From 5fb917c14a03610c7507cd8c80909656c0bca3a3 Mon Sep 17 00:00:00 2001 From: Aron Graham Date: Wed, 2 Jan 2019 12:36:29 +1000 Subject: [PATCH 1/7] added read-only property to disable user interactions on items #79 --- HISTORY.md | 959 +++++++++++++++-------------- bower.json | 2 +- demo/simple_demo.html | 20 + package.json | 2 +- px-dropdown-api.json | 758 +++++++++++++---------- px-dropdown-content.html | 22 +- px-dropdown.html | 8 + test/px-dropdown-custom-tests.js | 39 +- test/px-dropdown-test-fixture.html | 7 + 9 files changed, 996 insertions(+), 821 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 18ea3dbe..b6bec41b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,547 +1,550 @@ -v4.7.9 -================== -* fix max-width of dropdown-trigger - -v4.7.8 -================== -* Removed id #searchbox from px-dropdown and used the class variable .search__box. -* This ensures no duplicate 'non-unique id' error that chrome console checks for. - -v4.7.6 -================== -* fix event documentation - -v4.7.5 -================== -* fix width inheritance of content on resize -* close dropdown when trigger tapped again - -v4.7.4 -================== -* fix width inheritance of content - -v4.7.3 -================== -* fix width inheritance - -v4.7.2 -================== -* revert all accidental sass changes from 4.7.0 - -v4.7.1 -================== -* fix mobile responsiveness - -v4.7.0 -================== -* add disable-truncate property for content items - -v4.6.0 -================== -* Adding px-overlay-content to optionally hoist content. -* px-dropdown was broken up into two sub components to facilitate hoisting. - * Adds JS to dynamically watch for a trigger element to be added to the trigger slot so we can avoid breaking the API. We can't just pass the trigger down because in v1 Shadow DOM slots passed down twice that are empty still wipe out any -default content. - * Refactor px-dropdown-content to just listen for click event emitting from the trigger - * Move all code that deals with items into px-dropdown-content to cleanly seperate concerns. px-dropdown is just a wrapper that connects the trigger and content together and passes properties and slotted content down. - -v4.5.4 -================== -* fixing demo pages for IE11 - -v4.5.3 -================== -* update demo to be clearer - -v4.5.2 -================== -* revert simple_demo change - -v4.5.1 -================== -* add min width/height vars for product-switcher - -v4.5.0 -================== -* add mobile responsiveness -* add caret and header/footer slots to support px-product-switcher - -v4.4.3 -================== -* update tests - -v4.4.2 -================== -* fix keyboard a11y - -v4.4.1 -================== -* fix icon size (#70) - -v4.4.0 -================== -* allow disableSelect on individual items - -v4.3.4 -================== -* fix v4.3.1 to work in Polymer 1 - -v4.3.3 -================== -* remove min btn width - -v4.3.2 -================== -* add disableSelect property for use in menus - -v4.3.1 -================== -* make _itemsChanged more flexible - -v4.3.0 -================== -* add app-localize-behavior (#68) - -v4.2.2 -================== -* fix sizing issues (#67) - -v4.2.1 -================== -* Add missing style var to docs - -v4.2.0 -================== -* Adds `trigger` slot to support developer-defined custom trigger, see docs for +# v4.7.10 + +- added read-only property to item list. user can see the items (not disabled) but can not click them. + +# v4.7.9 + +- fix max-width of dropdown-trigger + +# v4.7.8 + +- Removed id #searchbox from px-dropdown and used the class variable .search\_\_box. +- This ensures no duplicate 'non-unique id' error that chrome console checks for. + +# v4.7.6 + +- fix event documentation + +# v4.7.5 + +- fix width inheritance of content on resize +- close dropdown when trigger tapped again + +# v4.7.4 + +- fix width inheritance of content + +# v4.7.3 + +- fix width inheritance + +# v4.7.2 + +- revert all accidental sass changes from 4.7.0 + +# v4.7.1 + +- fix mobile responsiveness + +# v4.7.0 + +- add disable-truncate property for content items + +# v4.6.0 + +- Adding px-overlay-content to optionally hoist content. +- px-dropdown was broken up into two sub components to facilitate hoisting. + - Adds JS to dynamically watch for a trigger element to be added to the trigger slot so we can avoid breaking the API. We can't just pass the trigger down because in v1 Shadow DOM slots passed down twice that are empty still wipe out any + default content. + - Refactor px-dropdown-content to just listen for click event emitting from the trigger + - Move all code that deals with items into px-dropdown-content to cleanly seperate concerns. px-dropdown is just a wrapper that connects the trigger and content together and passes properties and slotted content down. + +# v4.5.4 + +- fixing demo pages for IE11 + +# v4.5.3 + +- update demo to be clearer + +# v4.5.2 + +- revert simple_demo change + +# v4.5.1 + +- add min width/height vars for product-switcher + +# v4.5.0 + +- add mobile responsiveness +- add caret and header/footer slots to support px-product-switcher + +# v4.4.3 + +- update tests + +# v4.4.2 + +- fix keyboard a11y + +# v4.4.1 + +- fix icon size (#70) + +# v4.4.0 + +- allow disableSelect on individual items + +# v4.3.4 + +- fix v4.3.1 to work in Polymer 1 + +# v4.3.3 + +- remove min btn width + +# v4.3.2 + +- add disableSelect property for use in menus + +# v4.3.1 + +- make \_itemsChanged more flexible + +# v4.3.0 + +- add app-localize-behavior (#68) + +# v4.2.2 + +- fix sizing issues (#67) + +# v4.2.1 + +- Add missing style var to docs + +# v4.2.0 + +- Adds `trigger` slot to support developer-defined custom trigger, see docs for more information -v4.1.0 -================== -* Polymer 1.x/2.x hybrid element support +# v4.1.0 + +- Polymer 1.x/2.x hybrid element support + +# v4.0.18 + +- fix demo + +# v4.0.17 + +- add device flags + +# v4.0.16 + +- remove web-animations (#62) + +# v4.0.15 + +- resolve version conflict for web-animations (#62) + +# v4.0.14 + +- add null check (#59) + +# v4.0.13 + +- expose variable to fix style of breadcrumbs + +# v4.0.12 + +- handle items changes correctly, new boolean + +# v4.0.11 + +- revert 4.0.10 + +# v4.0.10 + +- clear selections on items change + +# v4.0.9 + +- add support for icons in the dropdown + +# v4.0.8 + +- add missing style vars to docs + +# v4.0.7 + +- fix typo + +# v4.0.6 + +- add back px-dropdown-click event + +# v4.0.5 + +- Fix comment for analyzer + +# v4.0.4 + +- switch to px-utl:check icon + +# v4.0.3 + +- runtime theming for demo + +# v4.0.2 + +- update demo per design feedback + +# v4.0.1 + +- Changed how search icon is positioned + +# v4.0.0 + +- rebuild of the px-dropdown component using iron-dropdown and iron-selector +- added new icons +- code review fixes +- fix #50, #51, #52 +- add prop for disableClear + +# v3.1.1 + +- fix for failing FF unit test + +# v3.1.0 + +- merge PR #36 to add keyboard support + +# v3.0.0 + +- turned off new functionality from PR #32 by default + +# v2.5.1 (tag deleted) + +- fixed display issue with search box, added unit tests + +# v2.5.0 (tag deleted) + +- merge PR #32, add search and sort functionality + +# v2.4.5 + +- changed position back to relative, fixed demo + +# v2.4.4 + +- changed position to absolute + +# v2.4.3 + +- improved accessibility + +# v2.4.2 + +- fix disabled text color + +# v2.4.0 + +- added chevron css vars + +# v2.3.1 + +- remove old theming and remove shields from subcomponent + +# v2.3.0 + +- standardized style variable naming + +# v2.2.11 + +- fixed CodePen for subcomponent + +# v2.2.10 + +- updated usage documentation + +# v2.2.9 + +- Ensure tooltip is hidden when scrolling the dropdown content + +# v2.2.8 + +- Ensure click on checkboxes don't throw an error + +# v2.2.7 + +- Update demo with multiple pages + +# v2.2.6 + +- added new demo component + +# v2.2.5 + +- clear up checkbox-mode confusion from demo (#28) + +# v2.2.4 + +- Update colors design to pick up new colors + +# v2.2.3 + +- rebuild demo css + +# v2.2.2 + +- changing ghp.sh to account for Alpha releases + +# v2.2.1 + +- fixed event propogation per #26 + +# v2.2.0 + +- added capability to disable a dropdown item + +# v2.1.4 + +- added styles for validation classes from px-forms-design + +# v2.1.3 + +- fix missing comma in bower.json + +# v2.1.2 + +- updating dropdown styles to match spec and adding checkbox mode to demo + +# v2.1.1 + +- Updated iron-dropdown dependency + +# v2.1.0 + +- Updated dependencies + +# v2.0.8 + +- changing browser in wct testing from safari 8 to safari 10 on elcapitan + +# v2.0.7 + +- added --px-dropdown-text-color css var + +# v2.0.6 + +- changing all devDeps to ^ + +# v2.0.5 + +- Update px-theme to 2.0.1 and update test fixtures + +# v2.0.4 + +- removing px-theme style call + +# v2.0.3 + +- changing Gruntfile.js to gulpfile.js + +# v2.0.2 + +- fixed style variables for consistency + +# v2.0.1 + +- added the style header in the docs + +# v2.0.0 + +- added css variables, and changed previous ones to match the BEM naming. + +# v1.0.1 + +- bower updating px-demo-snippet + +# v1.0.0 + +- accepted PR that fixed multiple checkbox behavior and standardized event names + +# v0.13.0 + +- added property for disabled dropdown + +# v0.12.3 + +- Updated dependencies + +# v0.12.1 + +- Fixed dropdown-content demo + +# v0.12.0 + +- Uprev + +# v0.11.5 + +- fixed demo bug + +# v0.11.4 + +- removed the text and chevron demo pages, since they are internal, and made the components load with parentComponent, so they can work with codepen. + +# v0.11.3 + +- added parent-name to demo-snippet and changed over the polymer-font-awesome library + +# v0.11.2 + +- added other demo pages to vulcanize + +# v0.11.1 + +- updated demo bugs + +# v0.11.0 -v4.0.18 -================== -* fix demo +- Added 'selectedKey' attribute to dropdown, representing the key of the currently selected item -v4.0.17 -================== -* add device flags +# v0.10.5 -v4.0.16 -================== -* remove web-animations (#62) +- updated mega demo styles and bower px-demo-snippet to ^ -v4.0.15 -================== -* resolve version conflict for web-animations (#62) +# v0.10.4 -v4.0.14 -================== -* add null check (#59) +- added image to readme, removed watch, added view on github -v4.0.13 -================== -* expose variable to fix style of breadcrumbs +# v0.10.3 -v4.0.12 -================== -* handle items changes correctly, new boolean +- updated gh-pages script to vulcanize demo -v4.0.11 -================== -* revert 4.0.10 +# v0.10.1 -v4.0.10 -================== -* clear selections on items change +- Fix to make px-dropdown play with Angular nicely. Added Angular demo, also. -v4.0.9 -================== -* add support for icons in the dropdown +# v0.10.0 -v4.0.8 -================== -* add missing style vars to docs +- Upgrade to Polymer 1.5.0 -v4.0.7 -================== -* fix typo +# v0.9.9 -v4.0.6 -================== -* add back px-dropdown-click event +- Added --dropdown_content_margin to control the dropdown content margin -v4.0.5 -================== -* Fix comment for analyzer +# v0.9.8 -v4.0.4 -================== -* switch to px-utl:check icon +- Added --dropdown_text_padding to control text padding and make internal element use flex layout -v4.0.3 -================== -* runtime theming for demo +# v0.9.7 -v4.0.2 -================== -* update demo per design feedback +- up minor version on polymer font awesome -v4.0.1 -================== -* Changed how search icon is positioned +# v0.9.6 -v4.0.0 -================== -* rebuild of the px-dropdown component using iron-dropdown and iron-selector -* added new icons -* code review fixes -* fix #50, #51, #52 -* add prop for disableClear +- removed dependency on .px-dropdown-content class -v3.1.1 -================== -* fix for failing FF unit test +# v0.9.5 -v3.1.0 -================== -* merge PR #36 to add keyboard support +- added oss_notice to bower ignore -v3.0.0 -================== -* turned off new functionality from PR #32 by default +# v0.9.4 -v2.5.1 (tag deleted) -================== -* fixed display issue with search box, added unit tests +- added pull request test for travis and updated OSS Notice -v2.5.0 (tag deleted) -================== -* merge PR #32, add search and sort functionality +# v0.9.3 -v2.4.5 -================== -* changed position back to relative, fixed demo +- added auto github pages functionality -v2.4.4 -================== -* changed position to absolute +# v0.9.2 -v2.4.3 -================== -* improved accessibility +- Minor CSS text colour fix. -v2.4.2 -================== -* fix disabled text color +# v0.9.1 -v2.4.0 -================== -* added chevron css vars +- Fix bug where selecting an item having a tooltip would set the value and displayValue to this item + its tooltip -v2.3.1 -================== -* remove old theming and remove shields from subcomponent +# v0.9.0 -v2.3.0 -================== -* standardized style variable naming +- Upgrade to Polymer 1.4.0 -v2.2.11 -================== -* fixed CodePen for subcomponent +# v0.8.1 -v2.2.10 -================== -* updated usage documentation +- display-value attribute now notifies -v2.2.9 -================== -* Ensure tooltip is hidden when scrolling the dropdown content +# v0.8.0 -v2.2.8 -================== -* Ensure click on checkboxes don't throw an error +- Apply scroll lock only if content has vertical scroll bars +- added 'checkbox-mode' attribute on px-dropdown-content, allowing it to function as a list of items with checkboxes -v2.2.7 -================== -* Update demo with multiple pages +# v0.7.4 -v2.2.6 -================== -* added new demo component +- brought the default border color for dropdown. -v2.2.5 -================== -* clear up checkbox-mode confusion from demo (#28) +# v0.7.3 -v2.2.4 -================== -* Update colors design to pick up new colors +- Fix tooltip bug in datatable + v0.7.2 + ================ +- removed documentation from README, and replaced with link to github page, where cos are auto generated. -v2.2.3 -================== -* rebuild demo css +# v0.7.1 -v2.2.2 -================== -* changing ghp.sh to account for Alpha releases +- updated readme and added stopPropagation on internal events -v2.2.1 -================== -* fixed event propogation per #26 +# v0.7.0 -v2.2.0 -================== -* added capability to disable a dropdown item +- removed px-dropdown-lock-width +- added readonly 'value' attribute on dropdown, computed from display-value. Fire "change" event on dropdown when value changes -v2.1.4 -================== -* added styles for validation classes from px-forms-design +# v0.6.2 -v2.1.3 -================== -* fix missing comma in bower.json +- more data-table fixes. Fire px-dropdown-lock-width event when requiring a container to lock its width to the dropdown width. -v2.1.2 -================== -* updating dropdown styles to match spec and adding checkbox mode to demo +# v0.6.1 -v2.1.1 -================== -* Updated iron-dropdown dependency +- fix bug when embedded in data-table -v2.1.0 -================== -* Updated dependencies +# v0.6.0 -v2.0.8 -================== -* changing browser in wct testing from safari 8 to safari 10 on elcapitan +- fix firefox positioning bug +- added allow-outside-scroll attribute on px-dropdown-content. By default lock scrolling on the dropdown when open and prevent scrolling everywhere else. -v2.0.7 -================== -* added --px-dropdown-text-color css var +# v0.5.0 -v2.0.6 -================== -* changing all devDeps to ^ +- px-dropdown-text now already included in px-dropdown. Use display-value attribute on px-dropdown to set its text -v2.0.5 -================== -* Update px-theme to 2.0.1 and update test fixtures +# v0.4.1 -v2.0.4 -================== -* removing px-theme style call +- fixed Shadow Dom support +- fixed IE10 selected value bug +# v0.4.0 -v2.0.3 -================== -* changing Gruntfile.js to gulpfile.js +- new attribute on px-dropdown: prevent-close-on-outside-click. Default to false and dropdown now automatically closes on outside clicks -v2.0.2 -================== -* fixed style variables for consistency +# v0.3.0 -v2.0.1 -================== -* added the style header in the docs +- make it more obvious it is possible to scroll by reducing the height of the dropdown by half an item's height if the dropdown has scrollbars +- added bound-target attribute: if set the dropdown will always try to fit within this HTMLElement +- fixed setDivWidth on click function bug. -v2.0.0 -================== -* added css variables, and changed previous ones to match the BEM naming. +# v0.2.0 -v1.0.1 -================== -* bower updating px-demo-snippet +- changed the way the initial text is passed in (added attribute display-value) +- added a hide-chevron attribute +- Updated styles +- max container character count now also applies to the px-text portion of the component. -v1.0.0 -=============== -* accepted PR that fixed multiple checkbox behavior and standardized event names +# v0.1.0 -v0.13.0 -=============== -* added property for disabled dropdown +- added smart orientation which detects if the dropdown will show below the viewport, and display the dropdown above the element clicked. +- Updated styles/spacing/chevron +- removed the need to call px-dropdown-chevron - it's baked into the component now. -v0.12.3 -=============== -* Updated dependencies +# v0.0.3 -v0.12.1 -=============== -* Fixed dropdown-content demo +- Updated License -v0.12.0 -=============== -* Uprev +# v0.0.2 -v0.11.5 -=============== -* fixed demo bug +- added hover and opened styles/classes -v0.11.4 -=============== -* removed the text and chevron demo pages, since they are internal, and made the components load with parentComponent, so they can work with codepen. +# v0.0.1 -v0.11.3 -=============== -* added parent-name to demo-snippet and changed over the polymer-font-awesome library - -v0.11.2 -=============== -* added other demo pages to vulcanize - -v0.11.1 -=============== -* updated demo bugs - -v0.11.0 -=============== -* Added 'selectedKey' attribute to dropdown, representing the key of the currently selected item - -v0.10.5 -=============== -* updated mega demo styles and bower px-demo-snippet to ^ - -v0.10.4 -=============== -* added image to readme, removed watch, added view on github - -v0.10.3 -=============== -* updated gh-pages script to vulcanize demo - -v0.10.1 -=============== -* Fix to make px-dropdown play with Angular nicely. Added Angular demo, also. - -v0.10.0 -=============== -* Upgrade to Polymer 1.5.0 - -v0.9.9 -=============== -* Added --dropdown_content_margin to control the dropdown content margin - -v0.9.8 -=============== -* Added --dropdown_text_padding to control text padding and make internal element use flex layout - -v0.9.7 -=============== -* up minor version on polymer font awesome - -v0.9.6 -=============== -* removed dependency on .px-dropdown-content class - -v0.9.5 -=============== -* added oss_notice to bower ignore - -v0.9.4 -=============== -* added pull request test for travis and updated OSS Notice - -v0.9.3 -=============== -* added auto github pages functionality - -v0.9.2 -=============== -* Minor CSS text colour fix. - -v0.9.1 -=============== -* Fix bug where selecting an item having a tooltip would set the value and displayValue to this item + its tooltip - -v0.9.0 -=============== -* Upgrade to Polymer 1.4.0 - -v0.8.1 -================ -* display-value attribute now notifies - -v0.8.0 -================ -* Apply scroll lock only if content has vertical scroll bars -* added 'checkbox-mode' attribute on px-dropdown-content, allowing it to function as a list of items with checkboxes - -v0.7.4 -================ -* brought the default border color for dropdown. - -v0.7.3 -================ -* Fix tooltip bug in datatable -v0.7.2 -================ -* removed documentation from README, and replaced with link to github page, where cos are auto generated. - -v0.7.1 -================ -* updated readme and added stopPropagation on internal events - -v0.7.0 -================ -* removed px-dropdown-lock-width -* added readonly 'value' attribute on dropdown, computed from display-value. Fire "change" event on dropdown when value changes - -v0.6.2 -================ -* more data-table fixes. Fire px-dropdown-lock-width event when requiring a container to lock its width to the dropdown width. - -v0.6.1 -================ -* fix bug when embedded in data-table - -v0.6.0 -================= -* fix firefox positioning bug -* added allow-outside-scroll attribute on px-dropdown-content. By default lock scrolling on the dropdown when open and prevent scrolling everywhere else. - -v0.5.0 -================== -* px-dropdown-text now already included in px-dropdown. Use display-value attribute on px-dropdown to set its text - -v0.4.1 -================== -* fixed Shadow Dom support -* fixed IE10 selected value bug - -v0.4.0 -================== -* new attribute on px-dropdown: prevent-close-on-outside-click. Default to false and dropdown now automatically closes on outside clicks - -v0.3.0 -================== -* make it more obvious it is possible to scroll by reducing the height of the dropdown by half an item's height if the dropdown has scrollbars -* added bound-target attribute: if set the dropdown will always try to fit within this HTMLElement -* fixed setDivWidth on click function bug. - -v0.2.0 -================== -* changed the way the initial text is passed in (added attribute display-value) -* added a hide-chevron attribute -* Updated styles -* max container character count now also applies to the px-text portion of the component. - -v0.1.0 -================== -* added smart orientation which detects if the dropdown will show below the viewport, and display the dropdown above the element clicked. -* Updated styles/spacing/chevron -* removed the need to call px-dropdown-chevron - it's baked into the component now. - -v0.0.3 -================== -* Updated License - -v0.0.2 -================== -* added hover and opened styles/classes - -v0.0.1 -================== -* Initial release, px-dropdown supports receiving an array of items, and displays a dropdown list when either the text or the chevron are clicked. A click on the item itself fires off a "px-dropdown-click" event, and passed the click event with it. +- Initial release, px-dropdown supports receiving an array of items, and displays a dropdown list when either the text or the chevron are clicked. A click on the item itself fires off a "px-dropdown-click" event, and passed the click event with it. diff --git a/bower.json b/bower.json index a47e70ae..a5017f4d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "px-dropdown", - "version": "4.7.9", + "version": "4.7.10", "main": [ "px-dropdown.html" ], diff --git a/demo/simple_demo.html b/demo/simple_demo.html index e126fa3a..2bd5596e 100644 --- a/demo/simple_demo.html +++ b/demo/simple_demo.html @@ -51,8 +51,19 @@ items='[{"key":"1","val":"test test test test test test test test test test test test test test test test iPhone"},{"key":"2","val":"Android"},{"key":"3","val":"Blackberry"},{"key":"4","val":"I am a menu item so I cannot be selected","disableSelect":true},{"key":"5","val":"Flip Phone","disabled":true}]'>
+

