@progressive-development/pd-spa-helper 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/InitApplicationData.d.ts +3 -0
- package/dist/src/InitApplicationData.js +8 -0
- package/dist/src/InitApplicationData.js.map +1 -0
- package/dist/src/PdSpaHelper.d.ts +111 -6
- package/dist/src/PdSpaHelper.js +410 -12
- package/dist/src/PdSpaHelper.js.map +1 -1
- package/dist/src/defaultpage/default-login.d.ts +5 -0
- package/dist/src/defaultpage/default-login.js +16 -0
- package/dist/src/defaultpage/default-login.js.map +1 -0
- package/dist/src/firebase/auth.d.ts +4 -0
- package/dist/src/firebase/auth.js +28 -0
- package/dist/src/firebase/auth.js.map +1 -0
- package/dist/src/firebase/firestore-client.d.ts +9 -0
- package/dist/src/firebase/firestore-client.js +19 -0
- package/dist/src/firebase/firestore-client.js.map +1 -0
- package/dist/src/firebase/functions-client.d.ts +31 -0
- package/dist/src/firebase/functions-client.js +70 -0
- package/dist/src/firebase/functions-client.js.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/pd-spa-helper.d.ts +0 -1
- package/dist/src/pd-spa-helper.js +4 -2
- package/dist/src/pd-spa-helper.js.map +1 -1
- package/dist/src/router/AppMain.d.ts +6 -0
- package/dist/src/router/AppMain.js +14 -0
- package/dist/src/router/AppMain.js.map +1 -0
- package/dist/src/service-call-controller2.d.ts +16 -0
- package/dist/src/service-call-controller2.js +43 -0
- package/dist/src/service-call-controller2.js.map +1 -0
- package/dist/src/tmpown/pd-login.d.ts +14 -0
- package/dist/src/tmpown/pd-login.js +118 -0
- package/dist/src/tmpown/pd-login.js.map +1 -0
- package/dist/src/tmpown/pd-panel-viewer.d.ts +18 -0
- package/dist/src/tmpown/pd-panel-viewer.js +187 -0
- package/dist/src/tmpown/pd-panel-viewer.js.map +1 -0
- package/dist/src/tmpown/pd-panel.d.ts +5 -0
- package/dist/src/tmpown/pd-panel.js +41 -0
- package/dist/src/tmpown/pd-panel.js.map +1 -0
- package/dist/src/tmpown/pd-toast.d.ts +12 -0
- package/dist/src/tmpown/pd-toast.js +114 -0
- package/dist/src/tmpown/pd-toast.js.map +1 -0
- package/dist/test/pd-spa-helper.test.js +2 -2
- package/dist/test/pd-spa-helper.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -1
- package/pd-spa-helper.iml +9 -0
- package/src/InitApplicationData.ts +9 -0
- package/src/PdSpaHelper.ts +490 -16
- package/src/defaultpage/default-login.ts +15 -0
- package/src/firebase/auth.ts +30 -0
- package/src/firebase/firestore-client.ts +21 -0
- package/src/firebase/functions-client.ts +103 -0
- package/src/index.ts +1 -1
- package/src/pd-spa-helper.ts +3 -3
- package/src/router/AppMain.ts +10 -0
- package/src/service-call-controller2.ts +67 -0
- package/src/tmpown/pd-login.ts +126 -0
- package/src/tmpown/pd-panel-viewer.ts +193 -0
- package/src/tmpown/pd-panel.ts +43 -0
- package/src/tmpown/pd-toast.ts +114 -0
- package/test/pd-spa-helper.test.ts +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getAuth, signInWithEmailAndPassword, signOut } from 'firebase/auth';
|
|
2
|
+
export const logout = async () => {
|
|
3
|
+
const auth = getAuth();
|
|
4
|
+
try {
|
|
5
|
+
await signOut(auth);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export const isAuthenticated = () => getAuth().currentUser !== null;
|
|
13
|
+
export const login = async (user, sec) => {
|
|
14
|
+
if (!user) {
|
|
15
|
+
const returnError = new Error("empty user");
|
|
16
|
+
return Promise.reject(returnError);
|
|
17
|
+
}
|
|
18
|
+
if (!sec) {
|
|
19
|
+
// error.eType = 'sec';
|
|
20
|
+
// error.logMsg = 'password required';
|
|
21
|
+
const returnError = new Error("empty password");
|
|
22
|
+
return Promise.reject(returnError);
|
|
23
|
+
}
|
|
24
|
+
const auth = getAuth();
|
|
25
|
+
const credentials = await signInWithEmailAndPassword(auth, user, sec);
|
|
26
|
+
return credentials.user;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/firebase/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,0BAA0B,EAAE,OAAO,EAAQ,MAAM,eAAe,CAAC;AAEnF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,IAAsB,EAAE;IACjD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,IAAI;QACF,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAY,EAAE,CAC3C,OAAO,EAAE,CAAC,WAAW,KAAK,IAAI,CAAC;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,IAAW,EAAE,GAAU,EAAiB,EAAE;IACpE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,WAAW,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;KACpC;IACD,IAAI,CAAC,GAAG,EAAE;QACR,uBAAuB;QACvB,sCAAsC;QACtC,MAAM,WAAW,GAAG,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;KACpC;IACD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,WAAW,GAAG,MAAM,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACtE,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC,CAAA","sourcesContent":["import { getAuth, signInWithEmailAndPassword, signOut, User } from 'firebase/auth';\n\nexport const logout = async (): Promise<boolean> => {\n const auth = getAuth();\n try {\n await signOut(auth);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nexport const isAuthenticated = (): boolean => \n getAuth().currentUser !== null;\n \nexport const login = async (user:string, sec:string): Promise<User> => {\n if (!user) { \n const returnError = new Error(\"empty user\"); \n return Promise.reject(returnError);\n }\n if (!sec) {\n // error.eType = 'sec';\n // error.logMsg = 'password required';\n const returnError = new Error(\"empty password\"); \n return Promise.reject(returnError);\n }\n const auth = getAuth(); \n const credentials = await signInWithEmailAndPassword(auth, user, sec);\n return credentials.user; \n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FirebaseApp } from 'firebase/app';
|
|
2
|
+
import { Firestore } from 'firebase/firestore';
|
|
3
|
+
/**
|
|
4
|
+
* During start/load application, initialize functions.
|
|
5
|
+
*
|
|
6
|
+
* @param {*} app - initialized app.
|
|
7
|
+
*/
|
|
8
|
+
export declare const initFirestore: (app: FirebaseApp) => void;
|
|
9
|
+
export declare const getDB: () => Firestore;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getFirestore } from 'firebase/firestore';
|
|
2
|
+
// import { getAuth } from 'firebase/auth';
|
|
3
|
+
let db;
|
|
4
|
+
/**
|
|
5
|
+
* During start/load application, initialize functions.
|
|
6
|
+
*
|
|
7
|
+
* @param {*} app - initialized app.
|
|
8
|
+
*/
|
|
9
|
+
export const initFirestore = (app) => {
|
|
10
|
+
try {
|
|
11
|
+
// init db access
|
|
12
|
+
db = getFirestore(app);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error(error);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const getDB = () => db;
|
|
19
|
+
//# sourceMappingURL=firestore-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore-client.js","sourceRoot":"","sources":["../../../src/firebase/firestore-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAC3D,2CAA2C;AAE3C,IAAI,EAAY,CAAC;AAEjB;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAgB,EAAE,EAAE;IAChD,IAAI;QACF,iBAAiB;QACjB,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;KACxB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACtB;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,GAAa,EAAE,CAAC,EAAE,CAAC","sourcesContent":["import { FirebaseApp } from 'firebase/app';\nimport {Firestore, getFirestore} from 'firebase/firestore';\n// import { getAuth } from 'firebase/auth';\n\nlet db:Firestore;\n\n/**\n * During start/load application, initialize functions.\n *\n * @param {*} app - initialized app.\n */\nexport const initFirestore = (app: FirebaseApp) => {\n try {\n // init db access\n db = getFirestore(app);\n } catch (error) {\n console.error(error);\n }\n};\n\nexport const getDB = ():Firestore => db;\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FirebaseApp } from "firebase/app";
|
|
2
|
+
import { TemplateResult } from "lit";
|
|
3
|
+
import { ServiceCallController } from "../service-call-controller2.js";
|
|
4
|
+
export interface FunctionDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
successCodes: Array<Number>;
|
|
7
|
+
fadeWindow: boolean;
|
|
8
|
+
successTxt: TemplateResult;
|
|
9
|
+
pendingTxt: TemplateResult;
|
|
10
|
+
}
|
|
11
|
+
export interface FunctionParam {
|
|
12
|
+
func: FunctionDefinition;
|
|
13
|
+
inputData: any;
|
|
14
|
+
}
|
|
15
|
+
export interface FunctionResult {
|
|
16
|
+
resultData: unknown;
|
|
17
|
+
statusCode: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FunctionsConfig {
|
|
20
|
+
region: string;
|
|
21
|
+
functions: Array<FunctionDefinition>;
|
|
22
|
+
postLoginFunc?: FunctionDefinition;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* During start/load application, initialize functions.
|
|
26
|
+
*
|
|
27
|
+
* @param {*} app - initialized app.
|
|
28
|
+
*/
|
|
29
|
+
export declare const initFunctions: (app: FirebaseApp, functionsConfig: FunctionsConfig) => void;
|
|
30
|
+
export declare const initController: (controllerParam: ServiceCallController) => void;
|
|
31
|
+
export declare const callFunction: (def: FunctionDefinition, functionInput: any) => Promise<FunctionResult>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { getFunctions, httpsCallable } from "firebase/functions";
|
|
2
|
+
const functionMap = new Map;
|
|
3
|
+
let controller;
|
|
4
|
+
/**
|
|
5
|
+
* During start/load application, initialize functions.
|
|
6
|
+
*
|
|
7
|
+
* @param {*} app - initialized app.
|
|
8
|
+
*/
|
|
9
|
+
export const initFunctions = (app, functionsConfig) => {
|
|
10
|
+
try {
|
|
11
|
+
// Initialize cloud functions through Firebase
|
|
12
|
+
const functions = getFunctions(app, functionsConfig.region);
|
|
13
|
+
// Initialize functions map
|
|
14
|
+
functionsConfig.functions.forEach(func => {
|
|
15
|
+
functionMap.set(func, httpsCallable(functions, func.name));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.error("ToDo: Error programmieren...", error);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const initController = (controllerParam) => {
|
|
23
|
+
controller = controllerParam;
|
|
24
|
+
};
|
|
25
|
+
const internalCallFunction = async (def, functionInput) => {
|
|
26
|
+
const funcRef = functionMap.get(def);
|
|
27
|
+
if (funcRef) {
|
|
28
|
+
const funcResult = await funcRef(functionInput);
|
|
29
|
+
if (funcResult
|
|
30
|
+
&& funcResult.data && def.successCodes.includes(funcResult.data.statusCode)) {
|
|
31
|
+
return funcResult.data;
|
|
32
|
+
}
|
|
33
|
+
/*
|
|
34
|
+
const ne = new Error("Invalid result");
|
|
35
|
+
if (result.data) {
|
|
36
|
+
// Read result of the Cloud Function.
|
|
37
|
+
switch (result.data.statusCode) {
|
|
38
|
+
case 200:
|
|
39
|
+
return resolve(result.data.projects);
|
|
40
|
+
default:
|
|
41
|
+
ne.data = result.data;
|
|
42
|
+
return reject(ne);
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
return reject(ne);
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
.catch((error) => {
|
|
49
|
+
// Getting the Error details.
|
|
50
|
+
const {code} = error;
|
|
51
|
+
const {message} = error;
|
|
52
|
+
const {details} = error;
|
|
53
|
+
|
|
54
|
+
console.warn("Error occured: ", code, message, details);
|
|
55
|
+
console.warn("Error: ", error);
|
|
56
|
+
return reject(error);
|
|
57
|
+
})
|
|
58
|
+
*/
|
|
59
|
+
}
|
|
60
|
+
console.log("No function available for ", def.name);
|
|
61
|
+
throw new Error("Illegal state, no data with right state available");
|
|
62
|
+
};
|
|
63
|
+
export const callFunction = async (def, functionInput) => {
|
|
64
|
+
const promise = internalCallFunction(def, functionInput);
|
|
65
|
+
if (controller) {
|
|
66
|
+
controller.callDataPromise = { func: def, promise };
|
|
67
|
+
}
|
|
68
|
+
return promise;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=functions-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions-client.js","sourceRoot":"","sources":["../../../src/firebase/functions-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAiB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA6BhF,MAAM,WAAW,GAAG,IAAI,GAAsC,CAAC;AAC/D,IAAI,UAAiC,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAgB,EAAE,eAAgC,EAAE,EAAE;IAClF,IAAI;QACA,8CAA8C;QAC9C,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAE5D,2BAA2B;QAC3B,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;KAEN;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;KACxD;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,eAAsC,EAAE,EAAE;IACvE,UAAU,GAAG,eAAe,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,oBAAoB,GAAG,KAAK,EAAE,GAAuB,EAAE,aAAkB,EAA2B,EAAE;IAC1G,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,OAAO,EAAE;QACX,MAAM,UAAU,GAAO,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;QACpD,IAAI,UAAU;eACP,UAAU,CAAC,IAAI,IAAI,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAC/E,OAAO,UAAU,CAAC,IAAsB,CAAC;SAC1C;QACD;;;;;;;;;;;;;;;;;;;;;;;;;UAyBE;KACH;IACD,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;AACvE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,GAAuB,EAAE,aAAkB,EAA2B,EAAE;IACzG,MAAM,OAAO,GAAG,oBAAoB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IACzD,IAAI,UAAU,EAAE;QACd,UAAU,CAAC,eAAe,GAAG,EAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAC,CAAC;KACnD;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA","sourcesContent":["import { FirebaseApp } from \"firebase/app\";\nimport { getFunctions, HttpsCallable, httpsCallable } from \"firebase/functions\";\nimport { TemplateResult } from \"lit\";\nimport { ServiceCallController } from \"../service-call-controller2.js\";\n\nexport interface FunctionDefinition {\n name: string,\n successCodes: Array<Number>, \n // Fade window during function call (true) or show only background infos (false).\n fadeWindow: boolean,\n successTxt: TemplateResult,\n pendingTxt: TemplateResult\n}\n\nexport interface FunctionParam {\n func: FunctionDefinition,\n inputData: any,\n}\n\nexport interface FunctionResult {\n resultData: unknown,\n statusCode: number,\n}\n\nexport interface FunctionsConfig {\n region: string, // 'europe-west3'\n functions: Array<FunctionDefinition>,\n postLoginFunc?: FunctionDefinition,\n}\n\nconst functionMap = new Map<FunctionDefinition, HttpsCallable>;\nlet controller: ServiceCallController;\n\n/**\n * During start/load application, initialize functions. \n * \n * @param {*} app - initialized app. \n */\nexport const initFunctions = (app: FirebaseApp, functionsConfig: FunctionsConfig) => {\n try {\n // Initialize cloud functions through Firebase\n const functions = getFunctions(app, functionsConfig.region);\n\n // Initialize functions map\n functionsConfig.functions.forEach(func => {\n functionMap.set(func, httpsCallable(functions, func.name));\n });\n\n } catch (error) {\n console.error(\"ToDo: Error programmieren...\", error);\n }\n}\n\nexport const initController = (controllerParam: ServiceCallController) => {\n controller = controllerParam\n}\n\nconst internalCallFunction = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> => {\n const funcRef = functionMap.get(def); \n if (funcRef) { \n const funcResult:any = await funcRef(functionInput);\n if (funcResult \n && funcResult.data && def.successCodes.includes(funcResult.data.statusCode)) {\n return funcResult.data as FunctionResult;\n }\n /*\n const ne = new Error(\"Invalid result\");\n if (result.data) {\n // Read result of the Cloud Function. \n switch (result.data.statusCode) {\n case 200:\n return resolve(result.data.projects);\n default:\n ne.data = result.data;\n return reject(ne);\n }\n } else {\n return reject(ne);\n }\n })\n .catch((error) => {\n // Getting the Error details.\n const {code} = error;\n const {message} = error;\n const {details} = error;\n\n console.warn(\"Error occured: \", code, message, details);\n console.warn(\"Error: \", error);\n return reject(error);\n })\n */\n } \n console.log(\"No function available for \", def.name);\n throw new Error(\"Illegal state, no data with right state available\");\n}\n\nexport const callFunction = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> => {\n const promise = internalCallFunction(def, functionInput);\n if (controller) {\n controller.callDataPromise = {func: def, promise};\n }\n return promise;\n}"]}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PdSpaHelper } from './PdSpaHelper.js';
|
|
1
|
+
export { PdSpaHelper, startInit, NavigationConfig, NavigationPage, MenuElement } from './PdSpaHelper.js';
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { PdSpaHelper } from './PdSpaHelper.js';
|
|
1
|
+
export { PdSpaHelper, startInit } from './PdSpaHelper.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { PdSpaHelper } from './PdSpaHelper.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAiD,MAAM,kBAAkB,CAAC","sourcesContent":["export { PdSpaHelper, startInit, NavigationConfig, NavigationPage, MenuElement } from './PdSpaHelper.js';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
//import { PdSpaHelper } from './PdSpaHelper.js';
|
|
3
|
+
//export default PdSpaHelper;
|
|
4
|
+
//window.customElements.define('pd-spa-helper', PdSpaHelper);
|
|
3
5
|
//# sourceMappingURL=pd-spa-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pd-spa-helper.js","sourceRoot":"","sources":["../../src/pd-spa-helper.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"pd-spa-helper.js","sourceRoot":"","sources":["../../src/pd-spa-helper.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,6BAA6B;AAC7B,6DAA6D","sourcesContent":["//import { PdSpaHelper } from './PdSpaHelper.js';\n//export default PdSpaHelper;\n//window.customElements.define('pd-spa-helper', PdSpaHelper);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare const AppMain_base: import("lit-element-router").Constructor<import("lit-element-router").Outlet> & typeof LitElement;
|
|
3
|
+
export declare class AppMain extends AppMain_base {
|
|
4
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html } from 'lit';
|
|
3
|
+
import { customElement } from 'lit/decorators.js';
|
|
4
|
+
import { outlet } from 'lit-element-router';
|
|
5
|
+
let AppMain = class AppMain extends outlet(LitElement) {
|
|
6
|
+
render() {
|
|
7
|
+
return html ` <slot></slot> `;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
AppMain = __decorate([
|
|
11
|
+
customElement('app-main')
|
|
12
|
+
], AppMain);
|
|
13
|
+
export { AppMain };
|
|
14
|
+
//# sourceMappingURL=AppMain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppMain.js","sourceRoot":"","sources":["../../../src/router/AppMain.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAG1C,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,MAAM,CAAC,UAAU,CAAC;IAC7C,MAAM;QACJ,OAAO,IAAI,CAAA,iBAAiB,CAAC;IAC/B,CAAC;CACF,CAAA;AAJY,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAInB;SAJY,OAAO","sourcesContent":["import {LitElement, html} from 'lit';\nimport {customElement} from 'lit/decorators.js';\nimport {outlet} from 'lit-element-router';\n\n@customElement('app-main')\nexport class AppMain extends outlet(LitElement) {\n render() {\n return html` <slot></slot> `;\n }\n}"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { FunctionDefinition, FunctionResult } from './firebase/functions-client.js';
|
|
3
|
+
export interface ServiceControllerInput {
|
|
4
|
+
promise: Promise<FunctionResult>;
|
|
5
|
+
func: FunctionDefinition;
|
|
6
|
+
}
|
|
7
|
+
export declare class ServiceCallController {
|
|
8
|
+
host: ReactiveControllerHost;
|
|
9
|
+
private task;
|
|
10
|
+
private _callDataPromise;
|
|
11
|
+
constructor(host: ReactiveControllerHost);
|
|
12
|
+
set callDataPromise(value: ServiceControllerInput);
|
|
13
|
+
get callDataPromise(): ServiceControllerInput;
|
|
14
|
+
clear(): void;
|
|
15
|
+
render(renderFunctions: any): unknown;
|
|
16
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { initialState, Task } from '@lit-labs/task';
|
|
2
|
+
import { initController } from './firebase/functions-client.js';
|
|
3
|
+
export class ServiceCallController {
|
|
4
|
+
constructor(host) {
|
|
5
|
+
this.host = host;
|
|
6
|
+
this.task = new Task(host, async ([callDataPromise]) => {
|
|
7
|
+
if (!callDataPromise) {
|
|
8
|
+
return initialState;
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
const result = await callDataPromise.promise;
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
console.error("Error: ", e);
|
|
16
|
+
throw new Error(`Failed call function "${callDataPromise.func.name}"`);
|
|
17
|
+
}
|
|
18
|
+
}, () => [this.callDataPromise]);
|
|
19
|
+
initController(this);
|
|
20
|
+
}
|
|
21
|
+
/*
|
|
22
|
+
set callData(value: FunctionParam) {
|
|
23
|
+
this._callData = value;
|
|
24
|
+
this.host.requestUpdate();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get callData(): FunctionParam { return this._callData; }
|
|
28
|
+
*/
|
|
29
|
+
set callDataPromise(value) {
|
|
30
|
+
this._callDataPromise = value;
|
|
31
|
+
this.host.requestUpdate();
|
|
32
|
+
}
|
|
33
|
+
get callDataPromise() { return this._callDataPromise; }
|
|
34
|
+
clear() {
|
|
35
|
+
this.task.status = 0;
|
|
36
|
+
this.host.requestUpdate();
|
|
37
|
+
}
|
|
38
|
+
// TODO: Type definition FunctionResult do not work, but work in Homepage Project...
|
|
39
|
+
render(renderFunctions) {
|
|
40
|
+
return this.task.render(renderFunctions);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=service-call-controller2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-call-controller2.js","sourceRoot":"","sources":["../../src/service-call-controller2.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAkB,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAsC,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAOpG,MAAM,OAAO,qBAAqB;IAQhC,YAAY,IAA4B;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAA2C,IAAI,EAEjE,KAAK,EAAE,CAAC,eAAe,CAA2B,EAAE,EAAE;YACpD,IAAI,CAAC,eAAe,EAAE;gBACpB,OAAO,YAAY,CAAC;aACrB;YACD,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC;gBAC7C,OAAO,MAAwB,CAAC;aACjC;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,eAAe,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;aACxE;QAEH,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAEhC,CAAC;QACF,cAAc,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;MAOE;IAEF,IAAI,eAAe,CAAC,KAA6B;QAC/C,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;IAED,IAAI,eAAe,KAA6B,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAE/E,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;IAED,oFAAoF;IACpF,MAAM,CAAC,eAAoB;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;CAEF","sourcesContent":["import {ReactiveControllerHost} from 'lit';\nimport {initialState, StatusRenderer, Task} from '@lit-labs/task';\n\nimport { FunctionDefinition, FunctionResult, initController } from './firebase/functions-client.js';\n\nexport interface ServiceControllerInput {\n promise: Promise<FunctionResult>,\n func: FunctionDefinition,\n}\n\nexport class ServiceCallController {\n\n host: ReactiveControllerHost;\n\n private task!: Task;\n\n private _callDataPromise!: ServiceControllerInput;\n\n constructor(host: ReactiveControllerHost) {\n this.host = host;\n this.task = new Task<[ServiceControllerInput], FunctionResult>(host,\n\n async ([callDataPromise]: [ServiceControllerInput]) => {\n if (!callDataPromise) {\n return initialState;\n }\n try {\n const result = await callDataPromise.promise;\n return result as FunctionResult;\n } catch (e) {\n console.error(\"Error: \", e);\n throw new Error(`Failed call function \"${callDataPromise.func.name}\"`);\n }\n\n }, () => [this.callDataPromise]\n\n );\n initController(this);\n }\n\n /*\n set callData(value: FunctionParam) {\n this._callData = value;\n this.host.requestUpdate();\n }\n\n get callData(): FunctionParam { return this._callData; }\n */\n\n set callDataPromise(value: ServiceControllerInput) {\n this._callDataPromise = value;\n this.host.requestUpdate();\n }\n\n get callDataPromise(): ServiceControllerInput { return this._callDataPromise; }\n\n clear() {\n this.task.status = 0;\n this.host.requestUpdate();\n }\n\n // TODO: Type definition FunctionResult do not work, but work in Homepage Project...\n render(renderFunctions: any) {\n return this.task.render(renderFunctions);\n }\n\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import '@progressive-development/pd-forms/pd-form-container.js';
|
|
3
|
+
import '@progressive-development/pd-forms/pd-form-row.js';
|
|
4
|
+
import '@progressive-development/pd-forms/pd-input.js';
|
|
5
|
+
import '@progressive-development/pd-forms/pd-button.js';
|
|
6
|
+
export declare class PdLogin extends LitElement {
|
|
7
|
+
/**
|
|
8
|
+
* @event login-success fired when login was successfully
|
|
9
|
+
*/
|
|
10
|
+
static get styles(): import("lit").CSSResult[];
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
_accessLogin(): void;
|
|
13
|
+
_dispatchToastEvent(txt: string): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, css, html } from 'lit';
|
|
3
|
+
import { customElement } from 'lit/decorators.js';
|
|
4
|
+
import '@progressive-development/pd-forms/pd-form-container.js';
|
|
5
|
+
import '@progressive-development/pd-forms/pd-form-row.js';
|
|
6
|
+
import '@progressive-development/pd-forms/pd-input.js';
|
|
7
|
+
import '@progressive-development/pd-forms/pd-button.js';
|
|
8
|
+
import { login } from '../firebase/auth.js';
|
|
9
|
+
let PdLogin = class PdLogin extends LitElement {
|
|
10
|
+
/**
|
|
11
|
+
* @event login-success fired when login was successfully
|
|
12
|
+
*/
|
|
13
|
+
static get styles() {
|
|
14
|
+
return [
|
|
15
|
+
css `
|
|
16
|
+
:host {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
/*min-height: 100vh;
|
|
20
|
+
min-width: 100vh;*/
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.login-form {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-flow: column;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
--pd-form-row-allign: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
`,
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
return html `
|
|
35
|
+
<div class="login-form">
|
|
36
|
+
<pd-form-container id="loginFormId">
|
|
37
|
+
|
|
38
|
+
<pd-form-row>
|
|
39
|
+
<pd-input
|
|
40
|
+
id="eMail"
|
|
41
|
+
class="quarter3"
|
|
42
|
+
maxlength="250"
|
|
43
|
+
field-type="mail"
|
|
44
|
+
valueName="email"
|
|
45
|
+
label="E-mail"
|
|
46
|
+
autoCompleteName="email"
|
|
47
|
+
required
|
|
48
|
+
@enter-pressed="${this._accessLogin}"
|
|
49
|
+
></pd-input>
|
|
50
|
+
</pd-form-row>
|
|
51
|
+
|
|
52
|
+
<pd-form-row>
|
|
53
|
+
<pd-input
|
|
54
|
+
id="pWord"
|
|
55
|
+
class="quarter3"
|
|
56
|
+
secret
|
|
57
|
+
maxlength="30"
|
|
58
|
+
label="Password"
|
|
59
|
+
required
|
|
60
|
+
@enter-pressed="${this._accessLogin}"
|
|
61
|
+
></pd-input>
|
|
62
|
+
</pd-form-row>
|
|
63
|
+
|
|
64
|
+
<pd-form-row>
|
|
65
|
+
<pd-button class="quarter3" primary text="Login" @click="${this._accessLogin}"></pd-button>
|
|
66
|
+
</pd-form-row>
|
|
67
|
+
|
|
68
|
+
</pd-form-container>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
_accessLogin() {
|
|
74
|
+
var _a, _b, _c, _d;
|
|
75
|
+
// validate form
|
|
76
|
+
const detail = {
|
|
77
|
+
errorMap: new Map()
|
|
78
|
+
};
|
|
79
|
+
(_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById("loginFormId")) === null || _b === void 0 ? void 0 : _b.dispatchEvent(new CustomEvent("validate-form", { detail }));
|
|
80
|
+
if (detail.errorMap.size === 0) {
|
|
81
|
+
// get form elements as input elements (for value access)
|
|
82
|
+
const elMail = (_c = this.shadowRoot) === null || _c === void 0 ? void 0 : _c.getElementById('eMail');
|
|
83
|
+
const elSec = (_d = this.shadowRoot) === null || _d === void 0 ? void 0 : _d.getElementById('pWord');
|
|
84
|
+
login(elMail === null || elMail === void 0 ? void 0 : elMail.value, elSec === null || elSec === void 0 ? void 0 : elSec.value)
|
|
85
|
+
.then(() => {
|
|
86
|
+
this.dispatchEvent(new CustomEvent("login-success"));
|
|
87
|
+
}).catch(error => {
|
|
88
|
+
switch (error.code) {
|
|
89
|
+
case 'auth/invalid-email':
|
|
90
|
+
// returnError.eType = 'user';
|
|
91
|
+
// returnError.logMsg = 'Invalid mail format';
|
|
92
|
+
this._dispatchToastEvent("E-Mail Format für Benutzer ist ungültig.");
|
|
93
|
+
break;
|
|
94
|
+
case 'auth/wrong-password':
|
|
95
|
+
case 'auth/user-not-found':
|
|
96
|
+
this._dispatchToastEvent("Anmeldung fehlgeschlagen, ungültige Benutzerdaten.");
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
this._dispatchToastEvent("Technisches Problem aufgetreten, die Anmeldung kann leider aktuell nicht durchgeführt werden.");
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
_dispatchToastEvent(txt) {
|
|
105
|
+
this.dispatchEvent(new CustomEvent("toast-event", {
|
|
106
|
+
detail: {
|
|
107
|
+
txt, isError: true,
|
|
108
|
+
},
|
|
109
|
+
bubbles: true,
|
|
110
|
+
composed: true
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
PdLogin = __decorate([
|
|
115
|
+
customElement("pd-login")
|
|
116
|
+
], PdLogin);
|
|
117
|
+
export { PdLogin };
|
|
118
|
+
//# sourceMappingURL=pd-login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-login.js","sourceRoot":"","sources":["../../../src/tmpown/pd-login.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,wDAAwD,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,+CAA+C,CAAC;AACvD,OAAO,gDAAgD,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAErC;;OAEG;IAEH,MAAM,KAAK,MAAM;QACf,OAAO;YACL,GAAG,CAAA;;;;;;;;;;;;;;;OAeF;SACF,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;;;;;;gCAciB,IAAI,CAAC,YAAY;;;;;;;;;;;;gCAYjB,IAAI,CAAC,YAAY;;;;;uEAKsB,IAAI,CAAC,YAAY;;;;;;KAMnF,CAAC;IACJ,CAAC;IAED,YAAY;;QAEV,gBAAgB;QAChB,MAAM,MAAM,GAAG;YACb,QAAQ,EAAE,IAAI,GAAG,EAAE;SACpB,CAAC;QACF,MAAA,MAAA,IAAI,CAAC,UAAU,0CAAE,cAAc,CAAC,aAAa,CAAC,0CAAE,aAAa,CAC3D,IAAI,WAAW,CAAC,eAAe,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC,CAAC;QAE9C,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE;YAE9B,yDAAyD;YACzD,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,cAAc,CAAC,OAAO,CAAqB,CAAC;YAC5E,MAAM,KAAK,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,cAAc,CAAC,OAAO,CAAqB,CAAC;YAE3E,KAAK,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;iBAC/B,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACf,QAAQ,KAAK,CAAC,IAAI,EAAE;oBAClB,KAAK,oBAAoB;wBACvB,8BAA8B;wBAC9B,8CAA8C;wBAC9C,IAAI,CAAC,mBAAmB,CAAC,0CAA0C,CAAC,CAAC;wBACrE,MAAM;oBACR,KAAK,qBAAqB,CAAC;oBAC3B,KAAK,qBAAqB;wBACxB,IAAI,CAAC,mBAAmB,CAAC,oDAAoD,CAAC,CAAC;wBAC/E,MAAM;oBACR;wBACE,IAAI,CAAC,mBAAmB,CAAC,+FAA+F,CAAC,CAAC;iBAC7H;YACH,CAAC,CAAC,CAAC;SACN;IACH,CAAC;IAED,mBAAmB,CAAC,GAAW;QAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,aAAa,EAAC;YAC/C,MAAM,EAAE;gBACN,GAAG,EAAE,OAAO,EAAE,IAAI;aACnB;YACD,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC,CAAC;IACN,CAAC;CAEF,CAAA;AAlHY,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAkHnB;SAlHY,OAAO","sourcesContent":["import { LitElement, css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport '@progressive-development/pd-forms/pd-form-container.js';\nimport '@progressive-development/pd-forms/pd-form-row.js';\nimport '@progressive-development/pd-forms/pd-input.js';\nimport '@progressive-development/pd-forms/pd-button.js';\n\nimport { login } from '../firebase/auth.js';\n\n@customElement(\"pd-login\")\nexport class PdLogin extends LitElement {\n\n /**\n * @event login-success fired when login was successfully\n */\n\n static get styles() {\n return [\n css`\n :host {\n display: flex;\n justify-content: center;\n /*min-height: 100vh;\n min-width: 100vh;*/ \n }\n\n .login-form {\n display: flex; \n flex-flow: column;\n justify-content: center; \n --pd-form-row-allign: center; \n }\n \n `,\n ];\n } \n\n render() {\n return html`\n <div class=\"login-form\">\n <pd-form-container id=\"loginFormId\">\n \n <pd-form-row>\n <pd-input\n id=\"eMail\"\n class=\"quarter3\"\n maxlength=\"250\"\n field-type=\"mail\"\n valueName=\"email\"\n label=\"E-mail\" \n autoCompleteName=\"email\"\n required\n @enter-pressed=\"${this._accessLogin}\"\n ></pd-input>\n </pd-form-row>\n\n <pd-form-row>\n <pd-input\n id=\"pWord\"\n class=\"quarter3\"\n secret \n maxlength=\"30\"\n label=\"Password\" \n required \n @enter-pressed=\"${this._accessLogin}\"\n ></pd-input>\n </pd-form-row>\n \n <pd-form-row>\n <pd-button class=\"quarter3\" primary text=\"Login\" @click=\"${this._accessLogin}\"></pd-button> \n </pd-form-row>\n\n </pd-form-container> \n </div>\n\n `;\n }\n\n _accessLogin() {\n \n // validate form\n const detail = {\n errorMap: new Map()\n };\n this.shadowRoot?.getElementById(\"loginFormId\")?.dispatchEvent(\n new CustomEvent(\"validate-form\", {detail}));\n\n if (detail.errorMap.size === 0) {\n \n // get form elements as input elements (for value access)\n const elMail = this.shadowRoot?.getElementById('eMail') as HTMLInputElement; \n const elSec = this.shadowRoot?.getElementById('pWord') as HTMLInputElement; \n\n login(elMail?.value, elSec?.value)\n .then(() => {\n this.dispatchEvent(new CustomEvent(\"login-success\"));\n }).catch(error => {\n switch (error.code) {\n case 'auth/invalid-email':\n // returnError.eType = 'user';\n // returnError.logMsg = 'Invalid mail format';\n this._dispatchToastEvent(\"E-Mail Format für Benutzer ist ungültig.\");\n break;\n case 'auth/wrong-password':\n case 'auth/user-not-found':\n this._dispatchToastEvent(\"Anmeldung fehlgeschlagen, ungültige Benutzerdaten.\");\n break;\n default:\n this._dispatchToastEvent(\"Technisches Problem aufgetreten, die Anmeldung kann leider aktuell nicht durchgeführt werden.\");\n }\n });\n } \n }\n\n _dispatchToastEvent(txt: string) {\n this.dispatchEvent(new CustomEvent(\"toast-event\",{\n detail: {\n txt, isError: true,\n },\n bubbles: true,\n composed: true\n }));\n }\n\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import 'hammerjs';
|
|
3
|
+
import '@progressive-development/pd-icon/pd-icon.js';
|
|
4
|
+
export declare class PdPanelViewer extends LitElement {
|
|
5
|
+
withProgress: boolean;
|
|
6
|
+
deltaCalc: number;
|
|
7
|
+
_index: number;
|
|
8
|
+
_panData: any;
|
|
9
|
+
_update: {};
|
|
10
|
+
static styles: import("lit").CSSResult;
|
|
11
|
+
get index(): number;
|
|
12
|
+
set index(value: number);
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
firstUpdated(): void;
|
|
15
|
+
update(changedProperties: any): void;
|
|
16
|
+
next(): void;
|
|
17
|
+
previous(): void;
|
|
18
|
+
}
|