-
Notifications
You must be signed in to change notification settings - Fork 125
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
fix: make tokenizer/multiinput responsive #2086
Conversation
Deploy preview for fundamental-ngx ready! Built with commit 6788f2d |
800f64d
to
6f8bd41
Compare
Depends on SAP/fundamental-styles#775 |
Should have left this as blocked as it depends on #2228 |
A lot of the changes came from #2228 which has now been merged so you should be seeing fewer. There are still some seemingly random changes, like one to breadcrumb, but i did that because the tokenizer and breadcrumb resize logic is very similar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Mike, let's take a look at my comments. The example works well, but there are some changes to include in the code
buildComponentCssClass(): string { | ||
return [ | ||
this.state ? 'is-' + this.state : '', | ||
this.type === 'radio' ? 'fd-radio' : '', | ||
this._getElementTag() === 'input' ? 'fd-input' : '', | ||
this._getElementTag() === 'textarea' ? 'fd-textarea' : '', | ||
this._getElementTag() === 'select' ? 'fd-form-select' : '', | ||
this.compact && this._getElementTag() === 'input' ? 'fd-input--compact' : '', | ||
this.compact && this._getElementTag() === 'textarea' ? 'fd-textarea--compact' : '', | ||
this.compact && this._getElementTag() === 'select' ? 'fd-form-select--compact' : '', | ||
this.class | ||
].filter(x => x !== '').join(' '); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have some method there?
buildComponentCssClass(): string { | |
return [ | |
this.state ? 'is-' + this.state : '', | |
this.type === 'radio' ? 'fd-radio' : '', | |
this._getElementTag() === 'input' ? 'fd-input' : '', | |
this._getElementTag() === 'textarea' ? 'fd-textarea' : '', | |
this._getElementTag() === 'select' ? 'fd-form-select' : '', | |
this.compact && this._getElementTag() === 'input' ? 'fd-input--compact' : '', | |
this.compact && this._getElementTag() === 'textarea' ? 'fd-textarea--compact' : '', | |
this.compact && this._getElementTag() === 'select' ? 'fd-form-select--compact' : '', | |
this.class | |
].filter(x => x !== '').join(' '); | |
} | |
buildComponentCssClass(): string { | |
return [ | |
this.state ? 'is-' + this.state : '', | |
this._getFormClass(), | |
this.compact ? (this._getFormClass() + '--compact') : '', | |
this.class | |
].filter(x => x !== '').join(' '); | |
} | |
private _getFormClass(): string { | |
switch (this._getElementTag()) { | |
case: 'input': | |
return `fd-input`; | |
case: 'select': | |
... | |
} | |
} |
} | ||
|
||
/** @hidden */ | ||
expandTokens(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make it private?
} | ||
|
||
/** @hidden */ | ||
collapseTokens(side?: string): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make it private?
/** @hidden */ | ||
focusTokenElement(event: KeyboardEvent, newIndex: number): HTMLElement { | ||
focusTokenElement(event: Event, newIndex: number): HTMLElement { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order of methods rules should be followed, take a look there
<ng-content select="fd-token"></ng-content> | ||
<span *ngIf="(moreTokensLeft.length > 0 || moreTokensRight.length > 0) && compact" class="fd-tokenizer-more" #moreElement> | ||
<ng-container>{{moreTokensLeft.length + moreTokensRight.length}} more</ng-container> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put some customizable {{word}}
, instead of more
?
<ng-content select="fd-token"></ng-content> | ||
<span *ngIf="(moreTokensLeft.length > 0 || moreTokensRight.length > 0) && compact" class="fd-tokenizer-more" #moreElement> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's good idea to depend behaviour on compact
flag. Maybe let's have another better docummented flag like collapseTokens: boolean
or something. It would be great to put some dedicated section only for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying collapseTokens would be an input or somehow behave separately from the compact flag? The specs make it pretty clear that phones are cozy and don't have "more" text and desktop is compact and does have "more" so I don't think we should deviate from that
This reverts commit ab2a011.
Please provide a link to the associated issue.
fixes #2018
Please provide a brief summary of this pull request.
Collapse/expand tokens within the tokenizer depending on tokenizer width. Multi-input should display "____ more" text indicating how many collapsed tokens there are. Also refactor the breadcrumb responsiveness a little bit.
Please check whether the PR fulfills the following requirements
https://github.com/SAP/fundamental-ngx/blob/master/CONTRIBUTING.md