Skip to content

Commit

Permalink
feat(filter): added filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Arne Deruwe committed Jun 9, 2021
1 parent db73e2e commit 5f8380a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class KendoConfigBuilder {
.kendoDiagram()
.kendoDropDownTree()
.kendoEditor()
.kendoFilter()
.kendoFilterMenu()
.kendoGantt()
.kendoGrid()
Expand Down Expand Up @@ -270,6 +271,11 @@ export class KendoConfigBuilder {
return this;
}

kendoFilter(): KendoConfigBuilder {
this.resources.push(PLATFORM.moduleName('./filter/filter'));
return this;
}

kendoFilterMenu(): KendoConfigBuilder {
this.resources.push(PLATFORM.moduleName('./filter-menu/filter-menu'));
return this;
Expand Down
3 changes: 3 additions & 0 deletions src/filter/filter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<slot></slot>
</template>
56 changes: 56 additions & 0 deletions src/filter/filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { inject, Container } from 'aurelia-dependency-injection';
import { customElement, bindable } from 'aurelia-templating';
import { WidgetBase } from '../common/widget-base';
import { generateBindables } from '../common/decorators';
import { constants } from '../common/constants';

@customElement(`${constants.elementPrefix}filter`)
@generateBindables('kendoFilter')
@inject(Element, WidgetBase, Container)
export class Filter {
@bindable kEnabled;

constructor(element, widgetBase, container) {
this.element = element;
this.widgetBase = widgetBase
.control('kendoFilter')
.linkViewModel(this)
.useElement(this.element)
.useContainer(container);
}

subscribe(event, callback) {
return this.widgetBase.subscribe(event, callback);
}

bind(ctx, overrideCtx) {
this.widgetBase.useParentCtx(overrideCtx);
}

attached() {
if (!this.kNoInit) {
this.recreate();
}
}

recreate() {
this.kWidget = this.widgetBase.recreate();
}

propertyChanged(property, newValue, oldValue) {
this.widgetBase.handlePropertyChanged(
this.kWidget,
property,
newValue,
oldValue
);
}

destroy() {
this.widgetBase.destroy(this.kWidget);
}

detached() {
this.destroy();
}
}

0 comments on commit 5f8380a

Please sign in to comment.