Skip to content

Commit

Permalink
Bind groupseparator typehint to vi-select group separator
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleeckx committed Jan 31, 2017
1 parent c4d4e3b commit cd6560d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<template is="dom-if" if="[[editing]]">
<template is="dom-if" if="[[!radio]]">
<vi-persistent-object-attribute-edit attribute="[[attribute]]">
<vi-select content options="[[options]]" selected-option="{{value}}" readonly="[[readOnly]]" disabled="[[attribute.parent.isFrozen]]" placeholder="[[placeholder]]"></vi-select>
<vi-select content options="[[options]]" selected-option="{{value}}" readonly="[[readOnly]]" disabled="[[attribute.parent.isFrozen]]" placeholder="[[placeholder]]" group-separator="[[groupSeparator]]"></vi-select>
</vi-persistent-object-attribute-edit>
</template>
<template is="dom-if" if="[[radio]]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ namespace Vidyano.WebComponents.Attributes {
radio: {
type: Boolean,
computed: "_computeRadio(attribute)"
},
groupSeparator: {
type: String,
computed: "_computeGroupSeparator(attribute)"
}
}
})
Expand All @@ -19,6 +23,10 @@ namespace Vidyano.WebComponents.Attributes {
return attribute && attribute.getTypeHint("inputtype", undefined, undefined, true) === "radio";
}

private _computeGroupSeparator(attribute: Vidyano.PersistentObjectAttribute): string {
return attribute && attribute.getTypeHint("groupseparator", null, undefined, true);
}

private _isRadioChecked(option: string, value: string): boolean {
return option === value || (!option && !value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<template is="dom-if" if="[[editing]]">
<template is="dom-if" if="[[!radio]]">
<vi-persistent-object-attribute-edit attribute="[[attribute]]">
<vi-select content options="[[options]]" selected-option="{{value}}" readonly="[[readOnly]]" disabled="[[attribute.parent.isFrozen]]" placeholder="[[placeholder]]"></vi-select>
<vi-select content options="[[options]]" selected-option="{{value}}" readonly="[[readOnly]]" disabled="[[attribute.parent.isFrozen]]" placeholder="[[placeholder]]" group-separator="[[groupSeparator]]"></vi-select>
</vi-persistent-object-attribute-edit>
</template>
<template is="dom-if" if="[[radio]]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ namespace Vidyano.WebComponents.Attributes {
radio: {
type: Boolean,
computed: "_computeRadio(attribute)"
},
groupSeparator: {
type: String,
computed: "_computeGroupSeparator(attribute)"
}
}
})
Expand All @@ -19,6 +23,10 @@ namespace Vidyano.WebComponents.Attributes {
return attribute && attribute.getTypeHint("inputtype", undefined, undefined, true) === "radio";
}

private _computeGroupSeparator(attribute: Vidyano.PersistentObjectAttribute): string {
return attribute && attribute.getTypeHint("groupseparator", null, undefined, true);
}

private _isRadioChecked(option: Vidyano.Common.IKeyValuePair, value: string): boolean {
return option == null && value == null || (option && option.key === value);
}
Expand Down

0 comments on commit cd6560d

Please sign in to comment.