Skip to content

Commit

Permalink
fix: default values, minWidth and Input name
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Jul 18, 2023
1 parent f80282b commit 5e8bc26
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<gn-ui-dropdown-selector
class="basis-1/4 grow"
[choices]="typeChoices"
[extraClass]="'secondary min-w-full'"
[extraBtnClass]="'secondary min-w-full'"
(selectValue)="chartType$.next($event)"
[selected]="chartType$.value"
[title]="'chart.dropdown.type' | translate"
></gn-ui-dropdown-selector>
<gn-ui-dropdown-selector
class="basis-1/4 grow"
[choices]="xChoices$ | async"
[extraClass]="'secondary min-w-full'"
[extraBtnClass]="'secondary min-w-full'"
(selectValue)="xProperty$.next($event)"
[selected]="xProperty$.value"
[title]="'chart.dropdown.xProperty' | translate"
Expand Down
2 changes: 0 additions & 2 deletions libs/feature/dataviz/src/lib/feature-dataviz.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { ChartViewComponent } from './chart-view/chart-view.component'
import { TranslateModule } from '@ngx-translate/core'
import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets'
import { UiInputsModule } from '@geonetwork-ui/ui/inputs'
import { OverlayModule } from '@angular/cdk/overlay'

@NgModule({
imports: [
Expand All @@ -26,7 +25,6 @@ import { OverlayModule } from '@angular/cdk/overlay'
UiWidgetsModule,
TranslateModule,
ChartComponent,
OverlayModule,
UiInputsModule,
],
declarations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#dropdown
[id]="wizardFieldConfig.id"
[title]="''"
[extraClass]="'secondary min-w-full'"
[extraBtnClass]="'secondary min-w-full'"
[showTitle]="false"
[choices]="dropdownChoices"
[selected]="wizardFieldData"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*ngIf="dropdownChoices$ | async as choices"
[title]="'table.select.data' | translate"
class="mb-7 w-auto ml-auto"
extraClass="!text-primary font-sans font-medium"
extraBtnClass="!text-primary font-sans font-medium"
[choices]="choices"
(selectValue)="selectLink($event)"
></gn-ui-dropdown-selector>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="w-full h-full flex flex-col p-1">
<div class="flex w-full justify-end mb-7 mt-1">
<gn-ui-dropdown-selector
extraClass="!text-primary font-sans font-medium"
extraBtnClass="!text-primary font-sans font-medium"
[title]="'map.select.layer' | translate"
[choices]="dropdownChoices$ | async"
(selectValue)="selectLinkToDisplay($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[title]="'organisation.sort.sortBy' | translate"
class="shrink"
[choices]="choices"
[minWidth]="'180px'"
[showTitle]="true"
(selectValue)="selectOrderToDisplay($event)"
></gn-ui-dropdown-selector>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div
class="flex items-start flex-col sm:flex-row sm:items-center relative w-full"
*ngIf="choices"
>
<span
*ngIf="showTitle"
Expand All @@ -11,8 +10,9 @@
</span>
<gn-ui-button
type="outline"
class="grow min-w-[165px]"
extraClass="w-full !p-[8px] !pl-[16px] {{ extraClass }}"
class="grow"
style="min-width: {{ minWidth }}"
extraClass="w-full !p-[8px] !pl-[16px] {{ extraBtnClass }}"
[title]="title"
[attr.aria-owns]="id"
(buttonClick)="openOverlay()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class DropdownSelectorComponent implements OnInit {
@Input() choices: DDChoices<unknown>
@Input() selected: any
@Input() maxRows: number
@Input() extraClass = ''
@Input() extraBtnClass = ''
@Input() minWidth = ''
@Output() selectValue = new EventEmitter<any>()
@ViewChild('overlayOrigin') overlayOrigin: CdkOverlayOrigin
@ViewChild(CdkConnectedOverlay) overlay: CdkConnectedOverlay
Expand Down Expand Up @@ -69,14 +70,14 @@ export class DropdownSelectorComponent implements OnInit {
}

getChoiceLabel(): string {
return (
this.selectedChoice.label.substring(0, 50) +
(this.selectedChoice.label.length > 50 ? '...' : '')
)
return this.selectedChoice?.label
}

ngOnInit(): void {
if (!this.maxRows) this.maxRows = DEFAULT_ROW_NUMBERS
if (!this.choices || this.choices.length === 0) {
this.choices = []
}
}

isSelected(choice) {
Expand Down

0 comments on commit 5e8bc26

Please sign in to comment.