Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ag-grid-react

Package Overview
Dependencies
Maintainers
4
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ag-grid-react - npm Package Compare versions

Comparing version 20.1.1 to 20.2.0

lib/baseReactComponent.d.ts

54

gulpfile.js

@@ -6,3 +6,3 @@ const gulp = require('gulp');

const pkg = require('./package.json');
const tsConfig = 'tsconfig.json';
const tsConfig = 'tsconfig.build.json';

@@ -12,3 +12,3 @@ const headerTemplate = '// <%= pkg.name %> v<%= pkg.version %>\n';

gulp.task('default', ['commonjs', 'umd']);
gulp.task('default', ['commonjs', "umd"]);

@@ -18,3 +18,9 @@ gulp.task('commonjs', tscTask);

async function tscTask() {
const tsResult = await gulp.src('src/**/*.ts').pipe(tsProject());
const tsResult = await gulp.src(
[
'src/**/*.ts',
'!src/**/__tests__/**/*',
'!src/**/setupTests.ts'
]
).pipe(tsProject());

@@ -29,5 +35,5 @@ return merge([

gulp.watch([
'./src/*',
'./node_modules/ag-grid-community/dist/lib/**/*'],
['commonjs']);
'./src/*',
'./node_modules/ag-grid-community/dist/lib/**/*'],
['commonjs']);
});

@@ -42,21 +48,21 @@

gulp.task('umd', () => rollup({
input: './src/main.ts',
rollup: require('rollup'),
output: {
name: 'AgGridReact',
file: 'my-file.umd.js',
format: 'umd',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes',
'ag-grid-community': 'agGrid'
input: './src/main.ts',
rollup: require('rollup'),
output: {
name: 'AgGridReact',
file: 'my-file.umd.js',
format: 'umd',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes',
'ag-grid-community': 'agGrid'
},
},
},
plugins: [typescript(), commonjs(),
uglify()
]
})
.pipe(source('ag-grid-react.min.js'))
.pipe(gulp.dest('./umd'))
plugins: [typescript(), commonjs(),
uglify()
]
})
.pipe(source('ag-grid-react.min.js'))
.pipe(gulp.dest('./umd'))
);

@@ -1,2 +0,2 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
import { Component } from "react";

@@ -3,0 +3,0 @@ import * as AgGrid from "ag-grid-community";

@@ -1,2 +0,2 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
"use strict";

