From a5a3d78171637337d359963a1f7aa7289b82acce Mon Sep 17 00:00:00 2001 From: Stephen Cooper Date: Fri, 23 Jan 2026 10:04:31 +0000 Subject: [PATCH 1/2] AG-16620 Fix examples (#12955) * AG-16620 Fix examples * Fix valueFormatter --- .../formula-editor-component-disabled/main.ts | 21 ++++++++----------- .../formula-editor-component/main.ts | 21 ++++++++----------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component-disabled/main.ts b/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component-disabled/main.ts index 37bdaeb8e24..56ccb09fa30 100644 --- a/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component-disabled/main.ts +++ b/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component-disabled/main.ts @@ -1,4 +1,4 @@ -import type { ColDef, GetRowIdParams, GridApi, GridOptions, ValueFormatterParams } from 'ag-grid-community'; +import type { GetRowIdParams, GridApi, GridOptions, ValueFormatterParams } from 'ag-grid-community'; import { ClientSideRowModelModule, ModuleRegistry, @@ -19,19 +19,16 @@ ModuleRegistry.registerModules([ let gridApi: GridApi; -const valueFormatter = ({ value }: ValueFormatterParams) => `$ ${Number(value).toFixed(2)}`; -const getRowId = (params: GetRowIdParams) => String(params.data.id); - -const columnDefs: ColDef[] = [ - { field: 'item' }, - { field: 'price', valueFormatter }, - { field: 'qty' }, - { field: 'total', allowFormula: true, cellEditor: 'agTextCellEditor', valueFormatter }, -]; +const currencyFormatter = ({ value }: ValueFormatterParams) => `$ ${Number(value).toFixed(2)}`; const gridOptions: GridOptions = { - columnDefs, - getRowId, + columnDefs: [ + { field: 'item' }, + { field: 'price', valueFormatter: currencyFormatter }, + { field: 'qty' }, + { field: 'total', allowFormula: true, cellEditor: 'agTextCellEditor', valueFormatter: currencyFormatter }, + ], + getRowId: (params: GetRowIdParams) => String(params.data.id), defaultColDef: { editable: true, flex: 1, diff --git a/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component/main.ts b/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component/main.ts index 374d32c62b7..e112d8bdca4 100644 --- a/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component/main.ts +++ b/documentation/ag-grid-docs/src/content/docs/formula-editor-component/_examples/formula-editor-component/main.ts @@ -1,4 +1,4 @@ -import type { ColDef, GetRowIdParams, GridApi, GridOptions, ValueFormatterParams } from 'ag-grid-community'; +import type { GetRowIdParams, GridApi, GridOptions, ValueFormatterParams } from 'ag-grid-community'; import { ClientSideRowModelModule, ModuleRegistry, @@ -20,19 +20,16 @@ ModuleRegistry.registerModules([ let gridApi: GridApi; -const valueFormatter = ({ value }: ValueFormatterParams) => `$ ${Number(value).toFixed(2)}`; -const getRowId = (params: GetRowIdParams) => String(params.data.id); - -const columnDefs: ColDef[] = [ - { field: 'item' }, - { field: 'price', valueFormatter }, - { field: 'qty' }, - { field: 'total', allowFormula: true, valueFormatter }, -]; +const currencyFormatter = ({ value }: ValueFormatterParams) => `$ ${Number(value).toFixed(2)}`; const gridOptions: GridOptions = { - columnDefs, - getRowId, + columnDefs: [ + { field: 'item' }, + { field: 'price', valueFormatter: currencyFormatter }, + { field: 'qty' }, + { field: 'total', allowFormula: true, valueFormatter: currencyFormatter }, + ], + getRowId: (params: GetRowIdParams) => String(params.data.id), cellSelection: { handle: { mode: 'fill', From 424f4a90ff00b195e21d23e1b0ed1b06b7d3108b Mon Sep 17 00:00:00 2001 From: Stephen Cooper Date: Fri, 23 Jan 2026 11:19:21 +0000 Subject: [PATCH 2/2] Fix threshold reporting (#12958) --- scripts/ci/compare-module-sizes.mjs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/ci/compare-module-sizes.mjs b/scripts/ci/compare-module-sizes.mjs index 74adf45f600..456e0e6520e 100644 --- a/scripts/ci/compare-module-sizes.mjs +++ b/scripts/ci/compare-module-sizes.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node import fs from 'node:fs'; -const THRESHOLD_PERCENT = 0.5; // Ignore changes below this percentage +const THRESHOLD = 0.5; // Ignore changes below this size change const HIGHLIGHT_PERCENT = 5; // Highlight table rows when change exceeds this percentage /** @@ -169,7 +169,7 @@ const maxIncrease = diffs.reduce((max, d) => (d.selfSizeDiff > max.selfSizeDiff const maxDecrease = diffs.reduce((min, d) => (d.selfSizeDiff < min.selfSizeDiff ? d : min), diffs[0]); // Filter significant changes -const significantChanges = diffs.filter((d) => Math.abs(d.selfSizePercent) >= THRESHOLD_PERCENT); +const significantChanges = diffs.filter((d) => Math.abs(d.selfSizeDiff) >= THRESHOLD); // Generate markdown report let report = ''; @@ -180,8 +180,8 @@ report += '## Module Size Comparison\n\n'; // Extremes section - only show if change is >= THRESHOLD_PERCENT report += '### Extreme Values\n\n'; -const showMaxIncrease = maxIncrease && maxIncrease.selfSizePercent >= THRESHOLD_PERCENT; -const showMaxDecrease = maxDecrease && maxDecrease.selfSizePercent <= -THRESHOLD_PERCENT; +const showMaxIncrease = maxIncrease && maxIncrease.selfSizeDiff >= THRESHOLD; +const showMaxDecrease = maxDecrease && maxDecrease.selfSizeDiff <= -THRESHOLD; if (showMaxIncrease) { const moduleName = maxIncrease.modules.length === 0 ? 'Base (no modules)' : maxIncrease.modules.join(', '); @@ -196,12 +196,12 @@ if (showMaxDecrease) { } if (!showMaxIncrease && !showMaxDecrease) { - report += `✅ No significant changes (all changes < ${THRESHOLD_PERCENT}%)\n\n`; + report += `✅ No significant changes (all changes < ${THRESHOLD}KB)\n\n`; } // Significant changes table if (significantChanges.length > 0) { - report += `### Significant Changes (≥ ${THRESHOLD_PERCENT}%)\n\n`; + report += `### Significant Changes (≥ ${THRESHOLD}KB)\n\n`; report += '| Module(s) | Base (KB) | PR (KB) | Diff (KB) | Diff % | Base Gzip (KB) | PR Gzip (KB) | Gzip Diff (KB) | Gzip % |\n'; report += @@ -230,7 +230,7 @@ if (significantChanges.length > 0) { report += '\n'; } else { report += '### Significant Changes\n\n'; - report += `✅ No modules changed by more than ${THRESHOLD_PERCENT}%.\n\n`; + report += `✅ No modules changed by more than ${THRESHOLD}KB.\n\n`; } // New/Removed modules @@ -302,7 +302,7 @@ console.log(`Comparison report written to ${outputFile}`); // Output summary for CI console.log('\n--- Summary ---'); -console.log(`Significant changes (>= ${THRESHOLD_PERCENT}%): ${significantChanges.length}`); +console.log(`Significant changes (>= ${THRESHOLD}KB): ${significantChanges.length}`); if (showMaxIncrease) { const moduleName = maxIncrease.modules.length === 0 ? 'Base (no modules)' : maxIncrease.modules.join(', '); console.log( @@ -316,5 +316,5 @@ if (showMaxDecrease) { ); } if (!showMaxIncrease && !showMaxDecrease) { - console.log(`No significant module size changes detected (all < ${THRESHOLD_PERCENT}%).`); + console.log(`No significant module size changes detected (all < ${THRESHOLD}KB).`); }