UNPKG

survey-angular-ui

Version:

survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.

811 lines (791 loc) 380 kB
import * as i0 from '@angular/core'; import { TemplateRef, Component, ViewChild, Directive, Input, VERSION, Injectable, HostBinding, ElementRef, Pipe, HostListener, ViewContainerRef, NgModule } from '@angular/core'; import * as Survey from 'survey-core'; import { createPopupModalViewModel, settings, ScrollViewModel, SvgRegistry, addIconsToThemeSet, PopupSurveyModel, LocalizableString, createPopupViewModel, Helpers, DropdownMultiSelectListModel, RendererFactory, ButtonGroupItemModel, doKey2ClickUp, doKey2ClickDown, doKey2ClickBlur, ActionDropdownViewModel, SurveyProgressModel, ProgressButtonsResponsivityManager, SurveyModel } from 'survey-core'; import { icons } from 'survey-core/icons/iconsV1'; import { icons as icons$1 } from 'survey-core/icons/iconsV2'; import { DomPortalOutlet, ComponentPortal } from '@angular/cdk/portal'; import * as i2 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i2$1 from '@angular/forms'; import { FormsModule } from '@angular/forms'; import * as i1 from '@angular/platform-browser'; class EmbeddedViewContentComponent { constructor(viewContainerRef) { this.viewContainerRef = viewContainerRef; } ngOnInit() { var _a; if (!!this.templateRef) { this.embeddedView = (_a = this.viewContainerRef) === null || _a === void 0 ? void 0 : _a.createEmbeddedView(this.templateRef); } } } EmbeddedViewContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmbeddedViewContentComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); EmbeddedViewContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: EmbeddedViewContentComponent, selector: "ng-component", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["template"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "", isInline: true }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmbeddedViewContentComponent, decorators: [{ type: Component, args: [{ template: "", }] }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { templateRef: [{ type: ViewChild, args: ["template", { read: TemplateRef, static: true }] }] } }); class BaseAngular extends EmbeddedViewContentComponent { constructor(changeDetectorRef, viewContainerRef) { super(viewContainerRef); this.changeDetectorRef = changeDetectorRef; this.isModelSubsribed = false; this.isDestroyed = false; } get surveyModel() { return this.getModel().getSurvey(); } ngDoCheck() { if (this.previousModel !== this.getModel()) { this.unMakeBaseElementAngular(this.previousModel); this.makeBaseElementAngular(this.getModel()); this.onModelChanged(); this.previousModel = this.getModel(); } this.setIsRendering(true); } onModelChanged() { } setIsRendering(val) { const model = this.getModel(); if (!!model) { model.isRendering = val; } } getIsRendering() { const model = this.getModel(); return !!model && !!model.isRendering; } ngOnDestroy() { this.isDestroyed = true; this.unMakeBaseElementAngular(this.getModel()); this.previousModel = undefined; } isBaseElementSubsribed(stateElement) { return !!stateElement.__ngImplemented; } getBaseElementCallbacks(stateElement) { var _a; stateElement.__ngSubscribers = (_a = stateElement.__ngSubscribers) !== null && _a !== void 0 ? _a : []; return (stateElement.__ngSubscribers); } makeBaseElementAngular(stateElement) { this.makeBaseElementAngularCallback = () => { this.isModelSubsribed = true; stateElement.__ngImplemented = true; stateElement.iteratePropertiesHash((hash, key) => { var val = hash[key]; if (Array.isArray(val)) { var val = val; val["onArrayChanged"] = (arrayChanges) => { this.update(key); }; } }); stateElement.setPropertyValueCoreHandler = (hash, key, val) => { if (hash[key] !== val) { hash[key] = val; this.update(key); } }; stateElement.enableOnElementRerenderedEvent(); }; if (!!stateElement) { if (!stateElement.__ngImplemented) { this.makeBaseElementAngularCallback(); } else { this.getBaseElementCallbacks(stateElement).push(this.makeBaseElementAngularCallback); } } } unMakeBaseElementAngular(stateElement) { if (!!stateElement) { if (this.isModelSubsribed) { this.isModelSubsribed = false; stateElement.__ngImplemented = false; stateElement.setPropertyValueCoreHandler = undefined; stateElement.iteratePropertiesHash((hash, key) => { var val = hash[key]; if (Array.isArray(val)) { var val = val; val["onArrayChanged"] = () => { }; } }); stateElement.disableOnElementRerenderedEvent(); const callbacks = this.getBaseElementCallbacks(stateElement); const callback = callbacks.shift(); callback && callback(); } else if (this.makeBaseElementAngularCallback) { const callbacks = this.getBaseElementCallbacks(stateElement); const index = callbacks.indexOf(this.makeBaseElementAngularCallback); if (index > -1) { callbacks.splice(index, 1); } } } } update(key) { if (this.getIsRendering()) return; this.beforeUpdate(); if (key && this.getPropertiesToUpdateSync().indexOf(key) > -1) { this.detectChanges(); this.afterUpdate(true); } else { queueMicrotask(() => { if (!this.isDestroyed) { this.setIsRendering(true); this.detectChanges(); this.afterUpdate(); } }); } } getChangeDetectorRef() { return this.embeddedView ? this.embeddedView : this.changeDetectorRef; } getPropertiesToUpdateSync() { return []; } detectChanges() { this.getChangeDetectorRef().detectChanges(); } getShouldReattachChangeDetector() { return true; } beforeUpdate() { this.setIsRendering(true); } afterUpdate(isSync = false) { this.setIsRendering(false); const model = this.getModel(); if (model && !this.isDestroyed) { model.afterRerender(); } } ngAfterViewChecked() { this.setIsRendering(false); } } BaseAngular.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseAngular, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); BaseAngular.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: BaseAngular, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "", isInline: true }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: BaseAngular, decorators: [{ type: Component, args: [{ template: "" }] }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }]; } }); class AngularComponentFactory { constructor() { this.creatorHash = {}; } registerComponent(typeName, componentType) { this.creatorHash[typeName] = componentType; } getAllTypes() { var result = new Array(); for (var key in this.creatorHash) { result.push(key); } return result.sort(); } isComponentRegistered(elementType) { return !!this.creatorHash[elementType]; } create(containerRef, elementType, resolver) { var componentType = this.creatorHash[elementType]; if (!componentType) return null; return containerRef.createComponent(resolver.resolveComponentFactory(componentType)); } } AngularComponentFactory.Instance = new AngularComponentFactory(); class DynamicComponentDirective { constructor(containerRef, templateRef, resolver) { this.containerRef = containerRef; this.templateRef = templateRef; this.resolver = resolver; } ngOnChanges(changes) { var _a; const componentChanges = changes["component"]; if (componentChanges.currentValue.name !== ((_a = componentChanges.previousValue) === null || _a === void 0 ? void 0 : _a.name) || (componentChanges.currentValue.name === undefined && componentChanges.previousValue === undefined && !this.componentInstance)) { this.createComponent(); } else { this.updateComponentData(); } } createComponent() { this.containerRef.clear(); if (AngularComponentFactory.Instance.isComponentRegistered(this.component.name)) { this.componentInstance = AngularComponentFactory.Instance.create(this.containerRef, this.component.name, this.resolver).instance; } else if (this.component.default) { this.componentInstance = AngularComponentFactory.Instance.create(this.containerRef, this.component.default, this.resolver).instance; } if (!this.componentInstance) { throw new Error(`Can't create component with name: ${this.component.name} and default: ${this.component.default}`); } else { this.componentInstance.contentTempl = this.templateRef; } this.updateComponentData(); } updateComponentData() { const data = this.component.data; Object.keys(data).forEach((key) => { this.componentInstance[key] = data[key]; }); } } DynamicComponentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DynamicComponentDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Directive }); DynamicComponentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: DynamicComponentDirective, selector: "[component]", inputs: { component: "component" }, usesOnChanges: true, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DynamicComponentDirective, decorators: [{ type: Directive, args: [{ selector: "[component]" }] }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { component: [{ type: Input }] } }); class ActionComponent extends BaseAngular { getModel() { return this.model; } get id() { return this.model.id || ""; } ngOnDestroy() { super.ngOnDestroy(); this.model.updateModeCallback = undefined; } ngAfterViewInit() { this.model.updateModeCallback = (mode, callback) => { this.model.mode = mode; queueMicrotask(() => { var _a; callback(mode, (_a = this.containerRef) === null || _a === void 0 ? void 0 : _a.nativeElement); }); }; this.model.afterRender(); } } ActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); ActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ActionComponent, selector: "sv-ng-action", inputs: { model: "model" }, viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #template>\n <div [class]=\"model.getActionRootCss()\" [id]=\"id\" #container>\n <div class=\"sv-action__content\">\n <ng-container *ngIf=\"model.needSeparator\">\n <div class=\"sv-action-bar-separator\"></div>\n </ng-container>\n <ng-template [component]=\"{ name: model.component, data: { model }, default: 'sv-action-bar-item'}\"></ng-template>\n </div>\n </div>\n</ng-template>", styles: [":host { display: none; }"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: DynamicComponentDirective, selector: "[component]", inputs: ["component"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ActionComponent, decorators: [{ type: Component, args: [{ selector: "sv-ng-action", templateUrl: "./action.component.html", styles: [":host { display: none; }"], }] }], propDecorators: { model: [{ type: Input }], containerRef: [{ type: ViewChild, args: ["container"] }] } }); AngularComponentFactory.Instance.registerComponent("sv-action", ActionComponent); class ActionBarComponent extends BaseAngular { getModel() { return this.model; } trackActionBy(_, action) { return action.renderedId; } get allowOnClick() { return this.handleClick !== undefined ? this.handleClick : true; } onModelChanged() { var _a; super.onModelChanged(); (_a = this.previousModel) === null || _a === void 0 ? void 0 : _a.resetResponsivityManager(); } initResponsivityManager() { var _a; if (!!this.model.hasVisibleActions && ((_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement)) { this.model.initResponsivityManager(this.container.nativeElement); } } ngAfterViewChecked() { super.ngAfterViewChecked(); this.initResponsivityManager(); } afterUpdate() { super.afterUpdate(); this.initResponsivityManager(); } onClick(event) { if (this.allowOnClick) { event.stopPropagation(); } } ngAfterViewInit() { this.initResponsivityManager(); } ngOnDestroy() { super.ngOnDestroy(); this.model.resetResponsivityManager(); } } ActionBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ActionBarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); ActionBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ActionBarComponent, selector: "sv-action-bar, sv-ng-action-bar", inputs: { model: "model", handleClick: "handleClick" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #template>\n <div *ngIf=\"model.hasActions\" [class]=\"model.getRootCss()\" (click)=\"onClick($event)\" #container [style]=\"model.getRootStyle()\">\n <ng-container *ngFor=\"let action of model.renderedActions; trackBy: trackActionBy\">\n <sv-ng-action [model]=\"action\"></sv-ng-action>\n </ng-container>\n </div>\n</ng-template>", styles: [":host { display: none }"], components: [{ type: ActionComponent, selector: "sv-ng-action", inputs: ["model"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ActionBarComponent, decorators: [{ type: Component, args: [{ selector: "sv-action-bar, sv-ng-action-bar", templateUrl: "./action-bar.component.html", styles: [":host { display: none }"] }] }], propDecorators: { model: [{ type: Input }], handleClick: [{ type: Input }], container: [{ type: ViewChild, args: ["container"] }] } }); AngularComponentFactory.Instance.registerComponent("sv-action-bar", ActionBarComponent); class VisibleDirective { constructor(el) { this.el = el; } ngOnChanges(changes) { changes["visible"].currentValue ? this.show() : this.hide(); } hide() { this.el.nativeElement.style.display = "none"; } show() { this.el.nativeElement.style.display = ""; } } VisibleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: VisibleDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); VisibleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: VisibleDirective, selector: "[visible]", inputs: { visible: "visible" }, usesOnChanges: true, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: VisibleDirective, decorators: [{ type: Directive, args: [{ selector: "[visible]" }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { visible: [{ type: Input }] } }); class PopupBaseContainerComponent extends BaseAngular { constructor(changeDetectorRef) { super(changeDetectorRef); this.changeDetectorRef.detach(); } getModel() { return this.model; } get applyButtonText() { const popupModalModel = this.model; if (!popupModalModel) return null; return popupModalModel.applyButtonText; } apply() { const popupModalModel = this.model; if (!popupModalModel) return; popupModalModel.apply(); } getPropertiesToUpdateSync() { return ["height"]; } getShouldReattachChangeDetector() { return false; } onModelChanged() { this.changeDetectorRef.detectChanges(); } afterUpdate(isSync = false) { super.afterUpdate(isSync); if (!isSync) { if (!this.model.isPositionSet && this.model.isVisible) { this.model.updateOnShowing(); } } } clickInside(event) { event.stopPropagation(); } } PopupBaseContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PopupBaseContainerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); PopupBaseContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: PopupBaseContainerComponent, selector: "sv-ng-popup-container, '[sv-ng-popup-container]'", inputs: { model: "model" }, usesInheritance: true, ngImport: i0, template: "<div class=\"sv-popup\" tabindex=\"-1\" [class]=\"model.styleClass\" [visible]=\"model.isVisible\" (click)=\"model.clickOutside($event)\" (keydown)=\"model.onKeyDown($event)\">\n <div class=\"sv-popup__container\" [style]=\"{ left: model.left, top: model.top, height: model.height, minWidth: model.minWidth, width: model.width }\" (click)=\"clickInside($event)\">\n <ng-container *ngIf=\"model.showHeader\">\n <ng-template [component]=\"{ name: model.popupHeaderTemplate, data: { model: model } }\"></ng-template>\n </ng-container>\n <div class=\"sv-popup__body-content\">\n <div *ngIf=\"model.title\" class=\"sv-popup__body-header\">{{ model.title }}</div>\n <div class=\"sv-popup__scrolling-content\">\n <div class=\"sv-popup__content\">\n <ng-template [component]=\"{ name: model.contentComponentName, data: model.contentComponentData }\"></ng-template>\n </div>\n </div>\n <div *ngIf=\"model.showFooter\" class=\"sv-popup__body-footer\">\n <sv-ng-action-bar [model]=\"model.footerToolbar\"></sv-ng-action-bar>\n </div>\n </div>\n </div>\n</div>", components: [{ type: ActionBarComponent, selector: "sv-action-bar, sv-ng-action-bar", inputs: ["model", "handleClick"] }], directives: [{ type: VisibleDirective, selector: "[visible]", inputs: ["visible"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: DynamicComponentDirective, selector: "[component]", inputs: ["component"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PopupBaseContainerComponent, decorators: [{ type: Component, args: [{ selector: "sv-ng-popup-container, '[sv-ng-popup-container]'", templateUrl: "./popup-container.component.html" }] }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { model: [{ type: Input }] } }); class PopupService { constructor(injector, applicationRef, componentFactoryResolver) { this.injector = injector; this.applicationRef = applicationRef; this.componentFactoryResolver = componentFactoryResolver; } createComponent(popupViewModel) { let portalHost; if (Number.parseInt(VERSION.major) > 18) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore portalHost = new DomPortalOutlet(popupViewModel.container, this.applicationRef, this.injector); } else { portalHost = new DomPortalOutlet(popupViewModel.container, this.componentFactoryResolver, this.applicationRef, this.injector); } const portal = new ComponentPortal(PopupBaseContainerComponent); const componentRef = portalHost.attach(portal); popupViewModel.setComponentElement(popupViewModel.container.children[0]); componentRef.instance.model = popupViewModel; componentRef.changeDetectorRef.detectChanges(); return portalHost; } } PopupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PopupService, deps: [{ token: i0.Injector }, { token: i0.ApplicationRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable }); PopupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PopupService }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PopupService, decorators: [{ type: Injectable }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.ApplicationRef }, { type: i0.ComponentFactoryResolver }]; } }); class ModalComponent { constructor(popupService) { this.popupService = popupService; this.functionDefined = false; } showDialog(dialogOptions, rootElement) { const popupViewModel = this.model = createPopupModalViewModel(dialogOptions, rootElement); const onVisibilityChangedCallback = (_, options) => { if (!options.isVisible) { this.portalHost.detach(); this.model.dispose(); } }; popupViewModel.onVisibilityChanged.add(onVisibilityChangedCallback); this.portalHost = this.popupService.createComponent(this.model); this.model.model.isVisible = true; return this.model; } ngOnInit() { this.functionDefined = true; settings.showDialog = (dialogOptions, rootElement) => { return this.showDialog(dialogOptions, rootElement); }; } ngOnDestroy() { var _a, _b; (_a = this.portalHost) === null || _a === void 0 ? void 0 : _a.detach(); (_b = this.model) === null || _b === void 0 ? void 0 : _b.dispose(); if (this.functionDefined) { settings.showDialog = undefined; } } } ModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ModalComponent, deps: [{ token: PopupService }], target: i0.ɵɵFactoryTarget.Component }); ModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ModalComponent, selector: "sv-ng-modal-container", ngImport: i0, template: "", isInline: true, styles: [":host{display:none}\n"] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ModalComponent, decorators: [{ type: Component, args: [{ selector: "sv-ng-modal-container", template: "", styleUrls: ["../../hide-host.scss"] }] }], ctorParameters: function () { return [{ type: PopupService }]; } }); class ScrollComponent extends EmbeddedViewContentComponent { constructor(viewContainerRef) { super(viewContainerRef); this.model = new ScrollViewModel(); this.model.onInnerHeightChanged = (hasScroll) => { if (!!this.onInnerHeightChanged) { this.onInnerHeightChanged(hasScroll); } }; } ngAfterViewInit() { var _a; this.model.setRootElement((_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement); } ngOnDestroy() { this.model.setRootElement(undefined); this.model.unsubscribeRootElement(); } } ScrollComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ScrollComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); ScrollComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ScrollComponent, selector: "sv-scroll", inputs: { disabled: "disabled", onInnerHeightChanged: "onInnerHeightChanged" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #template>\n <ng-container *ngIf=\"!disabled\">\n <div class=\"sv-scroll__wrapper\" #container>\n <div class=\"sv-scroll__scroller sv-drag-target-skipped\" (scroll)=\"model.onScrollContainer()\">\n <div class=\"sv-scroll__container\">\n <ng-container *ngTemplateOutlet=\"transparentTemplate\"></ng-container>\n </div>\n </div>\n <div class=\"sv-scroll__scrollbar\" (scroll)=\"model.onScrollScrollbar()\">\n <div class=\"sv-scroll__scrollbar-sizer\">\n </div>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"disabled\"><ng-container *ngTemplateOutlet=\"transparentTemplate\"></ng-container></ng-container>\n</ng-template>\n<ng-template #transparentTemplate>\n <ng-content></ng-content>\n</ng-template>", styles: [":host { display: none; }"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ScrollComponent, decorators: [{ type: Component, args: [{ selector: "sv-scroll", templateUrl: "./scroll.component.html", styles: [":host { display: none; }"] }] }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { disabled: [{ type: Input }], onInnerHeightChanged: [{ type: Input }], container: [{ type: ViewChild, args: ["container"] }] } }); AngularComponentFactory.Instance.registerComponent("sv-scroll", ScrollComponent); class SvgBundleComponent { constructor() { this.onIconsChanged = () => { var _a; if (typeof document !== "undefined") { if (!!((_a = this.svgContainer) === null || _a === void 0 ? void 0 : _a.nativeElement)) { this.svgContainer.nativeElement.innerHTML = SvgRegistry.iconsRenderedHtml(); } } }; } ngOnInit() { this.onIconsChanged(); SvgRegistry.onIconsChanged.add(this.onIconsChanged); } ngOnDestroy() { SvgRegistry.onIconsChanged.remove(this.onIconsChanged); } } SvgBundleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SvgBundleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); SvgBundleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SvgBundleComponent, selector: "sv-svg-bundle", viewQueries: [{ propertyName: "svgContainer", first: true, predicate: ["svgContainer"], descendants: true, static: true }], ngImport: i0, template: "<svg id='sv-icon-holder-global-container' #svgContainer></svg>", isInline: true, styles: [":host { display: none; }"] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SvgBundleComponent, decorators: [{ type: Component, args: [{ selector: "sv-svg-bundle", template: "<svg id='sv-icon-holder-global-container' #svgContainer></svg>", styles: [":host { display: none; }"] }] }], propDecorators: { svgContainer: [{ type: ViewChild, args: ["svgContainer", { static: true }] }] } }); class DynamicHeadComponent extends EmbeddedViewContentComponent { get ariaLabel() { return this.element.titleAriaLabel; } } DynamicHeadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DynamicHeadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); DynamicHeadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: DynamicHeadComponent, selector: "sv-ng-dynamic-head", inputs: { tagName: "tagName", element: "element" }, usesInheritance: true, ngImport: i0, template: "<ng-template #template>\n <ng-container [ngSwitch]=\"tagName\">\n <h1 *ngSwitchCase=\"'h1'\" [class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></h1>\n <h2 *ngSwitchCase=\"'h2'\"[class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></h2>\n <h3 *ngSwitchCase=\"'h3'\"[class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></h3>\n <h4 *ngSwitchCase=\"'h4'\"[class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></h4>\n <h5 *ngSwitchCase=\"'h5'\"[class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></h5>\n <h6 *ngSwitchCase=\"'h6'\"[class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></h6>\n <div *ngSwitchCase=\"'div'\"[class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></div>\n <label *ngSwitchCase=\"'label'\"[class]=\"element.cssTitle\" [attr.id]=\"element.ariaTitleId\" [attr.tabindex]=\"element.titleTabIndex\" [attr.aria-expanded]=\"element.titleAriaExpanded\" [attr.role]=\"element.titleAriaRole\" [attr.aria-label]=\"ariaLabel\"><ng-container *ngTemplateOutlet=\"titleContent\"></ng-container></label>\n </ng-container>\n <ng-template #titleContent>\n <ng-content></ng-content>\n </ng-template>\n</ng-template>", styles: [":host{display:none}\n"], directives: [{ type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DynamicHeadComponent, decorators: [{ type: Component, args: [{ selector: "sv-ng-dynamic-head", templateUrl: "./dynamic-head.component.html", styleUrls: ["../../hide-host.scss"] }] }], propDecorators: { tagName: [{ type: Input }], element: [{ type: Input }] } }); class SvgIconComponent { constructor(viewContaierRef) { this.viewContaierRef = viewContaierRef; } createSvg() { if (!!this.iconName) { Survey.createSvg(this.size, this.width, this.height, this.iconName, this.viewContaierRef.element.nativeElement, this.title); } } get rootClass() { let className = "sv-svg-icon"; if (!this.css && !!this.partCss) { className += " " + this.partCss; } else if (!!this.css) { className = this.css; } return className; } get rootRole() { return "presentation"; } ngOnChanges() { if (typeof document !== "undefined") { const el = this.viewContaierRef.element.nativeElement; el.innerHTML = ""; el.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "use")); this.createSvg(); } } } SvgIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SvgIconComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); SvgIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SvgIconComponent, selector: "'[sv-ng-svg-icon]'", inputs: { size: "size", width: "width", height: "height", iconName: "iconName", partCss: "partCss", css: "css", title: "title" }, host: { properties: { "class": "this.rootClass", "attr.role": "this.rootRole" } }, usesOnChanges: true, ngImport: i0, template: "", isInline: true }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SvgIconComponent, decorators: [{ type: Component, args: [{ selector: "'[sv-ng-svg-icon]'", template: "" }] }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { size: [{ type: Input }], width: [{ type: Input }], height: [{ type: Input }], iconName: [{ type: Input }], partCss: [{ type: Input }], css: [{ type: Input }], title: [{ type: Input }], rootClass: [{ type: HostBinding, args: ["class"] }], rootRole: [{ type: HostBinding, args: ["attr.role"] }] } }); class SurveyStringComponent { } SurveyStringComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SurveyStringComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); SurveyStringComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SurveyStringComponent, selector: "sv-ng-string, '[sv-ng-string]'", inputs: { model: "model" }, ngImport: i0, template: "<ng-template [component]='{ name: model.renderAs, data: { model: model.renderAsData } }'></ng-template>", isInline: true, directives: [{ type: DynamicComponentDirective, selector: "[component]", inputs: ["component"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SurveyStringComponent, decorators: [{ type: Component, args: [{ selector: "sv-ng-string, '[sv-ng-string]'", template: "<ng-template [component]='{ name: model.renderAs, data: { model: model.renderAsData } }'></ng-template>" }] }], propDecorators: { model: [{ type: Input }] } }); class ElementTitleActionsComponent extends EmbeddedViewContentComponent { get cssClasses() { return (this.element.isPanel ? this.element.cssClasses.panel : this.element.cssClasses) || {}; } } ElementTitleActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ElementTitleActionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); ElementTitleActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementTitleActionsComponent, selector: "sv-ng-element-title-actions", inputs: { element: "element" }, usesInheritance: true, ngImport: i0, template: "<ng-template #template>\n <ng-container *ngIf=\"!element.hasTitleActions\">\n <ng-container *ngTemplateOutlet=\"elementTitleContent\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"element.hasTitleActions\">\n <div class=\"sv-title-actions\">\n <span class=\"sv-title-actions__title\">\n <ng-container *ngTemplateOutlet=\"elementTitleContent\"></ng-container>\n </span>\n <sv-ng-action-bar [model]=\"element.getTitleToolbar()\"></sv-ng-action-bar>\n </div>\n </ng-container>\n <ng-template #elementTitleContent>\n <sv-ng-string *ngIf=\"element.isTitleRenderedAsString\" [model]=\"element.locRenderedTitle\"></sv-ng-string>\n <ng-container *ngIf=\"!element.isTitleRenderedAsString\">\n <span\n *ngIf=\"element.isRequireTextOnStart\"\n [class]=\"element.cssRequiredMark\"\n [attr.aria-hidden]=\"true\"\n >{{ element.requiredMark }}</span>\n <span *ngIf=\"element.isRequireTextOnStart\">&nbsp;</span>\n <span\n *ngIf=\"element.no\"\n style=\"position: static\"\n [class]=\"element.cssTitleNumber\"\n [attr.aria-hidden]=\"true\"\n >{{ element.no }}</span>\n <span *ngIf=\"element.no\">&nbsp;</span>\n <span\n *ngIf=\"element.isRequireTextBeforeTitle\"\n [class]=\"element.cssRequiredMark\"\n [attr.aria-hidden]=\"true\"\n >{{ element.requiredMark }}</span>\n <span *ngIf=\"element.isRequireTextBeforeTitle\">&nbsp;</span>\n <sv-ng-string [model]=\"element.locRenderedTitle\"></sv-ng-string>\n <span *ngIf=\"element.isRequireTextAfterTitle\">&nbsp;</span>\n <span\n *ngIf=\" element.isRequireTextAfterTitle\"\n [class]=\"element.cssRequiredMark\"\n [attr.aria-hidden]=\"true\"\n >{{ element.requiredMark }}</span> \n </ng-container>\n </ng-template>\n</ng-template>", styles: [":host{display:none}\n"], components: [{ type: ActionBarComponent, selector: "sv-action-bar, sv-ng-action-bar", inputs: ["model", "handleClick"] }, { type: SurveyStringComponent, selector: "sv-ng-string, '[sv-ng-string]'", inputs: ["model"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ElementTitleActionsComponent, decorators: [{ type: Component, args: [{ selector: "sv-ng-element-title-actions", templateUrl: "./title-actions.component.html", styleUrls: ["../../hide-host.scss"] }] }], propDecorators: { element: [{ type: Input }] } }); class ElementTitleComponent extends EmbeddedViewContentComponent { } ElementTitleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ElementTitleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); ElementTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementTitleComponent, selector: "sv-ng-element-title", inputs: { element: "element" }, usesInheritance: true, ngImport: i0, template: "<ng-template #template>\n <sv-ng-dynamic-head [tagName]=\"element.titleTagName\" [element]=\"element\" *ngIf=\"element.hasTitle\">\n <svg *ngIf=\"!element.isExpanded && element.getCssTitleExpandableSvg()\" [iconName]=\"'icon-expand-16x16'\" [partCss]=\"element.getCssTitleExpandableSvg()\" [size]=\"'auto'\" sv-ng-svg-icon></svg>\n <svg *ngIf=\"element.isExpanded && element.getCssTitleExpandableSvg()\" [iconName]=\"'icon-collapse-16x16'\" [partCss]=\"element.getCssTitleExpandableSvg()\" [size]=\"'auto'\" sv-ng-svg-icon></svg>\n <sv-ng-element-title-actions [element]=\"element\"></sv-ng-element-title-actions>\n </sv-ng-dynamic-head>\n</ng-template>", styles: [":host{display:none}\n"], components: [{ type: DynamicHeadComponent, selector: "sv-ng-dynamic-head", inputs: ["tagName", "element"] }, { type: SvgIconComponent, selector: "'[sv-ng-svg-icon]'", inputs: ["size", "width", "height", "iconName", "partCss", "css", "title"] }, { type: ElementTitleActionsComponent, selector: "sv-ng-element-title-actions", inputs: ["element"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ElementTitleComponent, decorators: [{ type: Component, args: [{ selector: "sv-ng-element-title", templateUrl: "./element-title.component.html", styleUrls: ["../../hide-host.scss"] }] }], propDecorators: { element: [{ type: Input }] } }); class SurveyHeaderComponent { constructor(viewContainerRef, changeDetectorRef) { this.viewContainerRef = viewContainerRef; this.changeDetectorRef = changeDetectorRef; } ngAfterViewInit() { this.survey.afterRenderHeader(this.viewContainerRef.element.nativeElement); this.survey.locLogo.onChanged = () => { this.changeDetectorRef.detectChanges(); }; } ngOnDestroy() { this.survey.locLogo.onChanged = () => { }; } } SurveyHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SurveyHeaderComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); SurveyHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SurveyHeaderComponent, selector: "'[sv-ng-survey-header]'", inputs: { survey: "survey" }, ngImport: i0, template: "<ng-template *ngIf=\"survey.isLogoBefore\" [component]=\"{ name: survey.getElementWrapperComponentName(survey, 'logo-image'), data: { data: survey.getElementWrapperComponentData(survey, 'logo-image') } }\"></ng-template>\n<div\n *ngIf=\"survey.renderedHasTitle\"\n [class]=\"survey.css.headerText\"\n [style.maxWidth]=\"survey.titleMaxWidth\"\n>\n <sv-ng-element-title [element]=\"survey\"></sv-ng-element-title>\n <div *ngIf=\"survey.renderedHasDescription\" [class]=\"survey.css.description\" [model]=\"survey.locDescription\" sv-ng-string></div>\n</div>\n\n<ng-template *ngIf=\"survey.isLogoAfter\" [component]=\"{ name: survey.getElementWrapperComponentName(survey, 'logo-image'), data: { data: survey.getElementWrapperComponentData(survey, 'logo-image') } }\"></ng-template>\n<div [class]=\"survey.css.headerClose\"></div>", components: [{ type: ElementTitleComponent, selector: "sv-ng-element-title", inputs: ["element"] }, { type: SurveyStringComponent, selector: "sv-ng-string, '[sv-ng-string]'", inputs: ["model"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: DynamicComponentDirective, selector: "[component]", inputs: ["component"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SurveyHeaderComponent, decorators: [{ type: Component, args: [{ selector: "'[sv-ng-survey-header]'", templateUrl: "survey-header.component.html" }] }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { survey: [{ type: Input }] } }); class ErrorsComponent { constructor() { } get id() { return this.element.id + "_errors"; } get class() { return this.element.cssError; } } ErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); ErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ErrorsComponent, selector: "'[sv-ng-errors]'", inputs: { element: "element", location: "location" }, host: { properties: { "id": "this.id", "class": "this.class" } }, ngImport: i0, template: "<ng-container *ngFor=\"let error of element.errors;\">\n <ng-template [component]=\"{ name: element.survey.questionErrorComponent, data: { element: element, cssClasses: element.cssClasses, error: error } }\"></ng-template>\n</ng-container>\n", directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: DynamicComponentDirective, selector: "[component]", inputs: ["component"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ErrorsComponent, decorators: [{ type: Component, args: [{ templateUrl: "./errors.component.html", selector: "'[sv-ng-errors]'" }] }], ctorParameters: function () { return []; }, propDecorators: { element: [{ type: Input }], location: [{ type: Input }], id: [{ type: HostBinding, args: ["id"] }], class: [{ type: HostBinding, args: ["class"] }] } }); class ElementComponent extends BaseAngular { getModel() { return this.model; } get elementComponentName() { return this.model.isPanel ? "panel" : "question"; } onModelChanged() { var _a; super.onModelChanged(); if (this.previousModel) { this.previousModel.setWrapperElement(undefined); } if (this.model && ((_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement)) { this.model.setWrapperElement(this.container.nativeElement); } } get componentName() { const survey = this.surveyModel; if (!!survey) { const name = survey.getElementWrapperComponentName(this.model); if (!!name) { return name; } } return this.elementComponentName; } get rootStyle() { //use this if to check if cssClassses are calculated and allowRootStyle flag was set if (!!this.model.cssClasses) { return this.model.rootStyle; } else { return {}; } } get componentData() { const s