Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ch34109]Remove user prefix #183

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@unicef-polymer/etools-dropdown",
"description": "Polymer 3 dropdown element with searchable options, single and multiple selection",
"version": "5.0.1",
"version": "5.1.0-rc.1",
"homepage": "https://github.com/unicef-polymer/etools-dropdown",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src_ts/EtoolsDropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export class EtoolsDropdown extends CommonFunctionalityMixin(MissingOptionsMixin
@show-more="${this.onShowMore}"
@shown-options="${this.onShownOptions}"
.language="${this.language}"
?unprefix-name="${this.unprefixName}"
></esmm-options-list>
</div>
</iron-dropdown>
Expand Down
2 changes: 2 additions & 0 deletions src_ts/EtoolsDropdownMulti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class EtoolsDropdownMulti extends CommonFunctionalityMixin(MissingOptions
.openMenu="${this._openMenu}"
.onInputFocus="${this.onInputFocus}"
exportparts="esmm-label-container, esmm-label, esmm-label-suffix"
?unprefix-name="${this.unprefixName}"
>
<span slot="input-label-suffix">
<slot name="label-suffix"></slot>
Expand Down Expand Up @@ -147,6 +148,7 @@ export class EtoolsDropdownMulti extends CommonFunctionalityMixin(MissingOptions
@show-more="${this.onShowMore}"
@shown-options="${this.onShownOptions}"
.language="${this.language}"
?unprefix-name="${this.unprefixName}"
>
</esmm-options-list>
<span
Expand Down
11 changes: 11 additions & 0 deletions src_ts/mixins/list-item-utils-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export const ListItemUtilsMixin = dedupeMixin(<T extends MixinTarget<LitElement>
@property({type: String, attribute: 'language'})
language!: string;

@property({type: Boolean, attribute: 'unprefix-name'})
unprefixName = false;

/**
* Get option primary label. All chars until `|` .
* @param label
Expand All @@ -48,6 +51,10 @@ export const ListItemUtilsMixin = dedupeMixin(<T extends MixinTarget<LitElement>
if (this.capitalize) {
l = this._capitalizeString(l);
}

if (this.unprefixName && label && label.lastIndexOf(']') > 0) {
label = label.substring(label.lastIndexOf(']') + 1);
}
}
return l;
}
Expand Down Expand Up @@ -98,6 +105,10 @@ export const ListItemUtilsMixin = dedupeMixin(<T extends MixinTarget<LitElement>
// capitalize label
label = this._capitalizeString(label);
}

if (this.unprefixName && label && label.lastIndexOf(']') > 0) {
label = label.substring(label.lastIndexOf(']') + 1);
}
}
return label;
}
Expand Down