Get et2 working in typescript

This commit is contained in:
nathangray 2020-01-22 01:58:43 -07:00 committed by Hadi Nategh
parent 805ac4591b
commit 680a82cb4e
6 changed files with 19 additions and 8 deletions

View File

@ -31,6 +31,7 @@ require("./et2_core_interfaces");
require("./et2_core_common");
var et2_core_DOMWidget_1 = require("./et2_core_DOMWidget");
var et2_core_inheritance_1 = require("./et2_core_inheritance");
var et2_core_widget_1 = require("./et2_core_widget");
/**
* Class which manages the DOM node itself. The simpleWidget class is derrived
* from et2_DOMWidget and implements the getDOMNode function. A setDOMNode
@ -273,8 +274,11 @@ var et2_container = /** @class */ (function (_super) {
* Constructor
*/
function et2_container(_parent, _attrs, _child) {
var _this =
// Call the inherited constructor
return _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_core_DOMWidget_1.et2_DOMWidget._attributes, _child || {})) || this;
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_core_DOMWidget_1.et2_DOMWidget._attributes, _child || {})) || this;
_this.setDOMNode(document.createElement("div"));
return _this;
}
/**
* The destroy function destroys all children of the widget, removes itself
@ -295,6 +299,8 @@ var et2_container = /** @class */ (function (_super) {
};
return et2_container;
}(et2_baseWidget));
// Register widget for attributes, but not for any xml tags
et2_core_widget_1.et2_register_widget(et2_container, []);
/**
* Container object for not-yet supported widgets
*
@ -354,4 +360,6 @@ var et2_placeholder = /** @class */ (function (_super) {
};
return et2_placeholder;
}(et2_baseWidget));
// Register widget, but no tags
et2_core_widget_1.et2_register_widget(et2_placeholder, []);
//# sourceMappingURL=et2_core_baseWidget.js.map

View File

@ -18,7 +18,7 @@ import './et2_core_interfaces';
import './et2_core_common';
import {et2_DOMWidget} from './et2_core_DOMWidget';
import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_widget, WidgetConfig} from "./et2_core_widget";
import {et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget";
/**
* Class which manages the DOM node itself. The simpleWidget class is derrived
@ -337,6 +337,8 @@ class et2_container extends et2_baseWidget
{
// Call the inherited constructor
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_DOMWidget._attributes, _child || {}));
this.setDOMNode(document.createElement("div"));
}
/**
@ -362,6 +364,8 @@ class et2_container extends et2_baseWidget
}
}
}
// Register widget for attributes, but not for any xml tags
et2_register_widget(et2_container, []);
/**
* Container object for not-yet supported widgets
@ -446,4 +450,5 @@ class et2_placeholder extends et2_baseWidget implements et2_IDetachedDOM
this.placeDiv = jQuery(_nodes[0]);
}
}
// Register widget, but no tags
et2_register_widget(et2_placeholder, []);

View File

@ -37,7 +37,7 @@ var et2_core_inheritance_1 = require("./et2_core_inheritance");
var et2_registry = {};
var et2_attribute_registry = {};
/**
* Registers the widget class defined by the given constructor and associates it
* Registers the widget class defined by the given constructor, registers all its class attributes, and associates it
* with the types in the _types array.
*
* @param {function} _constructor constructor

View File

@ -27,7 +27,7 @@ var et2_attribute_registry = {};
/**
* Registers the widget class defined by the given constructor and associates it
* Registers the widget class defined by the given constructor, registers all its class attributes, and associates it
* with the types in the _types array.
*
* @param {function} _constructor constructor

View File

@ -30,7 +30,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
*/
var et2_core_widget_1 = require("./et2_core_widget");
var et2_core_baseWidget_1 = require("./et2_core_baseWidget");
var et2_core_xml_1 = require("./et2_core_xml");
/**
* Class which implements box and vbox tag
*
@ -81,7 +80,7 @@ var et2_box = /** @class */ (function (_super) {
continue;
}
// Create the new element, if no expansion needed
var id = et2_core_xml_1.et2_readAttrWithDefault(node, "id", "");
var id = et2_readAttrWithDefault(node, "id", "");
if (id.indexOf('$') < 0 || widgetType != 'box') {
this.createElementFromNode(node);
childIndex++;

View File

@ -18,7 +18,6 @@
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
import {et2_baseWidget} from "./et2_core_baseWidget";
import {et2_readAttrWithDefault} from './et2_core_xml'
/**
* Class which implements box and vbox tag