onshore-forms 1.1.11 → 1.1.12

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.
@@ -367,6 +367,7 @@ class OnshoreFormItemContainer {
367
367
  formContainer;
368
368
  disabled = false;
369
369
  tempLockValue;
370
+ initialFormTemplate = undefined;
370
371
  OnshoreFormTemplateLayout = OnshoreFormTemplateLayout;
371
372
  layout = OnshoreFormTemplateLayout.auto;
372
373
  enabled(enable = true) {
@@ -503,6 +504,7 @@ class OnshoreFormAutocompleteItemComponent {
503
504
  onSelect = new EventEmitter();
504
505
  actionButtonClick = new EventEmitter();
505
506
  disabled = false;
507
+ initialFormTemplate = undefined;
506
508
  searchPrepare(term) {
507
509
  if (term.query != '') {
508
510
  this.search(term.query);
@@ -564,10 +566,14 @@ class OnshoreFormAutocompleteItemComponent {
564
566
  checkExclude() {
565
567
  setTimeout(() => {
566
568
  if (this.exclude) {
567
- this.ngControl.control?.disable();
569
+ if (this.initialFormTemplate === undefined)
570
+ this.initialFormTemplate = this.formTemplate;
571
+ this.ngControl.control?.clearValidators();
568
572
  }
569
573
  else {
570
- this.ngControl.control?.enable();
574
+ if (this.initialFormTemplate !== undefined) {
575
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
576
+ }
571
577
  }
572
578
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
573
579
  this.cdr.markForCheck();
@@ -637,6 +643,7 @@ class OnshoreFormCheckboxItemComponent {
637
643
  exclude = false;
638
644
  actionButtonClick = new EventEmitter();
639
645
  disabled = false;
646
+ initialFormTemplate = undefined;
640
647
  // ControlValueAccessor interface
641
648
  writeValue(obj) { }
642
649
  registerOnChange(fn) { }
@@ -659,10 +666,14 @@ class OnshoreFormCheckboxItemComponent {
659
666
  checkExclude() {
660
667
  setTimeout(() => {
661
668
  if (this.exclude) {
662
- this.ngControl.control?.disable();
669
+ if (this.initialFormTemplate === undefined)
670
+ this.initialFormTemplate = this.formTemplate;
671
+ this.ngControl.control?.clearValidators();
663
672
  }
664
673
  else {
665
- this.ngControl.control?.enable();
674
+ if (this.initialFormTemplate !== undefined) {
675
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
676
+ }
666
677
  }
667
678
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
668
679
  this.cdr.markForCheck();
@@ -714,6 +725,7 @@ class OnshoreFormColorpickerItemComponent {
714
725
  actionButtonClick = new EventEmitter();
715
726
  disabled = false;
716
727
  colorPickerValue = '';
728
+ initialFormTemplate = undefined;
717
729
  // ControlValueAccessor interface
718
730
  writeValue(obj) { }
719
731
  registerOnChange(fn) { }
@@ -757,10 +769,14 @@ class OnshoreFormColorpickerItemComponent {
757
769
  checkExclude() {
758
770
  setTimeout(() => {
759
771
  if (this.exclude) {
760
- this.ngControl.control?.disable();
772
+ if (this.initialFormTemplate === undefined)
773
+ this.initialFormTemplate = this.formTemplate;
774
+ this.ngControl.control?.clearValidators();
761
775
  }
762
776
  else {
763
- this.ngControl.control?.enable();
777
+ if (this.initialFormTemplate !== undefined) {
778
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
779
+ }
764
780
  }
765
781
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
766
782
  this.cdr.markForCheck();
@@ -853,6 +869,7 @@ class OnshoreFormDropdownItemComponent {
853
869
  actionButtonClick = new EventEmitter();
854
870
  entryCreated = new EventEmitter();
855
871
  disabled = false;
872
+ initialFormTemplate = undefined;
856
873
  // ControlValueAccessor interface
857
874
  writeValue(obj) {
858
875
  if (obj) {
@@ -899,10 +916,14 @@ class OnshoreFormDropdownItemComponent {
899
916
  checkExclude() {
900
917
  setTimeout(() => {
901
918
  if (this.exclude) {
902
- this.ngControl.control?.disable();
919
+ if (this.initialFormTemplate === undefined)
920
+ this.initialFormTemplate = this.formTemplate;
921
+ this.ngControl.control?.clearValidators();
903
922
  }
904
923
  else {
905
- this.ngControl.control?.enable();
924
+ if (this.initialFormTemplate !== undefined) {
925
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
926
+ }
906
927
  }
907
928
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
908
929
  this.cdr.markForCheck();
@@ -1218,6 +1239,7 @@ class OnshoreFormImageItemComponent {
1218
1239
  webcamDialogVisible = false;
1219
1240
  imageChooserDialogVisible = false;
1220
1241
  subscriptions = [];
1242
+ initialFormTemplate = undefined;
1221
1243
  getFileImage(image) {
1222
1244
  this.imageChooserDialogVisible = false;
1223
1245
  if (image) {
@@ -1295,10 +1317,14 @@ class OnshoreFormImageItemComponent {
1295
1317
  checkExclude() {
1296
1318
  setTimeout(() => {
1297
1319
  if (this.exclude) {
1298
- this.ngControl.control?.disable();
1320
+ if (this.initialFormTemplate === undefined)
1321
+ this.initialFormTemplate = this.formTemplate;
1322
+ this.ngControl.control?.clearValidators();
1299
1323
  }
1300
1324
  else {
1301
- this.ngControl.control?.enable();
1325
+ if (this.initialFormTemplate !== undefined) {
1326
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
1327
+ }
1302
1328
  }
1303
1329
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
1304
1330
  this.cdr.markForCheck();
@@ -1374,6 +1400,7 @@ class OnshoreFormInputItemComponent {
1374
1400
  OnshoreFormTemplateType = OnshoreFormTemplateType;
1375
1401
  passwordVisible = false;
1376
1402
  disabled = false;
1403
+ initialFormTemplate = undefined;
1377
1404
  // ControlValueAccessor interface
1378
1405
  writeValue(obj) { }
1379
1406
  registerOnChange(fn) { }
@@ -1399,10 +1426,14 @@ class OnshoreFormInputItemComponent {
1399
1426
  checkExclude() {
1400
1427
  setTimeout(() => {
1401
1428
  if (this.exclude) {
1402
- this.ngControl.control?.disable();
1429
+ if (this.initialFormTemplate === undefined)
1430
+ this.initialFormTemplate = this.formTemplate;
1431
+ this.ngControl.control?.clearValidators();
1403
1432
  }
1404
1433
  else {
1405
- this.ngControl.control?.enable();
1434
+ if (this.initialFormTemplate !== undefined) {
1435
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
1436
+ }
1406
1437
  }
1407
1438
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
1408
1439
  this.cdr.markForCheck();
@@ -1472,6 +1503,7 @@ class OnshoreFormSwitchItemComponent {
1472
1503
  valueChange = new EventEmitter();
1473
1504
  actionButtonClick = new EventEmitter();
1474
1505
  disabled = false;
1506
+ initialFormTemplate = undefined;
1475
1507
  // ControlValueAccessor interface
1476
1508
  writeValue(obj) { }
1477
1509
  registerOnChange(fn) { }
@@ -1494,10 +1526,14 @@ class OnshoreFormSwitchItemComponent {
1494
1526
  checkExclude() {
1495
1527
  setTimeout(() => {
1496
1528
  if (this.exclude) {
1497
- this.ngControl.control?.disable();
1529
+ if (this.initialFormTemplate === undefined)
1530
+ this.initialFormTemplate = this.formTemplate;
1531
+ this.ngControl.control?.clearValidators();
1498
1532
  }
1499
1533
  else {
1500
- this.ngControl.control?.enable();
1534
+ if (this.initialFormTemplate !== undefined) {
1535
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
1536
+ }
1501
1537
  }
1502
1538
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
1503
1539
  this.cdr.markForCheck();
@@ -1554,6 +1590,7 @@ class OnshoreFormDatetimeItemComponent {
1554
1590
  dataType = 'date';
1555
1591
  OnshoreFormTemplateType = OnshoreFormTemplateType;
1556
1592
  disabled = false;
1593
+ initialFormTemplate = undefined;
1557
1594
  // ControlValueAccessor interface
1558
1595
  writeValue(obj) { }
1559
1596
  registerOnChange(fn) { }
@@ -1573,10 +1610,14 @@ class OnshoreFormDatetimeItemComponent {
1573
1610
  checkExclude() {
1574
1611
  setTimeout(() => {
1575
1612
  if (this.exclude) {
1576
- this.ngControl.control?.disable();
1613
+ if (this.initialFormTemplate === undefined)
1614
+ this.initialFormTemplate = this.formTemplate;
1615
+ this.ngControl.control?.clearValidators();
1577
1616
  }
1578
1617
  else {
1579
- this.ngControl.control?.enable();
1618
+ if (this.initialFormTemplate !== undefined) {
1619
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
1620
+ }
1580
1621
  }
1581
1622
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
1582
1623
  this.cdr.markForCheck();
@@ -1636,6 +1677,7 @@ class OnshoreFormSortItemComponent {
1636
1677
  tempLockValue = [];
1637
1678
  OnshoreFormTemplateType = OnshoreFormTemplateType;
1638
1679
  disabled = false;
1680
+ initialFormTemplate = undefined;
1639
1681
  sortItemsChanged(event) {
1640
1682
  this.sortItems = event;
1641
1683
  this.ngControl?.control?.setValue(event);
@@ -1684,10 +1726,14 @@ class OnshoreFormSortItemComponent {
1684
1726
  checkExclude() {
1685
1727
  setTimeout(() => {
1686
1728
  if (this.exclude) {
1687
- this.ngControl.control?.disable();
1729
+ if (this.initialFormTemplate === undefined)
1730
+ this.initialFormTemplate = this.formTemplate;
1731
+ this.ngControl.control?.clearValidators();
1688
1732
  }
1689
1733
  else {
1690
- this.ngControl.control?.enable();
1734
+ if (this.initialFormTemplate !== undefined) {
1735
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
1736
+ }
1691
1737
  }
1692
1738
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
1693
1739
  this.cdr.markForCheck();
@@ -1748,6 +1794,7 @@ class OnshoreFormScannerItemComponent {
1748
1794
  webcamClick = new EventEmitter();
1749
1795
  scannerClick = new EventEmitter();
1750
1796
  disabled = false;
1797
+ initialFormTemplate = undefined;
1751
1798
  // ControlValueAccessor interface
1752
1799
  writeValue(obj) { }
1753
1800
  registerOnChange(fn) { }
@@ -1773,10 +1820,14 @@ class OnshoreFormScannerItemComponent {
1773
1820
  checkExclude() {
1774
1821
  setTimeout(() => {
1775
1822
  if (this.exclude) {
1776
- this.ngControl.control?.disable();
1823
+ if (this.initialFormTemplate === undefined)
1824
+ this.initialFormTemplate = this.formTemplate;
1825
+ this.ngControl.control?.clearValidators();
1777
1826
  }
1778
1827
  else {
1779
- this.ngControl.control?.enable();
1828
+ if (this.initialFormTemplate !== undefined) {
1829
+ this.ngControl.control?.setValidators(this.initialFormTemplate.validators);
1830
+ }
1780
1831
  }
1781
1832
  this.ngControl.control?.updateValueAndValidity({ onlySelf: false, emitEvent: true });
1782
1833
  this.cdr.markForCheck();