@ship-ui/core 0.13.17 → 0.13.19

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.
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { inject, ElementRef, Renderer2, ChangeDetectionStrategy, Component, input, computed, viewChild, effect, HostListener, NgModule, signal, Injectable, InjectionToken, model, output, ApplicationRef, createComponent, isSignal, OutputEmitterRef, contentChildren, afterNextRender, assertInInjectionContext, Injector, DestroyRef, HostBinding, contentChild, TemplateRef, runInInjectionContext, Directive, ChangeDetectorRef, viewChildren, ViewContainerRef, EnvironmentInjector } from '@angular/core';
3
3
  import { DatePipe, NgTemplateOutlet } from '@angular/common';
4
4
  import { SIGNAL } from '@angular/core/primitives/signals';
5
+ import { ShipDividerComponent as ShipDividerComponent$1 } from 'ship-ui';
5
6
 
6
7
  const iconTypes = ['bold', 'thin', 'light', 'fill'];
7
8
  class ShipIconComponent {
@@ -3015,6 +3016,9 @@ class ShipSelectComponent {
3015
3016
  this.value = input();
3016
3017
  this.label = input();
3017
3018
  this.asFreeText = input(false);
3019
+ this.optionTitle = input(null);
3020
+ this.freeTextTitle = input(null);
3021
+ this.freeTextPlaceholder = input('Type to create a new option');
3018
3022
  this.validateFreeText = input();
3019
3023
  this.placeholder = input();
3020
3024
  this.readonly = model(false);
@@ -3033,6 +3037,7 @@ class ShipSelectComponent {
3033
3037
  this.options = model([]);
3034
3038
  this.selectedOptions = model([]);
3035
3039
  this.cleared = output();
3040
+ this.onAddNewFreeTextOption = output();
3036
3041
  this.computedFreeTextOption = computed(() => {
3037
3042
  const inputValue = this.inputValue();
3038
3043
  const valueKey = this.value();
@@ -3187,7 +3192,7 @@ class ShipSelectComponent {
3187
3192
  e.preventDefault();
3188
3193
  this.close();
3189
3194
  }
3190
- if (e.key === 'Enter' || e.key === ' ') {
3195
+ if (e.key === 'Enter') {
3191
3196
  e.preventDefault();
3192
3197
  this.toggleOptionByIndex(this.focusedOptionIndex());
3193
3198
  }
@@ -3399,6 +3404,7 @@ class ShipSelectComponent {
3399
3404
  const index = options.findIndex((option) => this.getValue(option) === newOptionValue);
3400
3405
  if (index > -1)
3401
3406
  return options;
3407
+ this.onAddNewFreeTextOption.emit(newOptionValue);
3402
3408
  return [newOption, ...options];
3403
3409
  });
3404
3410
  optionIndex = 0;
@@ -3570,7 +3576,7 @@ class ShipSelectComponent {
3570
3576
  }
3571
3577
  }
3572
3578
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ShipSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3573
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: ShipSelectComponent, isStandalone: true, selector: "sh-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, asFreeText: { classPropertyName: "asFreeText", publicName: "asFreeText", isSignal: true, isRequired: false, transformFunction: null }, validateFreeText: { classPropertyName: "validateFreeText", publicName: "validateFreeText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, lazySearch: { classPropertyName: "lazySearch", publicName: "lazySearch", isSignal: true, isRequired: false, transformFunction: null }, inlineSearch: { classPropertyName: "inlineSearch", publicName: "inlineSearch", isSignal: true, isRequired: false, transformFunction: null }, asText: { classPropertyName: "asText", publicName: "asText", isSignal: true, isRequired: false, transformFunction: null }, isClearable: { classPropertyName: "isClearable", publicName: "isClearable", isSignal: true, isRequired: false, transformFunction: null }, selectMultiple: { classPropertyName: "selectMultiple", publicName: "selectMultiple", isSignal: true, isRequired: false, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, selectedOptionTemplate: { classPropertyName: "selectedOptionTemplate", publicName: "selectedOptionTemplate", isSignal: true, isRequired: false, transformFunction: null }, placeholderTemplate: { classPropertyName: "placeholderTemplate", publicName: "placeholderTemplate", isSignal: true, isRequired: false, transformFunction: null }, freeTextOptionTemplate: { classPropertyName: "freeTextOptionTemplate", publicName: "freeTextOptionTemplate", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, selectedOptions: { classPropertyName: "selectedOptions", publicName: "selectedOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { readonly: "readonlyChange", disabled: "disabledChange", isOpen: "isOpenChange", isLoading: "isLoadingChange", options: "optionsChange", selectedOptions: "selectedOptionsChange", cleared: "cleared" }, host: { properties: { "class.multiple": "selectMultiple()" } }, queries: [{ propertyName: "inlineTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "optionsWrapRef", first: true, predicate: ["optionsWrap"], descendants: true, isSignal: true }], ngImport: i0, template: `
3579
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: ShipSelectComponent, isStandalone: true, selector: "sh-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, asFreeText: { classPropertyName: "asFreeText", publicName: "asFreeText", isSignal: true, isRequired: false, transformFunction: null }, optionTitle: { classPropertyName: "optionTitle", publicName: "optionTitle", isSignal: true, isRequired: false, transformFunction: null }, freeTextTitle: { classPropertyName: "freeTextTitle", publicName: "freeTextTitle", isSignal: true, isRequired: false, transformFunction: null }, freeTextPlaceholder: { classPropertyName: "freeTextPlaceholder", publicName: "freeTextPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, validateFreeText: { classPropertyName: "validateFreeText", publicName: "validateFreeText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, lazySearch: { classPropertyName: "lazySearch", publicName: "lazySearch", isSignal: true, isRequired: false, transformFunction: null }, inlineSearch: { classPropertyName: "inlineSearch", publicName: "inlineSearch", isSignal: true, isRequired: false, transformFunction: null }, asText: { classPropertyName: "asText", publicName: "asText", isSignal: true, isRequired: false, transformFunction: null }, isClearable: { classPropertyName: "isClearable", publicName: "isClearable", isSignal: true, isRequired: false, transformFunction: null }, selectMultiple: { classPropertyName: "selectMultiple", publicName: "selectMultiple", isSignal: true, isRequired: false, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, selectedOptionTemplate: { classPropertyName: "selectedOptionTemplate", publicName: "selectedOptionTemplate", isSignal: true, isRequired: false, transformFunction: null }, placeholderTemplate: { classPropertyName: "placeholderTemplate", publicName: "placeholderTemplate", isSignal: true, isRequired: false, transformFunction: null }, freeTextOptionTemplate: { classPropertyName: "freeTextOptionTemplate", publicName: "freeTextOptionTemplate", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, selectedOptions: { classPropertyName: "selectedOptions", publicName: "selectedOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { readonly: "readonlyChange", disabled: "disabledChange", isOpen: "isOpenChange", isLoading: "isLoadingChange", options: "optionsChange", selectedOptions: "selectedOptionsChange", cleared: "cleared", onAddNewFreeTextOption: "onAddNewFreeTextOption" }, host: { properties: { "class.multiple": "selectMultiple()" } }, queries: [{ propertyName: "inlineTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "optionsWrapRef", first: true, predicate: ["optionsWrap"], descendants: true, isSignal: true }], ngImport: i0, template: `
3574
3580
  @let _placeholderTemplate = placeholderTemplate();
3575
3581
  @let _optionTemplate = optionTemplate();
3576
3582
  @let _freeTextOptionTemplate = freeTextOptionTemplate();
@@ -3670,6 +3676,10 @@ class ShipSelectComponent {
3670
3676
  @let freeTextOptionValue = getValue(freeTextOption);
3671
3677
 
3672
3678
  @if ($any(freeTextOptionValue).length > 0) {
3679
+ @if (freeTextTitle()) {
3680
+ <p title>{{ freeTextTitle() }}</p>
3681
+ }
3682
+
3673
3683
  <li
3674
3684
  (click)="toggleOptionByIndex(-1)"
3675
3685
  class="option"
@@ -3687,9 +3697,17 @@ class ShipSelectComponent {
3687
3697
  {{ freeTextOptionValue }}
3688
3698
  }
3689
3699
  </li>
3700
+
3701
+ @if (freeTextTitle() && filteredOptions().length > 0) {
3702
+ <sh-divider />
3703
+ }
3690
3704
  }
3691
3705
  }
3692
3706
 
3707
+ @if (optionTitle() && filteredOptions().length > 0) {
3708
+ <p title>{{ optionTitle() }}</p>
3709
+ }
3710
+
3693
3711
  @for (option of filteredOptions(); track $index) {
3694
3712
  <li
3695
3713
  (click)="toggleOptionByIndex($index)"
@@ -3711,7 +3729,7 @@ class ShipSelectComponent {
3711
3729
  }
3712
3730
  </div>
3713
3731
  </sh-popover>
3714
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ShipPopoverComponent, selector: "sh-popover", inputs: ["asMultiLayer", "disableOpenByClick", "isOpen", "options"], outputs: ["isOpenChange", "closed"] }, { kind: "component", type: ShipFormFieldComponent, selector: "sh-form-field" }, { kind: "component", type: ShipIconComponent, selector: "sh-icon" }, { kind: "component", type: ShipCheckboxComponent, selector: "sh-checkbox" }, { kind: "component", type: ShipSpinnerComponent, selector: "sh-spinner" }, { kind: "component", type: ShipChipComponent, selector: "sh-chip" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3732
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ShipPopoverComponent, selector: "sh-popover", inputs: ["asMultiLayer", "disableOpenByClick", "isOpen", "options"], outputs: ["isOpenChange", "closed"] }, { kind: "component", type: ShipFormFieldComponent, selector: "sh-form-field" }, { kind: "component", type: ShipIconComponent, selector: "sh-icon" }, { kind: "component", type: ShipCheckboxComponent, selector: "sh-checkbox" }, { kind: "component", type: ShipSpinnerComponent, selector: "sh-spinner" }, { kind: "component", type: ShipChipComponent, selector: "sh-chip" }, { kind: "component", type: ShipDividerComponent$1, selector: "sh-divider" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3715
3733
  }
3716
3734
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ShipSelectComponent, decorators: [{
3717
3735
  type: Component,
@@ -3725,6 +3743,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
3725
3743
  ShipCheckboxComponent,
3726
3744
  ShipSpinnerComponent,
3727
3745
  ShipChipComponent,
3746
+ ShipDividerComponent$1,
3728
3747
  ],
3729
3748
  template: `
3730
3749
  @let _placeholderTemplate = placeholderTemplate();
@@ -3826,6 +3845,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
3826
3845
  @let freeTextOptionValue = getValue(freeTextOption);
3827
3846
 
3828
3847
  @if ($any(freeTextOptionValue).length > 0) {
3848
+ @if (freeTextTitle()) {
3849
+ <p title>{{ freeTextTitle() }}</p>
3850
+ }
3851
+
3829
3852
  <li
3830
3853
  (click)="toggleOptionByIndex(-1)"
3831
3854
  class="option"
@@ -3843,9 +3866,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
3843
3866
  {{ freeTextOptionValue }}
3844
3867
  }
3845
3868
  </li>
3869
+
3870
+ @if (freeTextTitle() && filteredOptions().length > 0) {
3871
+ <sh-divider />
3872
+ }
3846
3873
  }
3847
3874
  }
3848
3875
 
3876
+ @if (optionTitle() && filteredOptions().length > 0) {
3877
+ <p title>{{ optionTitle() }}</p>
3878
+ }
3879
+
3849
3880
  @for (option of filteredOptions(); track $index) {
3850
3881
  <li
3851
3882
  (click)="toggleOptionByIndex($index)"