UNPKG

jqwidgets-ng

Version:

[![Price](https://img.shields.io/badge/price-COMMERCIAL-0098f7.svg)](https://jqwidgets.com/license/)

297 lines (292 loc) 11.1 kB
import '../jqwidgets/modules/jqxscrollbar'; import * as i0 from '@angular/core'; import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core'; /// <reference path="../../jqwidgets.d.ts" /> class jqxScrollBarComponent { constructor(containerElement) { this.autoCreate = true; this.properties = ['disabled', 'height', 'largestep', 'min', 'max', 'rtl', 'step', 'showButtons', 'thumbMinSize', 'theme', 'vertical', 'value', 'width']; // jqxScrollBarComponent events this.onValueChanged = 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.jqxScrollBar(this.properties[i])); } if (areEqual) { return false; } this.host.jqxScrollBar(this.properties[i], this[attrName]); continue; } if (this[attrName] !== this.host.jqxScrollBar(this.properties[i])) { this.host.jqxScrollBar(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, 'jqxScrollBar', options); } createWidget(options) { this.createComponent(options); } __updateRect__() { if (this.host) this.host.css({ width: this.attrWidth, height: this.attrHeight }); } setOptions(options) { this.host.jqxScrollBar('setOptions', options); } // jqxScrollBarComponent properties disabled(arg) { if (arg !== undefined) { this.host.jqxScrollBar('disabled', arg); } else { return this.host.jqxScrollBar('disabled'); } } height(arg) { if (arg !== undefined) { this.host.jqxScrollBar('height', arg); } else { return this.host.jqxScrollBar('height'); } } largestep(arg) { if (arg !== undefined) { this.host.jqxScrollBar('largestep', arg); } else { return this.host.jqxScrollBar('largestep'); } } min(arg) { if (arg !== undefined) { this.host.jqxScrollBar('min', arg); } else { return this.host.jqxScrollBar('min'); } } max(arg) { if (arg !== undefined) { this.host.jqxScrollBar('max', arg); } else { return this.host.jqxScrollBar('max'); } } rtl(arg) { if (arg !== undefined) { this.host.jqxScrollBar('rtl', arg); } else { return this.host.jqxScrollBar('rtl'); } } step(arg) { if (arg !== undefined) { this.host.jqxScrollBar('step', arg); } else { return this.host.jqxScrollBar('step'); } } showButtons(arg) { if (arg !== undefined) { this.host.jqxScrollBar('showButtons', arg); } else { return this.host.jqxScrollBar('showButtons'); } } thumbMinSize(arg) { if (arg !== undefined) { this.host.jqxScrollBar('thumbMinSize', arg); } else { return this.host.jqxScrollBar('thumbMinSize'); } } theme(arg) { if (arg !== undefined) { this.host.jqxScrollBar('theme', arg); } else { return this.host.jqxScrollBar('theme'); } } vertical(arg) { if (arg !== undefined) { this.host.jqxScrollBar('vertical', arg); } else { return this.host.jqxScrollBar('vertical'); } } value(arg) { if (arg !== undefined) { this.host.jqxScrollBar('value', arg); } else { return this.host.jqxScrollBar('value'); } } width(arg) { if (arg !== undefined) { this.host.jqxScrollBar('width', arg); } else { return this.host.jqxScrollBar('width'); } } // jqxScrollBarComponent functions destroy() { this.host.jqxScrollBar('destroy'); } isScrolling() { return this.host.jqxScrollBar('isScrolling'); } setPosition(index) { this.host.jqxScrollBar('setPosition', index); } __wireEvents__() { this.host.on('valueChanged', (eventData) => { this.onValueChanged.emit(eventData); }); } } //jqxScrollBarComponent jqxScrollBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxScrollBarComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); jqxScrollBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: jqxScrollBarComponent, selector: "jqxScrollBar", inputs: { attrDisabled: ["disabled", "attrDisabled"], attrLargestep: ["largestep", "attrLargestep"], attrMin: ["min", "attrMin"], attrMax: ["max", "attrMax"], attrRtl: ["rtl", "attrRtl"], attrStep: ["step", "attrStep"], attrShowButtons: ["showButtons", "attrShowButtons"], attrThumbMinSize: ["thumbMinSize", "attrThumbMinSize"], attrTheme: ["theme", "attrTheme"], attrVertical: ["vertical", "attrVertical"], attrValue: ["value", "attrValue"], attrWidth: ["width", "attrWidth"], attrHeight: ["height", "attrHeight"], autoCreate: ["auto-create", "autoCreate"] }, outputs: { onValueChanged: "onValueChanged" }, 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: jqxScrollBarComponent, decorators: [{ type: Component, args: [{ selector: 'jqxScrollBar', template: '<div><ng-content></ng-content></div>' }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { attrDisabled: [{ type: Input, args: ['disabled'] }], attrLargestep: [{ type: Input, args: ['largestep'] }], attrMin: [{ type: Input, args: ['min'] }], attrMax: [{ type: Input, args: ['max'] }], attrRtl: [{ type: Input, args: ['rtl'] }], attrStep: [{ type: Input, args: ['step'] }], attrShowButtons: [{ type: Input, args: ['showButtons'] }], attrThumbMinSize: [{ type: Input, args: ['thumbMinSize'] }], attrTheme: [{ type: Input, args: ['theme'] }], attrVertical: [{ type: Input, args: ['vertical'] }], attrValue: [{ type: Input, args: ['value'] }], attrWidth: [{ type: Input, args: ['width'] }], attrHeight: [{ type: Input, args: ['height'] }], autoCreate: [{ type: Input, args: ['auto-create'] }], onValueChanged: [{ type: Output }] } }); class jqxScrollBarModule { } jqxScrollBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxScrollBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); jqxScrollBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxScrollBarModule, declarations: [jqxScrollBarComponent], exports: [jqxScrollBarComponent] }); jqxScrollBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxScrollBarModule, imports: [[]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxScrollBarModule, decorators: [{ type: NgModule, args: [{ imports: [], declarations: [jqxScrollBarComponent], exports: [jqxScrollBarComponent] }] }] }); /** * Generated bundle index. Do not edit. */ export { jqxScrollBarComponent, jqxScrollBarModule };