cloud-ide-element 1.0.20 → 1.0.22

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.
@@ -649,6 +649,12 @@ class CideInputComponent {
649
649
  return value; // Already in correct format
650
650
  }
651
651
  }
652
+ else if (type === 'url' && typeof value === 'string' && value) {
653
+ // Normalize URL format - ensure it starts with http:// or https://
654
+ if (!value.startsWith('http://') && !value.startsWith('https://')) {
655
+ return `https://${value}`;
656
+ }
657
+ }
652
658
  return value;
653
659
  }
654
660
  /** @description for capitalization */
@@ -664,6 +670,10 @@ class CideInputComponent {
664
670
  return this.capitalizePipe?.transform(value, "sentenceCase");
665
671
  }
666
672
  }
673
+ else if (type == 'url') {
674
+ // URLs should not be capitalized - return as is
675
+ return value;
676
+ }
667
677
  return value;
668
678
  }
669
679
  /** @description It is used to return the value is valid or not */
@@ -681,6 +691,21 @@ class CideInputComponent {
681
691
  return false;
682
692
  }
683
693
  }
694
+ else if (type == 'url') {
695
+ if (typeof (value) == 'string') {
696
+ if (value?.length > 0) {
697
+ // Validate URL format
698
+ const urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;
699
+ return urlRegex.test(value);
700
+ }
701
+ else {
702
+ return false;
703
+ }
704
+ }
705
+ else {
706
+ return false;
707
+ }
708
+ }
684
709
  else if (type == 'date') {
685
710
  if (typeof (value) == 'string') {
686
711
  if (value?.length > 0) {
@@ -732,6 +757,32 @@ class CideInputComponent {
732
757
  validation_status.validation.required = `required!`;
733
758
  }
734
759
  }
760
+ else if (this.type == 'url') {
761
+ if (typeof (value) == 'string' && value) {
762
+ // URL validation regex
763
+ const urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;
764
+ if (!urlRegex.test(value)) {
765
+ validation_status.status = true;
766
+ validation_status.validation.required = `Please enter a valid URL (e.g., https://example.com)!`;
767
+ }
768
+ if (this.maxlength > 0) {
769
+ if (value?.length > this.maxlength) {
770
+ validation_status.status = true;
771
+ validation_status.validation.maxlength = `maximum length is ${this.maxlength}!`;
772
+ }
773
+ }
774
+ if (this.minlength > 0) {
775
+ if (value?.length < this.minlength) {
776
+ validation_status.status = true;
777
+ validation_status.validation.minlength = `minimum length is ${this.minlength}!`;
778
+ }
779
+ }
780
+ }
781
+ else if (this.required && !value) {
782
+ validation_status.status = true;
783
+ validation_status.validation.required = `URL is required!`;
784
+ }
785
+ }
735
786
  else if (this.type == 'date') {
736
787
  if (typeof (value) == 'string' && value) {
737
788
  // Validate date format and parse
@@ -858,6 +909,12 @@ class CideInputComponent {
858
909
  this.trailingIconInternal = this.trailingIcon || "calendar_today";
859
910
  this.isTrailingIconAllwedClick = true; // Allow clicking calendar icon
860
911
  }
912
+ else if (this.type === 'url') {
913
+ this.typeInternal = "url";
914
+ // Set default link icon if no trailing icon specified
915
+ this.trailingIconInternal = this.trailingIcon || "link";
916
+ this.isTrailingIconAllwedClick = false; // URL type doesn't need clickable trailing icon
917
+ }
861
918
  else {
862
919
  this.typeInternal = this.type;
863
920
  this.trailingIconInternal = this.trailingIcon;
@@ -1559,6 +1616,12 @@ class CideSelectComponent {
1559
1616
  }
1560
1617
  writeValue(value) {
1561
1618
  this.ngModel = value;
1619
+ if (this.searchable) {
1620
+ this.searchChange.emit({
1621
+ query: "",
1622
+ value: value // emit raw value for external handlers
1623
+ });
1624
+ }
1562
1625
  this.validateValue(value);
1563
1626
  }
1564
1627
  registerOnChange(fn) {