@gandalan/weblibs 0.0.26 → 0.0.29
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/.eslintignore +13 -0
- package/.eslintrc.cjs +43 -0
- package/api/IDAS.js +64 -39
- package/api/RESTClient.js +31 -47
- package/components/AddButton.svelte +2 -2
- package/components/DataGrid.svelte +18 -20
- package/components/Datepicker.svelte +66 -116
- package/components/Dialog.svelte +2 -2
- package/components/GanTable.svelte +32 -13
- package/components/Inputbox.svelte +86 -166
- package/declarations.d.ts +3 -0
- package/index.js +2 -2
- package/jsconfig.json +20 -0
- package/package.json +10 -1
package/.eslintignore
ADDED
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['eslint:recommended'],
|
|
4
|
+
plugins: ['svelte3'],
|
|
5
|
+
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
|
6
|
+
parser: '@babel/eslint-parser',
|
|
7
|
+
parserOptions: {
|
|
8
|
+
requireConfigFile: false,
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
ecmaVersion: 2020,
|
|
11
|
+
},
|
|
12
|
+
env: {
|
|
13
|
+
browser: true,
|
|
14
|
+
es2017: true,
|
|
15
|
+
node: true,
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
//indent: ['error', 4],
|
|
19
|
+
quotes: ['warn', 'single'],
|
|
20
|
+
semi: ['off', 'never'],
|
|
21
|
+
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
|
|
22
|
+
'curly': 'error',
|
|
23
|
+
'comma-spacing': 'error',
|
|
24
|
+
'brace-style': 'error',
|
|
25
|
+
'no-var': 'error',
|
|
26
|
+
'key-spacing': 'warn',
|
|
27
|
+
'keyword-spacing': 'warn',
|
|
28
|
+
'space-infix-ops': 'warn',
|
|
29
|
+
'arrow-spacing': 'warn',
|
|
30
|
+
'no-trailing-spaces': 'warn',
|
|
31
|
+
'space-before-blocks': 'warn',
|
|
32
|
+
'no-console': 'warn',
|
|
33
|
+
'no-extra-boolean-cast': 'off',
|
|
34
|
+
'no-multiple-empty-lines': ['warn', { 'max': 1, 'maxBOF': 0 }],
|
|
35
|
+
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
|
|
36
|
+
'no-unneeded-ternary': 'error',
|
|
37
|
+
'no-else-return': ['error', { 'allowElseIf': false }],
|
|
38
|
+
'array-bracket-newline': ['error', 'consistent'],
|
|
39
|
+
'eol-last': ['error', 'always'],
|
|
40
|
+
'prefer-template': 'error',
|
|
41
|
+
'comma-dangle': ['warn', 'always-multiline'],
|
|
42
|
+
},
|
|
43
|
+
};
|
package/api/IDAS.js
CHANGED
|
@@ -1,77 +1,102 @@
|
|
|
1
|
-
import { RESTClient } from
|
|
1
|
+
import { RESTClient } from './RESTClient';
|
|
2
2
|
|
|
3
|
-
let appToken = localStorage.getItem(
|
|
4
|
-
let authToken = localStorage.getItem(
|
|
5
|
-
let apiBaseUrl = localStorage.getItem(
|
|
3
|
+
let appToken = localStorage.getItem('IDAS_AppToken') || '66B70E0B-F7C4-4829-B12A-18AD309E3970';
|
|
4
|
+
let authToken = localStorage.getItem('IDAS_AuthToken');
|
|
5
|
+
let apiBaseUrl = localStorage.getItem('IDAS_ApiBaseUrl') || 'https://api.dev.idas-cloudservices.net/api/';
|
|
6
6
|
|
|
7
7
|
const url = new URL(apiBaseUrl);
|
|
8
|
-
url.pathname =
|
|
9
|
-
url.search =
|
|
8
|
+
url.pathname = '/SSO';
|
|
9
|
+
url.search = `?a=${appToken}&r=%target%%3Ft=%token%%26m=%mandant%`;
|
|
10
10
|
let ssoAuthUrl = url.toString();
|
|
11
11
|
|
|
12
12
|
let restClient = new RESTClient(apiBaseUrl, authToken);
|
|
13
13
|
restClient.onError = (error, message) => {
|
|
14
|
-
if (message.indexOf(
|
|
15
|
-
{
|
|
14
|
+
if (message.indexOf('401') || message.indexOf('403')) {
|
|
16
15
|
//console.log(message+" would remove Token");
|
|
17
|
-
localStorage.removeItem(
|
|
18
|
-
|
|
16
|
+
localStorage.removeItem('IDAS_AuthToken');
|
|
17
|
+
let ssoURL = ssoAuthUrl.replace('%target%', encodeURIComponent(window.location.href));
|
|
19
18
|
window.location = ssoURL;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
export class IDAS
|
|
24
|
-
{
|
|
25
|
-
async authenticate(authDTO) {
|
|
22
|
+
export class IDAS {
|
|
23
|
+
async authenticate(authDTO) {
|
|
26
24
|
authDTO.AppToken = appToken;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (data?.Token)
|
|
30
|
-
{
|
|
25
|
+
let { data } = await restClient.post('/Login/Authenticate', authDTO);
|
|
26
|
+
if (data?.Token) {
|
|
31
27
|
authToken = data.Token;
|
|
32
|
-
localStorage.setItem(
|
|
28
|
+
localStorage.setItem('IDAS_AuthToken', authToken);
|
|
33
29
|
restClient = new RESTClient(apiBaseUrl, authToken);
|
|
34
30
|
}
|
|
35
31
|
return data;
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
async authenticateWithSSO() {
|
|
39
|
-
if (!authToken)
|
|
40
|
-
|
|
41
|
-
var ssoURL = ssoAuthUrl.replace("%target%", encodeURIComponent(window.location.href));
|
|
34
|
+
async authenticateWithSSO() {
|
|
35
|
+
if (!authToken) {
|
|
36
|
+
let ssoURL = ssoAuthUrl.replace('%target%', encodeURIComponent(window.location.href));
|
|
42
37
|
window.location = ssoURL;
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
40
|
|
|
46
|
-
mandantGuid = localStorage.getItem(
|
|
41
|
+
mandantGuid = localStorage.getItem('IDAS_MandantGuid');
|
|
47
42
|
|
|
48
43
|
auth = {
|
|
49
|
-
async getCurrentAuthToken() {
|
|
44
|
+
async getCurrentAuthToken() {
|
|
45
|
+
return await restClient.put('/Login/Update/', { Token: authToken })
|
|
46
|
+
},
|
|
50
47
|
};
|
|
51
48
|
|
|
52
49
|
mandanten = {
|
|
53
|
-
async getAll() {
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
async getAll() {
|
|
51
|
+
return await restClient.get('/Mandanten');
|
|
52
|
+
},
|
|
53
|
+
async get(guid) {
|
|
54
|
+
return await restClient.get(`/Mandanten/${guid}`);
|
|
55
|
+
},
|
|
56
|
+
async save(m) {
|
|
57
|
+
await restClient.put('/Mandanten', m);
|
|
58
|
+
},
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
benutzer = {
|
|
59
|
-
async getAll(mandantGuid) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
async getAll(mandantGuid) {
|
|
63
|
+
return await restClient.get(`/BenutzerListe/${mandantGuid }/?mitRollenUndRechten=true`);
|
|
64
|
+
},
|
|
65
|
+
async get(guid) {
|
|
66
|
+
return await restClient.get(`/Benutzer/${guid}`);
|
|
67
|
+
},
|
|
68
|
+
async save(m) {
|
|
69
|
+
await restClient.put('/Benutzer', m);
|
|
70
|
+
},
|
|
62
71
|
};
|
|
63
72
|
|
|
64
73
|
feedback = {
|
|
65
|
-
async getAll() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
async
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
async getAll() {
|
|
75
|
+
return await restClient.get('/Feedback/');
|
|
76
|
+
},
|
|
77
|
+
async get(guid) {
|
|
78
|
+
return await restClient.get(`/Feedback/${guid}`);
|
|
79
|
+
},
|
|
80
|
+
async save(m) {
|
|
81
|
+
await restClient.put('/Feedback', m);
|
|
82
|
+
},
|
|
83
|
+
async comment(guid, commentData) {
|
|
84
|
+
await restClient.put(`/FeedbackKommentar/${guid}`, commentData);
|
|
85
|
+
},
|
|
86
|
+
async attachFile(m) {
|
|
87
|
+
await restClient.put('/FeedbackAttachment', m);
|
|
88
|
+
},
|
|
89
|
+
async deleteFile(guid) {
|
|
90
|
+
await restClient.delete(`/FeedbackAttachment/${guid}`);
|
|
91
|
+
},
|
|
71
92
|
};
|
|
72
93
|
|
|
73
94
|
rollen = {
|
|
74
|
-
async getAll() {
|
|
75
|
-
|
|
95
|
+
async getAll() {
|
|
96
|
+
return await restClient.get('/Rollen');
|
|
97
|
+
},
|
|
98
|
+
async save(m) {
|
|
99
|
+
await restClient.put('/Rollen', m);
|
|
100
|
+
},
|
|
76
101
|
};
|
|
77
|
-
}
|
|
102
|
+
}
|
package/api/RESTClient.js
CHANGED
|
@@ -1,122 +1,106 @@
|
|
|
1
|
-
import axios from
|
|
1
|
+
import axios from 'axios';
|
|
2
2
|
|
|
3
3
|
/*export let AppToken = "66B70E0B-F7C4-4829-B12A-18AD309E3970";
|
|
4
4
|
export let AuthToken = localStorage.getItem("AuthToken");
|
|
5
5
|
export let MandantGuid = localStorage.getItem("MandantGuid");
|
|
6
6
|
export let ApiBaseUrl = localStorage.getItem("ApiBaseUrl") || "https://api.dev.idas-cloudservices.net/api";
|
|
7
7
|
export let SiteBaseUrl = window.location.origin;
|
|
8
|
-
export let SSOAuthUrl = ApiBaseUrl.replace("/api",
|
|
8
|
+
export let SSOAuthUrl = ApiBaseUrl.replace("/api", '') + "/SSO?a=" + AppToken + "&r=%target%?t=%token%%26m=%mandant%";*/
|
|
9
9
|
|
|
10
|
-
export class RESTClient
|
|
11
|
-
{
|
|
10
|
+
export class RESTClient {
|
|
12
11
|
lastError = '';
|
|
13
|
-
token =
|
|
14
|
-
baseurl =
|
|
12
|
+
token = '';
|
|
13
|
+
baseurl = '';
|
|
15
14
|
|
|
16
|
-
constructor(url, token)
|
|
17
|
-
|
|
18
|
-
this.lastError = "";
|
|
15
|
+
constructor(url, token) {
|
|
16
|
+
this.lastError = '';
|
|
19
17
|
this.baseurl = url;
|
|
20
18
|
this.token = token;
|
|
21
|
-
console.log("Base: " + this.baseurl + " Token: " + this.token);
|
|
22
19
|
|
|
23
20
|
if (this.token) {
|
|
24
21
|
axios.defaults.headers.common['X-Gdl-AuthToken'] = this.token;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
axios.interceptors.request.use(req => {
|
|
28
|
-
console.log(`${req.method} ${req.url}`);
|
|
29
25
|
return req;
|
|
30
26
|
});
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
async get(uri)
|
|
34
|
-
{
|
|
29
|
+
async get(uri) {
|
|
35
30
|
try {
|
|
36
31
|
const response = await axios.get(this.baseurl + uri, { withCredentials: false });
|
|
37
32
|
this.lastError = '';
|
|
38
33
|
return response.data;
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
34
|
+
} catch (error) {
|
|
41
35
|
this.handleError(error);
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
38
|
|
|
45
|
-
async getFile(uri)
|
|
46
|
-
{
|
|
39
|
+
async getFile(uri) {
|
|
47
40
|
try {
|
|
48
41
|
const response = await axios.get(this.baseurl + uri, { responseType: 'blob' });
|
|
49
|
-
let fileName =
|
|
50
|
-
if (response.headers[
|
|
51
|
-
fileName = response.headers[
|
|
52
|
-
fileName = fileName.replace(
|
|
42
|
+
let fileName = '1000.pdf';
|
|
43
|
+
if (response.headers['content-disposition']) {
|
|
44
|
+
fileName = response.headers['content-disposition'].split(';')[1];
|
|
45
|
+
fileName = fileName.replace('filename=', '').trim();
|
|
53
46
|
}
|
|
54
47
|
this.lastError = '';
|
|
55
|
-
return { data: response.data, filename: fileName, contentType:
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
48
|
+
return { data: response.data, filename: fileName, contentType: 'application/pdf' };
|
|
49
|
+
} catch (error) {
|
|
58
50
|
this.handleError(error);
|
|
59
51
|
}
|
|
60
52
|
}
|
|
61
53
|
|
|
62
|
-
async getRaw(uri)
|
|
63
|
-
{
|
|
54
|
+
async getRaw(uri) {
|
|
64
55
|
let response = {};
|
|
65
56
|
try {
|
|
66
57
|
response = await axios.get(this.baseurl + uri, { withCredentials: false })
|
|
67
58
|
this.lastError = '';
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
59
|
+
} catch (error) {
|
|
70
60
|
this.handleError(error);
|
|
71
61
|
}
|
|
72
62
|
return response;
|
|
73
63
|
}
|
|
74
64
|
|
|
75
|
-
async post(uri, formData)
|
|
76
|
-
{
|
|
65
|
+
async post(uri, formData) {
|
|
77
66
|
try {
|
|
78
67
|
const response = await axios.post(this.baseurl + uri, formData, { withCredentials: false });
|
|
79
68
|
this.lastError = '';
|
|
80
69
|
return response;
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
70
|
+
} catch (error) {
|
|
83
71
|
this.handleError(error);
|
|
84
72
|
}
|
|
85
73
|
}
|
|
86
74
|
|
|
87
|
-
async put(uri, formData)
|
|
88
|
-
{
|
|
75
|
+
async put(uri, formData) {
|
|
89
76
|
try {
|
|
90
77
|
const response = await axios.put(this.baseurl + uri, formData, { withCredentials: false });
|
|
91
78
|
this.lastError = '';
|
|
92
79
|
return response;
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
80
|
+
} catch (error) {
|
|
95
81
|
this.handleError(error);
|
|
96
82
|
}
|
|
97
83
|
}
|
|
98
84
|
|
|
99
|
-
async delete(uri)
|
|
100
|
-
|
|
101
|
-
try
|
|
102
|
-
{
|
|
85
|
+
async delete(uri) {
|
|
86
|
+
try {
|
|
103
87
|
const response = await axios.delete(this.baseurl + uri, { withCredentials: false });
|
|
104
88
|
this.lastError = '';
|
|
105
89
|
return response;
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
90
|
+
} catch (error) {
|
|
108
91
|
this.handleError(error);
|
|
109
92
|
}
|
|
110
93
|
}
|
|
111
94
|
|
|
95
|
+
// eslint-disable-next-line no-unused-vars
|
|
112
96
|
onError = (error, message) => {};
|
|
113
97
|
|
|
114
|
-
handleError(error)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
console.log(
|
|
98
|
+
handleError(error) {
|
|
99
|
+
let message = error ? error.message : '?';
|
|
100
|
+
// eslint-disable-next-line no-console
|
|
101
|
+
console.log(`API Error: ${message}`);
|
|
118
102
|
this.lastError = message;
|
|
119
103
|
this.onError(error, message);
|
|
120
104
|
throw error;
|
|
121
105
|
}
|
|
122
|
-
}
|
|
106
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { Button } from 'svelte-chota';
|
|
3
3
|
import { mdiMessageAlert } from '@mdi/js'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
export let Handler;
|
|
6
6
|
export let disabled;
|
|
7
7
|
export let title;
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
|
|
10
10
|
<Button primary outline title={title} on:click={Handler} icon={mdiMessageAlert} {disabled}>
|
|
11
11
|
{title}
|
|
12
|
-
</Button>
|
|
12
|
+
</Button>
|
|
@@ -6,35 +6,33 @@
|
|
|
6
6
|
export let items = [];
|
|
7
7
|
export let selectedItem = {};
|
|
8
8
|
export let standardItem;
|
|
9
|
-
export let displayProperty =
|
|
10
|
-
export let header =
|
|
11
|
-
export let key =
|
|
9
|
+
export let displayProperty = '';
|
|
10
|
+
export let header = 'Überschrift';
|
|
11
|
+
export let key = 'Guid';
|
|
12
12
|
export let marker = null;
|
|
13
|
-
export let markerField =
|
|
13
|
+
export let markerField = '';
|
|
14
14
|
|
|
15
|
-
function setCurrent(item)
|
|
16
|
-
{
|
|
15
|
+
function setCurrent(item) {
|
|
17
16
|
selectedItem = item;
|
|
18
|
-
|
|
19
|
-
dispatch("selectedItemChanged", item);
|
|
17
|
+
dispatch('selectedItemChanged', item);
|
|
20
18
|
}
|
|
21
19
|
</script>
|
|
22
20
|
|
|
23
|
-
<div class="datagrid">
|
|
21
|
+
<div class="datagrid">
|
|
24
22
|
<div class="dgheader">
|
|
25
23
|
{header}
|
|
26
24
|
</div>
|
|
27
25
|
<div>
|
|
28
26
|
{#if standardItem}
|
|
29
|
-
|
|
27
|
+
<div class="dgrow" on:click={setCurrent(standardItem)} class:selected="{selectedItem[key] === standardItem[key]}">{standardItem[displayProperty]}</div>
|
|
30
28
|
{/if}
|
|
31
29
|
{#each items as d}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
<div class="dgrow" on:click={setCurrent(d)} class:selected="{selectedItem[key] === d[key]}">
|
|
31
|
+
{d[displayProperty]}
|
|
32
|
+
{#if marker && markerField && d[markerField] === true}
|
|
33
|
+
<Icon src={marker} />
|
|
34
|
+
{/if}
|
|
35
|
+
</div>
|
|
38
36
|
{/each}
|
|
39
37
|
</div>
|
|
40
38
|
</div>
|
|
@@ -55,7 +53,7 @@
|
|
|
55
53
|
padding: 4px 4px 4px 8px;
|
|
56
54
|
flex: 1;
|
|
57
55
|
}
|
|
58
|
-
|
|
56
|
+
|
|
59
57
|
.dgrow {
|
|
60
58
|
margin-left: 8px;
|
|
61
59
|
border-bottom: 1px solid var(--color-darkGrey);
|
|
@@ -65,8 +63,8 @@
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
.selected {
|
|
68
|
-
background-color: var(--color-selected);
|
|
69
|
-
color: var(--color-selected-text);
|
|
66
|
+
background-color: var(--color-selected);
|
|
67
|
+
color: var(--color-selected-text);
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
</style>
|
|
70
|
+
</style>
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
export let Height = 30;
|
|
3
|
-
export let Placeholder =
|
|
4
|
-
export let Value =
|
|
3
|
+
export let Placeholder = '';
|
|
4
|
+
export let Value = '';
|
|
5
5
|
export let Width = 120;
|
|
6
6
|
|
|
7
|
-
const backgroundNormal =
|
|
8
|
-
const backgroundFalschesDatum =
|
|
9
|
-
|
|
10
|
-
let monate = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"];
|
|
11
|
-
let montateKurz = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Nov", "Dez"];
|
|
12
|
-
let tage = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sontag"];
|
|
13
|
-
let tageKurz = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];
|
|
7
|
+
const backgroundNormal = '#FFFFFF';
|
|
8
|
+
const backgroundFalschesDatum = '#FF0000';
|
|
14
9
|
|
|
15
|
-
let
|
|
10
|
+
let monate = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
|
|
11
|
+
let tageKurz = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'];
|
|
12
|
+
|
|
13
|
+
let buttonStyle, divStyle, inputStyle;
|
|
16
14
|
let background = backgroundNormal;
|
|
17
15
|
let buttonHeight = Height - 6;
|
|
18
16
|
let buttonImageHeight = Height - 10;
|
|
@@ -21,210 +19,162 @@
|
|
|
21
19
|
let inputHeight = Height - 2;
|
|
22
20
|
let inputWidth = Width - Height - 10;
|
|
23
21
|
|
|
24
|
-
let allowedNumbers = [
|
|
22
|
+
let allowedNumbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
|
|
25
23
|
let allowedTage = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
26
|
-
let
|
|
27
|
-
let
|
|
28
|
-
let allowedFunctionalKeys = ["ArrowLeft", "ArrowRight", "Backspace", "Delete"];
|
|
24
|
+
let allowedSonderzeichen = '.';
|
|
25
|
+
let allowedFunctionalKeys = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete'];
|
|
29
26
|
let currentJahr = new Date().getFullYear();
|
|
30
27
|
let currentMonat = monate[new Date().getMonth()];
|
|
31
28
|
let wochenImMonat = [];
|
|
32
29
|
let monatIndex = 0;
|
|
33
30
|
|
|
34
|
-
function alertFalschesDatum()
|
|
35
|
-
{
|
|
31
|
+
function alertFalschesDatum() {
|
|
36
32
|
background = backgroundFalschesDatum;
|
|
37
33
|
errorHidden = false;
|
|
38
34
|
setFieldStyle();
|
|
39
35
|
}
|
|
40
|
-
function backToNormal()
|
|
41
|
-
{
|
|
36
|
+
function backToNormal() {
|
|
42
37
|
background = backgroundNormal;
|
|
43
38
|
errorHidden = true;
|
|
44
39
|
setFieldStyle();
|
|
45
40
|
}
|
|
46
|
-
function checkGueltigesDatum()
|
|
47
|
-
{
|
|
41
|
+
function checkGueltigesDatum() {
|
|
48
42
|
let error = false;
|
|
49
43
|
let inhalt = Value.split(allowedSonderzeichen);
|
|
50
44
|
let localTag = inhalt[0];
|
|
51
45
|
let localMonat = inhalt[1];
|
|
52
|
-
let localJahr = inhalt[2];
|
|
53
46
|
|
|
54
|
-
if(inhalt.length == 1 && Value.length == 2)
|
|
55
|
-
{
|
|
47
|
+
if (inhalt.length == 1 && Value.length == 2) {
|
|
56
48
|
Value = Value + allowedSonderzeichen;
|
|
57
49
|
}
|
|
58
|
-
if(inhalt.length == 2 && localMonat.toLocaleString().length >= 2)
|
|
59
|
-
{
|
|
50
|
+
if (inhalt.length == 2 && localMonat.toLocaleString().length >= 2) {
|
|
60
51
|
Value = Value + allowedSonderzeichen;
|
|
61
52
|
}
|
|
62
53
|
|
|
63
54
|
// Prüfung, ob der Monat korrekt eingegeben wurde
|
|
64
|
-
if(localMonat !=
|
|
65
|
-
{
|
|
55
|
+
if (localMonat != 'undefined' && (localMonat < 1 || localMonat > 12)) {
|
|
66
56
|
error = true;
|
|
67
|
-
}
|
|
68
|
-
else
|
|
69
|
-
{
|
|
57
|
+
} else {
|
|
70
58
|
error = false;
|
|
71
59
|
}
|
|
72
60
|
|
|
73
61
|
// Prüfung, ob der Tag korrekt eingegeben wurde
|
|
74
|
-
if(localTag < 1 || localTag > 31)
|
|
75
|
-
{
|
|
62
|
+
if (localTag < 1 || localTag > 31) {
|
|
76
63
|
error = true;
|
|
77
64
|
}
|
|
78
65
|
|
|
79
|
-
if(localMonat !=
|
|
80
|
-
{
|
|
66
|
+
if (localMonat != 'undefined') {
|
|
81
67
|
let localAllowedTage = allowedTage[inhalt[1]];
|
|
82
|
-
if(localAllowedTage ==
|
|
83
|
-
{
|
|
68
|
+
if (localAllowedTage == 'undefined') {
|
|
84
69
|
error = true;
|
|
85
70
|
}
|
|
86
|
-
if(localTag > localAllowedTage)
|
|
87
|
-
{
|
|
71
|
+
if (localTag > localAllowedTage) {
|
|
88
72
|
error = true;
|
|
89
73
|
}
|
|
90
74
|
}
|
|
91
75
|
|
|
92
|
-
if(error)
|
|
93
|
-
{
|
|
76
|
+
if (error) {
|
|
94
77
|
alertFalschesDatum();
|
|
95
|
-
}
|
|
96
|
-
else
|
|
97
|
-
{
|
|
78
|
+
} else {
|
|
98
79
|
backToNormal();
|
|
99
80
|
}
|
|
100
81
|
}
|
|
101
|
-
function daysInMonth()
|
|
102
|
-
{
|
|
82
|
+
function daysInMonth() {
|
|
103
83
|
wochenImMonat = [];
|
|
104
84
|
monatIndex = monate.findIndex(item => item == currentMonat) + 1;
|
|
105
85
|
let tageImMonat = new Date(currentJahr, monatIndex, 0).getDate();
|
|
106
86
|
let localTagIndex = 0;
|
|
107
87
|
let woche = [];
|
|
108
|
-
let tagesWochenCounter = 0;
|
|
109
88
|
|
|
110
|
-
for(let counter = 0; counter < tageImMonat; counter++)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
// Am Anfang müssen erstmal x Leertage in die Woche eingefügt werden, damit der Monat
|
|
89
|
+
for (let counter = 0; counter < tageImMonat; counter++) {
|
|
90
|
+
localTagIndex = new Date(currentJahr, monatIndex - 1, counter).getDay();
|
|
91
|
+
if (counter == 0) {
|
|
92
|
+
// Am Anfang müssen erstmal x Leertage in die Woche eingefügt werden, damit der Monat
|
|
116
93
|
// am passenden Wochentag startet => das macht es in der Anzeigeschleife leichter
|
|
117
|
-
for(let bufferCounter = 0; bufferCounter < localTagIndex; bufferCounter++)
|
|
118
|
-
{
|
|
94
|
+
for (let bufferCounter = 0; bufferCounter < localTagIndex; bufferCounter++) {
|
|
119
95
|
woche = [...woche, ''];
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
|
-
woche = [...woche, counter+1];
|
|
98
|
+
woche = [...woche, counter + 1];
|
|
123
99
|
|
|
124
|
-
|
|
125
|
-
if(woche.length >= 7)
|
|
126
|
-
{
|
|
100
|
+
if (woche.length >= 7) {
|
|
127
101
|
wochenImMonat = [...wochenImMonat, woche]
|
|
128
102
|
woche = [];
|
|
129
|
-
tagesWochenCounter = 0;
|
|
130
103
|
}
|
|
131
|
-
if(counter == tageImMonat-1)
|
|
132
|
-
{
|
|
104
|
+
if (counter == tageImMonat - 1) {
|
|
133
105
|
wochenImMonat = [...wochenImMonat, woche]
|
|
134
106
|
woche = [];
|
|
135
|
-
tagesWochenCounter = 0;
|
|
136
107
|
}
|
|
137
108
|
}
|
|
138
109
|
}
|
|
139
|
-
function ignoreInput(e)
|
|
140
|
-
{
|
|
110
|
+
function ignoreInput(e) {
|
|
141
111
|
e.preventDefault();
|
|
142
112
|
e.returnValue = false;
|
|
143
113
|
}
|
|
144
|
-
function setFieldStyle()
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
inputStyle = "background: " + background + "; border: 0px; height: " + inputHeight + "px; width: " + inputWidth + "px;";
|
|
114
|
+
function setFieldStyle() {
|
|
115
|
+
buttonStyle = `background: transparent; border: 0px; height: ${buttonHeight}px; margin-left: 10px; margin-right: 8px; margin-top: 0px; width: ${buttonHeight}px;`;
|
|
116
|
+
divStyle = `background: white; border: 0.5px solid lightgray; border-radius: 5px; display: flex; height: ${Height}px; width: ${Width}px;`;
|
|
117
|
+
inputStyle = `background: ${background}; border: 0px; height: ${inputHeight}px; width: ${inputWidth}px;`;
|
|
149
118
|
}
|
|
150
|
-
function setJahr(selectedJahr)
|
|
151
|
-
{
|
|
119
|
+
function setJahr(selectedJahr) {
|
|
152
120
|
currentJahr = selectedJahr.currentJahr;
|
|
153
121
|
daysInMonth();
|
|
154
122
|
}
|
|
155
|
-
function setMonat(selectedMonat)
|
|
156
|
-
{
|
|
123
|
+
function setMonat(selectedMonat) {
|
|
157
124
|
currentMonat = selectedMonat.currentMonat;
|
|
158
125
|
daysInMonth();
|
|
159
126
|
}
|
|
160
|
-
function setPlaceholder(tag)
|
|
161
|
-
|
|
162
|
-
if(tag != "")
|
|
163
|
-
{
|
|
127
|
+
function setPlaceholder(tag) {
|
|
128
|
+
if (tag != '') {
|
|
164
129
|
//Placeholder = getFormattedDate(tag);
|
|
165
130
|
}
|
|
166
131
|
}
|
|
167
|
-
function setValue(tag)
|
|
168
|
-
|
|
169
|
-
Value = new Date(currentJahr+"-"+currentMonat+"-"+tag);
|
|
132
|
+
function setValue(tag) {
|
|
133
|
+
Value = new Date(`${currentJahr}-${currentMonat}-${tag}`);
|
|
170
134
|
datePickerHidden = true;
|
|
171
135
|
backToNormal();
|
|
172
136
|
}
|
|
173
|
-
function thisKeyDown(e)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
{
|
|
177
|
-
let inhalt = Value.split(allowedSonderzeichen);
|
|
178
|
-
if(Value.length >= 10)
|
|
179
|
-
{
|
|
137
|
+
function thisKeyDown(e) {
|
|
138
|
+
if (allowedNumbers.includes(e.key) == true) {
|
|
139
|
+
if (Value.length >= 10) {
|
|
180
140
|
ignoreInput(e);
|
|
181
141
|
}
|
|
182
142
|
checkGueltigesDatum();
|
|
183
|
-
}
|
|
184
|
-
else if (e.key == allowedSonderzeichen)
|
|
185
|
-
{
|
|
143
|
+
} else if (e.key == allowedSonderzeichen) {
|
|
186
144
|
// Kann nicht mit einer && Verknüpfung in die else if-Bedingung gepackt werden, da sonst gar kein Sonderzeichen mehr erlaubt ist... warum auch immer.
|
|
187
|
-
if(Value.split(allowedSonderzeichen).length >= 3)
|
|
188
|
-
{
|
|
145
|
+
if (Value.split(allowedSonderzeichen).length >= 3) {
|
|
189
146
|
ignoreInput(e);
|
|
190
147
|
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
{
|
|
148
|
+
} else if (allowedFunctionalKeys.includes(e.key) == true) {
|
|
149
|
+
return;
|
|
150
|
+
} else {
|
|
195
151
|
ignoreInput(e);
|
|
196
152
|
}
|
|
197
153
|
}
|
|
198
|
-
function getValueFormatted(oldValue)
|
|
199
|
-
{
|
|
154
|
+
function getValueFormatted(oldValue) {
|
|
200
155
|
let localTag = (new Date(oldValue).getUTCDate()).toString();
|
|
201
|
-
let localMonat = (new Date(oldValue).getMonth()+1).toString();
|
|
156
|
+
let localMonat = (new Date(oldValue).getMonth() + 1).toString();
|
|
202
157
|
let localJahr = new Date(oldValue).getUTCFullYear().toString();
|
|
203
158
|
|
|
204
|
-
if(localMonat.length < 2)
|
|
205
|
-
|
|
206
|
-
localMonat = "0" + localMonat;
|
|
159
|
+
if (localMonat.length < 2) {
|
|
160
|
+
localMonat = `0${localMonat}`;
|
|
207
161
|
}
|
|
208
|
-
if(localTag.length < 2)
|
|
209
|
-
|
|
210
|
-
localTag = "0" + localTag;
|
|
162
|
+
if (localTag.length < 2) {
|
|
163
|
+
localTag = `0${localTag}`;
|
|
211
164
|
}
|
|
212
|
-
return localTag
|
|
165
|
+
return `${localTag }.${localMonat}.${localJahr}`;
|
|
213
166
|
}
|
|
214
167
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
$:if(Value)
|
|
221
|
-
{
|
|
168
|
+
setFieldStyle();
|
|
169
|
+
daysInMonth(currentMonat, currentJahr);
|
|
170
|
+
|
|
171
|
+
$:if (Value) {
|
|
222
172
|
Value = getValueFormatted(Value);
|
|
223
173
|
}
|
|
224
174
|
</script>
|
|
225
175
|
|
|
226
176
|
<div style={divStyle}>
|
|
227
|
-
<input
|
|
177
|
+
<input type="text" style={inputStyle} placeholder={Placeholder} bind:value={Value} on:keydown={thisKeyDown}>
|
|
228
178
|
<button style={buttonStyle} on:click={() => datePickerHidden = !datePickerHidden}>
|
|
229
179
|
<img src="calendar.png" alt="" height={buttonImageHeight}>
|
|
230
180
|
<!-- [...] -->
|
|
@@ -255,7 +205,7 @@
|
|
|
255
205
|
<tr>
|
|
256
206
|
{#each woche as tageInWoche}
|
|
257
207
|
<td>
|
|
258
|
-
<button class="buttonTag" on:mouseover={() => setPlaceholder(tageInWoche)} on:click={() => setValue(tageInWoche)}>
|
|
208
|
+
<button class="buttonTag" on:mouseover={() => setPlaceholder(tageInWoche)} on:focus={() => setPlaceholder(tageInWoche)} on:click={() => setValue(tageInWoche)}>
|
|
259
209
|
{tageInWoche}
|
|
260
210
|
</button>
|
|
261
211
|
</td>
|
|
@@ -298,4 +248,4 @@
|
|
|
298
248
|
background-color:cornflowerblue;
|
|
299
249
|
color: white;
|
|
300
250
|
}
|
|
301
|
-
</style>
|
|
251
|
+
</style>
|
package/components/Dialog.svelte
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
{#if isOpen}
|
|
6
|
-
<div class="z-10 absolute w-screen h-screen bg-black left-0 top-0 bg-opacity-50">
|
|
6
|
+
<div class="z-10 absolute w-screen h-screen bg-black left-0 top-0 bg-opacity-50">
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
9
|
<div class="z-10 absolute left-[20vw] top-[10vw] w-[60vw] shadow-xl shadow-slate-700 bg-white p-8">
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
<button class="float-right bg-gray-600 text-white p-4" on:click={() => isOpen = false}>Schließen</button>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
|
-
{/if}
|
|
20
|
+
{/if}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import SvelteTable from
|
|
2
|
+
import SvelteTable from 'svelte-table';
|
|
3
3
|
|
|
4
4
|
export let columns;
|
|
5
5
|
/** @type {any[]} */
|
|
6
6
|
export let rows;
|
|
7
7
|
/** @type {string} */
|
|
8
|
-
export let sortBy =
|
|
8
|
+
export let sortBy = '';
|
|
9
9
|
/** @type {(string | number)[]} */
|
|
10
10
|
export let expanded = [];
|
|
11
11
|
/** @type {(string | number)[]} */
|
|
@@ -30,6 +30,25 @@
|
|
|
30
30
|
export let clickExpand = null;
|
|
31
31
|
/** @type {function | null} */
|
|
32
32
|
export let clickCell = null;
|
|
33
|
+
|
|
34
|
+
// CSS Classes
|
|
35
|
+
export let classNameTable = 'border-2 border-collapse my-4';
|
|
36
|
+
export let classNameThead = '';
|
|
37
|
+
export let classNameTbody = '';
|
|
38
|
+
export let classNameSelect = '';
|
|
39
|
+
export let classNameInput = '';
|
|
40
|
+
export let classNameRow = 'border-2 border-collapse odd:bg-gray-100 hover:bg-gray-300';
|
|
41
|
+
export let classNameCell = '';
|
|
42
|
+
export let classNameRowSelected = '!bg-gray-400';
|
|
43
|
+
export let classNameRowExpanded = 'bg-gray-400';
|
|
44
|
+
export let classNameExpandedContent = '';
|
|
45
|
+
export let classNameCellExpand = '';
|
|
46
|
+
|
|
47
|
+
const asStringArray = v =>
|
|
48
|
+
[]
|
|
49
|
+
.concat(v)
|
|
50
|
+
.filter(v => v !== null && typeof v === 'string' && v !== '')
|
|
51
|
+
.join(' ');
|
|
33
52
|
</script>
|
|
34
53
|
|
|
35
54
|
<SvelteTable
|
|
@@ -47,17 +66,17 @@
|
|
|
47
66
|
on:clickRow={clickRow}
|
|
48
67
|
on:clickExpand={clickExpand}
|
|
49
68
|
on:clickCell={clickCell}
|
|
50
|
-
classNameTable=
|
|
51
|
-
classNameThead=
|
|
52
|
-
classNameTbody=
|
|
53
|
-
classNameSelect=
|
|
54
|
-
classNameInput=
|
|
55
|
-
classNameRow=
|
|
56
|
-
classNameCell=
|
|
57
|
-
classNameRowSelected=
|
|
58
|
-
classNameRowExpanded=
|
|
59
|
-
classNameExpandedContent=
|
|
60
|
-
classNameCellExpand=
|
|
69
|
+
classNameTable={asStringArray(['gan-table', classNameTable])}
|
|
70
|
+
classNameThead={asStringArray(['gan-thead', classNameThead])}
|
|
71
|
+
classNameTbody={asStringArray(['gan-tbody', classNameTbody])}
|
|
72
|
+
classNameSelect={asStringArray(['custom-select', classNameSelect])}
|
|
73
|
+
classNameInput={asStringArray(['custom-input', classNameInput])}
|
|
74
|
+
classNameRow={asStringArray(['gan-row', classNameRow])}
|
|
75
|
+
classNameCell={asStringArray(['gan-cell', classNameCell])}
|
|
76
|
+
classNameRowSelected={asStringArray(['row-selected', classNameRowSelected])}
|
|
77
|
+
classNameRowExpanded={asStringArray(['row-expanded', classNameRowExpanded])}
|
|
78
|
+
classNameExpandedContent={asStringArray(['expanded-content', classNameExpandedContent])}
|
|
79
|
+
classNameCellExpand={asStringArray(['cell-expand', classNameCellExpand])}>
|
|
61
80
|
|
|
62
81
|
<!-- Wait for better workaround. See: https://github.com/sveltejs/svelte/issues/5604 -->
|
|
63
82
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
export let AllowedDecimals = 2;
|
|
3
|
-
export let DecimalTrenner =
|
|
3
|
+
export let DecimalTrenner = ',';
|
|
4
4
|
export let KeyDownFunctionOnEnter, KeyDownFunctionOnTab;
|
|
5
5
|
export let Height = 30;
|
|
6
6
|
export let IsPflichtfeld = false;
|
|
@@ -8,266 +8,186 @@
|
|
|
8
8
|
export let MinValue = 0;
|
|
9
9
|
export let MaxValue = 0;
|
|
10
10
|
export let Multiline = false;
|
|
11
|
-
export let Type =
|
|
12
|
-
export let Value =
|
|
11
|
+
export let Type = 'text';
|
|
12
|
+
export let Value = '';
|
|
13
13
|
export let Width = 120;
|
|
14
14
|
|
|
15
15
|
let errorHidden = true;
|
|
16
|
-
let errorMessage =
|
|
17
|
-
let style =
|
|
18
|
-
let styleError =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
let
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
case "currency":
|
|
31
|
-
case "number":
|
|
16
|
+
let errorMessage = '';
|
|
17
|
+
let style = `height: ${Height}px; width: ${Width}px;`;
|
|
18
|
+
let styleError = `width: ${Width}px;`;
|
|
19
|
+
|
|
20
|
+
let allowedNumbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
21
|
+
let allowedDecimalTrenner = [',', '.'];
|
|
22
|
+
let allowedFunctionalKeys = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete'];
|
|
23
|
+
let allowedVorzeichen = '-';
|
|
24
|
+
|
|
25
|
+
function checkInput(e) {
|
|
26
|
+
switch (Type) {
|
|
27
|
+
case 'currency':
|
|
28
|
+
case 'number':
|
|
32
29
|
checkInputNumber(e);
|
|
33
30
|
break;
|
|
34
31
|
|
|
35
|
-
case
|
|
32
|
+
case 'email':
|
|
36
33
|
checkInputEMail(e)
|
|
37
34
|
break;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
executeAdditionalFunctions(e);
|
|
41
38
|
}
|
|
42
|
-
function checkInputNumber(e)
|
|
43
|
-
{
|
|
39
|
+
function checkInputNumber(e) {
|
|
44
40
|
let localValueString = Value.toLocaleString();
|
|
45
|
-
|
|
41
|
+
|
|
46
42
|
// Prüfung auf Ziffern
|
|
47
|
-
if(allowedNumbers.includes(e.key) == true)
|
|
48
|
-
|
|
49
|
-
if(isBetweenMinMax(e))
|
|
50
|
-
{
|
|
43
|
+
if (allowedNumbers.includes(e.key) == true) {
|
|
44
|
+
if (isBetweenMinMax(e)) {
|
|
51
45
|
let positionDezimalTrenner = localValueString.indexOf(DecimalTrenner)
|
|
52
|
-
if(positionDezimalTrenner > -1)
|
|
53
|
-
{
|
|
46
|
+
if (positionDezimalTrenner > -1) {
|
|
54
47
|
let decimals = localValueString.substring(positionDezimalTrenner);
|
|
55
|
-
if(decimals.length > AllowedDecimals || (Type ==
|
|
56
|
-
{
|
|
48
|
+
if (decimals.length > AllowedDecimals || (Type == 'currency' && decimals.length > 2)) {
|
|
57
49
|
ignoreInput(e);
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
|
-
}
|
|
61
|
-
else
|
|
62
|
-
{
|
|
52
|
+
} else {
|
|
63
53
|
ignoreInput(e);
|
|
64
54
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Prüfung auf Dezimaltrenner
|
|
68
|
-
else if (allowedDecimalTrenner.includes(e.key) == true)
|
|
69
|
-
{
|
|
70
|
-
if(localValueString.split(DecimalTrenner).length >= 2)
|
|
71
|
-
{
|
|
55
|
+
} else if (allowedDecimalTrenner.includes(e.key) == true) { // Prüfung auf Dezimaltrenner
|
|
56
|
+
if (localValueString.split(DecimalTrenner).length >= 2) {
|
|
72
57
|
ignoreInput(e);
|
|
73
|
-
}
|
|
74
|
-
else if(e.key != DecimalTrenner)
|
|
75
|
-
{
|
|
58
|
+
} else if (e.key != DecimalTrenner) {
|
|
76
59
|
ignoreInput(e);
|
|
77
60
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Prüfung auf Vorzeichen
|
|
81
|
-
else if (IsVorzeichenErlaubt && e.key == allowedVorzeichen)
|
|
82
|
-
{
|
|
83
|
-
if(!isBetweenMinMax(e))
|
|
84
|
-
{
|
|
61
|
+
} else if (IsVorzeichenErlaubt && e.key == allowedVorzeichen) { // Prüfung auf Vorzeichen
|
|
62
|
+
if (!isBetweenMinMax(e)) {
|
|
85
63
|
ignoreInput(e);
|
|
86
|
-
}
|
|
87
|
-
else if(localValueString.startsWith(e.key))
|
|
88
|
-
{
|
|
64
|
+
} else if (localValueString.startsWith(e.key)) {
|
|
89
65
|
ignoreInput(e);
|
|
90
|
-
}
|
|
91
|
-
else
|
|
92
|
-
{
|
|
66
|
+
} else {
|
|
93
67
|
Value = e.key + Value;
|
|
94
68
|
ignoreInput(e);
|
|
95
69
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
else if (allowedFunctionalKeys.includes(e.key) == true) { }
|
|
100
|
-
|
|
101
|
-
// Alles andere soll nicht erlaubt sein
|
|
102
|
-
else
|
|
103
|
-
{
|
|
70
|
+
} else if (allowedFunctionalKeys.includes(e.key) == true) { // Prüfung auf Funktionstasten wie [ENTF], [DEL], usw.
|
|
71
|
+
return;
|
|
72
|
+
} else { // Alles andere soll nicht erlaubt sein
|
|
104
73
|
ignoreInput(e);
|
|
105
74
|
}
|
|
106
75
|
}
|
|
107
|
-
function checkInputEMail(e)
|
|
108
|
-
|
|
109
|
-
let mailParts = Value.split("@");
|
|
76
|
+
function checkInputEMail(e) {
|
|
77
|
+
let mailParts = Value.split('@');
|
|
110
78
|
errorHidden = false; // Pauschal einen Fehler anzeigen lassen - spart Codezeilen
|
|
111
79
|
|
|
112
|
-
if(mailParts[0].length > 64)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
else if(mailParts.length > 1 && mailParts[
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
else if(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
else if(Value.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
else
|
|
129
|
-
{
|
|
130
|
-
errorMessage = "Die E-Mail Adresse darf mit einem @-Zeichen weder beginnen noch enden."
|
|
131
|
-
}
|
|
132
|
-
else if(!Value.includes("@") && e.key != "@")
|
|
133
|
-
{
|
|
134
|
-
errorMessage = "@-Zeichen muss enthalten sein."
|
|
135
|
-
}
|
|
136
|
-
else if(Value.length > 253)
|
|
137
|
-
{
|
|
138
|
-
errorMessage = "Maximallänge: 254 Zeichen.";
|
|
139
|
-
}
|
|
140
|
-
else if(Value.length < 6)
|
|
141
|
-
{
|
|
142
|
-
errorMessage = "Mindestlänge: 6 Zeichen.";
|
|
143
|
-
}
|
|
144
|
-
else
|
|
145
|
-
{
|
|
80
|
+
if (mailParts[0].length > 64) {
|
|
81
|
+
errorMessage = 'Der Lokalteil der E-Mail Adresse (vor dem @-Zeichen) darf eine Maximallänge von 64 Zeichen nicht überschreiten.'
|
|
82
|
+
} else if (mailParts.length > 1 && mailParts[0].length < 1) {
|
|
83
|
+
errorMessage = 'Der Lokalteil der E-Mail Adresse (vor dem @-Zeichen) muss eine Mindestlänge von 1 Zeichen besitzen.'
|
|
84
|
+
} else if (mailParts.length > 1 && !mailParts[1].includes('.')) {
|
|
85
|
+
errorMessage = 'Der Domainteil der E-Mail Adresse (nach dem @-Zeichen) muss einen Punkt (.) enthalten.'
|
|
86
|
+
} else if (Value.startsWith('.') || Value.endsWith('.')) {
|
|
87
|
+
errorMessage = 'Die E-Mail Adresse darf mit einem Punkt weder beginnen noch enden.'
|
|
88
|
+
} else if (Value.startsWith('@') || Value.endsWith('@')) {
|
|
89
|
+
errorMessage = 'Die E-Mail Adresse darf mit einem @-Zeichen weder beginnen noch enden.'
|
|
90
|
+
} else if (!Value.includes('@') && e.key != '@') {
|
|
91
|
+
errorMessage = '@-Zeichen muss enthalten sein.'
|
|
92
|
+
} else if (Value.length > 253) {
|
|
93
|
+
errorMessage = 'Maximallänge: 254 Zeichen.';
|
|
94
|
+
} else if (Value.length < 6) {
|
|
95
|
+
errorMessage = 'Mindestlänge: 6 Zeichen.';
|
|
96
|
+
} else {
|
|
146
97
|
errorHidden = true;
|
|
147
|
-
errorMessage =
|
|
98
|
+
errorMessage = ''; // einfach für die Sauberkeit
|
|
148
99
|
}
|
|
149
100
|
}
|
|
150
|
-
function executeAdditionalFunctions(e)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
case "Enter":
|
|
155
|
-
if(typeof(KeyDownFunctionOnEnter) != 'undefined')
|
|
156
|
-
{
|
|
101
|
+
function executeAdditionalFunctions(e) {
|
|
102
|
+
switch (e.key) {
|
|
103
|
+
case 'Enter':
|
|
104
|
+
if (typeof(KeyDownFunctionOnEnter) != 'undefined') {
|
|
157
105
|
KeyDownFunctionOnEnter();
|
|
158
106
|
}
|
|
159
107
|
break;
|
|
160
|
-
case
|
|
161
|
-
if(typeof(KeyDownFunctionOnTab) != 'undefined')
|
|
162
|
-
{
|
|
108
|
+
case 'Tab':
|
|
109
|
+
if (typeof(KeyDownFunctionOnTab) != 'undefined') {
|
|
163
110
|
KeyDownFunctionOnTab();
|
|
164
111
|
}
|
|
165
112
|
break;
|
|
166
113
|
}
|
|
167
114
|
}
|
|
168
|
-
function ignoreInput(e)
|
|
169
|
-
{
|
|
115
|
+
function ignoreInput(e) {
|
|
170
116
|
e.preventDefault();
|
|
171
117
|
e.returnValue = false;
|
|
172
118
|
}
|
|
173
|
-
function isBetweenMinMax(e)
|
|
174
|
-
{
|
|
119
|
+
function isBetweenMinMax(e) {
|
|
175
120
|
let isBetween = true;
|
|
176
121
|
let localValueString = Value.toLocaleString()
|
|
177
122
|
|
|
178
|
-
if(e.key == allowedVorzeichen)
|
|
179
|
-
{
|
|
123
|
+
if (e.key == allowedVorzeichen) {
|
|
180
124
|
localValueString = e.key + localValueString;
|
|
181
|
-
}
|
|
182
|
-
else
|
|
183
|
-
{
|
|
125
|
+
} else {
|
|
184
126
|
localValueString = localValueString + e.key;
|
|
185
127
|
}
|
|
186
128
|
|
|
187
129
|
// Replace wird benötigt, da sonst der Vergleich das deutsche "," als Dezimaltrenner nicht erkennt und ignoriert.
|
|
188
|
-
localValueString = localValueString.replaceAll(
|
|
130
|
+
localValueString = localValueString.replaceAll(',', '.');
|
|
189
131
|
|
|
190
|
-
if(MinValue == MaxValue || MinValue > MaxValue)
|
|
191
|
-
{
|
|
132
|
+
if (MinValue == MaxValue || MinValue > MaxValue) {
|
|
192
133
|
return isBetween;
|
|
193
|
-
}
|
|
194
|
-
else if(localValueString < MinValue)
|
|
195
|
-
{
|
|
134
|
+
} if (localValueString < MinValue) {
|
|
196
135
|
Value = MinValue;
|
|
197
136
|
isBetween = false;
|
|
198
|
-
}
|
|
199
|
-
else if(localValueString > MaxValue)
|
|
200
|
-
{
|
|
137
|
+
} else if (localValueString > MaxValue) {
|
|
201
138
|
Value = MaxValue;
|
|
202
139
|
isBetween = false;
|
|
203
140
|
}
|
|
204
141
|
return isBetween;
|
|
205
142
|
}
|
|
206
|
-
function thisKeyUp(
|
|
207
|
-
{
|
|
143
|
+
function thisKeyUp() {
|
|
208
144
|
setFieldStyle();
|
|
209
145
|
}
|
|
210
|
-
function setFieldStyle()
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if(IsPflichtfeld && Value
|
|
214
|
-
|
|
215
|
-
style = style + " background: #f5fc99;"
|
|
216
|
-
}
|
|
217
|
-
else if(IsPflichtfeld && Value == "")
|
|
218
|
-
{
|
|
219
|
-
style = style + " background: #fc5d5d;"
|
|
146
|
+
function setFieldStyle() {
|
|
147
|
+
if (IsPflichtfeld && Value != '') {
|
|
148
|
+
style = `${style} background: #f5fc99;`
|
|
149
|
+
} else if (IsPflichtfeld && Value == '') {
|
|
150
|
+
style = `${style} background: #fc5d5d;`
|
|
220
151
|
}
|
|
221
152
|
}
|
|
222
153
|
|
|
223
|
-
$:if(
|
|
224
|
-
{
|
|
225
|
-
// Dezimaltrenner und Tausendertrenner müssen für das US-Amerikanische Format getauscht werden
|
|
226
|
-
if(DecimalTrenner == allowedDecimalTrenner[1])
|
|
227
|
-
{
|
|
228
|
-
tausenderTrenner = allowedDecimalTrenner[0];
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
$:if(Type)
|
|
232
|
-
{
|
|
154
|
+
$:if (Type) {
|
|
233
155
|
Type = Type.toLocaleLowerCase();
|
|
234
|
-
switch(Type)
|
|
235
|
-
|
|
236
|
-
case
|
|
237
|
-
|
|
238
|
-
style = style + " text-align: right;"
|
|
156
|
+
switch (Type) {
|
|
157
|
+
case 'currency':
|
|
158
|
+
case 'number':
|
|
159
|
+
style = `${style} text-align: right;`
|
|
239
160
|
break;
|
|
240
161
|
}
|
|
241
162
|
}
|
|
242
|
-
$:if(IsPflichtfeld)
|
|
243
|
-
{
|
|
163
|
+
$:if (IsPflichtfeld) {
|
|
244
164
|
setFieldStyle();
|
|
245
165
|
}
|
|
246
166
|
</script>
|
|
247
167
|
|
|
248
168
|
<!-- Datum -->
|
|
249
169
|
{#if (Type == 'date')}
|
|
250
|
-
<input type="date" style={style} on:keydown={checkInput} on:keyup={thisKeyUp} on bind:value={Value}/>
|
|
170
|
+
<input type="date" style={style} on:keydown={checkInput} on:keyup={thisKeyUp} on bind:value={Value}/>
|
|
251
171
|
{/if}
|
|
252
172
|
|
|
253
173
|
<!-- Nummerisch -->
|
|
254
174
|
{#if (Type == 'number')}
|
|
255
|
-
<input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
|
|
175
|
+
<input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
|
|
256
176
|
{/if}
|
|
257
177
|
|
|
258
178
|
<!-- Text -->
|
|
259
179
|
{#if (Type == 'text' && !Multiline) || (Type == 'email')}
|
|
260
|
-
<input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
|
|
180
|
+
<input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
|
|
261
181
|
{/if}
|
|
262
182
|
{#if (Type == 'text' && Multiline)}
|
|
263
|
-
<textarea style={style} on:keydown={checkInput} bind:value={Value}/>
|
|
183
|
+
<textarea style={style} on:keydown={checkInput} bind:value={Value}/>
|
|
264
184
|
{/if}
|
|
265
185
|
|
|
266
186
|
<!-- Währung -->
|
|
267
187
|
{#if (Type == 'currency')}
|
|
268
|
-
<input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
|
|
188
|
+
<input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
|
|
269
189
|
{/if}
|
|
270
190
|
|
|
271
191
|
<div class="card" hidden={errorHidden} style={styleError}>
|
|
272
192
|
{errorMessage}
|
|
273
|
-
</div>
|
|
193
|
+
</div>
|
package/index.js
CHANGED
|
@@ -9,10 +9,10 @@ import SaveButton from './components/SaveButton.svelte';
|
|
|
9
9
|
|
|
10
10
|
export {
|
|
11
11
|
DataGrid, Datepicker, Inputbox, Dialog, GanTable,
|
|
12
|
-
AddButton, RemoveButton, SaveButton
|
|
12
|
+
AddButton, RemoveButton, SaveButton,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
import { IDAS } from './api/IDAS';
|
|
16
16
|
import { RESTClient } from './api/RESTClient';
|
|
17
17
|
|
|
18
|
-
export { IDAS, RESTClient };
|
|
18
|
+
export { IDAS, RESTClient };
|
package/jsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
/**
|
|
5
|
+
* Typecheck JS in `.svelte` and `.js` files by default.
|
|
6
|
+
* Disable this if you'd like to use dynamic types.
|
|
7
|
+
*/
|
|
8
|
+
"checkJs": false, // Default: true
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
/**
|
|
14
|
+
* To have warnings / errors of the Svelte compiler at the
|
|
15
|
+
* correct position, enable source maps by default.
|
|
16
|
+
*/
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"strict": true
|
|
19
|
+
}
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gandalan/weblibs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "WebLibs for Gandalan JS/TS/Svelte projects",
|
|
5
5
|
"author": "Philipp Reif",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"main": "index",
|
|
8
8
|
"typings": "index",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"check": "svelte-check",
|
|
11
|
+
"check:watch": "svelte-check --watch",
|
|
12
|
+
"lint": "eslint ."
|
|
13
|
+
},
|
|
9
14
|
"devDependencies": {
|
|
15
|
+
"@babel/eslint-parser": "^7.18.9",
|
|
10
16
|
"chota": "^0.8.0",
|
|
17
|
+
"eslint": "^8.21.0",
|
|
18
|
+
"eslint-plugin-svelte3": "^4.0.0",
|
|
11
19
|
"svelte": "^3.49.0",
|
|
20
|
+
"svelte-check": "^2.8.0",
|
|
12
21
|
"svelte-chota": "^1.8.6"
|
|
13
22
|
},
|
|
14
23
|
"dependencies": {
|