@syncfusion/ej2-inputs
Advanced tools
Comparing version 15.4.17 to 15.4.20
@@ -20,2 +20,5 @@ var __extends = (this && this.__extends) || (function () { | ||
import { Property, NotifyPropertyChanges, Event } from '@syncfusion/ej2-base'; | ||
/** | ||
* global declarations | ||
*/ | ||
var VALIDATE_EMAIL = new RegExp('^[A-Za-z0-9._%+-]{3,}@[a-zA-Z]{3,}([.]{1}[a-zA-Z]{2,5}' + | ||
@@ -28,2 +31,6 @@ '|[.]{1}[a-zA-Z]{2,4}[.]{1}[a-zA-Z]{2,4})$'); | ||
var VALIDATE_CREDITCARD = new RegExp('^\\d{13,16}$'); | ||
/** | ||
* ErrorOption values | ||
* @private | ||
*/ | ||
export var ErrorOption; | ||
@@ -34,4 +41,20 @@ (function (ErrorOption) { | ||
})(ErrorOption || (ErrorOption = {})); | ||
var FormValidator = FormValidator_1 = (function (_super) { | ||
/** | ||
* FormValidator class enables you to validate the form fields based on your defined rules | ||
* ```html | ||
* <form id='formId'> | ||
* <input type='text' name='Name' /> | ||
* <input type='text' name='Age' /> | ||
* </form> | ||
* <script> | ||
* let formObject = new FormValidator('#formId', { | ||
* rules: { Name: { required: true }, Age: { range: [18, 30] } }; | ||
* }); | ||
* formObject.validate(); | ||
* </script> | ||
* ``` | ||
*/ | ||
var FormValidator = /** @class */ (function (_super) { | ||
__extends(FormValidator, _super); | ||
// Initializes the FormValidator | ||
function FormValidator(element, options) { | ||
@@ -46,2 +69,6 @@ var _this = _super.call(this, options, element) || this; | ||
_this.selectQuery = 'input:not([type=reset]):not([type=button]), select, textarea'; | ||
/** | ||
* Specifies the default messages for validation rules. | ||
* @default : { List of validation message }; | ||
*/ | ||
_this.defaultMessages = { | ||
@@ -68,2 +95,3 @@ required: 'This field is required.', | ||
element = typeof element === 'string' ? select(element, document) : element; | ||
// Set novalidate to prevent default HTML5 form validation | ||
if (_this.element != null) { | ||
@@ -80,2 +108,9 @@ _this.element.setAttribute('novalidate', ''); | ||
} | ||
FormValidator_1 = FormValidator; | ||
/** | ||
* Add validation rules to the corresponding input element based on `name` attribute. | ||
* @param {string} name `name` of form field. | ||
* @param {Object} rules Validation rules for the corresponding element. | ||
* @return {void} | ||
*/ | ||
FormValidator.prototype.addRules = function (name, rules) { | ||
@@ -89,2 +124,9 @@ if (this.rules.hasOwnProperty(name)) { | ||
}; | ||
/** | ||
* Remove validation to the corresponding field based on name attribute. | ||
* When no parameter is passed, remove all the validations in the form. | ||
* @param {string} name Input name attribute value. | ||
* @param {string[]} rules List of validation rules need to be remove from the corresponding element. | ||
* @return {void} | ||
*/ | ||
FormValidator.prototype.removeRules = function (name, rules) { | ||
@@ -106,2 +148,8 @@ if (!name && !rules) { | ||
}; | ||
/** | ||
* Validate the current form values using defined rules. | ||
* Returns `true` when the form is valid otherwise `false` | ||
* @param {string} selected - Optional parameter to validate specified element. | ||
* @return {boolean} | ||
*/ | ||
FormValidator.prototype.validate = function (selected) { | ||
@@ -111,2 +159,3 @@ var rules = Object.keys(this.rules); | ||
this.validateRules(selected); | ||
//filter the selected element it don't have any valid input element | ||
return rules.indexOf(selected) !== -1 && this.errorRules.filter(function (data) { | ||
@@ -124,2 +173,6 @@ return data.name === selected; | ||
}; | ||
/** | ||
* Reset the value of all the fields in form. | ||
* @return {void} | ||
*/ | ||
FormValidator.prototype.reset = function () { | ||
@@ -143,2 +196,7 @@ this.errorRules = []; | ||
}; | ||
/** | ||
* Get input element by name. | ||
* @param {string} name - Input element name attribute value. | ||
* @return {HTMLInputElement} | ||
*/ | ||
FormValidator.prototype.getInputElement = function (name) { | ||
@@ -148,2 +206,6 @@ this.inputElement = (select('[name=' + name + ']', this.element)); | ||
}; | ||
/** | ||
* Destroy the form validator object and error elements. | ||
* @return {void} | ||
*/ | ||
FormValidator.prototype.destroy = function () { | ||
@@ -160,5 +222,12 @@ this.reset(); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
FormValidator.prototype.onPropertyChanged = function (newProp, oldProp) { | ||
// No code are needed | ||
}; | ||
; | ||
/** | ||
* @private | ||
*/ | ||
FormValidator.prototype.getModuleName = function () { | ||
@@ -175,2 +244,3 @@ return 'formValidator'; | ||
var input = _a[_i]; | ||
// Default attribute rules | ||
var allRule = {}; | ||
@@ -211,2 +281,3 @@ for (var _b = 0, defRules_1 = defRules; _b < defRules_1.length; _b++) { | ||
} | ||
//adding pattern type validation | ||
if (Object.keys(allRule).length !== 0) { | ||
@@ -269,2 +340,3 @@ this.addRules(input.name, allRule); | ||
}; | ||
// Wire events to the form elements | ||
FormValidator.prototype.wireEvents = function () { | ||
@@ -287,2 +359,3 @@ for (var _i = 0, _a = (this.inputElements); _i < _a.length; _i++) { | ||
}; | ||
// UnWire events to the form elements | ||
FormValidator.prototype.unwireEvents = function () { | ||
@@ -296,4 +369,6 @@ for (var _i = 0, _a = (this.inputElements); _i < _a.length; _i++) { | ||
}; | ||
// Handle input element focusout event | ||
FormValidator.prototype.focusOutHandler = function (e) { | ||
this.trigger('focusout', e); | ||
//FormValidator.triggerCallback(this.focusout, e); | ||
var element = e.target; | ||
@@ -309,5 +384,7 @@ if (this.rules[element.name]) { | ||
}; | ||
// Handle input element keyup event | ||
FormValidator.prototype.keyUpHandler = function (e) { | ||
this.trigger('keyup', e); | ||
var element = e.target; | ||
// List of keys need to prevent while validation | ||
var excludeKeys = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225]; | ||
@@ -321,5 +398,7 @@ if (e.which === 9 && (!this.rules[element.name] || (this.rules[element.name] && !this.rules[element.name][this.required]))) { | ||
}; | ||
// Handle input click event | ||
FormValidator.prototype.clickHandler = function (e) { | ||
this.trigger('click', e); | ||
var element = e.target; | ||
// If element type is not submit allow validation | ||
if (element.type !== 'submit') { | ||
@@ -329,5 +408,7 @@ this.validate(element.name); | ||
else if (element.getAttribute('formnovalidate') !== null) { | ||
// Prevent form validation, if submit button has formnovalidate attribute | ||
this.allowSubmit = true; | ||
} | ||
}; | ||
// Handle input change event | ||
FormValidator.prototype.changeHandler = function (e) { | ||
@@ -338,4 +419,7 @@ this.trigger('change', e); | ||
}; | ||
// Handle form submit event | ||
FormValidator.prototype.submitHandler = function (e) { | ||
this.trigger('submit', e); | ||
//FormValidator.triggerCallback(this.submit, e); | ||
// Prevent form submit if validation failed | ||
if (!this.allowSubmit && !this.validate()) { | ||
@@ -348,5 +432,7 @@ e.preventDefault(); | ||
}; | ||
// Handle form reset | ||
FormValidator.prototype.resetHandler = function () { | ||
this.reset(); | ||
}; | ||
// Validate each rule based on input element name | ||
FormValidator.prototype.validateRules = function (name) { | ||
@@ -371,2 +457,3 @@ if (!this.rules[name]) { | ||
this.errorRules.push(errorRule); | ||
// Set aria attributes to invalid elements | ||
this.inputElement.setAttribute('aria-invalid', 'true'); | ||
@@ -385,2 +472,3 @@ this.inputElement.setAttribute('aria-describedby', this.inputElement.id + '-info'); | ||
this.trigger('validationComplete', eventArgs); | ||
// Set aria-required to required rule elements | ||
if (rule === 'required') { | ||
@@ -398,2 +486,3 @@ this.inputElement.setAttribute('aria-required', 'true'); | ||
}; | ||
// Check the input element whether it's value satisfy the validation rule or not | ||
FormValidator.prototype.isValid = function (name, rule) { | ||
@@ -419,2 +508,3 @@ var params = this.rules[name][rule]; | ||
}; | ||
// Return default error message or custom error message | ||
FormValidator.prototype.getErrorMessage = function (ruleValue, rule) { | ||
@@ -431,2 +521,3 @@ var message = (ruleValue instanceof Array && typeof ruleValue[1] === 'string') ? ruleValue[1] : this.defaultMessages[rule]; | ||
}; | ||
// Create error element based on name and error message | ||
FormValidator.prototype.createErrorElement = function (name, message, input) { | ||
@@ -438,2 +529,3 @@ var errorElement = createElement(this.errorElement, { | ||
}); | ||
// Create message design if errorOption is message | ||
if (this.errorOption === ErrorOption.Message) { | ||
@@ -445,2 +537,3 @@ errorElement.classList.remove(this.errorClass); | ||
errorElement.id = this.inputElement.name + '-info'; | ||
// Append error message into MVC error message element | ||
if (this.element.querySelector('[data-valmsg-for="' + input.id + '"]')) { | ||
@@ -450,2 +543,3 @@ this.element.querySelector('[data-valmsg-for="' + input.id + '"]').appendChild(errorElement); | ||
else if (input.hasAttribute('data-msg-containerid') === true) { | ||
// Append error message into custom div element | ||
var containerId = input.getAttribute('data-msg-containerid'); | ||
@@ -456,2 +550,3 @@ var divElement = this.element.querySelector('#' + containerId); | ||
else if (this.customPlacement != null) { | ||
// Call custom placement function if customPlacement is not null | ||
this.customPlacement.call(this, this.inputElement, errorElement); | ||
@@ -467,2 +562,3 @@ } | ||
}; | ||
// Get error element by name | ||
FormValidator.prototype.getErrorElement = function (name) { | ||
@@ -475,2 +571,3 @@ this.infoElement = select(this.errorElement + '.' + this.errorClass, this.inputElement.parentElement); | ||
}; | ||
// Remove existing rule from errorRules object | ||
FormValidator.prototype.removeErrorRules = function (name) { | ||
@@ -484,2 +581,3 @@ for (var i = 0; i < this.errorRules.length; i++) { | ||
}; | ||
// Show error message to the input element | ||
FormValidator.prototype.showMessage = function (errorRule) { | ||
@@ -490,2 +588,3 @@ this.infoElement.style.display = 'block'; | ||
}; | ||
// Hide error message based on input name | ||
FormValidator.prototype.hideMessage = function (name) { | ||
@@ -500,2 +599,3 @@ if (this.infoElement) { | ||
}; | ||
// Check whether the input element have required rule and its value is not empty | ||
FormValidator.prototype.checkRequired = function (name) { | ||
@@ -508,2 +608,3 @@ if (!this.rules[name][this.required] && !this.inputElement.value.length) { | ||
}; | ||
// Return boolean result if the input have chekcable or submit types | ||
FormValidator.isCheckable = function (input) { | ||
@@ -513,116 +614,121 @@ var inputType = input.getAttribute('type'); | ||
}; | ||
// List of function to validate the rules | ||
FormValidator.checkValidator = { | ||
required: function (option) { | ||
return option.value.length > 0; | ||
}, | ||
email: function (option) { | ||
return VALIDATE_EMAIL.test(option.value); | ||
}, | ||
url: function (option) { | ||
return VALIDATE_URL.test(option.value); | ||
}, | ||
dateIso: function (option) { | ||
return VALIDATE_DATE_ISO.test(option.value); | ||
}, | ||
tel: function (option) { | ||
return VALIDATE_PHONE.test(option.value); | ||
}, | ||
creditcard: function (option) { | ||
return VALIDATE_CREDITCARD.test(option.value); | ||
}, | ||
number: function (option) { | ||
return !isNaN(Number(option.value)) && option.value.indexOf(' ') === -1; | ||
}, | ||
digits: function (option) { | ||
return VALIDATE_DIGITS.test(option.value); | ||
}, | ||
maxLength: function (option) { | ||
return option.value.length <= option.param; | ||
}, | ||
minLength: function (option) { | ||
return option.value.length >= option.param; | ||
}, | ||
rangeLength: function (option) { | ||
var param = option.param; | ||
return option.value.length >= param[0] && option.value.length <= param[1]; | ||
}, | ||
range: function (option) { | ||
var param = option.param; | ||
return !isNaN(Number(option.value)) && Number(option.value) >= param[0] && Number(option.value) <= param[1]; | ||
}, | ||
date: function (option) { | ||
return !isNaN(new Date(option.value).getTime()); | ||
}, | ||
max: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
// Maximum rule validation for number | ||
return +option.value <= option.param; | ||
} | ||
// Maximum rule validation for date | ||
return new Date(option.value).getTime() <= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
min: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
// Minimum rule validation for number | ||
return +option.value >= option.param; | ||
} | ||
// Minimum rule validation for date | ||
return new Date(option.value).getTime() >= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
regex: function (option) { | ||
return new RegExp(option.param).test(option.value); | ||
}, | ||
equalTo: function (option) { | ||
var compareTo = option.formElement.querySelector('#' + option.param); | ||
option.param = compareTo.value; | ||
return option.param === option.value; | ||
}, | ||
}; | ||
__decorate([ | ||
Property('e-hidden') | ||
], FormValidator.prototype, "ignore", void 0); | ||
__decorate([ | ||
Property({}) | ||
], FormValidator.prototype, "rules", void 0); | ||
__decorate([ | ||
Property('e-error') | ||
], FormValidator.prototype, "errorClass", void 0); | ||
__decorate([ | ||
Property('e-valid') | ||
], FormValidator.prototype, "validClass", void 0); | ||
__decorate([ | ||
Property('label') | ||
], FormValidator.prototype, "errorElement", void 0); | ||
__decorate([ | ||
Property('div') | ||
], FormValidator.prototype, "errorContainer", void 0); | ||
__decorate([ | ||
Property(ErrorOption.Label) | ||
], FormValidator.prototype, "errorOption", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "focusout", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "keyup", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "click", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "change", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "submit", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "validationBegin", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "validationComplete", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "customPlacement", void 0); | ||
FormValidator = FormValidator_1 = __decorate([ | ||
NotifyPropertyChanges | ||
], FormValidator); | ||
return FormValidator; | ||
var FormValidator_1; | ||
}(Base)); | ||
FormValidator.checkValidator = { | ||
required: function (option) { | ||
return option.value.length > 0; | ||
}, | ||
email: function (option) { | ||
return VALIDATE_EMAIL.test(option.value); | ||
}, | ||
url: function (option) { | ||
return VALIDATE_URL.test(option.value); | ||
}, | ||
dateIso: function (option) { | ||
return VALIDATE_DATE_ISO.test(option.value); | ||
}, | ||
tel: function (option) { | ||
return VALIDATE_PHONE.test(option.value); | ||
}, | ||
creditcard: function (option) { | ||
return VALIDATE_CREDITCARD.test(option.value); | ||
}, | ||
number: function (option) { | ||
return !isNaN(Number(option.value)) && option.value.indexOf(' ') === -1; | ||
}, | ||
digits: function (option) { | ||
return VALIDATE_DIGITS.test(option.value); | ||
}, | ||
maxLength: function (option) { | ||
return option.value.length <= option.param; | ||
}, | ||
minLength: function (option) { | ||
return option.value.length >= option.param; | ||
}, | ||
rangeLength: function (option) { | ||
var param = option.param; | ||
return option.value.length >= param[0] && option.value.length <= param[1]; | ||
}, | ||
range: function (option) { | ||
var param = option.param; | ||
return !isNaN(Number(option.value)) && Number(option.value) >= param[0] && Number(option.value) <= param[1]; | ||
}, | ||
date: function (option) { | ||
return !isNaN(new Date(option.value).getTime()); | ||
}, | ||
max: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
return +option.value <= option.param; | ||
} | ||
return new Date(option.value).getTime() <= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
min: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
return +option.value >= option.param; | ||
} | ||
return new Date(option.value).getTime() >= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
regex: function (option) { | ||
return new RegExp(option.param).test(option.value); | ||
}, | ||
equalTo: function (option) { | ||
var compareTo = option.formElement.querySelector('#' + option.param); | ||
option.param = compareTo.value; | ||
return option.param === option.value; | ||
}, | ||
}; | ||
__decorate([ | ||
Property('e-hidden') | ||
], FormValidator.prototype, "ignore", void 0); | ||
__decorate([ | ||
Property({}) | ||
], FormValidator.prototype, "rules", void 0); | ||
__decorate([ | ||
Property('e-error') | ||
], FormValidator.prototype, "errorClass", void 0); | ||
__decorate([ | ||
Property('e-valid') | ||
], FormValidator.prototype, "validClass", void 0); | ||
__decorate([ | ||
Property('label') | ||
], FormValidator.prototype, "errorElement", void 0); | ||
__decorate([ | ||
Property('div') | ||
], FormValidator.prototype, "errorContainer", void 0); | ||
__decorate([ | ||
Property(ErrorOption.Label) | ||
], FormValidator.prototype, "errorOption", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "focusout", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "keyup", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "click", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "change", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "submit", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "validationBegin", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "validationComplete", void 0); | ||
__decorate([ | ||
Event() | ||
], FormValidator.prototype, "customPlacement", void 0); | ||
FormValidator = FormValidator_1 = __decorate([ | ||
NotifyPropertyChanges | ||
], FormValidator); | ||
export { FormValidator }; | ||
var FormValidator_1; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Input box Component | ||
*/ | ||
export * from './form-validator'; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* NumericTextBox all modules | ||
*/ | ||
export * from './numerictextbox/index'; | ||
@@ -2,0 +5,0 @@ export * from './maskedtextbox/index'; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Input box Component | ||
*/ | ||
export * from './input'; |
@@ -18,2 +18,5 @@ import { createElement, attributes, addClass, removeClass, detach, classList, closest, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
}; | ||
/** | ||
* Base for Input creation through util methods. | ||
*/ | ||
export var Input; | ||
@@ -26,2 +29,9 @@ (function (Input) { | ||
}; | ||
/** | ||
* Create a wrapper to input element with multiple span elements and set the basic properties to input based components. | ||
* ``` | ||
* E.g : Input.createInput({ element: element, floatLabelType : "Auto", properties: { placeholder: 'Search' } }); | ||
* ``` | ||
* @param args | ||
*/ | ||
function createInput(args) { | ||
@@ -195,2 +205,5 @@ var inputObject = { container: null, buttons: [], clearButton: null }; | ||
} | ||
/** | ||
* To create clear button. | ||
*/ | ||
function createClearButton(element, container) { | ||
@@ -235,2 +248,5 @@ var button = createElement('span', { className: CLASSNAMES.CLEARICON }); | ||
} | ||
/** | ||
* To create input box contianer. | ||
*/ | ||
function createInputContainer(args, className, tagClass, tag) { | ||
@@ -247,2 +263,12 @@ var container; | ||
} | ||
/** | ||
* Sets the value to the input element. | ||
* ``` | ||
* E.g : Input.setValue('content', element, "Auto", true ); | ||
* ``` | ||
* @param value - Specify the value of the input element. | ||
* @param element - The element on which the specified value is updated. | ||
* @param floatLabelType - Specify the float label type of the input element. | ||
* @param clearButton - Boolean value to specify whether the clear icon is enabled / disabled on the input. | ||
*/ | ||
function setValue(value, element, floatLabelType, clearButton) { | ||
@@ -265,2 +291,11 @@ element.value = value; | ||
Input.setValue = setValue; | ||
/** | ||
* Sets the single or multiple cssClass to wrapper of input element. | ||
* ``` | ||
* E.g : Input.setCssClass('e-custom-class', [element]); | ||
* ``` | ||
* @param cssClass - Css class names which are needed to add. | ||
* @param elements - The elements which are needed to add / remove classes. | ||
* @param oldClass - Css class names which are needed to remove. If old classes are need to remove, can give this optional parameter. | ||
*/ | ||
function setCssClass(cssClass, elements, oldClass) { | ||
@@ -275,2 +310,10 @@ if (!isNullOrUndefined(oldClass) && oldClass !== '') { | ||
Input.setCssClass = setCssClass; | ||
/** | ||
* Set the placeholder attribute to the input element. | ||
* ``` | ||
* E.g : Input.setPlaceholder('Search here', element); | ||
* ``` | ||
* @param placeholder - Placeholder value which is need to add. | ||
* @param element - The element on which the placeholder is need to add. | ||
*/ | ||
function setPlaceholder(placeholder, element) { | ||
@@ -300,2 +343,12 @@ var parentElement; | ||
Input.setPlaceholder = setPlaceholder; | ||
/** | ||
* Set the read only attribute to the input element | ||
* ``` | ||
* E.g : Input.setReadonly(true, element); | ||
* ``` | ||
* @param isReadonly | ||
* - Boolean value to specify whether to set read only. Setting "True" value enables read only. | ||
* @param element | ||
* - The element which is need to enable read only. | ||
*/ | ||
function setReadonly(isReadonly, element, floatLabelType) { | ||
@@ -313,2 +366,12 @@ if (isReadonly) { | ||
Input.setReadonly = setReadonly; | ||
/** | ||
* Displays the element direction from right to left when its enabled. | ||
* ``` | ||
* E.g : Input.setEnableRtl(true, [inputObj.container]); | ||
* ``` | ||
* @param isRtl | ||
* - Boolean value to specify whether to set RTL. Setting "True" value enables the RTL mode. | ||
* @param elements | ||
* - The elements that are needed to enable/disable RTL. | ||
*/ | ||
function setEnableRtl(isRtl, elements) { | ||
@@ -323,2 +386,12 @@ if (isRtl) { | ||
Input.setEnableRtl = setEnableRtl; | ||
/** | ||
* Enables or disables the given input element. | ||
* ``` | ||
* E.g : Input.setEnabled(false, element); | ||
* ``` | ||
* @param isEnable | ||
* - Boolean value to specify whether to enable or disable. | ||
* @param element | ||
* - Element to be enabled or disabled. | ||
*/ | ||
function setEnabled(isEnable, element, floatLabelType) { | ||
@@ -339,2 +412,12 @@ var disabledAttrs = { 'disabled': 'disabled', 'aria-disabled': 'true' }; | ||
Input.setEnabled = setEnabled; | ||
/** | ||
* Removing the multiple attributes from the given element such as "disabled","id" , etc. | ||
* ``` | ||
* E.g : Input.removeAttributes({ 'disabled': 'disabled', 'aria-disabled': 'true' }, element); | ||
* ``` | ||
* @param attrs | ||
* - Array of attributes which are need to removed from the element. | ||
* @param element | ||
* - Element on which the attributes are needed to be removed. | ||
*/ | ||
function removeAttributes(attrs, element) { | ||
@@ -360,2 +443,12 @@ for (var _i = 0, _a = Object.keys(attrs); _i < _a.length; _i++) { | ||
Input.removeAttributes = removeAttributes; | ||
/** | ||
* Adding the multiple attributes to the given element such as "disabled","id" , etc. | ||
* ``` | ||
* E.g : Input.addAttributes({ 'id': 'inputpopup' }, element); | ||
* ``` | ||
* @param attrs | ||
* - Array of attributes which is added to element. | ||
* @param element | ||
* - Element on which the attributes are needed to be added. | ||
*/ | ||
function addAttributes(attrs, element) { | ||
@@ -425,2 +518,11 @@ for (var _i = 0, _a = Object.keys(attrs); _i < _a.length; _i++) { | ||
Input.addFloating = addFloating; | ||
/** | ||
* Creates a new span element with the given icons added and append it in container element. | ||
* ``` | ||
* E.g : Input.appendSpan('e-icon-spin', inputObj.container); | ||
* ``` | ||
* @param iconClass - Icon classes which are need to add to the span element which is going to created. | ||
* Span element acts as icon or button element for input. | ||
* @param container - The container on which created span element is going to append. | ||
*/ | ||
function appendSpan(iconClass, container) { | ||
@@ -427,0 +529,0 @@ var button = createElement('span', { className: iconClass }); |
@@ -0,1 +1,4 @@ | ||
/** | ||
* MaskedTextbox base modules | ||
*/ | ||
export * from './mask-base'; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* MaskedTextBox base module | ||
*/ | ||
import { EventHandler, isNullOrUndefined, merge, attributes, addClass, removeClass, Browser } from '@syncfusion/ej2-base'; | ||
@@ -9,2 +12,6 @@ import { Input } from '../../input/input'; | ||
var BOTTOMLABEL = 'e-label-bottom'; | ||
/** | ||
* @hidden | ||
* Built-in masking elements collection. | ||
*/ | ||
export var regularExpressions = { | ||
@@ -21,2 +28,6 @@ '0': '[0-9]', | ||
}; | ||
/** | ||
* @hidden | ||
* Generate required masking elements to the MaskedTextBox from user mask input. | ||
*/ | ||
export function createMask() { | ||
@@ -105,2 +116,6 @@ attributes(this.element, { 'role': 'textbox', 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', | ||
} | ||
/** | ||
* @hidden | ||
* Apply mask ability with masking elements to the MaskedTextBox. | ||
*/ | ||
export function applyMask() { | ||
@@ -110,2 +125,6 @@ setElementValue.call(this, this.promptMask); | ||
} | ||
/** | ||
* @hidden | ||
* To wire required events to the MaskedTextBox. | ||
*/ | ||
export function wireEvents() { | ||
@@ -121,2 +140,6 @@ EventHandler.add(this.element, 'keydown', maskInputKeyDownHandler, this); | ||
} | ||
/** | ||
* @hidden | ||
* To unwire events attached to the MaskedTextBox. | ||
*/ | ||
export function unwireEvents() { | ||
@@ -131,5 +154,13 @@ EventHandler.remove(this.element, 'keydown', maskInputKeyDownHandler); | ||
} | ||
/** | ||
* @hidden | ||
* To get masked value from the MaskedTextBox. | ||
*/ | ||
export function unstrippedValue(element) { | ||
return element.value; | ||
} | ||
/** | ||
* @hidden | ||
* To extract raw value from the MaskedTextBox. | ||
*/ | ||
export function strippedValue(element) { | ||
@@ -672,2 +703,6 @@ var value = ''; | ||
} | ||
/** | ||
* @hidden | ||
* Validates user input using masking elements '<' , '>' and '|'. | ||
*/ | ||
function changeToLowerUpperCase(key, value) { | ||
@@ -717,2 +752,6 @@ var promptMask; | ||
} | ||
/** | ||
* @hidden | ||
* To set updated values in the MaskedTextBox. | ||
*/ | ||
export function setMaskValue(val) { | ||
@@ -740,2 +779,6 @@ if (this.mask && !isNullOrUndefined(val) && (val === '' || this.prevValue !== val)) { | ||
} | ||
/** | ||
* @hidden | ||
* To set updated values in the input element. | ||
*/ | ||
export function setElementValue(val, element) { | ||
@@ -747,2 +790,6 @@ if (!this.isFocus && this.floatLabelType === 'Auto' && isNullOrUndefined(this.value)) { | ||
} | ||
/** | ||
* @hidden | ||
* Provide mask support to input textbox through utility method. | ||
*/ | ||
export function maskInput(args) { | ||
@@ -781,5 +828,13 @@ var inputEle = getMaskInput(args); | ||
} | ||
/** | ||
* @hidden | ||
* Gets raw value of the textbox which has been masked through utility method. | ||
*/ | ||
export function getVal(args) { | ||
return strippedValue.call(getUtilMaskEle(args), args.element); | ||
} | ||
/** | ||
* @hidden | ||
* Gets masked value of the textbox which has been masked through utility method. | ||
*/ | ||
export function getMaskedVal(args) { | ||
@@ -796,3 +851,7 @@ return unstrippedValue.call(getUtilMaskEle(args), args.element); | ||
} | ||
var MaskUndo = (function () { | ||
/** | ||
* @hidden | ||
* Arguments to perform undo and redo functionalities. | ||
*/ | ||
var MaskUndo = /** @class */ (function () { | ||
function MaskUndo() { | ||
@@ -799,0 +858,0 @@ } |
@@ -0,2 +1,5 @@ | ||
/** | ||
* MaskedTextbox modules | ||
*/ | ||
export * from './base/index'; | ||
export * from './maskedtextbox/index'; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* MaskedTextbox modules | ||
*/ | ||
export * from './maskedtextbox'; |
@@ -24,3 +24,15 @@ var __extends = (this && this.__extends) || (function () { | ||
var INPUT = 'e-input'; | ||
var MaskedTextBox = (function (_super) { | ||
/** | ||
* The MaskedTextBox allows the user to enter the valid input only based on the provided mask. | ||
* ```html | ||
* <input id="mask" type="text" /> | ||
* ``` | ||
* ```typescript | ||
* <script> | ||
* var maskObj = new MaskedTextBox({ mask: "(999) 9999-999" }); | ||
* maskObj.appendTo('#mask'); | ||
* </script> | ||
* ``` | ||
*/ | ||
var MaskedTextBox = /** @class */ (function (_super) { | ||
__extends(MaskedTextBox, _super); | ||
@@ -43,5 +55,13 @@ function MaskedTextBox(options, element) { | ||
} | ||
/** | ||
* Gets the component name | ||
* @private | ||
*/ | ||
MaskedTextBox.prototype.getModuleName = function () { | ||
return 'maskedtextbox'; | ||
}; | ||
/** | ||
* Initializes the event handler | ||
* @private | ||
*/ | ||
MaskedTextBox.prototype.preRender = function () { | ||
@@ -64,2 +84,6 @@ var ejInstance = getValue('ej2_instances', this.element); | ||
}; | ||
/** | ||
* Gets the properties to be maintained in the persisted state. | ||
* @return {string} | ||
*/ | ||
MaskedTextBox.prototype.getPersistData = function () { | ||
@@ -69,2 +93,6 @@ var keyEntity = ['value']; | ||
}; | ||
/** | ||
* Initializes the component rendering. | ||
* @private | ||
*/ | ||
MaskedTextBox.prototype.render = function () { | ||
@@ -134,2 +162,6 @@ if (this.element.tagName.toLowerCase() === 'input') { | ||
}; | ||
/** | ||
* Calls internally if any of the property value is changed. | ||
* @hidden | ||
*/ | ||
MaskedTextBox.prototype.onPropertyChanged = function (newProp, oldProp) { | ||
@@ -194,5 +226,15 @@ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) { | ||
}; | ||
/** | ||
* Gets the value of the MaskedTextBox with the masked format. | ||
* @return {string} | ||
*/ | ||
MaskedTextBox.prototype.getMaskedValue = function () { | ||
return unstrippedValue.call(this, this.element); | ||
}; | ||
/** | ||
* Removes the component from the DOM and detaches all its related event handlers. | ||
* Also it maintains the initial input element from the DOM. | ||
* @method destroy | ||
* @return {void} | ||
*/ | ||
MaskedTextBox.prototype.destroy = function () { | ||
@@ -204,49 +246,49 @@ unwireEvents.call(this); | ||
}; | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
Property('Never') | ||
], MaskedTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
Property(true) | ||
], MaskedTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
Property(false) | ||
], MaskedTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
Property(false) | ||
], MaskedTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "mask", void 0); | ||
__decorate([ | ||
Property('_') | ||
], MaskedTextBox.prototype, "promptChar", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "customCharacters", void 0); | ||
__decorate([ | ||
Event() | ||
], MaskedTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
Event() | ||
], MaskedTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
Event() | ||
], MaskedTextBox.prototype, "change", void 0); | ||
MaskedTextBox = __decorate([ | ||
NotifyPropertyChanges | ||
], MaskedTextBox); | ||
return MaskedTextBox; | ||
}(Component)); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
Property('Never') | ||
], MaskedTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
Property(true) | ||
], MaskedTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
Property(false) | ||
], MaskedTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
Property(false) | ||
], MaskedTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "mask", void 0); | ||
__decorate([ | ||
Property('_') | ||
], MaskedTextBox.prototype, "promptChar", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
Property(null) | ||
], MaskedTextBox.prototype, "customCharacters", void 0); | ||
__decorate([ | ||
Event() | ||
], MaskedTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
Event() | ||
], MaskedTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
Event() | ||
], MaskedTextBox.prototype, "change", void 0); | ||
MaskedTextBox = __decorate([ | ||
NotifyPropertyChanges | ||
], MaskedTextBox); | ||
export { MaskedTextBox }; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* NumericTextBox modules | ||
*/ | ||
export * from './numerictextbox'; |
@@ -32,3 +32,15 @@ var __extends = (this && this.__extends) || (function () { | ||
var DECIMALSEPARATOR = '.'; | ||
var NumericTextBox = (function (_super) { | ||
/** | ||
* Represents the NumericTextBox component that allows the user to enter only numeric values. | ||
* ```html | ||
* <input type='text' id="numeric"/> | ||
* ``` | ||
* ```typescript | ||
* <script> | ||
* var numericObj = new NumericTextBox({ value: 10 }); | ||
* numericObj.appendTo("#numeric"); | ||
* </script> | ||
* ``` | ||
*/ | ||
var NumericTextBox = /** @class */ (function (_super) { | ||
__extends(NumericTextBox, _super); | ||
@@ -77,2 +89,6 @@ function NumericTextBox(options, element) { | ||
}; | ||
/** | ||
* To Initialize the control rendering | ||
* @private | ||
*/ | ||
NumericTextBox.prototype.render = function () { | ||
@@ -140,2 +156,3 @@ if (this.element.tagName.toLowerCase() === 'input') { | ||
}; | ||
/* Wrapper creation */ | ||
NumericTextBox.prototype.createWrapper = function () { | ||
@@ -168,2 +185,3 @@ var inputObj = Input.createInput({ | ||
}; | ||
/* Spinner creation */ | ||
NumericTextBox.prototype.spinBtnCreation = function () { | ||
@@ -234,2 +252,3 @@ this.spinDown = Input.appendSpan(SPINICON + ' ' + SPINDOWN, this.container); | ||
NumericTextBox.prototype.wireSpinBtnEvents = function () { | ||
/* bind spin button events */ | ||
EventHandler.add(this.spinUp, Browser.touchStartEvent, this.mouseDownOnSpinner, this); | ||
@@ -251,2 +270,3 @@ EventHandler.add(this.spinDown, Browser.touchStartEvent, this.mouseDownOnSpinner, this); | ||
NumericTextBox.prototype.unwireSpinBtnEvents = function () { | ||
/* unbind spin button events */ | ||
EventHandler.remove(this.spinUp, Browser.touchStartEvent, this.mouseDownOnSpinner); | ||
@@ -584,2 +604,7 @@ EventHandler.remove(this.spinDown, Browser.touchStartEvent, this.mouseDownOnSpinner); | ||
}; | ||
/** | ||
* Increments the NumericTextBox value with the specified step value. | ||
* @param {number} step - Specifies the value used to increment the NumericTextBox value. | ||
* if its not given then numeric value will be incremented based on the step property value. | ||
*/ | ||
NumericTextBox.prototype.increment = function (step) { | ||
@@ -589,2 +614,7 @@ if (step === void 0) { step = this.step; } | ||
}; | ||
/** | ||
* Decrements the NumericTextBox value with specified step value. | ||
* @param {number} step - Specifies the value used to decrement the NumericTextBox value. | ||
* if its not given then numeric value will be decremented based on the step property value. | ||
*/ | ||
NumericTextBox.prototype.decrement = function (step) { | ||
@@ -594,2 +624,8 @@ if (step === void 0) { step = this.step; } | ||
}; | ||
/** | ||
* Removes the component from the DOM and detaches all its related event handlers. | ||
* Also it maintains the initial input element from the DOM. | ||
* @method destroy | ||
* @return {void} | ||
*/ | ||
NumericTextBox.prototype.destroy = function () { | ||
@@ -607,5 +643,12 @@ this.unwireEvents(); | ||
}; | ||
/** | ||
* Returns the value of NumericTextBox with the format applied to the NumericTextBox. | ||
*/ | ||
NumericTextBox.prototype.getText = function () { | ||
return this.element.value; | ||
}; | ||
/** | ||
* Gets the properties to be maintained in the persisted state. | ||
* @return {string} | ||
*/ | ||
NumericTextBox.prototype.getPersistData = function () { | ||
@@ -615,2 +658,6 @@ var keyEntity = ['value']; | ||
}; | ||
/** | ||
* Calls internally if any of the property value is changed. | ||
* @private | ||
*/ | ||
NumericTextBox.prototype.onPropertyChanged = function (newProp, oldProp) { | ||
@@ -706,74 +753,81 @@ var elementVal; | ||
}; | ||
/** | ||
* Gets the component name | ||
* @private | ||
*/ | ||
NumericTextBox.prototype.getModuleName = function () { | ||
return 'numerictextbox'; | ||
}; | ||
__decorate([ | ||
Property('') | ||
], NumericTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
Property(-(Number.MAX_VALUE)) | ||
], NumericTextBox.prototype, "min", void 0); | ||
__decorate([ | ||
Property(Number.MAX_VALUE) | ||
], NumericTextBox.prototype, "max", void 0); | ||
__decorate([ | ||
Property(1) | ||
], NumericTextBox.prototype, "step", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
Property(true) | ||
], NumericTextBox.prototype, "showSpinButton", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "readonly", void 0); | ||
__decorate([ | ||
Property(true) | ||
], NumericTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
Property('n2') | ||
], NumericTextBox.prototype, "format", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "decimals", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "currency", void 0); | ||
__decorate([ | ||
Property(true) | ||
], NumericTextBox.prototype, "strictMode", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "validateDecimalOnType", void 0); | ||
__decorate([ | ||
Property('Never') | ||
], NumericTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
Event() | ||
], NumericTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
Event() | ||
], NumericTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
Event() | ||
], NumericTextBox.prototype, "change", void 0); | ||
NumericTextBox = __decorate([ | ||
NotifyPropertyChanges | ||
], NumericTextBox); | ||
return NumericTextBox; | ||
}(Component)); | ||
__decorate([ | ||
Property('') | ||
], NumericTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
Property(-(Number.MAX_VALUE)) | ||
], NumericTextBox.prototype, "min", void 0); | ||
__decorate([ | ||
Property(Number.MAX_VALUE) | ||
], NumericTextBox.prototype, "max", void 0); | ||
__decorate([ | ||
Property(1) | ||
], NumericTextBox.prototype, "step", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
Property(true) | ||
], NumericTextBox.prototype, "showSpinButton", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "readonly", void 0); | ||
__decorate([ | ||
Property(true) | ||
], NumericTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
Property('n2') | ||
], NumericTextBox.prototype, "format", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "decimals", void 0); | ||
__decorate([ | ||
Property(null) | ||
], NumericTextBox.prototype, "currency", void 0); | ||
__decorate([ | ||
Property(true) | ||
], NumericTextBox.prototype, "strictMode", void 0); | ||
__decorate([ | ||
Property(false) | ||
], NumericTextBox.prototype, "validateDecimalOnType", void 0); | ||
__decorate([ | ||
Property('Never') | ||
], NumericTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
Event() | ||
], NumericTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
Event() | ||
], NumericTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
Event() | ||
], NumericTextBox.prototype, "change", void 0); | ||
NumericTextBox = __decorate([ | ||
NotifyPropertyChanges | ||
], NumericTextBox); | ||
export { NumericTextBox }; | ||
/** | ||
* Builder for NumericTextBox | ||
*/ | ||
export var numerictextboxHelper = CreateBuilder(NumericTextBox); |
{ | ||
"name": "@syncfusion/ej2-inputs", | ||
"version": "15.4.17", | ||
"version": "15.4.20", | ||
"description": "Essential JS 2 Input Components", | ||
@@ -9,3 +9,3 @@ "author": "Syncfusion Inc.", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "^15.4.17" | ||
"@syncfusion/ej2-base": "^15.4.20" | ||
}, | ||
@@ -12,0 +12,0 @@ "devDependencies": { |
@@ -32,3 +32,3 @@ var __extends = (this && this.__extends) || (function () { | ||
})(ErrorOption = exports.ErrorOption || (exports.ErrorOption = {})); | ||
var FormValidator = FormValidator_1 = (function (_super) { | ||
var FormValidator = (function (_super) { | ||
__extends(FormValidator, _super); | ||
@@ -76,2 +76,3 @@ function FormValidator(element, options) { | ||
} | ||
FormValidator_1 = FormValidator; | ||
FormValidator.prototype.addRules = function (name, rules) { | ||
@@ -477,117 +478,117 @@ if (this.rules.hasOwnProperty(name)) { | ||
}; | ||
FormValidator.checkValidator = { | ||
required: function (option) { | ||
return option.value.length > 0; | ||
}, | ||
email: function (option) { | ||
return VALIDATE_EMAIL.test(option.value); | ||
}, | ||
url: function (option) { | ||
return VALIDATE_URL.test(option.value); | ||
}, | ||
dateIso: function (option) { | ||
return VALIDATE_DATE_ISO.test(option.value); | ||
}, | ||
tel: function (option) { | ||
return VALIDATE_PHONE.test(option.value); | ||
}, | ||
creditcard: function (option) { | ||
return VALIDATE_CREDITCARD.test(option.value); | ||
}, | ||
number: function (option) { | ||
return !isNaN(Number(option.value)) && option.value.indexOf(' ') === -1; | ||
}, | ||
digits: function (option) { | ||
return VALIDATE_DIGITS.test(option.value); | ||
}, | ||
maxLength: function (option) { | ||
return option.value.length <= option.param; | ||
}, | ||
minLength: function (option) { | ||
return option.value.length >= option.param; | ||
}, | ||
rangeLength: function (option) { | ||
var param = option.param; | ||
return option.value.length >= param[0] && option.value.length <= param[1]; | ||
}, | ||
range: function (option) { | ||
var param = option.param; | ||
return !isNaN(Number(option.value)) && Number(option.value) >= param[0] && Number(option.value) <= param[1]; | ||
}, | ||
date: function (option) { | ||
return !isNaN(new Date(option.value).getTime()); | ||
}, | ||
max: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
return +option.value <= option.param; | ||
} | ||
return new Date(option.value).getTime() <= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
min: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
return +option.value >= option.param; | ||
} | ||
return new Date(option.value).getTime() >= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
regex: function (option) { | ||
return new RegExp(option.param).test(option.value); | ||
}, | ||
equalTo: function (option) { | ||
var compareTo = option.formElement.querySelector('#' + option.param); | ||
option.param = compareTo.value; | ||
return option.param === option.value; | ||
}, | ||
}; | ||
__decorate([ | ||
ej2_base_3.Property('e-hidden') | ||
], FormValidator.prototype, "ignore", void 0); | ||
__decorate([ | ||
ej2_base_3.Property({}) | ||
], FormValidator.prototype, "rules", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('e-error') | ||
], FormValidator.prototype, "errorClass", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('e-valid') | ||
], FormValidator.prototype, "validClass", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('label') | ||
], FormValidator.prototype, "errorElement", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('div') | ||
], FormValidator.prototype, "errorContainer", void 0); | ||
__decorate([ | ||
ej2_base_3.Property(ErrorOption.Label) | ||
], FormValidator.prototype, "errorOption", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "focusout", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "keyup", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "click", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "change", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "submit", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "validationBegin", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "validationComplete", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "customPlacement", void 0); | ||
FormValidator = FormValidator_1 = __decorate([ | ||
ej2_base_3.NotifyPropertyChanges | ||
], FormValidator); | ||
return FormValidator; | ||
var FormValidator_1; | ||
}(ej2_base_1.Base)); | ||
FormValidator.checkValidator = { | ||
required: function (option) { | ||
return option.value.length > 0; | ||
}, | ||
email: function (option) { | ||
return VALIDATE_EMAIL.test(option.value); | ||
}, | ||
url: function (option) { | ||
return VALIDATE_URL.test(option.value); | ||
}, | ||
dateIso: function (option) { | ||
return VALIDATE_DATE_ISO.test(option.value); | ||
}, | ||
tel: function (option) { | ||
return VALIDATE_PHONE.test(option.value); | ||
}, | ||
creditcard: function (option) { | ||
return VALIDATE_CREDITCARD.test(option.value); | ||
}, | ||
number: function (option) { | ||
return !isNaN(Number(option.value)) && option.value.indexOf(' ') === -1; | ||
}, | ||
digits: function (option) { | ||
return VALIDATE_DIGITS.test(option.value); | ||
}, | ||
maxLength: function (option) { | ||
return option.value.length <= option.param; | ||
}, | ||
minLength: function (option) { | ||
return option.value.length >= option.param; | ||
}, | ||
rangeLength: function (option) { | ||
var param = option.param; | ||
return option.value.length >= param[0] && option.value.length <= param[1]; | ||
}, | ||
range: function (option) { | ||
var param = option.param; | ||
return !isNaN(Number(option.value)) && Number(option.value) >= param[0] && Number(option.value) <= param[1]; | ||
}, | ||
date: function (option) { | ||
return !isNaN(new Date(option.value).getTime()); | ||
}, | ||
max: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
return +option.value <= option.param; | ||
} | ||
return new Date(option.value).getTime() <= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
min: function (option) { | ||
if (!isNaN(Number(option.value))) { | ||
return +option.value >= option.param; | ||
} | ||
return new Date(option.value).getTime() >= new Date(JSON.parse(JSON.stringify(option.param))).getTime(); | ||
}, | ||
regex: function (option) { | ||
return new RegExp(option.param).test(option.value); | ||
}, | ||
equalTo: function (option) { | ||
var compareTo = option.formElement.querySelector('#' + option.param); | ||
option.param = compareTo.value; | ||
return option.param === option.value; | ||
}, | ||
}; | ||
__decorate([ | ||
ej2_base_3.Property('e-hidden') | ||
], FormValidator.prototype, "ignore", void 0); | ||
__decorate([ | ||
ej2_base_3.Property({}) | ||
], FormValidator.prototype, "rules", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('e-error') | ||
], FormValidator.prototype, "errorClass", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('e-valid') | ||
], FormValidator.prototype, "validClass", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('label') | ||
], FormValidator.prototype, "errorElement", void 0); | ||
__decorate([ | ||
ej2_base_3.Property('div') | ||
], FormValidator.prototype, "errorContainer", void 0); | ||
__decorate([ | ||
ej2_base_3.Property(ErrorOption.Label) | ||
], FormValidator.prototype, "errorOption", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "focusout", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "keyup", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "click", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "change", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "submit", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "validationBegin", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "validationComplete", void 0); | ||
__decorate([ | ||
ej2_base_3.Event() | ||
], FormValidator.prototype, "customPlacement", void 0); | ||
FormValidator = FormValidator_1 = __decorate([ | ||
ej2_base_3.NotifyPropertyChanges | ||
], FormValidator); | ||
exports.FormValidator = FormValidator; | ||
var FormValidator_1; | ||
}); |
@@ -196,50 +196,50 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('Never') | ||
], MaskedTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], MaskedTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], MaskedTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], MaskedTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "mask", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('_') | ||
], MaskedTextBox.prototype, "promptChar", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "customCharacters", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], MaskedTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], MaskedTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], MaskedTextBox.prototype, "change", void 0); | ||
MaskedTextBox = __decorate([ | ||
ej2_base_1.NotifyPropertyChanges | ||
], MaskedTextBox); | ||
return MaskedTextBox; | ||
}(ej2_base_1.Component)); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('Never') | ||
], MaskedTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], MaskedTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], MaskedTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], MaskedTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "mask", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('_') | ||
], MaskedTextBox.prototype, "promptChar", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], MaskedTextBox.prototype, "customCharacters", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], MaskedTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], MaskedTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], MaskedTextBox.prototype, "change", void 0); | ||
MaskedTextBox = __decorate([ | ||
ej2_base_1.NotifyPropertyChanges | ||
], MaskedTextBox); | ||
exports.MaskedTextBox = MaskedTextBox; | ||
}); |
@@ -695,72 +695,72 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
__decorate([ | ||
ej2_base_1.Property('') | ||
], NumericTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(-(Number.MAX_VALUE)) | ||
], NumericTextBox.prototype, "min", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(Number.MAX_VALUE) | ||
], NumericTextBox.prototype, "max", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(1) | ||
], NumericTextBox.prototype, "step", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], NumericTextBox.prototype, "showSpinButton", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "readonly", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], NumericTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('n2') | ||
], NumericTextBox.prototype, "format", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "decimals", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "currency", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], NumericTextBox.prototype, "strictMode", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "validateDecimalOnType", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('Never') | ||
], NumericTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], NumericTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], NumericTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], NumericTextBox.prototype, "change", void 0); | ||
NumericTextBox = __decorate([ | ||
ej2_base_2.NotifyPropertyChanges | ||
], NumericTextBox); | ||
return NumericTextBox; | ||
}(ej2_base_1.Component)); | ||
__decorate([ | ||
ej2_base_1.Property('') | ||
], NumericTextBox.prototype, "cssClass", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "value", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(-(Number.MAX_VALUE)) | ||
], NumericTextBox.prototype, "min", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(Number.MAX_VALUE) | ||
], NumericTextBox.prototype, "max", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(1) | ||
], NumericTextBox.prototype, "step", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "width", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "placeholder", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], NumericTextBox.prototype, "showSpinButton", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "readonly", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], NumericTextBox.prototype, "enabled", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "enableRtl", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "enablePersistence", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('n2') | ||
], NumericTextBox.prototype, "format", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "decimals", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(null) | ||
], NumericTextBox.prototype, "currency", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(true) | ||
], NumericTextBox.prototype, "strictMode", void 0); | ||
__decorate([ | ||
ej2_base_1.Property(false) | ||
], NumericTextBox.prototype, "validateDecimalOnType", void 0); | ||
__decorate([ | ||
ej2_base_1.Property('Never') | ||
], NumericTextBox.prototype, "floatLabelType", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], NumericTextBox.prototype, "created", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], NumericTextBox.prototype, "destroyed", void 0); | ||
__decorate([ | ||
ej2_base_1.Event() | ||
], NumericTextBox.prototype, "change", void 0); | ||
NumericTextBox = __decorate([ | ||
ej2_base_2.NotifyPropertyChanges | ||
], NumericTextBox); | ||
exports.NumericTextBox = NumericTextBox; | ||
exports.numerictextboxHelper = ej2_base_1.CreateBuilder(NumericTextBox); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7599853
75636