@firestitch/form 12.4.5 → 12.4.7
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.
|
@@ -1370,46 +1370,50 @@
|
|
|
1370
1370
|
}
|
|
1371
1371
|
};
|
|
1372
1372
|
FsControlDirective.prototype.getMessageSelector = function () {
|
|
1373
|
+
var _a;
|
|
1373
1374
|
if (this.messageSelector === false) {
|
|
1374
1375
|
return '';
|
|
1375
1376
|
}
|
|
1376
1377
|
if (this.messageSelector) {
|
|
1377
1378
|
return this.messageSelector;
|
|
1378
1379
|
}
|
|
1379
|
-
else if (this.formDirective
|
|
1380
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
|
|
1380
1381
|
return this.formDirective.messageSelector;
|
|
1381
1382
|
}
|
|
1382
1383
|
};
|
|
1383
1384
|
FsControlDirective.prototype.getHintWrapperSelector = function () {
|
|
1385
|
+
var _a;
|
|
1384
1386
|
if (this.hintSelector === false) {
|
|
1385
1387
|
return '';
|
|
1386
1388
|
}
|
|
1387
1389
|
if (this.hintSelector) {
|
|
1388
1390
|
return this.hintSelector;
|
|
1389
1391
|
}
|
|
1390
|
-
else if (this.formDirective
|
|
1392
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
|
|
1391
1393
|
return this.formDirective.hintSelector;
|
|
1392
1394
|
}
|
|
1393
1395
|
};
|
|
1394
1396
|
FsControlDirective.prototype.getWrapperSelector = function () {
|
|
1397
|
+
var _a;
|
|
1395
1398
|
if (this.wrapperSelector === false) {
|
|
1396
1399
|
return '';
|
|
1397
1400
|
}
|
|
1398
1401
|
if (this.wrapperSelector) {
|
|
1399
1402
|
return this.wrapperSelector;
|
|
1400
1403
|
}
|
|
1401
|
-
else if (this.formDirective
|
|
1404
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.wrapperSelector) {
|
|
1402
1405
|
return this.formDirective.wrapperSelector;
|
|
1403
1406
|
}
|
|
1404
1407
|
};
|
|
1405
1408
|
FsControlDirective.prototype.getlabelSelector = function () {
|
|
1409
|
+
var _a;
|
|
1406
1410
|
if (this.labelSelector === false) {
|
|
1407
1411
|
return '';
|
|
1408
1412
|
}
|
|
1409
1413
|
if (this.labelSelector) {
|
|
1410
1414
|
return this.labelSelector;
|
|
1411
1415
|
}
|
|
1412
|
-
else if (this.formDirective
|
|
1416
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.labelSelector) {
|
|
1413
1417
|
return this.formDirective.labelSelector;
|
|
1414
1418
|
}
|
|
1415
1419
|
};
|
|
@@ -1430,11 +1434,19 @@
|
|
|
1430
1434
|
</mat-form-field>
|
|
1431
1435
|
*/
|
|
1432
1436
|
FsControlDirective.prototype.render = function () {
|
|
1433
|
-
var _a;
|
|
1437
|
+
var _a, _b;
|
|
1434
1438
|
if (this.ngControl) {
|
|
1435
1439
|
var renderer = this.renderer2;
|
|
1436
1440
|
var wrapper = this.getWrapperElement();
|
|
1437
1441
|
var error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
|
|
1442
|
+
var shouldErrorBeRendered = this.ngControl.invalid
|
|
1443
|
+
&& (this.ngControl.dirty || ((_b = (_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.ngForm) === null || _b === void 0 ? void 0 : _b.submitted));
|
|
1444
|
+
if (shouldErrorBeRendered && error) {
|
|
1445
|
+
wrapper.classList.add('ng-invalid', 'ng-dirty');
|
|
1446
|
+
}
|
|
1447
|
+
else {
|
|
1448
|
+
wrapper.classList.remove('ng-invalid');
|
|
1449
|
+
}
|
|
1438
1450
|
if (!this.getMessageSelector()) {
|
|
1439
1451
|
return;
|
|
1440
1452
|
}
|
|
@@ -1466,13 +1478,9 @@
|
|
|
1466
1478
|
if (errorWrapper) {
|
|
1467
1479
|
errorWrapper.remove();
|
|
1468
1480
|
}
|
|
1469
|
-
wrapper.classList.remove('ng-invalid');
|
|
1470
|
-
var shouldErrorBeRendered = this.ngControl.invalid
|
|
1471
|
-
&& (this.ngControl.dirty || ((_a = this.formDirective.ngForm) === null || _a === void 0 ? void 0 : _a.submitted));
|
|
1472
1481
|
if (!shouldErrorBeRendered || !error) {
|
|
1473
1482
|
return;
|
|
1474
1483
|
}
|
|
1475
|
-
wrapper.classList.add('ng-invalid', 'ng-dirty');
|
|
1476
1484
|
errorWrapper = renderer.createElement('div');
|
|
1477
1485
|
renderer.addClass(errorWrapper, 'fs-form-error-target');
|
|
1478
1486
|
renderer.addClass(errorWrapper, this.appendErrorClass);
|