cloud-ide-element 1.0.19 → 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) {
@@ -4567,13 +4630,15 @@ class CideEleDropdownComponent {
4567
4630
  }
4568
4631
  closeDropdown() {
4569
4632
  console.log('🔵 closeDropdown called, setting isOpen to false');
4570
- this.isOpen.set(false);
4571
- // Destroy portal if it exists
4572
- if (this.config.usePortal) {
4573
- this.destroyPortalDropdown();
4574
- }
4575
- this.dropdownManager.unregisterDropdown(this.dropdownId);
4576
- this.dropdownToggle.emit(false);
4633
+ setTimeout(() => {
4634
+ this.isOpen.set(false);
4635
+ // Destroy portal if it exists
4636
+ if (this.config.usePortal) {
4637
+ this.destroyPortalDropdown();
4638
+ }
4639
+ this.dropdownManager.unregisterDropdown(this.dropdownId);
4640
+ this.dropdownToggle.emit(false);
4641
+ }, 100);
4577
4642
  }
4578
4643
  getItemClasses(item) {
4579
4644
  const baseClasses = 'tw-flex tw-items-center tw-w-full tw-px-3 tw-py-2 tw-text-sm tw-transition-colors tw-duration-150';
@@ -4601,6 +4666,18 @@ class CideEleDropdownComponent {
4601
4666
  this.currentPosition.set(newPosition);
4602
4667
  }
4603
4668
  }
4669
+ ngOnDestroy() {
4670
+ // Cleanup portal if it exists
4671
+ if (this.config.usePortal) {
4672
+ this.destroyPortalDropdown();
4673
+ }
4674
+ // Close dropdown and unregister
4675
+ if (this.isOpen()) {
4676
+ this.closeDropdown();
4677
+ }
4678
+ // Ensure dropdown is unregistered
4679
+ this.dropdownManager.unregisterDropdown(this.dropdownId);
4680
+ }
4604
4681
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideEleDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4605
4682
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.7", type: CideEleDropdownComponent, isStandalone: true, selector: "cide-ele-dropdown", inputs: { items: "items", config: "config", triggerTemplate: "triggerTemplate", menuTemplate: "menuTemplate" }, outputs: { itemClick: "itemClick", dropdownToggle: "dropdownToggle" }, host: { listeners: { "window:resize": "onWindowResize()", "window:scroll": "onWindowScroll()" } }, viewQueries: [{ propertyName: "dropdownContainer", first: true, predicate: ["dropdownContainer"], descendants: true, isSignal: true }, { propertyName: "dropdownMenu", first: true, predicate: ["dropdownMenu"], descendants: true, isSignal: true }, { propertyName: "dropdownMenuTemplate", first: true, predicate: ["dropdownMenuTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: `
4606
4683
  <div class="tw-relative" #dropdownContainer>