@aurelia-mdc-web/select
Version:
Wrapper for Material Components Web Select
39 lines • 1.74 kB
JavaScript
import { PLATFORM, bindingMode, EventSubscriber } from 'aurelia-framework';
import { MdcComponentAdapters } from '@aurelia-mdc-web/base';
import { strings } from '@material/select';
import { MdcSelectValueObserver } from './mdc-select-value-observer';
import { MdcDefaultSelectConfiguration } from './mdc-default-select-configuration';
export { MdcSelect } from './mdc-select';
export { MdcDefaultSelectConfiguration };
export function configure(frameworkConfig, callback) {
frameworkConfig.container.get(MdcComponentAdapters).registerMdcElementConfig(selectConfig);
frameworkConfig.globalResources([
PLATFORM.moduleName('./mdc-select'),
PLATFORM.moduleName('./mdc-select-icon'),
PLATFORM.moduleName('./mdc-select-helper-text/mdc-select-helper-text')
]);
frameworkConfig.aurelia
.use
.plugin(PLATFORM.moduleName('@aurelia-mdc-web/floating-label'))
.plugin(PLATFORM.moduleName('@aurelia-mdc-web/line-ripple'))
.plugin(PLATFORM.moduleName('@aurelia-mdc-web/list'))
.plugin(PLATFORM.moduleName('@aurelia-mdc-web/menu'))
.plugin(PLATFORM.moduleName('@aurelia-mdc-web/notched-outline'))
.plugin(PLATFORM.moduleName('@aurelia-mdc-web/ripple'));
if (typeof callback === 'function') {
const config = frameworkConfig.container.get(MdcDefaultSelectConfiguration);
callback(config);
}
}
const selectConfig = {
tagName: 'mdc-select',
properties: {
value: {
defaultBindingMode: bindingMode.twoWay,
getObserver(element) {
return new MdcSelectValueObserver(element, new EventSubscriber([strings.CHANGE_EVENT]));
}
}
}
};
//# sourceMappingURL=index.js.map