igniteui-react-grids
Version:
Ignite UI React grid components.
210 lines (209 loc) • 7.4 kB
JavaScript
import { __extends, __values } from "tslib";
import * as React from 'react';
import { ensureEnum, brushToString, stringToBrush, NamePatcher, isValidProp, getModifiedProps } from "igniteui-react-core";
import { ReactRenderer, PortalManager } from "igniteui-react-core";
import { DataGridStylingDefaults } from './DataGridStylingDefaults';
import { GridColumnSummaryOptions } from './GridColumnSummaryOptions';
import { IgrGridColumnOptionsSectionBase } from "./igr-grid-column-options-section-base";
import { ControlDisplayDensity_$type } from "igniteui-react-core";
var IgrGridColumnSummaryOptions = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrGridColumnSummaryOptions, _super);
function IgrGridColumnSummaryOptions(props) {
var _this = _super.call(this, props) || this;
_this._reactRenderer = null;
if (_this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this));
}
_this._getMainRef = _this._getMainRef.bind(_this);
if (document) {
_this._mainDiv = document.createElement("div");
_this._mainDiv.style.display = "block";
_this._mainDiv.style.width = "100%";
_this._mainDiv.style.height = "100%";
}
_this._portalManager = new PortalManager("summarySubMenu", _this.requestRender);
var ren = new ReactRenderer(_this._mainDiv, document, true, DataGridStylingDefaults, _this._portalManager);
_this._reactRenderer = ren;
_this.i.provideRenderer(ren);
if (props) {
_this.initializeProperties();
}
return _this;
}
IgrGridColumnSummaryOptions.prototype._getMainRef = function (ref) {
this._elRef = ref;
};
IgrGridColumnSummaryOptions.prototype.render = function () {
var children = [];
if (this._portalManager)
this._portalManager.onRender(children);
var div = React.createElement("div", {
className: "ig-grid-column-summary-options igr-grid-column-summary-options",
ref: this._getMainRef,
children: children
});
return div;
};
IgrGridColumnSummaryOptions.prototype.requestRender = function () {
if (this._initialized)
this.setState({});
};
IgrGridColumnSummaryOptions.prototype.shouldComponentUpdate = function (nextProps, nextState) {
var e_1, _a;
var mod = getModifiedProps(this.props, nextProps);
try {
for (var _b = __values(Object.keys(mod)), _c = _b.next(); !_c.done; _c = _b.next()) {
var p = _c.value;
if (isValidProp(this, p)) {
this[p] = mod[p];
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
return true;
};
IgrGridColumnSummaryOptions.prototype.initializeProperties = function () {
var e_2, _a;
try {
for (var _b = __values(Object.keys(this.props)), _c = _b.next(); !_c.done; _c = _b.next()) {
var p = _c.value;
if (isValidProp(this, p)) {
this[p] = this.props[p];
}
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
};
// supports angular themes or custom properties set in CSS
IgrGridColumnSummaryOptions.prototype.updateStyle = function () {
this._styling(this._mainDiv, this);
};
IgrGridColumnSummaryOptions.prototype.destroy = function () {
this.i.destroy();
this._reactRenderer.destroy();
};
IgrGridColumnSummaryOptions.prototype.componentWillUnmount = function () {
};
IgrGridColumnSummaryOptions.prototype.componentDidMount = function () {
this._elRef.appendChild(this._mainDiv);
this.initializeContent();
};
IgrGridColumnSummaryOptions.prototype.initializeContent = function () {
this._styling(this._mainDiv, this);
this.updateStyle();
};
IgrGridColumnSummaryOptions.prototype.createImplementation = function () {
return new GridColumnSummaryOptions();
};
Object.defineProperty(IgrGridColumnSummaryOptions.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnSummaryOptions.prototype, "summaryCaption", {
/**
* Gets or sets the text inside the summary button.
*/
get: function () {
return this.i.cd;
},
set: function (v) {
this.i.cd = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnSummaryOptions.prototype, "summaryListDensity", {
/**
* Gets or sets the display density used for the summary list.
*/
get: function () {
return this.i.b5;
},
set: function (v) {
this.i.b5 = ensureEnum(ControlDisplayDensity_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnSummaryOptions.prototype, "actualSummaryListDensity", {
/**
* Gets the actual display density used for the summary list.
*/
get: function () {
return this.i.b3;
},
set: function (v) {
this.i.b3 = ensureEnum(ControlDisplayDensity_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnSummaryOptions.prototype, "activeCount", {
get: function () {
return this.i.b7;
},
set: function (v) {
this.i.b7 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnSummaryOptions.prototype, "summaryListTextColor", {
get: function () {
return brushToString(this.i.cv);
},
set: function (v) {
this.i.cv = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnSummaryOptions.prototype, "summaryListBackground", {
get: function () {
return brushToString(this.i.cu);
},
set: function (v) {
this.i.cu = stringToBrush(v);
},
enumerable: false,
configurable: true
});
IgrGridColumnSummaryOptions.prototype.onApply = function () {
this.i.bt();
};
IgrGridColumnSummaryOptions.prototype.onCancel = function () {
this.i.bu();
};
IgrGridColumnSummaryOptions.prototype.closeMenu = function () {
this.i.cj();
};
return IgrGridColumnSummaryOptions;
}(IgrGridColumnOptionsSectionBase));
export { IgrGridColumnSummaryOptions };