Skip to content

Commit

Permalink
chore(all): prepare release 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Jun 29, 2016
1 parent 11fa631 commit 9abb0ab
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 162 deletions.
152 changes: 76 additions & 76 deletions dist/aurelia-materialize-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -1620,82 +1620,82 @@ export class MdScrollSpy {
}
}
@inject(Element, LogManager, BindingEngine, TaskQueue)
@customAttribute('md-select')
export class MdSelect {
@bindable() disabled = false;
_suspendUpdate = false;
subscriptions = [];
constructor(element, logManager, bindingEngine, taskQueue) {
this.element = element;
this.taskQueue = taskQueue;
this.handleChangeFromViewModel = this.handleChangeFromViewModel.bind(this);
this.handleChangeFromNativeSelect = this.handleChangeFromNativeSelect.bind(this);
this.log = LogManager.getLogger('md-select');
this.bindingEngine = bindingEngine;
}
attached() {
this.subscriptions.push(this.bindingEngine.propertyObserver(this.element, 'value').subscribe(this.handleChangeFromViewModel));
// this.subscriptions.push(this.bindingEngine.propertyObserver(this.element, 'selectedOptions').subscribe(this.notifyBindingEngine.bind(this)));
// $(this.element).material_select(() => {
// this.log.warn('materialize callback', $(this.element).val());
// this.handleChangeFromNativeSelect();
// });
$(this.element).material_select();
$(this.element).on('change', this.handleChangeFromNativeSelect);
}
detached() {
$(this.element).off('change', this.handleChangeFromNativeSelect);
$(this.element).material_select('destroy');
this.subscriptions.forEach(sub => sub.dispose());
}
refresh() {
this.taskQueue.queueTask(() => {
$(this.element).material_select('destroy');
$(this.element).material_select();
});
}
disabledChanged(newValue) {
let $wrapper = $(this.element).parent('.select-wrapper');
if ($wrapper.length > 0) {
if (newValue) {
$('.caret', $wrapper).addClass('disabled');
$('input.select-dropdown', $wrapper).attr('disabled', 'disabled');
$wrapper.attr('disabled', 'disabled');
} else {
$('.caret', $wrapper).removeClass('disabled');
$('input.select-dropdown', $wrapper).attr('disabled', null);
$wrapper.attr('disabled', null);
$('.select-dropdown', $wrapper).dropdown({'hover': false, 'closeOnClick': false});
}
}
}
notifyBindingEngine() {
this.log.debug('selectedOptions changed', arguments);
}
handleChangeFromNativeSelect() {
if (!this._suspendUpdate) {
this.log.debug('handleChangeFromNativeSelect', this.element.value, $(this.element).val());
this._suspendUpdate = true;
fireEvent(this.element, 'change');
this._suspendUpdate = false;
}
}
handleChangeFromViewModel(newValue) {
this.log.debug('handleChangeFromViewModel', newValue, $(this.element).val());
if (!this._suspendUpdate) {
$(this.element).material_select();
}
}
}
@inject(Element, LogManager, BindingEngine, TaskQueue)
@customAttribute('md-select')
export class MdSelect {
@bindable() disabled = false;
_suspendUpdate = false;
subscriptions = [];
constructor(element, logManager, bindingEngine, taskQueue) {
this.element = element;
this.taskQueue = taskQueue;
this.handleChangeFromViewModel = this.handleChangeFromViewModel.bind(this);
this.handleChangeFromNativeSelect = this.handleChangeFromNativeSelect.bind(this);
this.log = LogManager.getLogger('md-select');
this.bindingEngine = bindingEngine;
}
attached() {
this.subscriptions.push(this.bindingEngine.propertyObserver(this.element, 'value').subscribe(this.handleChangeFromViewModel));
// this.subscriptions.push(this.bindingEngine.propertyObserver(this.element, 'selectedOptions').subscribe(this.notifyBindingEngine.bind(this)));
// $(this.element).material_select(() => {
// this.log.warn('materialize callback', $(this.element).val());
// this.handleChangeFromNativeSelect();
// });
$(this.element).material_select();
$(this.element).on('change', this.handleChangeFromNativeSelect);
}
detached() {
$(this.element).off('change', this.handleChangeFromNativeSelect);
$(this.element).material_select('destroy');
this.subscriptions.forEach(sub => sub.dispose());
}
refresh() {
this.taskQueue.queueTask(() => {
$(this.element).material_select('destroy');
$(this.element).material_select();
});
}
disabledChanged(newValue) {
let $wrapper = $(this.element).parent('.select-wrapper');
if ($wrapper.length > 0) {
if (newValue) {
$('.caret', $wrapper).addClass('disabled');
$('input.select-dropdown', $wrapper).attr('disabled', 'disabled');
$wrapper.attr('disabled', 'disabled');
} else {
$('.caret', $wrapper).removeClass('disabled');
$('input.select-dropdown', $wrapper).attr('disabled', null);
$wrapper.attr('disabled', null);
$('.select-dropdown', $wrapper).dropdown({'hover': false, 'closeOnClick': false});
}
}
}
notifyBindingEngine() {
this.log.debug('selectedOptions changed', arguments);
}
handleChangeFromNativeSelect() {
if (!this._suspendUpdate) {
this.log.debug('handleChangeFromNativeSelect', this.element.value, $(this.element).val());
this._suspendUpdate = true;
fireEvent(this.element, 'change');
this._suspendUpdate = false;
}
}
handleChangeFromViewModel(newValue) {
this.log.debug('handleChangeFromViewModel', newValue, $(this.element).val());
if (!this._suspendUpdate) {
$(this.element).material_select();
}
}
}
@customAttribute('md-sidenav-collapse')
@inject(Element, ObserverLocator)
Expand Down
2 changes: 1 addition & 1 deletion dist/dev/dist/dev/select/select.js.map

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

Loading

0 comments on commit 9abb0ab

Please sign in to comment.