OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fix displaying draggable autocompleter in wp column selection
ulferts7587d59dd9ca
diff --git a/app/components/projects/configure_view_modal_component.html.erb b/app/components/projects/configure_view_modal_component.html.erbindex fffb06b79f0..182ea3cf6c9 100644--- a/app/components/projects/configure_view_modal_component.html.erb+++ b/app/components/projects/configure_view_modal_component.html.erb@@ -26,7 +26,8 @@id: 'columns-select',inputLabel: I18n.t(:'queries.configure_view.columns.input_label'),inputPlaceholder: I18n.t(:'queries.configure_view.columns.input_placeholder'),- dragAreaLabel: I18n.t(:'queries.configure_view.columns.drag_area_label')+ dragAreaLabel: I18n.t(:'queries.configure_view.columns.drag_area_label'),+ appendToComponent: true}%><% end %><% end %>diff --git a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.html b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.htmlindex f1eca7df63d..e17b38afa2f 100644--- a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.html+++ b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.html@@ -18,7 +18,7 @@[clearSearchOnAdd]="true"[closeOnSelect]="true"[searchFn]="searchFunction"- [appendTo]="'#op-draggable-autocomplete-container'"+ [appendTo]="appendTo"(open)="opened()"(change)="select($event)"></ng-select>@@ -34,9 +34,9 @@<divclass="op-draggable-autocomplete--selected"dragula="columns"- [(dragulaModel)]="selected"+ [(dragulaModel)]="selectedOptions">- <div class="op-draggable-autocomplete--item" *ngFor="let item of selected">+ <div class="op-draggable-autocomplete--item" *ngFor="let item of selectedOptions"><spanclass="op-draggable-autocomplete--item-text"[textContent]="item.name"diff --git a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.ts b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.tsindex 9914e37ddf1..1c2dc1cc9b7 100644--- a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.ts+++ b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.ts@@ -36,7 +36,7 @@ export class DraggableAutocompleteComponent extends UntilDestroyedMixin implemen@Input() options:DraggableOption[];/** Order list of selected items */- @Input('selected') _selected:DraggableOption[] = [];+ @Input() selected:DraggableOption[] = [];/** List of options that are protected from being deleted. They can still be moved. */@Input() protected:DraggableOption[] = [];@@ -58,6 +58,10 @@ export class DraggableAutocompleteComponent extends UntilDestroyedMixin implemen/** Label to display drag&drop area */@Input() dragAreaLabel = '';+ /** Decide whether to bind the component to the component or to the body */+ /** Binding to the component in case the component is inside a Primer Dialog which uses popover */+ @Input() appendToComponent = false;+/** Output when autocompleter changes values or items removed */@Output() onChange = new EventEmitter<DraggableOption[]>();@@ -71,6 +75,8 @@ export class DraggableAutocompleteComponent extends UntilDestroyedMixin implemen@ViewChild('ngSelectComponent') public ngSelectComponent:NgSelectComponent;@ViewChild('input') inputElement:ElementRef;+ public appendTo = 'body';+constructor(readonly I18n:I18nService,readonly elementRef:ElementRef,@@ -116,6 +122,8 @@ export class DraggableAutocompleteComponent extends UntilDestroyedMixin implemen},},);++ this.appendTo = this.appendToComponent ? '#op-draggable-autocomplete-container' : 'body';}ngAfterViewInit():void {@@ -141,33 +149,33 @@ export class DraggableAutocompleteComponent extends UntilDestroyedMixin implemenreturn;}- this.selected = [...this.selected, item];+ this.selectedOptions = [...this.selectedOptions, item];// Remove selectionthis.ngSelectComponent.clearModel();}remove(item:DraggableOption) {- this.selected = this.selected.filter((selected) => selected.id !== item.id);+ this.selectedOptions = this.selectedOptions.filter((selected) => selected.id !== item.id);}isRemovable(item:DraggableOption) {return !this.protected.find((protectedItem) => protectedItem.id === item.id);}- get selected() {- return this._selected;+ get selectedOptions() {+ return this.selected;}- set selected(val:DraggableOption[]) {- this._selected = val;+ set selectedOptions(val:DraggableOption[]) {+ this.selected = val;this.updateAvailableOptions();- this.onChange.emit(this.selected);+ this.onChange.emit(this.selectedOptions);}get hiddenValue() {- return this.selected.map((item) => item.id).join(' ');+ return this.selectedOptions.map((item) => item.id).join(' ');}opened() {@@ -180,6 +188,6 @@ export class DraggableAutocompleteComponent extends UntilDestroyedMixin implemenprivate updateAvailableOptions() {this.availableOptions = this.options- .filter((item) => !this.selected.find((selected) => selected.id === item.id));+ .filter((item) => !this.selectedOptions.find((selected) => selected.id === item.id));}}