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

AG-12929 Update for 32.2.1 #89

Merged
merged 7 commits into from
Sep 27, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,15 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
initializer = createSiblingPropertyInitializer(rootNode, rootAccessor);
}
if (!initializer) return;
const newObj = initializer.get('value');
let newObj = initializer.get('value');
if (!newObj.isObjectExpression()) {
// overwrite value with a new object expression
const [transformed] = initializer.replaceWith(
t.objectProperty(initializer.node.key, t.objectExpression([])),
);
initializer = transformed;
newObj = initializer.get('value') as NodePath<ObjectExpression>;
}
if (!newObj.isObjectExpression()) return;
rootNode = newObj;

Expand All @@ -787,6 +795,10 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
}
}

const key = node.get('key');
if (key.isIdentifier() && key.node.name === path[0]) {
return;
}
node.remove();
},

Expand Down Expand Up @@ -859,9 +871,24 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
if (!rootSibling) return;

// Fish out the reference to the object expression
const jsxExpressionContainer = rootSibling?.get('value');
if (!jsxExpressionContainer?.isJSXExpressionContainer()) return;
const objExp = jsxExpressionContainer.get('expression');
const jsxAttributeValue = rootSibling?.get('value');
let objExp: NodePath<Expression | JSXEmptyExpression>;
if (jsxAttributeValue?.isJSXExpressionContainer()) {
objExp = jsxAttributeValue.get('expression');
if (!objExp.isObjectExpression()) {
// overwrite value with a new object expression
const [transformed] = objExp.replaceWith(t.objectExpression([]));
objExp = transformed;
}
} else if (jsxAttributeValue?.isStringLiteral()) {
// overwrite value with a new object expression
const [transformed] = jsxAttributeValue.replaceWith(
t.jsxExpressionContainer(t.objectExpression([])),
);
objExp = transformed.get('expression');
} else {
return;
}
if (!objExp.isObjectExpression()) return;

// This loop is doing largely the same thing as the loop in the `.init` transformer:
Expand All @@ -876,7 +903,15 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
initializer = createSiblingPropertyInitializer(rootNode, accessor);
}
if (!initializer) return;
const newObj = initializer.get('value');
let newObj = initializer.get('value');
if (!newObj.isObjectExpression()) {
// overwrite value with a new object expression
const [transformed] = initializer.replaceWith(
t.objectProperty(initializer.node.key, t.objectExpression([])),
);
initializer = transformed;
newObj = initializer.get('value') as NodePath<ObjectExpression>;
}
if (!newObj.isObjectExpression()) return;
rootNode = newObj;

Expand All @@ -886,6 +921,10 @@ export function migrateDeepProperty<S extends AstTransformContext<AstCliContext>
}
}

