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.2.0 to 21.0.0

src/react-app-env.d.ts

2

lib/agGridColumn.d.ts

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

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

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

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

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

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

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

// ag-grid-react v20.2.0
// ag-grid-react v21.0.0
import * as React from "react";

@@ -42,3 +42,5 @@ import { ReactPortal } from "react";

componentWillReceiveProps(nextProps: any): void;
private extractDeclarativeColDefChanges;
private extractGridPropertyChanges;
componentWillUnmount(): void;
}

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

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

@@ -93,5 +93,8 @@ var __extends = (this && this.__extends) || (function () {

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

@@ -149,5 +152,28 @@ if (runningTime >= AgGridReact.MAX_COMPONENT_CREATION_TIME) {

AgGridReact.prototype.componentWillReceiveProps = function (nextProps) {
var changes = {};
this.extractGridPropertyChanges(nextProps, changes);
this.extractDeclarativeColDefChanges(nextProps, changes);
AgGrid.ComponentUtil.processOnChange(changes, this.gridOptions, this.api, this.columnApi);
};
AgGridReact.prototype.extractDeclarativeColDefChanges = function (nextProps, changes) {
var debugLogging = !!nextProps.debug;
if (agGridColumn_1.AgGridColumn.hasChildColumns(nextProps)) {
var detectionStrategy = this.changeDetectionService.getStrategy(changeDetectionService_1.ChangeDetectionStrategyType.DeepValueCheck);
var currentColDefs = this.gridOptions.columnDefs;
var newColDefs = agGridColumn_1.AgGridColumn.mapChildColumnDefs(nextProps);
if (!detectionStrategy.areEqual(currentColDefs, newColDefs)) {
if (debugLogging) {
console.log("agGridReact: colDefs definitions changed");
}
changes['columnDefs'] =
{
previousValue: this.gridOptions.columnDefs,
currentValue: agGridColumn_1.AgGridColumn.mapChildColumnDefs(nextProps)
};
}
}
};
AgGridReact.prototype.extractGridPropertyChanges = function (nextProps, changes) {
var _this = this;
var debugLogging = !!nextProps.debug;
var changes = {};
var changedKeys = Object.keys(nextProps);

@@ -179,3 +205,2 @@ changedKeys.forEach(function (propKey) {

});
AgGrid.ComponentUtil.processOnChange(changes, this.gridOptions, this.api, this.columnApi);
};

@@ -182,0 +207,0 @@ AgGridReact.prototype.componentWillUnmount = function () {

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

// ag-grid-react v20.2.0
// ag-grid-react v21.0.0
import { IComponent, WrapableInterface } from 'ag-grid-community';

@@ -3,0 +3,0 @@ export declare abstract class BaseReactComponent implements IComponent<any>, WrapableInterface {

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

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

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

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

// ag-grid-react v20.2.0
// ag-grid-react v21.0.0
export declare enum ChangeDetectionStrategyType {

@@ -3,0 +3,0 @@ IdentityCheck = "IdentityCheck",

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

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

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

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

// ag-grid-react v20.2.0
// ag-grid-react v21.0.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.2.0
// ag-grid-react v21.0.0
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

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

// ag-grid-react v20.2.0
// ag-grid-react v21.0.0
import { Promise } from 'ag-grid-community';

@@ -3,0 +3,0 @@ import { AgGridReact } from "./agGridReact";

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

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

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

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

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

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

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

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

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

// ag-grid-react v20.2.0
// ag-grid-react v21.0.0
import { Promise } from 'ag-grid-community';

@@ -13,2 +13,4 @@ import { AgGridReact } from "./agGridReact";

private statelessComponent;
private orphans;
private unwrapComponent;
constructor(reactComponent: any, parentComponent: AgGridReact);

@@ -23,3 +25,4 @@ getFrameworkComponentInstance(): any;

private createParentElement;
statelessComponentRendered(): boolean;
private static isStateless;
}

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

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

@@ -28,4 +28,6 @@ var __extends = (this && this.__extends) || (function () {

_this.componentWrappingElement = 'div';
_this.unwrapComponent = true;
_this.reactComponent = reactComponent;
_this.parentComponent = parentComponent;
_this.orphans = [];
_this.statelessComponent = ReactComponent.isStateless(_this.reactComponent);

@@ -46,2 +48,4 @@ return _this;

return new ag_grid_community_1.Promise(function (resolve) {
// functional components have to have the wrapping div... :-(
_this.unwrapComponent = _this.parentComponent.props.componentWrappingElement === undefined && !_this.statelessComponent;
_this.eParentElement = _this.createParentElement(params);

@@ -52,5 +56,29 @@ _this.createReactComponent(params, resolve);

ReactComponent.prototype.getGui = function () {
return this.eParentElement;
if (this.unwrapComponent) {
var fragment = document.createDocumentFragment();
if (this.orphans.length > 0) {
for (var _i = 0, _a = this.orphans; _i < _a.length; _i++) {
var orphan = _a[_i];
fragment.appendChild(orphan);
}
}
else {
while (this.eParentElement.firstChild) {
this.orphans.push(this.eParentElement.firstChild);
fragment.appendChild(this.eParentElement.firstChild);
}
}
return fragment;
}
else {
return this.eParentElement;
}
};
ReactComponent.prototype.destroy = function () {
if (this.unwrapComponent) {
for (var _i = 0, _a = this.orphans; _i < _a.length; _i++) {
var orphan = _a[_i];
this.eParentElement.appendChild(orphan);
}
}
return this.parentComponent.destroyPortal(this.portal);

@@ -74,8 +102,13 @@ };

var eParentElement = document.createElement(this.parentComponent.props.componentWrappingElement || 'div');
AgGrid.Utils.addCssClass(eParentElement, 'ag-react-container');
// so user can have access to the react container,
// to add css class or style
params.reactContainer = this.eParentElement;
if (!this.unwrapComponent) {
AgGrid.Utils.addCssClass(eParentElement, 'ag-react-container');
// so user can have access to the react container,
// to add css class or style
params.reactContainer = this.eParentElement;
}
return eParentElement;
};
ReactComponent.prototype.statelessComponentRendered = function () {
return this.eParentElement.childElementCount > 0;
};
ReactComponent.isStateless = function (Component) {

@@ -82,0 +115,0 @@ return (typeof Component === 'function' &&

{
"name": "ag-grid-react",
"version": "20.2.0",
"version": "21.0.0",
"description": "ag-Grid React Component",

@@ -11,3 +11,4 @@ "main": "main.js",

"test": "CI=true react-scripts test --verbose=false",
"test:watch": "react-scripts test --verbose=false"
"test:watch": "react-scripts test --verbose=false",
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache"
},

@@ -39,5 +40,5 @@ "repository": {

"@types/prop-types": "^15.5.6",
"@types/react": "^16.8.8",
"@types/react-dom": "^16.8.2",
"ag-grid-community": "^20.2.0",
"@types/react": "16.8.17",
"@types/react-dom": "16.8.4",
"ag-grid-community": "^21.0.0",
"enzyme": "^3.9.0",

@@ -60,10 +61,10 @@ "enzyme-adapter-react-16": "^1.10.0",

"tslib": "^1.9.3",
"typescript": "~3.2.1",
"typescript": "~3.4.1",
"vinyl-source-stream": "^2.0.0"
},
"peerDependencies": {
"ag-grid-community": "^20.2.0",
"ag-grid-community": "^21.0.0",
"react": "^15.5.0 || ^16.0.0",
"react-dom": "^15.5.0 || ^16.0.0"
}
}
}

@@ -99,4 +99,6 @@ import * as React from "react";

waitForInstance(reactComponent: ReactComponent, resolve: (value: any) => void, runningTime = 0) {
if (reactComponent.getFrameworkComponentInstance() || reactComponent.isStatelesComponent()) {
if (reactComponent.isStatelesComponent() && reactComponent.statelessComponentRendered()) {
resolve(null);
} else if (!reactComponent.isStatelesComponent() && reactComponent.getFrameworkComponentInstance()) {
resolve(null);
} else {

@@ -159,5 +161,35 @@ if (runningTime >= AgGridReact.MAX_COMPONENT_CREATION_TIME) {

componentWillReceiveProps(nextProps: any) {
const changes = <any>{};
this.extractGridPropertyChanges(nextProps, changes);
this.extractDeclarativeColDefChanges(nextProps, changes);
AgGrid.ComponentUtil.processOnChange(changes, this.gridOptions, this.api!, this.columnApi);
}
private extractDeclarativeColDefChanges(nextProps: any, changes: any) {
let debugLogging = !!nextProps.debug;
const changes = <any>{};
if (AgGridColumn.hasChildColumns(nextProps)) {
const detectionStrategy = this.changeDetectionService.getStrategy(ChangeDetectionStrategyType.DeepValueCheck);
const currentColDefs = this.gridOptions.columnDefs;
const newColDefs = AgGridColumn.mapChildColumnDefs(nextProps);
if (!detectionStrategy.areEqual(currentColDefs, newColDefs)) {
if (debugLogging) {
console.log(`agGridReact: colDefs definitions changed`);
}
changes['columnDefs'] =
{
previousValue: this.gridOptions.columnDefs,
currentValue: AgGridColumn.mapChildColumnDefs(nextProps)
}
}
}
}
private extractGridPropertyChanges(nextProps: any, changes: any) {
let debugLogging = !!nextProps.debug;
const changedKeys = Object.keys(nextProps);

@@ -190,5 +222,2 @@ changedKeys.forEach((propKey) => {

});
AgGrid.ComponentUtil.processOnChange(changes, this.gridOptions, this.api!, this.columnApi);
}

@@ -195,0 +224,0 @@

@@ -19,2 +19,4 @@ import * as React from 'react';

private statelessComponent: boolean;
private orphans: any[];
private unwrapComponent: boolean = true;

@@ -27,2 +29,4 @@ constructor(reactComponent: any, parentComponent: AgGridReact) {

this.orphans = [];
this.statelessComponent = ReactComponent.isStateless(this.reactComponent);

@@ -45,2 +49,4 @@ }

return new Promise<void>(resolve => {
// functional components have to have the wrapping div... :-(
this.unwrapComponent = this.parentComponent.props.componentWrappingElement === undefined && !this.statelessComponent;
this.eParentElement = this.createParentElement(params);

@@ -52,7 +58,28 @@ this.createReactComponent(params, resolve);

public getGui(): HTMLElement {
if (this.unwrapComponent) {
const fragment = document.createDocumentFragment();
return this.eParentElement;
if (this.orphans.length > 0) {
for (const orphan of this.orphans) {
fragment.appendChild(orphan)
}
} else {
while (this.eParentElement.firstChild) {
this.orphans.push(this.eParentElement.firstChild);
fragment.appendChild(this.eParentElement.firstChild)
}
}
return fragment as any;
} else {
return this.eParentElement;
}
}
public destroy(): void {
if (this.unwrapComponent) {
for (const orphan of this.orphans) {
this.eParentElement.appendChild(orphan);
}
}
return this.parentComponent.destroyPortal(this.portal as ReactPortal);

@@ -80,17 +107,24 @@ }

private createParentElement(params: any) {
const eParentElement = document.createElement(this.parentComponent.props.componentWrappingElement || 'div');
AgGrid.Utils.addCssClass(eParentElement as HTMLElement, 'ag-react-container');
let eParentElement = document.createElement(this.parentComponent.props.componentWrappingElement || 'div');
// so user can have access to the react container,
// to add css class or style
params.reactContainer = this.eParentElement;
if (!this.unwrapComponent) {
AgGrid.Utils.addCssClass(eParentElement as HTMLElement, 'ag-react-container');
// so user can have access to the react container,
// to add css class or style
params.reactContainer = this.eParentElement;
}
return eParentElement;
}
public statelessComponentRendered(): boolean {
return this.eParentElement.childElementCount > 0;
}
private static isStateless(Component: any) {
return (
typeof Component === 'function' &&
!(Component.prototype && Component.prototype.isReactComponent)
!(Component.prototype && Component.prototype.isReactComponent)
);
}
}

@@ -11,2 +11,6 @@ {

"react-dom"
],
"lib": [
"es2015",
"dom"
]

@@ -13,0 +17,0 @@ },

@@ -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,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})});
!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 c(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 s=function(r){function n(t,e){var n=r.call(this,t,e)||this;return n.props=t,n.state=e,n}return c(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){s[t]=e})}o(p.ColDefUtil.BOOLEAN_PROPERTIES,e.bool),o(p.ColDefUtil.STRING_PROPERTIES,e.string),o(p.ColDefUtil.OBJECT_PROPERTIES,e.object),o(p.ColDefUtil.ARRAY_PROPERTIES,e.array),o(p.ColDefUtil.NUMBER_PROPERTIES,e.number),o(p.ColDefUtil.FUNCTION_PROPERTIES,e.func);var u,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.unwrapComponent=!0,n.reactComponent=t,n.parentComponent=e,n.orphans=[],n.statelessComponent=o.isStateless(n.reactComponent),n}return c(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 p.Promise(function(t){n.unwrapComponent=void 0===n.parentComponent.props.componentWrappingElement&&!n.statelessComponent,n.eParentElement=n.createParentElement(e),n.createReactComponent(e,t)})},o.prototype.getGui=function(){if(this.unwrapComponent){var t=document.createDocumentFragment();if(0<this.orphans.length)for(var e=0,n=this.orphans;e<n.length;e++){var r=n[e];t.appendChild(r)}else for(;this.eParentElement.firstChild;)this.orphans.push(this.eParentElement.firstChild),t.appendChild(this.eParentElement.firstChild);return t}return this.eParentElement},o.prototype.destroy=function(){if(this.unwrapComponent)for(var t=0,e=this.orphans;t<e.length;t++){var n=e[t];this.eParentElement.appendChild(n)}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 this.unwrapComponent||(p.Utils.addCssClass(e,"ag-react-container"),t.reactContainer=this.eParentElement),e},o.prototype.statelessComponentRendered=function(){return 0<this.eParentElement.childElementCount},o.isStateless=function(t){return"function"==typeof t&&!(t.prototype&&t.prototype.isReactComponent)},o}(f);(l=u||(u={})).IdentityCheck="IdentityCheck",l.DeepValueCheck="DeepValueCheck",l.NoCheck="NoCheck";var m=function(){function t(){var t;this.strategyMap=((t={})[u.DeepValueCheck]=new C,t[u.IdentityCheck]=new d(function(t,e){return t===e}),t[u.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}(),C=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}(),y=function(r){function t(t,e){var n=r.call(this)||this;return n.reactComponent=t,n.parentComponent=e,n}return c(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 p.Promise(function(t){n.eParentElement=document.createElement(n.parentComponent.props.componentWrappingElement||"div"),p.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 c(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||{};s.hasChildColumns(this.props)&&(e.columnDefs=s.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},o.prototype.shouldComponentUpdate=function(){return!1},o.prototype.waitForInstance=function(t,e,n){var r=this;if(void 0===n&&(n=0),t.isStatelesComponent()&&t.statelessComponentRendered())e(null);else if(!t.isStatelesComponent()&&t.getFrameworkComponentInstance())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 u.IdentityCheck}return u.DeepValueCheck},o.prototype.componentWillReceiveProps=function(t){var e={};this.extractGridPropertyChanges(t,e),this.extractDeclarativeColDefChanges(t,e),p.ComponentUtil.processOnChange(e,this.gridOptions,this.api,this.columnApi)},o.prototype.extractDeclarativeColDefChanges=function(t,e){var n=!!t.debug;if(s.hasChildColumns(t)){var r=this.changeDetectionService.getStrategy(u.DeepValueCheck),o=this.gridOptions.columnDefs,i=s.mapChildColumnDefs(t);r.areEqual(o,i)||(n&&console.log("agGridReact: colDefs definitions changed"),e.columnDefs={previousValue:this.gridOptions.columnDefs,currentValue:s.mapChildColumnDefs(t)})}},o.prototype.extractGridPropertyChanges=function(e,n){var r=this,o=!!e.debug;Object.keys(e).forEach(function(t){-1!==p.ComponentUtil.ALL_PROPERTIES.indexOf(t)&&(r.changeDetectionService.getStrategy(r.getStrategyTypeForProp(t)).areEqual(r.props[t],e[t])||(o&&console.log("agGridReact: ["+t+"] property changed"),n[t]={previousValue:r.props[t],currentValue:e[t]}))}),p.ComponentUtil.getEventCallbacks().forEach(function(t){r.props[t]!==e[t]&&(o&&console.log("agGridReact: ["+t+"] event callback changed"),n[t]={previousValue:r.props[t],currentValue:e[t]})})},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(p.ComponentUtil.getEventCallbacks(),e.func),E(p.ComponentUtil.BOOLEAN_PROPERTIES,e.bool),E(p.ComponentUtil.STRING_PROPERTIES,e.string),E(p.ComponentUtil.OBJECT_PROPERTIES,e.object),E(p.ComponentUtil.ARRAY_PROPERTIES,e.array),E(p.ComponentUtil.NUMBER_PROPERTIES,e.number),E(p.ComponentUtil.FUNCTION_PROPERTIES,e.func);var v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.createWrapper=function(t){return this.useLegacyReact()?new y(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([p.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([p.Bean("frameworkComponentWrapper")],e)}(p.BaseComponentWrapper);p.Grid.setFrameworkBeans([v]),t.AgGridReact=g,t.AgGridColumn=s,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