@@ -3,0 +3,0 @@ var __extends = (this && this.__extends) || (function () {

@@ -1,8 +0,12 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
import * as React from "react";
import { ReactPortal } from "react";
import * as AgGrid from "ag-grid-community";
import { GridOptions } from "ag-grid-community";
import { AgReactComponent } from "./agReactComponent";
import { ColumnApi, GridApi, GridOptions } from "ag-grid-community";
import { ReactComponent } from "./reactComponent";
import { ChangeDetectionService, ChangeDetectionStrategyType } from "./changeDetectionService";
export interface AgGridReactProps extends GridOptions {
gridOptions?: GridOptions;
rowDataChangeDetectionStrategy?: ChangeDetectionStrategyType;
componentWrappingElement?: string;
}

@@ -15,5 +19,6 @@ export declare class AgGridReact extends React.Component<AgGridReactProps, {}> {

gridOptions: AgGrid.GridOptions;
api: AgGrid.GridApi;
columnApi: AgGrid.ColumnApi;
portals: any[];
changeDetectionService: ChangeDetectionService;
api: GridApi | null;
columnApi: ColumnApi;
portals: ReactPortal[];
hasPendingPortalUpdate: boolean;

@@ -27,3 +32,3 @@ protected eGridDiv: HTMLElement;

shouldComponentUpdate(): boolean;
waitForInstance(reactComponent: AgReactComponent, resolve: any, runningTime?: number): void;
waitForInstance(reactComponent: ReactComponent, resolve: (value: any) => void, runningTime?: number): void;
/**

@@ -34,12 +39,8 @@ * Mounts a react portal for components registered under the componentFramework.

*/
mountReactPortal(portal: any, reactComponent: any, resolve: any): void;
mountReactPortal(portal: ReactPortal, reactComponent: ReactComponent, resolve: (value: any) => void): void;
batchUpdate(callback?: any): any;
destroyPortal(portal: any): void;
destroyPortal(portal: ReactPortal): void;
private getStrategyTypeForProp;
componentWillReceiveProps(nextProps: any): void;
private skipPropertyCheck;
componentWillUnmount(): void;
static unwrapStringOrNumber(obj: any): any;
copy(value: any): any;
areEquivalent(a: any, b: any): boolean;
static areEquivalent(a: any, b: any): boolean;
}

@@ -1,2 +0,2 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
"use strict";

@@ -27,2 +27,3 @@ var __extends = (this && this.__extends) || (function () {

var React = require("react");
var ReactDOM = require("react-dom");
var PropTypes = require("prop-types");

@@ -32,3 +33,5 @@ var AgGrid = require("ag-grid-community");

var agGridColumn_1 = require("./agGridColumn");
var agReactComponent_1 = require("./agReactComponent");
var reactComponent_1 = require("./reactComponent");
var changeDetectionService_1 = require("./changeDetectionService");
var legacyReactComponent_1 = require("./legacyReactComponent");
var AgGridReact = /** @class */ (function (_super) {

@@ -41,2 +44,4 @@ __extends(AgGridReact, _super);

_this.destroyed = false;
_this.changeDetectionService = new changeDetectionService_1.ChangeDetectionService();
_this.api = null;
_this.portals = [];

@@ -91,3 +96,3 @@ _this.hasPendingPortalUpdate = false;

if (runningTime === void 0) { runningTime = 0; }
if (reactComponent.getFrameworkComponentInstance()) {
if (reactComponent.getFrameworkComponentInstance() || reactComponent.isStatelesComponent()) {
resolve(null);

@@ -131,2 +136,17 @@ }

};
AgGridReact.prototype.getStrategyTypeForProp = function (propKey) {
if (propKey === 'rowData') {
// for row data we either return the supplied strategy, or:
// if deltaRowDataMode we default to IdentityChecks,
// if not we default to DeepValueChecks (with the rest of the properties)
if (!!this.props.rowDataChangeDetectionStrategy) {
return this.props.rowDataChangeDetectionStrategy;
}
else if (this.props['deltaRowDataMode']) {
return changeDetectionService_1.ChangeDetectionStrategyType.IdentityCheck;
}
}
// all non row data properties will default to DeepValueCheck
return changeDetectionService_1.ChangeDetectionStrategyType.DeepValueCheck;
};
AgGridReact.prototype.componentWillReceiveProps = function (nextProps) {

@@ -139,4 +159,4 @@ var _this = this;

if (AgGrid.ComponentUtil.ALL_PROPERTIES.indexOf(propKey) !== -1) {
if (_this.skipPropertyCheck(propKey) ||
!_this.areEquivalent(_this.props[propKey], nextProps[propKey])) {
var changeDetectionStrategy = _this.changeDetectionService.getStrategy(_this.getStrategyTypeForProp(propKey));
if (!changeDetectionStrategy.areEqual(_this.props[propKey], nextProps[propKey])) {
if (debugLogging) {

@@ -165,5 +185,2 @@ console.log("agGridReact: [" + propKey + "] property changed");

};
AgGridReact.prototype.skipPropertyCheck = function (propKey) {
return this.props['deltaRowDataMode'] && propKey === 'rowData';
};
AgGridReact.prototype.componentWillUnmount = function () {

@@ -175,101 +192,2 @@ if (this.api) {

};
/*
* deeper object comparison - taken from https://stackoverflow.com/questions/1068834/object-comparison-in-javascript
*/
AgGridReact.unwrapStringOrNumber = function (obj) {
return obj instanceof Number || obj instanceof String ? obj.valueOf() : obj;
};
// sigh, here for ie compatibility
AgGridReact.prototype.copy = function (value) {
if (!value) {
return value;
}
if (Array.isArray(value)) {
// shallow copy the array - this will typically be either rowData or columnDefs
var arrayCopy = [];
for (var i = 0; i < value.length; i++) {
arrayCopy.push(this.copy(value[i]));
}
return arrayCopy;
}
// for anything without keys (boolean, string etc).
// Object.keys - chrome will swallow them, IE will fail (correctly, imho)
if (typeof value !== "object") {
return value;
}
return [{}, value].reduce(function (r, o) {
Object.keys(o).forEach(function (k) {
r[k] = o[k];
});
return r;
}, {});
};
AgGridReact.prototype.areEquivalent = function (a, b) {
return AgGridReact.areEquivalent(this.copy(a), this.copy(b));
};
/*
* slightly modified, but taken from https://stackoverflow.com/questions/1068834/object-comparison-in-javascript
*
* What we're trying to do here is determine if the property being checked has changed in _value_, not just in reference
*
* For eg, if a user updates the columnDefs via property binding, but the actual columns defs are the same before and
* after, then we don't want the grid to re-render
*/
AgGridReact.areEquivalent = function (a, b) {
a = AgGridReact.unwrapStringOrNumber(a);
b = AgGridReact.unwrapStringOrNumber(b);
if (a === b)
return true; //e.g. a and b both null
if (a === null || b === null || typeof a !== typeof b)
return false;
if (a instanceof Date) {
return b instanceof Date && a.valueOf() === b.valueOf();
}
if (typeof a === "function") {
return a.toString() === b.toString();
}
if (typeof a !== "object") {
return a == b; //for boolean, number, string, function, xml
}
var newA = a.areEquivPropertyTracking === undefined, newB = b.areEquivPropertyTracking === undefined;
try {
var prop = void 0;
if (newA) {
a.areEquivPropertyTracking = [];
}
else if (a.areEquivPropertyTracking.some(function (other) {
return other === b;
}))
return true;
if (newB) {
b.areEquivPropertyTracking = [];
}
else if (b.areEquivPropertyTracking.some(function (other) { return other === a; })) {
return true;
}
a.areEquivPropertyTracking.push(b);
b.areEquivPropertyTracking.push(a);
var tmp = {};
for (prop in a)
if (prop != "areEquivPropertyTracking") {
tmp[prop] = null;
}
for (prop in b)
if (prop != "areEquivPropertyTracking") {
tmp[prop] = null;
}
for (prop in tmp) {
if (!this.areEquivalent(a[prop], b[prop])) {
return false;
}
}
return true;
}
finally {
if (newA)
delete a.areEquivPropertyTracking;
if (newB)
delete b.areEquivPropertyTracking;
}
};
AgGridReact.MAX_COMPONENT_CREATION_TIME = 1000; // a second should be more than enough to instantiate a component

@@ -299,41 +217,16 @@ return AgGridReact;

}
ReactFrameworkComponentWrapper.prototype.createWrapper = function (ReactComponent) {
var _self = this;
var DynamicAgReactComponent = /** @class */ (function (_super) {
__extends(DynamicAgReactComponent, _super);
function DynamicAgReactComponent() {
return _super.call(this, ReactComponent, _self.agGridReact) || this;
}
DynamicAgReactComponent.prototype.init = function (params) {
return _super.prototype.init.call(this, params);
};
DynamicAgReactComponent.prototype.hasMethod = function (name) {
var frameworkComponentInstance = wrapper.getFrameworkComponentInstance();
if (frameworkComponentInstance == null) {
return false;
}
return frameworkComponentInstance[name] != null;
};
DynamicAgReactComponent.prototype.callMethod = function (name, args) {
var _this = this;
var frameworkComponentInstance = this.getFrameworkComponentInstance();
// this should never happen now that AgGridReact.waitForInstance is in use
if (frameworkComponentInstance == null) {
window.setTimeout(function () { return _this.callMethod(name, args); }, 100);
}
else {
var method = wrapper.getFrameworkComponentInstance()[name];
if (method == null)
return null;
return method.apply(frameworkComponentInstance, args);
}
};
DynamicAgReactComponent.prototype.addMethod = function (name, callback) {
wrapper[name] = callback;
};
return DynamicAgReactComponent;
}(agReactComponent_1.AgReactComponent));
var wrapper = new DynamicAgReactComponent();
return wrapper;
ReactFrameworkComponentWrapper.prototype.createWrapper = function (UserReactComponent) {
// at some point soon unstable_renderSubtreeIntoContainer is going to be dropped (and in a minor release at that)
// this uses the existing mechanism as long as possible, but switches over to using Portals when
// unstable_renderSubtreeIntoContainer is no longer an option
return this.useLegacyReact() ?
new legacyReactComponent_1.LegacyReactComponent(UserReactComponent, this.agGridReact) :
new reactComponent_1.ReactComponent(UserReactComponent, this.agGridReact);
};
ReactFrameworkComponentWrapper.prototype.useLegacyReact = function () {
// force use of react next (ie portals) if unstable_renderSubtreeIntoContainer is no longer present
// or if the user elects to try it
return (typeof ReactDOM.unstable_renderSubtreeIntoContainer !== "function")
|| (this.agGridReact && this.agGridReact.gridOptions && !this.agGridReact.gridOptions.reactNext);
};
__decorate([

@@ -340,0 +233,0 @@ ag_grid_community_1.Autowired("agGridReact"),

@@ -1,2 +0,2 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
import { ICellEditor, ICellEditorParams, ICellRenderer, ICellRendererParams, IDate, IDateParams, IFilter, IFilterParams, IHeader, IHeaderGroup, IHeaderGroupParams, IHeaderParams, ILoadingCellRendererParams, ILoadingOverlayParams, INoRowsOverlayParams, IStatusPanel, IToolPanel, IToolPanelParams, IAfterGuiAttachedParams, IStatusPanelParams } from 'ag-grid-community';

@@ -3,0 +3,0 @@ export interface AgReactFrameworkComponent<T> {

@@ -1,3 +0,3 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,3 +0,3 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
export { AgGridReact } from './agGridReact';
export { AgGridColumn } from './agGridColumn';

@@ -1,2 +0,2 @@

// ag-grid-react v20.1.1
// ag-grid-react v20.2.0
"use strict";

@@ -3,0 +3,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -5,11 +5,24 @@ export * from './lib/agGridReact';

import {AgGridReactProps} from "./lib/agGridReact";
import {AgGridColumnProps, AgGridColumnGroupProps} from "./lib/agGridColumn";
import {AgGridColumnGroupProps, AgGridColumnProps} from "./lib/agGridColumn";
import {Component} from "react";
declare module "ag-grid-react" {
export class AgGridReact extends Component<AgGridReactProps, {}> {
}
export class AgGridColumn extends Component<AgGridColumnProps | AgGridColumnGroupProps, {}> {
}
export declare class AgGridReact extends Component<AgGridReactProps, {}> {
}
export declare class AgGridColumn extends Component<AgGridColumnProps | AgGridColumnGroupProps, {}> {
}
export {ICellEditorReactComp} from './lib/interfaces';
export {AgReactFrameworkComponent} from './lib/interfaces';
export {IHeaderGroupReactComp} from './lib/interfaces';
export {IHeaderReactComp} from './lib/interfaces';
export {IDateReactComp} from './lib/interfaces';
export {IFilterReactComp} from './lib/interfaces';
export {ICellRendererReactComp} from './lib/interfaces';
export {ILoadingCellRendererReactComp} from './lib/interfaces';
export {ILoadingOverlayReactComp} from './lib/interfaces';
export {INoRowsOverlayReactComp} from './lib/interfaces';
export {IStatusPanelReactComp} from './lib/interfaces';
export {IToolPanelReactComp} from './lib/interfaces';
{
"name": "ag-grid-react",
"version": "20.1.1",
"version": "20.2.0",
"description": "ag-Grid React Component",

@@ -9,3 +9,5 @@ "main": "main.js",

"build": "gulp",
"umd": "rollup -c"
"umd": "rollup -c",
"test": "CI=true react-scripts test --verbose=false",
"test:watch": "react-scripts test --verbose=false"
},

@@ -33,14 +35,20 @@ "repository": {

"devDependencies": {
"@types/react": "^16.7.9",
"@types/react-dom": "^16.0.11",
"@types/enzyme": "^3.9.0",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.0.9",
"@types/prop-types": "^15.5.6",
"ag-grid-community": "^20.1.0",
"@types/react": "^16.8.8",
"@types/react-dom": "^16.8.2",
"ag-grid-community": "^20.2.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.10.0",
"gulp": "^3.9.1",
"gulp-header": "^2.0.5",
"gulp-merge": "^0.1.1",
"gulp-rename": "^1.4.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-typescript": "^5.0.0-alpha.3",
"gulp-merge": "^0.1.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-scripts": "2.1.5",
"rollup": "~0.67.3",

@@ -56,6 +64,6 @@ "rollup-plugin-commonjs": "^9.1.6",

"peerDependencies": {
"ag-grid-community": "^20.1.0",
"ag-grid-community": "^20.2.0",
"react": "^15.5.0 || ^16.0.0",
"react-dom": "^15.5.0 || ^16.0.0"
}
}
}
import * as React from "react";
import {ReactPortal} from "react";
import * as ReactDOM from "react-dom";
import * as PropTypes from "prop-types";

@@ -8,14 +10,17 @@ import * as AgGrid from "ag-grid-community";

Bean,
ColumnApi,
FrameworkComponentWrapper,
GridApi,
GridOptions,
IComponent,
Promise,
WrapableInterface
} from "ag-grid-community";
import {AgGridColumn} from "./agGridColumn";
import {ReactComponent} from "./reactComponent";
import {ChangeDetectionService, ChangeDetectionStrategyType} from "./changeDetectionService";
import {LegacyReactComponent} from "./legacyReactComponent";
import { AgGridColumn } from "./agGridColumn";
import { AgReactComponent } from "./agReactComponent";
export interface AgGridReactProps extends GridOptions {
gridOptions?: GridOptions;
rowDataChangeDetectionStrategy?: ChangeDetectionStrategyType;
componentWrappingElement?: string;
}

@@ -28,9 +33,12 @@

gridOptions: AgGrid.GridOptions;
api: AgGrid.GridApi;
columnApi: AgGrid.ColumnApi;
portals = [];
gridOptions!: AgGrid.GridOptions;
changeDetectionService = new ChangeDetectionService();
api: GridApi | null = null;
columnApi!: ColumnApi;
portals: ReactPortal[] = [];
hasPendingPortalUpdate = false;
protected eGridDiv: HTMLElement;
protected eGridDiv!: HTMLElement;

@@ -46,3 +54,3 @@ private static MAX_COMPONENT_CREATION_TIME: number = 1000; // a second should be more than enough to instantiate a component

style: this.createStyleForDiv(),
ref: e => {
ref: (e: HTMLElement) => {
this.eGridDiv = e;

@@ -82,4 +90,4 @@ }

this.api = this.gridOptions.api;
this.columnApi = this.gridOptions.columnApi;
this.api = this.gridOptions.api!;
this.columnApi = this.gridOptions.columnApi!;
}

@@ -94,7 +102,7 @@

waitForInstance(reactComponent: AgReactComponent, resolve, runningTime = 0) {
if(reactComponent.getFrameworkComponentInstance()) {
waitForInstance(reactComponent: ReactComponent, resolve: (value: any) => void, runningTime = 0) {
if (reactComponent.getFrameworkComponentInstance() || reactComponent.isStatelesComponent()) {
resolve(null);
} else {
if(runningTime >= AgGridReact.MAX_COMPONENT_CREATION_TIME) {
if (runningTime >= AgGridReact.MAX_COMPONENT_CREATION_TIME) {
console.error(`ag-Grid: React Component '${reactComponent.getReactComponentName()}' not created within ${AgGridReact.MAX_COMPONENT_CREATION_TIME}ms`);

@@ -112,8 +120,8 @@ return;

*/
mountReactPortal(portal, reactComponent, resolve) {
mountReactPortal(portal: ReactPortal, reactComponent: ReactComponent, resolve: (value: any) => void) {
this.portals = [...this.portals, portal];
this.batchUpdate(this.waitForInstance(reactComponent, resolve));
this.batchUpdate(this.waitForInstance(reactComponent, resolve));
}
batchUpdate(callback?) {
batchUpdate(callback?: any) {
if (this.hasPendingPortalUpdate) {

@@ -134,3 +142,3 @@ return callback && callback();

destroyPortal(portal) {
destroyPortal(portal: ReactPortal) {
this.portals = this.portals.filter(curPortal => curPortal !== portal);

@@ -140,2 +148,18 @@ this.batchUpdate();

private getStrategyTypeForProp(propKey: string) {
if (propKey === 'rowData') {
// for row data we either return the supplied strategy, or:
// if deltaRowDataMode we default to IdentityChecks,
// if not we default to DeepValueChecks (with the rest of the properties)
if (!!this.props.rowDataChangeDetectionStrategy) {
return this.props.rowDataChangeDetectionStrategy;
} else if (this.props['deltaRowDataMode']) {
return ChangeDetectionStrategyType.IdentityCheck;
}
}
// all non row data properties will default to DeepValueCheck
return ChangeDetectionStrategyType.DeepValueCheck;
}
componentWillReceiveProps(nextProps: any) {

@@ -148,5 +172,4 @@ let debugLogging = !!nextProps.debug;

if (AgGrid.ComponentUtil.ALL_PROPERTIES.indexOf(propKey) !== -1) {
if (this.skipPropertyCheck(propKey) ||
!this.areEquivalent(this.props[propKey], nextProps[propKey])) {
const changeDetectionStrategy = this.changeDetectionService.getStrategy(this.getStrategyTypeForProp(propKey));
if (!changeDetectionStrategy.areEqual(this.props[propKey], nextProps[propKey])) {
if (debugLogging) {

@@ -176,9 +199,5 @@ console.log(`agGridReact: [${propKey}] property changed`);

AgGrid.ComponentUtil.processOnChange(changes, this.gridOptions, this.api, this.columnApi);
AgGrid.ComponentUtil.processOnChange(changes, this.gridOptions, this.api!, this.columnApi);
}
private skipPropertyCheck(propKey) {
return this.props['deltaRowDataMode'] && propKey === 'rowData';
}
componentWillUnmount() {

@@ -190,107 +209,2 @@ if (this.api) {

}
/*
* deeper object comparison - taken from https://stackoverflow.com/questions/1068834/object-comparison-in-javascript
*/
static unwrapStringOrNumber(obj) {
return obj instanceof Number || obj instanceof String ? obj.valueOf() : obj;
}
// sigh, here for ie compatibility
copy(value) {
if (!value) {
return value;
}
if (Array.isArray(value)) {
// shallow copy the array - this will typically be either rowData or columnDefs
const arrayCopy = [];
for (let i = 0; i < value.length; i++) {
arrayCopy.push(this.copy(value[i]));
}
return arrayCopy;
}
// for anything without keys (boolean, string etc).
// Object.keys - chrome will swallow them, IE will fail (correctly, imho)
if (typeof value !== "object") {
return value;
}
return [{}, value].reduce((r, o) => {
Object.keys(o).forEach(function(k) {
r[k] = o[k];
});
return r;
}, {});
}
areEquivalent(a, b) {
return AgGridReact.areEquivalent(this.copy(a), this.copy(b));
}
/*
* slightly modified, but taken from https://stackoverflow.com/questions/1068834/object-comparison-in-javascript
*
* What we're trying to do here is determine if the property being checked has changed in _value_, not just in reference
*
* For eg, if a user updates the columnDefs via property binding, but the actual columns defs are the same before and
* after, then we don't want the grid to re-render
*/
static areEquivalent(a, b) {
a = AgGridReact.unwrapStringOrNumber(a);
b = AgGridReact.unwrapStringOrNumber(b);
if (a === b) return true; //e.g. a and b both null
if (a === null || b === null || typeof a !== typeof b) return false;
if (a instanceof Date) {
return b instanceof Date && a.valueOf() === b.valueOf();
}
if (typeof a === "function") {
return a.toString() === b.toString();
}
if (typeof a !== "object") {
return a == b; //for boolean, number, string, function, xml
}
const newA = a.areEquivPropertyTracking === undefined,
newB = b.areEquivPropertyTracking === undefined;
try {
let prop;
if (newA) {
a.areEquivPropertyTracking = [];
} else if (
a.areEquivPropertyTracking.some(function(other) {
return other === b;
})
)
return true;
if (newB) {
b.areEquivPropertyTracking = [];
} else if (b.areEquivPropertyTracking.some(other => other === a)) {
return true;
}
a.areEquivPropertyTracking.push(b);
b.areEquivPropertyTracking.push(a);
const tmp = {};
for (prop in a)
if (prop != "areEquivPropertyTracking") {
tmp[prop] = null;
}
for (prop in b)
if (prop != "areEquivPropertyTracking") {
tmp[prop] = null;
}
for (prop in tmp) {
if (!this.areEquivalent(a[prop], b[prop])) {
return false;
}
}
return true;
} finally {
if (newA) delete a.areEquivPropertyTracking;
if (newB) delete b.areEquivPropertyTracking;
}
}
}

@@ -312,3 +226,3 @@

listOfProps.forEach((propKey: string) => {
AgGridReact[propKey] = propType;
(AgGridReact as any)[propKey] = propType;
});

@@ -319,44 +233,18 @@ }

class ReactFrameworkComponentWrapper extends BaseComponentWrapper<WrapableInterface> implements FrameworkComponentWrapper {
@Autowired("agGridReact") private agGridReact: AgGridReact;
@Autowired("agGridReact") private agGridReact!: AgGridReact;
createWrapper(ReactComponent: { new(): any }): WrapableInterface {
let _self = this;
createWrapper(UserReactComponent: { new(): any }): WrapableInterface {
// at some point soon unstable_renderSubtreeIntoContainer is going to be dropped (and in a minor release at that)
// this uses the existing mechanism as long as possible, but switches over to using Portals when
// unstable_renderSubtreeIntoContainer is no longer an option
return this.useLegacyReact() ?
new LegacyReactComponent(UserReactComponent, this.agGridReact) :
new ReactComponent(UserReactComponent, this.agGridReact);
}
class DynamicAgReactComponent extends AgReactComponent implements IComponent<any>, WrapableInterface {
constructor() {
super(ReactComponent, _self.agGridReact);
}
public init(params: any): Promise<void> {
return super.init(<any>params);
}
hasMethod(name: string): boolean {
let frameworkComponentInstance = wrapper.getFrameworkComponentInstance();
if (frameworkComponentInstance == null) {
return false;
}
return frameworkComponentInstance[name] != null;
}
callMethod(name: string, args: IArguments): void {
let frameworkComponentInstance = this.getFrameworkComponentInstance();
// this should never happen now that AgGridReact.waitForInstance is in use
if (frameworkComponentInstance == null) {
window.setTimeout(() => this.callMethod(name, args), 100);
} else {
let method = wrapper.getFrameworkComponentInstance()[name];
if (method == null) return null;
return method.apply(frameworkComponentInstance, args);
}
}
addMethod(name: string, callback: Function): void {
wrapper[name] = callback;
}
}
const wrapper: DynamicAgReactComponent = new DynamicAgReactComponent();
return wrapper;
private useLegacyReact() {
// force use of react next (ie portals) if unstable_renderSubtreeIntoContainer is no longer present
// or if the user elects to try it
return (typeof ReactDOM.unstable_renderSubtreeIntoContainer !== "function")
|| (this.agGridReact && this.agGridReact.gridOptions && !this.agGridReact.gridOptions.reactNext);
}

@@ -363,0 +251,0 @@ }

@@ -6,8 +6,25 @@ {

"experimentalDecorators": true,
"module": "commonjs",
"module": "esnext",
"target": "es5",
"types": [
"react",
"react-dom"
]
"react-dom",
"jest"
],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
},

@@ -17,3 +34,6 @@ "exclude": [

"lib"
],
"include": [
"src"
]
}
}

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("prop-types"),require("react"),require("react-dom"),require("ag-grid-community")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","react-dom","ag-grid-community"],e):e(t.AgGridReact={},t.PropTypes,t.React,t.ReactDOM,t.agGrid)}(this,function(t,e,i,a,p){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function n(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var p=t.length-1;0<=p;p--)(o=t[p])&&(a=(i<3?o(a):3<i?o(e,n,a):o(e,n))||a);return 3<i&&a&&Object.defineProperty(e,n,a),a}var c=function(r){function n(t,e){var n=r.call(this,t,e)||this;return n.props=t,n.state=e,n}return o(n,r),n.prototype.render=function(){return null},n.mapChildColumnDefs=function(t){return i.Children.map(t.children,function(t){return n.toColDef(t.props)})},n.toColDef=function(t){var e=n.createColDefFromGridColumn(t);return n.hasChildColumns(t)&&(e.children=n.getChildColDefs(t.children)),e},n.hasChildColumns=function(t){return 0<i.Children.count(t.children)},n.getChildColDefs=function(t){return i.Children.map(t,function(t){return n.createColDefFromGridColumn(t.props)})},n.createColDefFromGridColumn=function(t){var e={};return n.assign(e,t),delete e.children,e},n.assign=function(t,e){return[e].reduce(function(e,n){return Object.keys(n).forEach(function(t){e[t]=n[t]}),e},t)},n}(i.Component);function u(t,e){t.forEach(function(t){c[t]=e})}u(p.ColDefUtil.BOOLEAN_PROPERTIES,e.bool),u(p.ColDefUtil.STRING_PROPERTIES,e.string),u(p.ColDefUtil.OBJECT_PROPERTIES,e.object),u(p.ColDefUtil.ARRAY_PROPERTIES,e.array),u(p.ColDefUtil.NUMBER_PROPERTIES,e.number),u(p.ColDefUtil.FUNCTION_PROPERTIES,e.func);var s=function(){function t(t,e){this.reactComponent=t,this.parentComponent=e}return t.prototype.getFrameworkComponentInstance=function(){return this.componentInstance},t.prototype.getReactComponentName=function(){return this.reactComponent.name},t.prototype.init=function(e){var n=this;return new p.Promise(function(t){n.eParentElement=document.createElement("div"),p.Utils.addCssClass(n.eParentElement,"ag-react-container"),e.reactContainer=n.eParentElement,n.useLegacyReact()?n.createReactComponentLegacy(e,t):n.createReactComponent(e,t)})},t.prototype.useLegacyReact=function(){return"function"!=typeof a.unstable_renderSubtreeIntoContainer||this.parentComponent&&this.parentComponent.gridOptions&&!this.parentComponent.gridOptions.reactNext},t.prototype.getGui=function(){return this.eParentElement},t.prototype.destroy=function(){if(!this.useLegacyReact())return this.parentComponent.destroyPortal(this.portal);a.unmountComponentAtNode(this.eParentElement)},t.prototype.createReactComponentLegacy=function(t,e){var n=this,r=i.createElement(this.reactComponent,t);this.parentComponent?a.unstable_renderSubtreeIntoContainer(this.parentComponent,r,this.eParentElement,function(){n.componentInstance=this,e(null)}):a.render(r,this.eParentElement,function(){n.componentInstance=this,e(null)})},t.prototype.createReactComponent=function(t,e){var n=this;t.ref=function(t){n.componentInstance=t};var r=i.createElement(this.reactComponent,t),o=a.createPortal(r,this.eParentElement);this.portal=o,this.parentComponent.mountReactPortal(o,this,e)},t}(),l=function(r){function a(t,e){var n=r.call(this,t,e)||this;return n.props=t,n.state=e,n.destroyed=!1,n.portals=[],n.hasPendingPortalUpdate=!1,n}return o(a,r),a.prototype.render=function(){var e=this;return i.createElement("div",{style:this.createStyleForDiv(),ref:function(t){e.eGridDiv=t}},this.portals)},a.prototype.createStyleForDiv=function(){var e={height:"100%"},n=this.props.containerStyle;return n&&Object.keys(n).forEach(function(t){e[t]=n[t]}),e},a.prototype.componentDidMount=function(){var t={seedBeanInstances:{agGridReact:this}},e=this.props.gridOptions||{};c.hasChildColumns(this.props)&&(e.columnDefs=c.mapChildColumnDefs(this.props)),this.gridOptions=p.ComponentUtil.copyAttributesToGridOptions(e,this.props),new p.Grid(this.eGridDiv,this.gridOptions,t),this.api=this.gridOptions.api,this.columnApi=this.gridOptions.columnApi},a.prototype.shouldComponentUpdate=function(){return!1},a.prototype.waitForInstance=function(t,e,n){var r=this;if(void 0===n&&(n=0),t.getFrameworkComponentInstance())e(null);else{if(a.MAX_COMPONENT_CREATION_TIME<=n)return void console.error("ag-Grid: React Component '"+t.getReactComponentName()+"' not created within "+a.MAX_COMPONENT_CREATION_TIME+"ms");window.setTimeout(function(){return r.waitForInstance(t,e,n+5)},5)}},a.prototype.mountReactPortal=function(t,e,n){this.portals=this.portals.concat([t]),this.batchUpdate(this.waitForInstance(e,n))},a.prototype.batchUpdate=function(t){var e=this;if(this.hasPendingPortalUpdate)return t&&t();setTimeout(function(){e.api&&e.forceUpdate(function(){t&&t(),e.hasPendingPortalUpdate=!1})}),this.hasPendingPortalUpdate=!0},a.prototype.destroyPortal=function(e){this.portals=this.portals.filter(function(t){return t!==e}),this.batchUpdate()},a.prototype.componentWillReceiveProps=function(e){var n=this,r=!!e.debug,o={};Object.keys(e).forEach(function(t){-1!==p.ComponentUtil.ALL_PROPERTIES.indexOf(t)&&(!n.skipPropertyCheck(t)&&n.areEquivalent(n.props[t],e[t])||(r&&console.log("agGridReact: ["+t+"] property changed"),o[t]={previousValue:n.props[t],currentValue:e[t]}))}),p.ComponentUtil.getEventCallbacks().forEach(function(t){n.props[t]!==e[t]&&(r&&console.log("agGridReact: ["+t+"] event callback changed"),o[t]={previousValue:n.props[t],currentValue:e[t]})}),p.ComponentUtil.processOnChange(o,this.gridOptions,this.api,this.columnApi)},a.prototype.skipPropertyCheck=function(t){return this.props.deltaRowDataMode&&"rowData"===t},a.prototype.componentWillUnmount=function(){this.api&&(this.api.destroy(),this.api=null)},a.unwrapStringOrNumber=function(t){return t instanceof Number||t instanceof String?t.valueOf():t},a.prototype.copy=function(t){if(!t)return t;if(Array.isArray(t)){for(var e=[],n=0;n<t.length;n++)e.push(this.copy(t[n]));return e}return"object"!=typeof t?t:[{},t].reduce(function(e,n){return Object.keys(n).forEach(function(t){e[t]=n[t]}),e},{})},a.prototype.areEquivalent=function(t,e){return a.areEquivalent(this.copy(t),this.copy(e))},a.areEquivalent=function(e,n){if(e=a.unwrapStringOrNumber(e),n=a.unwrapStringOrNumber(n),e===n)return!0;if(null===e||null===n||typeof e!=typeof n)return!1;if(e instanceof Date)return n instanceof Date&&e.valueOf()===n.valueOf();if("function"==typeof e)return e.toString()===n.toString();if("object"!=typeof e)return e==n;var t=void 0===e.areEquivPropertyTracking,r=void 0===n.areEquivPropertyTracking;try{var o=void 0;if(t)e.areEquivPropertyTracking=[];else if(e.areEquivPropertyTracking.some(function(t){return t===n}))return!0;if(r)n.areEquivPropertyTracking=[];else if(n.areEquivPropertyTracking.some(function(t){return t===e}))return!0;e.areEquivPropertyTracking.push(n),n.areEquivPropertyTracking.push(e);var i={};for(o in e)"areEquivPropertyTracking"!=o&&(i[o]=null);for(o in n)"areEquivPropertyTracking"!=o&&(i[o]=null);for(o in i)if(!this.areEquivalent(e[o],n[o]))return!1;return!0}finally{t&&delete e.areEquivPropertyTracking,r&&delete n.areEquivPropertyTracking}},a.MAX_COMPONENT_CREATION_TIME=1e3,a}(i.Component);function f(t,e){t.forEach(function(t){l[t]=e})}l.propTypes={gridOptions:e.object},f(p.ComponentUtil.getEventCallbacks(),e.func),f(p.ComponentUtil.BOOLEAN_PROPERTIES,e.bool),f(p.ComponentUtil.STRING_PROPERTIES,e.string),f(p.ComponentUtil.OBJECT_PROPERTIES,e.object),f(p.ComponentUtil.ARRAY_PROPERTIES,e.array),f(p.ComponentUtil.NUMBER_PROPERTIES,e.number),f(p.ComponentUtil.FUNCTION_PROPERTIES,e.func);var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.createWrapper=function(n){var r=this,i=new(function(e){function t(){return e.call(this,n,r.agGridReact)||this}return o(t,e),t.prototype.init=function(t){return e.prototype.init.call(this,t)},t.prototype.hasMethod=function(t){var e=i.getFrameworkComponentInstance();return null!=e&&null!=e[t]},t.prototype.callMethod=function(t,e){var n=this,r=this.getFrameworkComponentInstance();if(null!=r){var o=i.getFrameworkComponentInstance()[t];return null==o?null:o.apply(r,e)}window.setTimeout(function(){return n.callMethod(t,e)},100)},t.prototype.addMethod=function(t,e){i[t]=e},t}(s));return i},n([p.Autowired("agGridReact"),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:type",l)],e.prototype,"agGridReact",void 0),e=n([p.Bean("frameworkComponentWrapper")],e)}(p.BaseComponentWrapper);p.Grid.setFrameworkBeans([h]),t.AgGridReact=l,t.AgGridColumn=c,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("prop-types"),require("react"),require("react-dom"),require("ag-grid-community")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","react-dom","ag-grid-community"],e):e(t.AgGridReact={},t.PropTypes,t.React,t.ReactDOM,t.agGrid)}(this,function(t,e,i,a,c){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function p(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function n(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;0<=c;c--)(o=t[c])&&(a=(i<3?o(a):3<i?o(e,n,a):o(e,n))||a);return 3<i&&a&&Object.defineProperty(e,n,a),a}var u=function(r){function n(t,e){var n=r.call(this,t,e)||this;return n.props=t,n.state=e,n}return p(n,r),n.prototype.render=function(){return null},n.mapChildColumnDefs=function(t){return i.Children.map(t.children,function(t){return n.toColDef(t.props)})},n.toColDef=function(t){var e=n.createColDefFromGridColumn(t);return n.hasChildColumns(t)&&(e.children=n.getChildColDefs(t.children)),e},n.hasChildColumns=function(t){return 0<i.Children.count(t.children)},n.getChildColDefs=function(t){return i.Children.map(t,function(t){return n.createColDefFromGridColumn(t.props)})},n.createColDefFromGridColumn=function(t){var e={};return n.assign(e,t),delete e.children,e},n.assign=function(t,e){return[e].reduce(function(e,n){return Object.keys(n).forEach(function(t){e[t]=n[t]}),e},t)},n}(i.Component);function o(t,e){t.forEach(function(t){u[t]=e})}o(c.ColDefUtil.BOOLEAN_PROPERTIES,e.bool),o(c.ColDefUtil.STRING_PROPERTIES,e.string),o(c.ColDefUtil.OBJECT_PROPERTIES,e.object),o(c.ColDefUtil.ARRAY_PROPERTIES,e.array),o(c.ColDefUtil.NUMBER_PROPERTIES,e.number),o(c.ColDefUtil.FUNCTION_PROPERTIES,e.func);var s,l,f=function(){function t(){}return t.prototype.hasMethod=function(t){var e=this.getFrameworkComponentInstance();return null!=e&&null!=e[t]},t.prototype.callMethod=function(t,e){var n=this,r=this.getFrameworkComponentInstance();if(null!=r){var o=this.getFrameworkComponentInstance()[t];if(null==o)return;return o.apply(r,e)}window.setTimeout(function(){return n.callMethod(t,e)},100)},t.prototype.addMethod=function(t,e){this[t]=e},t}(),h=function(r){function o(t,e){var n=r.call(this)||this;return n.portal=null,n.componentWrappingElement="div",n.reactComponent=t,n.parentComponent=e,n.statelessComponent=o.isStateless(n.reactComponent),n}return p(o,r),o.prototype.getFrameworkComponentInstance=function(){return this.componentInstance},o.prototype.isStatelesComponent=function(){return this.statelessComponent},o.prototype.getReactComponentName=function(){return this.reactComponent.name},o.prototype.init=function(e){var n=this;return new c.Promise(function(t){n.eParentElement=n.createParentElement(e),n.createReactComponent(e,t)})},o.prototype.getGui=function(){return this.eParentElement},o.prototype.destroy=function(){return this.parentComponent.destroyPortal(this.portal)},o.prototype.createReactComponent=function(t,e){var n=this;this.statelessComponent||(t.ref=function(t){n.componentInstance=t});var r=i.createElement(this.reactComponent,t),o=a.createPortal(r,this.eParentElement);this.portal=o,this.parentComponent.mountReactPortal(o,this,e)},o.prototype.createParentElement=function(t){var e=document.createElement(this.parentComponent.props.componentWrappingElement||"div");return c.Utils.addCssClass(e,"ag-react-container"),t.reactContainer=this.eParentElement,e},o.isStateless=function(t){return"function"==typeof t&&!(t.prototype&&t.prototype.isReactComponent)},o}(f);(l=s||(s={})).IdentityCheck="IdentityCheck",l.DeepValueCheck="DeepValueCheck",l.NoCheck="NoCheck";var m=function(){function t(){var t;this.strategyMap=((t={})[s.DeepValueCheck]=new y,t[s.IdentityCheck]=new d(function(t,e){return t===e}),t[s.NoCheck]=new d(function(t,e){return!0}),t)}return t.prototype.getStrategy=function(t){return this.strategyMap[t]},t}(),d=function(){function t(t){this.strategy=t}return t.prototype.areEqual=function(t,e){return this.strategy(t,e)},t}(),y=function(){function a(){}return a.prototype.areEqual=function(t,e){return a.areEquivalent(a.copy(t),a.copy(e))},a.unwrapStringOrNumber=function(t){return t instanceof Number||t instanceof String?t.valueOf():t},a.copy=function(t){if(!t)return t;if(Array.isArray(t)){for(var e=[],n=0;n<t.length;n++)e.push(this.copy(t[n]));return e}return"object"!=typeof t?t:[{},t].reduce(function(e,n){return Object.keys(n).forEach(function(t){e[t]=n[t]}),e},{})},a.areEquivalent=function(e,n){if(e=a.unwrapStringOrNumber(e),n=a.unwrapStringOrNumber(n),e===n)return!0;if(null===e||null===n||typeof e!=typeof n)return!1;if(e instanceof Date)return n instanceof Date&&e.valueOf()===n.valueOf();if("function"==typeof e)return e.toString()===n.toString();if("object"!=typeof e)return e==n;var t=void 0===e.areEquivPropertyTracking,r=void 0===n.areEquivPropertyTracking;try{var o=void 0;if(t)e.areEquivPropertyTracking=[];else if(e.areEquivPropertyTracking.some(function(t){return t===n}))return!0;if(r)n.areEquivPropertyTracking=[];else if(n.areEquivPropertyTracking.some(function(t){return t===e}))return!0;e.areEquivPropertyTracking.push(n),n.areEquivPropertyTracking.push(e);var i={};for(o in e)"areEquivPropertyTracking"!=o&&(i[o]=null);for(o in n)"areEquivPropertyTracking"!=o&&(i[o]=null);for(o in i)if(!this.areEquivalent(e[o],n[o]))return!1;return!0}finally{t&&delete e.areEquivPropertyTracking,r&&delete n.areEquivPropertyTracking}},a}(),C=function(r){function t(t,e){var n=r.call(this)||this;return n.reactComponent=t,n.parentComponent=e,n}return p(t,r),t.prototype.getFrameworkComponentInstance=function(){return this.componentInstance},t.prototype.getReactComponentName=function(){return this.reactComponent.name},t.prototype.init=function(e){var n=this;return new c.Promise(function(t){n.eParentElement=document.createElement(n.parentComponent.props.componentWrappingElement||"div"),c.Utils.addCssClass(n.eParentElement,"ag-react-container"),e.reactContainer=n.eParentElement,n.createReactComponentLegacy(e,t)})},t.prototype.getGui=function(){return this.eParentElement},t.prototype.destroy=function(){a.unmountComponentAtNode(this.eParentElement)},t.prototype.createReactComponentLegacy=function(t,e){var n=this,r=i.createElement(this.reactComponent,t);this.parentComponent?a.unstable_renderSubtreeIntoContainer(this.parentComponent,r,this.eParentElement,function(){n.componentInstance=this,e(null)}):a.render(r,this.eParentElement,function(){n.componentInstance=this,e(null)})},t}(f),g=function(r){function o(t,e){var n=r.call(this,t,e)||this;return n.props=t,n.state=e,n.destroyed=!1,n.changeDetectionService=new m,n.api=null,n.portals=[],n.hasPendingPortalUpdate=!1,n}return p(o,r),o.prototype.render=function(){var e=this;return i.createElement("div",{style:this.createStyleForDiv(),ref:function(t){e.eGridDiv=t}},this.portals)},o.prototype.createStyleForDiv=function(){var e={height:"100%"},n=this.props.containerStyle;return n&&Object.keys(n).forEach(function(t){e[t]=n[t]}),e},o.prototype.componentDidMount=function(){var t={seedBeanInstances:{agGridReact:this}},e=this.props.gridOptions||{};u.hasChildColumns(this.props)&&(e.columnDefs=u.mapChildColumnDefs(this.props)),this.gridOptions=c.ComponentUtil.copyAttributesToGridOptions(e,this.props),new c.Grid(this.eGridDiv,this.gridOptions,t),this.api=this.gridOptions.api,this.columnApi=this.gridOptions.columnApi},o.prototype.shouldComponentUpdate=function(){return!1},o.prototype.waitForInstance=function(t,e,n){var r=this;if(void 0===n&&(n=0),t.getFrameworkComponentInstance()||t.isStatelesComponent())e(null);else{if(o.MAX_COMPONENT_CREATION_TIME<=n)return void console.error("ag-Grid: React Component '"+t.getReactComponentName()+"' not created within "+o.MAX_COMPONENT_CREATION_TIME+"ms");window.setTimeout(function(){return r.waitForInstance(t,e,n+5)},5)}},o.prototype.mountReactPortal=function(t,e,n){this.portals=this.portals.concat([t]),this.batchUpdate(this.waitForInstance(e,n))},o.prototype.batchUpdate=function(t){var e=this;if(this.hasPendingPortalUpdate)return t&&t();setTimeout(function(){e.api&&e.forceUpdate(function(){t&&t(),e.hasPendingPortalUpdate=!1})}),this.hasPendingPortalUpdate=!0},o.prototype.destroyPortal=function(e){this.portals=this.portals.filter(function(t){return t!==e}),this.batchUpdate()},o.prototype.getStrategyTypeForProp=function(t){if("rowData"===t){if(this.props.rowDataChangeDetectionStrategy)return this.props.rowDataChangeDetectionStrategy;if(this.props.deltaRowDataMode)return s.IdentityCheck}return s.DeepValueCheck},o.prototype.componentWillReceiveProps=function(e){var n=this,r=!!e.debug,o={};Object.keys(e).forEach(function(t){-1!==c.ComponentUtil.ALL_PROPERTIES.indexOf(t)&&(n.changeDetectionService.getStrategy(n.getStrategyTypeForProp(t)).areEqual(n.props[t],e[t])||(r&&console.log("agGridReact: ["+t+"] property changed"),o[t]={previousValue:n.props[t],currentValue:e[t]}))}),c.ComponentUtil.getEventCallbacks().forEach(function(t){n.props[t]!==e[t]&&(r&&console.log("agGridReact: ["+t+"] event callback changed"),o[t]={previousValue:n.props[t],currentValue:e[t]})}),c.ComponentUtil.processOnChange(o,this.gridOptions,this.api,this.columnApi)},o.prototype.componentWillUnmount=function(){this.api&&(this.api.destroy(),this.api=null)},o.MAX_COMPONENT_CREATION_TIME=1e3,o}(i.Component);function E(t,e){t.forEach(function(t){g[t]=e})}g.propTypes={gridOptions:e.object},E(c.ComponentUtil.getEventCallbacks(),e.func),E(c.ComponentUtil.BOOLEAN_PROPERTIES,e.bool),E(c.ComponentUtil.STRING_PROPERTIES,e.string),E(c.ComponentUtil.OBJECT_PROPERTIES,e.object),E(c.ComponentUtil.ARRAY_PROPERTIES,e.array),E(c.ComponentUtil.NUMBER_PROPERTIES,e.number),E(c.ComponentUtil.FUNCTION_PROPERTIES,e.func);var P=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.createWrapper=function(t){return this.useLegacyReact()?new C(t,this.agGridReact):new h(t,this.agGridReact)},e.prototype.useLegacyReact=function(){return"function"!=typeof a.unstable_renderSubtreeIntoContainer||this.agGridReact&&this.agGridReact.gridOptions&&!this.agGridReact.gridOptions.reactNext},n([c.Autowired("agGridReact"),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:type",g)],e.prototype,"agGridReact",void 0),e=n([c.Bean("frameworkComponentWrapper")],e)}(c.BaseComponentWrapper);c.Grid.setFrameworkBeans([P]),t.AgGridReact=g,t.AgGridColumn=u,Object.defineProperty(t,"__esModule",{value:!0})});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc