Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getSubComponent_(tagOrCtor, config, owner) {
let Ctor = tagOrCtor;
if (isString(Ctor)) {
Ctor = ComponentRegistry.getConstructor(tagOrCtor);
}
const ref = getRef_(owner, config);
let comp;
if (isDef(ref)) {
comp = match_(owner.components[ref], Ctor, config, owner);
owner.components[ref] = comp;
owner.refs[ref] = comp;
} else {
const data = getCurrentData();
let key = config.key;
if (!isDef(key)) {
const type = getUid(Ctor, true);
data.currCount = data.currCount || {};
data.currCount[type] = data.currCount[type] || 0;
key = `__METAL_IC__${type}_${data.currCount[type]++}`;
}
comp = match_(
data.prevComps ? data.prevComps[key] : null,
Ctor,
config,
replaceNonInternal(
component,
data,
state = this.getManagerData(component).state_
) {
const keys = state.getStateKeys();
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (!state.getStateKeyConfig(key).internal) {
if (data.hasOwnProperty(key) && isDef(data[key])) {
state.set(key, data[key]);
} else {
state.setDefaultValue(key);
}
}
}
}
hasInitialValue_(name) {
return this.initialValues_.hasOwnProperty(name) &&
isDef(this.initialValues_[name]);
}
export function isChildTag(tag) {
return isDef(tag.tag);
}
function triggerElementListeners_(element, event, defaultFns) {
const lastContainer = event[LAST_CONTAINER];
if (!isDef(lastContainer) || !contains(lastContainer, element)) {
const listeners = domData.get(element, 'listeners', {})[event.type];
return triggerListeners_(listeners, event, element, defaultFns);
}
return true;
}
function getSubComponent_(tagOrCtor, config, owner) {
let Ctor = tagOrCtor;
if (isString(Ctor)) {
Ctor = ComponentRegistry.getConstructor(tagOrCtor);
}
const ref = getRef_(owner, config);
let comp;
if (isDef(ref)) {
comp = match_(owner.components[ref], Ctor, config, owner);
owner.components[ref] = comp;
owner.refs[ref] = comp;
} else {
const data = getCurrentData();
let key = config.key;
if (!isDef(key)) {
const type = getUid(Ctor, true);
data.currCount = data.currCount || {};
data.currCount[type] = data.currCount[type] || 0;
key = `__METAL_IC__${type}_${data.currCount[type]++}`;
}
comp = match_(
data.prevComps ? data.prevComps[key] : null,
Ctor,
config,
owner
);
data.currComps = data.currComps || {};
data.currComps[key] = comp;
}
return comp;