@linzjs/step-ag-grid 34.0.1 → 34.0.3

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": "34.0.1",
5
+ "version": "34.0.3",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -33,8 +33,8 @@
33
33
  "react-dom": ">=18"
34
34
  },
35
35
  "dependencies": {
36
- "ag-grid-community": "34.3.1",
37
- "ag-grid-react": "34.3.1",
36
+ "ag-grid-community": "35.3.1",
37
+ "ag-grid-react": "35.3.1",
38
38
  "clsx": "^2.1.1",
39
39
  "debounce-promise": "^3.1.2",
40
40
  "matcher": "^6.0.0",
@@ -43,14 +43,14 @@
43
43
  "usehooks-ts": "^3.1.1"
44
44
  },
45
45
  "scripts": {
46
- "build": "node --eval \"fs.mkdirSync('./dist', { recursive: true })\" && run-s clean lintall css bundle",
47
- "yalc": "run-s clean css bundle && yalc push",
46
+ "build": "node --eval \"fs.mkdirSync('./dist', { recursive: true })\" && npm run clean && npm run lintall && npm run css && npm run bundle",
47
+ "yalc": "npm run clean && npm run css && npm run bundle && yalc push",
48
48
  "clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
49
49
  "bundle": "tsc -p tsconfig.json && rollup -c",
50
50
  "css": "sass ./src/styles/index.scss:dist/index.css --no-source-map",
51
51
  "test": "cross-env vitest run",
52
52
  "test:watch": "vitest --watch",
53
- "lintall": "run-s lint:oxlint",
53
+ "lintall": "oxlint ./src",
54
54
  "lint:oxlint": "oxlint ./src",
55
55
  "lint:fix": "oxlint ./src --fix",
56
56
  "format": "oxfmt --write ./src",
@@ -59,8 +59,7 @@
59
59
  "build-storybook": "storybook build",
60
60
  "deploy-storybook": "npx --yes -p @storybook/storybook-deployer storybook-to-ghpages",
61
61
  "chromatic": "chromatic --exit-zero-on-changes",
62
- "update": "npx npm-check-updates -i --format group -c 7d",
63
- "prepare": "husky"
62
+ "update": "npx npm-check-updates -i --format group -c 7d"
64
63
  },
65
64
  "browserslist": {
66
65
  "production": [
@@ -75,53 +74,46 @@
75
74
  ]
76
75
  },
77
76
  "devDependencies": {
78
- "@chromatic-com/storybook": "^5.3.1",
79
- "@linzjs/lui": "^27.0.0",
80
- "@linzjs/windows": "^16.1.0",
77
+ "@chromatic-com/storybook": "^5.4.0",
78
+ "@linzjs/lui": "^30.1.0",
79
+ "@linzjs/windows": "^16.2.0",
81
80
  "@rollup/plugin-commonjs": "^29.0.3",
82
81
  "@rollup/plugin-json": "^6.1.0",
83
82
  "@rollup/plugin-node-resolve": "^16.0.3",
84
- "rollup-plugin-esbuild": "^6.2.1",
85
- "@storybook/addon-docs": "^10.6.0",
86
- "@storybook/addon-links": "^10.6.0",
87
- "@storybook/react-vite": "^10.6.0",
88
- "@testing-library/dom": "^10.4.1",
83
+ "@storybook/addon-docs": "^10.6.1",
84
+ "@storybook/addon-links": "^10.6.1",
85
+ "@storybook/react-vite": "^10.6.1",
86
+ "@testing-library/dom": "^10.4.2",
89
87
  "@testing-library/react": "16.3.3",
90
88
  "@testing-library/user-event": "^14.6.7",
91
89
  "@types/debounce-promise": "^3.1.9",
92
90
  "@types/jest": "^30.0.0",
93
91
  "@types/jsdom": "^28.0.3",
94
92
  "@types/lodash-es": "^4.17.12",
95
- "@types/node": "^24.13.3",
93
+ "@types/node": "^24.19.0",
96
94
  "@types/react": "^18.3.31",
97
95
  "@types/react-dom": "^18.3.7",
98
- "@vitejs/plugin-react": "6.1.1",
96
+ "@vitejs/plugin-react": "6.1.2",
99
97
  "@vitest/ui": "^4.1.11",
100
98
  "chromatic": "^17.8.0",
101
99
  "cross-env": "^10.1.0",
102
- "husky": "^9.1.7",
103
- "jsdom": "29.1.1",
100
+ "jsdom": "^30.1.2",
104
101
  "lodash-es": "^4.18.1",
105
- "npm-run-all": "^4.1.5",
106
- "oxfmt": "^0.67.0",
107
- "oxlint": "^1.82.0",
108
- "postcss": "^8.5.28",
102
+ "oxfmt": "^0.72.0",
103
+ "oxlint": "^1.87.0",
104
+ "postcss": "^8.5.29",
109
105
  "postcss-scss": "^4.0.9",
110
106
  "react": ">=19",
111
- "react-dom": "^19.2.8",
112
- "rollup": "4.63.1",
107
+ "react-dom": "^19.3.0",
108
+ "rollup": "^4.64.0",
113
109
  "rollup-plugin-copy": "^3.5.0",
110
+ "rollup-plugin-esbuild": "^6.2.1",
114
111
  "rollup-plugin-peer-deps-external": "^2.2.4",
115
112
  "rollup-plugin-postcss": "^4.0.2",
116
- "sass": "^1.104.0",
117
- "storybook": "^10.6.0",
113
+ "sass": "^1.105.1",
114
+ "storybook": "^10.6.1",
118
115
  "typescript": "^7.0.2",
119
- "vite": "^8.2.2",
116
+ "vite": "^8.3.2",
120
117
  "vitest": "^4.1.11"
121
- },
122
- "husky": {
123
- "hooks": {
124
- "pre-commit": "npm run lint"
125
- }
126
118
  }
