@pepperi/lib
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.
1,226 lines (1,202 loc) • 121 kB
JavaScript
import { ɵɵdefineInjectable, ɵsetClassMetadata, Injectable, ɵɵinject, Injector, ɵɵdirectiveInject, Renderer2, ElementRef, ɵɵdefineDirective, Directive, ɵɵdefinePipe, Pipe, ɵɵlistener, HostListener, TemplateRef, Input, ViewContainerRef, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule, PLATFORM_ID, Optional, Inject, InjectionToken } from '@angular/core';
import { CommonModule, isPlatformBrowser, DOCUMENT } from '@angular/common';
import { HttpResponse, HTTP_INTERCEPTORS, HttpClientModule, HttpClient } from '@angular/common/http';
import { DomSanitizer, BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ReactiveFormsModule, FormsModule, Validators, FormBuilder } from '@angular/forms';
import { throwError, BehaviorSubject } from 'rxjs';
import { catchError, distinctUntilChanged, delay, finalize, tap } from 'rxjs/operators';
import { TranslateService, TranslateModule } from '@ngx-translate/core';
class JwtHelperService {
constructor() {
}
urlBase64Decode(str) {
let output = str.replace(/-/g, '+').replace(/_/g, '/');
switch (output.length % 4) {
case 0: {
break;
}
case 2: {
output += '==';
break;
}
case 3: {
output += '=';
break;
}
default: {
throw new Error('Illegal base64url string!');
}
}
return this.b64DecodeUnicode(output);
}
// credits for decoder goes to https://github.com/atk
b64decode(str) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let output = '';
str = String(str).replace(/=+$/, '');
if (str.length % 4 === 1) {
throw new Error('\'atob\' failed: The string to be decoded is not correctly encoded.');
}
for (
// initialize result and counters
let bc = 0, bs, buffer, idx = 0;
// get next character
(buffer = str.charAt(idx++));
// character found in table? initialize bit storage and add its ascii value;
~buffer &&
((bs = bc % 4 ? bs * 64 + buffer : buffer),
// and if not first of each 4 characters,
// convert the first 8 bits to one ascii character
bc++ % 4)
? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))
: 0) {
// try to find character in table (0-63, not found => -1)
buffer = chars.indexOf(buffer);
}
return output;
}
b64DecodeUnicode(str) {
return decodeURIComponent(Array.prototype.map
.call(this.b64decode(str), (c) => {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(''));
}
decodeToken(token) {
if (!token || token === '') {
return null;
}
const parts = token.split('.');
if (parts.length !== 3) {
throw new Error('The inspected token doesn\'t appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.');
}
const decoded = this.urlBase64Decode(parts[1]);
if (!decoded) {
throw new Error('Cannot decode the token.');
}
return JSON.parse(decoded);
}
getTokenExpirationDate(token) {
let decoded;
decoded = this.decodeToken(token);
if (!decoded || !decoded.hasOwnProperty('exp')) {
return null;
}
const date = new Date(0);
date.setUTCSeconds(decoded.exp);
return date;
}
isTokenExpired(token, offsetSeconds) {
if (!token || token === '') {
return true;
}
const date = this.getTokenExpirationDate(token);
offsetSeconds = offsetSeconds || 0;
if (date === null) {
return false;
}
return !(date.valueOf() > new Date().valueOf() + offsetSeconds * 1000);
}
getAuthScheme(authScheme, request) {
if (typeof authScheme === 'function') {
return authScheme(request);
}
return authScheme;
}
}
JwtHelperService.ɵfac = function JwtHelperService_Factory(t) { return new (t || JwtHelperService)(); };
JwtHelperService.ɵprov = ɵɵdefineInjectable({ token: JwtHelperService, factory: JwtHelperService.ɵfac, providedIn: 'root' });
/*@__PURE__*/ (function () { ɵsetClassMetadata(JwtHelperService, [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], function () { return []; }, null); })();
class SessionService {
constructor(jwtHelper) {
this.jwtHelper = jwtHelper;
this.IDP_TOKEN_KEY = 'idp_token';
this.PAPI_BASE_URL_KEY = 'pepperi.baseurl';
this.WAPI_TOKEN_KEY = 'auth_token';
this.WAPI_BASE_URL_KEY = 'serverHostURL';
}
// TODO: Maybe need to move this parse into the c'tor.
getParseToken() {
const tokenTest = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjRiYTFjNzJmMTI3NThjYzEzMzg3ZWQ3YTBiZjNlODg3IiwidHlwIjoiSldUIn0.eyJuYmYiOjE1OTY3MjU5NjksImV4cCI6MTU5NjcyNjI2OSwiaXNzIjoiaHR0cHM6Ly9pZHAuc2FuZGJveC5wZXBwZXJpLmNvbSIsImF1ZCI6InBlcHBlcmkud2ViYXBwLmFwcC5zYW5kYm94LnBlcHBlcmkuY29tIiwiaWF0IjoxNTk2NzI1OTY5LCJhdF9oYXNoIjoiSGtmRXJ0Q2JzQ3NzOTVKUm05VmJTdyIsInNpZCI6IjJkNzFiM2JiNWUyNjRiNDk2Y2JmZDkzNmYyNTNhNWIzIiwic3ViIjoiZTJkZmQ0MDYtZDM4Yy00ZmYwLThhZGItMWRlMjI3ODIzYWEyIiwiYXV0aF90aW1lIjoxNTk2NzE4ODA5LCJpZHAiOiJsb2NhbCIsIm5hbWUiOiJkYW5pZWwgZGF2aWRvZmYiLCJlbWFpbCI6ImRhbmllbC5kQHBlcHBlcml0ZXN0LmNvbSIsInBlcHBlcmkuaWQiOjg2OTAzMDQsInBlcHBlcmkudXNlcnV1aWQiOiJlMmRmZDQwNi1kMzhjLTRmZjAtOGFkYi0xZGUyMjc4MjNhYTIiLCJwZXBwZXJpLmRpc3RyaWJ1dG9yaWQiOjMwMDEyMzUxLCJwZXBwZXJpLmRpc3RyaWJ1dG9ydXVpZCI6IjBiZDBlZDc5LThlOWUtNDRmYi05NmY0LThlNTNlZDljZTgyYiIsInBlcHBlcmkuZGF0YWNlbnRlciI6InNhbmRib3giLCJwZXBwZXJpLmtlZXBsb2dpbiI6ZmFsc2UsInBlcHBlcmkuaWRsZXRpbWV3ZWIiOjEyMCwidXBkYXRlZF9hdCI6MTU5NjcwMjgwMCwiZ2l2ZW5fbmFtZSI6ImRhbmllbCIsImZhbWlseV9uYW1lIjoiZGF2aWRvZmYiLCJwZXBwZXJpLmFwaW50YmFzZXVybCI6Imh0dHBzOi8vcmVzdGFwaS5zYW5kYm94LnBlcHBlcmkuY29tIiwicGVwcGVyaS53ZWJhcGliYXNldXJsIjoiaHR0cHM6Ly93ZWJhcGkuc2FuZGJveC5wZXBwZXJpLmNvbS9WMTZfNTAvV2ViQXBwXzYiLCJwZXBwZXJpLnB1YmxpY2FwaWJhc2V1cmwiOiJodHRwczovL2FwaS1zYW5kYm94LnBlcHBlcmkuY29tIiwicGVwcGVyaS5iYXNldXJsIjoiaHR0cHM6Ly9wYXBpLnNhbmRib3gucGVwcGVyaS5jb20vVjEuMCIsInBlcHBlcmkuZW1wbG95ZWV0eXBlIjoxLCJhbXIiOlsicHdkIl19.tNtZT3Cl4dMmTQftoaO2KP5BvHOlWGIP-5GpHrAhZoymBkxBSxpKprQGqr0ATtQlNHjX3gDV1W6k_avaSkyJgDiB2hcwr1tNRilasNuMzNV93gxLC9Oh_HdkIN4cZ0hahIcJvf_17PHpS8zD_MRwvGG_i45wRYJAtiGXChxCMzooethRsLOq5TEwuNbE3MxdjZOpImGYyytmsfdsdJRWQn1LQwQBt95ssuypcUzBsVB34P5XuFttjAe9dhTwHIfgsPG-VdfAWH_r-hVe834wKpKrplSWlC_MucgS0X4XP_tN4CtLnHO2wXKPsojqSTH2NQycfqh6YvT6rzRDBEdQIQ";
const token = this.getIdpToken();
// token = token || tokenTest;
const decodedToken = this.jwtHelper.decodeToken(token);
// const expirationDate = this.jwtHelper.getTokenExpirationDate(token);
// const isExpired = this.jwtHelper.isTokenExpired(token);
return decodedToken;
}
setObject(key, object) {
const stringifiedObject = (typeof object === 'string' || object instanceof String) ? object : JSON.stringify(object);
sessionStorage.setItem(key, stringifiedObject.toString());
}
getObject(key) {
let result = null;
const item = sessionStorage.getItem(key);
try {
result = item ? JSON.parse(item) : item;
}
catch (_a) {
result = item;
}
return result;
}
getPepperiConsumerToken() {
return this.PEPPERI_CONSUMER_TOKEN;
}
gettWapiToken() {
return this.getObject(this.WAPI_TOKEN_KEY);
}
getWapiBaseUrl() {
return this.getObject(this.WAPI_BASE_URL_KEY);
}
getIdpToken() {
return this.getObject(this.IDP_TOKEN_KEY);
}
getPapiBaseUrl() {
const tokenObj = this.getParseToken();
return tokenObj ? tokenObj[this.PAPI_BASE_URL_KEY] : null;
}
}
SessionService.ɵfac = function SessionService_Factory(t) { return new (t || SessionService)(ɵɵinject(JwtHelperService)); };
SessionService.ɵprov = ɵɵdefineInjectable({ token: SessionService, factory: SessionService.ɵfac, providedIn: 'root' });
/*@__PURE__*/ (function () { ɵsetClassMetadata(SessionService, [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], function () { return [{ type: JwtHelperService }]; }, null); })();
class AuthInterceptor {
// private SESSION_TOKEN_KEY = 'auth_token';
// private token = 'secrettoken';
// private refreshTokenInProgress = false;
// private refreshTokenSubject: BehaviorSubject<any> = new BehaviorSubject<any>(null);
constructor(sessionService) {
this.sessionService = sessionService;
this.AUTH_HEADER = 'Authorization';
this.PEPPERI_TOKEN_HEADER = 'PepperiSessionToken';
this.PEPPERI_CONSUMER_KEY_HEADER = 'X-Pepperi-ConsumerKey';
}
// Add authorization token if the token exist.
addAuthorizationToken(request) {
if (!request.headers.has(this.AUTH_HEADER)) {
const idpToken = this.sessionService.getIdpToken();
if (idpToken) {
request = request.clone({
headers: request.headers.set(this.AUTH_HEADER, `Bearer ${idpToken}`)
});
}
}
return request;
}
// Add pepperi consumer token if calling to papi domain.
addPepperiConsumerToken(request) {
if (!request.headers.has(this.PEPPERI_CONSUMER_KEY_HEADER)) {
const papiBaseUrl = this.sessionService.getPapiBaseUrl();
if (papiBaseUrl && request.url.match(new RegExp(papiBaseUrl, 'g'))) {
const pepperiConsumerToken = this.sessionService.getPepperiConsumerToken();
if (pepperiConsumerToken) {
request = request.clone({
headers: request.headers.set(this.PEPPERI_CONSUMER_KEY_HEADER, pepperiConsumerToken)
});
}
}
}
return request;
}
// Add web api token if calling to wapi domain.
addWebApiToken(request) {
if (!request.headers.has(this.PEPPERI_TOKEN_HEADER)) {
const wapiBaseUrl = this.sessionService.getWapiBaseUrl();
if (wapiBaseUrl && request.url.match(new RegExp(wapiBaseUrl, 'g'))) {
const webApiToken = this.sessionService.gettWapiToken();
if (webApiToken) {
request = request.clone({
headers: request.headers.set(this.PEPPERI_TOKEN_HEADER, webApiToken)
});
}
}
}
return request;
}
intercept(req, next) {
console.warn('AuthInterceptor');
// Add content type
if (!req.headers.has('Content-Type')) {
req = req.clone({
headers: req.headers.set('Content-Type', 'application/json')
});
}
req = this.addAuthorizationToken(req);
req = this.addPepperiConsumerToken(req);
req = this.addWebApiToken(req);
return next.handle(req);
// TODO: Check if we need this - this is an advance code that try to refresh the token in case of expired.
// return next.handle(req).pipe(
// catchError((error: HttpErrorResponse) => {
// if (error && error.status === 401) {
// // 401 errors are most likely going to be because we have an expired token that we need to refresh.
// if (this.refreshTokenInProgress) {
// // If refreshTokenInProgress is true, we will wait until refreshTokenSubject has a non-null value
// // which means the new token is ready and we can retry the request again
// return this.refreshTokenSubject.pipe(
// filter(result => result !== null),
// take(1),
// switchMap(() => next.handle(this.addAuthenticationToken(req)))
// );
// } else {
// this.refreshTokenInProgress = true;
// // Set the refreshTokenSubject to null so that subsequent API calls will
// // wait until the new token has been retrieved
// this.refreshTokenSubject.next(null);
// return this.refreshAccessToken().pipe(
// switchMap((success: boolean) => {
// this.refreshTokenSubject.next(success);
// return next.handle(this.addAuthenticationToken(req));
// }),
// // When the call to refreshToken completes we reset the refreshTokenInProgress to false
// // for the next time the token needs to be refreshed
// finalize(() => (this.refreshTokenInProgress = false))
// );
// }
// } else {
// return throwError(error);
// }
// })
// );
}
}
AuthInterceptor.ɵfac = function AuthInterceptor_Factory(t) { return new (t || AuthInterceptor)(ɵɵinject(SessionService)); };
AuthInterceptor.ɵprov = ɵɵdefineInjectable({ token: AuthInterceptor, factory: AuthInterceptor.ɵfac });
/*@__PURE__*/ (function () { ɵsetClassMetadata(AuthInterceptor, [{
type: Injectable
}], function () { return [{ type: SessionService }]; }, null); })();
// import { ToastrService } from 'ngx-toastr';
class ErrorInterceptor {
constructor() { }
intercept(req, next) {
console.warn('ErrorInterceptor');
return next.handle(req)
.pipe(
// retry(2), TODO: Check if we want to retry
catchError((error) => {
// 401 handled in auth.interceptor
if (error.status !== 401) {
// TODO: Show error in dialog.
// this.toastr.error(error.message);
}
return throwError(error);
}));
}
}
ErrorInterceptor.ɵfac = function ErrorInterceptor_Factory(t) { return new (t || ErrorInterceptor)(); };
ErrorInterceptor.ɵprov = ɵɵdefineInjectable({ token: ErrorInterceptor, factory: ErrorInterceptor.ɵfac });
/*@__PURE__*/ (function () { ɵsetClassMetadata(ErrorInterceptor, [{
type: Injectable
}], function () { return []; }, null); })();
class LoaderService {
constructor() {
this.counter = 0;
this.showLoaderSubject = new BehaviorSubject(false);
}
get onChanged$() {
return this.showLoaderSubject.asObservable().pipe(distinctUntilChanged());
}
show() {
this.counter++;
this.showLoaderSubject.next(true);
}
hide() {
this.counter--;
if (this.counter === 0) {
this.showLoaderSubject.next(false);
}
}
}
LoaderService.ɵfac = function LoaderService_Factory(t) { return new (t || LoaderService)(); };
LoaderService.ɵprov = ɵɵdefineInjectable({ token: LoaderService, factory: LoaderService.ɵfac, providedIn: 'root' });
/*@__PURE__*/ (function () { ɵsetClassMetadata(LoaderService, [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], function () { return []; }, null); })();
class LoaderInterceptor {
constructor(injector) {
this.injector = injector;
}
intercept(req, next) {
console.warn('LoaderInterceptor');
const loaderService = this.injector.get(LoaderService);
loaderService.show();
// TODO: Remove the delay.
return next.handle(req).pipe(delay(3000), finalize(() => loaderService.hide()));
}
}
LoaderInterceptor.ɵfac = function LoaderInterceptor_Factory(t) { return new (t || LoaderInterceptor)(ɵɵinject(Injector)); };
LoaderInterceptor.ɵprov = ɵɵdefineInjectable({ token: LoaderInterceptor, factory: LoaderInterceptor.ɵfac });
/*@__PURE__*/ (function () { ɵsetClassMetadata(LoaderInterceptor, [{
type: Injectable
}], function () { return [{ type: Injector }]; }, null); })();
class ProfilerInterceptor {
intercept(req, next) {
console.warn('ProfilerInterceptor');
const started = Date.now();
let ok;
return next.handle(req).pipe(tap(
// Succeeds when there is a response; ignore other events
(event) => {
if (event instanceof HttpResponse) {
ok = 'succeeded';
}
},
// Operation failed; error is an HttpErrorResponse
error => (ok = 'failed')),
// Log when response observable either completes or errors
finalize(() => {
const elapsed = Date.now() - started;
const msg = `${req.method} "${req.urlWithParams}" ${ok} in ${elapsed} ms.`;
console.log(msg);
}));
}
}
ProfilerInterceptor.ɵfac = function ProfilerInterceptor_Factory(t) { return new (t || ProfilerInterceptor)(); };
ProfilerInterceptor.ɵprov = ɵɵdefineInjectable({ token: ProfilerInterceptor, factory: ProfilerInterceptor.ɵfac });
/*@__PURE__*/ (function () { ɵsetClassMetadata(ProfilerInterceptor, [{
type: Injectable
}], null, null); })();
const httpInterceptorProviders = [
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
// { provide: HTTP_INTERCEPTORS, useClass: CacheInterceptor, multi: true },
// { provide: HTTP_INTERCEPTORS, useClass: ConvertInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
// { provide: HTTP_INTERCEPTORS, useClass: FakeInterceptor, multi: true },
// { provide: HTTP_INTERCEPTORS, useClass: HeaderInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: LoaderInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ProfilerInterceptor, multi: true },
];
// Const BIDI_RTL_LANGS Array
// BIDI_RTL_LANGS ref: http://en.wikipedia.org/wiki/Right-to-left
// Table of scripts in Unicode: https://en.wikipedia.org/wiki/Script_(Unicode)
const _BIDI_RTL_LANGS = [
'ae',
'ar',
'arc',
'bcc',
'bqi',
'ckb',
'dv',
'fa',
'glk',
'he',
'ku',
'mzn',
'nqo',
'pnb',
'ps',
'sd',
'ug',
'ur',
'yi' /* 'ייִדיש', Yiddish */
];
var ORIENTATION;
(function (ORIENTATION) {
ORIENTATION[ORIENTATION["Landscape"] = 0] = "Landscape";
ORIENTATION[ORIENTATION["Portrait"] = 1] = "Portrait";
})(ORIENTATION || (ORIENTATION = {}));
var SCREEN_SIZE;
(function (SCREEN_SIZE) {
SCREEN_SIZE[SCREEN_SIZE["XL"] = 0] = "XL";
SCREEN_SIZE[SCREEN_SIZE["LG"] = 1] = "LG";
SCREEN_SIZE[SCREEN_SIZE["MD"] = 2] = "MD";
SCREEN_SIZE[SCREEN_SIZE["SM"] = 3] = "SM";
SCREEN_SIZE[SCREEN_SIZE["XS"] = 4] = "XS";
})(SCREEN_SIZE || (SCREEN_SIZE = {}));
class LayoutService {
constructor(translate) {
this.translate = translate;
this.resizeSubject = new BehaviorSubject(SCREEN_SIZE.LG);
}
get onResize$() {
return this.resizeSubject.asObservable().pipe(distinctUntilChanged());
}
/**
* Set the current screen size.
* @param size The size to change to.
*/
onResize(size) {
this.resizeSubject.next(size);
}
getOrintation() {
if (window.innerHeight > window.innerWidth) {
return ORIENTATION.Portrait;
}
else {
return ORIENTATION.Landscape;
}
}
getScreenWidth() {
let retVal = 250.0;
switch (this.resizeSubject.getValue()) {
case SCREEN_SIZE.XS: {
retVal = this.getOrintation() === ORIENTATION.Landscape ? 130.0 : 65.0;
break;
}
case SCREEN_SIZE.SM:
case SCREEN_SIZE.MD: {
retVal = this.getOrintation() === ORIENTATION.Landscape ? 220.0 : 140.0;
break;
}
case SCREEN_SIZE.LG: {
retVal = this.getOrintation() === ORIENTATION.Landscape ? 400.0 : 250.0;
break;
}
}
return retVal;
}
getScreenHeight() {
let retVal = 250.0;
switch (this.resizeSubject.getValue()) {
case SCREEN_SIZE.XS: {
retVal = this.getOrintation() === ORIENTATION.Landscape ? 65.0 : 130.0;
break;
}
case SCREEN_SIZE.SM:
case SCREEN_SIZE.MD: {
retVal = this.getOrintation() === ORIENTATION.Landscape ? 140.0 : 220.0;
break;
}
case SCREEN_SIZE.LG: {
retVal = this.getOrintation() === ORIENTATION.Landscape ? 250.0 : 400.0;
break;
}
}
return retVal;
}
getScreenHeightPx() {
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
}
getScreenWidthPx() {
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
}
getCurrentLanguage() {
return this.translate && this.translate.currentLang || navigator.language;
}
isRtl() {
const userLang = this.getCurrentLanguage();
const isRtl = _BIDI_RTL_LANGS.indexOf(userLang) >= 0;
return isRtl;
}
}
LayoutService.ɵfac = function LayoutService_Factory(t) { return new (t || LayoutService)(ɵɵinject(TranslateService)); };
LayoutService.ɵprov = ɵɵdefineInjectable({ token: LayoutService, factory: LayoutService.ɵfac, providedIn: 'root' });
/*@__PURE__*/ (function () { ɵsetClassMetadata(LayoutService, [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], function () { return [{ type: TranslateService }]; }, null); })();
class RtlClassDirective {
constructor(layoutService, renderer, element) {
this.layoutService = layoutService;
this.renderer = renderer;
this.element = element;
}
ngOnInit() {
const isRtl = this.layoutService.isRtl();
if (isRtl) {
this.renderer.addClass(this.element.nativeElement, 'rtl');
}
}
}
RtlClassDirective.ɵfac = function RtlClassDirective_Factory(t) { return new (t || RtlClassDirective)(ɵɵdirectiveInject(LayoutService), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ElementRef)); };
RtlClassDirective.ɵdir = ɵɵdefineDirective({ type: RtlClassDirective, selectors: [["", "pepRtlClass", ""]] });
/*@__PURE__*/ (function () { ɵsetClassMetadata(RtlClassDirective, [{
type: Directive,
args: [{
selector: '[pepRtlClass]',
}]
}], function () { return [{ type: LayoutService }, { type: Renderer2 }, { type: ElementRef }]; }, null); })();
class RtlDirectionDirective {
constructor(layoutService, renderer, element) {
this.layoutService = layoutService;
this.renderer = renderer;
this.element = element;
}
ngOnInit() {
const isRtl = this.layoutService.isRtl();
this.renderer.setAttribute(this.element.nativeElement, 'dir', isRtl ? 'rtl' : 'ltr');
}
}
RtlDirectionDirective.ɵfac = function RtlDirectionDirective_Factory(t) { return new (t || RtlDirectionDirective)(ɵɵdirectiveInject(LayoutService), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ElementRef)); };
RtlDirectionDirective.ɵdir = ɵɵdefineDirective({ type: RtlDirectionDirective, selectors: [["", "pepRtlDirection", ""]] });
/*@__PURE__*/ (function () { ɵsetClassMetadata(RtlDirectionDirective, [{
type: Directive,
args: [{
selector: '[pepRtlDirection]',
}]
}], function () { return [{ type: LayoutService }, { type: Renderer2 }, { type: ElementRef }]; }, null); })();
class CapitalizePipe {
transform(value) {
if (value) {
return value.charAt(0).toUpperCase() + value.slice(1);
}
return value;
}
}
CapitalizePipe.ɵfac = function CapitalizePipe_Factory(t) { return new (t || CapitalizePipe)(); };
CapitalizePipe.ɵpipe = ɵɵdefinePipe({ name: "capitalize", type: CapitalizePipe, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(CapitalizePipe, [{
type: Pipe,
args: [{ name: 'capitalize' }]
}], null, null); })();
class EncodePipe {
transform(value) {
if (value) {
const v = btoa(value);
return v;
}
return value;
}
}
EncodePipe.ɵfac = function EncodePipe_Factory(t) { return new (t || EncodePipe)(); };
EncodePipe.ɵpipe = ɵɵdefinePipe({ name: "encodePipe", type: EncodePipe, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(EncodePipe, [{
type: Pipe,
args: [{ name: 'encodePipe' }]
}], null, null); })();
class EscapePipe {
transform(value) {
if (value) {
const v = escape(value);
return v;
}
return value;
}
}
EscapePipe.ɵfac = function EscapePipe_Factory(t) { return new (t || EscapePipe)(); };
EscapePipe.ɵpipe = ɵɵdefinePipe({ name: "escapePipe", type: EscapePipe, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(EscapePipe, [{
type: Pipe,
args: [{ name: 'escapePipe' }]
}], null, null); })();
class ReplaceLineBreaks {
transform(value) {
const newValue = value.replace(/(<br\ ?\/?>)/g, ' ');
return newValue;
}
}
ReplaceLineBreaks.ɵfac = function ReplaceLineBreaks_Factory(t) { return new (t || ReplaceLineBreaks)(); };
ReplaceLineBreaks.ɵpipe = ɵɵdefinePipe({ name: "replaceLineBreaks", type: ReplaceLineBreaks, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(ReplaceLineBreaks, [{
type: Pipe,
args: [{ name: 'replaceLineBreaks' }]
}], null, null); })();
class DateFormatter {
transform(value, culture, showTime = false) {
let res = '';
value = new Date(value);
if (value) {
res = value.toLocaleDateString(culture || 'en-US');
if (showTime) {
res += ' ' + value.toLocaleTimeString((culture || 'en-US'), { hour: '2-digit', minute: '2-digit' });
}
}
return res;
}
}
DateFormatter.ɵfac = function DateFormatter_Factory(t) { return new (t || DateFormatter)(); };
DateFormatter.ɵpipe = ɵɵdefinePipe({ name: "dateFormatter", type: DateFormatter, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(DateFormatter, [{
type: Pipe,
args: [{ name: 'dateFormatter' }]
}], null, null); })();
class DateStringFormatter {
transform(value, culture, showTime = false) {
let res = '';
const tmpDate = new Date(value);
if (value) {
res = tmpDate.toLocaleDateString(culture || 'en-US');
if (showTime) {
res += ' ' + tmpDate.toLocaleTimeString(culture || 'en-US');
}
}
return res;
}
}
DateStringFormatter.ɵfac = function DateStringFormatter_Factory(t) { return new (t || DateStringFormatter)(); };
DateStringFormatter.ɵpipe = ɵɵdefinePipe({ name: "dateStringFormatter", type: DateStringFormatter, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(DateStringFormatter, [{
type: Pipe,
args: [{ name: 'dateStringFormatter' }]
}], null, null); })();
class SafeHtmlPipe {
constructor(sanitizer) {
this.sanitizer = sanitizer;
}
transform(html) {
return this.sanitizer.bypassSecurityTrustHtml(html);
}
}
SafeHtmlPipe.ɵfac = function SafeHtmlPipe_Factory(t) { return new (t || SafeHtmlPipe)(ɵɵdirectiveInject(DomSanitizer)); };
SafeHtmlPipe.ɵpipe = ɵɵdefinePipe({ name: "safeHtml", type: SafeHtmlPipe, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(SafeHtmlPipe, [{
type: Pipe,
args: [{ name: 'safeHtml' }]
}], function () { return [{ type: DomSanitizer }]; }, null); })();
class SafePipe {
constructor(sanitizer) {
this.sanitizer = sanitizer;
}
transform(value, type) {
switch (type) {
case 'html': return this.sanitizer.bypassSecurityTrustHtml(value);
case 'style': return this.sanitizer.bypassSecurityTrustStyle(value);
case 'script': return this.sanitizer.bypassSecurityTrustScript(value);
case 'url': return this.sanitizer.bypassSecurityTrustUrl(value);
case 'resourceUrl': return this.sanitizer.bypassSecurityTrustResourceUrl(value);
default: throw new Error(`Invalid safe type specified: ${type}`);
}
}
}
SafePipe.ɵfac = function SafePipe_Factory(t) { return new (t || SafePipe)(ɵɵdirectiveInject(DomSanitizer)); };
SafePipe.ɵpipe = ɵɵdefinePipe({ name: "safe", type: SafePipe, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(SafePipe, [{
type: Pipe,
args: [{
name: 'safe'
}]
}], function () { return [{ type: DomSanitizer }]; }, null); })();
class SplitUppercase {
transform(value) {
const newValue = value.replace(/([a-z])([A-Z])/g, '$1 $2');
return newValue;
}
}
SplitUppercase.ɵfac = function SplitUppercase_Factory(t) { return new (t || SplitUppercase)(); };
SplitUppercase.ɵpipe = ɵɵdefinePipe({ name: "splitUppercase", type: SplitUppercase, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(SplitUppercase, [{
type: Pipe,
args: [{ name: 'splitUppercase' }]
}], null, null); })();
class ToNumber {
transform(value) {
return parseInt(value);
}
}
ToNumber.ɵfac = function ToNumber_Factory(t) { return new (t || ToNumber)(); };
ToNumber.ɵpipe = ɵɵdefinePipe({ name: "toNumber", type: ToNumber, pure: true });
/*@__PURE__*/ (function () { ɵsetClassMetadata(ToNumber, [{
type: Pipe,
args: [{ name: 'toNumber' }]
}], null, null); })();
class ButtonBlurDirective {
constructor(element) {
this.element = element;
}
onClick() {
setTimeout(() => {
this.element.nativeElement.blur();
}, 0);
}
}
ButtonBlurDirective.ɵfac = function ButtonBlurDirective_Factory(t) { return new (t || ButtonBlurDirective)(ɵɵdirectiveInject(ElementRef)); };
ButtonBlurDirective.ɵdir = ɵɵdefineDirective({ type: ButtonBlurDirective, selectors: [["", "pepButtonBlur", ""]], hostBindings: function ButtonBlurDirective_HostBindings(rf, ctx) { if (rf & 1) {
ɵɵlistener("click", function ButtonBlurDirective_click_HostBindingHandler() { return ctx.onClick(); });
} } });
/*@__PURE__*/ (function () { ɵsetClassMetadata(ButtonBlurDirective, [{
type: Directive,
args: [{
selector: '[pepButtonBlur]'
}]
}], function () { return [{ type: ElementRef }]; }, { onClick: [{
type: HostListener,
args: ['click']
}] }); })();
class MenuBlurDirective {
constructor(element) {
this.element = element;
}
menuClosedEvent() {
setTimeout(() => {
this.element.nativeElement.blur();
}, 0);
}
menuOpenedEvent() {
setTimeout(() => {
this.element.nativeElement.blur();
}, 0);
}
}
MenuBlurDirective.ɵfac = function MenuBlurDirective_Factory(t) { return new (t || MenuBlurDirective)(ɵɵdirectiveInject(ElementRef)); };
MenuBlurDirective.ɵdir = ɵɵdefineDirective({ type: MenuBlurDirective, selectors: [["", "pepMenuBlur", ""]], hostBindings: function MenuBlurDirective_HostBindings(rf, ctx) { if (rf & 1) {
ɵɵlistener("menuClosed", function MenuBlurDirective_menuClosed_HostBindingHandler() { return ctx.menuClosedEvent(); })("menuOpened", function MenuBlurDirective_menuOpened_HostBindingHandler() { return ctx.menuOpenedEvent(); });
} } });
/*@__PURE__*/ (function () { ɵsetClassMetadata(MenuBlurDirective, [{
type: Directive,
args: [{
selector: '[pepMenuBlur]'
}]
}], function () { return [{ type: ElementRef }]; }, { menuClosedEvent: [{
type: HostListener,
args: ['menuClosed']
}], menuOpenedEvent: [{
type: HostListener,
args: ['menuOpened']
}] }); })();
class PortalService {
constructor() {
this.targets = new Map();
}
addTarget(targetName, viewContainer) {
this.targets.set(targetName, viewContainer);
}
attach(targetName, template) {
const target = this.getTarget(targetName);
if (target) {
target.createEmbeddedView(template);
}
}
clear(targetName) {
const target = this.getTarget(targetName);
if (target) {
target.clear();
}
}
getTarget(targetName) {
return this.targets.has(targetName) ? this.targets.get(targetName) : null;
}
}
PortalService.ɵfac = function PortalService_Factory(t) { return new (t || PortalService)(); };
PortalService.ɵprov = ɵɵdefineInjectable({ token: PortalService, factory: PortalService.ɵfac, providedIn: 'root' });
/*@__PURE__*/ (function () { ɵsetClassMetadata(PortalService, [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], function () { return []; }, null); })();
class AttachDirective {
constructor(portalService, templateRef) {
this.portalService = portalService;
this.templateRef = templateRef;
}
ngOnInit() {
this.portalService.attach(this.targetName, this.templateRef);
}
ngOnDestroy() {
this.portalService.clear(this.targetName);
}
}
AttachDirective.ɵfac = function AttachDirective_Factory(t) { return new (t || AttachDirective)(ɵɵdirectiveInject(PortalService), ɵɵdirectiveInject(TemplateRef)); };
AttachDirective.ɵdir = ɵɵdefineDirective({ type: AttachDirective, selectors: [["", "pepAttach", ""]], inputs: { targetName: ["pepAttach", "targetName"] } });
/*@__PURE__*/ (function () { ɵsetClassMetadata(AttachDirective, [{
type: Directive,
args: [{
selector: '[pepAttach]',
}]
}], function () { return [{ type: PortalService }, { type: TemplateRef }]; }, { targetName: [{
type: Input,
args: ['pepAttach']
}] }); })();
class TargetDirective {
constructor(portalService, viewContainer) {
this.portalService = portalService;
this.viewContainer = viewContainer;
}
ngOnInit() {
this.portalService.addTarget(this.targetName, this.viewContainer);
}
}
TargetDirective.ɵfac = function TargetDirective_Factory(t) { return new (t || TargetDirective)(ɵɵdirectiveInject(PortalService), ɵɵdirectiveInject(ViewContainerRef)); };
TargetDirective.ɵdir = ɵɵdefineDirective({ type: TargetDirective, selectors: [["", "pepTarget", ""]], inputs: { targetName: ["pepTarget", "targetName"] } });
/*@__PURE__*/ (function () { ɵsetClassMetadata(TargetDirective, [{
type: Directive,
args: [{
selector: '[pepTarget]',
}]
}], function () { return [{ type: PortalService }, { type: ViewContainerRef }]; }, { targetName: [{
type: Input,
args: ['pepTarget']
}] }); })();
const layoutList = [
RtlClassDirective,
RtlDirectionDirective,
];
const pipeList = [
CapitalizePipe,
EncodePipe,
EscapePipe,
ReplaceLineBreaks,
DateFormatter,
DateStringFormatter,
SafeHtmlPipe,
SafePipe,
SplitUppercase,
ToNumber
];
const utilitiesList = [
ButtonBlurDirective,
MenuBlurDirective
];
const portalList = [
AttachDirective,
TargetDirective
];
// export class Loader implements TranslateLoader {
// private translations = new Subject();
// $translations = this.translations.asObservable();
// getTranslation(lang: string) {
// console.log(`called with ${lang}`);
// return this.$translations;
// }
// }
// export class Missing implements MissingTranslationHandler {
// handle(params: MissingTranslationHandlerParams) {
// return '... missing translation';
// }
// }
// export function LoaderFactory() {
// ;
// return new Loader();
// }
// export function LoaderFactoryHttp(http: HttpClient) {
// return new TranslateHttpLoader(http, './assets/pepperi-lib/i18n/', '.json');
// }
class PepperiModule {
}
PepperiModule.ɵmod = ɵɵdefineNgModule({ type: PepperiModule });
PepperiModule.ɵinj = ɵɵdefineInjector({ factory: function PepperiModule_Factory(t) { return new (t || PepperiModule)(); }, providers: [
httpInterceptorProviders,
], imports: [[
CommonModule,
HttpClientModule,
BrowserModule,
BrowserAnimationsModule,
ReactiveFormsModule,
FormsModule,
], TranslateModule] });
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(PepperiModule, { declarations: [CapitalizePipe,
EncodePipe,
EscapePipe,
ReplaceLineBreaks,
DateFormatter,
DateStringFormatter,
SafeHtmlPipe,
SafePipe,
SplitUppercase,
ToNumber, ButtonBlurDirective,
MenuBlurDirective, RtlClassDirective,
RtlDirectionDirective, AttachDirective,
TargetDirective], imports: [CommonModule,
HttpClientModule,
BrowserModule,
BrowserAnimationsModule,
ReactiveFormsModule,
FormsModule], exports: [CapitalizePipe,
EncodePipe,
EscapePipe,
ReplaceLineBreaks,
DateFormatter,
DateStringFormatter,
SafeHtmlPipe,
SafePipe,
SplitUppercase,
ToNumber, ButtonBlurDirective,
MenuBlurDirective, RtlClassDirective,
RtlDirectionDirective, AttachDirective,
TargetDirective, TranslateModule] }); })();
/*@__PURE__*/ (function () { ɵsetClassMetadata(PepperiModule, [{
type: NgModule,
args: [{
declarations: [
pipeList,
utilitiesList,
layoutList,
portalList
],
providers: [
httpInterceptorProviders,
],
imports: [
CommonModule,
HttpClientModule,
BrowserModule,
BrowserAnimationsModule,
ReactiveFormsModule,
FormsModule,
],
exports: [
pipeList,
utilitiesList,
layoutList,
portalList,
TranslateModule
],
}]
}], null, null); })();
/*
* Public API Surface of pepperi-lib/core/common/directives
*/
/*
* export from pepperi-lib/core/common/directives
*/
var FIELD_TYPE;
(function (FIELD_TYPE) {
// specify text field
FIELD_TYPE[FIELD_TYPE["Default"] = 0] = "Default";
FIELD_TYPE[FIELD_TYPE["TextBox"] = 1] = "TextBox";
FIELD_TYPE[FIELD_TYPE["LimitedLengthTextBox"] = 2] = "LimitedLengthTextBox";
// specify text area field
FIELD_TYPE[FIELD_TYPE["TextArea"] = 3] = "TextArea";
FIELD_TYPE[FIELD_TYPE["TextHeader"] = 4] = "TextHeader";
// specify date field
FIELD_TYPE[FIELD_TYPE["Date"] = 5] = "Date";
// specify date & time field
FIELD_TYPE[FIELD_TYPE["DateAndTime"] = 6] = "DateAndTime";
// specify integer field
FIELD_TYPE[FIELD_TYPE["NumberInteger"] = 7] = "NumberInteger";
// specify decimal field
FIELD_TYPE[FIELD_TYPE["NumberReal"] = 8] = "NumberReal";
// specify currency field
FIELD_TYPE[FIELD_TYPE["Currency"] = 9] = "Currency";
// specify boolean field
FIELD_TYPE[FIELD_TYPE["Boolean"] = 10] = "Boolean";
// specify multiple options field
FIELD_TYPE[FIELD_TYPE["ComboBox"] = 11] = "ComboBox";
// specify multiple options field
FIELD_TYPE[FIELD_TYPE["MultiTickBox"] = 12] = "MultiTickBox";
// specify separator (view only) field
FIELD_TYPE[FIELD_TYPE["Separator"] = 13] = "Separator";
// specify address field
FIELD_TYPE[FIELD_TYPE["Address"] = 14] = "Address";
// specify percentage field
FIELD_TYPE[FIELD_TYPE["Percentage"] = 15] = "Percentage";
FIELD_TYPE[FIELD_TYPE["EmptyComboBox"] = 16] = "EmptyComboBox";
FIELD_TYPE[FIELD_TYPE["InternalLink"] = 17] = "InternalLink";
// specify email field
FIELD_TYPE[FIELD_TYPE["Email"] = 18] = "Email";
FIELD_TYPE[FIELD_TYPE["LimitedDate"] = 19] = "LimitedDate";
// specify image field
FIELD_TYPE[FIELD_TYPE["Image"] = 20] = "Image";
FIELD_TYPE[FIELD_TYPE["MultiTickBoxToComboBox"] = 21] = "MultiTickBoxToComboBox";
FIELD_TYPE[FIELD_TYPE["EmptyMultiTickBox"] = 22] = "EmptyMultiTickBox";
FIELD_TYPE[FIELD_TYPE["Totals"] = 23] = "Totals";
// specify attachment field
FIELD_TYPE[FIELD_TYPE["Attachment"] = 24] = "Attachment";
FIELD_TYPE[FIELD_TYPE["Signature"] = 25] = "Signature";
// specify link field
FIELD_TYPE[FIELD_TYPE["Link"] = 26] = "Link";
// specify image url field
FIELD_TYPE[FIELD_TYPE["ImageURL"] = 27] = "ImageURL";
FIELD_TYPE[FIELD_TYPE["NumberIntegerQuantitySelector"] = 28] = "NumberIntegerQuantitySelector";
FIELD_TYPE[FIELD_TYPE["NumberRealQuantitySelector"] = 29] = "NumberRealQuantitySelector";
FIELD_TYPE[FIELD_TYPE["NumberIntegerForMatrix"] = 30] = "NumberIntegerForMatrix";
FIELD_TYPE[FIELD_TYPE["NumberRealForMatrix"] = 31] = "NumberRealForMatrix";
FIELD_TYPE[FIELD_TYPE["Images"] = 32] = "Images";
FIELD_TYPE[FIELD_TYPE["Indicators"] = 33] = "Indicators";
FIELD_TYPE[FIELD_TYPE["CalculatedReal"] = 34] = "CalculatedReal";
FIELD_TYPE[FIELD_TYPE["CalculatedInt"] = 35] = "CalculatedInt";
FIELD_TYPE[FIELD_TYPE["CalculatedString"] = 36] = "CalculatedString";
FIELD_TYPE[FIELD_TYPE["CalculatedDate"] = 37] = "CalculatedDate";
FIELD_TYPE[FIELD_TYPE["CalculatedBool"] = 38] = "CalculatedBool";
FIELD_TYPE[FIELD_TYPE["MapDataDropDown"] = 39] = "MapDataDropDown";
FIELD_TYPE[FIELD_TYPE["MapDataReal"] = 40] = "MapDataReal";
FIELD_TYPE[FIELD_TYPE["MapDataString"] = 41] = "MapDataString";
FIELD_TYPE[FIELD_TYPE["MapDataInt"] = 42] = "MapDataInt";
FIELD_TYPE[FIELD_TYPE["Sum"] = 43] = "Sum";
FIELD_TYPE[FIELD_TYPE["Phone"] = 44] = "Phone";
FIELD_TYPE[FIELD_TYPE["UrlForApi"] = 45] = "UrlForApi";
FIELD_TYPE[FIELD_TYPE["ManyToManyUrlForApi"] = 46] = "ManyToManyUrlForApi";
FIELD_TYPE[FIELD_TYPE["ReferenceType"] = 47] = "ReferenceType";
FIELD_TYPE[FIELD_TYPE["GuidReferenceType"] = 48] = "GuidReferenceType";
FIELD_TYPE[FIELD_TYPE["Button"] = 49] = "Button";
FIELD_TYPE[FIELD_TYPE["InternalPage"] = 50] = "InternalPage";
FIELD_TYPE[FIELD_TYPE["Duration"] = 51] = "Duration";
FIELD_TYPE[FIELD_TYPE["ListOfObjects"] = 52] = "ListOfObjects";
FIELD_TYPE[FIELD_TYPE["Package"] = 53] = "Package";
FIELD_TYPE[FIELD_TYPE["BooleanText"] = 55] = "BooleanText";
FIELD_TYPE[FIELD_TYPE["RichTextHTML"] = 56] = "RichTextHTML"; // Html Text
})(FIELD_TYPE || (FIELD_TYPE = {}));
class FieldLayout {
constructor(x = 0, width = 1, xAlignment = 1, y = 0, height = 1, yAlignment = 1, lineNumber = 1) {
this.X = x;
this.Width = width;
this.XAlignment = xAlignment;
this.Y = y;
this.Height = height;
this.YAlignment = yAlignment;
this.LineNumber = lineNumber;
}
}
class UIControlField {
constructor() {
this.MandatoryField = false;
this.Mandatory = false;
this.minFieldWidth = 45;
this.calcColumnWidth = 10;
this.calcTitleColumnWidthString = '100%';
this.calcColumnWidthString = '100%';
}
}
class UIControl {
}
class ObjectsDataRowCell {
}
class ObjectsDataRow {
constructor() {
this.IsSelectableForActions = true;
this.IsEditable = true;
}
}
class ObjectSingleData {
constructor(uiControl = null, data = null) {
this.Success = true;
this.ErrorMessage = '';
this.Type = '';
this.UIControl = uiControl;
this.Data = data;
}
}
class ObjectsData {
constructor() {
this.ErrorMessage = '';
this.Success = true;
this.TotalAmount = '0';
this.CurrencySymbol = '$';
}
}
class SmartSearchValues {
}
class SmartSearchResponse {
}
class PepperiFieldData {
constructor(options = {}) {
this.ApiName = options.ApiName;
this.Value = options.Value;
this.FormattedValue = options.FormattedValue || '';
this.FieldType = options.FieldType;
this.ColumnWidth = options.ColumnWidth;
this.ColumnWidthType = options.ColumnWidthType;
this.XAlignment = options.XAlignment;
this.Title = options.Title || '';
}
}
class PepperiRowData {
}
class Guid {
static pad4(num) {
let ret = num.toString(16);
while (ret.length < 4) {
ret = '0' + ret;
}
return ret;
}
static random4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
static newGuid() {
// This is not build for -prod
// return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
// const r = Math.random() * 16 | 0;
// const v = c === 'x' ? r : (r & 0x3 | 0x8);
// return v.toString(16);
// });
// If we have a cryptographically secure PRNG, use that
if (typeof (window) !== 'undefined' &&
typeof (window.crypto) !== 'undefined' &&
typeof (window.crypto.getRandomValues) !== 'undefined') {
const buf = new Uint16Array(8);
window.crypto.getRandomValues(buf);
return (this.pad4(buf[0]) + this.pad4(buf[1]) + '-' + this.pad4(buf[2]) + '-' + this.pad4(buf[3]) + '-' +
this.pad4(buf[4]) + '-' + this.pad4(buf[5]) + this.pad4(buf[6]) + this.pad4(buf[7]));
}
else { // Otherwise, just use Math.random
return this.random4() + this.random4() + '-' + this.random4() + '-' + this.random4() + '-' +
this.random4() + '-' + this.random4() + this.random4() + this.random4();
}
}
}
// export interface IKeyedCollection<T> {
// Add(key: string, value: T);
// ContainsKey(key: string): boolean;
// Count(): number;
// Item(key: string): T;
// Keys(): string[];
// Remove(key: string): T;
// RemoveAll();
// Values(): T[];
// }
// export class KeyedCollection<T> implements IKeyedCollection<T> {
// private items: { [index: string]: T } = {};
// private count: number = 0;
// initFromObj(collection: KeyedCollection<T>) {
// this.items = {};
// this.count = 0;
// const keys = [];
// for (const prop in collection.items) {
// if (collection.items.hasOwnProperty(prop)) {
// this.Add(prop, collection.items[prop]);
// }
// }
// }
// public ContainsKey(key: string): boolean {
// return this.items.hasOwnProperty(key);
// }
// public Count(): number {
// return this.count;
// }
// public Add(key: string, value: T) {
// if (!this.ContainsKey(key)) {
// this.count++;
// }
// this.items[key] = value;
// }
// public Remove(key: string): T {
// var val = this.items[key];
// if (this.ContainsKey(key)) {
// delete this.items[key];
// this.count--;
// }
// return val;
// }
// public RemoveAll() {
// this.items = {};
// this.count = 0;
// }
// public Item(key: string): T {
// return this.items[key];
// }
// public Keys(): string[] {
// var keySet: string[] = [];
// for (var prop in this.items) {
// if (this.items.hasOwnProperty(prop)) {
// keySet.push(prop);
// }
// }
// return keySet;
// }
// public Values(): T[] {
// var values: T[] = [];
// for (var prop in this.items) {
// if (this.items.hasOwnProperty(prop)) {
// values.push(this.items[prop]);
// }
// }
// return values;
// }
// }
/*
* Public API Surface of pepperi-lib/core/common/model
*/
/*
* export from pepperi-lib/core/common/model
*/
/*
* Public API Surface of pepperi-lib/