Skip to content

Commit

Permalink
feat(select): Добавить опцию для скрытия чекбосов (#UIM-252) (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
lskramarov authored Dec 13, 2019
1 parent 3fc18d4 commit 0911f9a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/mosaic-dev/select/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

<div mc-select-search-empty-result>Ничего не найдено</div>

<mc-option *ngFor="let option of filteredMultipleOptions | async" [value]="option">{{ option }}</mc-option>
<mc-option [showCheckbox]="false" *ngFor="let option of filteredMultipleOptions | async" [value]="option">{{ option }}</mc-option>
</mc-select>
</mc-form-field>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/mosaic/core/option/option.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mc-pseudo-checkbox
*ngIf="multiple"
*ngIf="showCheckbox"
[state]="selected ? 'checked' : ''"
[disabled]="disabled">
</mc-pseudo-checkbox>
Expand Down
11 changes: 11 additions & 0 deletions packages/mosaic/core/option/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ export class McOption implements AfterViewChecked, OnDestroy {
/** The form value of the option. */
@Input() value: any;

@Input()
get showCheckbox() {
return this._showCheckbox === undefined ? this.multiple : this._showCheckbox;
}

set showCheckbox(value) {
this._showCheckbox = coerceBooleanProperty(value);
}

private _showCheckbox: boolean;

/** Event emitted when the option is selected or deselected. */
// tslint:disable-next-line:no-output-on-prefix
@Output() readonly onSelectionChange = new EventEmitter<McOptionSelectionChange>();
Expand Down

0 comments on commit 0911f9a

Please sign in to comment.