Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sap.ui.define(['sap/m/P13nFilterPanel', 'br/com/sigga/components/CustomP13nConditionPanel'], function (P13nFilterPanel, CustomP13nConditionPanel) {
- "use strict";
- const CustomP13nFilterPanel = P13nFilterPanel.extend("br.com.sigga.components.CustomP13nFilterPanel", {
- metadata: {
- library: "br.com.sigga.components"
- },
- renderer(oRm, oControl) {
- // start ConditionPanel
- oRm.write("<section");
- oRm.writeControlData(oControl);
- oRm.addClass("sapMFilterPanel");
- // oRm.addStyle("width", oControl.getWidth());
- // oRm.addStyle("height", oControl.getHeight());
- oRm.writeClasses();
- oRm.writeStyles();
- oRm.write(">");
- // render content
- oRm.write("<div");
- oRm.addClass("sapMFilterPanelContent");
- oRm.addClass("sapMFilterPanelBG");
- oRm.writeClasses();
- oRm.write(">");
- const aChildren = oControl.getAggregation("content");
- const iLength = aChildren.length;
- for (let i = 0; i < iLength; i++) {
- oRm.renderControl(aChildren[i]);
- }
- oRm.write("</div>");
- oRm.write("</section>");
- }
- });
- CustomP13nFilterPanel.prototype.init = function () {
- this.setType(sap.m.P13nPanelType.filter);
- this.setTitle(sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("FILTERPANEL_TITLE"));
- sap.ui.getCore().loadLibrary("sap.ui.layout");
- jQuery.sap.require("sap.ui.layout.Grid");
- sap.ui.layout.Grid.prototype.init.apply(this);
- this._aKeyFields = [];
- this.addStyleClass("sapMFilterPanel");
- // init some resources
- this._oRb = sap.ui.getCore().getLibraryResourceBundle("sap.m");
- this._aIncludeOperations = {};
- if (!this._aIncludeOperations.default) {
- this.setIncludeOperations([
- sap.m.P13nConditionOperation.EQ, sap.m.P13nConditionOperation.BT, sap.m.P13nConditionOperation.LT, sap.m.P13nConditionOperation.LE, sap.m.P13nConditionOperation.GT, sap.m.P13nConditionOperation.GE
- ]);
- }
- if (!this._aIncludeOperations.string) {
- this.setIncludeOperations([
- sap.m.P13nConditionOperation.Contains, sap.m.P13nConditionOperation.EQ, sap.m.P13nConditionOperation.BT, sap.m.P13nConditionOperation.StartsWith, sap.m.P13nConditionOperation.EndsWith, sap.m.P13nConditionOperation.LT, sap.m.P13nConditionOperation.LE, sap.m.P13nConditionOperation.GT, sap.m.P13nConditionOperation.GE
- ], "string");
- }
- if (!this._aIncludeOperations.date) {
- this.setIncludeOperations([
- sap.m.P13nConditionOperation.EQ, sap.m.P13nConditionOperation.BT, sap.m.P13nConditionOperation.LT, sap.m.P13nConditionOperation.LE, sap.m.P13nConditionOperation.GT, sap.m.P13nConditionOperation.GE
- ], "date");
- }
- if (!this._aIncludeOperations.time) {
- this.setIncludeOperations([
- sap.m.P13nConditionOperation.EQ, sap.m.P13nConditionOperation.BT, sap.m.P13nConditionOperation.LT, sap.m.P13nConditionOperation.LE, sap.m.P13nConditionOperation.GT, sap.m.P13nConditionOperation.GE
- ], "time");
- }
- if (!this._aIncludeOperations.numeric) {
- this.setIncludeOperations([
- sap.m.P13nConditionOperation.EQ, sap.m.P13nConditionOperation.BT, sap.m.P13nConditionOperation.LT, sap.m.P13nConditionOperation.LE, sap.m.P13nConditionOperation.GT, sap.m.P13nConditionOperation.GE
- ], "numeric");
- }
- if (!this._aIncludeOperations.boolean) {
- this.setIncludeOperations([
- sap.m.P13nConditionOperation.EQ
- ], "boolean");
- }
- this._aExcludeOperations = {};
- if (!this._aExcludeOperations.default) {
- this.setExcludeOperations([
- sap.m.P13nConditionOperation.EQ
- ]);
- }
- this._oIncludePanel = new sap.m.Panel({
- expanded: true,
- expandable: true,
- headerText: this._oRb.getText("FILTERPANEL_INCLUDES"),
- width: "auto"
- }).addStyleClass("sapMFilterPadding");
- this._oIncludeFilterPanel = new CustomP13nConditionPanel({
- maxConditions: this.getMaxIncludes(),
- alwaysShowAddIcon: false,
- layoutMode: this.getLayoutMode(),
- dataChange: this._handleDataChange()
- });
- this._oIncludeFilterPanel._sAddRemoveIconTooltipKey = "FILTER";
- for (const sType in this._aIncludeOperations) {
- this._oIncludeFilterPanel.setOperations(this._aIncludeOperations[sType], sType);
- }
- this._oIncludePanel.addContent(this._oIncludeFilterPanel);
- this.addAggregation("content", this._oIncludePanel);
- this._oExcludePanel = new sap.m.Panel({
- expanded: false,
- expandable: true,
- headerText: this._oRb.getText("FILTERPANEL_EXCLUDES"),
- width: "auto"
- }).addStyleClass("sapMFilterPadding");
- this._oExcludeFilterPanel = new CustomP13nConditionPanel({
- exclude: true,
- maxConditions: this.getMaxExcludes(),
- alwaysShowAddIcon: false,
- layoutMode: this.getLayoutMode(),
- dataChange: this._handleDataChange()
- });
- this._oExcludeFilterPanel._sAddRemoveIconTooltipKey = "FILTER";
- for (const sType in this._aExcludeOperations) {
- this._oExcludeFilterPanel.setOperations(this._aExcludeOperations[sType], sType);
- }
- this._oExcludePanel.addContent(this._oExcludeFilterPanel);
- this.addAggregation("content", this._oExcludePanel);
- this._updatePanel();
- };
- return CustomP13nFilterPanel;
- });
Add Comment
Please, Sign In to add comment