diff --git a/HISTORY.md b/HISTORY.md index b3104acc..08f2efbf 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +# v4.8.0 + +- Added a new property to make the number of selected values used in the trigger label variable. +- The new property is `display-value-count` and its default value is `1`, which is the current default behaviour. + # v4.7.10 - Added read-only and disabled-viewable properties to px-dropdown. diff --git a/bower.json b/bower.json index a5017f4d..2ff665be 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "px-dropdown", - "version": "4.7.10", + "version": "4.8.0", "main": [ "px-dropdown.html" ], diff --git a/demo/simple_demo.html b/demo/simple_demo.html index aa67216b..a739fa96 100644 --- a/demo/simple_demo.html +++ b/demo/simple_demo.html @@ -14,7 +14,7 @@ limitations under the License. --> - +
@@ -91,7 +91,9 @@ hoist read-only container-type="bar" - selected-values='["2","5"]' + display-value-count="3" + select-by="key" + selected-values='["1","2","3"]' items='[{"key":"1","val":"iPhone"},{"key":"2","val":"Android"},{"key":"3","val":"Blackberry"},{"key":"4","val":"Windows Windows Windows Windows Windows Windows Windows Phone"},{"key":"5","val":"Flip Phone","disabled":true}]' multi> @@ -135,16 +137,4 @@ - - diff --git a/package-lock.json b/package-lock.json index 69896219..5007ed02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "px-dropdown", - "version": "4.7.10", + "version": "4.7.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3408e102..0139524f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "px-dropdown", "author": "General Electric", "description": "A Predix UI Dropdown component", - "version": "4.7.10", + "version": "4.8.0", "extName": null, "repository": { "type": "git", diff --git a/px-dropdown-api.json b/px-dropdown-api.json index 2137259d..44145921 100644 --- a/px-dropdown-api.json +++ b/px-dropdown-api.json @@ -2337,15 +2337,15 @@ }, { "name": "_handleSelection", - "description": "Handles the selection event from iron-selector to update\nthe label displayed inside the dropdown.", + "description": "Handles the selection event from iron-selector to update\nthe label displayed inside the dropdown. Use the displayValueCount property to define how many values\nare displayed in the trigger value of multiple select lists", "privacy": "protected", "sourceRange": { "start": { - "line": 587, + "line": 588, "column": 4 }, "end": { - "line": 614, + "line": 617, "column": 5 } }, @@ -2362,11 +2362,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 619, + "line": 622, "column": 4 }, "end": { - "line": 645, + "line": 650, "column": 5 } }, @@ -2383,11 +2383,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 649, + "line": 654, "column": 4 }, "end": { - "line": 651, + "line": 656, "column": 5 } }, @@ -2400,11 +2400,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 656, + "line": 661, "column": 4 }, "end": { - "line": 666, + "line": 671, "column": 5 } }, @@ -2417,11 +2417,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 670, + "line": 675, "column": 4 }, "end": { - "line": 677, + "line": 682, "column": 5 } }, @@ -2447,11 +2447,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 681, + "line": 686, "column": 4 }, "end": { - "line": 686, + "line": 691, "column": 5 } }, @@ -2471,11 +2471,11 @@ "privacy": "private", "sourceRange": { "start": { - "line": 692, + "line": 697, "column": 4 }, "end": { - "line": 695, + "line": 700, "column": 5 } }, @@ -2488,11 +2488,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 700, + "line": 705, "column": 4 }, "end": { - "line": 724, + "line": 729, "column": 5 } }, @@ -2512,11 +2512,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 728, + "line": 733, "column": 4 }, "end": { - "line": 736, + "line": 741, "column": 5 } }, @@ -2529,11 +2529,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 740, + "line": 745, "column": 4 }, "end": { - "line": 746, + "line": 751, "column": 5 } }, @@ -2546,11 +2546,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 750, + "line": 755, "column": 4 }, "end": { - "line": 758, + "line": 763, "column": 5 } }, @@ -2570,11 +2570,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 762, + "line": 767, "column": 4 }, "end": { - "line": 847, + "line": 852, "column": 5 } }, @@ -2591,11 +2591,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 851, + "line": 856, "column": 4 }, "end": { - "line": 859, + "line": 864, "column": 5 } }, @@ -2612,11 +2612,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 863, + "line": 868, "column": 4 }, "end": { - "line": 865, + "line": 870, "column": 5 } }, @@ -2633,11 +2633,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 869, + "line": 874, "column": 4 }, "end": { - "line": 871, + "line": 876, "column": 5 } }, @@ -2663,11 +2663,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 875, + "line": 880, "column": 4 }, "end": { - "line": 877, + "line": 882, "column": 5 } }, @@ -2684,11 +2684,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 881, + "line": 886, "column": 4 }, "end": { - "line": 883, + "line": 888, "column": 5 } }, @@ -2711,11 +2711,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 884, + "line": 889, "column": 4 }, "end": { - "line": 886, + "line": 891, "column": 5 } }, @@ -2735,11 +2735,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 887, + "line": 892, "column": 4 }, "end": { - "line": 889, + "line": 894, "column": 5 } }, @@ -2759,11 +2759,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 890, + "line": 895, "column": 4 }, "end": { - "line": 892, + "line": 897, "column": 5 } }, @@ -2783,11 +2783,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 893, + "line": 898, "column": 4 }, "end": { - "line": 895, + "line": 900, "column": 5 } }, @@ -2811,7 +2811,7 @@ "column": 10 }, "end": { - "line": 896, + "line": 901, "column": 3 } }, @@ -3597,11 +3597,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 193, + "line": 194, "column": 6 }, "end": { - "line": 197, + "line": 198, "column": 7 } }, @@ -3619,11 +3619,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 201, + "line": 202, "column": 6 }, "end": { - "line": 204, + "line": 205, "column": 7 } }, @@ -3639,11 +3639,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 209, + "line": 210, "column": 6 }, "end": { - "line": 211, + "line": 212, "column": 7 } }, @@ -3658,11 +3658,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 216, + "line": 217, "column": 6 }, "end": { - "line": 219, + "line": 220, "column": 7 } }, @@ -3678,11 +3678,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 225, + "line": 226, "column": 6 }, "end": { - "line": 230, + "line": 231, "column": 7 } }, @@ -3694,6 +3694,28 @@ }, "defaultValue": "\"Select\"" }, + { + "name": "displayValueCount", + "type": "number", + "description": "The number of values to display as a comma separated string on multi select lists. \nSelections greater then this number will display as \"N Selected\"", + "privacy": "public", + "sourceRange": { + "start": { + "line": 236, + "column": 6 + }, + "end": { + "line": 240, + "column": 7 + } + }, + "metadata": { + "polymer": { + "observer": "\"_resetMinWidth\"" + } + }, + "defaultValue": "1" + }, { "name": "disableClear", "type": "boolean", @@ -3701,11 +3723,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 239, + "line": 249, "column": 6 }, "end": { - "line": 242, + "line": 252, "column": 7 } }, @@ -3721,11 +3743,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 246, + "line": 256, "column": 6 }, "end": { - "line": 249, + "line": 259, "column": 7 } }, @@ -3741,11 +3763,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 255, + "line": 265, "column": 6 }, "end": { - "line": 258, + "line": 268, "column": 7 } }, @@ -3761,11 +3783,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 264, + "line": 274, "column": 6 }, "end": { - "line": 267, + "line": 277, "column": 7 } }, @@ -3781,11 +3803,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 272, + "line": 282, "column": 6 }, "end": { - "line": 274, + "line": 284, "column": 7 } }, @@ -3800,11 +3822,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 289, + "line": 299, "column": 6 }, "end": { - "line": 295, + "line": 305, "column": 7 } }, @@ -3822,11 +3844,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 301, + "line": 311, "column": 6 }, "end": { - "line": 304, + "line": 314, "column": 7 } }, @@ -3842,11 +3864,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 309, + "line": 319, "column": 6 }, "end": { - "line": 312, + "line": 322, "column": 7 } }, @@ -3862,11 +3884,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 317, + "line": 327, "column": 6 }, "end": { - "line": 321, + "line": 331, "column": 7 } }, @@ -3884,11 +3906,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 326, + "line": 336, "column": 6 }, "end": { - "line": 329, + "line": 339, "column": 7 } }, @@ -3905,11 +3927,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 333, + "line": 343, "column": 6 }, "end": { - "line": 339, + "line": 349, "column": 7 } }, @@ -3927,11 +3949,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 345, + "line": 355, "column": 6 }, "end": { - "line": 348, + "line": 358, "column": 7 } }, @@ -3947,11 +3969,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 353, + "line": 363, "column": 6 }, "end": { - "line": 356, + "line": 366, "column": 7 } }, @@ -3967,11 +3989,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 360, + "line": 370, "column": 6 }, "end": { - "line": 363, + "line": 373, "column": 7 } }, @@ -3987,11 +4009,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 367, + "line": 377, "column": 6 }, "end": { - "line": 370, + "line": 380, "column": 7 } }, @@ -4007,11 +4029,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 375, + "line": 385, "column": 6 }, "end": { - "line": 378, + "line": 388, "column": 7 } }, @@ -4027,11 +4049,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 383, + "line": 393, "column": 6 }, "end": { - "line": 386, + "line": 396, "column": 7 } }, @@ -4047,11 +4069,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 392, + "line": 402, "column": 6 }, "end": { - "line": 394, + "line": 404, "column": 7 } }, @@ -4066,11 +4088,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 400, + "line": 410, "column": 6 }, "end": { - "line": 403, + "line": 413, "column": 7 } }, @@ -4086,11 +4108,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 411, + "line": 421, "column": 6 }, "end": { - "line": 414, + "line": 424, "column": 7 } }, @@ -4106,11 +4128,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 419, + "line": 429, "column": 6 }, "end": { - "line": 422, + "line": 432, "column": 7 } }, @@ -4126,11 +4148,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 427, + "line": 437, "column": 6 }, "end": { - "line": 430, + "line": 440, "column": 7 } }, @@ -4146,11 +4168,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 436, + "line": 446, "column": 6 }, "end": { - "line": 439, + "line": 449, "column": 7 } }, @@ -4166,11 +4188,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 445, + "line": 455, "column": 6 }, "end": { - "line": 448, + "line": 458, "column": 7 } }, @@ -4186,11 +4208,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 455, + "line": 465, "column": 6 }, "end": { - "line": 458, + "line": 468, "column": 7 } }, @@ -4206,11 +4228,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 465, + "line": 475, "column": 6 }, "end": { - "line": 468, + "line": 478, "column": 7 } }, @@ -4226,11 +4248,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 473, + "line": 483, "column": 6 }, "end": { - "line": 476, + "line": 486, "column": 7 } }, @@ -4245,11 +4267,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 480, + "line": 490, "column": 6 }, "end": { - "line": 483, + "line": 493, "column": 7 } }, @@ -4265,11 +4287,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 488, + "line": 498, "column": 6 }, "end": { - "line": 491, + "line": 501, "column": 7 } }, @@ -4285,11 +4307,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 499, + "line": 509, "column": 6 }, "end": { - "line": 502, + "line": 512, "column": 7 } }, @@ -4305,11 +4327,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 503, + "line": 513, "column": 6 }, "end": { - "line": 506, + "line": 516, "column": 7 } }, @@ -4325,11 +4347,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 511, + "line": 521, "column": 6 }, "end": { - "line": 522, + "line": 532, "column": 7 } }, @@ -4345,11 +4367,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 526, + "line": 536, "column": 6 }, "end": { - "line": 531, + "line": 541, "column": 7 } }, @@ -4364,11 +4386,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 536, + "line": 546, "column": 6 }, "end": { - "line": 538, + "line": 548, "column": 7 } }, @@ -4383,11 +4405,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 543, + "line": 553, "column": 6 }, "end": { - "line": 546, + "line": 556, "column": 7 } }, @@ -4403,11 +4425,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 550, + "line": 560, "column": 6 }, "end": { - "line": 553, + "line": 563, "column": 7 } }, @@ -4424,11 +4446,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 555, + "line": 565, "column": 4 }, "end": { - "line": 567, + "line": 577, "column": 5 } }, @@ -4441,11 +4463,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 568, + "line": 578, "column": 4 }, "end": { - "line": 576, + "line": 586, "column": 5 } }, @@ -4458,11 +4480,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 577, + "line": 587, "column": 4 }, "end": { - "line": 579, + "line": 589, "column": 5 } }, @@ -4718,11 +4740,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 580, + "line": 590, "column": 4 }, "end": { - "line": 582, + "line": 592, "column": 5 } }, @@ -4735,11 +4757,11 @@ "privacy": "public", "sourceRange": { "start": { - "line": 587, + "line": 597, "column": 4 }, "end": { - "line": 592, + "line": 602, "column": 5 } }, @@ -4752,11 +4774,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 601, + "line": 611, "column": 4 }, "end": { - "line": 616, + "line": 626, "column": 5 } }, @@ -4773,11 +4795,11 @@ "privacy": "protected", "sourceRange": { "start": { - "line": 620, + "line": 630, "column": 4 }, "end": { - "line": 626, + "line": 636, "column": 5 } }, @@ -4795,11 +4817,11 @@ "metadata": {}, "sourceRange": { "start": { - "line": 180, + "line": 181, "column": 10 }, "end": { - "line": 639, + "line": 649, "column": 3 } }, @@ -4829,11 +4851,11 @@ "description": "A flag which reflects if the dropdown trigger has been clicked or not.", "sourceRange": { "start": { - "line": 193, + "line": 194, "column": 6 }, "end": { - "line": 197, + "line": 198, "column": 7 } }, @@ -4845,11 +4867,11 @@ "description": "Whether or not to hide the chevron icon from the dropdown.", "sourceRange": { "start": { - "line": 201, + "line": 202, "column": 6 }, "end": { - "line": 204, + "line": 205, "column": 7 } }, @@ -4861,11 +4883,11 @@ "description": "A CSS selector which specifies the bounding target the dropdown will be\ndisplayed within. Defaults to `window`.", "sourceRange": { "start": { - "line": 209, + "line": 210, "column": 6 }, "end": { - "line": 211, + "line": 212, "column": 7 } }, @@ -4877,11 +4899,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": 216, + "line": 217, "column": 6 }, "end": { - "line": 219, + "line": 220, "column": 7 } }, @@ -4893,27 +4915,43 @@ "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": 225, + "line": 226, "column": 6 }, "end": { - "line": 230, + "line": 231, "column": 7 } }, "metadata": {}, "type": "string" }, + { + "name": "display-value-count", + "description": "The number of values to display as a comma separated string on multi select lists. \nSelections greater then this number will display as \"N Selected\"", + "sourceRange": { + "start": { + "line": 236, + "column": 6 + }, + "end": { + "line": 240, + "column": 7 + } + }, + "metadata": {}, + "type": "number" + }, { "name": "disable-clear", "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": 239, + "line": 249, "column": 6 }, "end": { - "line": 242, + "line": 252, "column": 7 } }, @@ -4925,11 +4963,11 @@ "description": "If set to true, users can still open the dropdown but can not click on items", "sourceRange": { "start": { - "line": 246, + "line": 256, "column": 6 }, "end": { - "line": 249, + "line": 259, "column": 7 } }, @@ -4941,11 +4979,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": 255, + "line": 265, "column": 6 }, "end": { - "line": 258, + "line": 268, "column": 7 } }, @@ -4957,11 +4995,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": 264, + "line": 274, "column": 6 }, "end": { - "line": 267, + "line": 277, "column": 7 } }, @@ -4973,11 +5011,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": 289, + "line": 299, "column": 6 }, "end": { - "line": 295, + "line": 305, "column": 7 } }, @@ -4989,11 +5027,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": 301, + "line": 311, "column": 6 }, "end": { - "line": 304, + "line": 314, "column": 7 } }, @@ -5005,11 +5043,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": 309, + "line": 319, "column": 6 }, "end": { - "line": 312, + "line": 322, "column": 7 } }, @@ -5021,11 +5059,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": 317, + "line": 327, "column": 6 }, "end": { - "line": 321, + "line": 331, "column": 7 } }, @@ -5037,11 +5075,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": 326, + "line": 336, "column": 6 }, "end": { - "line": 329, + "line": 339, "column": 7 } }, @@ -5053,11 +5091,11 @@ "description": "A read-only array of the selected `