127
119
  }
@@ -7,7 +7,7 @@ import {
7
7
  ValueFormatterFunc,
8
8
  ValueFormatterParams,
9
9
  } from 'ag-grid-community';
10
- import { forwardRef, ReactElement, useContext } from 'react';
10
+ import { ReactElement, useContext } from 'react';
11
11
 
12
12
  import { GridPopoverContextProvider } from '../contexts/GridPopoverContextProvider';
13
13
  import { GridUpdatingContext } from '../contexts/GridUpdatingContext';
@@ -176,7 +176,7 @@ export interface CellEditorCommon {
176
176
 
177
177
  export const GenericCellEditorComponentWrapper = (editor?: (props: any) => ReactElement) => {
178
178
  const obj = { editor };
179
- return forwardRef(function GenericCellEditorComponentFr(cellEditorParams: ICellEditorParams, _) {
179
+ return function GenericCellEditorComponentFr(cellEditorParams: ICellEditorParams) {
180
180
  const valueFormatted = cellEditorParams.formatValue
181
181
  ? cellEditorParams.formatValue(cellEditorParams.value)
182
182
  : 'Missing formatter';
@@ -194,5 +194,5 @@ export const GenericCellEditorComponentWrapper = (editor?: (props: any) => React
194
194
  </>
195
195
  </GridPopoverContextProvider>
196
196
  );
197
- });
197
+ };
198
198
  };
@@ -71,10 +71,16 @@ export const usePostSortRowsHook = ({ setStaleGrid }: PostSortRowsHookProps) =>
71
71
  const equals = colDef.equals;
72
72
  sortColumnEquals[colId] = (a, b) => equals(a, b);
73
73
  } else if (colDef?.comparator) {
74
- const comparator = colDef.comparator;
75
- // isDescending doesn't matter here - we only care whether the comparator considers the two
76
- // values equivalent (0), not which direction they'd sort in.
77
- sortColumnEquals[colId] = (a, b, nodeA, nodeB) => comparator(a, b, nodeA, nodeB, false) === 0;
74
+ // comparator may be a single function or a map of comparators per SortType (e.g. 'default'/'absolute') -
75
+ // use the function form directly, or the 'default' entry from the map.
76
+ const comparator = typeof colDef.comparator === 'function' ? colDef.comparator : colDef.comparator.default;
77
+ if (comparator) {
78
+ // isDescending doesn't matter here - we only care whether the comparator considers the two
79
+ // values equivalent (0), not which direction they'd sort in.
80
+ sortColumnEquals[colId] = (a, b, nodeA, nodeB) => comparator(a, b, nodeA, nodeB, false) === 0;
81
+ } else {
82
+ sortColumnEquals[colId] = (a, b) => a === b;
83
+ }
78
84
  } else {
79
85
  sortColumnEquals[colId] = (a, b) => a === b;
80
86
  }
