From 36a873ba7d1115bf175c2e5eb55e595bf11374c3 Mon Sep 17 00:00:00 2001 From: ctwoolsey Date: Thu, 22 Dec 2022 12:12:57 +0100 Subject: [PATCH] updated autocomplete multiple to return EmberArray (#26) --- .github/workflows/{ci.yml => ci.yml.dont.use} | 0 README.md | 3 ++- addon/components/r-paper-autocomplete.js | 12 ++++++++++-- package.json | 6 +++--- 4 files changed, 15 insertions(+), 6 deletions(-) rename .github/workflows/{ci.yml => ci.yml.dont.use} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml.dont.use similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/ci.yml.dont.use diff --git a/README.md b/README.md index 2587624..b49590c 100644 --- a/README.md +++ b/README.md @@ -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 `
  • ` element. diff --git a/addon/components/r-paper-autocomplete.js b/addon/components/r-paper-autocomplete.js index 7fe73c8..223de48 100644 --- a/addon/components/r-paper-autocomplete.js +++ b/addon/components/r-paper-autocomplete.js @@ -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; diff --git a/package.json b/package.json index 1482556..fc10048 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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",