1 |
|
2 | "use strict";
|
3 | var __extends = (this && this.__extends) || (function () {
|
4 | var extendStatics = function (d, b) {
|
5 | extendStatics = Object.setPrototypeOf ||
|
6 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
7 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
8 | return extendStatics(d, b);
|
9 | };
|
10 | return function (d, b) {
|
11 | extendStatics(d, b);
|
12 | function __() { this.constructor = d; }
|
13 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14 | };
|
15 | })();
|
16 | var __rest = (this && this.__rest) || function (s, e) {
|
17 | var t = {};
|
18 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
19 | t[p] = s[p];
|
20 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
21 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
22 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
23 | t[p[i]] = s[p[i]];
|
24 | }
|
25 | return t;
|
26 | };
|
27 | Object.defineProperty(exports, "__esModule", { value: true });
|
28 | var React = require("react");
|
29 | var react_1 = require("react");
|
30 | var PropTypes = require("prop-types");
|
31 | var AgGrid = require("ag-grid-community");
|
32 | var AgGridColumn = (function (_super) {
|
33 | __extends(AgGridColumn, _super);
|
34 | function AgGridColumn(props) {
|
35 | var _this = _super.call(this, props) || this;
|
36 | _this.props = props;
|
37 | return _this;
|
38 | }
|
39 | AgGridColumn.prototype.render = function () {
|
40 | return null;
|
41 | };
|
42 | AgGridColumn.mapChildColumnDefs = function (children) {
|
43 | return React.Children.map(children, function (child) { return !!child ? AgGridColumn.toColDef(child.props) : null; });
|
44 | };
|
45 | AgGridColumn.toColDef = function (columnProps) {
|
46 | var children = columnProps.children, colDef = __rest(columnProps, ["children"]);
|
47 | if (AgGridColumn.hasChildColumns(children)) {
|
48 | colDef.children = AgGridColumn.mapChildColumnDefs(children);
|
49 | }
|
50 | return colDef;
|
51 | };
|
52 | AgGridColumn.hasChildColumns = function (children) {
|
53 | return React.Children.count(children) > 0;
|
54 | };
|
55 | return AgGridColumn;
|
56 | }(react_1.Component));
|
57 | exports.AgGridColumn = AgGridColumn;
|
58 | addProperties(AgGrid.ColDefUtil.BOOLEAN_PROPERTIES, PropTypes.bool);
|
59 | addProperties(AgGrid.ColDefUtil.STRING_PROPERTIES, PropTypes.string);
|
60 | addProperties(AgGrid.ColDefUtil.OBJECT_PROPERTIES, PropTypes.object);
|
61 | addProperties(AgGrid.ColDefUtil.ARRAY_PROPERTIES, PropTypes.array);
|
62 | addProperties(AgGrid.ColDefUtil.NUMBER_PROPERTIES, PropTypes.number);
|
63 | addProperties(AgGrid.ColDefUtil.FUNCTION_PROPERTIES, PropTypes.func);
|
64 | function addProperties(listOfProps, propType) {
|
65 | listOfProps.forEach(function (propKey) {
|
66 | AgGridColumn[propKey] = propType;
|
67 | });
|
68 | }
|