-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AG-12549 Selection API codemods (#87)
* fix create-transform task * add grid options codemod for v32.2 * fix simple js test * wip * codemods for selection properties * add tests * warn on unimplemented transformations * rename scenario * add comments, tidy, reduce type casting * uncommit * missing manifest * update test * Increment package version * test case for deprecated colDef props * pre-compute the value and exit early if no valid transformation
- Loading branch information
1 parent
495eabc
commit afdbb99
Showing
76 changed files
with
1,463 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"private": true, | ||
"name": "@ag-grid-devtools/cli", | ||
"version": "32.0.7", | ||
"version": "32.2.0", | ||
"license": "MIT", | ||
"description": "AG Grid developer toolkit", | ||
"author": "AG Grid <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
packages/cli/src/codemods/plugins/transform-grid-api-methods/plugin.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"name": "Transform Grid API methods", | ||
"description": "Transform deprecated Grid API method invocations", | ||
"template": "../../../templates/plugin-transform-grid-api-methods" | ||
"description": "Transform deprecated Grid API method invocations" | ||
} |
3 changes: 1 addition & 2 deletions
3
packages/cli/src/codemods/plugins/transform-grid-options/plugin.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"name": "Transform Grid options", | ||
"description": "Transform deprecated Grid options", | ||
"template": "../../../templates/plugin-transform-grid-options" | ||
"description": "Transform deprecated Grid options" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/cli/src/codemods/transforms/transform-grid-options-v32-2/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# `transform-grid-options-v32-2` | ||
|
||
> _Transform deprecated Grid options_ | ||
See the [`transform-grid-options`](../../plugins/transform-grid-options/) plugin for usage instructions. | ||
|
||
## Common tasks | ||
|
||
### Add a test case | ||
|
||
Create a new unit test scenario for this transform: | ||
|
||
``` | ||
pnpm run task:create-test --type transform --target transform-grid-options-v32-2 | ||
``` | ||
|
||
### Add a new rule | ||
|
||
Replacement rules are specified in [`replacements.ts`](./replacements.ts) | ||
|
||
### Add to a codemod release | ||
|
||
Add this source code transformation to a codemod release: | ||
|
||
``` | ||
pnpm run task:include-transform --transform transform-grid-options-v32-2 | ||
``` |
50 changes: 50 additions & 0 deletions
50
...s/transform-grid-options-v32-2/__fixtures__/scenarios/angular/warnings/input.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// @ts-nocheck | ||
import { AdvancedFilterModel, ColDef, ColGroupDef, GridReadyEvent } from '@ag-grid-community/core'; | ||
import { AgGridAngular } from '@ag-grid-community/angular'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { IOlympicData } from './interfaces'; | ||
|
||
@Component({ | ||
selector: 'my-app', | ||
template: `<div> | ||
<ag-grid-angular | ||
[columnDefs]="columnDefs" | ||
[rowData]="rowData" | ||
[rowSelection]="single" | ||
[suppressRowClickSelection]="true" | ||
[suppressRowDeselection]="true" | ||
[isRowSelectable]="true" | ||
[rowMultiSelectWithClick]="true" | ||
[groupSelectsChildren]="true" | ||
[groupSelectsFiltered]="true" | ||
[enableRangeSelection]="true" | ||
[suppressMultiRangeSelection]="true" | ||
[suppressClearOnFillReduction]="true" | ||
[enableRangeHandle]="true" | ||
[enableFillHandle]="true" | ||
[fillHandleDirection]="true" | ||
[fillOperation]="fillOperation($params)" | ||
[suppressCopyRowsToClipboard]="true" | ||
[suppressCopySingleCellRanges]="true" | ||
(gridReady)="onGridReady($event)" | ||
></ag-grid-angular> | ||
</div>`, | ||
}) | ||
export class AppComponent { | ||
@ViewChild(AgGridAngular) private grid!: AgGridAngular; | ||
public columnDefs: (ColDef | ColGroupDef)[] = []; | ||
public rowData!: IOlympicData[]; | ||
|
||
constructor(private http: HttpClient) { | ||
} | ||
|
||
onGridReady(params: GridReadyEvent<IOlympicData>) { | ||
this.http | ||
.get<IOlympicData[]>('https://www.ag-grid.com/example-assets/olympic-winners.json') | ||
.subscribe((data) => { | ||
this.rowData = data; | ||
console.log("Hello, world!"); | ||
}); | ||
} | ||
} |
Oops, something went wrong.