Checkpoint
gitea/hedera-web/pipeline/head This commit looks good
Details
gitea/hedera-web/pipeline/head This commit looks good
Details
This commit is contained in:
parent
87a583794a
commit
30052408de
|
@ -59,13 +59,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<htk-combo
|
<htk-combo
|
||||||
placeholder="_Country">
|
placeholder="_Country"
|
||||||
<vn-param
|
id="country"
|
||||||
id="country"
|
one-way="true">
|
||||||
property="param"
|
|
||||||
lot="iter"
|
|
||||||
name="countryFk"
|
|
||||||
one-way="true"/>
|
|
||||||
<db-model property="model">
|
<db-model property="model">
|
||||||
SELECT id, country FROM vn.country
|
SELECT id, country FROM vn.country
|
||||||
ORDER BY country
|
ORDER BY country
|
||||||
|
@ -77,9 +73,9 @@
|
||||||
placeholder="_Province"
|
placeholder="_Province"
|
||||||
column="provinceFk"
|
column="provinceFk"
|
||||||
form="iter">
|
form="iter">
|
||||||
<db-model property="model" lot="iter">
|
<db-model property="model" lot="country">
|
||||||
SELECT id, name FROM vn.province
|
SELECT id, name FROM vn.province
|
||||||
WHERE countryFk = #countryFk
|
WHERE countryFk = #id
|
||||||
ORDER BY name
|
ORDER BY name
|
||||||
</db-model>
|
</db-model>
|
||||||
</htk-combo>
|
</htk-combo>
|
||||||
|
|
|
@ -5,7 +5,7 @@ var Tpl = require('./gui.xml').default;
|
||||||
require('./gui.scss');
|
require('./gui.scss');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Htk.Component,
|
Extends: Vn.Component,
|
||||||
Properties: {
|
Properties: {
|
||||||
conn: {
|
conn: {
|
||||||
type: Db.Connection
|
type: Db.Connection
|
||||||
|
@ -30,7 +30,7 @@ module.exports = new Class({
|
||||||
,_navbarVisible: true
|
,_navbarVisible: true
|
||||||
|
|
||||||
,initialize: function(props) {
|
,initialize: function(props) {
|
||||||
this.builderInitString(Tpl);
|
this.loadTemplateFromString(Tpl);
|
||||||
this.loadingCount = 0;
|
this.loadingCount = 0;
|
||||||
|
|
||||||
this.$.background.onclick = function() {};
|
this.$.background.onclick = function() {};
|
||||||
|
|
|
@ -3,7 +3,7 @@ require('./login.scss');
|
||||||
var Tpl = require('./login.xml').default;
|
var Tpl = require('./login.xml').default;
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Htk.Component,
|
Extends: Vn.Component,
|
||||||
Properties:
|
Properties:
|
||||||
{
|
{
|
||||||
conn:
|
conn:
|
||||||
|
@ -20,7 +20,7 @@ module.exports = new Class({
|
||||||
|
|
||||||
,initialize: function(props) {
|
,initialize: function(props) {
|
||||||
this.parent(props);
|
this.parent(props);
|
||||||
this.builderInitString(Tpl);
|
this.loadTemplateFromString(Tpl);
|
||||||
|
|
||||||
//this.$.socialBar.conn = this._conn;
|
//this.$.socialBar.conn = this._conn;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Htk.Widget
|
Extends: Vn.Component
|
||||||
,Tag: 'htk-social-bar'
|
,Tag: 'htk-social-bar'
|
||||||
,Properties: {
|
,Properties: {
|
||||||
conn: {
|
conn: {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
var Assistant = require('../assistant');
|
var Assistant = require('../assistant');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget,
|
Extends: Component,
|
||||||
Tag: 'htk-assistant-bar',
|
Tag: 'htk-assistant-bar',
|
||||||
Properties: {
|
Properties: {
|
||||||
assistant: {
|
assistant: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
var Step = require('../step');
|
var Step = require('../step');
|
||||||
var Toast = require('../toast');
|
var Toast = require('../toast');
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ var Toast = require('../toast');
|
||||||
* A simple assistant with steps.
|
* A simple assistant with steps.
|
||||||
*/
|
*/
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget,
|
Extends: Component,
|
||||||
Tag: 'htk-assistant',
|
Tag: 'htk-assistant',
|
||||||
Properties: {
|
Properties: {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,15 +3,13 @@ require('./style.scss');
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Htk.Field
|
Extends: Htk.Field
|
||||||
,Tag: 'htk-calendar'
|
,Tag: 'htk-calendar'
|
||||||
,Properties:
|
,Properties: {
|
||||||
{
|
restrictFunc: {
|
||||||
restrictFunc:
|
|
||||||
{
|
|
||||||
type: Function
|
type: Function
|
||||||
,set: function(x) {
|
,set: function(x) {
|
||||||
this._restrictFunc = x;
|
this._restrictFunc = x;
|
||||||
}
|
}
|
||||||
,get: function(x) {
|
,get: function() {
|
||||||
return this._restrictFunc;
|
return this._restrictFunc;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
@import "../../style/variables";
|
@import "../style/variables";
|
||||||
@import "../../style/classes";
|
@import "../style/classes";
|
||||||
|
|
||||||
.htk-calendar {
|
.htk-calendar {
|
||||||
@extend %box;
|
@extend %box;
|
|
@ -1,36 +0,0 @@
|
||||||
|
|
||||||
const Widget = require('../widget');
|
|
||||||
|
|
||||||
module.exports = new Class({
|
|
||||||
Extends: Widget
|
|
||||||
|
|
||||||
,scope: null
|
|
||||||
|
|
||||||
,builderInit: function(path) {
|
|
||||||
const builder = new Vn.Builder();
|
|
||||||
builder.compileFile(path);
|
|
||||||
this.builderResultInit(builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
,builderInitString: function(xmlString) {
|
|
||||||
const builder = new Vn.Builder();
|
|
||||||
builder.compileString(xmlString);
|
|
||||||
this.builderResultInit(builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
,builderResultInit: function(builder) {
|
|
||||||
const scope = this.scope = builder.load(this.doc, this);
|
|
||||||
scope.link();
|
|
||||||
|
|
||||||
this.$ = scope.$;
|
|
||||||
this._node = scope.$.main;
|
|
||||||
}
|
|
||||||
|
|
||||||
,_destroy: function() {
|
|
||||||
if (this.scope)
|
|
||||||
this.scope.unref();
|
|
||||||
|
|
||||||
this.parent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget
|
Extends: Component
|
||||||
,Implements: Vn.ParamIface
|
,Implements: Vn.ParamIface
|
||||||
,Tag: 'htk-field'
|
,Tag: 'htk-field'
|
||||||
,Child: 'param'
|
,Child: 'param'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget
|
Extends: Component
|
||||||
,Tag: 'htk-grid'
|
,Tag: 'htk-grid'
|
||||||
,Child: 'model'
|
,Child: 'model'
|
||||||
,Properties:
|
,Properties:
|
||||||
|
|
|
@ -3,9 +3,7 @@ require('db/db');
|
||||||
require('./style/index.scss');
|
require('./style/index.scss');
|
||||||
|
|
||||||
Htk = module.exports = {
|
Htk = module.exports = {
|
||||||
Widget : require('./widget')
|
Popup : require('./popup')
|
||||||
,Component : require('./component')
|
|
||||||
,Popup : require('./popup')
|
|
||||||
,Dialog : require('./dialog')
|
,Dialog : require('./dialog')
|
||||||
,Toast : require('./toast')
|
,Toast : require('./toast')
|
||||||
,Repeater : require('./repeater')
|
,Repeater : require('./repeater')
|
||||||
|
@ -24,23 +22,23 @@ Htk = module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var Fields = {
|
var Fields = {
|
||||||
Text : require('./fields/text')
|
Text : require('./text')
|
||||||
,Html : require('./fields/html')
|
,Html : require('./html')
|
||||||
,Entry : require('./fields/entry')
|
,Entry : require('./entry')
|
||||||
,RadioGroup : require('./fields/radio/radio-group')
|
,RadioGroup : require('./radio/radio-group')
|
||||||
,Radio : require('./fields/radio')
|
,Radio : require('./radio')
|
||||||
,Label : require('./fields/label')
|
,Label : require('./label')
|
||||||
,TextArea : require('./fields/text-area')
|
,TextArea : require('./text-area')
|
||||||
,Spin : require('./fields/spin')
|
,Spin : require('./spin')
|
||||||
,Check : require('./fields/check')
|
,Check : require('./check')
|
||||||
,Select : require('./fields/select')
|
,Select : require('./select')
|
||||||
,Calendar : require('./fields/calendar')
|
,Calendar : require('./calendar')
|
||||||
,DateChooser : require('./fields/date-chooser')
|
,DateChooser : require('./date-chooser')
|
||||||
,Image : require('./fields/image')
|
,Image : require('./image')
|
||||||
,Button : require('./fields/button')
|
,Button : require('./button')
|
||||||
,BarButton : require('./fields/bar-button')
|
,BarButton : require('./bar-button')
|
||||||
,Table : require('./fields/table')
|
,Table : require('./table')
|
||||||
,SearchEntry : require('./fields/search-entry')
|
,SearchEntry : require('./search-entry')
|
||||||
,ColumnButton : require('./columns/button')
|
,ColumnButton : require('./columns/button')
|
||||||
,ColumnLink : require('./columns/link')
|
,ColumnLink : require('./columns/link')
|
||||||
,ColumnDate : require('./columns/date')
|
,ColumnDate : require('./columns/date')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget
|
Extends: Component
|
||||||
,Tag: 'htk-icon'
|
,Tag: 'htk-icon'
|
||||||
,Properties:
|
,Properties:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Component = require('../component');
|
var Component = require('vn/component');
|
||||||
var Toast = require('../toast');
|
var Toast = require('../toast');
|
||||||
var Tpl = require('./ui.xml').default;
|
var Tpl = require('./ui.xml').default;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ module.exports = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(props) {
|
initialize: function(props) {
|
||||||
this.builderInitString(Tpl);
|
this.loadTemplateFromString(Tpl);
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.$.form.onsubmit = function() {
|
this.$.form.onsubmit = function() {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require('./style.scss');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to display or edit an image. Also it allows to show it's full version.
|
* Class to display or edit an image. Also it allows to show it's full version.
|
||||||
*/
|
*/
|
|
@ -46,11 +46,11 @@
|
||||||
margin: .6em;
|
margin: .6em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
&:hover > .actions {
|
||||||
.item:hover > .actions {
|
display: flex;
|
||||||
display: flex;
|
}
|
||||||
}
|
&:last-child {
|
||||||
.item:last-child {
|
border-bottom: none;
|
||||||
border-bottom: none;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Tag: 'htk-loader'
|
Tag: 'htk-loader'
|
||||||
,Extends: Widget
|
,Extends: Component
|
||||||
,Properties: {
|
,Properties: {
|
||||||
form: {
|
form: {
|
||||||
type: Db.Form
|
type: Db.Form
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to handle popups.
|
* Class to handle popups.
|
||||||
*/
|
*/
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget
|
Extends: Component
|
||||||
,Tag: 'htk-popup'
|
,Tag: 'htk-popup'
|
||||||
,Properties: {
|
,Properties: {
|
||||||
/**
|
/**
|
||||||
* The popup child.
|
* The popup child.
|
||||||
*/
|
*/
|
||||||
child: {
|
child: {
|
||||||
type: Widget
|
type: Component
|
||||||
,set: function(x) {
|
,set: function(x) {
|
||||||
this._child = x;
|
this._child = x;
|
||||||
this._setChildNode(x.node);
|
this._setChildNode(x.node);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget
|
Extends: Component
|
||||||
,Tag: 'htk-repeater'
|
,Tag: 'htk-repeater'
|
||||||
,Child: 'model'
|
,Child: 'model'
|
||||||
,Properties:
|
,Properties:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var ColumnText = require('../../columns/text');
|
var ColumnText = require('../columns/text');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Htk.Field
|
Extends: Htk.Field
|
||||||
|
@ -40,8 +40,7 @@ module.exports = new Class({
|
||||||
/**
|
/**
|
||||||
* The number of rows in the form.
|
* The number of rows in the form.
|
||||||
*/
|
*/
|
||||||
numRows:
|
numRows:{
|
||||||
{
|
|
||||||
type: Number
|
type: Number
|
||||||
,get: function() {
|
,get: function() {
|
||||||
if (this._model)
|
if (this._model)
|
||||||
|
@ -53,8 +52,7 @@ module.exports = new Class({
|
||||||
/**
|
/**
|
||||||
* Checks if the form data is ready.
|
* Checks if the form data is ready.
|
||||||
*/
|
*/
|
||||||
ready:
|
ready:{
|
||||||
{
|
|
||||||
type: Boolean
|
type: Boolean
|
||||||
,get: function() {
|
,get: function() {
|
||||||
return this._model && this._model.ready;
|
return this._model && this._model.ready;
|
||||||
|
@ -63,8 +61,7 @@ module.exports = new Class({
|
||||||
/**
|
/**
|
||||||
* Checks if the form data is ready.
|
* Checks if the form data is ready.
|
||||||
*/
|
*/
|
||||||
placeholder:
|
placeholder:{
|
||||||
{
|
|
||||||
type: String
|
type: String
|
||||||
,set: function(x) {
|
,set: function(x) {
|
||||||
this._placeholder = x;
|
this._placeholder = x;
|
||||||
|
@ -77,8 +74,7 @@ module.exports = new Class({
|
||||||
/**
|
/**
|
||||||
* Wether to allow null values.
|
* Wether to allow null values.
|
||||||
*/
|
*/
|
||||||
notNull:
|
notNull:{
|
||||||
{
|
|
||||||
type: Boolean
|
type: Boolean
|
||||||
,set: function(x) {
|
,set: function(x) {
|
||||||
this._notNull = x;
|
this._notNull = x;
|
||||||
|
@ -93,7 +89,13 @@ module.exports = new Class({
|
||||||
$: {
|
$: {
|
||||||
type: Object
|
type: Object
|
||||||
,get: function() {
|
,get: function() {
|
||||||
return this._model.getObject(this._row);
|
return this._model.getObject(this._row) || {};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
type: Object
|
||||||
|
,get: function() {
|
||||||
|
return this.$;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
@import "../../style/variables";
|
@import "../style/variables";
|
||||||
|
|
||||||
.htk-select {
|
.htk-select {
|
||||||
display: flex;
|
display: flex;
|
|
@ -1,8 +1,8 @@
|
||||||
require('./style.scss');
|
require('./style.scss');
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget
|
Extends: Component
|
||||||
,Tag: 'htk-spinner'
|
,Tag: 'htk-spinner'
|
||||||
|
|
||||||
,_started: false
|
,_started: false
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
var Widget = require('../widget');
|
var Component = require('vn/component');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Widget,
|
Extends: Component,
|
||||||
Tag: 'htk-step',
|
Tag: 'htk-step',
|
||||||
Properties: {
|
Properties: {
|
||||||
name: {
|
name: {
|
||||||
|
@ -42,7 +42,7 @@ module.exports = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
appendChild: function(child) {
|
appendChild: function(child) {
|
||||||
if (child instanceof Widget)
|
if (child instanceof Component)
|
||||||
child = child.node;
|
child = child.node;
|
||||||
this.node.appendChild(child);
|
this.node.appendChild(child);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
var Entry = require('../entry');
|
var Entry = require('../entry');
|
||||||
var ColumnRadio = require('../../columns/radio');
|
var ColumnRadio = require('../columns/radio');
|
||||||
|
|
||||||
module.exports = new Class({
|
module.exports = new Class({
|
||||||
Extends: Entry
|
Extends: Entry
|
|
@ -1,5 +1,5 @@
|
||||||
const VnObject = require('./object');
|
const VnObject = require('./object');
|
||||||
const Widget = require('../htk/widget');
|
const Component = require('./component');
|
||||||
const VnNode = require('./node');
|
const VnNode = require('./node');
|
||||||
const Scope = require('./scope');
|
const Scope = require('./scope');
|
||||||
const Type = require('./type');
|
const Type = require('./type');
|
||||||
|
@ -515,7 +515,7 @@ module.exports = new Class({
|
||||||
const object = new context.klass();
|
const object = new context.klass();
|
||||||
object.setProperties(context.props);
|
object.setProperties(context.props);
|
||||||
|
|
||||||
if (context.nodeId && object instanceof Widget) {
|
if (context.nodeId && object instanceof Component) {
|
||||||
var id = context.nodeId;
|
var id = context.nodeId;
|
||||||
object.htmlId = scope.getHtmlId(id);
|
object.htmlId = scope.getHtmlId(id);
|
||||||
object.className = '_'+ id +' '+ object.className;
|
object.className = '_'+ id +' '+ object.className;
|
||||||
|
@ -646,7 +646,7 @@ module.exports = new Class({
|
||||||
for (var i = 0; i < childs.length; i++) {
|
for (var i = 0; i < childs.length; i++) {
|
||||||
let child = objects[childs[i]];
|
let child = objects[childs[i]];
|
||||||
|
|
||||||
if (child instanceof Widget)
|
if (child instanceof Component)
|
||||||
child = child.node;
|
child = child.node;
|
||||||
if (child instanceof Node)
|
if (child instanceof Node)
|
||||||
object.appendChild(child);
|
object.appendChild(child);
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
|
|
||||||
const NodeBuilder = require('../../vn/node-builder');
|
const NodeBuilder = require('./node-builder');
|
||||||
|
|
||||||
const WidgetClass = {
|
const Klass = new Class();
|
||||||
|
module.exports = Klass;
|
||||||
|
|
||||||
|
Klass.extend({Classes: ''});
|
||||||
|
|
||||||
|
const ComponentClass = {
|
||||||
Extends: NodeBuilder
|
Extends: NodeBuilder
|
||||||
,Properties: {
|
,Properties: {
|
||||||
/**
|
/**
|
||||||
* Main HTML node that represents the widget
|
* Main HTML node that represents the component
|
||||||
*/
|
*/
|
||||||
node: {
|
node: {
|
||||||
type: Object
|
type: Object
|
||||||
|
@ -32,11 +37,24 @@ const WidgetClass = {
|
||||||
class: {
|
class: {
|
||||||
type: String
|
type: String
|
||||||
,set: function(x) {
|
,set: function(x) {
|
||||||
this._cssClass = x;
|
this._className = x;
|
||||||
this._refreshClass();
|
this._refreshClass();
|
||||||
}
|
}
|
||||||
,get: function() {
|
,get: function() {
|
||||||
return this._node.className;
|
return this._className;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* CSS classes to be appendend to the node classes.
|
||||||
|
*/
|
||||||
|
className: {
|
||||||
|
type: String
|
||||||
|
,set: function(x) {
|
||||||
|
this._className = x;
|
||||||
|
this._refreshClass();
|
||||||
|
}
|
||||||
|
,get: function() {
|
||||||
|
return this._className;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -78,6 +96,7 @@ const WidgetClass = {
|
||||||
}
|
}
|
||||||
|
|
||||||
,_node: null
|
,_node: null
|
||||||
|
,scope: null
|
||||||
|
|
||||||
,initialize: function(props) {
|
,initialize: function(props) {
|
||||||
this.doc = document;
|
this.doc = document;
|
||||||
|
@ -87,10 +106,20 @@ const WidgetClass = {
|
||||||
|
|
||||||
,createRoot: function(tagName) {
|
,createRoot: function(tagName) {
|
||||||
const node = this._node = this.createElement(tagName);
|
const node = this._node = this.createElement(tagName);
|
||||||
if (this._htmlId) node.id = this._htmlId;
|
if (this._htmlId)
|
||||||
|
node.id = this._htmlId;
|
||||||
|
if (this.$constructor.Classes)
|
||||||
|
node.className = this.$constructor.Classes;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
,appendChild: function(child) {
|
||||||
|
if (child instanceof Klass)
|
||||||
|
this._node.appendChild(child.node);
|
||||||
|
else if (child instanceof Element)
|
||||||
|
this._node.appendChild(child);
|
||||||
|
}
|
||||||
|
|
||||||
,renderBase: function() {
|
,renderBase: function() {
|
||||||
if (this._node)
|
if (this._node)
|
||||||
return;
|
return;
|
||||||
|
@ -100,8 +129,8 @@ const WidgetClass = {
|
||||||
}
|
}
|
||||||
|
|
||||||
,_refreshClass: function() {
|
,_refreshClass: function() {
|
||||||
if (this._node && this._cssClass)
|
if (this._node && this._className)
|
||||||
this._node.className = this._cssClass +' '+ this._node.className;
|
this._node.className = this._className +' '+ this._node.className;
|
||||||
}
|
}
|
||||||
|
|
||||||
,remove: function() {
|
,remove: function() {
|
||||||
|
@ -110,11 +139,38 @@ const WidgetClass = {
|
||||||
|
|
||||||
,on: function(id, callback, instance) {
|
,on: function(id, callback, instance) {
|
||||||
if (htmlEventMap[id]) {
|
if (htmlEventMap[id]) {
|
||||||
this.node.addEventListener(id,
|
this.addEventListener(id,
|
||||||
callback.bind(instance, this));
|
callback.bind(instance, this));
|
||||||
} else
|
} else
|
||||||
this.parent(id, callback, instance);
|
this.parent(id, callback, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
,loadTemplateFromFile: function(path) {
|
||||||
|
const builder = new Vn.Builder();
|
||||||
|
builder.compileFile(path);
|
||||||
|
this.loadScope(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
,loadTemplateFromString: function(xmlString) {
|
||||||
|
const builder = new Vn.Builder();
|
||||||
|
builder.compileString(xmlString);
|
||||||
|
this.loadScope(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
,loadScope: function(builder) {
|
||||||
|
const scope = this.scope = builder.load(this.doc, this);
|
||||||
|
scope.link();
|
||||||
|
|
||||||
|
this.$ = scope.$;
|
||||||
|
this._node = scope.$.main;
|
||||||
|
}
|
||||||
|
|
||||||
|
,_destroy: function() {
|
||||||
|
if (this.scope)
|
||||||
|
this.scope.unref();
|
||||||
|
|
||||||
|
this.parent();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
htmlEventMap = {};
|
htmlEventMap = {};
|
||||||
|
@ -141,9 +197,9 @@ htmlMethods = [
|
||||||
'addEventListener'
|
'addEventListener'
|
||||||
];
|
];
|
||||||
htmlMethods.forEach(method => {
|
htmlMethods.forEach(method => {
|
||||||
WidgetClass[method] = function() {
|
ComponentClass[method] = function() {
|
||||||
this.node[method].apply(this.node, arguments);
|
this.node[method].apply(this.node, arguments);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = new Class(WidgetClass);
|
Klass.implement(ComponentClass);
|
|
@ -8,7 +8,7 @@ module.exports = new Class({
|
||||||
,Implements: LotIface
|
,Implements: LotIface
|
||||||
,Tag: 'vn-lot'
|
,Tag: 'vn-lot'
|
||||||
,Properties: {
|
,Properties: {
|
||||||
params: {
|
$: {
|
||||||
type: Object
|
type: Object
|
||||||
,set: function(x) {
|
,set: function(x) {
|
||||||
this.setAll(x);
|
this.setAll(x);
|
||||||
|
@ -17,13 +17,13 @@ module.exports = new Class({
|
||||||
return this._params;
|
return this._params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,$: {
|
,params: {
|
||||||
type: Object
|
type: Object
|
||||||
,set: function(x) {
|
,set: function(x) {
|
||||||
this.setAll(x);
|
this.$ = x;
|
||||||
}
|
}
|
||||||
,get: function() {
|
,get: function() {
|
||||||
return this._params;
|
return this.$;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
vnCustomTags = {};
|
vnCustomTags = {};
|
||||||
|
|
||||||
var Mutators = Class.Mutators;
|
const Mutators = Class.Mutators;
|
||||||
|
const _Extends = Mutators.Extends;
|
||||||
var _Extends = Mutators.Extends;
|
|
||||||
|
|
||||||
Mutators.Extends = function() {
|
Mutators.Extends = function() {
|
||||||
_Extends.apply(this, arguments);
|
_Extends.apply(this, arguments);
|
||||||
|
@ -13,13 +12,22 @@ Mutators.Extends = function() {
|
||||||
Mutators.Tag = function(tagName) {
|
Mutators.Tag = function(tagName) {
|
||||||
vnCustomTags[tagName] = this;
|
vnCustomTags[tagName] = this;
|
||||||
this.extend({Tag: tagName});
|
this.extend({Tag: tagName});
|
||||||
|
|
||||||
|
const parent = this.parent;
|
||||||
|
if (parent && parent.Classes !== undefined) {
|
||||||
|
let Classes = tagName
|
||||||
|
|
||||||
|
if (parent.Classes !== '')
|
||||||
|
Classes += ' '+ parent.Classes;
|
||||||
|
this.extend({Classes});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Mutators.Properties = function(props) {
|
Mutators.Properties = function(props) {
|
||||||
var parentProps;
|
let parentProps;
|
||||||
|
|
||||||
for (var propName in props) {
|
for (const propName in props) {
|
||||||
var prop = props[propName];
|
const prop = props[propName];
|
||||||
prop.configurable = true;
|
prop.configurable = true;
|
||||||
|
|
||||||
if (!prop.get && !prop.set && prop.writable === undefined)
|
if (!prop.get && !prop.set && prop.writable === undefined)
|
||||||
|
@ -27,19 +35,10 @@ Mutators.Properties = function(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parent && (parentProps = this.parent.Properties))
|
if (this.parent && (parentProps = this.parent.Properties))
|
||||||
for (var propName in parentProps)
|
for (const propName in parentProps)
|
||||||
if (!props[propName])
|
if (!props[propName])
|
||||||
props[propName] = parentProps[propName];
|
props[propName] = parentProps[propName];
|
||||||
|
|
||||||
this.extend({Properties: props});
|
this.extend({Properties: props});
|
||||||
Object.defineProperties(this.prototype, props);
|
Object.defineProperties(this.prototype, props);
|
||||||
};
|
};
|
||||||
|
|
||||||
Mutators.Parent = function(propName) {
|
|
||||||
this.extend({Parent: propName});
|
|
||||||
};
|
|
||||||
|
|
||||||
Mutators.Child = function(propName) {
|
|
||||||
this.extend({Child: propName});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ Vn = module.exports = {
|
||||||
,Form : require('./form')
|
,Form : require('./form')
|
||||||
,Node : require('./node')
|
,Node : require('./node')
|
||||||
,NodeBuilder : require('./node-builder')
|
,NodeBuilder : require('./node-builder')
|
||||||
|
,Component : require('./component')
|
||||||
,Builder : require('./builder')
|
,Builder : require('./builder')
|
||||||
,JsonException : require('./json-exception')
|
,JsonException : require('./json-exception')
|
||||||
,JsonConnection : require('./json-connection')
|
,JsonConnection : require('./json-connection')
|
||||||
|
|
Loading…
Reference in New Issue