@iotize/ionic
Version:
Iotize specific building blocks on top of @ionic/angular.
159 lines (150 loc) • 12.5 kB
JavaScript
import * as i0 from '@angular/core';
import { Pipe, Component, Input, NgModule } from '@angular/core';
import { Subject, NEVER } from 'rxjs';
import { takeUntil, switchMap, map, share } from 'rxjs/operators';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i1$1 from '@ionic/angular';
import { IonicModule } from '@ionic/angular';
import { TapConfiguratorWriter } from '@iotize/tap/configurator';
function tapConfiguratorEventToProgress(event) {
const progress = event.progress;
return progress ? progress.loaded / progress.total : 0;
}
class TapConfiguratorEventProgressPercentPipe {
transform(event) {
return event ? tapConfiguratorEventToProgress(event) : 0;
}
}
/** @nocollapse */ TapConfiguratorEventProgressPercentPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorEventProgressPercentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
/** @nocollapse */ TapConfiguratorEventProgressPercentPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorEventProgressPercentPipe, name: "tapConfiguratorEventProgressPercent" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorEventProgressPercentPipe, decorators: [{
type: Pipe,
args: [{
name: 'tapConfiguratorEventProgressPercent',
}]
}] });
class TapConfiguratorStepTitlePipe {
transform(data) {
switch (data?.step) {
case TapConfiguratorWriter.Step.applyConfig:
return `Appling configuration`;
case TapConfiguratorWriter.Step.enableSecureCom:
return `Enabling secure communication`;
case TapConfiguratorWriter.Step.executeCall:
return `Writing configuration`;
case TapConfiguratorWriter.Step.factoryReset:
return `Clearing configuration`;
case TapConfiguratorWriter.Step.logout:
return `User logout`;
case TapConfiguratorWriter.Step.validatesConfig:
return `Validating configuration`;
case TapConfiguratorWriter.Step.writeSecurityOptions:
return `Writing security options`;
}
}
}
/** @nocollapse */ TapConfiguratorStepTitlePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorStepTitlePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
/** @nocollapse */ TapConfiguratorStepTitlePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorStepTitlePipe, name: "tapConfiguratorStepTitle" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorStepTitlePipe, decorators: [{
type: Pipe,
args: [{
name: 'tapConfiguratorStepTitle',
}]
}] });
class TapConfiguratorProgressBarComponent {
set events(obs) {
this._eventsStream.next(obs);
}
constructor() {
this._eventsStream = new Subject();
this.destroyed = new Subject();
this._progressEventStream = this._eventsStream.pipe(takeUntil(this.destroyed), switchMap((stream) => {
if (stream === undefined) {
return NEVER;
}
else {
return stream.pipe(map((event) => {
const percent = tapConfiguratorEventToProgress(event);
const step = event.step;
return {
percent,
step,
};
}));
}
}), share());
}
ngOnDestroy() {
this.destroyed.next();
this.destroyed.complete();
}
ngOnInit() {
this._progressEventStream.subscribe((step) => {
this.step = step;
});
}
}
/** @nocollapse */ TapConfiguratorProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TapConfiguratorProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TapConfiguratorProgressBarComponent, selector: "tap-configurator-progress-bar", inputs: { events: "events", color: "color" }, ngImport: i0, template: "<ng-container *ngIf=\"step\">\n <p>\n {{ step | tapConfiguratorStepTitle }}\n </p>\n <ion-progress-bar [color]=\"color\" [value]=\"step.percent\"></ion-progress-bar>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1$1.IonProgressBar, selector: "ion-progress-bar", inputs: ["buffer", "color", "mode", "reversed", "type", "value"] }, { kind: "pipe", type: TapConfiguratorStepTitlePipe, name: "tapConfiguratorStepTitle" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressBarComponent, decorators: [{
type: Component,
args: [{ selector: 'tap-configurator-progress-bar', template: "<ng-container *ngIf=\"step\">\n <p>\n {{ step | tapConfiguratorStepTitle }}\n </p>\n <ion-progress-bar [color]=\"color\" [value]=\"step.percent\"></ion-progress-bar>\n</ng-container>\n" }]
}], ctorParameters: function () { return []; }, propDecorators: { events: [{
type: Input
}], color: [{
type: Input
}] } });
class TapConfiguratorProgressBarModule {
}
/** @nocollapse */ TapConfiguratorProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ TapConfiguratorProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressBarModule, declarations: [TapConfiguratorProgressBarComponent,
TapConfiguratorStepTitlePipe,
TapConfiguratorEventProgressPercentPipe], imports: [CommonModule, IonicModule], exports: [TapConfiguratorProgressBarComponent,
TapConfiguratorStepTitlePipe,
TapConfiguratorEventProgressPercentPipe] });
/** @nocollapse */ TapConfiguratorProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressBarModule, imports: [CommonModule, IonicModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressBarModule, decorators: [{
type: NgModule,
args: [{
declarations: [
TapConfiguratorProgressBarComponent,
TapConfiguratorStepTitlePipe,
TapConfiguratorEventProgressPercentPipe,
],
exports: [
TapConfiguratorProgressBarComponent,
TapConfiguratorStepTitlePipe,
TapConfiguratorEventProgressPercentPipe,
],
imports: [CommonModule, IonicModule],
}]
}] });
class TapConfiguratorProgressModalComponent {
constructor() { }
ngOnInit() { }
}
/** @nocollapse */ TapConfiguratorProgressModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TapConfiguratorProgressModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TapConfiguratorProgressModalComponent, selector: "tap-configurator-progress-modal", ngImport: i0, template: "<ion-header>\n <ion-toolbar>\n <ion-title> Tap configuration </ion-title>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <tap-configurator-progress-bar></tap-configurator-progress-bar>\n</ion-content>\n<ion-footer>\n <ion-item>\n <ion-buttons slot=\"start\">\n <ion-button color=\"danger\"> CANCEL </ion-button>\n </ion-buttons>\n </ion-item>\n</ion-footer>\n", styles: [""], dependencies: [{ kind: "component", type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i1$1.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i1$1.IonContent, selector: "ion-content", inputs: ["color", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i1$1.IonFooter, selector: "ion-footer", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i1$1.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i1$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i1$1.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: i1$1.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: TapConfiguratorProgressBarComponent, selector: "tap-configurator-progress-bar", inputs: ["events", "color"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressModalComponent, decorators: [{
type: Component,
args: [{ selector: 'tap-configurator-progress-modal', template: "<ion-header>\n <ion-toolbar>\n <ion-title> Tap configuration </ion-title>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <tap-configurator-progress-bar></tap-configurator-progress-bar>\n</ion-content>\n<ion-footer>\n <ion-item>\n <ion-buttons slot=\"start\">\n <ion-button color=\"danger\"> CANCEL </ion-button>\n </ion-buttons>\n </ion-item>\n</ion-footer>\n" }]
}], ctorParameters: function () { return []; } });
class TapConfiguratorProgressModalModule {
}
/** @nocollapse */ TapConfiguratorProgressModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ TapConfiguratorProgressModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressModalModule, declarations: [TapConfiguratorProgressModalComponent], imports: [CommonModule, IonicModule, TapConfiguratorProgressBarModule], exports: [TapConfiguratorProgressModalComponent] });
/** @nocollapse */ TapConfiguratorProgressModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressModalModule, imports: [CommonModule, IonicModule, TapConfiguratorProgressBarModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapConfiguratorProgressModalModule, decorators: [{
type: NgModule,
args: [{
declarations: [TapConfiguratorProgressModalComponent],
exports: [TapConfiguratorProgressModalComponent],
imports: [CommonModule, IonicModule, TapConfiguratorProgressBarModule],
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { TapConfiguratorEventProgressPercentPipe, TapConfiguratorProgressBarComponent, TapConfiguratorProgressBarModule, TapConfiguratorProgressModalComponent, TapConfiguratorProgressModalModule, TapConfiguratorStepTitlePipe };
//# sourceMappingURL=iotize-ionic-configurator.mjs.map