@@ -181,7 +181,7 @@ export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMu
181
181
  />
182
182
  )}
183
183
  {headerGroups &&
184
- (isEmpty(headerGroups) || !toPairs(headerGroups).some(([_, options]) => !isEmpty(options))) && (
184
+ (isEmpty(headerGroups) || !toPairs(headerGroups).some(([, options]) => !isEmpty(options))) && (
185
185
  <MenuItem key={'noOptions'} className={'GridMultiSelect-noOptions'} disabled={true}>
186
186
  {props.noOptionsMessage ?? 'No Options'}
187
187
  </MenuItem>
@@ -342,7 +342,7 @@ const FilterInput = (props: {
342
342
  return (
343
343
  <>
344
344
  <FocusableItem className={'filter-item'} key={'filter'}>
345
- {(_: any) => (
345
+ {() => (
346
346
  <div style={{ width: '100%' }} className={'GridFormMultiSelect-filter'}>
347
347
  <input
348
348
  className={'LuiTextInput-input'}
@@ -73,8 +73,8 @@ export const GridFormTextInput = <TData extends GridBaseRow>(props: GridFormText
73
73
  setValue(e.target.value);
74
74
  }}
75
75
  error={invalid()}
76
+ width={props.width ?? 264}
76
77
  formatted={props.units}
77
- style={{ width: props.width ?? 240 }}
78
78
  placeholder={props.placeholder ?? 'Type here'}
79
79
  helpText={helpText}
80
80
  validationSummary={textInputValidatorPropsToSummary(props)}
@@ -2,13 +2,14 @@ import './TextInputFormatted.scss';
2
2
 
3
3
  import clsx from 'clsx';
4
4
  import { omit } from 'lodash-es';
5
- import { DetailedHTMLProps, InputHTMLAttributes, ReactElement } from 'react';
5
+ import { DetailedHTMLProps, InputHTMLAttributes, ReactElement, useLayoutEffect, useRef, useState } from 'react';
6
6
 
7
7
  import { FormError } from './FormError';
8
8
 
9
9
  export interface LuiTextInputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
10
10
  // overrides value in base class to be string type only
11
11
  value: string;
12
+ width?: string | number;
12
13
 
13
14
  // Custom fields
14
15
  helpText?: string;
@@ -18,7 +19,23 @@ export interface LuiTextInputProps extends DetailedHTMLProps<InputHTMLAttributes
18
19
  validationSummary?: string;
19
20
  }
20
21
 
22
+ // gap between the end of the typed text and the start of the formatted units label
23
+ const FORMATTED_GAP = 8;
24
+
21
25
  export const TextInputFormatted = (props: LuiTextInputProps): ReactElement => {
26
+ const formattedRef = useRef<HTMLSpanElement>(null);
27
+ const [formattedPadding, setFormattedPadding] = useState<number | undefined>(undefined);
28
+
29
+ useLayoutEffect(() => {
30
+ if (!props.formatted) {
31
+ setFormattedPadding(undefined);
32
+ return;
33
+ }
34
+ const formattedWidth = formattedRef.current?.offsetWidth ?? 0;
35
+ // right offset the formatted span sits at, see TextInputFormatted.scss
36
+ setFormattedPadding(formattedWidth + 14 + FORMATTED_GAP);
37
+ }, [props.formatted]);
38
+
22
39
  return (
23
40
  <div
24
41
  className={clsx(
@@ -26,6 +43,7 @@ export const TextInputFormatted = (props: LuiTextInputProps): ReactElement => {
26
43
  props.error && 'hasError',
27
44
  props.className,
28
45
  )}
46
+ style={{ width: props.width, ...props.style }}
29
47
  >
30
48
  <span className="LuiTextInput-inputWrapper">
31
49
  {/* wrapper div used for error styling */}
@@ -35,14 +53,17 @@ export const TextInputFormatted = (props: LuiTextInputProps): ReactElement => {
35
53
  defaultValue={props.value}
36
54
  {...omit(props, [
37
55
  'error',
56
+ 'width',
38
57
  'value',
39
58
  'helpText',
40
59
  'formatted',
41
60
  'className',
42
61
  'allowTabToSave',
43
62
  'validationSummary',
63
+ 'style',
44
64
  ])}
45
65
  className={'LuiTextInput-input'}
66
+ style={formattedPadding != null ? { paddingRight: formattedPadding } : undefined}
46
67
  onMouseEnter={(e) => {
47
68
  e.currentTarget.focus();
48
69
  props.onMouseEnter?.(e);
@@ -50,7 +71,9 @@ export const TextInputFormatted = (props: LuiTextInputProps): ReactElement => {
50
71
  data-allowtabtosave={props.allowTabToSave}
51
72
  data-validationsummary={props.validationSummary}
52
73
  />
53
- <span className={'LuiTextInput-formatted'}>{props.formatted}</span>
74
+ <span className={'LuiTextInput-formatted'} ref={formattedRef}>
75
+ {props.formatted}
76
+ </span>
54
77
  </span>
55
78
 
56
79
  <FormError error={props.error} helpText={props.helpText} />
@@ -181,11 +181,24 @@ const GridReadOnlyTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<I
181
181
  [],
182
182
  );
183
183
 
184
- const [rowData] = useState<ITestRow[]>([
185
- { id: 1000, position: 'Tester', age: 30, height: `6'4"`, desc: 'Tests application', dd: '1' },
186
- { id: 1001, position: 'Developer', age: 12, height: `5'3"`, desc: 'Develops application', dd: '2' },
187
- { id: 1002, position: 'Manager', age: 65, height: `5'9"`, desc: 'Manages', dd: '3' },
188
- ]);
184
+ const [rowData] = useState<ITestRow[]>(() => {
185
+ const positions = [
186
+ { position: 'Tester', desc: 'Tests application' },
187
+ { position: 'Developer', desc: 'Develops application' },
188
+ { position: 'Manager', desc: 'Manages' },
189
+ ];
190
+ return Array.from({ length: 50 }, (_, index) => {
191
+ const { position, desc } = positions[index % positions.length];
192
+ return {
193
+ id: 1000 + index,
194
+ position,
195
+ age: 20 + (index % 50),
196
+ height: `${5 + (index % 2)}'${index % 12}"`,
197
+ desc,
198
+ dd: `${index + 1}`,
199
+ };
200
+ });
201
+ });
189
202
 
190
203
  return (
191
204
  <GridWrapper maxHeight={400}>
@@ -19,6 +19,7 @@ const onSelectFilter = fn();
19
19
  const five = <div>Five</div>;
20
20
  let options: MultiSelectGridOption[] = [];
21
21
  const Template: StoryFn<typeof GridFormMultiSelectGrid> = (props: GridFormMultiSelectGridProps<any>) => {
22
+ // eslint-disable-next-line react/globals
22
23
  options = [
23
24
  { label: 'Zero', value: 0 },
24
25
  { label: 'One', value: 1 },
@@ -19,6 +19,7 @@ const onSelectFilter = fn();
19
19
 
20
20
  let options: MultiSelectOption[] = [];
21
21
  const Template: StoryFn<typeof GridFormMultiSelect> = (props: GridFormMultiSelectProps<any>) => {
22
+ // eslint-disable-next-line react/globals
22
23
  options = [
23
24
  { label: 'Zero', value: 0 },
24
25
  { label: 'One', value: 1 },
@@ -9,6 +9,7 @@ const Template = (props: GridFormTextInputProps<any>) => {
9
9
  ['Text input', {}],
10
10
  ['Text input with text', {}, 'Some text'],
11
11
  ['Text input with error & placeholder', { required: true, placeholder: 'Custom placeholder' }],
12
+ ['Text input with units', { units: 'km/h', maxLength: 1 }, '123456789'],
12
13
  ];
13
14
  // eslint-disable-next-line react-hooks/rules-of-hooks
14
15
  const anchorRefs = configs.map(() => useRef<HTMLHeadingElement>(null));