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

Bump ag-grid to version 33.0.4 #355

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
137 changes: 102 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"ag-grid-community": "31.3.2",
"ag-grid-enterprise": "31.3.2",
"ag-grid-react": "31.3.2",
"ag-grid-community": "33.0.4",
"ag-grid-enterprise": "33.0.4",
"ag-grid-react": "33.0.4",
"@mui/icons-material": "^5.15.7",
"@mui/material": "^5.15.7",
"d3-format": "^3.1.0",
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/AgGrid.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export default class DashAgGrid extends Component {
}

DashAgGrid.defaultProps = {
className: 'ag-theme-alpine',
resetColumnState: false,
exportDataAsCsv: false,
selectAll: false,
Expand Down
9 changes: 3 additions & 6 deletions src/lib/fragments/AgGrid.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,9 @@ import RowMenuRenderer from '../renderers/rowMenuRenderer';
import {customFunctions} from '../renderers/customFunctions';

import {AgGridReact} from 'ag-grid-react';
import {AllCommunityModule, ModuleRegistry} from 'ag-grid-community';

import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-alpine.css';
import 'ag-grid-community/styles/ag-theme-balham.css';
import 'ag-grid-community/styles/ag-theme-material.css';
import 'ag-grid-community/styles/ag-theme-quartz.css';
ModuleRegistry.registerModules([AllCommunityModule]);

// d3 imports
import * as d3Format from 'd3-format';
Expand Down Expand Up @@ -1149,7 +1146,7 @@ export default class DashAgGrid extends Component {
cellRendererData: {
value,
colId: props.column.colId,
rowIndex: props.rowIndex,
rowIndex: props.node.sourceRowIndex,
rowId: props.node.id,
timestamp: Date.now(),
},
Expand Down
8 changes: 7 additions & 1 deletion src/lib/fragments/AgGridEnterprise.react.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React, {Component} from 'react';
import {LicenseManager} from 'ag-grid-enterprise';
import {
LicenseManager,
AllEnterpriseModule,
ModuleRegistry,
} from 'ag-grid-enterprise';
import DashAgGrid, {propTypes} from './AgGrid.react';

ModuleRegistry.registerModules([AllEnterpriseModule]);

export default class DashAgGridEnterprise extends Component {
render() {
const {licenseKey} = this.props;
Expand Down
1 change: 1 addition & 0 deletions src/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AgGrid, {getApi, getApiAsync} from './components/AgGrid.react';

export {AgGrid, getApi, getApiAsync};
export {useGridFilter} from 'ag-grid-react';
2 changes: 2 additions & 0 deletions src/lib/utils/propCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ export const PROPS_NOT_FOR_AG_GRID = [
'selectAll',
'deselectAll',
'deleteSelectedRows',
'selectedRows',
'paginationInfo',
'rowTransaction',
'updateColumnState',
'csvExportParams',
Expand Down
28 changes: 13 additions & 15 deletions tests/assets/dashAgGridFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,28 +184,26 @@ const {useImperativeHandle, useState, useEffect, forwardRef} = React;
dagfuncs.YearFilter = forwardRef((props, ref) => {
const [year, setYear] = useState('All');

useImperativeHandle(ref, () => {
return {
doesFilterPass(params) {
return params.data.year >= 2010;
},
dash_ag_grid.useGridFilter({
doesFilterPass(params) {
return params.data.year >= 2010;
},

isFilterActive() {
return year === '2010'
},
isFilterActive() {
return year === '2010'
},

// this example isn't using getModel() and setModel(),
// so safe to just leave these empty. don't do this in your code!!!
getModel() {
},
// this example isn't using getModel() and setModel(),
// so safe to just leave these empty. don't do this in your code!!!
getModel() {
},

setModel() {
}
setModel() {
}
});

useEffect(() => {
props.filterChangedCallback()
props.onModelChange(year === "All" ? null : year)
}, [year]);

setProps = ({value}) => {
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cell_value_changed.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def test_cv001_cell_value_changed(dash_duo):
columnDefs=[{"field": "Key", "checkboxSelection": True}]
+ [{"field": i} for i in ["Column", "OldValue", "NewValue"]],
rowData=[],
dashGridOptions={
"rowSelection": {"mode": "singleRow"},
},
),
],
style={"margin": 20},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_custom_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_fi003_custom_filter(dash_duo):

grid.wait_for_cell_text(0, 0, "23")

dash_duo.find_element('.ag-header-cell[aria-colindex="3"] .ag-icon-menu').click()
dash_duo.find_element('.ag-header-cell[aria-colindex="3"] .ag-header-cell-filter-button').click()

dash_duo.find_element('.ag-filter label:nth-child(2)').click()

Expand Down
6 changes: 4 additions & 2 deletions tests/test_dangerous_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def test_dt002_dangerous_templates(dash_duo):
"field": "company",
},
{
"headerComponentParams": {"template": "<div>Testing</div>"},
"headerComponentParams": {
"template": '<div data-ref="eLabel">[<span data-ref="eText"></span>]</div>'
},
"field": "price",
"valueFormatter": {"function": """d3.format("($,.2f")(params.value)"""},
},
Expand Down Expand Up @@ -122,4 +124,4 @@ def loadBlank(n):
)
dash_duo.find_element("#loadBlank").click()
dash_duo.wait_for_text_to_equal(".ag-overlay-no-rows-wrapper", "whoops no info")
assert grid.get_header_cell(2).text == "Testing"
assert grid.get_header_cell(2).text == "[Price]"
2 changes: 1 addition & 1 deletion tests/test_grid_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_ga001_grid_apis(dash_duo):
app.clientside_callback(
"""function (n) {
if (n) {
dash_ag_grid.getApi('grid').setColumnVisible("price", false)
dash_ag_grid.getApi('grid').setColumnsVisible(["price"], false)
}
return dash_clientside.no_update
}""",
Expand Down
3 changes: 3 additions & 0 deletions tests/test_scroll_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def update_scrollTo(n_clicks):
return scroll_to_inputs[n_clicks - 1]

dash_duo.start_server(app)
dash_duo.driver.set_window_size(1000, 800)

grid = utils.Grid(dash_duo, "grid")

action = utils.ActionChains(dash_duo.driver)
Expand Down Expand Up @@ -231,6 +233,7 @@ def reset_columnState(n, s):
return state

dash_duo.start_server(app)
dash_duo.driver.set_window_size(1000, 800)

grid = utils.Grid(dash_duo, "grid")
until(lambda: "1" == grid.get_cell(2000, 9).text, timeout=3)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_user_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def test_us001_user_style(dash_duo):
grid.wait_for_cell_text(0, 0, "Toyota")
until(
lambda: "height: 500px"
in dash_duo.find_element("div.ag-theme-alpine").get_attribute("style"),
in dash_duo.find_element("#grid").get_attribute("style"),
timeout=3,
)
until(
lambda: "width: 500px"
in dash_duo.find_element("div.ag-theme-alpine").get_attribute("style"),
in dash_duo.find_element("#grid").get_attribute("style"),
timeout=3,
)