@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
|
@@ -277,6 +277,9 @@ var AXValidatableComponent = /** @class */ (function (_super) {
|
|
|
277
277
|
this.__nativeElement = elementRef.nativeElement;
|
|
278
278
|
this.__valueField = valueField;
|
|
279
279
|
this.__validation = validation;
|
|
280
|
+
var value = this[this.__valueField];
|
|
281
|
+
if ((!Array.isArray(value) && value) || (Array.isArray(value) && value.length > 0))
|
|
282
|
+
this.validate();
|
|
280
283
|
};
|
|
281
284
|
Object.defineProperty(AXValidatableComponent.prototype, "validation", {
|
|
282
285
|
get: function () {
|
|
@@ -287,7 +290,7 @@ var AXValidatableComponent = /** @class */ (function (_super) {
|
|
|
287
290
|
});
|
|
288
291
|
AXValidatableComponent.prototype.validate = function () {
|
|
289
292
|
var _this = this;
|
|
290
|
-
if (this.__validation !== undefined) {
|
|
293
|
+
if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
|
|
291
294
|
var result = this.__validation.validate(this[this.__valueField]);
|
|
292
295
|
result.then(function (c) {
|
|
293
296
|
if (c.result) {
|
|
@@ -306,40 +309,44 @@ var AXValidatableComponent = /** @class */ (function (_super) {
|
|
|
306
309
|
AXValidatableComponent.prototype.clearValidationStyle = function (element, clear) {
|
|
307
310
|
if (clear === void 0) { clear = false; }
|
|
308
311
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
312
|
+
if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
|
|
313
|
+
var formGroup = element.closest('.form-group');
|
|
314
|
+
var formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
|
|
315
|
+
;
|
|
316
|
+
var label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
|
|
317
|
+
var parent_1 = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
|
|
318
|
+
(_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.remove('success-state');
|
|
319
|
+
(_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('error-state');
|
|
320
|
+
//formItem?.classList.remove('required-state');
|
|
321
|
+
if (!clear) {
|
|
322
|
+
(_f = formItem) === null || _f === void 0 ? void 0 : _f.classList.add('success-state');
|
|
323
|
+
}
|
|
324
|
+
(_g = label) === null || _g === void 0 ? void 0 : _g.classList.remove('error-text');
|
|
325
|
+
if (parent_1.querySelector('span.error-text')) {
|
|
326
|
+
parent_1.removeChild(parent_1.querySelector('span.error-text'));
|
|
327
|
+
}
|
|
323
328
|
}
|
|
324
329
|
};
|
|
325
330
|
AXValidatableComponent.prototype.applyValidationStyle = function (element, v) {
|
|
326
331
|
var _a, _b, _c, _d, _e, _f;
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
332
|
+
if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
|
|
333
|
+
var formGroup = element.closest('.form-group');
|
|
334
|
+
var formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
|
|
335
|
+
var label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
|
|
336
|
+
var parent_2 = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
|
|
337
|
+
(_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.add('error-state');
|
|
338
|
+
(_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('success-state');
|
|
339
|
+
if (parent_2.querySelector('span.error-text')) {
|
|
340
|
+
parent_2.removeChild(parent_2.querySelector('span.error-text'));
|
|
341
|
+
}
|
|
342
|
+
if (this.__validation.showMessage) {
|
|
343
|
+
var span = document.createElement('span');
|
|
344
|
+
span.innerText = v.message;
|
|
345
|
+
span.classList.add('ax', 'error-text');
|
|
346
|
+
parent_2.appendChild(span);
|
|
347
|
+
}
|
|
348
|
+
(_f = label) === null || _f === void 0 ? void 0 : _f.classList.add('error-text');
|
|
341
349
|
}
|
|
342
|
-
(_f = label) === null || _f === void 0 ? void 0 : _f.classList.add('error-text');
|
|
343
350
|
};
|
|
344
351
|
__decorate([
|
|
345
352
|
Input(),
|
|
@@ -418,7 +425,6 @@ var AXBaseTextComponent = /** @class */ (function (_super) {
|
|
|
418
425
|
isUserChange: this.userChange
|
|
419
426
|
});
|
|
420
427
|
this.userChange = false;
|
|
421
|
-
debugger;
|
|
422
428
|
this.clearValidationStyle(this.input.nativeElement, v ? false : true);
|
|
423
429
|
this.cdr.detectChanges();
|
|
424
430
|
}
|
|
@@ -3474,7 +3480,7 @@ var AXCheckBoxComponent = /** @class */ (function (_super) {
|
|
|
3474
3480
|
AXCheckBoxComponent = __decorate([
|
|
3475
3481
|
Component({
|
|
3476
3482
|
selector: 'ax-check-box',
|
|
3477
|
-
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\"
|
|
3483
|
+
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>",
|
|
3478
3484
|
encapsulation: ViewEncapsulation.None,
|
|
3479
3485
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
3480
3486
|
}),
|
|
@@ -8710,11 +8716,11 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
|
|
|
8710
8716
|
// this.clearValidationStyle(this.ref.nativeElement);
|
|
8711
8717
|
}
|
|
8712
8718
|
// this.text = '';
|
|
8719
|
+
this.validate();
|
|
8713
8720
|
this.cdr.markForCheck();
|
|
8714
8721
|
};
|
|
8715
8722
|
AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };
|
|
8716
8723
|
AXSelectBoxComponent.prototype.onTextBoxClick = function (e) {
|
|
8717
|
-
debugger;
|
|
8718
8724
|
if (this.disabled == false && this.readonly == false) {
|
|
8719
8725
|
this.dropdown.open();
|
|
8720
8726
|
}
|
|
@@ -12493,7 +12499,7 @@ var AXTimePickerComponent = /** @class */ (function (_super) {
|
|
|
12493
12499
|
AXTimePickerComponent = AXTimePickerComponent_1 = __decorate([
|
|
12494
12500
|
Component({
|
|
12495
12501
|
selector: 'ax-time-picker',
|
|
12496
|
-
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\"
|
|
12502
|
+
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)\"> -->",
|
|
12497
12503
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12498
12504
|
host: { style: 'display: contents;' },
|
|
12499
12505
|
providers: [{ provide: AXValidatableComponent, useExisting: AXTimePickerComponent_1 }]
|