Convert et2_widget_groupbox to TS

This commit is contained in:
Hadi Nategh 2020-02-10 14:33:15 +01:00
parent 5dd310c254
commit a1bf3f345b
2 changed files with 136 additions and 43 deletions

View File

@ -1,3 +1,4 @@
"use strict";
/** /**
* EGroupware eTemplate2 - JS Groupbox object * EGroupware eTemplate2 - JS Groupbox object
* *
@ -9,56 +10,76 @@
* @copyright Nathan Gray 2012 * @copyright Nathan Gray 2012
* @version $Id$ * @version $Id$
*/ */
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*egw:uses /*egw:uses
et2_core_baseWidget; et2_core_baseWidget;
*/ */
var et2_core_widget_1 = require("./et2_core_widget");
var et2_core_baseWidget_1 = require("./et2_core_baseWidget");
var et2_core_inheritance_1 = require("./et2_core_inheritance");
/** /**
* Class which implements the groupbox tag * Class which implements the groupbox tag
* *
* @augments et2_baseWidget * @augments et2_baseWidget
*/ */
var et2_groupbox = (function(){ "use strict"; return et2_baseWidget.extend( var et2_groupbox = /** @class */ (function (_super) {
{ __extends(et2_groupbox, _super);
/** /**
* Constructor * Constructor
* *
* @memberOf et2_groupbox * @memberOf et2_groupbox
*/ */
init: function() { function et2_groupbox(_parent, _attrs, _child) {
this._super.apply(this, arguments); var _this =
// Call the inherited constructor
this.setDOMNode(document.createElement("fieldset")); _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_groupbox._attributes, _child || {})) || this;
} _this.setDOMNode(document.createElement("fieldset"));
});}).call(this); return _this;
et2_register_widget(et2_groupbox, ["groupbox"]); }
return et2_groupbox;
}(et2_core_baseWidget_1.et2_baseWidget));
et2_core_widget_1.et2_register_widget(et2_groupbox, ["groupbox"]);
/** /**
* @augments et2_baseWidget * @augments et2_baseWidget
*/ */
var et2_groupbox_legend = (function(){ "use strict"; return et2_baseWidget.extend( var et2_groupbox_legend = /** @class */ (function (_super) {
{ __extends(et2_groupbox_legend, _super);
attributes: { /**
"label": { * Constructor
"name": "Label", *
"type": "string", * @memberOf et2_groupbox_legend
"default": "", */
"description": "Label for group box", function et2_groupbox_legend(_parent, _attrs, _child) {
"translate" : true var _this =
} // Call the inherited constructor
}, _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_groupbox_legend._attributes, _child || {})) || this;
var legend = jQuery(document.createElement("legend")).text(_this.options.label);
/** _this.setDOMNode(legend[0]);
* Constructor return _this;
* }
* @memberOf et2_groupbox_legend et2_groupbox_legend._attributes = {
*/ "label": {
init: function() { "name": "Label",
this._super.apply(this, arguments); "type": "string",
"default": "",
var legend = jQuery(document.createElement("legend")).text(this.options.label); "description": "Label for group box",
this.setDOMNode(legend[0]); "translate": true
} }
});}).call(this); };
et2_register_widget(et2_groupbox_legend, ["caption"]); return et2_groupbox_legend;
}(et2_core_baseWidget_1.et2_baseWidget));
et2_core_widget_1.et2_register_widget(et2_groupbox_legend, ["caption"]);
//# sourceMappingURL=et2_widget_groupbox.js.map

View File

@ -0,0 +1,72 @@
/**
* EGroupware eTemplate2 - JS Groupbox object
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
* @subpackage api
* @link http://www.egroupware.org
* @author Nathan Gray
* @copyright Nathan Gray 2012
* @version $Id$
*/
/*egw:uses
et2_core_baseWidget;
*/
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
import {et2_baseWidget} from "./et2_core_baseWidget";
import {ClassWithAttributes} from "./et2_core_inheritance";
/**
* Class which implements the groupbox tag
*
* @augments et2_baseWidget
*/
class et2_groupbox extends et2_baseWidget
{
/**
* Constructor
*
* @memberOf et2_groupbox
*/
constructor(_parent, _attrs? : WidgetConfig, _child? : object)
{
// Call the inherited constructor
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_groupbox._attributes, _child || {}));
this.setDOMNode(document.createElement("fieldset"));
}
}
et2_register_widget(et2_groupbox, ["groupbox"]);
/**
* @augments et2_baseWidget
*/
class et2_groupbox_legend extends et2_baseWidget
{
static readonly _attributes : any = {
"label": {
"name": "Label",
"type": "string",
"default": "",
"description": "Label for group box",
"translate" : true
}
};
/**
* Constructor
*
* @memberOf et2_groupbox_legend
*/
constructor(_parent, _attrs? : WidgetConfig, _child? : object)
{
// Call the inherited constructor
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_groupbox_legend._attributes, _child || {}));
let legend = jQuery(document.createElement("legend")).text(this.options.label);
this.setDOMNode(legend[0]);
}
}
et2_register_widget(et2_groupbox_legend, ["caption"]);