Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function configure(config: { container: Container, globalResources?: (...resources: string[]) => any }, configCallback) {
UIUtils.auContainer = config.container;
document.documentElement.classList.add(window.browserAgent());
ValidationController.prototype.validateTrigger = validateTrigger.changeOrBlur;
config.container.registerHandler('ui-validator', container => container.get(UIValidationRenderer));
if (config.globalResources) {
// Core Elements
config.globalResources(
PLATFORM.moduleName('./elements/core/ui-grid'),
PLATFORM.moduleName('./elements/core/ui-page'),
PLATFORM.moduleName('./elements/core/ui-viewport')
);
// Input Elements
config.globalResources(
PLATFORM.moduleName('./elements/inputs/ui-button'),
PLATFORM.moduleName('./elements/inputs/ui-date'),
PLATFORM.moduleName('./elements/inputs/ui-form'),
PLATFORM.moduleName('./elements/inputs/ui-input'),
PLATFORM.moduleName('./elements/inputs/ui-lists'),
PLATFORM.moduleName('./elements/inputs/ui-options'),
export function configure(config: { container: Container, globalResources?: (...resources: string[]) => any }, configCallback) {
UIUtils.auContainer = config.container;
document.documentElement.classList.add(window.browserAgent());
ValidationController.prototype.validateTrigger = validateTrigger.changeOrBlur;
config.container.registerHandler('ui-validator', container => container.get(UIValidationRenderer));
// Core Elements
config.globalResources(
PLATFORM.moduleName('./elements/core/ui-grid'),
PLATFORM.moduleName('./elements/core/ui-page'),
PLATFORM.moduleName('./elements/core/ui-viewport')
);
// Input Elements
config.globalResources(
PLATFORM.moduleName('./elements/inputs/ui-button'),
PLATFORM.moduleName('./elements/inputs/ui-date'),
PLATFORM.moduleName('./elements/inputs/ui-form'),
PLATFORM.moduleName('./elements/inputs/ui-input'),
PLATFORM.moduleName('./elements/inputs/ui-lists'),
PLATFORM.moduleName('./elements/inputs/ui-options'),
PLATFORM.moduleName('./elements/inputs/ui-phone'),
var registerValidators = function (container) {
container.get(ValidationController).validateTrigger = validateTrigger.changeOrBlur;
ValidationRules.customRule("url", function (value) {
return value === null ||
value === undefined ||
value === "" ||
/^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/.test(value);
}, "\${$displayName} is not a valid url.");
ValidationRules.customRule("phone", function (value) {
return value === null || value === undefined || value === "" || parsePhoneNumberFromString(value).isValid();
}, "\${$displayName} is not a valid phone number.");
ValidationRules.customRule("number", function (value, obj, min, max) {
return value === null ||
value === undefined ||
value === "" ||
(isNumber(value) &&
value >= (isEmpty(min) ? Number.MIN_VALUE : min) &&
value <= (isEmpty(max) ? Number.MAX_VALUE : max));
const registerValidators = (container) => {
container.get(ValidationController).validateTrigger = validateTrigger.changeOrBlur;
ValidationRules.customRule("url", (value) => value === null ||
value === undefined ||
value === "" ||
/^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/.test(value), "\${$displayName} is not a valid url.");
ValidationRules.customRule("phone", (value) => value === null || value === undefined || value === "" || parsePhoneNumberFromString(value).isValid(), "\${$displayName} is not a valid phone number.");
ValidationRules.customRule("number", (value, obj, min, max) => value === null ||
value === undefined ||
value === "" ||
(isNumber(value) &&
value >= (isEmpty(min) ? Number.MIN_VALUE : min) &&
value <= (isEmpty(max) ? Number.MAX_VALUE : max)), "\${$displayName} must be an number value between \${$config.min} and \${$config.max}.", (min, max) => ({ min, max }));
ValidationRules.customRule("decimal", (value, obj, min, max) => value === null ||
value === undefined ||
value === "" ||
(isDecimal(value) &&
value >= (isEmpty(min) ? Number.MIN_VALUE : min) &&
export const registerValidators = (container: Container) => {
container.get(ValidationController).validateTrigger = validateTrigger.changeOrBlur;
ValidationRules.customRule(
"url",
(value) =>
value === null ||
value === undefined ||
value === "" ||
/^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/.test(
value
),
"\${$displayName} is not a valid url."
);
ValidationRules.customRule(
"phone",
(value) =>
value === null || value === undefined || value === "" || parsePhoneNumberFromString(value).isValid(),
constructor(public element: Element, factory: ValidationControllerFactory) {
this.virtual = element.hasAttribute('virtual');
this.editable = element.hasAttribute('editable');
this.rowCounter = element.hasAttribute('row-counter');
this.rowExpander = element.hasAttribute('row-expander');
if (!element.hasAttribute('scroll')) this.element.classList.add('ui-auto-size');
if (element.hasAttribute('hilight')) this.element.classList.add('ui-hilight');
if (this.editable) {
this.controller = factory.createForCurrentScope();
this.controller.validateTrigger = validateTrigger.changeOrBlur;
}
}
constructor(public element: Element, controllerFactory: ValidationControllerFactory) {
this.controller = controllerFactory.createForCurrentScope();
this.controller.validateTrigger = validateTrigger.changeOrBlur;
this.controller.addRenderer(new UIValidationRenderer());
this.model = new DataModel();
}
constructor(public controller: ValidationController) {
this.model = new DataModel();
this.controller.validateTrigger = validateTrigger.changeOrBlur;
}