const key = node.get('name');
if (key.isJSXIdentifier() && key.node.name === path[0]) {
return;
}
node.remove();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { IOlympicData } from './interfaces';
[rowMultiSelectWithClick]="true"
[groupSelectsChildren]="true"
[groupSelectsFiltered]="true"
[enableRangeSelection]="true"
[cellSelection]="true"
[suppressMultiRangeSelection]="true"
[suppressClearOnFillReduction]="true"
[enableRangeHandle]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = [
new SyntaxError('The grid option "rowMultiSelectWithClick" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "groupSelectsChildren" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "groupSelectsFiltered" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "enableRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
new SyntaxError('The grid option "enableRangeHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: onRangeSelectionChanged,
onCellSelectionDeleteStart: foo,
onCellSelectionDeleteEnd: () => {},
enableRangeSelection: cellSelection,

cellSelection: cellSelection,
enableRangeHandle: isEnableRangeHandle(),
suppressMultiRangeSelection: suppressMultiRangeSelection,
suppressClearOnFillReduction,

suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction
}
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module.exports = [
new SyntaxError(`The grid option "enableRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | enableRangeSelection: cellSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "enableRangeHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | enableRangeHandle: isEnableRangeHandle(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressMultiRangeSelection: suppressMultiRangeSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressClearOnFillReduction,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressCopyRowsToClipboard: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: onRangeSelectionChanged,
onCellSelectionDeleteStart: foo,
onCellSelectionDeleteEnd: () => {},
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
mode: "cell",

handle: {
mode: "fill",
direction: getFillDirection(),
setFillValue: () => {console.log('filling')}
},
cellSelection: true,
enableFillHandle: true,
suppressMultiRangeSelection: suppressMultiRangeSelection,
suppressClearOnFillReduction,
fillHandleDirection: getFillDirection(),
fillOperation: () => {console.log('filling')},

suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction
}
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
module.exports = [
new SyntaxError(`The grid option "enableFillHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | enableFillHandle: true,
| ^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressMultiRangeSelection: suppressMultiRangeSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressClearOnFillReduction,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "fillHandleDirection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | fillHandleDirection: getFillDirection(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "fillOperation" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | fillOperation: () => {console.log('filling')},
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressCopyRowsToClipboard: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: onRangeSelectionChanged,
onCellSelectionDeleteStart: foo,
onCellSelectionDeleteEnd: () => {},
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
mode: "cell",

handle: {
mode: "range"
},
cellSelection: true,
enableRangeHandle: true,
suppressMultiRangeSelection: suppressMultiRangeSelection,
suppressClearOnFillReduction,

suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction
}
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
module.exports = [
new SyntaxError(`The grid option "enableRangeHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | enableRangeHandle: true,
| ^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressMultiRangeSelection: suppressMultiRangeSelection,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressClearOnFillReduction,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressCopyRowsToClipboard: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ const gridApi = createGrid(document.body, {
headerCheckboxSelection: true,
headerCheckboxSelectionCurrentPageOnly: true,
}],

rowData: [],

selection: {
rowSelection: {
mode: "multiRow"
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: () => {},
onCellSelectionDeleteStart: () => {},
onCellSelectionDeleteEnd: () => {},

rowSelection: {
mode: "multiRow",
isRowSelectable: (params) => params.data.year < 2007,
enableSelectionWithoutKeys: true
},

suppressRowClickSelection: true,
suppressRowDeselection: true,
groupSelectsChildren: true,
groupSelectsFiltered: true,
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
mode: "multiRow",
isRowSelectable: (params) => params.data.year < 2007,
enableMultiSelectWithClick: true
}
suppressCopySingleCellRanges: true
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ const gridApi = createGrid(document.body, {
onCellSelectionChanged: () => {},
onCellSelectionDeleteStart: () => {},
onCellSelectionDeleteEnd: () => {},
suppressRowClickSelection: true,
suppressRowDeselection: true,
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true,

selection: {
rowSelection: {
mode: "singleRow",
isRowSelectable: (params) => params.data.year < 2007
}
},

suppressRowClickSelection: true,
suppressRowDeselection: true,
suppressCopyRowsToClipboard: true,
suppressCopySingleCellRanges: true
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ function foo() {}
function MyComponent(props) {
return (
(<AgGridReact
columnDefs={[]}
rowData={[]}
onCellSelectionChanged={onRangeSelectionChanged}
onCellSelectionDeleteStart={foo}
onCellSelectionDeleteEnd={() => {}}
suppressCopyRowsToClipboard={true}
suppressCopySingleCellRanges={true}
selection={{
mode: "cell",
suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction,

handle: {
mode: "fill",
direction: 'x',
setFillValue: () => {console.log('filling')}
}
}} />)
columnDefs={[]}
rowData={[]}
onCellSelectionChanged={onRangeSelectionChanged}
onCellSelectionDeleteStart={foo}
onCellSelectionDeleteEnd={() => {}}
cellSelection={true}
suppressMultiRangeSelection={suppressMultiRangeSelection}
suppressClearOnFillReduction={suppressClearOnFillReduction}
enableFillHandle={true}
fillHandleDirection={'x'}
fillOperation={() => {console.log('filling')}}
suppressCopyRowsToClipboard={true}
suppressCopySingleCellRanges={true}
/>)
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
module.exports = [
new SyntaxError(`The grid option "suppressMultiRangeSelection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressMultiRangeSelection={suppressMultiRangeSelection}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressClearOnFillReduction" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressClearOnFillReduction={suppressClearOnFillReduction}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "enableFillHandle" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | enableFillHandle={true}
| ^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "fillHandleDirection" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | fillHandleDirection={'x'}
| ^^^^^^^^^^^^^^^^^^^^^^^^^`),new SyntaxError(`The grid option "fillOperation" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | fillOperation={() => {console.log('filling')}}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`),
new SyntaxError(`The grid option "suppressCopyRowsToClipboard" cannot be automatically migrated. Please refer to the migration guide for more details: https://ag-grid.com/javascript-data-grid/upgrading-to-ag-grid-32-2/

> | suppressCopyRowsToClipboard={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function foo() {}

function MyComponent (props) {
return (
<AgGridReact
<AgGridReact
columnDefs={[]}
rowData={[]}
onRangeSelectionChanged={onRangeSelectionChanged}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ function MyComponent (props) {
onCellSelectionChanged={onRangeSelectionChanged}
onCellSelectionDeleteStart={foo}
onCellSelectionDeleteEnd={() => {}}
suppressCopyRowsToClipboard={true}
suppressCopySingleCellRanges={true}
selection={{
mode: "cell",

handle: {
mode: "range"
},
cellSelection={true}
enableRangeHandle={true}
suppressMultiRangeSelection={suppressMultiRangeSelection}
suppressClearOnFillReduction={suppressClearOnFillReduction}

suppressMultiRanges: suppressMultiRangeSelection,
suppressClearOnFillReduction: suppressClearOnFillReduction
}} />)
suppressCopyRowsToClipboard={true}
suppressCopySingleCellRanges={true}
/>)
);
}
Loading