Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let deco = function(t) {
let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);
r.hasDynamicOptions = true;
};
let deco = function(t) {
let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);
r.hasDynamicOptions = true;
};
return (target, property) => {
if (!property) {
throw Error("Decorator should be used on property only!");
}
const meta = Metadata.getOrCreateOwn(
Metadata.properties,
ModelMetadata,
target
) as ModelMetadata;
meta.serializableProps.push(property);
meta.propertyDefs[property] = {
enumerable: true,
get: target.propertyGetter(property),
set: target.propertySetter(property)
};
meta.propertyDefs["_" + property] = {
enumerable: false,
value: defaultValue,
writable: true
};
export function addRule(target, key, descriptor, targetOrConfig, rule) {
var rules = metadata.getOrCreateOwn(metadataKey, ValidationRules, target);
if (targetOrConfig === null || targetOrConfig === undefined) {
targetOrConfig = true;
}
rules.addRule(key, rule(targetOrConfig));
if (descriptor) {
descriptor.configurable = true;
}
}
static forTarget(target) {
return metadata.getOrCreateOwn(Metadata.key, Metadata, target, target.name);
}
}
let deco = function(target, key2, descriptor2) {
let actualTarget = key2 ? target.constructor : target; //is it on a property or a class?
let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, actualTarget);
let prop;
if (key2) { //is it on a property or a class?
nameOrConfigOrTarget = nameOrConfigOrTarget || {};
nameOrConfigOrTarget.name = key2;
}
prop = new BindableProperty(nameOrConfigOrTarget);
return prop.registerWith(actualTarget, r, descriptor2);
};
return function(target) {
let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, target);
r.attributeName = name;
r.attributeDefaultBindingMode = defaultBindingMode;
};
}