@acorex/components 3.0.0 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/acorex-components.metadata.json +1 -1
- package/bundles/acorex-components.umd.js +40 -34
- package/bundles/acorex-components.umd.js.map +1 -1
- package/bundles/acorex-components.umd.min.js +1 -1
- package/bundles/acorex-components.umd.min.js.map +1 -1
- package/esm2015/lib/base/element.class.js +38 -32
- package/esm2015/lib/checkbox/checkbox.component.js +2 -2
- package/esm2015/lib/selectbox/selectbox.component.js +2 -2
- package/esm2015/lib/time-picker/time-picker.component.js +2 -2
- package/esm5/lib/base/element.class.js +38 -32
- package/esm5/lib/checkbox/checkbox.component.js +2 -2
- package/esm5/lib/selectbox/selectbox.component.js +2 -2
- package/esm5/lib/time-picker/time-picker.component.js +2 -2
- package/fesm2015/acorex-components.js +41 -35
- package/fesm2015/acorex-components.js.map +1 -1
- package/fesm5/acorex-components.js +40 -34
- package/fesm5/acorex-components.js.map +1 -1
- package/package.json +1 -1
|
@@ -233,12 +233,15 @@ class AXValidatableComponent extends AXBaseComponent {
|
|
|
233
233
|
this.__nativeElement = elementRef.nativeElement;
|
|
234
234
|
this.__valueField = valueField;
|
|
235
235
|
this.__validation = validation;
|
|
236
|
+
const value = this[this.__valueField];
|
|
237
|
+
if ((!Array.isArray(value) && value) || (Array.isArray(value) && value.length > 0))
|
|
238
|
+
this.validate();
|
|
236
239
|
}
|
|
237
240
|
get validation() {
|
|
238
241
|
return this.__validation;
|
|
239
242
|
}
|
|
240
243
|
validate() {
|
|
241
|
-
if (this.__validation !== undefined) {
|
|
244
|
+
if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
|
|
242
245
|
const result = this.__validation.validate(this[this.__valueField]);
|
|
243
246
|
result.then(c => {
|
|
244
247
|
if (c.result) {
|
|
@@ -256,40 +259,44 @@ class AXValidatableComponent extends AXBaseComponent {
|
|
|
256
259
|
}
|
|
257
260
|
clearValidationStyle(element, clear = false) {
|
|
258
261
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
262
|
+
if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
|
|
263
|
+
const formGroup = element.closest('.form-group');
|
|
264
|
+
const formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
|
|
265
|
+
;
|
|
266
|
+
const label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
|
|
267
|
+
const parent = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
|
|
268
|
+
(_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.remove('success-state');
|
|
269
|
+
(_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('error-state');
|
|
270
|
+
//formItem?.classList.remove('required-state');
|
|
271
|
+
if (!clear) {
|
|
272
|
+
(_f = formItem) === null || _f === void 0 ? void 0 : _f.classList.add('success-state');
|
|
273
|
+
}
|
|
274
|
+
(_g = label) === null || _g === void 0 ? void 0 : _g.classList.remove('error-text');
|
|
275
|
+
if (parent.querySelector('span.error-text')) {
|
|
276
|
+
parent.removeChild(parent.querySelector('span.error-text'));
|
|
277
|
+
}
|
|
273
278
|
}
|
|
274
279
|
}
|
|
275
280
|
applyValidationStyle(element, v) {
|
|
276
281
|
var _a, _b, _c, _d, _e, _f;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
282
|
+
if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
|
|
283
|
+
const formGroup = element.closest('.form-group');
|
|
284
|
+
const formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
|
|
285
|
+
const label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
|
|
286
|
+
const parent = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
|
|
287
|
+
(_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.add('error-state');
|
|
288
|
+
(_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('success-state');
|
|
289
|
+
if (parent.querySelector('span.error-text')) {
|
|
290
|
+
parent.removeChild(parent.querySelector('span.error-text'));
|
|
291
|
+
}
|
|
292
|
+
if (this.__validation.showMessage) {
|
|
293
|
+
const span = document.createElement('span');
|
|
294
|
+
span.innerText = v.message;
|
|
295
|
+
span.classList.add('ax', 'error-text');
|
|
296
|
+
parent.appendChild(span);
|
|
297
|
+
}
|
|
298
|
+
(_f = label) === null || _f === void 0 ? void 0 : _f.classList.add('error-text');
|
|
299
|
+
}
|
|
293
300
|
}
|
|
294
301
|
}
|
|
295
302
|
__decorate([
|
|
@@ -359,7 +366,6 @@ class AXBaseTextComponent extends AXValidatableComponent {
|
|
|
359
366
|
isUserChange: this.userChange
|
|
360
367
|
});
|
|
361
368
|
this.userChange = false;
|
|
362
|
-
debugger;
|
|
363
369
|
this.clearValidationStyle(this.input.nativeElement, v ? false : true);
|
|
364
370
|
this.cdr.detectChanges();
|
|
365
371
|
}
|
|
@@ -3242,7 +3248,7 @@ __decorate([
|
|
|
3242
3248
|
AXCheckBoxComponent = __decorate([
|
|
3243
3249
|
Component({
|
|
3244
3250
|
selector: 'ax-check-box',
|
|
3245
|
-
template: "<!-- <label class=\"ax checkbox {{size}}\" for=\"{{uid}}\" [ngClass]=\"{ 'disabled': disabled, 'readonly': readonly }\"\r\n (click)=\"handleClick($event)\">\r\n {{ label }}\r\n <input #input type=\"checkbox\" id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\"\r\n [disabled]=\"disabled || readonly\" />\r\n <span class=\"checkmark\" [ngClass]=\"{'indeterminate': indeterminate && value == null}\"></span>\r\n\r\n</label> -->\r\n\r\n<label for=\"{{uid}}\" class=\"ax-checkbox-container\" (click)=\"handleClick($event)\">\r\n <input #input type=\"checkbox\" class=\"ax-checkbox\" id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\"
|
|
3251
|
+
template: "<!-- <label class=\"ax checkbox {{size}}\" for=\"{{uid}}\" [ngClass]=\"{ 'disabled': disabled, 'readonly': readonly }\"\r\n (click)=\"handleClick($event)\">\r\n {{ label }}\r\n <input #input type=\"checkbox\" id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\"\r\n [disabled]=\"disabled || readonly\" />\r\n <span class=\"checkmark\" [ngClass]=\"{'indeterminate': indeterminate && value == null}\"></span>\r\n\r\n</label> -->\r\n\r\n<label for=\"{{uid}}\" class=\"ax-checkbox-container\" (click)=\"handleClick($event)\">\r\n <input #input type=\"checkbox\" class=\"ax-checkbox\" [ngClass]=\"{'indeterminate': indeterminate && value == null}\"\r\n id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\" [(ngModel)]=\"value\" [disabled]=\"disabled || readonly\" />\r\n <span>{{ label ? label : ' ' }}</span>\r\n</label>",
|
|
3246
3252
|
encapsulation: ViewEncapsulation.None,
|
|
3247
3253
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
3248
3254
|
}),
|
|
@@ -8180,11 +8186,11 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
|
|
|
8180
8186
|
// this.clearValidationStyle(this.ref.nativeElement);
|
|
8181
8187
|
}
|
|
8182
8188
|
// this.text = '';
|
|
8189
|
+
this.validate();
|
|
8183
8190
|
this.cdr.markForCheck();
|
|
8184
8191
|
}
|
|
8185
8192
|
onFocusTextBox(e) { }
|
|
8186
8193
|
onTextBoxClick(e) {
|
|
8187
|
-
debugger;
|
|
8188
8194
|
if (this.disabled == false && this.readonly == false) {
|
|
8189
8195
|
this.dropdown.open();
|
|
8190
8196
|
}
|
|
@@ -11801,7 +11807,7 @@ __decorate([
|
|
|
11801
11807
|
AXTimePickerComponent = AXTimePickerComponent_1 = __decorate([
|
|
11802
11808
|
Component({
|
|
11803
11809
|
selector: 'ax-time-picker',
|
|
11804
|
-
template: "<div class=\"ax form-item\" [class.disabled]=\"disabled\" [attr.id]=\"uid\" #fc>\r\n <div class=\"ax items-wrapper\">\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </div>\r\n <div class=\"content\" #content>\r\n <div class=\"ax form-control input {{size}}\" [class.disabled]=\"disabled\" [class.readonly]=\"readonly\"
|
|
11810
|
+
template: "<div class=\"ax form-item\" [class.disabled]=\"disabled\" [attr.id]=\"uid\" #fc>\r\n <div class=\"ax items-wrapper\">\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </div>\r\n <div class=\"content\" #content>\r\n <div class=\"ax form-control input {{size}}\" [class.disabled]=\"disabled\" [class.readonly]=\"readonly\" [class.icon]=\"icon\">\r\n <input #input type=\"text\" class=\"ax {{size}}\" [textMask]=\"timeType\" [(ngModel)]=\"textValue\" placeholder=\"{{placeholder}}\" [readonly]=\"readonly\" [disabled]=\"disabled\" [ngClass]=\"setTextAlign()\" [class.clear]=\"value && allowClear\" (focus)=\"handleInputFocus()\"\r\n (blur)=\"handleInputBlur($event)\" (keypress)='handleKeyPress($event)' (keyup)=\"handleKeyUp($event)\" (keydown)=\"handleKeyDown($event)\" (click)=\"handleClick($event)\">\r\n <i class=\"{{icon}}\" *ngIf=\"icon\"></i>\r\n </div>\r\n </div>\r\n <div class=\"ax items-wrapper\">\r\n <ax-button *ngIf=\"value && allowClear\" icon=\"far fa-times\" type=\"danger blank\" (click)=\"clear()\" [disabled]=\"disabled\" [tabIndex]=\"-1\"></ax-button>\r\n <ng-content select=\"[end]\">\r\n </ng-content>\r\n </div>\r\n</div>\r\n<!-- [textMask]=\"{mask: mask , showMask:showMask , guid: maskGuid , keepCharPositions: maskKeepCharPositions}\" -->\r\n<!-- <input #input id=\"timePickerValue\" [textMask]=\"timeType\" type=\"text\" [(ngModel)]=\"value\" (keypress)='handleKeyPress($event)'\r\n (keyup)=\"handleKeyUp($event)\" (keydown)=\"handleKeyDown($event)\" (click)=\"handleClick($event)\"> -->",
|
|
11805
11811
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11806
11812
|
host: { style: 'display: contents;' },
|
|
11807
11813
|
providers: [{ provide: AXValidatableComponent, useExisting: AXTimePickerComponent_1 }]
|