-
Notifications
You must be signed in to change notification settings - Fork 87
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
select: кастомные модификаторы и атрибуты для button #2080
Comments
Возможно моды |
Возможно стоит даже и базовый код button вынести в моду. block('select').elem('button')(
mode('button-mods')(function() {
var mods = this.mods;
return {
size : mods.size,
theme : mods.theme,
view : mods.view,
focused : mods.focused,
disabled : mods.disabled,
checked : mods.mode !== 'radio' && !!this._checkedOptions.length
}
}),
mode('button-attrs')(function() {
var mods = this.mods;
return {
role : 'listbox',
'aria-owns' : this._optionIds.join(' '),
'aria-multiselectable' : mods.mode === 'check'? 'true' : undefined,
'aria-labelledby' : this._selectTextId
},
}),
mode('button')(function() {
var select = this._select,
mods = this.mods;
return {
block : 'button',
mix : { block : this.block, elem : this.elem },
mods : apply('button-mods'),
attrs : apply('button-attrs'),
id : select.id,
tabIndex : select.tabIndex,
content : [
apply('content'),
{ block : 'icon', mix : { block : 'select', elem : 'tick' } }
]
};
}),
replace()(function() {
return apply('button');
}),
def()(function() {
return applyNext({ _selectTextId : this.generateId() });
})
); |
Пример использования: block('select').mod('prefixed')(
def()((node, ctx) => {
return applyNext({
_textPrefix : ctx.textPrefix
});
}),
elem('button')(
mode('button-mods')((node) => {
return node.extend(applyNext(), { prefixed : true });
}),
mode('button')((node) => {
return node.extend(applyNext(), { textPrefix : node._textPrefix });
})
)
); |
veged
changed the title
Select кастомные модификаторы и атрибуты для button
Select: кастомные модификаторы и атрибуты для button
Mar 22, 2018
veged
changed the title
Select: кастомные модификаторы и атрибуты для button
select: кастомные модификаторы и атрибуты для button
Mar 22, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Полезно для переопределения на проекте как-то так.
@veged @tadatuta
The text was updated successfully, but these errors were encountered: