Skip to content

Commit

Permalink
updated autocomplete multiple to return EmberArray (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctwoolsey authored Dec 22, 2022
1 parent 1559f90 commit 36a873b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ All properties of the `TextField` are available for the `TextField` component un

If `@nativeOnChange={{true}}`:
The `onChange` function will return the mui specified `(event, value, reason, details)`.
Otherwise, `@onChange` will return `(value)`.
Otherwise, `@onChange` will return `(value)`.
If `@multiple={{true}}` the `value` returned will be an `EmberArray`.

While options and groupings can all be set through passed arguments, it is possible if desired to customize the grouping headers or options.
By using `<:groupHeaders>` or `<:options>` those sections may be customized. Each customization must be wrapped within a `<li>` element.
Expand Down
12 changes: 10 additions & 2 deletions addon/components/r-paper-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,17 @@ export default class RPaperAutocompleteComponent extends BaseEmberPaperReact {
onChangeHandler(event, value, reason, details) {
if (this.args.onChange) {
if (this.args.nativeOnChange) {
return this.args.onChange(event, value, reason, details);
if (this.args.multiple) {
return this.args.onChange(event, A(value), reason, details);
} else {
return this.args.onChange(event, value, reason, details);
}
} else {
return this.args.onChange(value);
if (this.args.multiple) {
return this.args.onChange(A(value));
} else {
return this.args.onChange(value);
}
}
} else {
return null;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-paper-react",
"version": "4.0.0",
"version": "4.1.0",
"description": "An ember paper implementation built on react material-ui components",
"keywords": [
"ember-addon",
Expand Down Expand Up @@ -67,8 +67,8 @@
"@testing-library/react": "13.3.0",
"babel-eslint": "10.1.0",
"broccoli-asset-rev": "3.0.0",
"concurrently": "^7.6.0",
"ember-cli": "~4.9.1",
"concurrently": "7.6.0",
"ember-cli": "4.9.1",
"ember-cli-dependency-checker": "3.3.1",
"ember-cli-inject-live-reload": "2.1.0",
"ember-cli-sri": "2.1.1",
Expand Down

0 comments on commit 36a873b

Please sign in to comment.