Skip to content

feat(select): add option to hide checkboxes (#UIM-252) #365

Merged
merged 1 commit into from
Dec 13, 2019
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
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