UNPKG

ngy-tutorial

Version:
739 lines (725 loc) 107 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/animations'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/platform-browser/animations')) : typeof define === 'function' && define.amd ? define('ngy-tutorial', ['exports', '@angular/core', 'rxjs', '@angular/animations', '@angular/common', '@angular/platform-browser', '@angular/platform-browser/animations'], factory) : (factory((global['ngy-tutorial'] = {}),global.ng.core,global.rxjs,global.ng.animations,global.ng.common,global.ng.platformBrowser,global.ng.platformBrowser.animations)); }(this, (function (exports,i0,rxjs,animations,common,platformBrowser,animations$1) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var StepPromptPlacement = { Above: 0, Below: 1, Left: 2, Right: 3, }; StepPromptPlacement[StepPromptPlacement.Above] = 'Above'; StepPromptPlacement[StepPromptPlacement.Below] = 'Below'; StepPromptPlacement[StepPromptPlacement.Left] = 'Left'; StepPromptPlacement[StepPromptPlacement.Right] = 'Right'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgyTutorialService = /** @class */ (function () { function NgyTutorialService() { this.toShow = new i0.EventEmitter(); this.tutorialInProgress = new rxjs.Observable(); this.currentStep = new rxjs.Observable(); this._tutorialInProgress = new rxjs.BehaviorSubject(false); this._currentStep = new rxjs.BehaviorSubject(0); this.tutorialInProgress = this._tutorialInProgress.asObservable(); this.currentStep = this._currentStep.asObservable(); this.steps = []; } /** * @return {?} */ NgyTutorialService.prototype.showTutorial = /** * @return {?} */ function () { this._currentStep.next(0); this.toShow.emit(this.steps.slice()); this._tutorialInProgress.next(true); }; /** * @return {?} */ NgyTutorialService.prototype.hideTutorial = /** * @return {?} */ function () { this.toShow.emit([]); this._tutorialInProgress.next(false); }; /** * @param {?} title * @param {?} prompt * @param {?=} option * @return {?} */ NgyTutorialService.prototype.addStep = /** * @param {?} title * @param {?} prompt * @param {?=} option * @return {?} */ function (title, prompt, option) { if (option && option.disableNext && option.disableInteraction) { console.warn("ngy-tutorial error, step " + title + " - " + prompt + " has disableNext and disableInteraction set to true.\n This step will cause tutorial to be unable to progress forward as such is not added to the tutorial"); return; } this.steps.push(new TutorialStep(title, prompt, option)); }; /** * @param {?} stepNumber * @return {?} */ NgyTutorialService.prototype.removeStep = /** * @param {?} stepNumber * @return {?} */ function (stepNumber) { if (stepNumber > this.steps.length - 1 || stepNumber < 0) { return; } else { this.steps.splice(stepNumber, 1); } }; /** * @return {?} */ NgyTutorialService.prototype.nextStep = /** * @return {?} */ function () { this._currentStep.next(this._currentStep.value + 1); }; /** * @return {?} */ NgyTutorialService.prototype.previousStep = /** * @return {?} */ function () { this._currentStep.next(this._currentStep.value - 1); }; NgyTutorialService.decorators = [ { type: i0.Injectable, args: [{ providedIn: 'root' },] }, ]; NgyTutorialService.ctorParameters = function () { return []; }; /** @nocollapse */ NgyTutorialService.ngInjectableDef = i0.defineInjectable({ factory: function NgyTutorialService_Factory() { return new NgyTutorialService(); }, token: NgyTutorialService, providedIn: "root" }); return NgyTutorialService; }()); var TutorialStep = /** @class */ (function () { function TutorialStep(title, prompt, option) { this.options = __assign({}, TutorialStep.DEFAULT_OPTIONS, option); this.title = title; this.prompt = prompt; } TutorialStep.DEFAULT_OPTIONS = { placement: StepPromptPlacement.Below }; return TutorialStep; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgyTutorialComponent = /** @class */ (function () { function NgyTutorialComponent(svc, document) { var _this = this; this.svc = svc; this.document = document; this.enabled = false; this.steps = []; this.currentStep = 0; this.svc.toShow.subscribe(function (stps) { _this.steps = stps; _this.currentStep = 0; if (_this.steps.length) { _this.enabled = true; setTimeout(function () { _this.setupUIForStep(); }); } else { _this.enabled = false; } }); this.svc.currentStep.subscribe(function (step) { _this.currentStep = step; if (_this.currentStep >= _this.steps.length || _this.currentStep < 0) { _this.svc.hideTutorial(); } if (_this.enabled) { setTimeout(function () { _this.setupUIForStep(); }); } }); } /** * @return {?} */ NgyTutorialComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; /** * @private * @return {?} */ NgyTutorialComponent.prototype.setupUIForStep = /** * @private * @return {?} */ function () { /** @type {?} */ var step = this.steps[this.currentStep]; if (step) { this.resetCovers(); this.prompt.ngOnInit(); if (!step.options.relatedElement) { this.coverAll(); } else { /** @type {?} */ var elem = this.document.body.querySelector("#" + step.options.relatedElement); if (elem) { this.coverShowElement(elem); this.prompt.setPromptForElement(elem, step.options.placement); if (step.options.disableInteraction) { this.coverElement(elem); } } else { this.coverAll(); } } } }; /** * @private * @param {?} element * @return {?} */ NgyTutorialComponent.prototype.coverElement = /** * @private * @param {?} element * @return {?} */ function (element) { /** @type {?} */ var positionInfo = element.getBoundingClientRect(); /** @type {?} */ var margin = 10; this.setPosition(this.elementCover.nativeElement, positionInfo.left - margin, positionInfo.top - margin, positionInfo.width + 2 * margin, positionInfo.height + 2 * margin); }; /** * @private * @return {?} */ NgyTutorialComponent.prototype.coverAll = /** * @private * @return {?} */ function () { if (this.topCover) { this.topCover.nativeElement.style.left = '0'; this.topCover.nativeElement.style.top = '0'; this.topCover.nativeElement.style.height = '100vh'; this.prompt.setPromptForElement(); } }; /** * @private * @param {?} element * @return {?} */ NgyTutorialComponent.prototype.coverShowElement = /** * @private * @param {?} element * @return {?} */ function (element) { /** @type {?} */ var positionInfo = element.getBoundingClientRect(); /** @type {?} */ var margin = 10; /** @type {?} */ var viewW = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); /** @type {?} */ var viewH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); this.setPosition(this.topCover.nativeElement, 0, 0, viewW, positionInfo.top - margin); this.setPosition(this.leftCover.nativeElement, 0, positionInfo.top - margin, positionInfo.left - margin, positionInfo.height + 2 * margin); this.setPosition(this.rightCover.nativeElement, positionInfo.left + positionInfo.width + margin, positionInfo.top - margin, viewW - positionInfo.left - positionInfo.width - margin, positionInfo.height + 2 * margin); this.setPosition(this.bottomCover.nativeElement, 0, positionInfo.top + positionInfo.height + margin, viewW, viewH - positionInfo.top - positionInfo.height - margin); }; /** * @private * @param {?} element * @param {?} left * @param {?} top * @param {?} width * @param {?} height * @return {?} */ NgyTutorialComponent.prototype.setPosition = /** * @private * @param {?} element * @param {?} left * @param {?} top * @param {?} width * @param {?} height * @return {?} */ function (element, left, top, width, height) { element.style.left = left + "px"; element.style.top = top + "px"; element.style.width = width + "px"; element.style.height = height + "px"; }; /** * @private * @return {?} */ NgyTutorialComponent.prototype.resetCovers = /** * @private * @return {?} */ function () { if (this.topCover) { this.topCover.nativeElement.style.removeProperty('height'); this.topCover.nativeElement.style.removeProperty('width'); this.topCover.nativeElement.style.removeProperty('top'); this.topCover.nativeElement.style.removeProperty('left'); } if (this.leftCover) { this.leftCover.nativeElement.style.removeProperty('height'); this.leftCover.nativeElement.style.removeProperty('width'); this.leftCover.nativeElement.style.removeProperty('top'); this.leftCover.nativeElement.style.removeProperty('left'); } if (this.rightCover) { this.rightCover.nativeElement.style.removeProperty('height'); this.rightCover.nativeElement.style.removeProperty('width'); this.rightCover.nativeElement.style.removeProperty('top'); this.rightCover.nativeElement.style.removeProperty('left'); } if (this.bottomCover) { this.bottomCover.nativeElement.style.removeProperty('height'); this.bottomCover.nativeElement.style.removeProperty('width'); this.bottomCover.nativeElement.style.removeProperty('top'); this.bottomCover.nativeElement.style.removeProperty('left'); } if (this.elementCover) { this.elementCover.nativeElement.style.removeProperty('height'); this.elementCover.nativeElement.style.removeProperty('width'); this.elementCover.nativeElement.style.removeProperty('top'); this.elementCover.nativeElement.style.removeProperty('left'); } }; NgyTutorialComponent.decorators = [ { type: i0.Component, args: [{ selector: 'lib-ngy-tutorial', template: "<lib-ngy-tutorial-prompt *ngIf=\"enabled\" @fadeAnimation [step]=\"steps[currentStep]\" [stepNumber]=\"currentStep\" [totalSteps]=\"steps.length\" #prompt></lib-ngy-tutorial-prompt>\n<div class=\"window-cover full-width\" #topCover *ngIf=\"enabled\" @fadeAnimation>\n</div>\n<div class=\"window-cover\" #leftCover *ngIf=\"enabled\" @fadeAnimation>\n</div>\n<div class=\"window-cover\" #rightCover *ngIf=\"enabled\" @fadeAnimation>\n</div>\n<div class=\"window-cover full-width\" #bottomCover *ngIf=\"enabled\" @fadeAnimation>\n</div>\n<div class=\"element-cover\" #elementCover>\n\n</div>", styles: [":host{position:fixed;left:0;top:0;width:0;height:0}.window-cover{position:fixed;background:rgba(0,0,0,.8);z-index:998}.window-cover.full-width{width:100vw}.element-cover{position:fixed;z-index:998}lib-ngy-tutorial-prompt{top:0;left:0;position:fixed;z-index:999}"], animations: [ animations.trigger('fadeAnimation', [ animations.transition('void => *', [ animations.query(':self', animations.animate('0.3s ease-in-out', animations.keyframes([ animations.style({ opacity: 0 }), animations.style({ opacity: 1 }), ])), { optional: true }), ]), animations.transition('* => void', [ animations.query(':self', animations.animate('0.3s ease-in-out', animations.keyframes([ animations.style({ opacity: 1 }), animations.style({ opacity: 0 }), ])), { optional: true }), ]), ]), ] },] }, ]; NgyTutorialComponent.ctorParameters = function () { return [ { type: NgyTutorialService }, { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] } ]; }; NgyTutorialComponent.propDecorators = { topCover: [{ type: i0.ViewChild, args: ['topCover',] }], leftCover: [{ type: i0.ViewChild, args: ['leftCover',] }], rightCover: [{ type: i0.ViewChild, args: ['rightCover',] }], bottomCover: [{ type: i0.ViewChild, args: ['bottomCover',] }], elementCover: [{ type: i0.ViewChild, args: ['elementCover',] }], prompt: [{ type: i0.ViewChild, args: ['prompt',] }] }; return NgyTutorialComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var PromptComponent = /** @class */ (function () { function PromptComponent(svc, sani, document, options) { this.svc = svc; this.sani = sani; this.document = document; this.options = options; this.stepNumber = 0; this.totalSteps = 0; this.overrideButtonDisable = false; this.margin = 10; this.appliedClasses = {}; this.appliedTexts = {}; } /** * @return {?} */ PromptComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.appliedClasses = {}; this.appliedTexts = {}; if (this.options.classToAdd) { this.appliedClasses.container = this.options.classToAdd.container ? this.options.classToAdd.container : []; this.appliedClasses.title = this.options.classToAdd.title ? this.options.classToAdd.title : []; this.appliedClasses.prompt = this.options.classToAdd.prompt ? this.options.classToAdd.prompt : []; this.appliedClasses.nextBtn = this.options.classToAdd.nextBtn ? this.options.classToAdd.nextBtn : []; this.appliedClasses.previousBtn = this.options.classToAdd.previousBtn ? this.options.classToAdd.previousBtn : []; this.appliedClasses.finishBtn = this.options.classToAdd.finishBtn ? this.options.classToAdd.finishBtn : []; this.appliedClasses.skipBtn = this.options.classToAdd.skipBtn ? this.options.classToAdd.skipBtn : []; this.appliedClasses.nextIcon = this.options.classToAdd.nextIcon ? this.options.classToAdd.nextIcon : ''; this.appliedClasses.previousIcon = this.options.classToAdd.previousIcon ? this.options.classToAdd.previousIcon : ''; this.appliedClasses.finishIcon = this.options.classToAdd.finishIcon ? this.options.classToAdd.finishIcon : ''; this.appliedClasses.skipIcon = this.options.classToAdd.skipIcon ? this.options.classToAdd.skipIcon : ''; } if (this.step.options && this.step.options.classToAdd) { // tslint:disable-next-line:max-line-length this.appliedClasses.container = this.appliedClasses.container.concat(this.step.options.classToAdd.container ? this.step.options.classToAdd.container : []); // tslint:disable-next-line:max-line-length this.appliedClasses.title = this.appliedClasses.title.concat(this.step.options.classToAdd.title ? this.step.options.classToAdd.title : []); // tslint:disable-next-line:max-line-length this.appliedClasses.prompt = this.appliedClasses.prompt.concat(this.step.options.classToAdd.prompt ? this.step.options.classToAdd.prompt : []); // tslint:disable-next-line:max-line-length this.appliedClasses.nextBtn = this.appliedClasses.nextBtn.concat(this.step.options.classToAdd.nextBtn ? this.step.options.classToAdd.nextBtn : []); // tslint:disable-next-line:max-line-length this.appliedClasses.previousBtn = this.appliedClasses.previousBtn.concat(this.step.options.classToAdd.previousBtn ? this.step.options.classToAdd.previousBtn : []); // tslint:disable-next-line:max-line-length this.appliedClasses.finishBtn = this.appliedClasses.finishBtn.concat(this.step.options.classToAdd.finishBtn ? this.step.options.classToAdd.finishBtn : []); // tslint:disable-next-line:max-line-length this.appliedClasses.skipBtn = this.appliedClasses.skipBtn.concat(this.step.options.classToAdd.skipBtn ? this.step.options.classToAdd.skipBtn : []); // tslint:disable-next-line:max-line-length this.appliedClasses.nextIcon = this.step.options.classToAdd.nextIcon ? this.step.options.classToAdd.nextIcon : this.appliedClasses.nextIcon; // tslint:disable-next-line:max-line-length this.appliedClasses.previousIcon = this.step.options.classToAdd.previousIcon ? this.step.options.classToAdd.previousIcon : this.appliedClasses.previousIcon; // tslint:disable-next-line:max-line-length this.appliedClasses.finishIcon = this.step.options.classToAdd.finishIcon ? this.step.options.classToAdd.finishIcon : this.appliedClasses.finishIcon; // tslint:disable-next-line:max-line-length this.appliedClasses.skipIcon = this.step.options.classToAdd.skipIcon ? this.step.options.classToAdd.skipIcon : this.appliedClasses.skipIcon; } if (this.options.actionTexts) { this.appliedTexts = __assign({}, this.options.actionTexts); } if (this.step.options && this.step.options.actionTexts) { this.appliedTexts = __assign({}, this.appliedTexts, this.step.options.actionTexts); } if (this.step.title) { this.titleSafe = this.sani.bypassSecurityTrustHtml(this.step.title); } if (this.step.prompt) { this.promptSafe = this.sani.bypassSecurityTrustHtml(this.step.prompt); } }; /** * @return {?} */ PromptComponent.prototype.finishTutorial = /** * @return {?} */ function () { this.svc.hideTutorial(); }; /** * @return {?} */ PromptComponent.prototype.nextStep = /** * @return {?} */ function () { this.svc.nextStep(); }; /** * @return {?} */ PromptComponent.prototype.previousStep = /** * @return {?} */ function () { this.svc.previousStep(); }; /** * @param {?=} elem * @param {?=} placement * @return {?} */ PromptComponent.prototype.setPromptForElement = /** * @param {?=} elem * @param {?=} placement * @return {?} */ function (elem, placement) { var _this = this; setTimeout(function () { /** @type {?} */ var promptPositionInfo = _this.prompt.nativeElement.getBoundingClientRect(); /** @type {?} */ var viewW = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); /** @type {?} */ var viewH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); /** @type {?} */ var promptH = promptPositionInfo.height; /** @type {?} */ var promptW = promptPositionInfo.width; if (!elem || placement === undefined) { _this.setPromptPosition(viewW / 2 - promptW / 2, viewH / 2 - promptH / 2); } else { /** @type {?} */ var positionInfo = elem.getBoundingClientRect(); if (placement === StepPromptPlacement.Right) { _this.setPromptPosition(positionInfo.left + positionInfo.width + 2 * _this.margin, positionInfo.top + positionInfo.height / 2 - promptH / 2); } else if (placement === StepPromptPlacement.Left) { _this.setPromptPosition(positionInfo.left - promptW - 2 * _this.margin, positionInfo.top + positionInfo.height / 2 - promptH / 2); } else if (placement === StepPromptPlacement.Above) { _this.setPromptPosition(positionInfo.left + positionInfo.width / 2 - promptW / 2, positionInfo.top - 2 * _this.margin - promptH); } else { _this.setPromptPosition(positionInfo.left + positionInfo.width / 2 - promptW / 2, positionInfo.top + positionInfo.height + 2 * _this.margin); } setTimeout(function () { _this.overrideButtonDisable = _this.isPromptCoveringElement(elem) || _this.isElementOutOfView(elem); }, 200); } }); }; /** * @private * @param {?} left * @param {?} top * @return {?} */ PromptComponent.prototype.setPromptPosition = /** * @private * @param {?} left * @param {?} top * @return {?} */ function (left, top) { /** @type {?} */ var promptPositionInfo = this.prompt.nativeElement.getBoundingClientRect(); /** @type {?} */ var viewW = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); /** @type {?} */ var viewH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); /** @type {?} */ var promptH = promptPositionInfo.height; /** @type {?} */ var promptW = promptPositionInfo.width; if (left < this.margin) { left = this.margin; } if (top < this.margin) { top = this.margin; } if (left > viewW - promptW - this.margin) { left = viewW - promptW - this.margin; } if (top > viewH - promptH - this.margin) { top = viewH - promptH - this.margin; } this.prompt.nativeElement.style.left = left + "px"; this.prompt.nativeElement.style.top = top + "px"; }; /** * @private * @param {?} elem * @return {?} */ PromptComponent.prototype.isPromptCoveringElement = /** * @private * @param {?} elem * @return {?} */ function (elem) { if (!elem) { return false; } /** @type {?} */ var promptPositionInfo = this.prompt.nativeElement.getBoundingClientRect(); /** @type {?} */ var promptL = promptPositionInfo.left; /** @type {?} */ var promptT = promptPositionInfo.top; /** @type {?} */ var promptLW = promptL + promptPositionInfo.width; /** @type {?} */ var promptTH = promptT + promptPositionInfo.height; /** @type {?} */ var positionInfo = elem.getBoundingClientRect(); /** @type {?} */ var elementL = positionInfo.left; /** @type {?} */ var elementT = positionInfo.top; /** @type {?} */ var elementCenterX = elementL + positionInfo.width / 2; /** @type {?} */ var elementCenterY = elementT + positionInfo.height / 2; if (promptTH < elementCenterY || promptT > elementCenterY || promptLW < elementCenterX || promptL > elementCenterX) { return false; } else { return true; } }; /** * @private * @param {?} elem * @return {?} */ PromptComponent.prototype.isElementOutOfView = /** * @private * @param {?} elem * @return {?} */ function (elem) { /** @type {?} */ var positionInfo = elem.getBoundingClientRect(); /** @type {?} */ var viewW = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); /** @type {?} */ var viewH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); if (positionInfo.top + positionInfo.height / 2 > viewH || positionInfo.left + positionInfo.width / 2 > viewW) { return true; } else { return false; } }; PromptComponent.decorators = [ { type: i0.Component, args: [{ selector: 'lib-ngy-tutorial-prompt', template: "<div class=\"prompt-container smooth-2 ngy-tutorial-prompt-container\" [ngClass]=\"appliedClasses.container\" *ngIf=\"step\"\n #prompt>\n <h2 class=\"title ngy-tutorial-title\" [ngClass]=\"appliedClasses.title\" *ngIf=\"step.title\" [innerHTML]=\"titleSafe\"></h2>\n <p class=\"prompt ngy-tutorial-prompt\" [ngClass]=\"appliedClasses.prompt\" *ngIf=\"step.prompt\" [innerHTML]=\"promptSafe\"></p>\n <div class=\"action-container\">\n <div class=\"actions left\">\n <button id=\"lib-ngy-tutorial-previous-btn\" *ngIf=\"(stepNumber !== 0) && (!step.options.disablePrevious || overrideButtonDisable)\" class=\"ngy-tutorial-previous-btn\"\n (click)=\"previousStep()\" [ngClass]=\"appliedClasses.previousBtn\"><i [ngClass]=\"appliedClasses.previousIcon\"\n *ngIf=\"appliedClasses.previousIcon\"></i> {{appliedTexts.previous ? appliedTexts.previous : \"Previous\"}}</button>\n <button id=\"lib-ngy-tutorial-skip-btn\" [ngClass]=\"appliedClasses.skipBtn\" *ngIf=\"stepNumber===0\" class=\"ngy-tutorial-skip-btn\"\n (click)=\"finishTutorial()\"><i [ngClass]=\"appliedClasses.skipIcon\" *ngIf=\"appliedClasses.skipIcon\"></i>\n {{appliedTexts.skip ? appliedTexts.skip : \"Skip\"}}</button>\n </div>\n <div class=\"actions right\">\n <button id=\"lib-ngy-tutorial-next-btn\" *ngIf=\"(stepNumber !== totalSteps - 1) && (!step.options.disableNext || overrideButtonDisable)\" class=\"ngy-tutorial-next-btn\"\n (click)=\"nextStep()\" [ngClass]=\"appliedClasses.nextBtn\"><i [ngClass]=\"appliedClasses.nextIcon\" *ngIf=\"appliedClasses.nextIcon\"></i>\n {{appliedTexts.next ? appliedTexts.next : \"Next\"}}</button>\n <button id=\"lib-ngy-tutorial-finish-btn\" *ngIf=\"(stepNumber === totalSteps - 1) && (!step.options.disableNext || overrideButtonDisable)\"\n class=\"ngy-tutorial-finish-btn\" (click)=\"finishTutorial()\" [ngClass]=\"appliedClasses.finishBtn\"><i [ngClass]=\"appliedClasses.finishIcon\"\n *ngIf=\"appliedClasses.finishIcon\"></i>\n {{appliedTexts.finish ? appliedTexts.finish : \"Finish\"}}</button>\n </div>\n </div>\n</div>", styles: [".prompt-container{max-width:40vw;border-radius:3px;padding:10px;background:#222;box-shadow:0 0 6px rgba(0,0,0,.6);display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative}@media screen and (max-width:768px){.prompt-container{max-width:95vw}}@media screen and (max-width:992px) and (min-width:768px){.prompt-container{max-width:85vw}}.prompt-container .title{margin-bottom:10px}.prompt-container .prompt{text-align:center}.prompt-container .action-container{margin-top:10px;display:flex;width:100%;flex-direction:row}.prompt-container .action-container .actions{width:100%;display:flex;padding:10px}.prompt-container .action-container .actions.left{align-items:flex-start}.prompt-container .action-container .actions.right{justify-content:flex-end}.smooth-2{transition:.2s cubic-bezier(.645,.045,.355,1)}"] },] }, ]; PromptComponent.ctorParameters = function () { return [ { type: NgyTutorialService }, { type: platformBrowser.DomSanitizer }, { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }, { type: undefined, decorators: [{ type: i0.Inject, args: ['ngy-tutorial-options',] }] } ]; }; PromptComponent.propDecorators = { stepNumber: [{ type: i0.Input }], totalSteps: [{ type: i0.Input }], step: [{ type: i0.Input }], prompt: [{ type: i0.ViewChild, args: ['prompt',] }] }; return PromptComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgyTutorialModule = /** @class */ (function () { function NgyTutorialModule() { } /** * @param {?=} options * @return {?} */ NgyTutorialModule.forRoot = /** * @param {?=} options * @return {?} */ function (options) { if (options === void 0) { options = {}; } return { ngModule: NgyTutorialModule, providers: [ NgyTutorialService, { provide: 'ngy-tutorial-options', useValue: options } ] }; }; NgyTutorialModule.decorators = [ { type: i0.NgModule, args: [{ imports: [ common.CommonModule, animations$1.BrowserAnimationsModule ], declarations: [NgyTutorialComponent, PromptComponent], exports: [NgyTutorialComponent] },] }, ]; return NgyTutorialModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ exports.NgyTutorialService = NgyTutorialService; exports.NgyTutorialModule = NgyTutorialModule; exports.StepPromptPlacement = StepPromptPlacement; exports.ɵb = PromptComponent; exports.ɵa = NgyTutorialComponent; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd5LXR1dG9yaWFsLnVtZC5qcy5tYXAiLCJzb3VyY2VzIjpbbnVsbCwibmc6Ly9uZ3ktdHV0b3JpYWwvbGliL2FwaS9pLW9wdGlvbnMudHMiLCJuZzovL25neS10dXRvcmlhbC9saWIvbmd5LXR1dG9yaWFsLnNlcnZpY2UudHMiLCJuZzovL25neS10dXRvcmlhbC9saWIvdHV0b3JpYWwvdHV0b3JpYWwuY29tcG9uZW50LnRzIiwibmc6Ly9uZ3ktdHV0b3JpYWwvbGliL3Byb21wdC9wcm9tcHQuY29tcG9uZW50LnRzIiwibmc6Ly9uZ3ktdHV0b3JpYWwvbGliL25neS10dXRvcmlhbC5tb2R1bGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyohICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq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kge1xyXG4gICAgICAgIGlmIChmKSB0aHJvdyBuZXcgVHlwZUVycm9yKFwiR2VuZXJhdG9yIGlzIGFscmVhZHkgZXhlY3V0aW5nLlwiKTtcclxuICAgICAgICB3aGlsZSAoXykgdHJ5IHtcclxuICAgICAgICAgICAgaWYgKGYgPSAxLCB5ICYmICh0ID0gb3BbMF0gJiAyID8geVtcInJldHVyblwiXSA6IG9wWzBdID8geVtcInRocm93XCJdIHx8ICgodCA9IHlbXCJyZXR1cm5cIl0pICYmIHQuY2FsbCh5KSwgMCkgOiB5Lm5leHQpICYmICEodCA9IHQuY2FsbCh5LCBvcFsxXSkpLmRvbmUpIHJldHVybiB0O1xyXG4gICAgICAgICAgICBpZiAoeSA9IDAsIHQpIG9wID0gW29wWzBdICYgMiwgdC52YWx1ZV07XHJcbiAgICAgICAgICAgIHN3aXRjaCAob3BbMF0pIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgMDogY2FzZSAxOiB0ID0gb3A7IGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA0OiBfLmxhYmVsKys7IHJldHVybiB7IHZhbHVlOiBvcFsxXSwgZG9uZTogZmFsc2UgfTtcclxuICAgICAgICAgICAgICAgIGNhc2UgNTogXy5sYWJlbCsrOyB5ID0gb3BbMV07IG9wID0gWzBdOyBjb250aW51ZTtcclxuICAgICAgICAgICAgICAgIGNhc2UgNzogb3AgPSBfLm9wcy5wb3AoKTsgXy50cnlzLnBvcCgpOyBjb250aW51ZTtcclxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IF8udHJ5cywgdCA9IHQubGVuZ3RoID4gMCAmJiB0W3QubGVuZ3RoIC0gMV0pICYmIChvcFswXSA9PT0gNiB8fCBvcFswXSA9PT0gMikpIHsgXyA9IDA7IGNvbnRpbnVlOyB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wWzBdID09PSAzICYmICghdCB8fCAob3BbMV0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FsbChvKTtcclxuICAgIHJldHVybiB7XHJcbiAgICAgICAgbmV4dDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICBpZiAobyAmJiBpID49IG8ubGVuZ3RoKSBvID0gdm9pZCAwO1xyXG4gICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07XHJcbiAgICAgICAgfVxyXG4gICAgfTtcclxufVxyXG5cclxuZXhwb3J0IGZ1bmN0aW9uIF9fcmVhZChvLCBuKSB7XHJcbiAgICB2YXIgbSA9IHR5cGVvZiBTeW1ib2wgPT09IFwiZnVuY3Rpb25cIiAmJiBvW1N5bWJvbC5pdGVyYXRvcl07XHJcbiAgICBpZiAoIW0pIHJldHVybiBvO1xyXG4gICAgdmFyIGkgPSBtLmNhbGwobyksIHIsIGFyID0gW10sIGU7XHJcbiAgICB0cnkge1xyXG4gICAgICAgIHdoaWxlICgobiA9PT0gdm9pZCAwIHx8IG4tLSA+IDApICYmICEociA9IGkubmV4dCgpKS5kb25lKSBhci5wdXNoKHIudmFsdWUpO1xyXG4gICAgfVxyXG4gICAgY2F0Y2ggKGVycm9yKSB7IGUgPSB7IGVycm9yOiBlcnJvciB9OyB9XHJcbiAgICBmaW5hbGx5IHtcclxuICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICBpZiAociAmJiAhci5kb25lICYmIChtID0gaVtcInJldHVyblwiXSkpIG0uY2FsbChpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZmluYWxseSB7IGlmIChlKSB0aHJvdyBlLmVycm9yOyB9XHJcbiAgICB9XHJcbiAgICByZXR1cm4gYXI7XHJcbn1cclxuXHJcbmV4cG9ydCBmdW5jdGlvbiBfX3NwcmVhZCgpIHtcclxuICAgIGZvciAodmFyIGFyID0gW10sIGkgPSAwOyBpIDwgYXJndW1lbnRzLmxlbmd0aDsgaSsrKVxyXG4gICAgICAgIGFyID0gYXIuY29uY2F0KF9fcmVhZChhcmd1bWVudHNbaV0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