@db-ux/ngx-core-components 3.1.4 → 3.1.16

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"
@@ -2943,15 +2941,18 @@ class DBCustomSelect {
2943
2941
  }
2944
2942
  return false;
2945
2943
  }
2946
- getTagRemoveLabel(index) {
2947
- if (this.removeTagsTexts() && this.removeTagsTexts().length > index) {
2948
- return this.removeTagsTexts().at(index);
2949
- }
2950
- else {
2951
- return `${DEFAULT_REMOVE} ${this._selectedOptions()
2952
- ? this.getOptionLabel(this._selectedOptions()[index])
2953
- : ""}`;
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
+ }
2954
2953
  }
2954
+ // Fallback to default behavior
2955
+ return `${DEFAULT_REMOVE} ${this.getOptionLabel(option)}`;
2955
2956
  }
2956
2957
  handleTagRemove(option, event) {
2957
2958
  if (event) {
@@ -2982,39 +2983,53 @@ class DBCustomSelect {
2982
2983
  if (isCheckbox) {
2983
2984
  const listElement = activeElement?.closest("li");
2984
2985
  if (event.key === "ArrowDown" || event.key === "ArrowRight") {
2985
- if (listElement?.nextElementSibling) {
2986
- listElement?.nextElementSibling
2987
- ?.querySelector("input")
2988
- ?.focus();
2986
+ // Find next element with input, skipping group titles
2987
+ let nextElement = listElement?.nextElementSibling;
2988
+ while (nextElement) {
2989
+ const nextInput = nextElement.querySelector("input");
2990
+ if (nextInput) {
2991
+ nextInput.focus();
2992
+ break;
2993
+ }
2994
+ nextElement = nextElement.nextElementSibling;
2989
2995
  }
2990
- else {
2996
+ if (!nextElement) {
2991
2997
  // We are on the last checkbox we move to the top checkbox
2992
2998
  this.handleFocusFirstDropdownCheckbox(activeElement);
2993
2999
  }
2994
3000
  }
2995
3001
  else {
2996
- if (listElement?.previousElementSibling) {
2997
- listElement?.previousElementSibling
2998
- ?.querySelector("input")
2999
- ?.focus();
3000
- }
3001
- else if (this.detailsRef()?.nativeElement.querySelector(`input[type="checkbox"]`) !== activeElement) {
3002
- // We are on the top list checkbox but there is a select all checkbox as well
3003
- this.handleFocusFirstDropdownCheckbox(activeElement);
3002
+ // Find previous element with input, skipping group titles
3003
+ let prevElement = listElement?.previousElementSibling;
3004
+ while (prevElement) {
3005
+ const prevInput = prevElement.querySelector("input");
3006
+ if (prevInput) {
3007
+ prevInput.focus();
3008
+ break;
3009
+ }
3010
+ prevElement = prevElement.previousElementSibling;
3004
3011
  }
3005
- else {
3006
- // We are on the top checkbox, we need to move to the search
3007
- // or to the last checkbox
3008
- const search = getSearchInput(this.detailsRef()?.nativeElement);
3009
- if (search) {
3010
- delay(() => {
3011
- search.focus();
3012
- }, 100);
3012
+ if (!prevElement) {
3013
+ // Check if we have a "select all" checkbox (only relevant for multi-select)
3014
+ const selectAllCheckbox = this.detailsRef()?.nativeElement.querySelector(`input[type="checkbox"]`);
3015
+ if (selectAllCheckbox && selectAllCheckbox !== activeElement) {
3016
+ // We are on the top list checkbox but there is a select all checkbox as well
3017
+ this.handleFocusFirstDropdownCheckbox(activeElement);
3013
3018
  }
3014
3019
  else {
3015
- const checkboxList = Array.from(this.detailsRef()?.nativeElement?.querySelectorAll(`input[type="checkbox"],input[type="radio"]`));
3016
- if (checkboxList.length) {
3017
- checkboxList.at(-1)?.focus();
3020
+ // We are on the top checkbox, we need to move to the search
3021
+ // or to the last checkbox
3022
+ const search = getSearchInput(this.detailsRef()?.nativeElement);
3023
+ if (search) {
3024
+ delay(() => {
3025
+ search.focus();
3026
+ }, 100);
3027
+ }
3028
+ else {
3029
+ const checkboxList = Array.from(this.detailsRef()?.nativeElement?.querySelectorAll(`input[type="checkbox"],input[type="radio"]`));
3030
+ if (checkboxList.length) {
3031
+ checkboxList.at(-1)?.focus();
3032
+ }
3018
3033
  }
3019
3034
  }
3020
3035
  }
@@ -3422,10 +3437,14 @@ class DBCustomSelect {
3422
3437
  // --- Mitosis: Workaround to make sure the effect() is triggered ---
3423
3438
  this.values();
3424
3439
  // ---
3425
- if (this.values() &&
3426
- Array.isArray(this.values()) &&
3427
- this.values() !== this._values()) {
3428
- this._values.set(this.values() ?? []);
3440
+ const v = this.values();
3441
+ if (Array.isArray(v)) {
3442
+ if (this._values() !== v) {
3443
+ this._values.set(v);
3444
+ }
3445
+ }
3446
+ else if (v == null && this._values()?.length !== 0) {
3447
+ this._values.set([]);
3429
3448
  }
3430
3449
  }, {
3431
3450
  // Enable writing to signals inside effects
@@ -3724,7 +3743,7 @@ class DBCustomSelect {
3724
3743
  <db-tag
3725
3744
  emphasis="strong"
3726
3745
  behavior="removable"
3727
- [removeButton]="getTagRemoveLabel(index)"
3746
+ [removeButton]="getTagRemoveLabel(option)"
3728
3747
  (remove)="handleTagRemove(option, $event)"
3729
3748
  >{{getOptionLabel(option)}}</db-tag
3730
3749
  >
@@ -3831,6 +3850,7 @@ class DBCustomSelect {
3831
3850
  >
3832
3851
  }
3833
3852
  <span
3853
+ class="db-custom-select-placeholder"
3834
3854
  [attr.aria-hidden]="getBooleanAsString(true)"
3835
3855
  [attr.id]="_placeholderId()"
3836
3856
  >{{placeholder() ?? label()}}</span
@@ -3945,7 +3965,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
3945
3965
  <db-tag
3946
3966
  emphasis="strong"
3947
3967
  behavior="removable"
3948
- [removeButton]="getTagRemoveLabel(index)"
3968
+ [removeButton]="getTagRemoveLabel(option)"
3949
3969
  (remove)="handleTagRemove(option, $event)"
3950
3970
  >{{getOptionLabel(option)}}</db-tag
3951
3971
  >
@@ -4052,6 +4072,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
4052
4072
  >
4053
4073
  }
4054
4074
  <span
4075
+ class="db-custom-select-placeholder"
4055
4076
  [attr.aria-hidden]="getBooleanAsString(true)"
4056
4077
  [attr.id]="_placeholderId()"
4057
4078
  >{{placeholder() ?? label()}}</span
@@ -6398,7 +6419,11 @@ class DBSelect {
6398
6419
  }
6399
6420
  </select>
6400
6421
  @if(placeholder()){
6401
- <span [attr.id]="_placeholderId()">{{placeholder()}}</span>
6422
+ <span
6423
+ class="db-select-placeholder"
6424
+ [attr.id]="_placeholderId()"
6425
+ >{{placeholder()}}</span
6426
+ >
6402
6427
  } @if(stringPropVisible(message(), showMessage())){
6403
6428
  <db-infotext
6404
6429
  size="small"
@@ -6494,7 +6519,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
6494
6519
  }
6495
6520
  </select>
6496
6521
  @if(placeholder()){
6497
- <span [attr.id]="_placeholderId()">{{placeholder()}}</span>
6522
+ <span
6523
+ class="db-select-placeholder"
6524
+ [attr.id]="_placeholderId()"
6525
+ >{{placeholder()}}</span
6526
+ >
6498
6527
  } @if(stringPropVisible(message(), showMessage())){
6499
6528
  <db-infotext
6500
6529
  size="small"
@@ -6617,9 +6646,6 @@ const StackJustifyContentList = ['space-between', 'start', 'end', 'center'];
6617
6646
  const defaultProps$5 = {};
6618
6647
  class DBSwitch {
6619
6648
  handleChange(event) {
6620
- if (this.change) {
6621
- this.change.emit(event);
6622
- }
6623
6649
  handleFrameworkEventAngular(this, event, "checked");
6624
6650
  }
6625
6651
  handleBlur(event) {
@@ -6655,7 +6681,6 @@ class DBSwitch {
6655
6681
  this.icon = input();
6656
6682
  this.iconTrailing = input();
6657
6683
  this.label = input();
6658
- this.change = output();
6659
6684
  this.blur = output();
6660
6685
  this.focus = output();
6661
6686
  this._ref = viewChild("_ref");
@@ -6716,7 +6741,7 @@ class DBSwitch {
6716
6741
  }
6717
6742
  }
6718
6743
  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 }); }
6719
- 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: [{
6744
+ 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: [{
6720
6745
  provide: NG_VALUE_ACCESSOR,
6721
6746
  useExisting: DBSwitch,
6722
6747
  multi: true