Skip to content

Commit

Permalink
Merge 464623b into fbc5f33
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Dec 24, 2021
2 parents fbc5f33 + 464623b commit b161797
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Component, forwardRef, ViewChild} from '@angular/core';
import {FormControl, Validators} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {ALWAYS_FALSE_HANDLER, TuiBooleanHandler, TuiIdentityMatcher} from '@taiga-ui/cdk';
import {TuiValueContentContext} from '@taiga-ui/core';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

import {default as example1Html} from '!!raw-loader!./examples/1/index.html';
Expand Down Expand Up @@ -57,7 +58,9 @@ class Account {
})
export class ExampleTuiSelectComponent extends AbstractExampleTuiControl {
@ViewChild('valueTemplateContent')
private readonly valueTemplateRef: PolymorpheusContent = '';
private readonly valueTemplateRef: PolymorpheusContent<
TuiValueContentContext<Account>
> = '';

readonly exampleImportModule = exampleImportModule;
readonly exampleInsertTemplate = exampleInsertTemplate;
Expand Down Expand Up @@ -130,7 +133,7 @@ export class ExampleTuiSelectComponent extends AbstractExampleTuiControl {
(item: Account) => item.balance < 300,
];

get valueContent(): PolymorpheusContent {
get valueContent(): PolymorpheusContent<TuiValueContentContext<Account>> {
return this.valueTemplateRef && this.selectedValueTemplate
? this.valueTemplateRef
: '';
Expand Down
5 changes: 5 additions & 0 deletions projects/demo/src/modules/components/select/select.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
color: var(--tui-accent);
margin: 0 0.25rem 0 -0.25rem;
}

.text-overflow {
overflow: hidden;
text-overflow: ellipsis;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</tui-doc-demo>
<ng-template #valueTemplateContent let-item>
<tui-svg src="tuiIconCheck" class="icon"></tui-svg>
{{ item }}
<div class="text-overflow">{{ item }}</div>
</ng-template>
<div i18n>
<p>
Expand Down
11 changes: 8 additions & 3 deletions projects/kit/components/select/select.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,23 @@
/* stylelint-enable */
}

.hosted {
.t-hosted {
display: block;
border-radius: inherit;
}

.textfield {
.t-textfield {
border-radius: inherit;
text-align: inherit;
}

.value {
.t-value {
display: flex;
width: 100%;
align-items: center;
overflow: hidden;

&__primitive {
.text-overflow();
}
}
12 changes: 8 additions & 4 deletions projects/kit/components/select/select.template.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<tui-hosted-dropdown
class="hosted"
class="t-hosted"
[canOpen]="canOpen"
[content]="datalist || ''"
(tuiActiveZoneChange)="onActiveZone($event)"
>
<tui-primitive-textfield
automation-id="tui-select__textfield"
class="textfield"
class="t-textfield"
[editable]="false"
[pseudoFocused]="computedFocused"
[pseudoHovered]="computedHovered"
Expand All @@ -27,9 +27,13 @@
*ngIf="value !== null"
polymorpheus-outlet
automation-id="tui-select__value"
class="value"
class="t-value"
[content]="computedContent"
[context]="computeContext(value, computedFocused)"
></div>
>
<ng-template let-primitiveValue>
<div class="t-value__primitive">{{ primitiveValue }}</div>
</ng-template>
</div>
</tui-primitive-textfield>
</tui-hosted-dropdown>

0 comments on commit b161797

Please sign in to comment.