@firestitch/address
Version:
@firestitch/address
79 lines (63 loc) • 1.64 kB
text/typescript
import {
Component,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output
} from '@angular/core';
// Interfaces
import { IFsAddressConfig } from '../../interfaces/address-config.interface';
import { FsAddress } from '../../interfaces/address.interface';
import { IFsAddressMapConfig } from '../../interfaces/address-map-config.interface';
export class FsAddressPickerComponent implements OnInit, OnDestroy {
// ADDRESS Two-way binding
public addressValue: FsAddress;
get address() {
return this.addressValue;
}
addressChange = new EventEmitter();
set address(value: FsAddress) {
this.addressValue = value;
this.addressChange.emit(this.addressValue);
}
// CONFIG Two-way binding
public configValue: IFsAddressConfig;
get config() {
return this.configValue;
}
configChange = new EventEmitter();
set config(value: IFsAddressConfig) {
this.configValue = value;
this.configChange.emit(this.configValue);
}
change: EventEmitter<any> = new EventEmitter<any>();
// BINDING END
// Others
public isEdit: boolean;
constructor() {
this.isEdit = false;
}
ngOnInit() {}
ngOnDestroy() {}
public openEdit() {
this.isEdit = true;
}
public closeEdit() {
this.isEdit = false;
}
public clear() {
this.address = {};
}
public changed(event: FsAddress) {
this.change.emit(event);
if (event) {
this.address = event;
}
}
}