angular-location-selector
Version:

572 lines (560 loc) • 29.2 kB
JavaScript
import { __decorate } from 'tslib';
import { EventEmitter, Input, Output, Component, ElementRef, HostListener, ChangeDetectorRef, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import { TreeViewModule } from '@progress/kendo-angular-treeview';
import { FormsModule } from '@angular/forms';
let AngularLocationSelectorComponent = class AngularLocationSelectorComponent {
constructor() {
this.type = "single";
this.selectedLocationId = null;
this.selectedLocationName = 'Select';
this.selectorDisabledLocation = false;
this.onChange = new EventEmitter();
}
ngOnInit() {
}
onLocationsFetched(locations) {
this.locationHierachy = locations;
}
updateLocationState(dataItem) {
this.onChange.emit(dataItem);
}
};
__decorate([
Input()
], AngularLocationSelectorComponent.prototype, "type", void 0);
__decorate([
Input()
], AngularLocationSelectorComponent.prototype, "labelText", void 0);
__decorate([
Input()
], AngularLocationSelectorComponent.prototype, "selectedLocationId", void 0);
__decorate([
Input()
], AngularLocationSelectorComponent.prototype, "selectedLocationName", void 0);
__decorate([
Input()
], AngularLocationSelectorComponent.prototype, "selectorDisabledLocation", void 0);
__decorate([
Input()
], AngularLocationSelectorComponent.prototype, "locationHierachy", void 0);
__decorate([
Input()
], AngularLocationSelectorComponent.prototype, "hoverText", void 0);
__decorate([
Output()
], AngularLocationSelectorComponent.prototype, "onChange", void 0);
AngularLocationSelectorComponent = __decorate([
Component({
selector: 'angular-location-selector',
template: "<location-single-selector *ngIf=\"type == 'single'\" labelText=\"{{labelText}}\" class=\"location-selector-view\" [locationHierachy]=\"locationHierachy\"\r\nisDisableParentClick=\"false\" selectedLocationId=\"{{selectedLocationId}}\" hoverText=\"{{hoverText}}\"\r\nselectedLocationName=\"{{selectedLocationName}}\" isIncludeFloatLocation=\"true\"\r\n(onLocationsData)=\"onLocationsFetched($event)\" [selectorDisabled]=\"selectorDisabledLocation\" [hideBranchLess]=\"true\"\r\n(onChange)=\"updateLocationState($event)\">\r\n</location-single-selector>\r\n\r\n<location-multi-selector *ngIf=\"type == 'multi'\" labelText=\"{{labelText}}\" class=\"location-selector-view\" [locationHierachy]=\"locationHierachy\"\r\nisDisableParentClick=\"false\" selectedLocationId=\"{{selectedLocationId}}\" hoverText=\"{{hoverText}}\"\r\nselectedLocationName=\"{{selectedLocationName}}\" isIncludeFloatLocation=\"true\"\r\n(onLocationsData)=\"onLocationsFetched($event)\" [selectorDisabled]=\"selectorDisabledLocation\" [hideBranchLess]=\"true\"\r\n(onChange)=\"updateLocationState($event)\">\r\n</location-multi-selector>"
})
], AngularLocationSelectorComponent);
let LocationMultiSelectorComponent = class LocationMultiSelectorComponent {
constructor(elementRef) {
this.elementRef = elementRef;
this.expandedKeys = [];
this.selectorOpened = false;
this.selectedLocationName = "Select";
this.selectedLocationId = 0;
this.isIncludeFloatLocation = true;
this.hideBranchLess = false;
this.includeInactive = false;
this.isDisableParentClick = false;
this.onChange = new EventEmitter();
this.page = "";
this.checkedKeys = [];
this.selectorDisabled = false;
this.onLocationsData = new EventEmitter();
this.selectedLocations = [];
}
ngOnInit() {
this.onLocationsData.emit(this.locationHierachy);
this.addExpandListItem(this.locationHierachy.locations);
this.setDefaultValue(this.checkedKeys, this.locationHierachy.locations);
}
onGlobalClick(event) {
if (!this.elementRef.nativeElement.contains(event.target)) {
// clicked outside => close dropdown list
this.selectorOpened = false;
}
}
closeDropDown() {
this.selectorOpened = false;
}
onItemSelected(data) {
this.selectorOpened = false;
}
setDefaultValue(checkedKeys, items) {
for (var i = 0; i < items.length; i++) {
if (checkedKeys.indexOf(items[i].locationId) > -1) {
if (items[i].isSelectable) {
this.selectedLocations.push(items[i]);
this.setDefaultValue(checkedKeys, items[i].items);
}
}
else {
this.setDefaultValue(checkedKeys, items[i].items);
}
}
}
addExpandListItem(treeItem) {
treeItem.forEach(item => {
if (item.items && item.items.length > 0) {
this.expandedKeys.push(item.locationId);
this.addExpandListItem(item.items);
}
});
}
handleChange(data) {
this.checkedKeys = data;
let locationsFlatArray = this.locationHierachy.locationsFlatData;
let selectedLocatonsArray = locationsFlatArray.filter(item => data.indexOf(item.locationId) !== -1);
this.selectedLocations = selectedLocatonsArray;
this.onChange.emit(this.selectedLocations);
}
locationClick() {
this.selectorOpened = !this.selectorOpened;
}
onRemove(item) {
const index = this.selectedLocations.findIndex((c) => c.locationId === item.locationId);
const checkedKeyIndex = this.checkedKeys.findIndex(k => k == item.locationId);
this.checkedKeys.splice(checkedKeyIndex, 1);
this.selectedLocations.splice(index, 1);
this.onChange.emit(this.selectedLocations);
}
};
LocationMultiSelectorComponent.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "selectedLocationName", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "selectedLocationId", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "labelText", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "hoverText", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "isIncludeFloatLocation", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "hideBranchLess", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "includeInactive", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "isDisableParentClick", void 0);
__decorate([
Output()
], LocationMultiSelectorComponent.prototype, "onChange", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "locationHierachy", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "page", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "checkedKeys", void 0);
__decorate([
Input()
], LocationMultiSelectorComponent.prototype, "selectorDisabled", void 0);
__decorate([
Output()
], LocationMultiSelectorComponent.prototype, "onLocationsData", void 0);
__decorate([
HostListener('document:mousedown', ['$event'])
], LocationMultiSelectorComponent.prototype, "onGlobalClick", null);
LocationMultiSelectorComponent = __decorate([
Component({
selector: 'location-multi-selector',
template: "<div class=\"row align-items-center\" (click)=\"closeDropDown()\">\r\n <div class=\"col-md-12\">\r\n <label *ngIf=\"labelText?.length > 0\">{{labelText}}</label>\r\n\r\n <div #menu class=\"d-flex justify-content-between location-selector-form\"\r\n [ngClass]=\"{'disableSelector':selectorDisabled,'location-selector-focus' : selectorOpened}\" id=\"ddlLocationy\"\r\n (click)=\"locationClick()\" [title]=\"hoverText\" (click)=\"$event.stopPropagation()\">\r\n <div >\r\n <span *ngIf=\"selectorDisabled && selectedLocations.length<1\">\r\n {{selectedLocationName}}\r\n </span>\r\n <span *ngIf=\"!selectorDisabled && selectedLocations.length<1\">\r\n Select\r\n </span>\r\n <kendo-chip *ngFor=\"let selectedLocation of selectedLocations.slice(0,3)\"\r\n [label]=\"selectedLocation.locationName\" removable=\"true\" removeIcon=\"k-icon k-i-close\"\r\n (remove)=\"onRemove(selectedLocation);\">\r\n </kendo-chip>\r\n </div>\r\n <div class=\"d-flex flex-column align-items-center ml-1\">\r\n <em class=\"fas fa-chevron-down\"></em>\r\n <span *ngIf=\"selectedLocations?.length >3\">+{{selectedLocations?.length-3}}\r\n </span>\r\n </div>\r\n </div>\r\n <div class=\"location-tree-wrapper p-2\" *ngIf=\"selectorOpened\" (click)=\"$event.stopPropagation()\">\r\n <location-multi-selector-tree-view [locations]=\"locationHierachy.locations\"\r\n [expandedKeys]=\"expandedKeys\" \r\n [selectedLocationId]=\"selectedLocationId\" [checkedKeys]=\"checkedKeys\" (onChange)=\"handleChange($event)\"\r\n (closeEvent)=\"onItemSelected($event)\">\r\n </location-multi-selector-tree-view>\r\n </div>\r\n </div>\r\n</div>",
styles: [":host ::ng-deep .location-selector-form{align-items:center;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;color:#495057;cursor:pointer;display:block;font-size:.9rem;height:auto;font-weight:400;line-height:1.5;padding:.2rem .4rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:300px}:host ::ng-deep .location-selector-focus{background-color:#fff;box-shadow:0 0 0 .2rem rgba(0,81,81,.1);color:#495057;outline:0}:host ::ng-deep .location-tree-wrapper{position:absolute;z-index:10}:host ::ng-deep .disableSelector{opacity:.6;pointer-events:none}.k-chip{color:#fff;margin:2px;background-color:#005151;float:left;border-radius:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.k-chip:last-child{max-width:230px}"]
})
], LocationMultiSelectorComponent);
let LocationMultiSelectorTreeViewComponent = class LocationMultiSelectorTreeViewComponent {
constructor(cdRef) {
this.cdRef = cdRef;
this.closeEvent = new EventEmitter();
this.onChange = new EventEmitter();
this.locationSelector = {
id: 0,
locationName: null,
locationCode: null,
utcoffsetInMinutes: 0,
locationTypeId: 0,
timezoneId: null,
timeZoneName: null,
dropDownDisabled: null,
lastLocationAutoWraupTime: null
};
// currently checked Tree view unique id
this.checkedKeys = [];
this.checkAll = true;
// Checking component
this.key = 'locationId';
}
ngOnChanges(changes) {
this.checkDefaultValue(changes.checkedKeys.currentValue, this.locations);
}
ngOnInit() {
this.checkDefaultValue(this.checkedKeys, this.locations);
this.onChange.emit(this.checkedKeys);
}
ngAfterContentInit() {
this.addExpandListItem(this.locations);
}
ngAfterViewInit() {
this.cdRef.detectChanges();
}
checkDefaultValue(checkedKeys, items) {
for (var i = 0; i < items.length; i++) {
if (checkedKeys.indexOf(items[i].locationId) > -1) {
if (items[i].isSelectable) {
items[i].isSelected = true;
this.checkDefaultValue(checkedKeys, items[i].items);
}
else {
items[i].isSelected = false;
}
}
else {
items[i].isSelected = false;
this.checkDefaultValue(checkedKeys, items[i].items);
}
}
}
handleCheck(dataItem) {
dataItem.isSelected = !dataItem.isSelected;
this.handleChildCheck(dataItem.items, dataItem.isSelected);
this.checkedKeys = [];
this.checkedKeys = this.getCheckedKeys(this.locations, this.checkedKeys);
this.onChange.emit(this.checkedKeys);
}
handleChildCheck(childItems, isSelected) {
for (var i = 0; i < childItems.length; i++) {
if (childItems[i].isSelectable) {
childItems[i].isSelected = isSelected;
this.handleChildCheck(childItems[i].items, isSelected);
}
}
}
unCheckAll(items) {
for (var i = 0; i < items.length; i++) {
if (items[i].isSelectable) {
items[i].isSelected = false;
this.unCheckAll(items[i].items);
}
}
}
getCheckedKeys(items, keys) {
for (var i = 0; i < items.length; i++) {
if (items[i].isSelected) {
keys.push(items[i].locationId);
}
keys = this.getCheckedKeys(items[i].items, keys);
}
return keys;
}
showClick(dataItem) {
var _a, _b, _c, _d, _e, _f, _g, _h;
this.locationSelector = {
id: (_a = dataItem) === null || _a === void 0 ? void 0 : _a.locationId,
locationName: (_b = dataItem) === null || _b === void 0 ? void 0 : _b.locationName,
locationCode: (_c = dataItem) === null || _c === void 0 ? void 0 : _c.locationCode,
locationTypeId: (_d = dataItem) === null || _d === void 0 ? void 0 : _d.locationTypeId,
utcoffsetInMinutes: (_e = dataItem) === null || _e === void 0 ? void 0 : _e.utcoffsetInMinutes,
timezoneId: (_f = dataItem) === null || _f === void 0 ? void 0 : _f.timezoneId,
timeZoneName: (_g = dataItem) === null || _g === void 0 ? void 0 : _g.timeZoneName,
dropDownDisabled: null,
lastLocationAutoWraupTime: (_h = dataItem) === null || _h === void 0 ? void 0 : _h.lastLocationAutoWraupTime
};
this.closeEvent.emit(this.locationSelector);
}
addExpandListItem(treeItem) {
treeItem.forEach(item => {
if (item.hasChild) {
this.addExpandListItem(item.items);
}
});
}
};
LocationMultiSelectorTreeViewComponent.ctorParameters = () => [
{ type: ChangeDetectorRef }
];
__decorate([
Input()
], LocationMultiSelectorTreeViewComponent.prototype, "expandedKeys", void 0);
__decorate([
Input()
], LocationMultiSelectorTreeViewComponent.prototype, "selectedLocationId", void 0);
__decorate([
Input()
], LocationMultiSelectorTreeViewComponent.prototype, "locations", void 0);
__decorate([
Output()
], LocationMultiSelectorTreeViewComponent.prototype, "closeEvent", void 0);
__decorate([
Output()
], LocationMultiSelectorTreeViewComponent.prototype, "onChange", void 0);
__decorate([
Input()
], LocationMultiSelectorTreeViewComponent.prototype, "checkedKeys", void 0);
LocationMultiSelectorTreeViewComponent = __decorate([
Component({
selector: 'location-multi-selector-tree-view',
template: "<kendo-treeview [nodes]=\"locations\" textField=\"locationName\" childrenField=\"items\" \r\n[(expandedKeys)]=\"expandedKeys\" expandBy=\"locationId\" \r\n[filterable]=\"true\" \r\n filterInputPlaceholder=\"Search\" kendoTreeViewExpandable \r\n kendoTreeViewHierarchyBinding>\r\n <ng-template kendoTreeViewNodeTemplate let-dataItem>\r\n <input [(ngModel)]=\"dataItem.isSelected\" (click)=\"handleCheck(dataItem)\" [disabled]=\"!dataItem.isSelectable\" class=\"k-checkbox\" type=\"checkbox\"\r\n kendoCheckBox /><span class=\"selectoritem\" (click)=\"handleCheck(dataItem)\" [ngClass]=\"{'disableNode': dataItem.isSelectable === false,'itemactive' : selectedLocationId == dataItem.locationId}\"> \r\n {{ dataItem.locationName }} \r\n </span>\r\n \r\n </ng-template>\r\n</kendo-treeview>\r\n",
styles: [":host ::ng-deep .k-checkbox{border-color:#000}:host ::ng-deep .k-textbox{width:100%;margin-bottom:8px}:host ::ng-deep .k-in.k-state-focused{box-shadow:none!important}:host ::ng-deep .selectoritem:hover{background-color:#005151;border-radius:3px;color:#fff;font-weight:500;cursor:default}:host ::ng-deep .k-treeview .k-icon{font-size:20px}:host ::ng-deep .k-treeview .k-in{padding:0;width:100%}:host ::ng-deep .selectoritem{padding:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}:host ::ng-deep .disableNode{opacity:.6;pointer-events:none}:host ::ng-deep .itemactive{color:#005151;font-weight:500}"]
})
], LocationMultiSelectorTreeViewComponent);
let LocationMultiSelectorModule = class LocationMultiSelectorModule {
};
LocationMultiSelectorModule = __decorate([
NgModule({
declarations: [
LocationMultiSelectorTreeViewComponent,
LocationMultiSelectorComponent
],
imports: [
CommonModule,
FormsModule,
ButtonsModule,
TreeViewModule
],
exports: [
LocationMultiSelectorComponent
],
entryComponents: [LocationMultiSelectorComponent]
})
], LocationMultiSelectorModule);
let LocationSingleSelectorComponent = class LocationSingleSelectorComponent {
constructor(elementRef) {
this.elementRef = elementRef;
this.expandedKeys = [];
this.selectorOpened = false;
this.disableSelector = false;
this.selectedLocationName = "Select";
this.selectedLocationId = 0;
this.isIncludeFloatLocation = true;
this.isDisableParentClick = false;
this.page = "";
this.hideBranchLess = false;
this.selectableTypes = []; // an array of location types to be made selectable
this.selectorDisabled = false;
this.onChange = new EventEmitter();
this.onLocationsData = new EventEmitter();
}
ngOnInit() {
this.onLocationsData.emit(this.locationHierachy);
if (this.selectableTypes.length > 0)
this.locationHierachy.locations[0] = this.makeSelectableByLocationType(this.locationHierachy.locations[0]);
if (this.locationHierachy.locations.length > 0 && this.locationHierachy.locations[0].items == null) {
this.disableSelector = true;
this.selectedLocationName = "No branches available";
}
else if (this.selectedLocationName == null && this.selectedLocationId != null) {
// if a location name is not passed in as an input, we set it using the locationId
this.selectedLocationName = this.locationHierachy.locationsFlatData.find(l => l.locationId == this.selectedLocationId).locationName;
}
this.addExpandListItem(this.locationHierachy.locations);
this.setDropDownState();
}
makeSelectableByLocationType(locations) {
locations.isSelectable = this.selectableTypes.includes(locations.locationTypeId);
if (locations.hasChild) {
locations.items.forEach(i => this.makeSelectableByLocationType(i));
}
return locations;
}
setDropDownState() {
this.disableSelector = this.selectorDisabled;
}
onGlobalClick(event) {
if (!this.elementRef.nativeElement.contains(event.target)) {
// clicked outside => close dropdown list
this.selectorOpened = false;
}
}
closeDropDown() {
this.selectorOpened = false;
}
onItemSelected(data) {
this.selectorOpened = false;
this.onChange.emit(data);
this.selectedLocationName = data.locationName;
}
addExpandListItem(treeItem) {
treeItem.forEach(item => {
if (item.items && item.items.length > 0) {
this.expandedKeys.push(item.locationId);
this.addExpandListItem(item.items);
}
});
}
locationClick() {
if (!this.selectorDisabled) {
this.selectorOpened = !this.selectorOpened;
}
}
};
LocationSingleSelectorComponent.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "selectedLocationName", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "selectedLocationId", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "labelText", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "hoverText", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "isIncludeFloatLocation", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "isDisableParentClick", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "page", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "hideBranchLess", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "selectableTypes", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "selectorDisabled", void 0);
__decorate([
Output()
], LocationSingleSelectorComponent.prototype, "onChange", void 0);
__decorate([
Output()
], LocationSingleSelectorComponent.prototype, "onLocationsData", void 0);
__decorate([
Input()
], LocationSingleSelectorComponent.prototype, "locationHierachy", void 0);
__decorate([
HostListener('document:mousedown', ['$event'])
], LocationSingleSelectorComponent.prototype, "onGlobalClick", null);
LocationSingleSelectorComponent = __decorate([
Component({
selector: 'location-single-selector',
template: "<div class=\"row align-items-center\" (click)=\"closeDropDown()\">\r\n <div class=\"col-md-12\">\r\n <label *ngIf=\"labelText?.length > 0\">{{labelText}}</label>\r\n\r\n <div #menu class=\"d-flex justify-content-between location-selector-form\"\r\n [ngClass]=\"{'disableSelector':selectorDisabled,'location-selector-focus' : selectorOpened}\" id=\"ddlLocationy\"\r\n (click)=\"locationClick()\" (click)=\"$event.stopPropagation()\" [title]=\"hoverText\">\r\n <div class=\"selected-location\">{{selectedLocationName}}</div>\r\n <div><em class=\"fas fa-chevron-down\"></em></div>\r\n </div>\r\n <div class=\"location-tree-wrapper p-2\" *ngIf=\"selectorOpened\" (click)=\"$event.stopPropagation()\">\r\n <location-single-selector-tree-view [locations]=\"locationHierachy.locations\" [expandedKeys]=\"expandedKeys\"\r\n [selectedLocationId]=\"selectedLocationId\" (closeEvent)=\"onItemSelected($event)\">\r\n </location-single-selector-tree-view>\r\n </div>\r\n </div>\r\n</div>",
styles: [":host ::ng-deep .location-selector-form{cursor:pointer;display:block;width:300px;height:calc(1.5em + .75rem + 2px);padding:.375rem .75rem;font-size:.9rem;font-weight:400;line-height:1.5;color:#495057;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}:host ::ng-deep .location-selector-focus{color:#495057;background-color:#fff;outline:0;box-shadow:0 0 0 .2rem rgba(0,81,81,.1)}:host ::ng-deep .location-tree-wrapper{position:absolute;z-index:10}:host ::ng-deep .disableSelector{opacity:.6;cursor:default}.selected-location{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:350px}"]
})
], LocationSingleSelectorComponent);
let LocationSingleSelectorTreeViewComponent = class LocationSingleSelectorTreeViewComponent {
constructor() {
this.closeEvent = new EventEmitter();
this.locationSelector = {
id: 0,
locationName: null,
locationCode: null,
utcoffsetInMinutes: 0,
locationTypeId: 0,
timezoneId: null,
timeZoneName: null,
dropDownDisabled: null,
lastLocationAutoWraupTime: null
};
}
ngOnInit() {
}
ngAfterContentInit() {
this.addExpandListItem(this.locations);
}
showClick(dataItem) {
var _a, _b, _c, _d, _e, _f, _g, _h;
this.locationSelector = {
id: (_a = dataItem) === null || _a === void 0 ? void 0 : _a.locationId,
locationName: (_b = dataItem) === null || _b === void 0 ? void 0 : _b.locationName,
locationCode: (_c = dataItem) === null || _c === void 0 ? void 0 : _c.locationCode,
locationTypeId: (_d = dataItem) === null || _d === void 0 ? void 0 : _d.locationTypeId,
utcoffsetInMinutes: (_e = dataItem) === null || _e === void 0 ? void 0 : _e.utcoffsetInMinutes,
timezoneId: (_f = dataItem) === null || _f === void 0 ? void 0 : _f.timeZoneId,
timeZoneName: (_g = dataItem) === null || _g === void 0 ? void 0 : _g.timeZoneName,
dropDownDisabled: null,
lastLocationAutoWraupTime: (_h = dataItem) === null || _h === void 0 ? void 0 : _h.lastLocationAutoWraupTime
};
this.closeEvent.emit(this.locationSelector);
}
addExpandListItem(treeItem) {
treeItem.forEach(item => {
if (item.hasChild) {
this.addExpandListItem(item.items);
}
});
}
};
__decorate([
Input()
], LocationSingleSelectorTreeViewComponent.prototype, "expandedKeys", void 0);
__decorate([
Input()
], LocationSingleSelectorTreeViewComponent.prototype, "selectedLocationId", void 0);
__decorate([
Input()
], LocationSingleSelectorTreeViewComponent.prototype, "locations", void 0);
__decorate([
Output()
], LocationSingleSelectorTreeViewComponent.prototype, "closeEvent", void 0);
LocationSingleSelectorTreeViewComponent = __decorate([
Component({
selector: 'location-single-selector-tree-view',
template: "<kendo-treeview [nodes]=\"locations\" textField=\"locationName\" childrenField=\"items\" \r\n[(expandedKeys)]=\"expandedKeys\" expandBy=\"locationId\" \r\n[filterable]=\"true\" \r\n filterInputPlaceholder=\"Search\" kendoTreeViewExpandable \r\n kendoTreeViewHierarchyBinding>\r\n <ng-template kendoTreeViewNodeTemplate let-dataItem >\r\n <span class=\"selectoritem\" (click)=\"showClick(dataItem)\" [ngClass]=\"{'disableNode': dataItem.isSelectable === false,'itemactive' : selectedLocationId == dataItem.locationId}\"> \r\n {{ dataItem.locationName }} \r\n </span> \r\n </ng-template>\r\n</kendo-treeview>",
styles: [":host ::ng-deep .k-checkbox{border-color:#000}:host ::ng-deep .k-textbox{width:100%;margin-bottom:8px}:host ::ng-deep .k-in.k-state-focused{box-shadow:none!important}:host ::ng-deep .selectoritem:hover{background-color:#005151;border-radius:3px;color:#fff;font-weight:500;cursor:default}:host ::ng-deep .k-treeview .k-icon{font-size:20px}:host ::ng-deep .k-treeview .k-in{padding:0;width:100%}:host ::ng-deep .selectoritem{padding:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}:host ::ng-deep .disableNode{opacity:.6;pointer-events:none}:host ::ng-deep .itemactive{color:#005151;font-weight:500}"]
})
], LocationSingleSelectorTreeViewComponent);
let LocationSingleSelectorModule = class LocationSingleSelectorModule {
};
LocationSingleSelectorModule = __decorate([
NgModule({
declarations: [
LocationSingleSelectorTreeViewComponent,
LocationSingleSelectorComponent,
],
imports: [
CommonModule,
TreeViewModule
],
exports: [
LocationSingleSelectorComponent
],
entryComponents: [LocationSingleSelectorComponent],
})
], LocationSingleSelectorModule);
let AngularLocationSelectorModule = class AngularLocationSelectorModule {
};
AngularLocationSelectorModule = __decorate([
NgModule({
declarations: [AngularLocationSelectorComponent],
imports: [
LocationSingleSelectorModule,
LocationMultiSelectorModule,
CommonModule
],
exports: [AngularLocationSelectorComponent]
})
], AngularLocationSelectorModule);
/*
* Public API Surface of angular-location-selector
*/
/**
* Generated bundle index. Do not edit.
*/
export { AngularLocationSelectorComponent, AngularLocationSelectorModule, LocationSingleSelectorModule as ɵa, LocationSingleSelectorTreeViewComponent as ɵb, LocationSingleSelectorComponent as ɵc, LocationMultiSelectorModule as ɵd, LocationMultiSelectorTreeViewComponent as ɵe, LocationMultiSelectorComponent as ɵf };
//# sourceMappingURL=angular-location-selector.js.map