Skip to content
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

feat(MdChips): formatter #1339

Merged
merged 8 commits into from Jan 12, 2018

Conversation

Projects
None yet
2 participants
@VdustR
Copy link
Member

commented Dec 25, 2017

New props :md-format for the formatter before chip insertion. Effects to insertion and duplicated-checking.

fix #1288

feat(MdChips): formatter
Formatter before chip insertion. Effects to insertion and duplicated-checking.

fix #1288
type: 'Function',
description: [
'Formatter before chip insertion. Effects to insertion and duplicated-checking.',
'@param {<code>String</code>} input value'

This comment has been minimized.

Copy link
@marcosmoura

marcosmoura Dec 26, 2017

Member

Maybe we can explicitly say that this function will receive this parameter. There is an example on md-table component

This comment has been minimized.

Copy link
@VdustR

VdustR Dec 27, 2017

Author Member

fix ca3ac20

</md-chips>
<md-chips class="md-primary" v-model="artists" md-placeholder="Add artist..." :md-format="formatName">
<label>Artists</label>
<div class="md-helper-text">Try insert `Eugène Ysaÿe` twice. The formatter will remove diacritics.</div>

This comment has been minimized.

Copy link
@marcosmoura

marcosmoura Dec 26, 2017

Member

Is this message correct? Try insert 'Eugène Ysaÿe' twice. I think a good one could be:
Try inserting a chip with 'Eugène Ysaÿe'

This comment has been minimized.

Copy link
@VdustR

VdustR Dec 27, 2017

Author Member

Yes, I expect developers see this:

image

// capitalize
words = words.map(str => str[0].toUpperCase() + str.slice(1))
let result = words.join(' ')
return result

This comment has been minimized.

Copy link
@marcosmoura

marcosmoura Dec 26, 2017

Member

Just return the words.join(' ') instead of creating a new var

This comment has been minimized.

Copy link
@VdustR

VdustR Dec 27, 2017

Author Member

fix e955e99

}
},
methods: {
insertChip ({ target }) {
if (!this.inputValue || !this.modelRespectLimit) {
let inputValue = this.formattedInputValue

This comment has been minimized.

Copy link
@marcosmoura

marcosmoura Dec 26, 2017

Member

Add a space before if statement

This comment has been minimized.

Copy link
@VdustR

VdustR Dec 27, 2017

Author Member

fix 79f4f41

@marcosmoura

This comment has been minimized.

Copy link
Member

commented Dec 26, 2017

Great idea! We can use this on autocomplete as well.
I just comment about some minor issues!

Thank you!

<div class="page-container-section">
<h2>Formatter</h2>

<p>There could be a rule to be followed by the inserted chips:</p>

This comment has been minimized.

Copy link
@marcosmoura

marcosmoura Dec 26, 2017

Member

A better message could be:
Sometimes you may need to format a chip value before adding it, and for this case you can use a custom formatter function. This function will receive the chip value and must return the formatted value.

This comment has been minimized.

Copy link
@VdustR

VdustR Dec 27, 2017

Author Member

fix 8a52166

@marcosmoura marcosmoura merged commit 247a840 into vuematerial:dev Jan 12, 2018

3 of 5 checks passed

codeclimate/diff-coverage 0% (50% threshold)
Details
codeclimate/total-coverage 34% (-0.1% change)
Details
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@VdustR VdustR deleted the VdustR:fix#1288 branch Jan 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.