Enhancement: improve layout, button labels for custom fields dropdown (#6362)

This commit is contained in:
shamoon 2024-04-18 23:57:17 -07:00 committed by GitHub
parent 40db1065dc
commit 78f338484f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 19 deletions

View File

@ -2692,18 +2692,14 @@
<source>Create New Field</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.html</context>
<context context-type="linenumber">21</context>
<context context-type="linenumber">22</context>
</context-group>
</trans-unit>
<trans-unit id="3249513483374643425" datatype="html">
<source>Add</source>
<trans-unit id="601575001006419615" datatype="html">
<source>Add to document</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.html</context>
<context context-type="linenumber">24</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/permissions-select/permissions-select.component.html</context>
<context context-type="linenumber">7</context>
<context context-type="linenumber">25</context>
</context-group>
</trans-unit>
<trans-unit id="7827616268749044116" datatype="html">
@ -4097,7 +4093,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/input/select/select.component.ts</context>
<context context-type="linenumber">155</context>
<context context-type="linenumber">158</context>
</context-group>
</trans-unit>
<trans-unit id="6423278459497515329" datatype="html">
@ -4307,6 +4303,13 @@
<context context-type="linenumber">45</context>
</context-group>
</trans-unit>
<trans-unit id="3249513483374643425" datatype="html">
<source>Add</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/permissions-select/permissions-select.component.html</context>
<context context-type="linenumber">7</context>
</context-group>
</trans-unit>
<trans-unit id="1230154438678955604" datatype="html">
<source>Change</source>
<context-group purpose="location">

View File

@ -6,7 +6,7 @@
<div ngbDropdownMenu aria-labelledby="customFieldsDropdown" class="shadow custom-fields-dropdown">
<ul class="list-group list-group-flush">
<li class="list-group-item">
<pngx-input-select class="mb-3"
<pngx-input-select
[items]="unusedFields"
bindLabel="name"
[(ngModel)]="field"
@ -14,14 +14,15 @@
[notFoundText]="notFoundText"
[disableCreateNew]="!canCreateFields"
(createNew)="createField($event)"
[hideAddButton]="true"
bindValue="id">
</pngx-input-select>
<div class="btn-toolbar" role="toolbar">
<button class="btn btn-sm btn-outline-secondary me-auto" type="button" (click)="createField()" [disabled]="!canCreateFields">
<i-bs width="1em" height="1em" name="asterisk"></i-bs>&nbsp;<ng-container i18n>Create New Field</ng-container>
</button>
<button class="btn btn-sm btn-outline-primary me-1" type="button" (click)="addField(); fieldDropdown.close()" [disabled]="field === undefined">
<i-bs width="1.2em" height="1.2em" name="plus-circle"></i-bs>&nbsp;<ng-container i18n>Add</ng-container>
<button class="btn btn-sm btn-outline-primary" type="button" (click)="addField(); fieldDropdown.close()" [disabled]="field === undefined">
<i-bs width="1.2em" height="1.2em" name="plus-circle"></i-bs>&nbsp;<ng-container i18n>Add to document</ng-container>
</button>
</div>
</li>

View File

@ -1,5 +1,5 @@
.custom-fields-dropdown {
min-width: 350px;
min-width: 380px;
// correct position on mobile
@media (max-width: 575.98px) {

View File

@ -1,10 +1,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { CustomFieldsDropdownComponent } from './custom-fields-dropdown.component'
import {
HttpClientTestingModule,
HttpTestingController,
} from '@angular/common/http/testing'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { ToastService } from 'src/app/services/toast.service'
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
import { of } from 'rxjs'

View File

@ -36,7 +36,7 @@
<span [title]="item[bindLabel]">{{item[bindLabel]}}</span>
</ng-template>
</ng-select>
@if (allowCreateNew) {
@if (allowCreateNew && !hideAddButton) {
<button class="btn btn-outline-secondary" type="button" (click)="addItem()" [disabled]="disabled">
<i-bs width="1.2em" height="1.2em" name="plus"></i-bs>
</button>

View File

@ -94,6 +94,9 @@ export class SelectComponent extends AbstractInputComponent<number> {
@Input()
disableCreateNew: boolean = false
@Input()
hideAddButton: boolean = false
@Output()
createNew = new EventEmitter<string>()

View File

@ -17,7 +17,7 @@
--page-margin: 10px auto;
}
::ng-deep .ng-select-taggable {
::ng-deep form .ng-select-taggable {
max-width: calc(100% - 90px); // fudge factor for (2x) ng-select button width
}