@gandalan/weblibs 0.0.28 → 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 +63 -104
- package/components/Dialog.svelte +2 -2
- package/components/GanTable.svelte +26 -26
- package/components/Inputbox.svelte +86 -157
- package/index.js +2 -2
- package/package.json +6 -2
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,14 +1,14 @@
|
|
|
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 = [
|
|
11
|
-
let tageKurz = [
|
|
7
|
+
const backgroundNormal = '#FFFFFF';
|
|
8
|
+
const backgroundFalschesDatum = '#FF0000';
|
|
9
|
+
|
|
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
12
|
|
|
13
13
|
let buttonStyle, divStyle, inputStyle;
|
|
14
14
|
let background = backgroundNormal;
|
|
@@ -19,197 +19,156 @@
|
|
|
19
19
|
let inputHeight = Height - 2;
|
|
20
20
|
let inputWidth = Width - Height - 10;
|
|
21
21
|
|
|
22
|
-
let allowedNumbers = [
|
|
22
|
+
let allowedNumbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
|
|
23
23
|
let allowedTage = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
24
|
-
let allowedSonderzeichen =
|
|
25
|
-
let allowedFunctionalKeys = [
|
|
24
|
+
let allowedSonderzeichen = '.';
|
|
25
|
+
let allowedFunctionalKeys = ['ArrowLeft', 'ArrowRight', 'Backspace', 'Delete'];
|
|
26
26
|
let currentJahr = new Date().getFullYear();
|
|
27
27
|
let currentMonat = monate[new Date().getMonth()];
|
|
28
28
|
let wochenImMonat = [];
|
|
29
29
|
let monatIndex = 0;
|
|
30
30
|
|
|
31
|
-
function alertFalschesDatum()
|
|
32
|
-
{
|
|
31
|
+
function alertFalschesDatum() {
|
|
33
32
|
background = backgroundFalschesDatum;
|
|
34
33
|
errorHidden = false;
|
|
35
34
|
setFieldStyle();
|
|
36
35
|
}
|
|
37
|
-
function backToNormal()
|
|
38
|
-
{
|
|
36
|
+
function backToNormal() {
|
|
39
37
|
background = backgroundNormal;
|
|
40
38
|
errorHidden = true;
|
|
41
39
|
setFieldStyle();
|
|
42
40
|
}
|
|
43
|
-
function checkGueltigesDatum()
|
|
44
|
-
{
|
|
41
|
+
function checkGueltigesDatum() {
|
|
45
42
|
let error = false;
|
|
46
43
|
let inhalt = Value.split(allowedSonderzeichen);
|
|
47
44
|
let localTag = inhalt[0];
|
|
48
45
|
let localMonat = inhalt[1];
|
|
49
46
|
|
|
50
|
-
if(inhalt.length == 1 && Value.length == 2)
|
|
51
|
-
{
|
|
47
|
+
if (inhalt.length == 1 && Value.length == 2) {
|
|
52
48
|
Value = Value + allowedSonderzeichen;
|
|
53
49
|
}
|
|
54
|
-
if(inhalt.length == 2 && localMonat.toLocaleString().length >= 2)
|
|
55
|
-
{
|
|
50
|
+
if (inhalt.length == 2 && localMonat.toLocaleString().length >= 2) {
|
|
56
51
|
Value = Value + allowedSonderzeichen;
|
|
57
52
|
}
|
|
58
53
|
|
|
59
54
|
// Prüfung, ob der Monat korrekt eingegeben wurde
|
|
60
|
-
if(localMonat !=
|
|
61
|
-
{
|
|
55
|
+
if (localMonat != 'undefined' && (localMonat < 1 || localMonat > 12)) {
|
|
62
56
|
error = true;
|
|
63
|
-
}
|
|
64
|
-
else
|
|
65
|
-
{
|
|
57
|
+
} else {
|
|
66
58
|
error = false;
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
// Prüfung, ob der Tag korrekt eingegeben wurde
|
|
70
|
-
if(localTag < 1 || localTag > 31)
|
|
71
|
-
{
|
|
62
|
+
if (localTag < 1 || localTag > 31) {
|
|
72
63
|
error = true;
|
|
73
64
|
}
|
|
74
65
|
|
|
75
|
-
if(localMonat !=
|
|
76
|
-
{
|
|
66
|
+
if (localMonat != 'undefined') {
|
|
77
67
|
let localAllowedTage = allowedTage[inhalt[1]];
|
|
78
|
-
if(localAllowedTage ==
|
|
79
|
-
{
|
|
68
|
+
if (localAllowedTage == 'undefined') {
|
|
80
69
|
error = true;
|
|
81
70
|
}
|
|
82
|
-
if(localTag > localAllowedTage)
|
|
83
|
-
{
|
|
71
|
+
if (localTag > localAllowedTage) {
|
|
84
72
|
error = true;
|
|
85
73
|
}
|
|
86
74
|
}
|
|
87
75
|
|
|
88
|
-
if(error)
|
|
89
|
-
{
|
|
76
|
+
if (error) {
|
|
90
77
|
alertFalschesDatum();
|
|
91
|
-
}
|
|
92
|
-
else
|
|
93
|
-
{
|
|
78
|
+
} else {
|
|
94
79
|
backToNormal();
|
|
95
80
|
}
|
|
96
81
|
}
|
|
97
|
-
function daysInMonth()
|
|
98
|
-
{
|
|
82
|
+
function daysInMonth() {
|
|
99
83
|
wochenImMonat = [];
|
|
100
84
|
monatIndex = monate.findIndex(item => item == currentMonat) + 1;
|
|
101
85
|
let tageImMonat = new Date(currentJahr, monatIndex, 0).getDate();
|
|
102
86
|
let localTagIndex = 0;
|
|
103
87
|
let woche = [];
|
|
104
88
|
|
|
105
|
-
for(let counter = 0; counter < tageImMonat; counter++)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
// 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
|
|
111
93
|
// am passenden Wochentag startet => das macht es in der Anzeigeschleife leichter
|
|
112
|
-
for(let bufferCounter = 0; bufferCounter < localTagIndex; bufferCounter++)
|
|
113
|
-
{
|
|
94
|
+
for (let bufferCounter = 0; bufferCounter < localTagIndex; bufferCounter++) {
|
|
114
95
|
woche = [...woche, ''];
|
|
115
96
|
}
|
|
116
97
|
}
|
|
117
|
-
woche = [...woche, counter+1];
|
|
98
|
+
woche = [...woche, counter + 1];
|
|
118
99
|
|
|
119
|
-
if(woche.length >= 7)
|
|
120
|
-
{
|
|
100
|
+
if (woche.length >= 7) {
|
|
121
101
|
wochenImMonat = [...wochenImMonat, woche]
|
|
122
102
|
woche = [];
|
|
123
103
|
}
|
|
124
|
-
if(counter == tageImMonat-1)
|
|
125
|
-
{
|
|
104
|
+
if (counter == tageImMonat - 1) {
|
|
126
105
|
wochenImMonat = [...wochenImMonat, woche]
|
|
127
106
|
woche = [];
|
|
128
107
|
}
|
|
129
108
|
}
|
|
130
109
|
}
|
|
131
|
-
function ignoreInput(e)
|
|
132
|
-
{
|
|
110
|
+
function ignoreInput(e) {
|
|
133
111
|
e.preventDefault();
|
|
134
112
|
e.returnValue = false;
|
|
135
113
|
}
|
|
136
|
-
function setFieldStyle()
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
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;`;
|
|
141
118
|
}
|
|
142
|
-
function setJahr(selectedJahr)
|
|
143
|
-
{
|
|
119
|
+
function setJahr(selectedJahr) {
|
|
144
120
|
currentJahr = selectedJahr.currentJahr;
|
|
145
121
|
daysInMonth();
|
|
146
122
|
}
|
|
147
|
-
function setMonat(selectedMonat)
|
|
148
|
-
{
|
|
123
|
+
function setMonat(selectedMonat) {
|
|
149
124
|
currentMonat = selectedMonat.currentMonat;
|
|
150
125
|
daysInMonth();
|
|
151
126
|
}
|
|
152
|
-
function setPlaceholder(tag)
|
|
153
|
-
|
|
154
|
-
if(tag != "")
|
|
155
|
-
{
|
|
127
|
+
function setPlaceholder(tag) {
|
|
128
|
+
if (tag != '') {
|
|
156
129
|
//Placeholder = getFormattedDate(tag);
|
|
157
130
|
}
|
|
158
131
|
}
|
|
159
|
-
function setValue(tag)
|
|
160
|
-
|
|
161
|
-
Value = new Date(currentJahr+"-"+currentMonat+"-"+tag);
|
|
132
|
+
function setValue(tag) {
|
|
133
|
+
Value = new Date(`${currentJahr}-${currentMonat}-${tag}`);
|
|
162
134
|
datePickerHidden = true;
|
|
163
135
|
backToNormal();
|
|
164
136
|
}
|
|
165
|
-
function thisKeyDown(e)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
if(Value.length >= 10)
|
|
170
|
-
{
|
|
137
|
+
function thisKeyDown(e) {
|
|
138
|
+
if (allowedNumbers.includes(e.key) == true) {
|
|
139
|
+
if (Value.length >= 10) {
|
|
171
140
|
ignoreInput(e);
|
|
172
141
|
}
|
|
173
142
|
checkGueltigesDatum();
|
|
174
|
-
}
|
|
175
|
-
else if (e.key == allowedSonderzeichen)
|
|
176
|
-
{
|
|
143
|
+
} else if (e.key == allowedSonderzeichen) {
|
|
177
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.
|
|
178
|
-
if(Value.split(allowedSonderzeichen).length >= 3)
|
|
179
|
-
{
|
|
145
|
+
if (Value.split(allowedSonderzeichen).length >= 3) {
|
|
180
146
|
ignoreInput(e);
|
|
181
147
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
{
|
|
148
|
+
} else if (allowedFunctionalKeys.includes(e.key) == true) {
|
|
149
|
+
return;
|
|
150
|
+
} else {
|
|
186
151
|
ignoreInput(e);
|
|
187
152
|
}
|
|
188
153
|
}
|
|
189
|
-
function getValueFormatted(oldValue)
|
|
190
|
-
{
|
|
154
|
+
function getValueFormatted(oldValue) {
|
|
191
155
|
let localTag = (new Date(oldValue).getUTCDate()).toString();
|
|
192
|
-
let localMonat = (new Date(oldValue).getMonth()+1).toString();
|
|
156
|
+
let localMonat = (new Date(oldValue).getMonth() + 1).toString();
|
|
193
157
|
let localJahr = new Date(oldValue).getUTCFullYear().toString();
|
|
194
158
|
|
|
195
|
-
if(localMonat.length < 2)
|
|
196
|
-
|
|
197
|
-
localMonat = "0" + localMonat;
|
|
159
|
+
if (localMonat.length < 2) {
|
|
160
|
+
localMonat = `0${localMonat}`;
|
|
198
161
|
}
|
|
199
|
-
if(localTag.length < 2)
|
|
200
|
-
|
|
201
|
-
localTag = "0" + localTag;
|
|
162
|
+
if (localTag.length < 2) {
|
|
163
|
+
localTag = `0${localTag}`;
|
|
202
164
|
}
|
|
203
|
-
return localTag
|
|
165
|
+
return `${localTag }.${localMonat}.${localJahr}`;
|
|
204
166
|
}
|
|
205
167
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
$:if(Value)
|
|
212
|
-
{
|
|
168
|
+
setFieldStyle();
|
|
169
|
+
daysInMonth(currentMonat, currentJahr);
|
|
170
|
+
|
|
171
|
+
$:if (Value) {
|
|
213
172
|
Value = getValueFormatted(Value);
|
|
214
173
|
}
|
|
215
174
|
</script>
|
|
@@ -289,4 +248,4 @@
|
|
|
289
248
|
background-color:cornflowerblue;
|
|
290
249
|
color: white;
|
|
291
250
|
}
|
|
292
|
-
</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)[]} */
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
export let clickCell = null;
|
|
33
33
|
|
|
34
34
|
// CSS Classes
|
|
35
|
-
export let classNameTable =
|
|
36
|
-
export let classNameThead =
|
|
37
|
-
export let classNameTbody =
|
|
38
|
-
export let classNameSelect =
|
|
39
|
-
export let classNameInput =
|
|
40
|
-
export let classNameRow =
|
|
41
|
-
export let classNameCell =
|
|
42
|
-
export let classNameRowSelected =
|
|
43
|
-
export let classNameRowExpanded =
|
|
44
|
-
export let classNameExpandedContent =
|
|
45
|
-
export let classNameCellExpand =
|
|
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
46
|
|
|
47
47
|
const asStringArray = v =>
|
|
48
48
|
[]
|
|
49
49
|
.concat(v)
|
|
50
|
-
.filter(v => v !== null && typeof v ===
|
|
51
|
-
.join(
|
|
50
|
+
.filter(v => v !== null && typeof v === 'string' && v !== '')
|
|
51
|
+
.join(' ');
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
<SvelteTable
|
|
@@ -66,17 +66,17 @@
|
|
|
66
66
|
on:clickRow={clickRow}
|
|
67
67
|
on:clickExpand={clickExpand}
|
|
68
68
|
on:clickCell={clickCell}
|
|
69
|
-
classNameTable={asStringArray([
|
|
70
|
-
classNameThead={asStringArray([
|
|
71
|
-
classNameTbody={asStringArray([
|
|
72
|
-
classNameSelect={asStringArray([
|
|
73
|
-
classNameInput={asStringArray([
|
|
74
|
-
classNameRow={asStringArray([
|
|
75
|
-
classNameCell={asStringArray([
|
|
76
|
-
classNameRowSelected={asStringArray([
|
|
77
|
-
classNameRowExpanded={asStringArray([
|
|
78
|
-
classNameExpandedContent={asStringArray([
|
|
79
|
-
classNameCellExpand={asStringArray([
|
|
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])}>
|
|
80
80
|
|
|
81
81
|
<!-- Wait for better workaround. See: https://github.com/sveltejs/svelte/issues/5604 -->
|
|
82
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,257 +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
|
-
let allowedNumbers = [
|
|
21
|
-
let allowedDecimalTrenner = [
|
|
22
|
-
let allowedFunctionalKeys = [
|
|
23
|
-
let allowedVorzeichen =
|
|
24
|
-
|
|
25
|
-
function checkInput(e)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
case "currency":
|
|
30
|
-
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':
|
|
31
29
|
checkInputNumber(e);
|
|
32
30
|
break;
|
|
33
31
|
|
|
34
|
-
case
|
|
32
|
+
case 'email':
|
|
35
33
|
checkInputEMail(e)
|
|
36
34
|
break;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
executeAdditionalFunctions(e);
|
|
40
38
|
}
|
|
41
|
-
function checkInputNumber(e)
|
|
42
|
-
{
|
|
39
|
+
function checkInputNumber(e) {
|
|
43
40
|
let localValueString = Value.toLocaleString();
|
|
44
|
-
|
|
41
|
+
|
|
45
42
|
// Prüfung auf Ziffern
|
|
46
|
-
if(allowedNumbers.includes(e.key) == true)
|
|
47
|
-
|
|
48
|
-
if(isBetweenMinMax(e))
|
|
49
|
-
{
|
|
43
|
+
if (allowedNumbers.includes(e.key) == true) {
|
|
44
|
+
if (isBetweenMinMax(e)) {
|
|
50
45
|
let positionDezimalTrenner = localValueString.indexOf(DecimalTrenner)
|
|
51
|
-
if(positionDezimalTrenner > -1)
|
|
52
|
-
{
|
|
46
|
+
if (positionDezimalTrenner > -1) {
|
|
53
47
|
let decimals = localValueString.substring(positionDezimalTrenner);
|
|
54
|
-
if(decimals.length > AllowedDecimals || (Type ==
|
|
55
|
-
{
|
|
48
|
+
if (decimals.length > AllowedDecimals || (Type == 'currency' && decimals.length > 2)) {
|
|
56
49
|
ignoreInput(e);
|
|
57
50
|
}
|
|
58
51
|
}
|
|
59
|
-
}
|
|
60
|
-
else
|
|
61
|
-
{
|
|
52
|
+
} else {
|
|
62
53
|
ignoreInput(e);
|
|
63
54
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Prüfung auf Dezimaltrenner
|
|
67
|
-
else if (allowedDecimalTrenner.includes(e.key) == true)
|
|
68
|
-
{
|
|
69
|
-
if(localValueString.split(DecimalTrenner).length >= 2)
|
|
70
|
-
{
|
|
55
|
+
} else if (allowedDecimalTrenner.includes(e.key) == true) { // Prüfung auf Dezimaltrenner
|
|
56
|
+
if (localValueString.split(DecimalTrenner).length >= 2) {
|
|
71
57
|
ignoreInput(e);
|
|
72
|
-
}
|
|
73
|
-
else if(e.key != DecimalTrenner)
|
|
74
|
-
{
|
|
58
|
+
} else if (e.key != DecimalTrenner) {
|
|
75
59
|
ignoreInput(e);
|
|
76
60
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Prüfung auf Vorzeichen
|
|
80
|
-
else if (IsVorzeichenErlaubt && e.key == allowedVorzeichen)
|
|
81
|
-
{
|
|
82
|
-
if(!isBetweenMinMax(e))
|
|
83
|
-
{
|
|
61
|
+
} else if (IsVorzeichenErlaubt && e.key == allowedVorzeichen) { // Prüfung auf Vorzeichen
|
|
62
|
+
if (!isBetweenMinMax(e)) {
|
|
84
63
|
ignoreInput(e);
|
|
85
|
-
}
|
|
86
|
-
else if(localValueString.startsWith(e.key))
|
|
87
|
-
{
|
|
64
|
+
} else if (localValueString.startsWith(e.key)) {
|
|
88
65
|
ignoreInput(e);
|
|
89
|
-
}
|
|
90
|
-
else
|
|
91
|
-
{
|
|
66
|
+
} else {
|
|
92
67
|
Value = e.key + Value;
|
|
93
68
|
ignoreInput(e);
|
|
94
69
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
else if (allowedFunctionalKeys.includes(e.key) == true) { }
|
|
99
|
-
|
|
100
|
-
// Alles andere soll nicht erlaubt sein
|
|
101
|
-
else
|
|
102
|
-
{
|
|
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
|
|
103
73
|
ignoreInput(e);
|
|
104
74
|
}
|
|
105
75
|
}
|
|
106
|
-
function checkInputEMail(e)
|
|
107
|
-
|
|
108
|
-
let mailParts = Value.split("@");
|
|
76
|
+
function checkInputEMail(e) {
|
|
77
|
+
let mailParts = Value.split('@');
|
|
109
78
|
errorHidden = false; // Pauschal einen Fehler anzeigen lassen - spart Codezeilen
|
|
110
79
|
|
|
111
|
-
if(mailParts[0].length > 64)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
else if(mailParts.length > 1 && mailParts[
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
else if(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
else if(Value.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
else
|
|
128
|
-
{
|
|
129
|
-
errorMessage = "Die E-Mail Adresse darf mit einem @-Zeichen weder beginnen noch enden."
|
|
130
|
-
}
|
|
131
|
-
else if(!Value.includes("@") && e.key != "@")
|
|
132
|
-
{
|
|
133
|
-
errorMessage = "@-Zeichen muss enthalten sein."
|
|
134
|
-
}
|
|
135
|
-
else if(Value.length > 253)
|
|
136
|
-
{
|
|
137
|
-
errorMessage = "Maximallänge: 254 Zeichen.";
|
|
138
|
-
}
|
|
139
|
-
else if(Value.length < 6)
|
|
140
|
-
{
|
|
141
|
-
errorMessage = "Mindestlänge: 6 Zeichen.";
|
|
142
|
-
}
|
|
143
|
-
else
|
|
144
|
-
{
|
|
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 {
|
|
145
97
|
errorHidden = true;
|
|
146
|
-
errorMessage =
|
|
98
|
+
errorMessage = ''; // einfach für die Sauberkeit
|
|
147
99
|
}
|
|
148
100
|
}
|
|
149
|
-
function executeAdditionalFunctions(e)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
case "Enter":
|
|
154
|
-
if(typeof(KeyDownFunctionOnEnter) != 'undefined')
|
|
155
|
-
{
|
|
101
|
+
function executeAdditionalFunctions(e) {
|
|
102
|
+
switch (e.key) {
|
|
103
|
+
case 'Enter':
|
|
104
|
+
if (typeof(KeyDownFunctionOnEnter) != 'undefined') {
|
|
156
105
|
KeyDownFunctionOnEnter();
|
|
157
106
|
}
|
|
158
107
|
break;
|
|
159
|
-
case
|
|
160
|
-
if(typeof(KeyDownFunctionOnTab) != 'undefined')
|
|
161
|
-
{
|
|
108
|
+
case 'Tab':
|
|
109
|
+
if (typeof(KeyDownFunctionOnTab) != 'undefined') {
|
|
162
110
|
KeyDownFunctionOnTab();
|
|
163
111
|
}
|
|
164
112
|
break;
|
|
165
113
|
}
|
|
166
114
|
}
|
|
167
|
-
function ignoreInput(e)
|
|
168
|
-
{
|
|
115
|
+
function ignoreInput(e) {
|
|
169
116
|
e.preventDefault();
|
|
170
117
|
e.returnValue = false;
|
|
171
118
|
}
|
|
172
|
-
function isBetweenMinMax(e)
|
|
173
|
-
{
|
|
119
|
+
function isBetweenMinMax(e) {
|
|
174
120
|
let isBetween = true;
|
|
175
121
|
let localValueString = Value.toLocaleString()
|
|
176
122
|
|
|
177
|
-
if(e.key == allowedVorzeichen)
|
|
178
|
-
{
|
|
123
|
+
if (e.key == allowedVorzeichen) {
|
|
179
124
|
localValueString = e.key + localValueString;
|
|
180
|
-
}
|
|
181
|
-
else
|
|
182
|
-
{
|
|
125
|
+
} else {
|
|
183
126
|
localValueString = localValueString + e.key;
|
|
184
127
|
}
|
|
185
128
|
|
|
186
129
|
// Replace wird benötigt, da sonst der Vergleich das deutsche "," als Dezimaltrenner nicht erkennt und ignoriert.
|
|
187
|
-
localValueString = localValueString.replaceAll(
|
|
130
|
+
localValueString = localValueString.replaceAll(',', '.');
|
|
188
131
|
|
|
189
|
-
if(MinValue == MaxValue || MinValue > MaxValue)
|
|
190
|
-
{
|
|
132
|
+
if (MinValue == MaxValue || MinValue > MaxValue) {
|
|
191
133
|
return isBetween;
|
|
192
|
-
}
|
|
193
|
-
else if(localValueString < MinValue)
|
|
194
|
-
{
|
|
134
|
+
} if (localValueString < MinValue) {
|
|
195
135
|
Value = MinValue;
|
|
196
136
|
isBetween = false;
|
|
197
|
-
}
|
|
198
|
-
else if(localValueString > MaxValue)
|
|
199
|
-
{
|
|
137
|
+
} else if (localValueString > MaxValue) {
|
|
200
138
|
Value = MaxValue;
|
|
201
139
|
isBetween = false;
|
|
202
140
|
}
|
|
203
141
|
return isBetween;
|
|
204
142
|
}
|
|
205
|
-
function thisKeyUp()
|
|
206
|
-
{
|
|
143
|
+
function thisKeyUp() {
|
|
207
144
|
setFieldStyle();
|
|
208
145
|
}
|
|
209
|
-
function setFieldStyle()
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if(IsPflichtfeld && Value
|
|
213
|
-
|
|
214
|
-
style = style + " background: #f5fc99;"
|
|
215
|
-
}
|
|
216
|
-
else if(IsPflichtfeld && Value == "")
|
|
217
|
-
{
|
|
218
|
-
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;`
|
|
219
151
|
}
|
|
220
152
|
}
|
|
221
153
|
|
|
222
|
-
$:if(Type)
|
|
223
|
-
{
|
|
154
|
+
$:if (Type) {
|
|
224
155
|
Type = Type.toLocaleLowerCase();
|
|
225
|
-
switch(Type)
|
|
226
|
-
|
|
227
|
-
case
|
|
228
|
-
|
|
229
|
-
style = style + " text-align: right;"
|
|
156
|
+
switch (Type) {
|
|
157
|
+
case 'currency':
|
|
158
|
+
case 'number':
|
|
159
|
+
style = `${style} text-align: right;`
|
|
230
160
|
break;
|
|
231
161
|
}
|
|
232
162
|
}
|
|
233
|
-
$:if(IsPflichtfeld)
|
|
234
|
-
{
|
|
163
|
+
$:if (IsPflichtfeld) {
|
|
235
164
|
setFieldStyle();
|
|
236
165
|
}
|
|
237
166
|
</script>
|
|
238
167
|
|
|
239
168
|
<!-- Datum -->
|
|
240
169
|
{#if (Type == 'date')}
|
|
241
|
-
<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}/>
|
|
242
171
|
{/if}
|
|
243
172
|
|
|
244
173
|
<!-- Nummerisch -->
|
|
245
174
|
{#if (Type == 'number')}
|
|
246
|
-
<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}/>
|
|
247
176
|
{/if}
|
|
248
177
|
|
|
249
178
|
<!-- Text -->
|
|
250
179
|
{#if (Type == 'text' && !Multiline) || (Type == 'email')}
|
|
251
|
-
<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}/>
|
|
252
181
|
{/if}
|
|
253
182
|
{#if (Type == 'text' && Multiline)}
|
|
254
|
-
<textarea style={style} on:keydown={checkInput} bind:value={Value}/>
|
|
183
|
+
<textarea style={style} on:keydown={checkInput} bind:value={Value}/>
|
|
255
184
|
{/if}
|
|
256
185
|
|
|
257
186
|
<!-- Währung -->
|
|
258
187
|
{#if (Type == 'currency')}
|
|
259
|
-
<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}/>
|
|
260
189
|
{/if}
|
|
261
190
|
|
|
262
191
|
<div class="card" hidden={errorHidden} style={styleError}>
|
|
263
192
|
{errorMessage}
|
|
264
|
-
</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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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",
|
|
@@ -8,10 +8,14 @@
|
|
|
8
8
|
"typings": "index",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"check": "svelte-check",
|
|
11
|
-
"check:watch": "svelte-check --watch"
|
|
11
|
+
"check:watch": "svelte-check --watch",
|
|
12
|
+
"lint": "eslint ."
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
15
|
+
"@babel/eslint-parser": "^7.18.9",
|
|
14
16
|
"chota": "^0.8.0",
|
|
17
|
+
"eslint": "^8.21.0",
|
|
18
|
+
"eslint-plugin-svelte3": "^4.0.0",
|
|
15
19
|
"svelte": "^3.49.0",
|
|
16
20
|
"svelte-check": "^2.8.0",
|
|
17
21
|
"svelte-chota": "^1.8.6"
|