jqwidgets-ng
Version:
[](https://jqwidgets.com/license/)
227 lines (222 loc) • 8.87 kB
JavaScript
import '../jqwidgets/modules/jqxtimeline';
import * as i0 from '@angular/core';
import { Component, Input, NgModule } from '@angular/core';
/// <reference path="../../jqwidgets.d.ts" />
class jqxTimelineComponent {
constructor(containerElement) {
this.autoCreate = true;
this.properties = ['autoWidth', 'collapsible', 'disabled', 'horizontal', 'position', 'source', 'theme'];
this.elementRef = containerElement;
}
ngOnInit() {
if (this.autoCreate) {
this.createComponent();
}
}
;
ngOnChanges(changes) {
if (this.host) {
for (let i = 0; i < this.properties.length; i++) {
let attrName = 'attr' + this.properties[i].substring(0, 1).toUpperCase() + this.properties[i].substring(1);
let areEqual = false;
if (this[attrName] !== undefined) {
if (typeof this[attrName] === 'object') {
if (this[attrName] instanceof Array) {
areEqual = this.arraysEqual(this[attrName], this.host.jqxTimeline(this.properties[i]));
}
if (areEqual) {
return false;
}
this.host.jqxTimeline(this.properties[i], this[attrName]);
continue;
}
if (this[attrName] !== this.host.jqxTimeline(this.properties[i])) {
this.host.jqxTimeline(this.properties[i], this[attrName]);
}
}
}
}
}
arraysEqual(attrValue, hostValue) {
if ((attrValue && !hostValue) || (!attrValue && hostValue)) {
return false;
}
if (attrValue.length != hostValue.length) {
return false;
}
for (let i = 0; i < attrValue.length; i++) {
if (attrValue[i] !== hostValue[i]) {
return false;
}
}
return true;
}
manageAttributes() {
let options = {};
for (let i = 0; i < this.properties.length; i++) {
let attrName = 'attr' + this.properties[i].substring(0, 1).toUpperCase() + this.properties[i].substring(1);
if (this[attrName] !== undefined) {
options[this.properties[i]] = this[attrName];
}
}
return options;
}
moveClasses(parentEl, childEl) {
let classes = parentEl.classList;
if (classes.length > 0) {
childEl.classList.add(...classes);
}
parentEl.className = '';
}
moveStyles(parentEl, childEl) {
let style = parentEl.style.cssText;
childEl.style.cssText = style;
parentEl.style.cssText = '';
}
createComponent(options) {
if (this.host) {
return;
}
if (options) {
JQXLite.extend(options, this.manageAttributes());
}
else {
options = this.manageAttributes();
}
this.host = JQXLite(this.elementRef.nativeElement.firstChild);
this.moveClasses(this.elementRef.nativeElement, this.host[0]);
this.moveStyles(this.elementRef.nativeElement, this.host[0]);
this.__wireEvents__();
this.widgetObject = jqwidgets.createInstance(this.host, 'jqxTimeline', options);
}
createWidget(options) {
this.createComponent(options);
}
__updateRect__() {
if (this.host)
this.host.css({ width: this.attrWidth, height: this.attrHeight });
}
setOptions(options) {
this.host.jqxTimeline('setOptions', options);
}
// jqxTimelineComponent properties
autoWidth(arg) {
if (arg !== undefined) {
this.host.jqxTimeline('autoWidth', arg);
}
else {
return this.host.jqxTimeline('autoWidth');
}
}
collapsible(arg) {
if (arg !== undefined) {
this.host.jqxTimeline('collapsible', arg);
}
else {
return this.host.jqxTimeline('collapsible');
}
}
disabled(arg) {
if (arg !== undefined) {
this.host.jqxTimeline('disabled', arg);
}
else {
return this.host.jqxTimeline('disabled');
}
}
horizontal(arg) {
if (arg !== undefined) {
this.host.jqxTimeline('horizontal', arg);
}
else {
return this.host.jqxTimeline('horizontal');
}
}
position(arg) {
if (arg !== undefined) {
this.host.jqxTimeline('position', arg);
}
else {
return this.host.jqxTimeline('position');
}
}
source(arg) {
if (arg !== undefined) {
this.host.jqxTimeline('source', arg);
}
else {
return this.host.jqxTimeline('source');
}
}
theme(arg) {
if (arg !== undefined) {
this.host.jqxTimeline('theme', arg);
}
else {
return this.host.jqxTimeline('theme');
}
}
// jqxTimelineComponent functions
render() {
return this.host.jqxTimeline('render');
}
// jqxTimelineComponent events
__wireEvents__() {
}
} //jqxTimelineComponent
jqxTimelineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxTimelineComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
jqxTimelineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: jqxTimelineComponent, selector: "jqxTimeline", inputs: { attrAutoWidth: ["autoWidth", "attrAutoWidth"], attrCollapsible: ["collapsible", "attrCollapsible"], attrDisabled: ["disabled", "attrDisabled"], attrHorizontal: ["horizontal", "attrHorizontal"], attrPosition: ["position", "attrPosition"], attrSource: ["source", "attrSource"], attrTheme: ["theme", "attrTheme"], attrWidth: ["width", "attrWidth"], attrHeight: ["height", "attrHeight"], autoCreate: ["auto-create", "autoCreate"] }, usesOnChanges: true, ngImport: i0, template: '<div><ng-content></ng-content></div>', isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxTimelineComponent, decorators: [{
type: Component,
args: [{
selector: 'jqxTimeline',
template: '<div><ng-content></ng-content></div>'
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { attrAutoWidth: [{
type: Input,
args: ['autoWidth']
}], attrCollapsible: [{
type: Input,
args: ['collapsible']
}], attrDisabled: [{
type: Input,
args: ['disabled']
}], attrHorizontal: [{
type: Input,
args: ['horizontal']
}], attrPosition: [{
type: Input,
args: ['position']
}], attrSource: [{
type: Input,
args: ['source']
}], attrTheme: [{
type: Input,
args: ['theme']
}], attrWidth: [{
type: Input,
args: ['width']
}], attrHeight: [{
type: Input,
args: ['height']
}], autoCreate: [{
type: Input,
args: ['auto-create']
}] } });
class jqxTimelineModule {
}
jqxTimelineModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxTimelineModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
jqxTimelineModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxTimelineModule, declarations: [jqxTimelineComponent], exports: [jqxTimelineComponent] });
jqxTimelineModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxTimelineModule, imports: [[]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxTimelineModule, decorators: [{
type: NgModule,
args: [{
imports: [],
declarations: [jqxTimelineComponent],
exports: [jqxTimelineComponent]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { jqxTimelineComponent, jqxTimelineModule };