@db-ux/ngx-core-components 3.1.3 → 3.1.15

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.
@@ -113,7 +113,7 @@ export declare class DBCustomSelect implements AfterViewInit, ControlValueAccess
113
113
  getSelectAllLabel(): string;
114
114
  getOptionLabel(option: CustomSelectOptionType): string;
115
115
  getOptionChecked(value?: string): boolean | undefined;
116
- getTagRemoveLabel(index: number): string;
116
+ getTagRemoveLabel(option: CustomSelectOptionType): string;
117
117
  handleTagRemove(option: CustomSelectOptionType, event?: ClickEvent<HTMLButtonElement> | void): void;
118
118
  handleAutoPlacement(): void;
119
119
  handleArrowDownUp(event: any): void;
@@ -194,7 +194,7 @@ export type DBCustomSelectDefaultState = {
194
194
  getNativeSelectValue: () => string;
195
195
  getOptionLabel: (option: CustomSelectOptionType) => string;
196
196
  getOptionChecked: (value?: string) => boolean;
197
- getTagRemoveLabel: (index: number) => string;
197
+ getTagRemoveLabel: (option: CustomSelectOptionType) => string;
198
198
  selectAllEnabled: boolean;
199
199
  searchEnabled: boolean;
200
200
  amountOptions: number;
@@ -26,7 +26,6 @@ export declare class DBSwitch implements AfterViewInit, ControlValueAccessor {
26
26
  icon: InputSignal<DBSwitchProps["icon"]>;
27
27
  iconTrailing: InputSignal<DBSwitchProps["iconTrailing"]>;
28
28
  label: InputSignal<DBSwitchProps["label"]>;
29
- change: import("@angular/core").OutputEmitterRef<void | Event>;
30
29
  blur: import("@angular/core").OutputEmitterRef<void | FocusEvent>;
31
30
  focus: import("@angular/core").OutputEmitterRef<void | FocusEvent>;
32
31
  _ref: import("@angular/core").Signal<ElementRef<any> | undefined>;
@@ -48,5 +47,5 @@ export declare class DBSwitch implements AfterViewInit, ControlValueAccessor {
48
47
  setDisabledState(disabled: boolean): void;
49
48
  ngAfterViewInit(): void;
50
49
  static ɵfac: i0.ɵɵFactoryDeclaration<DBSwitch, never>;
51
- static ɵcmp: i0.ɵɵComponentDeclaration<DBSwitch, "db-switch", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "visualAid": { "alias": "visualAid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "showLabel": { "alias": "showLabel"; "required": false; "isSignal": true; }; "emphasis": { "alias": "emphasis"; "required": false; "isSignal": true; }; "showRequiredAsterisk": { "alias": "showRequiredAsterisk"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "validation": { "alias": "validation"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "iconLeading": { "alias": "iconLeading"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "iconTrailing": { "alias": "iconTrailing"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "disabled": "disabledChange"; "change": "change"; "blur": "blur"; "focus": "focus"; }, never, ["*"], true, never>;
50
+ static ɵcmp: i0.ɵɵComponentDeclaration<DBSwitch, "db-switch", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "visualAid": { "alias": "visualAid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "showLabel": { "alias": "showLabel"; "required": false; "isSignal": true; }; "emphasis": { "alias": "emphasis"; "required": false; "isSignal": true; }; "showRequiredAsterisk": { "alias": "showRequiredAsterisk"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "validation": { "alias": "validation"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "iconLeading": { "alias": "iconLeading"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "iconTrailing": { "alias": "iconTrailing"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "disabled": "disabledChange"; "blur": "blur"; "focus": "focus"; }, never, ["*"], true, never>;
52
51
  }
@@ -962,9 +962,7 @@ const CardElevationLevelList = ['1', '2', '3'];
962
962
 
963
963
  /* eslint-disable @typescript-eslint/no-explicit-any */
964
964
  const handleFrameworkEventAngular = (component, event, modelValue = 'value') => {
965
- // Change event to work with reactive and template driven forms
966
965
  component.propagateChange(event.target[modelValue]);
967
- component.writeValue(event.target[modelValue]);
968
966
  };
969
967
  const handleFrameworkEventVue = (emit, event, modelValue = 'value') => {
970
968
  // TODO: Replace this with the solution out of https://github.com/BuilderIO/mitosis/issues/833 after this has been "solved"
@@ -2544,7 +2542,10 @@ class DBTooltip {
2544
2542
  if (this._ref()?.nativeElement) {
2545
2543
  // This is a workaround for angular
2546
2544
  delay(() => {
2547
- handleFixedPopover(this._ref()?.nativeElement, parent, this.placement() ?? "bottom");
2545
+ // Due to race conditions we need to check for _ref again
2546
+ if (this._ref()?.nativeElement) {
2547
+ handleFixedPopover(this._ref()?.nativeElement, parent, this.placement() ?? "bottom");
2548
+ }
2548
2549
  }, 1);
2549
2550
  }
2550
2551
  }
@@ -2940,15 +2941,18 @@ class DBCustomSelect {
2940
2941
  }
2941
2942
  return false;
2942
2943
  }
2943
- getTagRemoveLabel(index) {
2944
- if (this.removeTagsTexts() && this.removeTagsTexts().length > index) {
2945
- return this.removeTagsTexts().at(index);
2946
- }
2947
- else {
2948
- return `${DEFAULT_REMOVE} ${this._selectedOptions()
2949
- ? this.getOptionLabel(this._selectedOptions()[index])
2950
- : ""}`;
2944
+ getTagRemoveLabel(option) {
2945
+ const removeTexts = this.removeTagsTexts();
2946
+ const options = this.options();
2947
+ if (removeTexts && options) {
2948
+ // Find the index of the option in the original options array
2949
+ const optionIndex = options.findIndex((opt) => opt.value === option.value);
2950
+ if (optionIndex >= 0 && optionIndex < removeTexts.length) {
2951
+ return removeTexts[optionIndex];
2952
+ }
2951
2953
  }
2954
+ // Fallback to default behavior
2955
+ return `${DEFAULT_REMOVE} ${this.getOptionLabel(option)}`;
2952
2956
  }
2953
2957
  handleTagRemove(option, event) {
2954
2958
  if (event) {
@@ -3419,10 +3423,14 @@ class DBCustomSelect {
3419
3423
  // --- Mitosis: Workaround to make sure the effect() is triggered ---
3420
3424
  this.values();
3421
3425
  // ---
3422
- if (this.values() &&
3423
- Array.isArray(this.values()) &&
3424
- this.values() !== this._values()) {
3425
- this._values.set(this.values() ?? []);
3426
+ const v = this.values();
3427
+ if (Array.isArray(v)) {
3428
+ if (this._values() !== v) {
3429
+ this._values.set(v);
3430
+ }
3431
+ }
3432
+ else if (v == null && this._values()?.length !== 0) {
3433
+ this._values.set([]);
3426
3434
  }
3427
3435
  }, {
3428
3436
  // Enable writing to signals inside effects
@@ -3721,7 +3729,7 @@ class DBCustomSelect {
3721
3729
  <db-tag
3722
3730
  emphasis="strong"
3723
3731
  behavior="removable"
3724
- [removeButton]="getTagRemoveLabel(index)"
3732
+ [removeButton]="getTagRemoveLabel(option)"
3725
3733
  (remove)="handleTagRemove(option, $event)"
3726
3734
  >{{getOptionLabel(option)}}</db-tag
3727
3735
  >
@@ -3828,6 +3836,7 @@ class DBCustomSelect {
3828
3836
  >
3829
3837
  }
3830
3838
  <span
3839
+ class="db-custom-select-placeholder"
3831
3840
  [attr.aria-hidden]="getBooleanAsString(true)"
3832
3841
  [attr.id]="_placeholderId()"
3833
3842
  >{{placeholder() ?? label()}}</span
@@ -3942,7 +3951,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
3942
3951
  <db-tag
3943
3952
  emphasis="strong"
3944
3953
  behavior="removable"
3945
- [removeButton]="getTagRemoveLabel(index)"
3954
+ [removeButton]="getTagRemoveLabel(option)"
3946
3955
  (remove)="handleTagRemove(option, $event)"
3947
3956
  >{{getOptionLabel(option)}}</db-tag
3948
3957
  >
@@ -4049,6 +4058,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
4049
4058
  >
4050
4059
  }
4051
4060
  <span
4061
+ class="db-custom-select-placeholder"
4052
4062
  [attr.aria-hidden]="getBooleanAsString(true)"
4053
4063
  [attr.id]="_placeholderId()"
4054
4064
  >{{placeholder() ?? label()}}</span
@@ -6314,7 +6324,6 @@ class DBSelect {
6314
6324
  this.disabled.set(disabled);
6315
6325
  }
6316
6326
  ngAfterViewInit() {
6317
- this.writeValue(this.value() ?? "");
6318
6327
  if (typeof window !== "undefined") {
6319
6328
  const element = this._ref()?.nativeElement;
6320
6329
  this.enableAttributePassing(element, "db-select");
@@ -6326,6 +6335,8 @@ class DBSelect {
6326
6335
  this._invalidMessageId.set(mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX);
6327
6336
  this._placeholderId.set(mId + DEFAULT_PLACEHOLDER_ID_SUFFIX);
6328
6337
  this._invalidMessage.set(this.invalidMessage() || DEFAULT_INVALID_MESSAGE);
6338
+ // @ts-ignore
6339
+ this.writeValue?.(this.value?.() ?? "");
6329
6340
  }
6330
6341
  }
6331
6342
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DBSelect, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
@@ -6394,7 +6405,11 @@ class DBSelect {
6394
6405
  }
6395
6406
  </select>
6396
6407
  @if(placeholder()){
6397
- <span [attr.id]="_placeholderId()">{{placeholder()}}</span>
6408
+ <span
6409
+ class="db-select-placeholder"
6410
+ [attr.id]="_placeholderId()"
6411
+ >{{placeholder()}}</span
6412
+ >
6398
6413
  } @if(stringPropVisible(message(), showMessage())){
6399
6414
  <db-infotext
6400
6415
  size="small"
@@ -6490,7 +6505,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
6490
6505
  }
6491
6506
  </select>
6492
6507
  @if(placeholder()){
6493
- <span [attr.id]="_placeholderId()">{{placeholder()}}</span>
6508
+ <span
6509
+ class="db-select-placeholder"
6510
+ [attr.id]="_placeholderId()"
6511
+ >{{placeholder()}}</span
6512
+ >
6494
6513
  } @if(stringPropVisible(message(), showMessage())){
6495
6514
  <db-infotext
6496
6515
  size="small"
@@ -6613,9 +6632,6 @@ const StackJustifyContentList = ['space-between', 'start', 'end', 'center'];
6613
6632
  const defaultProps$5 = {};
6614
6633
  class DBSwitch {
6615
6634
  handleChange(event) {
6616
- if (this.change) {
6617
- this.change.emit(event);
6618
- }
6619
6635
  handleFrameworkEventAngular(this, event, "checked");
6620
6636
  }
6621
6637
  handleBlur(event) {
@@ -6651,7 +6667,6 @@ class DBSwitch {
6651
6667
  this.icon = input();
6652
6668
  this.iconTrailing = input();
6653
6669
  this.label = input();
6654
- this.change = output();
6655
6670
  this.blur = output();
6656
6671
  this.focus = output();
6657
6672
  this._ref = viewChild("_ref");
@@ -6712,7 +6727,7 @@ class DBSwitch {
6712
6727
  }
6713
6728
  }
6714
6729
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DBSwitch, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
6715
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: DBSwitch, isStandalone: true, selector: "db-switch", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, visualAid: { classPropertyName: "visualAid", publicName: "visualAid", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showLabel: { classPropertyName: "showLabel", publicName: "showLabel", isSignal: true, isRequired: false, transformFunction: null }, emphasis: { classPropertyName: "emphasis", publicName: "emphasis", isSignal: true, isRequired: false, transformFunction: null }, showRequiredAsterisk: { classPropertyName: "showRequiredAsterisk", publicName: "showRequiredAsterisk", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, validation: { classPropertyName: "validation", publicName: "validation", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, iconLeading: { classPropertyName: "iconLeading", publicName: "iconLeading", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, iconTrailing: { classPropertyName: "iconTrailing", publicName: "iconTrailing", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", disabled: "disabledChange", change: "change", blur: "blur", focus: "focus" }, providers: [{
6730
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: DBSwitch, isStandalone: true, selector: "db-switch", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, visualAid: { classPropertyName: "visualAid", publicName: "visualAid", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showLabel: { classPropertyName: "showLabel", publicName: "showLabel", isSignal: true, isRequired: false, transformFunction: null }, emphasis: { classPropertyName: "emphasis", publicName: "emphasis", isSignal: true, isRequired: false, transformFunction: null }, showRequiredAsterisk: { classPropertyName: "showRequiredAsterisk", publicName: "showRequiredAsterisk", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, validation: { classPropertyName: "validation", publicName: "validation", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, iconLeading: { classPropertyName: "iconLeading", publicName: "iconLeading", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, iconTrailing: { classPropertyName: "iconTrailing", publicName: "iconTrailing", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", disabled: "disabledChange", blur: "blur", focus: "focus" }, providers: [{
6716
6731
  provide: NG_VALUE_ACCESSOR,
6717
6732
  useExisting: DBSwitch,
6718
6733
  multi: true