UNPKG

ngx-joyride

Version:

[![npm version](https://badge.fury.io/js/ngx-joyride.svg)](https://badge.fury.io/js/ngx-joyride) [![Build Status](https://travis-ci.org/tnicola/ngx-joyride.svg?branch=master)](https://travis-ci.org/tnicola/ngx-joyride) [![codecov](https://codecov.io/gh/

115 lines 15.8 kB
import { Injectable } from '@angular/core'; import { of, Observable } from 'rxjs'; export const DEFAULT_THEME_COLOR = '#3b5560'; export const STEP_DEFAULT_POSITION = 'bottom'; export const DEFAULT_TIMEOUT_BETWEEN_STEPS = 1; export class ObservableCustomTexts { } export const DEFAULT_TEXTS = { prev: of('prev'), next: of('next'), done: of('done'), close: of(null) }; export class JoyrideOptionsService { constructor() { this.themeColor = DEFAULT_THEME_COLOR; this.stepDefaultPosition = STEP_DEFAULT_POSITION; this.logsEnabled = false; this.showCounter = true; this.showPrevButton = true; this.stepsOrder = []; } setOptions(options) { this.stepsOrder = options.steps; this.stepDefaultPosition = options.stepDefaultPosition ? options.stepDefaultPosition : this.stepDefaultPosition; this.logsEnabled = typeof options.logsEnabled !== 'undefined' ? options.logsEnabled : this.logsEnabled; this.showCounter = typeof options.showCounter !== 'undefined' ? options.showCounter : this.showCounter; this.showPrevButton = typeof options.showPrevButton !== 'undefined' ? options.showPrevButton : this.showPrevButton; this.themeColor = options.themeColor ? options.themeColor : this.themeColor; this.firstStep = options.startWith; this.waitingTime = typeof options.waitingTime !== 'undefined' ? options.waitingTime : DEFAULT_TIMEOUT_BETWEEN_STEPS; typeof options.customTexts !== 'undefined' ? this.setCustomText(options.customTexts) : this.setCustomText(DEFAULT_TEXTS); } getBackdropColor() { return this.hexToRgb(this.themeColor); } getThemeColor() { return this.themeColor; } getStepDefaultPosition() { return this.stepDefaultPosition; } getStepsOrder() { return this.stepsOrder; } getFirstStep() { return this.firstStep; } getWaitingTime() { return this.waitingTime; } areLogsEnabled() { return this.logsEnabled; } isCounterVisible() { return this.showCounter; } isPrevButtonVisible() { return this.showPrevButton; } getCustomTexts() { return this.customTexts; } setCustomText(texts) { let prev; let next; let done; let close; prev = texts.prev ? texts.prev : DEFAULT_TEXTS.prev; next = texts.next ? texts.next : DEFAULT_TEXTS.next; done = texts.done ? texts.done : DEFAULT_TEXTS.done; close = texts.close ? texts.close : DEFAULT_TEXTS.close; this.customTexts = { prev: this.toObservable(prev), next: this.toObservable(next), done: this.toObservable(done), close: this.toObservable(close) }; } toObservable(value) { return value instanceof Observable ? value : of(value); } hexToRgb(hex) { const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; hex = hex.replace(shorthandRegex, (m, r, g, b) => { return r + r + g + g + b + b; }); const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}` : null; } } JoyrideOptionsService.decorators = [ { type: Injectable } ]; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiam95cmlkZS1vcHRpb25zLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtam95cmlkZS9zcmMvbGliL3NlcnZpY2VzL2pveXJpZGUtb3B0aW9ucy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFNM0MsT0FBTyxFQUFFLEVBQUUsRUFBRSxVQUFVLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFFdEMsTUFBTSxDQUFDLE1BQU0sbUJBQW1CLEdBQUcsU0FBUyxDQUFDO0FBQzdDLE1BQU0sQ0FBQyxNQUFNLHFCQUFxQixHQUFHLFFBQVEsQ0FBQztBQUM5QyxNQUFNLENBQUMsTUFBTSw2QkFBNkIsR0FBRyxDQUFDLENBQUM7QUFFL0MsTUFBTSxPQUFPLHFCQUFxQjtDQUtqQ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gdGhpcy5zaG93UHJldkJ1dHRvbiA9XHJcbiAgICAgICAgICAgIHR5cGVvZiBvcHRpb25zLnNob3dQcmV2QnV0dG9uICE9PSAndW5kZWZpbmVkJ1xyXG4gICAgICAgICAgICAgICAgPyBvcHRpb25zLnNob3dQcmV2QnV0dG9uXHJcbiAgICAgICAgICAgICAgICA6IHRoaXMuc2hvd1ByZXZCdXR0b247XHJcbiAgICAgICAgdGhpcy50aGVtZUNvbG9yID0gb3B0aW9ucy50aGVtZUNvbG9yXHJcbiAgICAgICAgICAgID8gb3B0aW9ucy50aGVtZUNvbG9yXHJcbiAgICAgICAgICAgIDogdGhpcy50aGVtZUNvbG9yO1xyXG4gICAgICAgIHRoaXMuZmlyc3RTdGVwID0gb3B0aW9ucy5zdGFydFdpdGg7XHJcbiAgICAgICAgdGhpcy53YWl0aW5nVGltZSA9XHJcbiAgICAgICAgICAgIHR5cGVvZiBvcHRpb25zLndhaXRpbmdUaW1lICE9PSAndW5kZWZpbmVkJ1xyXG4gICAgICAgICAgICAgICAgPyBvcHRpb25zLndhaXRpbmdUaW1lXHJcbiAgICAgICAgICAgICAgICA6IERFRkFVTFRfVElNRU9VVF9CRVRXRUVOX1NURVBTO1xyXG4gICAgICAgIHR5cGVvZiBvcHRpb25zLmN1c3RvbVRleHRzICE9PSAndW5kZWZpbmVkJ1xyXG4gICAgICAgICAgICA/IHRoaXMuc2V0Q3VzdG9tVGV4dChvcHRpb25zLmN1c3RvbVRleHRzKVxyXG4gICAgICAgICAgICA6IHRoaXMuc2V0Q3VzdG9tVGV4dChERUZBVUxUX1RFWFRTKTtcclxuICAgIH1cclxuXHJcbiAgICBnZXRCYWNrZHJvcENvbG9yKCkge1xyXG4gICAgICAgIHJldHVybiB0aGlzLmhleFRvUmdiKHRoaXMudGhlbWVDb2xvcik7XHJcbiAgICB9XHJcblxyXG4gICAgZ2V0VGhlbWVDb2xvcigpIHtcclxuICAgICAgICByZXR1cm4gdGhpcy50aGVtZUNvbG9yO1xyXG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ydGhhbmRSZWdleCwgKG06IGFueSwgcjogYW55LCBnOiBhbnksIGI6IGFueSkgPT4ge1xyXG4gICAgICAgICAgICByZXR1cm4gciArIHIgKyBnICsgZyArIGIgKyBiO1xyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICBjb25zdCByZXN1bHQgPSAvXiM/KFthLWZcXGRdezJ9KShbYS1mXFxkXXsyfSkoW2EtZlxcZF17Mn0pJC9pLmV4ZWMoaGV4KTtcclxuICAgICAgICByZXR1cm4gcmVzdWx0XHJcbiAgICAgICAgICAgID8gYCR7cGFyc2VJbnQocmVzdWx0WzFdLCAxNil9LCAke3BhcnNlSW50KFxyXG4gICAgICAgICAgICAgICAgICByZXN1bHRbMl0sXHJcbiAgICAgICAgICAgICAgICAgIDE2XHJcbiAgICAgICAgICAgICAgKX0sICR7cGFyc2VJbnQocmVzdWx0WzNdLCAxNil9YFxyXG4gICAgICAgICAgICA6IG51bGw7XHJcbiAgICB9XHJcbn1cclxuIl19