本文整理汇总了TypeScript中jb-core.jb.compName方法的典型用法代码示例。如果您正苦于以下问题:TypeScript jb.compName方法的具体用法?TypeScript jb.compName怎么用?TypeScript jb.compName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jb-core.jb
的用法示例。
在下文中一共展示了jb.compName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isCompNameOfType
isCompNameOfType(name,type) {
var _jbart = jbart_base().comps[name] ? jbart_base() : jbart;
if (name && _jbart.comps[name]) {
while (!_jbart.comps[name].type && jb.compName(jbart.comps[name].impl))
name = jb.compName(_jbart.comps[name].impl);
return (_jbart.comps[name].type || '').indexOf(type) == 0;
}
}
示例2: getStyleComp
getStyleComp(path) {
var style = this.val(path);
var compName = jb.compName(style);
if (compName == 'customStyle')
return { type: 'inner', path: path, style : style }
var comp = compName && getComp(compName);
if (jb.compName(comp.impl) == 'customStyle')
return { type: 'global', path: compName, style: comp.impl, innerPath: path }
}
示例3: nonControlParams
nonControlParams(path) {
var prof = profileFromPath(path);
if (!prof) return [];
var params = jb_compParams(getComp(jb.compName(prof)));
return params.filter(p=>
(p.type||'').indexOf('control')==-1)
.map(p=>p.id)
}
示例4: simpleRun
simpleRun() {
var _win = jbart.previewWindow || window;
if (model.isCompNameOfType(jb.compName(this.circuit),'control'))
this.circuitType = 'control'
else if (model.isCompNameOfType(jb.compName(this.circuit),'action'))
this.circuitType = 'action'
else if (model.isCompNameOfType(jb.compName(this.circuit),'data'))
this.circuitType = 'data'
else
this.circuitType = 'unknown';
if (this.circuitType == 'control') // running circuit in a group to get the 'ready' event
return testControl(this.context, this.forTests);
else if (this.circuitType != 'action')
return Promise.resolve(_win.jb_run(this.context));
}
示例5: paramDef
paramDef(path) {
if (!parentPath(path)) // no param def for root
return;
if (!isNaN(Number(path.split('~').pop()))) // array elements
path = parentPath(path);
var parent_prof = profileFromPath(parentPath(path),true);
var comp = parent_prof && getComp(jb.compName(parent_prof));
var params = jb_compParams(comp);
var paramName = path.split('~').pop();
return params.filter(p=>p.id==paramName)[0] || {};
}
示例6: jbEditorMoreParams
jbEditorMoreParams(path) {
var val = profileFromPath(path);
var comp = getComp(jb.compName(val||{}));
if (comp) {
var existing = this.jbEditorSubNodes(path);
return jb_compParams(comp)
.map(p=> path + '~' + p.id)
.filter(p=> existing.indexOf(p) == -1)
}
return [];
}
示例7: jbEditorSubNodes
jbEditorSubNodes(path) {
var val = profileFromPath(path);
if (!val || typeof val != 'object') return [];
var compName = jb.compName(val);
var comp = getComp(compName);
if (Array.isArray(val))
return Object.getOwnPropertyNames(val)
.map(x=>x=='length'? val.length : x)
.map(k=> path +'~'+k)
else if (val['$'+compName]) { // sugar
var arr = val['$'+compName];
var res_path = path + '~$' + compName;
if (Array.isArray(arr)) // sugar array. e.g. $pipeline: [ .. ]
return Object.getOwnPropertyNames(arr)
.map(x=>x=='length'? arr.length : x)
.map(k=> res_path +'~'+k)
return [res_path];
} else if (comp) {
var composite = jb_compParams(comp)
.filter(p=>
p.composite)
.map(p=>flattenArray(p.id));
return (composite[0] || []).concat(jb_compParams(comp)
.filter(p=>!p.composite)
.map(p=> ({ path: path + '~' + p.id, param: p}))
.filter(e=>profileFromPath(e.path) != null || e.param.essential)
.map(e=>e.path)
)
}
function flattenArray(prop) {
var innerVal = val[prop];
if (Array.isArray(innerVal))
return Object.getOwnPropertyNames(innerVal)
.map(x=>x=='length'? innerVal.length : x)
.map(k=> path +'~'+prop + '~' + k)
else
return [path + '~' + prop]
}
}
示例8: jbEditorTitle
jbEditorTitle(path, collapsed) {
var val = profileFromPath(path);
var compName = jb.compName(val||{});
var prop = path.split('~').pop();
if (!isNaN(Number(prop))) // array value - title as a[i]
prop = path.split('~').slice(-2).join('[') + ']';
if (Array.isArray(val) && this.paramType(path) == 'data')
compName = `pipeline (${val.length})`;
if (Array.isArray(val) && this.paramType(path) == 'action')
compName = `actions (${val.length})`;
var summary = '';
if (collapsed && typeof val == 'object')
summary = ': ' + this.summary(path).substr(0,20);
if (compName)
return prop + `= <span class="treenode-val">${compName}${summary}</span>`;
else if (typeof val == 'string')
return prop + (collapsed ? `: <span class="treenode-val" title="${val}">${val}</span>` : '');
return prop + (Array.isArray(val) ? ` (${val.length})` : '');
}
示例9: controlParams
controlParams(path) {
var prof = profileFromPath(path,true);
if (!prof) return [];
var params = jb_compParams(getComp(jb.compName(prof)));
return params.filter(p=>(p.type||'').match(/control|options|menu/)).map(p=>p.id)
}
示例10: compName
compName(path) {
var val = profileFromPath(path);
return val && jb.compName(val);
}