Disabled Dropdown

+ + +

Multi Select

Disable Select (Like a Menu)


+

Set Items to Read Only

+ + +

Search Mode

` elements in the dropdown.", "sourceRange": { "start": { - "line": 237, + "line": 244, "column": 6 }, "end": { - "line": 240, + "line": 247, "column": 7 } }, @@ -2944,11 +2996,11 @@ "description": "By default, the dropdown will constrain scrolling on the page to\nitself when opened. Set to true in order to allow scrolling of\nthe page while the dropdown is open.", "sourceRange": { "start": { - "line": 246, + "line": 253, "column": 6 }, "end": { - "line": 248, + "line": 255, "column": 7 } }, @@ -2960,11 +3012,11 @@ "description": "Whether the dropdown should be disabled and non-interactive.", "sourceRange": { "start": { - "line": 252, + "line": 259, "column": 6 }, "end": { - "line": 254, + "line": 261, "column": 7 } }, @@ -2976,11 +3028,11 @@ "description": "If true, the dropdown will include a search box, whereby the\ndropdown items can be filtered with a search term.", "sourceRange": { "start": { - "line": 259, + "line": 266, "column": 6 }, "end": { - "line": 261, + "line": 268, "column": 7 } }, @@ -2992,11 +3044,11 @@ "description": "The value of the search box, used for filtering the dropdown\nitems when searchMode is true.", "sourceRange": { "start": { - "line": 266, + "line": 273, "column": 6 }, "end": { - "line": 269, + "line": 276, "column": 7 } }, @@ -3008,11 +3060,11 @@ "description": "What to sort the dropdown items by - one of \"key\" or \"val\".\nBy default, the items will be displayed in the order they are\npassed into the component.", "sourceRange": { "start": { - "line": 275, + "line": 282, "column": 6 }, "end": { - "line": 277, + "line": 284, "column": 7 } }, @@ -3024,11 +3076,11 @@ "description": "The height of the trigger element, used for calculating offset distance\nfor the dropdown. Set this value if you use the `trigger` slot.", "sourceRange": { "start": { - "line": 282, + "line": 289, "column": 6 }, "end": { - "line": 284, + "line": 291, "column": 7 } }, @@ -3040,11 +3092,11 @@ "description": "By default, the dropdown menu will be flush against the trigger.\nEnable this property to show a caret between the two. Useful\nin iconic menus and used by the application/product switcher.", "sourceRange": { "start": { - "line": 290, + "line": 297, "column": 6 }, "end": { - "line": 292, + "line": 299, "column": 7 } }, @@ -3056,11 +3108,11 @@ "description": "By default the dropdown will attempt to automatically align itself\nvertically and horizontally based on the available space. Set this flag\nto turn off that automatic behavior and force a certain `verticalAlign` / `horizontalAlign`.", "sourceRange": { "start": { - "line": 298, + "line": 305, "column": 6 }, "end": { - "line": 300, + "line": 307, "column": 7 } }, @@ -3072,11 +3124,11 @@ "description": "Vertical alignment of the dropdown relative to the trigger.\nShould be one of `top` or `bottom` where `top` means that the dropdown\nand trigger are aligned at the top, so the dropdown will extend _below_ the trigger.\nOverridden by dynamic alignment, unless `disableDynamicAlign` is true.", "sourceRange": { "start": { - "line": 307, + "line": 314, "column": 6 }, "end": { - "line": 309, + "line": 316, "column": 7 } }, @@ -3088,11 +3140,11 @@ "description": "Horizontal alignment of the dropdown relative to the trigger.\nShould be one of `left` or `right` where `left` means that the dropdown\nand trigger are aligned on their left side, so the dropdown will extend _to the right_.\nOverridden by dynamic alignment, unless `disableDynamicAlign` is true.", "sourceRange": { "start": { - "line": 316, + "line": 323, "column": 6 }, "end": { - "line": 318, + "line": 325, "column": 7 } }, @@ -3104,11 +3156,11 @@ "description": "Whether to display the mobile version of the dropdown, which appears as a fullscreen modal.\nAutomatically detected based on the breakpoint specified in `mobileAt`.", "sourceRange": { "start": { - "line": 323, + "line": 330, "column": 6 }, "end": { - "line": 326, + "line": 333, "column": 7 } }, @@ -3120,11 +3172,11 @@ "description": "The breakpoint (in # of pixels) at which to display the mobile version of px-dropdown.", "sourceRange": { "start": { - "line": 330, + "line": 337, "column": 6 }, "end": { - "line": 332, + "line": 339, "column": 7 } }, @@ -3136,11 +3188,11 @@ "description": "By default, the mobile dropdown will show Apply/Clear buttons.\nSet this property to hide them.", "sourceRange": { "start": { - "line": 337, + "line": 344, "column": 6 }, "end": { - "line": 339, + "line": 346, "column": 7 } }, @@ -3152,11 +3204,11 @@ "description": "Binding target for iron-a11y-keys", "sourceRange": { "start": { - "line": 373, + "line": 380, "column": 6 }, "end": { - "line": 375, + "line": 382, "column": 7 } }, @@ -3344,11 +3396,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 189, + "line": 190, "column": 6 }, "end": { - "line": 193, + "line": 194, "column": 7 } }, @@ -3366,11 +3418,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 197, + "line": 198, "column": 6 }, "end": { - "line": 200, + "line": 201, "column": 7 } }, @@ -3386,11 +3438,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 205, + "line": 206, "column": 6 }, "end": { - "line": 207, + "line": 208, "column": 7 } }, @@ -3405,11 +3457,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 212, + "line": 213, "column": 6 }, "end": { - "line": 215, + "line": 216, "column": 7 } }, @@ -3425,11 +3477,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 221, + "line": 222, "column": 6 }, "end": { - "line": 226, + "line": 227, "column": 7 } }, @@ -3448,11 +3500,31 @@ "privacy": "public", "sourceRange": { "start": { - "line": 235, + "line": 236, "column": 6 }, "end": { - "line": 238, + "line": 239, + "column": 7 + } + }, + "metadata": { + "polymer": {} + }, + "defaultValue": "false" + }, + { + "name": "readOnly", + "type": "boolean", + "description": "If set to true, users can still open the dropdown but can not click on items", + "privacy": "public", + "sourceRange": { + "start": { + "line": 243, + "column": 6 + }, + "end": { + "line": 246, "column": 7 } }, @@ -3468,11 +3540,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 244, + "line": 252, "column": 6 }, "end": { - "line": 247, + "line": 255, "column": 7 } }, @@ -3488,11 +3560,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 253, + "line": 261, "column": 6 }, "end": { - "line": 256, + "line": 264, "column": 7 } }, @@ -3508,11 +3580,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 261, + "line": 269, "column": 7 }, "end": { - "line": 263, + "line": 271, "column": 7 } }, @@ -3527,11 +3599,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 278, + "line": 286, "column": 6 }, "end": { - "line": 284, + "line": 292, "column": 7 } }, @@ -3549,11 +3621,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 290, + "line": 298, "column": 6 }, "end": { - "line": 293, + "line": 301, "column": 7 } }, @@ -3569,11 +3641,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 298, + "line": 306, "column": 6 }, "end": { - "line": 301, + "line": 309, "column": 7 } }, @@ -3589,11 +3661,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 306, + "line": 314, "column": 6 }, "end": { - "line": 310, + "line": 318, "column": 7 } }, @@ -3611,11 +3683,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 315, + "line": 323, "column": 6 }, "end": { - "line": 318, + "line": 326, "column": 7 } }, @@ -3632,11 +3704,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 322, + "line": 330, "column": 6 }, "end": { - "line": 328, + "line": 336, "column": 7 } }, @@ -3654,11 +3726,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 334, + "line": 342, "column": 6 }, "end": { - "line": 337, + "line": 345, "column": 7 } }, @@ -3674,11 +3746,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 342, + "line": 350, "column": 6 }, "end": { - "line": 345, + "line": 353, "column": 7 } }, @@ -3694,11 +3766,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 349, + "line": 357, "column": 6 }, "end": { - "line": 352, + "line": 360, "column": 7 } }, @@ -3714,11 +3786,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 357, + "line": 365, "column": 6 }, "end": { - "line": 360, + "line": 368, "column": 7 } }, @@ -3734,11 +3806,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 365, + "line": 373, "column": 6 }, "end": { - "line": 368, + "line": 376, "column": 7 } }, @@ -3754,11 +3826,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 374, + "line": 382, "column": 6 }, "end": { - "line": 376, + "line": 384, "column": 7 } }, @@ -3773,11 +3845,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 382, + "line": 390, "column": 6 }, "end": { - "line": 385, + "line": 393, "column": 7 } }, @@ -3793,11 +3865,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 393, + "line": 401, "column": 6 }, "end": { - "line": 396, + "line": 404, "column": 7 } }, @@ -3813,11 +3885,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 401, + "line": 409, "column": 6 }, "end": { - "line": 404, + "line": 412, "column": 7 } }, @@ -3833,11 +3905,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 409, + "line": 417, "column": 6 }, "end": { - "line": 412, + "line": 420, "column": 7 } }, @@ -3853,11 +3925,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 418, + "line": 426, "column": 6 }, "end": { - "line": 421, + "line": 429, "column": 7 } }, @@ -3873,11 +3945,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 427, + "line": 435, "column": 6 }, "end": { - "line": 430, + "line": 438, "column": 7 } }, @@ -3893,11 +3965,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 437, + "line": 445, "column": 6 }, "end": { - "line": 440, + "line": 448, "column": 7 } }, @@ -3913,11 +3985,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 447, + "line": 455, "column": 6 }, "end": { - "line": 450, + "line": 458, "column": 7 } }, @@ -3933,11 +4005,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 455, + "line": 463, "column": 6 }, "end": { - "line": 458, + "line": 466, "column": 7 } }, @@ -3952,11 +4024,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 462, + "line": 470, "column": 6 }, "end": { - "line": 465, + "line": 473, "column": 7 } }, @@ -3972,11 +4044,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 470, + "line": 478, "column": 6 }, "end": { - "line": 473, + "line": 481, "column": 7 } }, @@ -3992,11 +4064,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 481, + "line": 489, "column": 6 }, "end": { - "line": 484, + "line": 492, "column": 7 } }, @@ -4012,11 +4084,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 485, + "line": 493, "column": 6 }, "end": { - "line": 488, + "line": 496, "column": 7 } }, @@ -4032,11 +4104,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 493, + "line": 501, "column": 6 }, "end": { - "line": 504, + "line": 512, "column": 7 } }, @@ -4052,11 +4124,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 508, + "line": 516, "column": 6 }, "end": { - "line": 513, + "line": 521, "column": 7 } }, @@ -4071,11 +4143,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 518, + "line": 526, "column": 6 }, "end": { - "line": 520, + "line": 528, "column": 7 } }, @@ -4090,11 +4162,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 525, + "line": 533, "column": 6 }, "end": { - "line": 528, + "line": 536, "column": 7 } }, @@ -4110,11 +4182,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 532, + "line": 540, "column": 6 }, "end": { - "line": 535, + "line": 543, "column": 7 } }, @@ -4131,11 +4203,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 537, + "line": 545, "column": 4 }, "end": { - "line": 549, + "line": 557, "column": 5 } }, @@ -4148,11 +4220,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 550, + "line": 558, "column": 4 }, "end": { - "line": 558, + "line": 566, "column": 5 } }, @@ -4165,11 +4237,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 559, + "line": 567, "column": 4 }, "end": { - "line": 561, + "line": 569, "column": 5 } }, @@ -4425,11 +4497,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 562, + "line": 570, "column": 4 }, "end": { - "line": 564, + "line": 572, "column": 5 } }, @@ -4442,11 +4514,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 569, + "line": 577, "column": 4 }, "end": { - "line": 574, + "line": 582, "column": 5 } }, @@ -4459,11 +4531,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 583, + "line": 591, "column": 4 }, "end": { - "line": 598, + "line": 606, "column": 5 } }, @@ -4480,11 +4552,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 602, + "line": 610, "column": 4 }, "end": { - "line": 608, + "line": 616, "column": 5 } }, @@ -4502,11 +4574,11 @@ "metadata": {}, "sourceRange": { "start": { - "line": 176, + "line": 177, "column": 10 }, "end": { - "line": 621, + "line": 629, "column": 3 } }, @@ -4536,11 +4608,11 @@ "description": "A flag which reflects if the dropdown trigger has been clicked or not.", "sourceRange": { "start": { - "line": 189, + "line": 190, "column": 6 }, "end": { - "line": 193, + "line": 194, "column": 7 } }, @@ -4552,11 +4624,11 @@ "description": "Whether or not to hide the chevron icon from the dropdown.", "sourceRange": { "start": { - "line": 197, + "line": 198, "column": 6 }, "end": { - "line": 200, + "line": 201, "column": 7 } }, @@ -4568,11 +4640,11 @@ "description": "A CSS selector which specifies the bounding target the dropdown will be\ndisplayed within. Defaults to `window`.", "sourceRange": { "start": { - "line": 205, + "line": 206, "column": 6 }, "end": { - "line": 207, + "line": 208, "column": 7 } }, @@ -4584,11 +4656,11 @@ "description": "Whether the dropdown will close when a user clicks\noutside of it. Set to true to prevent dropdown from closing.", "sourceRange": { "start": { - "line": 212, + "line": 213, "column": 6 }, "end": { - "line": 215, + "line": 216, "column": 7 } }, @@ -4600,11 +4672,11 @@ "description": "The placeholder text to display in the dropdown. If the\nselected value(s) are cleared out, the displayValue will be\nreplaced in the dropdown.", "sourceRange": { "start": { - "line": 221, + "line": 222, "column": 6 }, "end": { - "line": 226, + "line": 227, "column": 7 } }, @@ -4616,11 +4688,27 @@ "description": "If set to true, users are unable to clear out the dropdown\nonce a selection has been made. Useful for required single-select\ndropdowns where an empty state would be undesirable. Not recommended\nfor multi-select dropdowns, as it means the user will simply lose the ability\nto quickly deselect all checked options (there is currently no mechanism\nwhich requires a user to select at least one option).", "sourceRange": { "start": { - "line": 235, + "line": 236, "column": 6 }, "end": { - "line": 238, + "line": 239, + "column": 7 + } + }, + "metadata": {}, + "type": "boolean" + }, + { + "name": "read-only", + "description": "If set to true, users can still open the dropdown but can not click on items", + "sourceRange": { + "start": { + "line": 243, + "column": 6 + }, + "end": { + "line": 246, "column": 7 } }, @@ -4632,11 +4720,11 @@ "description": "If set to true, users can still open the dropdown and click on items,\nbut they will not be selected. Use this property in use cases where\nthe dropdown is used as a menu instead of a form input.", "sourceRange": { "start": { - "line": 244, + "line": 252, "column": 6 }, "end": { - "line": 247, + "line": 255, "column": 7 } }, @@ -4648,11 +4736,11 @@ "description": "By default, dropdown items longer than the max-width of the dropdown\nwill be truncated, with the full string available on hover tooltip.\nIf this property is set, items will not be truncated, but will wrap instead.", "sourceRange": { "start": { - "line": 253, + "line": 261, "column": 6 }, "end": { - "line": 256, + "line": 264, "column": 7 } }, @@ -4664,11 +4752,11 @@ "description": "An array that contains the list of items which show up in the dropdown.\nEach item can either be a simple string, or an object consisting of:\n* 'key' - a unique identifier (number or string)\n* 'val' - the actual text that is displayed\n* 'disabled' - whether the item should be disabled completely - can't be selected nor used as a menu option (optional)\n* 'disableSelect` - whether the item should be disabled for selection, but can still be used as a menu option (optional)\n* 'selected' - whether the item should be selected at instantiation (optional)\n* 'icon' - an icon name from the px-icon-set to display next to the item (optional)\n* 'color' - the color to use for the icon - if not specified, the default text colors will be used (optional)\n\nNote: if you specify more than one item as `selected`, but `multi` is not enabled,\nonly the *first* selected item will be chosen. See also `clearSelectionsOnChange`.", "sourceRange": { "start": { - "line": 278, + "line": 286, "column": 6 }, "end": { - "line": 284, + "line": 292, "column": 7 } }, @@ -4680,11 +4768,11 @@ "description": "If set to true, multiple values can be selected in the dropdown.\nSelected values are reflected in the `selectedValues` property.\nIf set to false, a single selected value is reflected in `selected`.", "sourceRange": { "start": { - "line": 290, + "line": 298, "column": 6 }, "end": { - "line": 293, + "line": 301, "column": 7 } }, @@ -4696,11 +4784,11 @@ "description": "Which property of each dropdown item will be used to get/set\nthe selected items - should be one of \"key\" or \"val\".", "sourceRange": { "start": { - "line": 298, + "line": 306, "column": 6 }, "end": { - "line": 301, + "line": 309, "column": 7 } }, @@ -4712,11 +4800,11 @@ "description": "Gets or sets the selected item when `multi` is false.\nWill either be a single key or value based on `selectBy`.", "sourceRange": { "start": { - "line": 306, + "line": 314, "column": 6 }, "end": { - "line": 310, + "line": 318, "column": 7 } }, @@ -4728,11 +4816,11 @@ "description": "Gets or sets the selected items when `multi` is true.\nWill either be an array of keys or values based on `selectBy`.", "sourceRange": { "start": { - "line": 315, + "line": 323, "column": 6 }, "end": { - "line": 318, + "line": 326, "column": 7 } }, @@ -4744,11 +4832,11 @@ "description": "A read-only array of the selected `
` elements in the dropdown.", "sourceRange": { "start": { - "line": 322, + "line": 330, "column": 6 }, "end": { - "line": 328, + "line": 336, "column": 7 } }, @@ -4760,11 +4848,11 @@ "description": "By default, the dropdown will constrain scrolling on the page to\nitself when opened. Set to true in order to allow scrolling of\nthe page while the dropdown is open.", "sourceRange": { "start": { - "line": 334, + "line": 342, "column": 6 }, "end": { - "line": 337, + "line": 345, "column": 7 } }, @@ -4776,11 +4864,11 @@ "description": "Style for the button that invokes the dropdown.\nOne of 'default','bare','bare--primary', 'tertiary', or 'icon'.", "sourceRange": { "start": { - "line": 342, + "line": 350, "column": 6 }, "end": { - "line": 345, + "line": 353, "column": 7 } }, @@ -4792,11 +4880,11 @@ "description": "Whether the dropdown should be disabled and non-interactive.", "sourceRange": { "start": { - "line": 349, + "line": 357, "column": 6 }, "end": { - "line": 352, + "line": 360, "column": 7 } }, @@ -4808,11 +4896,11 @@ "description": "If true, the dropdown will include a search box, whereby the\ndropdown items can be filtered with a search term.", "sourceRange": { "start": { - "line": 357, + "line": 365, "column": 6 }, "end": { - "line": 360, + "line": 368, "column": 7 } }, @@ -4824,11 +4912,11 @@ "description": "The value of the search box, used for filtering the dropdown\nitems when searchMode is true.", "sourceRange": { "start": { - "line": 365, + "line": 373, "column": 6 }, "end": { - "line": 368, + "line": 376, "column": 7 } }, @@ -4840,11 +4928,11 @@ "description": "What to sort the dropdown items by - one of \"key\" or \"val\".\nBy default, the items will be displayed in the order they are\npassed into the component.", "sourceRange": { "start": { - "line": 374, + "line": 382, "column": 6 }, "end": { - "line": 376, + "line": 384, "column": 7 } }, @@ -4856,11 +4944,11 @@ "description": "If set to true, the display-value will always show up in the\ninvoking button of the dropdown. Useful in cases like the\npx-data-table, where \"Show/Hide Columns\" should always appear.", "sourceRange": { "start": { - "line": 382, + "line": 390, "column": 6 }, "end": { - "line": 385, + "line": 393, "column": 7 } }, @@ -4872,11 +4960,11 @@ "description": "If buttonStyle is set to 'icon' this property will dictate\nwhich icon will be displayed inside of the dropdown button.\nThe `displayValue`, selected values, and chevron will not be displayed.\nPerfect for icon-invoked menus. The value of this property should\nbe a valid px-icon name, e.g. 'px-utl:app-settings'", "sourceRange": { "start": { - "line": 393, + "line": 401, "column": 6 }, "end": { - "line": 396, + "line": 404, "column": 7 } }, @@ -4888,11 +4976,11 @@ "description": "Set this property if you would like the `selected` and `selectedValues`\nproperties to be cleared whenever mutations are made to the `items` array.", "sourceRange": { "start": { - "line": 401, + "line": 409, "column": 6 }, "end": { - "line": 404, + "line": 412, "column": 7 } }, @@ -4904,11 +4992,11 @@ "description": "The height of the trigger element, used for calculating offset distance\nfor the dropdown. Set this value if you use the `trigger` slot.", "sourceRange": { "start": { - "line": 409, + "line": 417, "column": 6 }, "end": { - "line": 412, + "line": 420, "column": 7 } }, @@ -4920,11 +5008,11 @@ "description": "By default, the dropdown menu will be flush against the trigger.\nEnable this property to show a caret between the two. Useful\nin iconic menus and used by the application/product switcher.", "sourceRange": { "start": { - "line": 418, + "line": 426, "column": 6 }, "end": { - "line": 421, + "line": 429, "column": 7 } }, @@ -4936,11 +5024,11 @@ "description": "By default the dropdown will attempt to automatically align itself\nvertically and horizontally based on the available space. Set this flag\nto turn off that automatic behavior and force a certain `verticalAlign` / `horizontalAlign`.", "sourceRange": { "start": { - "line": 427, + "line": 435, "column": 6 }, "end": { - "line": 430, + "line": 438, "column": 7 } }, @@ -4952,11 +5040,11 @@ "description": "Vertical alignment of the dropdown relative to the trigger.\nShould be one of `top` or `bottom` where `top` means that the dropdown\nand trigger are aligned at the top, so the dropdown will extend _below_ the trigger.\nOverridden by dynamic alignment, unless `disableDynamicAlign` is true.", "sourceRange": { "start": { - "line": 437, + "line": 445, "column": 6 }, "end": { - "line": 440, + "line": 448, "column": 7 } }, @@ -4968,11 +5056,11 @@ "description": "Horizontal alignment of the dropdown relative to the trigger.\nShould be one of `left` or `right` where `left` means that the dropdown\nand trigger are aligned on their left side, so the dropdown will extend _to the right_.\nOverridden by dynamic alignment, unless `disableDynamicAlign` is true.", "sourceRange": { "start": { - "line": 447, + "line": 455, "column": 6 }, "end": { - "line": 450, + "line": 458, "column": 7 } }, @@ -4984,11 +5072,11 @@ "description": "Whether to display the mobile version of the dropdown, which appears as a fullscreen modal.\nAutomatically detected based on the breakpoint specified in `mobileAt`.", "sourceRange": { "start": { - "line": 455, + "line": 463, "column": 6 }, "end": { - "line": 458, + "line": 466, "column": 7 } }, @@ -5000,11 +5088,11 @@ "description": "The breakpoint (in # of pixels) at which to display the mobile version of px-dropdown.", "sourceRange": { "start": { - "line": 462, + "line": 470, "column": 6 }, "end": { - "line": 465, + "line": 473, "column": 7 } }, @@ -5016,11 +5104,11 @@ "description": "By default, the mobile dropdown will show Apply/Clear buttons.\nSet this property to hide them.", "sourceRange": { "start": { - "line": 470, + "line": 478, "column": 6 }, "end": { - "line": 473, + "line": 481, "column": 7 } }, @@ -5032,11 +5120,11 @@ "description": "A valid IETF language tag as a string that `app-localize-behavior` will\nuse to localize this component.\n\nSee https://github.com/PolymerElements/app-localize-behavior for API\ndocumentation and more information.", "sourceRange": { "start": { - "line": 481, + "line": 489, "column": 6 }, "end": { - "line": 484, + "line": 492, "column": 7 } }, @@ -5048,11 +5136,11 @@ "description": "", "sourceRange": { "start": { - "line": 485, + "line": 493, "column": 6 }, "end": { - "line": 488, + "line": 496, "column": 7 } }, @@ -5064,11 +5152,11 @@ "description": "A dictionary of strings used within the component for AppLocalizeBehavior\nto use, based on the selected `language` property.", "sourceRange": { "start": { - "line": 493, + "line": 501, "column": 6 }, "end": { - "line": 504, + "line": 512, "column": 7 } }, @@ -5080,11 +5168,11 @@ "description": "Specifies if the dropdown content should get hoisted to a container in order to escape its current stacking context", "sourceRange": { "start": { - "line": 532, + "line": 540, "column": 6 }, "end": { - "line": 535, + "line": 543, "column": 7 } }, diff --git a/px-dropdown-content.html b/px-dropdown-content.html index c9454a72..85a1f854 100644 --- a/px-dropdown-content.html +++ b/px-dropdown-content.html @@ -166,6 +166,14 @@ disableSelect: { type: Boolean }, + /** + * If set, the items list will be in read only mode, the list is not disabled + * but the user can not click the items. Though like the disNo events are fired. + */ + readOnly: { + type: Boolean, + observer: '_setReadOnly' + }, /** * By default, dropdown items longer than the max-width of the dropdown * will be truncated, with the full string available on hover tooltip. @@ -548,8 +556,8 @@ * * @event px-dropdown-click */ - _handleActivate: function(evt) { - if(evt.detail.item.hasAttribute('disabled')) { + _handleActivate: function(evt) { + if(evt.detail.item.hasAttribute('disabled') || this.readOnly) { evt.preventDefault(); } else if (this.disableSelect || evt.detail.item.disableSelect) { @@ -703,6 +711,16 @@ return sortValue; }, + /** + * Adds the class that sets pointer-events = none to disable user interactions. + */ + _setReadOnly: function() { + if(this.readOnly) { + this.toggleClass('dropdown-option__item',true,Polymer.dom(this.$.dropdown).querySelector('.dropdown-content')); + } else { + this.toggleClass('dropdown-option__item',false,Polymer.dom(this.$.dropdown).querySelector('.dropdown-content')); + } + }, /** * Adds or removes the focused class for keyboard navigation. */ diff --git a/px-dropdown.html b/px-dropdown.html index 14529100..a4cf5440 100644 --- a/px-dropdown.html +++ b/px-dropdown.html @@ -150,6 +150,7 @@ bound-target="[[boundTarget]]" prevent-close-on-outside-click="[[preventCloseOnOutsideClick]]" disable-select="[[disableSelect]]" + read-only="[[readOnly]]" select-by="[[selectBy]]" selected="{{selected}}" selected-values="{{selectedValues}}" @@ -237,6 +238,13 @@ type: Boolean, value: false }, + /** + * If set to true, users can still open the dropdown but can not click on items + */ + readOnly: { + type: Boolean, + value: false + }, /** * If set to true, users can still open the dropdown and click on items, * but they will not be selected. Use this property in use cases where diff --git a/test/px-dropdown-custom-tests.js b/test/px-dropdown-custom-tests.js index 47476f3c..b2a4715d 100644 --- a/test/px-dropdown-custom-tests.js +++ b/test/px-dropdown-custom-tests.js @@ -291,7 +291,7 @@ describe("Custom Automation Tests for sort feature px-dropdown", function(done) }); }); - it("Sort mode: items can be sorted by values or keys", function(done) { + it("Sort mode: items can be sorted by keys", function(done) { let selector = px_dropdown.$.content.$.selector, divs = Polymer.dom(selector.root).querySelectorAll("div"); @@ -302,14 +302,14 @@ describe("Custom Automation Tests for sort feature px-dropdown", function(done) done(); }); - it("Sort mode: items can be sorted by values or keys", function(done) { + it("Sort mode: items can be sorted by values", function(done) { let selector = px_dropdown.$.content.$.selector, divs = Polymer.dom(selector.root).querySelectorAll("div"); assert.equal(divs[0].textContent.trim(), "Four"); - px_dropdown.sortMode = "key"; + px_dropdown.sortMode = "val"; divs = Polymer.dom(selector.root).querySelectorAll("div"); - assert.equal(divs[0].textContent.trim(), "One"); + assert.equal(divs[0].textContent.trim(), "Four"); done(); }); }); @@ -421,6 +421,37 @@ describe("Disabled element tests for px-dropdown", function(done) { done(); }); }); +describe("Read Only item tests for px-dropdown", function(done) { + let px_dropdown; + + beforeEach(function(done) { + px_dropdown = fixture("dropdown-readonly-element-fixture"); + flush(() => { + done(); + }); + }); + + it("When menu items set to read only the items can not be selected", function(done) { + (px_dropdown_content = px_dropdown.$.content.$.dropdown), + (px_dropdown_button = px_dropdown.$.trigger.$.trigger), + (dropdown_option = Polymer.dom( + px_dropdown.$.content.root + ).querySelectorAll(".dropdown-option")[1]); + + var item_click = function(e) { + assert.fail(null, null, "should not be able to select read only items"); + done(); + }; + px_dropdown_button.click(); + px_dropdown.addEventListener("px-dropdown-selection-changed", item_click); + dropdown_option.click(); + px_dropdown.removeEventListener( + "px-dropdown-selection-changed", + item_click + ); + done(); + }); +}); describe("Custom trigger tests for px-dropdown", function() { let px_dropdown; diff --git a/test/px-dropdown-test-fixture.html b/test/px-dropdown-test-fixture.html index 3d4f16a7..a2f9dce9 100644 --- a/test/px-dropdown-test-fixture.html +++ b/test/px-dropdown-test-fixture.html @@ -50,6 +50,13 @@ + + + +