Added knockoutjs components

Added material design checkbox component
Added lang changing animation
This commit is contained in:
RainLoop Team 2014-10-30 01:08:53 +04:00
parent c2b7632c13
commit 1423b88839
48 changed files with 1213 additions and 256 deletions

72
dev/Component/Abstract.js Normal file
View file

@ -0,0 +1,72 @@
(function () {
'use strict';
var
_ = require('_'),
ko = require('ko'),
Utils = require('Common/Utils')
;
/**
* @constructor
*/
function AbstractComponent()
{
this.disposable = [];
}
/**
* @type {Array}
*/
AbstractComponent.prototype.disposable = [];
AbstractComponent.prototype.dispose = function ()
{
_.each(this.disposable, function (fFuncToDispose) {
if (fFuncToDispose && fFuncToDispose.dispose)
{
fFuncToDispose.dispose();
}
});
};
/**
* @param {AbstractComponent} fClassObject
* @param {string} sTemplateID
* @return {Object}
*/
AbstractComponent.componentExportHelper = function (fClassObject, sTemplateID) {
return {
viewModel: {
createViewModel: function(oParams, oCmponentInfo) {
oParams = oParams || {};
oParams.element = null;
if (oCmponentInfo.element)
{
oParams.element = $(oCmponentInfo.element);
Utils.i18nToNode(oParams.element);
if (!Utils.isUnd(oParams.inline) && ko.unwrap(oParams.inline))
{
oParams.element.css('display', 'inline-block');
}
}
return new fClassObject(oParams);
}
},
template: {
element: sTemplateID
}
};
};
module.exports = AbstractComponent;
}());