igniteui-react-grids
Version:
Ignite UI React grid components.
223 lines (222 loc) • 9.24 kB
JavaScript
import { __extends, __values } from "tslib";
import * as React from 'react';
import { ensureEnum, NamePatcher, isValidProp, getModifiedProps } from "igniteui-react-core";
import { ReactRenderer } from "igniteui-react-core";
import { DataGridStylingDefaults } from './DataGridStylingDefaults';
import { GridColumnFilterOptions } from './GridColumnFilterOptions';
import { IgrGridColumnOptionsSectionBase } from "./igr-grid-column-options-section-base";
import { IgrCheckboxList } from "./igr-checkbox-list";
import { ControlDisplayDensity_$type } from "igniteui-react-core";
var IgrGridColumnFilterOptions = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrGridColumnFilterOptions, _super);
function IgrGridColumnFilterOptions(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);
_this._getClearFiltersSectionRef = _this._getClearFiltersSectionRef.bind(_this);
_this._getFilterSectionRef = _this._getFilterSectionRef.bind(_this);
_this._getFilterCheckboxListSectionRef = _this._getFilterCheckboxListSectionRef.bind(_this);
_this._getFilterButtonsSectionRef = _this._getFilterButtonsSectionRef.bind(_this);
if (document) {
_this._mainDiv = document.createElement("div");
_this._mainDiv.style.display = "block";
_this._mainDiv.style.width = "100%";
_this._mainDiv.style.height = "100%";
}
var ren = new ReactRenderer(_this._mainDiv, document, true, DataGridStylingDefaults);
_this._reactRenderer = ren;
var gridColumnFilterOptions = _this.i;
gridColumnFilterOptions.provideRenderer(ren);
if (props) {
_this.initializeProperties();
}
return _this;
}
IgrGridColumnFilterOptions.prototype._getMainRef = function (ref) {
this._elRef = ref;
this.verifyReferences();
};
IgrGridColumnFilterOptions.prototype._getClearFiltersSectionRef = function (ref) {
this._clearFiltersSectionRef = ref;
this.verifyReferences();
};
IgrGridColumnFilterOptions.prototype._getFilterSectionRef = function (ref) {
this._filterSectionRef = ref;
this.verifyReferences();
};
IgrGridColumnFilterOptions.prototype._getFilterCheckboxListSectionRef = function (ref) {
this._filterCheckboxListSectionRef = ref;
this.verifyReferences();
};
IgrGridColumnFilterOptions.prototype._getFilterButtonsSectionRef = function (ref) {
this._filterButtonsSectionRef = ref;
this.verifyReferences();
};
IgrGridColumnFilterOptions.prototype.verifyReferences = function () {
if (this._reactRenderer &&
this._elRef &&
this._clearFiltersSectionRef &&
this._filterSectionRef &&
this._filterCheckboxListSectionRef &&
this._filterButtonsSectionRef) {
var gridColumnFilterOptions = this.i;
var mainRef = this._reactRenderer.getWrapper(this._elRef);
gridColumnFilterOptions.provideMainDiv(mainRef);
var clearFiltersSectionWrapper = this._reactRenderer.getWrapper(this._clearFiltersSectionRef);
gridColumnFilterOptions.provideClearFiltersSection(clearFiltersSectionWrapper);
var filtersSectionWrapper = this._reactRenderer.getWrapper(this._filterSectionRef);
gridColumnFilterOptions.provideFilterSection(filtersSectionWrapper);
gridColumnFilterOptions.provideFilterCheckboxListSection(this._filterCheckboxListSectionRef.i);
var filterButtonsSectionWrapper = this._reactRenderer.getWrapper(this._filterButtonsSectionRef);
gridColumnFilterOptions.provideFilterButtonSection(filterButtonsSectionWrapper);
}
};
IgrGridColumnFilterOptions.prototype.render = function () {
var divStyle = {
height: "195px"
};
return (React.createElement("div", { className: "ig-grid-column-filter-options igr-grid-column-filter-options", ref: this._getMainRef }, React.createElement("div", { ref: this._getClearFiltersSectionRef, key: "clearFiltersSection" }), React.createElement("div", { ref: this._getFilterSectionRef, key: "filtersSection" }), React.createElement("div", { style: divStyle }, React.createElement(IgrCheckboxList, { height: "100%", ref: this._getFilterCheckboxListSectionRef, key: "filterCheckboxListSection" })), React.createElement("div", { ref: this._getFilterButtonsSectionRef, key: "filterButtonsSection" })));
};
IgrGridColumnFilterOptions.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;
};
IgrGridColumnFilterOptions.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
IgrGridColumnFilterOptions.prototype.updateStyle = function () {
this._styling(this._mainDiv, this);
};
IgrGridColumnFilterOptions.prototype.destroy = function () {
this.i.destroy();
this._reactRenderer.destroy();
};
IgrGridColumnFilterOptions.prototype.componentWillUnmount = function () {
};
IgrGridColumnFilterOptions.prototype.componentDidMount = function () {
this._elRef.appendChild(this._mainDiv);
this.initializeContent();
};
IgrGridColumnFilterOptions.prototype.initializeContent = function () {
this._styling(this._mainDiv, this);
this.updateStyle();
};
IgrGridColumnFilterOptions.prototype.createImplementation = function () {
return new GridColumnFilterOptions();
};
Object.defineProperty(IgrGridColumnFilterOptions.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnFilterOptions.prototype, "clearColumnFiltersCaption", {
get: function () {
return this.i.b7;
},
set: function (v) {
this.i.b7 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnFilterOptions.prototype, "filterListPlaceholderText", {
get: function () {
return this.i.cc;
},
set: function (v) {
this.i.cc = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnFilterOptions.prototype, "filterListDensity", {
/**
* Gets or sets the display Density to use for the buttons in the component.
*/
get: function () {
return this.i.b2;
},
set: function (v) {
this.i.b2 = ensureEnum(ControlDisplayDensity_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnFilterOptions.prototype, "actualFilterListDensity", {
/**
* Gets the actual display filterListDensity to use for the component.
*/
get: function () {
return this.i.b0;
},
set: function (v) {
this.i.b0 = ensureEnum(ControlDisplayDensity_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridColumnFilterOptions.prototype, "textFilterCaption", {
get: function () {
return this.i.cg;
},
set: function (v) {
this.i.cg = v;
},
enumerable: false,
configurable: true
});
IgrGridColumnFilterOptions.prototype.onApply = function () {
this.i.bt();
};
return IgrGridColumnFilterOptions;
}(IgrGridColumnOptionsSectionBase));
export { IgrGridColumnFilterOptions };