jqwidgets-ng
Version:
[](https://jqwidgets.com/license/)
348 lines (343 loc) • 13.1 kB
JavaScript
import '../jqwidgets/modules/jqxpopover';
import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
/// <reference path="../../jqwidgets.d.ts" />
class jqxPopoverComponent {
constructor(containerElement) {
this.autoCreate = true;
this.properties = ['arrowOffsetValue', 'animationOpenDelay', 'animationCloseDelay', 'autoClose', 'animationType', 'height', 'initContent', 'isModal', 'offset', 'position', 'rtl', 'selector', 'showArrow', 'showCloseButton', 'width', 'title', 'theme'];
// jqxPopoverComponent events
this.onClose = new EventEmitter();
this.onOpen = new EventEmitter();
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.jqxPopover(this.properties[i]));
}
if (areEqual) {
return false;
}
this.host.jqxPopover(this.properties[i], this[attrName]);
continue;
}
if (this[attrName] !== this.host.jqxPopover(this.properties[i])) {
this.host.jqxPopover(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.widgetObject = jqwidgets.createInstance(this.host, 'jqxPopover', options);
this.host = this.widgetObject['host'];
this.__wireEvents__();
}
createWidget(options) {
this.createComponent(options);
}
__updateRect__() {
if (this.host)
this.host.css({ width: this.attrWidth, height: this.attrHeight });
}
setOptions(options) {
this.host.jqxPopover('setOptions', options);
}
// jqxPopoverComponent properties
arrowOffsetValue(arg) {
if (arg !== undefined) {
this.host.jqxPopover('arrowOffsetValue', arg);
}
else {
return this.host.jqxPopover('arrowOffsetValue');
}
}
animationOpenDelay(arg) {
if (arg !== undefined) {
this.host.jqxPopover('animationOpenDelay', arg);
}
else {
return this.host.jqxPopover('animationOpenDelay');
}
}
animationCloseDelay(arg) {
if (arg !== undefined) {
this.host.jqxPopover('animationCloseDelay', arg);
}
else {
return this.host.jqxPopover('animationCloseDelay');
}
}
autoClose(arg) {
if (arg !== undefined) {
this.host.jqxPopover('autoClose', arg);
}
else {
return this.host.jqxPopover('autoClose');
}
}
animationType(arg) {
if (arg !== undefined) {
this.host.jqxPopover('animationType', arg);
}
else {
return this.host.jqxPopover('animationType');
}
}
height(arg) {
if (arg !== undefined) {
this.host.jqxPopover('height', arg);
}
else {
return this.host.jqxPopover('height');
}
}
initContent(arg) {
if (arg !== undefined) {
this.host.jqxPopover('initContent', arg);
}
else {
return this.host.jqxPopover('initContent');
}
}
isModal(arg) {
if (arg !== undefined) {
this.host.jqxPopover('isModal', arg);
}
else {
return this.host.jqxPopover('isModal');
}
}
offset(arg) {
if (arg !== undefined) {
this.host.jqxPopover('offset', arg);
}
else {
return this.host.jqxPopover('offset');
}
}
position(arg) {
if (arg !== undefined) {
this.host.jqxPopover('position', arg);
}
else {
return this.host.jqxPopover('position');
}
}
rtl(arg) {
if (arg !== undefined) {
this.host.jqxPopover('rtl', arg);
}
else {
return this.host.jqxPopover('rtl');
}
}
selector(arg) {
if (arg !== undefined) {
this.host.jqxPopover('selector', arg);
}
else {
return this.host.jqxPopover('selector');
}
}
showArrow(arg) {
if (arg !== undefined) {
this.host.jqxPopover('showArrow', arg);
}
else {
return this.host.jqxPopover('showArrow');
}
}
showCloseButton(arg) {
if (arg !== undefined) {
this.host.jqxPopover('showCloseButton', arg);
}
else {
return this.host.jqxPopover('showCloseButton');
}
}
width(arg) {
if (arg !== undefined) {
this.host.jqxPopover('width', arg);
}
else {
return this.host.jqxPopover('width');
}
}
title(arg) {
if (arg !== undefined) {
this.host.jqxPopover('title', arg);
}
else {
return this.host.jqxPopover('title');
}
}
theme(arg) {
if (arg !== undefined) {
this.host.jqxPopover('theme', arg);
}
else {
return this.host.jqxPopover('theme');
}
}
// jqxPopoverComponent functions
close() {
this.host.jqxPopover('close');
}
destroy() {
this.host.jqxPopover('destroy');
}
open() {
this.host.jqxPopover('open');
}
__wireEvents__() {
setTimeout(() => {
this.host.on('close', (eventData) => { this.onClose.emit(eventData); });
this.host.on('open', (eventData) => { this.onOpen.emit(eventData); });
});
}
} //jqxPopoverComponent
jqxPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxPopoverComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
jqxPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: jqxPopoverComponent, selector: "jqxPopover", inputs: { attrArrowOffsetValue: ["arrowOffsetValue", "attrArrowOffsetValue"], attrAnimationOpenDelay: ["animationOpenDelay", "attrAnimationOpenDelay"], attrAnimationCloseDelay: ["animationCloseDelay", "attrAnimationCloseDelay"], attrAutoClose: ["autoClose", "attrAutoClose"], attrAnimationType: ["animationType", "attrAnimationType"], attrInitContent: ["initContent", "attrInitContent"], attrIsModal: ["isModal", "attrIsModal"], attrOffset: ["offset", "attrOffset"], attrPosition: ["position", "attrPosition"], attrRtl: ["rtl", "attrRtl"], attrSelector: ["selector", "attrSelector"], attrShowArrow: ["showArrow", "attrShowArrow"], attrShowCloseButton: ["showCloseButton", "attrShowCloseButton"], attrTitle: ["title", "attrTitle"], attrTheme: ["theme", "attrTheme"], attrWidth: ["width", "attrWidth"], attrHeight: ["height", "attrHeight"], autoCreate: ["auto-create", "autoCreate"] }, outputs: { onClose: "onClose", onOpen: "onOpen" }, 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: jqxPopoverComponent, decorators: [{
type: Component,
args: [{
selector: 'jqxPopover',
template: '<div><ng-content></ng-content></div>'
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { attrArrowOffsetValue: [{
type: Input,
args: ['arrowOffsetValue']
}], attrAnimationOpenDelay: [{
type: Input,
args: ['animationOpenDelay']
}], attrAnimationCloseDelay: [{
type: Input,
args: ['animationCloseDelay']
}], attrAutoClose: [{
type: Input,
args: ['autoClose']
}], attrAnimationType: [{
type: Input,
args: ['animationType']
}], attrInitContent: [{
type: Input,
args: ['initContent']
}], attrIsModal: [{
type: Input,
args: ['isModal']
}], attrOffset: [{
type: Input,
args: ['offset']
}], attrPosition: [{
type: Input,
args: ['position']
}], attrRtl: [{
type: Input,
args: ['rtl']
}], attrSelector: [{
type: Input,
args: ['selector']
}], attrShowArrow: [{
type: Input,
args: ['showArrow']
}], attrShowCloseButton: [{
type: Input,
args: ['showCloseButton']
}], attrTitle: [{
type: Input,
args: ['title']
}], attrTheme: [{
type: Input,
args: ['theme']
}], attrWidth: [{
type: Input,
args: ['width']
}], attrHeight: [{
type: Input,
args: ['height']
}], autoCreate: [{
type: Input,
args: ['auto-create']
}], onClose: [{
type: Output
}], onOpen: [{
type: Output
}] } });
class jqxPopoverModule {
}
jqxPopoverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxPopoverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
jqxPopoverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxPopoverModule, declarations: [jqxPopoverComponent], exports: [jqxPopoverComponent] });
jqxPopoverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxPopoverModule, imports: [[]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxPopoverModule, decorators: [{
type: NgModule,
args: [{
imports: [],
declarations: [jqxPopoverComponent],
exports: [jqxPopoverComponent]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { jqxPopoverComponent, jqxPopoverModule };