本文整理汇总了TypeScript中@core/custom/exports.customTag_register函数的典型用法代码示例。如果您正苦于以下问题:TypeScript customTag_register函数的具体用法?TypeScript customTag_register怎么用?TypeScript customTag_register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了customTag_register函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: Bind
(function() {
function Bind() {}
customTag_register(':bind', Bind);
customTag_register( 'bind', Bind);
Bind.prototype = {
constructor: Bind,
renderStart: function(model, ctx, container){
this.provider = BindingProvider.create(model, container, this, 'single');
this.provider.objectChanged();
}
};
}());
开发者ID:atmajs,项目名称:MaskJS,代码行数:18,代码来源:bind_node.ts
示例2: _createExports
function _createExports(nodes, model, module) {
var exports = module.exports,
items = module.importItems,
getHandler = _module_getHandlerDelegate(module);
var i = -1,
imax = items.length;
while (++i < imax) {
var x = items[i];
if (x.registerScope) {
x.registerScope(module);
}
}
var i = -1,
imax = nodes.length;
while (++i < imax) {
var node = nodes[i];
var name = node.tagName;
if (name === 'define' || name === 'let') {
var Base = {
getHandler: _fn_wrap(customTag_Compo_getHandler, getHandler),
getModule: _module_getModuleDelegate(module),
location: module.location
};
var Ctor = Define.create(node, model, module, Base);
var Proto = Ctor.prototype;
if (Proto.scope != null || module.scope != null) {
Proto.scope = obj_extend(Proto.scope, module.scope);
}
var compoName = node.name;
if (name === 'define') {
exports[compoName] = Ctor;
customTag_register(compoName, Ctor);
}
if (name === 'let') {
customTag_registerResolver(compoName);
}
exports.__handlers__[compoName] = Ctor;
}
}
exports['*'] = class_create(customTag_Base, {
getHandler: getHandler,
location: module.location,
nodes: exports.__nodes__,
scope: module.scope
});
return exports;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:51,代码来源:ModuleMask.ts
示例3: Bind
(function() {
function Bind() {}
customTag_register(':bind', Bind);
customTag_register( 'bind', Bind);
Bind.prototype = {
constructor: Bind,
renderEnd: function(els, model, cntx, container){
this.provider = BindingProvider.create(model, container, this, 'single');
BindingProvider.bind(this.provider);
},
dispose: function(){
if (this.provider && typeof this.provider.dispose === 'function') {
this.provider.dispose();
}
}
};
}());
开发者ID:atmajs,项目名称:MaskJS,代码行数:24,代码来源:bind.ts
示例4: log_warn
log_warn('Template was not found', id);
return null;
},
register: function(id, nodes){
if (id == null) {
log_warn('`:template` must define the `id` attr');
return;
}
cache_[id] = nodes;
}
};
customTag_register(':template', {
render: function() {
Templates.register(this.attr.id, this.nodes);
}
});
customTag_register(':import', {
renderStart: function() {
var id = this.attr.id;
if (id == null) {
log_error('`:import` shoud reference the template via id attr')
return;
}
this.nodes = Templates.resolve(this, id);
}
});
custom_Statements['include'] = {
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:template.ts
示例5: customTag_register
customTag_register('+for', {
meta: {
serializeNodes: true
},
serializeNodes: function(node){
return mask_stringify(node);
},
render: function(model, ctx, container, ctr, children){
var directive = For.parseFor(this.expression),
attr = this.attr;
attr[attr_PROP_1] = directive[0];
attr[attr_PROP_2] = directive[1];
attr[attr_TYPE] = directive[2];
attr[attr_EXPR] = directive[3];
var value = expression_eval(directive[3], model, ctx, ctr);
if (value == null)
return;
if (is_Array(value))
arr_createRefs(value);
For.build(
value,
directive,
this.nodes,
model,
ctx,
container,
this,
children
);
},
renderEnd: function(els, model, ctx, container, ctr){
var compo = new ForStatement(this, this.attr);
_renderPlaceholder(this, compo, container);
_compo_initAndBind(compo, this, model, ctx, container, ctr);
return compo;
},
getHandler: function(name, model){
return For.getHandler(name, model);
}
});
开发者ID:atmajs,项目名称:MaskJS,代码行数:49,代码来源:for.ts
示例6: ValidateGroup
import { customTag_register } from '@core/custom/exports';
function ValidateGroup() {}
customTag_register(':validate:group', ValidateGroup);
ValidateGroup.prototype = {
constructor: ValidateGroup,
validate: function() {
var validations = getValidations(this);
for (var i = 0, x, length = validations.length; i < length; i++) {
x = validations[i];
if (!x.validate()) {
return false;
}
}
return true;
}
};
function getValidations(component, out = []){
if (component.components == null){
return out;
}
var compos = component.components;
for(var i = 0, x, length = compos.length; i < length; i++){
x = compos[i];
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:validate_group.ts
示例7: customStatement_get
(function(){
var $Visible = customStatement_get('visible');
customTag_register('+visible', {
meta: {
serializeNodes: true
},
render: function(model, ctx, container, ctr, childs){
return build(this.nodes, model, ctx, container, ctr);
},
renderEnd: function(els, model, ctx, container, ctr){
var compo = new VisibleStatement(this);
compo.elements = els;
compo.model = model;
compo.parent = ctr;
compo.refresh = fn_proxy(compo.refresh, compo);
compo.binder = expression_createBinder(
compo.expr,
model,
ctx,
ctr,
compo.refresh
);
expression_bind(compo.expr, model, ctx, ctr, compo.binder);
compo.refresh();
return compo;
}
});
function VisibleStatement(node){
this.expr = node.expression;
this.nodes = node.nodes;
}
VisibleStatement.prototype = {
compoName: '+visible',
elements: null,
binder: null,
model: null,
parent: null,
refresh: function(){
var isVisible = expression_eval_safe(
this.expr, this.model, this.ctx, this
);
$Visible.toggle(this.elements, isVisible);
},
dispose: function(){
expression_unbind(
this.expr,
this.model,
this.parent,
this.binder
);
this.parent = null;
this.model = null;
this.ctx = null;
}
};
function build(nodes, model, ctx, container, ctr){
var els = [];
builder_build(nodes, model, ctx, container, ctr, els);
return els;
}
}());
开发者ID:atmajs,项目名称:MaskJS,代码行数:70,代码来源:visible.ts
示例8: SlotHandler
import { _global } from '@utils/refs'
import { customTag_register } from '@core/custom/exports';
import { expression_eval } from '@project/expression/src/exports';
function SlotHandler() {}
customTag_register(':slot', SlotHandler);
SlotHandler.prototype = {
constructor: SlotHandler,
renderEnd: function(element, model, cntx, container){
this.slots = {};
this.expression = this.attr.on;
this.slots[this.attr.signal] = this.handle;
},
handle: function(){
var expr = this.expression;
expression_eval(expr, this.model, _global, this);
}
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:23,代码来源:slot.ts
示例9: function
if (x.compoName === ':validate') {
this.provider.addValidation(x.validations);
}
}
}
if (this.attr['no-validation'] == null) {
var fn = ValidatorProvider.getFnFromModel(model, this.provider.value);
if (fn != null) {
this.provider.addValidation(fn);
}
}
BindingProvider.bind(this.provider);
},
dispose: function() {
var dispose = this.provider && this.provider.dispose;
if (dispose != null) {
dispose.call(this.provider);
}
},
validate: function(){
return this.provider && this.provider.validate();
},
handlers: {
attr: {
'x-signal': function() {}
}
}
});
customTag_register(':dualbind', DualbindCompo);
customTag_register( 'dualbind', DualbindCompo);
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:dualbind.ts
示例10: function
var Compo = {
meta: {
mode: 'server:all'
},
render: function(model, ctx, container) {
this.html = jMask(this.nodes).text(model, ctx, this);
if (container.insertAdjacentHTML) {
container.insertAdjacentHTML('beforeend', this.html);
return;
}
if (container.ownerDocument) {
var div = document.createElement('div'),
child;
div.innerHTML = this.html;
child = div.firstChild;
while (child != null) {
container.appendChild(child);
child = child.nextSibling;
}
}
},
toHtml: function(){
return this.html || '';
},
html: null
};
customTag_register(':html', Compo);
开发者ID:atmajs,项目名称:MaskJS,代码行数:28,代码来源:html.ts
注:本文中的@core/custom/exports.customTag_register函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论