Browse Source

code refactoring

pull/22363/head
erdemcaygor 1 year ago
parent
commit
fca845bd67
  1. 18
      npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form-prop.component.html
  2. 29
      npm/ng-packs/packages/components/extensible/src/lib/components/multi-select/extensible-form-multiselect.component.ts

18
npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form-prop.component.html

@ -62,24 +62,6 @@
}
@case ('multiselect') {
<ng-template [ngTemplateOutlet]="label"></ng-template>
<!-- <select
#field
[id]="prop.id"
[formControlName]="prop.name"
[abpDisabled]="disabled"
multiple="multiple"
class="form-select form-control"
>
@for (option of options$ | async; track option.value) {
<option [ngValue]="option.value">
@if (prop.isExtra) {
{{ '::' + option.key | abpLocalization }}
} @else {
{{ option.key }}
}
</option>
}
</select>-->
<abp-extensible-form-multi-select
[prop]="prop"
[options]="options$ | async"

29
npm/ng-packs/packages/components/extensible/src/lib/components/multi-select/extensible-form-multiselect.component.ts

@ -1,7 +1,6 @@
import { Component, ChangeDetectionStrategy, forwardRef, input } from '@angular/core';
import { NG_VALUE_ACCESSOR, ControlValueAccessor, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { ABP, LocalizationModule } from '@abp/ng.core';
import { BaseThemeSharedModule } from '@abp/ng.theme.shared';
import { FormProp } from '@abp/ng.components/extensible';
@ -17,21 +16,19 @@ const EXTENSIBLE_FORM_MULTI_SELECT_CONTROL_VALUE_ACCESSOR = {
template: `
<div [id]="prop().id">
@for (option of options(); track option.value) {
<div class="d-flex align-items-center column-gap-2">
<div class="form-check" validationTarget>
<input
type="checkbox"
class="form-check-input"
[disabled]="disabled"
[checked]="isChecked(option.value)"
(change)="onCheckboxChange(option.value, $event)"
/>
@if (prop().isExtra) {
{{ '::' + option.key | abpLocalization }}
} @else {
{{ option.key }}
}
</div>
<div class="form-check" validationTarget>
<input
type="checkbox"
class="form-check-input"
[disabled]="disabled"
[checked]="isChecked(option.value)"
(change)="onCheckboxChange(option.value, $event)"
/>
@if (prop().isExtra) {
{{ '::' + option.key | abpLocalization }}
} @else {
{{ option.key }}
}
</div>
}
</div>

Loading…
Cancel
Save