Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid upgrade #3395

Merged
merged 5 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
requires `hoist-core >= v16.3.0`).
* Added bindable `readonly` property to `LeftRightChooserModel`.


### ⚙️ Technical
* Support the `HOIST_IMPERSONATOR` role introduced in hoist-core `v16.3.0`
* Hoist now supports and requires ag-Grid v30 or higher. This version includes critical
performance improvements to scrolling without the problematic 'ResizeObserver' issues discussed
below.

### 🐞 Bug Fixes

* Fixed a bug where Onsen components wrappers could not forward refs.
* Improved the exceptions thrown by fetchService when errors occur parsing response JSON.

Expand Down
2 changes: 1 addition & 1 deletion cmp/grid/columns/Column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export interface ColumnSpec {
* User-facing text/element displayed in the Column header, or a function to produce the same.
* Defaulted from `displayName`.
*/
headerName?: ColumnHeaderNameFn | ReactNode;
headerName?: ColumnHeaderNameFn | string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's undo this change, headerName can be ReactNode again


/** Tooltip text for grid header.*/
headerTooltip?: string;
Expand Down
11 changes: 8 additions & 3 deletions cmp/grid/columns/ColumnGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ export class ColumnGroup {
const {headerName, gridModel} = this;
return {
groupId: this.groupId,
headerValueGetter: agParams =>
isFunction(headerName)
headerValueGetter: agParams => {
// headerValueGetter should always return a string
// for display in draggable shadow box, aGrid Tool panel.
// Hoist ColumnHeader will handle display of Element values in the header.
const ret = isFunction(headerName)
? headerName({columnGroup: this, gridModel, agParams})
: headerName,
: headerName;
return isString(ret) ? ret : genDisplayName(this.groupId);
lbwexler marked this conversation as resolved.
Show resolved Hide resolved
},
headerClass: getAgHeaderClassFn(this),
headerGroupComponentParams: {gridModel, xhColumnGroup: this},
children: this.children.map(it => it.getAgSpec()),
Expand Down
10 changes: 5 additions & 5 deletions desktop/cmp/grid/editors/impl/InlineEditorModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {bindable, makeObservable} from '@xh/hoist/mobx';
import {wait} from '@xh/hoist/promise';
import {createObservableRef} from '@xh/hoist/utils/react';
import classNames from 'classnames';
import {isNil} from 'lodash';
import {ForwardedRef, ReactElement, useImperativeHandle} from 'react';

/**
Expand Down Expand Up @@ -97,11 +96,12 @@ class InlineEditorModel extends HoistModel {

inputEl.focus();

const {charPress} = this.agParams;
if (isNil(charPress)) {
inputEl.select();
const {eventKey} = this.agParams;
// Enter initial keystroke in value (if single char and not special key e.g (F2 or Enter).
if (eventKey?.length == 1) {
ref.current.noteValueChange(eventKey);
} else {
ref.current.noteValueChange(charPress);
inputEl.select();
}
}

Expand Down
4 changes: 2 additions & 2 deletions kit/ag-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export type {
ColumnGroup as AgColumnGroup
} from '@ag-grid-community/core';

const MIN_VERSION = '29.1.0';
const MAX_VERSION = '29.*.*';
const MIN_VERSION = '30.0.0';
const MAX_VERSION = '30.*.*';

/**
* Expose application versions of ag-Grid to Hoist.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@ag-grid-community/client-side-row-model": "29.x",
"@ag-grid-community/core": "29.x",
"@ag-grid-community/react": "29.x",
"@ag-grid-community/client-side-row-model": "30.x",
"@ag-grid-community/core": "30.x",
"@ag-grid-community/react": "30.x",
"@xh/hoist-dev-utils": "^6.2.0",
"eslint-config-prettier": "8.x",
"eslint-plugin-tsdoc": "^0.2.17",
Expand Down
32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
# yarn lockfile v1


"@ag-grid-community/client-side-row-model@29.x":
version "29.3.5"
resolved "https://registry.yarnpkg.com/@ag-grid-community/client-side-row-model/-/client-side-row-model-29.3.5.tgz#3895a778195bca17f86d0e7f90f80b207a283d8e"
integrity sha512-+uA28LTAummyYdZbEDys+cTECPn1Po1f6vX9QZOK9gpZdNzSpGjd3Vc1SKR/2brR6XMGlPeSRsX+FPZmG9uvHQ==
dependencies:
"@ag-grid-community/core" "~29.3.5"

"@ag-grid-community/core@29.x", "@ag-grid-community/core@~29.3.5":
version "29.3.5"
resolved "https://registry.yarnpkg.com/@ag-grid-community/core/-/core-29.3.5.tgz#f6fd10f5a612290c4dfbc8a78adc2af587008c99"
integrity sha512-r86bOCscnKVtaYyKqlN2UCtfbjf4UcmxHfVuXzJ94iN8Jy3iiQVrbQnbNArnjR589Bt/1VR/m+SdAMsOLcdpag==

"@ag-grid-community/react@29.x":
version "29.3.5"
resolved "https://registry.yarnpkg.com/@ag-grid-community/react/-/react-29.3.5.tgz#e5f6ef9942b0ad5f550c2d2d82834b04978a554d"
integrity sha512-vetngHiWXptSsWLaXtmr89zaBKEIAUpl+P+QGup27oYiqjTtdZKAgT2lowZZOQ7dFxsjb1OxDOtmOZrZGxuMUw==
"@ag-grid-community/client-side-row-model@30.x":
version "30.0.0"
resolved "https://registry.yarnpkg.com/@ag-grid-community/client-side-row-model/-/client-side-row-model-30.0.0.tgz#5c3ee15f5d245240422f4d24fd5109160b6f9ea3"
integrity sha512-Mzqhf6ymVKQ8xjBAubYIE61mIBaS8CZkgA5mychiHyE5hApkJxKoytFMZFQt4y0dabRbjkKvwD60zLiEnoOJiQ==
dependencies:
"@ag-grid-community/core" "~30.0.0"

"@ag-grid-community/core@30.x", "@ag-grid-community/core@~30.0.0":
version "30.0.0"
resolved "https://registry.yarnpkg.com/@ag-grid-community/core/-/core-30.0.0.tgz#071aab3c5221bb002e6afc8e69749fc2edc5ff18"
integrity sha512-/yBAxXxVYrJvjSd+hVA3Qhb46WpPph/9p11KHL6gZdWVMODu6GbRUiEz5OhIxitoU3mrlzWc+r8JaUtKCYvdDg==

"@ag-grid-community/react@30.x":
version "30.0.0"
resolved "https://registry.yarnpkg.com/@ag-grid-community/react/-/react-30.0.0.tgz#2d38a37d5203a17d7427d7a2644e3311a60922ab"
integrity sha512-KLTDS74nFC6m6YPP6b6mot8utcqQvZXrrcCxZP91K5/mM1hyvr8CAjLlDepFqE5d5drPSIpXIQNYraNqHMhn5Q==
dependencies:
prop-types "^15.8.1"

Expand Down