multiselect-combo-box
Advanced tools
Comparing version 2.5.0-beta to 2.5.0-beta.1
@@ -15,3 +15,3 @@ { | ||
"name": "multiselect-combo-box", | ||
"version": "2.5.0-beta", | ||
"version": "2.5.0-beta.1", | ||
"main": "multiselect-combo-box.js", | ||
@@ -18,0 +18,0 @@ "directories": { |
@@ -26,3 +26,3 @@ import {PolymerElement} from '@polymer/polymer/polymer-element.js'; | ||
<template is="dom-if" if="[[compactMode]]" restamp=""> | ||
<div part="compact-mode-label">[[_getCompactModeDisplayValue(items, items.*)]]</div> | ||
<div part="compact-mode-label">[[_getCompactModeLabel(items, items.*)]]</div> | ||
</template> | ||
@@ -33,3 +33,3 @@ | ||
<div part="token"> | ||
<div part="token-label">[[_getItemDisplayValue(item, itemLabelPath)]]</div> | ||
<div part="token-label">[[_getItemLabel(item, itemLabelPath)]]</div> | ||
<div part="token-remove-button" role="button" on-click="_removeToken"></div> | ||
@@ -113,6 +113,2 @@ </div> | ||
} | ||
_resolvePlaceholder(compactMode, placeholder) { | ||
return compactMode ? '' : placeholder; | ||
} | ||
} | ||
@@ -119,0 +115,0 @@ |
@@ -50,8 +50,8 @@ /** | ||
/** | ||
* Custom function for rendering the display value when in compact mode. | ||
* Custom function for generating the display label when in compact mode. | ||
* | ||
* This function receives the array of selected items and should return | ||
* a string value that will be used as the display value. | ||
* a string value that will be used as the display label. | ||
*/ | ||
compactModeValueRenderer: Function, | ||
compactModeLabelGenerator: Function, | ||
@@ -102,6 +102,6 @@ /** | ||
/** | ||
* Returns the item display value. | ||
* Returns the item display label. | ||
* @protected | ||
*/ | ||
_getItemDisplayValue(item, itemLabelPath) { | ||
_getItemLabel(item, itemLabelPath) { | ||
return item && item.hasOwnProperty(itemLabelPath) ? item[itemLabelPath] : item; | ||
@@ -111,8 +111,8 @@ } | ||
/** | ||
* Retrieves the component display value when in compact mode. | ||
* Retrieves the component display label when in compact mode. | ||
* @protected | ||
*/ | ||
_getCompactModeDisplayValue(items) { | ||
if (this.compactModeValueRenderer && typeof this.compactModeValueRenderer === 'function') { | ||
return this.compactModeValueRenderer(items); | ||
_getCompactModeLabel(items) { | ||
if (this.compactModeLabelGenerator && typeof this.compactModeLabelGenerator === 'function') { | ||
return this.compactModeLabelGenerator(items); | ||
} else { | ||
@@ -119,0 +119,0 @@ const suffix = (items.length === 0 || items.length > 1) ? 'values' : 'value'; |
@@ -116,3 +116,3 @@ import {PolymerElement} from '@polymer/polymer/polymer-element.js'; | ||
compact-mode="[[compactMode]]" | ||
compact-mode-value-renderer="[[compactModeValueRenderer]]" | ||
compact-mode-label-generator="[[compactModeLabelGenerator]]" | ||
on-item-removed="_handleItemRemoved" | ||
@@ -313,3 +313,3 @@ on-remove-all-items="_handleRemoveAllItems" | ||
'_templateOrRendererChanged(_itemTemplate, renderer)', | ||
'__observeOffsetHeight(errorMessage, invalid, label)' | ||
'_observeOffsetHeight(errorMessage, invalid, label)' | ||
]; | ||
@@ -349,3 +349,3 @@ } | ||
__observeOffsetHeight() { | ||
_observeOffsetHeight() { | ||
this._notifyResizeIfNeeded(); | ||
@@ -444,3 +444,3 @@ } | ||
return compactMode ? | ||
this._getCompactModeDisplayValue(selectedItems) : | ||
this._getCompactModeLabel(selectedItems) : | ||
this._getDisplayValue(selectedItems, itemLabelPath, readonlyValueSeparator); | ||
@@ -450,3 +450,3 @@ } | ||
_getDisplayValue(selectedItems, itemLabelPath, valueSeparator) { | ||
return selectedItems.map(item => this._getItemDisplayValue(item, itemLabelPath)).join(valueSeparator); | ||
return selectedItems.map(item => this._getItemLabel(item, itemLabelPath)).join(valueSeparator); | ||
} | ||
@@ -471,4 +471,4 @@ | ||
selectedItems.sort((item1, item2) => { | ||
const item1Str = String(this._getItemDisplayValue(item1, this.itemLabelPath)); | ||
const item2Str = String(this._getItemDisplayValue(item2, this.itemLabelPath)); | ||
const item1Str = String(this._getItemLabel(item1, this.itemLabelPath)); | ||
const item2Str = String(this._getItemLabel(item2, this.itemLabelPath)); | ||
return item1Str.localeCompare(item2Str); | ||
@@ -475,0 +475,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57056
1149