Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor: add selectors #405

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ng-core-label-editor *ngIf="to.label && field.templateOptions.hideLabel !== true" [field]="field">
</ng-core-label-editor>

<div [ngClass]="{'ml-3': field.templateOptions.hideLabel !== true}">
<div class="array-item" [ngClass]="{'ml-3': field.templateOptions.hideLabel !== true}">
<!-- validation error message -->
<div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
<formly-validation-message [field]="field"></formly-validation-message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,33 @@
 You should have received a copy of the GNU Affero General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<div class="btn-group mt-1" dropdown #dropdown="bs-dropdown" [insideClick]="true" [isDisabled]="to.readonly">
<button id="button-basic" dropdownToggle type="button"
class="btn btn-outline-primary btn-sm btn-block dropdown-toggle px-3" aria-controls="dropdown-basic">
{{ selectedOptions.length ? selectedValuesAsString : ('Select an option' | translate) }}
<span class="caret"></span>
</button>
<div id="dropdown-basic" *dropdownMenu class="dropdown-menu" role="menu" aria-labelledby="button-basic">
<div class="px-4 py-2" *ngIf="filter || filteredOptions.length > to.minItemsToDisplaySearch">
<input type="text" class="form-control form-control-sm" (input)="onFilterChange($event.target.value)"
[value]="filter" [placeholder]="'Filter...' | translate" />
</div>
<ng-container *ngIf="filteredOptions.length; else noResult">
<ng-container *ngFor="let option of filteredOptions">
<a class="dropdown-item" [ngClass]="{ active: isOptionSelected(option), disabled: option.disabled }" href="#"
(click)="$event.preventDefault(); selectOption(option); dropdown.hide()"
*ngIf="option.value != null; else group">
{{ !filter ? '&nbsp;&nbsp;&nbsp;&nbsp;'.repeat(option.level) + ' ' : '' }}{{ option.translatedLabel }}
</a>
<ng-template #group>
<h6 class="dropdown-header">{{ option.translatedLabel }}</h6>
</ng-template>
<div>
<div class="btn-group mt-1" dropdown #dropdown="bs-dropdown" [insideClick]="true" [isDisabled]="to.readonly">
<button id="button-basic" dropdownToggle type="button"
class="btn btn-outline-primary btn-sm btn-block dropdown-toggle px-3" aria-controls="dropdown-basic">
{{ selectedOptions.length ? selectedValuesAsString : ('Select an option' | translate) }}
<span class="caret"></span>
</button>
<div id="dropdown-basic" *dropdownMenu class="dropdown-menu" role="menu" aria-labelledby="button-basic">
<div class="px-4 py-2" *ngIf="filter || filteredOptions.length > to.minItemsToDisplaySearch">
<input type="text" class="form-control form-control-sm" (input)="onFilterChange($event.target.value)"
[value]="filter" [placeholder]="'Filter...' | translate" />
</div>
<ng-container *ngIf="filteredOptions.length; else noResult">
<ng-container *ngFor="let option of filteredOptions">
<a class="dropdown-item" [ngClass]="{ active: isOptionSelected(option), disabled: option.disabled }" href="#"
(click)="$event.preventDefault(); selectOption(option); dropdown.hide()"
*ngIf="option.value != null; else group">
{{ !filter ? '&nbsp;&nbsp;&nbsp;&nbsp;'.repeat(option.level) + ' ' : '' }}{{ option.translatedLabel }}
</a>
<ng-template #group>
<h6 class="dropdown-header">{{ option.translatedLabel }}</h6>
</ng-template>
</ng-container>
</ng-container>
</ng-container>
<ng-template #noResult>
<p class="m-0 px-4 py-2 text-muted" translate>No result</p>
</ng-template>
<ng-template #noResult>
<p class="m-0 px-4 py-2 text-muted" translate>No result</p>
</ng-template>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@
<div class="header">
<ng-core-label-editor *ngIf="field.templateOptions.hideLabel !== true" [field]="field"></ng-core-label-editor>
</div>
<!-- each object properties -->
<div [ngClass]="{'ml-3': field.templateOptions.hideLabel !== true, 'content': true}">
<!-- validation error message -->
<div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
<formly-validation-message [field]="field"></formly-validation-message>
</div>
<div class="{{ to.containerCssClass }}">
<ng-container *ngFor="let f of field.fieldGroup">
<div class="{{ f.templateOptions.itemCssClass }} mb-1" *ngIf="!f.hide" [id]="'field-' + f.id">
<!-- field -->
<formly-field [field]="f"></formly-field>
</div>
</ng-container>
<div class="object">
<!-- each object properties -->
<div [ngClass]="{'ml-3': field.templateOptions.hideLabel !== true, 'content': true}">
<!-- validation error message -->
<div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
<formly-validation-message [field]="field"></formly-validation-message>
</div>
<div class="{{ to.containerCssClass }}">
<ng-container *ngFor="let f of field.fieldGroup">
<div class="{{ f.templateOptions.itemCssClass }} mb-1" *ngIf="!f.hide" [id]="'field-' + f.id">
<!-- field -->
<formly-field [field]="f"></formly-field>
</div>
</ng-container>
</div>
</div>
</div>