- Fix attribute inheritance didn't work properly

- Get nextmatch filterheader working
This commit is contained in:
nathangray 2020-02-04 16:07:50 -07:00
parent 12eb1dec61
commit e0bc769315
7 changed files with 88 additions and 27 deletions

View File

@ -125,10 +125,10 @@ var ClassWithAttributes = /** @class */ (function () {
class_tree.push(class_prototype);
class_prototype = Object.getPrototypeOf(class_prototype);
} while (class_prototype !== ClassWithAttributes && n < 50);
for (var i = class_tree.length - 1; i > 0; i--) {
class_tree[i - 1]._attributes = ClassWithAttributes.extendAttributes(class_tree[i - 1]._attributes, class_tree[i]._attributes);
for (var i = class_tree.length - 1; i >= 0; i--) {
attributes = ClassWithAttributes.extendAttributes(attributes, class_tree[i]._attributes);
}
return class_tree[0]._attributes;
return attributes;
};
/**
* Extend current _attributes with the one from the parent class

View File

@ -166,11 +166,11 @@ export class ClassWithAttributes
class_prototype = Object.getPrototypeOf(class_prototype);
} while (class_prototype !== ClassWithAttributes && n < 50);
for(let i = class_tree.length - 1; i > 0; i--)
for(let i = class_tree.length - 1; i >= 0; i--)
{
class_tree[i-1]._attributes = ClassWithAttributes.extendAttributes(class_tree[i-1]._attributes,class_tree[i]._attributes);
attributes = ClassWithAttributes.extendAttributes(attributes,class_tree[i]._attributes);
}
return class_tree[0]._attributes;
return attributes;
}
/**
* Extend current _attributes with the one from the parent class

View File

@ -297,7 +297,6 @@ var et2_dataview_selectionManager = /** @class */ (function () {
}
return element;
}
_entry.ao.getPrevious = function (_step) {
return getElementRelatively(-_step);
};

View File

@ -57,12 +57,12 @@ var __extends = (this && this.__extends) || (function () {
Object.defineProperty(exports, "__esModule", { value: true });
require("./et2_core_common");
require("./et2_core_interfaces");
var et2_core_inheritance_1 = require("./et2_core_inheritance");
var et2_core_widget_1 = require("./et2_core_widget");
var et2_core_DOMWidget_1 = require("./et2_core_DOMWidget");
var et2_core_baseWidget_1 = require("./et2_core_baseWidget");
var et2_core_inputWidget_1 = require("./et2_core_inputWidget");
var et2_widget_selectbox_1 = require("./et2_widget_selectbox");
var et2_core_inheritance_1 = require("./et2_core_inheritance");
var et2_extension_nextmatch_rowProvider_1 = require("./et2_extension_nextmatch_rowProvider");
var et2_extension_nextmatch_controller_1 = require("./et2_extension_nextmatch_controller");
var et2_dataview_1 = require("./et2_dataview");
@ -2578,6 +2578,34 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super) {
sub_header.iterateOver(bind_change, this, et2_core_inputWidget_1.et2_inputWidget);
}
};
et2_nextmatch_header_bar._attributes = {
"filter_label": {
"name": "Filter label",
"type": "string",
"description": "Label for filter",
"default": "",
"translate": true
},
"filter_help": {
"name": "Filter help",
"type": "string",
"description": "Help message for filter",
"default": "",
"translate": true
},
"filter": {
"name": "Filter value",
"type": "any",
"description": "Current value for filter",
"default": ""
},
"no_filter": {
"name": "No filter",
"type": "boolean",
"description": "Remove filter",
"default": false
}
};
return et2_nextmatch_header_bar;
}(et2_core_DOMWidget_1.et2_DOMWidget));
et2_core_widget_1.et2_register_widget(et2_nextmatch_header_bar, ["nextmatch_header_bar"]);
@ -2615,6 +2643,14 @@ var et2_nextmatch_header = /** @class */ (function (_super) {
// add class if label is empty
this.labelNode.toggleClass('et2_label_empty', !_value);
};
et2_nextmatch_header._attributes = {
"label": {
"name": "Caption",
"type": "string",
"description": "Caption for the nextmatch header",
"translate": true
}
};
return et2_nextmatch_header;
}(et2_core_baseWidget_1.et2_baseWidget));
exports.et2_nextmatch_header = et2_nextmatch_header;
@ -2798,6 +2834,16 @@ var et2_nextmatch_customfields = /** @class */ (function (_super) {
}
return name;
};
et2_nextmatch_customfields._attributes = {
'customfields': {
'name': 'Custom fields',
'description': 'Auto filled'
},
'fields': {
'name': "Visible fields",
"description": "Auto filled"
}
};
return et2_nextmatch_customfields;
}(et2_container));
exports.et2_nextmatch_customfields = et2_nextmatch_customfields;
@ -2849,12 +2895,20 @@ var et2_nextmatch_sortheader = /** @class */ (function (_super) {
.addClass(_mode);
this.sortmode = _mode;
};
et2_nextmatch_sortheader._attributes = {
"sortmode": {
"name": "Sort order",
"type": "string",
"description": "Default sort order",
"translate": false
}
};
return et2_nextmatch_sortheader;
}(et2_nextmatch_header));
exports.et2_nextmatch_sortheader = et2_nextmatch_sortheader;
et2_core_widget_1.et2_register_widget(et2_nextmatch_sortheader, ['nextmatch-sortheader']);
/**
* @augments et2_selectbox
* Filter from a provided list of options
*/
var et2_nextmatch_filterheader = /** @class */ (function (_super) {
__extends(et2_nextmatch_filterheader, _super);
@ -2863,8 +2917,6 @@ var et2_nextmatch_filterheader = /** @class */ (function (_super) {
}
/**
* Override to add change handler
*
* @memberOf et2_nextmatch_filterheader
*/
et2_nextmatch_filterheader.prototype.createInputWidget = function () {
// Make sure there's an option for all
@ -2908,7 +2960,7 @@ var et2_nextmatch_filterheader = /** @class */ (function (_super) {
exports.et2_nextmatch_filterheader = et2_nextmatch_filterheader;
et2_core_widget_1.et2_register_widget(et2_nextmatch_filterheader, ['nextmatch-filterheader']);
/**
* @augments et2_selectAccount
* Filter by account
*/
var et2_nextmatch_accountfilterheader = /** @class */ (function (_super) {
__extends(et2_nextmatch_accountfilterheader, _super);
@ -3157,6 +3209,21 @@ var et2_nextmatch_customfilter = /** @class */ (function (_super) {
return this.real_node.setNextmatch(_nextmatch);
}
};
et2_nextmatch_customfilter._attributes = {
"widget_type": {
"name": "Actual type",
"type": "string",
"description": "The actual type of widget you should use",
"no_lang": 1
},
"widget_options": {
"name": "Actual options",
"type": "any",
"description": "The options for the actual widget",
"no_lang": 1,
"default": {}
}
};
return et2_nextmatch_customfilter;
}(et2_nextmatch_filterheader));
et2_core_widget_1.et2_register_widget(et2_nextmatch_customfilter, ['nextmatch-customfilter']);

View File

@ -43,13 +43,12 @@
import './et2_core_common';
import './et2_core_interfaces';
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
import {et2_widget} from "./et2_core_widget";
import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget";
import {et2_DOMWidget} from "./et2_core_DOMWidget";
import {et2_baseWidget} from "./et2_core_baseWidget";
import {et2_inputWidget} from "./et2_core_inputWidget";
import {et2_selectbox} from "./et2_widget_selectbox";
import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_nextmatch_rowProvider} from "./et2_extension_nextmatch_rowProvider";
import {et2_nextmatch_controller} from "./et2_extension_nextmatch_controller";
@ -2642,7 +2641,7 @@ et2_register_widget(et2_nextmatch, ["nextmatch"]);
*/
class et2_nextmatch_header_bar extends et2_DOMWidget implements et2_INextmatchHeader
{
static readonly _attributes: {
static readonly _attributes: any = {
"filter_label": {
"name": "Filter label",
"type": "string",
@ -3339,7 +3338,7 @@ et2_register_widget(et2_nextmatch_header_bar, ["nextmatch_header_bar"]);
*/
export class et2_nextmatch_header extends et2_baseWidget implements et2_INextmatchHeader
{
static readonly _attributes: {
static readonly _attributes: any = {
"label": {
"name": "Caption",
"type": "string",
@ -3398,7 +3397,7 @@ et2_register_widget(et2_nextmatch_header, ['nextmatch-header']);
*/
export class et2_nextmatch_customfields extends et2_container implements et2_INextmatchHeader
{
static readonly _attributes: {
static readonly _attributes: any = {
'customfields': {
'name': 'Custom fields',
'description': 'Auto filled'
@ -3633,7 +3632,7 @@ et2_register_widget(et2_nextmatch_customfields, ['nextmatch-customfields']);
// @ts-ignore
export class et2_nextmatch_sortheader extends et2_nextmatch_header implements et2_INextmatchSortable
{
static readonly _attributes: {
static readonly _attributes: any = {
"sortmode": {
"name": "Sort order",
"type": "string",
@ -3700,7 +3699,7 @@ export class et2_nextmatch_sortheader extends et2_nextmatch_header implements et
et2_register_widget(et2_nextmatch_sortheader, ['nextmatch-sortheader']);
/**
* @augments et2_selectbox
* Filter from a provided list of options
*/
export class et2_nextmatch_filterheader extends et2_selectbox implements et2_INextmatchHeader, et2_IResizeable
{
@ -3708,8 +3707,6 @@ export class et2_nextmatch_filterheader extends et2_selectbox implements et2_INe
/**
* Override to add change handler
*
* @memberOf et2_nextmatch_filterheader
*/
createInputWidget( )
{
@ -3766,7 +3763,7 @@ export class et2_nextmatch_filterheader extends et2_selectbox implements et2_INe
et2_register_widget(et2_nextmatch_filterheader, ['nextmatch-filterheader']);
/**
* @augments et2_selectAccount
* Filter by account
*/
class et2_nextmatch_accountfilterheader extends et2_selectAccount implements et2_INextmatchHeader, et2_IResizeable
{
@ -3836,7 +3833,7 @@ et2_register_widget(et2_nextmatch_accountfilterheader, ['nextmatch-accountfilter
*/
class et2_nextmatch_taglistheader extends et2_taglist implements et2_INextmatchHeader, et2_IResizeable
{
static readonly _attributes = {
static readonly _attributes : any = {
autocomplete_url: { default: ''},
multiple: { default: 'toggle'},
onchange: {
@ -4000,7 +3997,7 @@ et2_register_widget(et2_nextmatch_entryheader, ['nextmatch-entryheader']);
*/
class et2_nextmatch_customfilter extends et2_nextmatch_filterheader
{
static readonly _attributes: {
static readonly _attributes: any = {
"widget_type": {
"name": "Actual type",
"type": "string",

View File

@ -30,7 +30,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
et2_core_xml;
et2_core_DOMWidget;
et2_core_inputWidget;
et2_extension_nextmatch;
*/
require("./et2_core_common");
var et2_core_inheritance_1 = require("./et2_core_inheritance");

View File

@ -16,7 +16,6 @@
et2_core_xml;
et2_core_DOMWidget;
et2_core_inputWidget;
et2_extension_nextmatch;
*/
import './et2_core_common';