@gandalan/weblibs 1.1.78 → 1.1.80

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/index.js CHANGED
@@ -1,20 +1,7 @@
1
- import AddButton from "./components/AddButton.svelte";
2
- import DataGrid from "./components/DataGrid.svelte";
3
- import Dialog from "./components/Dialog.svelte";
4
- import GanTable from "./components/GanTable.svelte";
5
- import Datepicker from "./components/Datepicker.svelte";
6
- import Inputbox from "./components/Inputbox.svelte";
7
- import RemoveButton from "./components/RemoveButton.svelte";
8
- import SaveButton from "./components/SaveButton.svelte";
9
-
10
- export {
11
- DataGrid, Datepicker, Inputbox, Dialog, GanTable,
12
- AddButton, RemoveButton, SaveButton,
13
- }
14
-
15
- export { IDASFactory } from "./api/IDAS";
16
- export { RESTClient } from "./api/RESTClient";
17
- export { initIDAS } from "./api/authUtils";
1
+ import { IDASFactory } from "./api/IDAS";
2
+ import { RESTClient } from "./api/RESTClient";
3
+ import { initIDAS } from "./api/authUtils";
4
+ export { IDASFactory, RESTClient, initIDAS };
18
5
 
19
6
  export { createApi as api, idasApi, fetchEnv, getRefreshToken } from "./api/fluentApi";
20
7
  export { authBuilder } from "./api/fluentAuthBuilder";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.1.78",
3
+ "version": "1.1.80",
4
4
  "description": "WebLibs for Gandalan JS/TS/Svelte projects",
5
5
  "keywords": [
6
6
  "gandalan"
@@ -24,20 +24,14 @@
24
24
  "@mdi/js": "^7.4.47",
25
25
  "axios": "^1.7.7",
26
26
  "jwt-decode": "^4.0.0",
27
- "svelte-table": "^0.6.3",
28
27
  "validator": "^13.12.0"
29
28
  },
30
29
  "devDependencies": {
31
30
  "@babel/eslint-parser": "^7.25.8",
32
- "chota": "^0.9.2",
33
31
  "eslint": "^8.57.1",
34
32
  "eslint-plugin-svelte": "^2.44.1",
35
33
  "svelte": "^4.2.19",
36
- "svelte-check": "^3.8.6",
37
- "svelte-chota": "^1.8.6"
38
- },
39
- "peerDependencies": {
40
- "svelte-chota": "^1.8.6"
34
+ "svelte-check": "^3.8.6"
41
35
  },
42
36
  "publishConfig": {
43
37
  "access": "public"
@@ -1,12 +0,0 @@
1
- <script>
2
- import { Button } from "svelte-chota";
3
- import { mdiMessageAlert } from "@mdi/js"
4
-
5
- export let Handler;
6
- export let disabled;
7
- export let title;
8
- </script>
9
-
10
- <Button primary outline title={title} on:click={Handler} icon={mdiMessageAlert} {disabled}>
11
- {title}
12
- </Button>
@@ -1,70 +0,0 @@
1
- <script>
2
- import { createEventDispatcher } from "svelte";
3
- import { Icon } from "svelte-chota";
4
- const dispatch = createEventDispatcher();
5
-
6
- export let items = [];
7
- export let selectedItem = {};
8
- export let standardItem;
9
- export let displayProperty = "";
10
- export let header = "Überschrift";
11
- export let key = "Guid";
12
- export let marker = null;
13
- export let markerField = "";
14
-
15
- function setCurrent(item)
16
- {
17
- selectedItem = item;
18
- dispatch("selectedItemChanged", item);
19
- }
20
- </script>
21
-
22
- <div class="datagrid">
23
- <div class="dgheader">
24
- {header}
25
- </div>
26
- <div>
27
- {#if standardItem}
28
- <div class="dgrow" on:click={setCurrent(standardItem)} on:keypress={e => e.key === "Enter" && setCurrent(standardItem)} role="row" tabindex="0" class:selected="{selectedItem[key] === standardItem[key]}">{standardItem[displayProperty]}</div>
29
- {/if}
30
- {#each items as d, i}
31
- <div class="dgrow" on:click={setCurrent(d)} on:keypress={e => e.key === "Enter" && setCurrent(d)} role="row" tabindex="{i + 1}" class:selected="{selectedItem[key] === d[key]}">
32
- {d[displayProperty]}
33
- {#if marker && markerField && d[markerField] === true}
34
- <Icon src={marker} />
35
- {/if}
36
- </div>
37
- {/each}
38
- </div>
39
- </div>
40
-
41
- <style>
42
- .datagrid {
43
- border: 1px solid var(--color-darkGrey);
44
- background-color: var(--color-grey);
45
- display: flex;
46
- flex-direction: column;
47
- justify-content: flex-start;
48
- align-content: flex-start;
49
- cursor: pointer;
50
- }
51
-
52
- .dgheader {
53
- background-color: var(--color-grey);
54
- padding: 4px 4px 4px 8px;
55
- flex: 1;
56
- }
57
-
58
- .dgrow {
59
- margin-left: 8px;
60
- border-bottom: 1px solid var(--color-darkGrey);
61
- background-color: #fff;
62
- padding: 4px;
63
- flex: 1;
64
- }
65
-
66
- .selected {
67
- background-color: var(--color-selected);
68
- color: var(--color-selected-text);
69
- }
70
- </style>
@@ -1,293 +0,0 @@
1
- <script>
2
- export let Height = 30;
3
- export let Placeholder = "";
4
- export let Value = "";
5
- export let Width = 120;
6
-
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
-
13
- let buttonStyle, divStyle, inputStyle;
14
- let background = backgroundNormal;
15
- let buttonHeight = Height - 6;
16
- let buttonImageHeight = Height - 10;
17
- let datePickerHidden = true;
18
- let errorHidden = true;
19
- let inputHeight = Height - 2;
20
- let inputWidth = Width - Height - 10;
21
-
22
- let allowedNumbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
23
- let allowedTage = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
24
- let allowedSonderzeichen = ".";
25
- let allowedFunctionalKeys = ["ArrowLeft", "ArrowRight", "Backspace", "Delete"];
26
- let currentJahr = new Date().getFullYear();
27
- let currentMonat = monate[new Date().getMonth()];
28
- let wochenImMonat = [];
29
- let monatIndex = 0;
30
-
31
- function alertFalschesDatum()
32
- {
33
- background = backgroundFalschesDatum;
34
- errorHidden = false;
35
- setFieldStyle();
36
- }
37
- function backToNormal()
38
- {
39
- background = backgroundNormal;
40
- errorHidden = true;
41
- setFieldStyle();
42
- }
43
- function checkGueltigesDatum()
44
- {
45
- let error = false;
46
- let inhalt = Value.split(allowedSonderzeichen);
47
- let localTag = inhalt[0];
48
- let localMonat = inhalt[1];
49
-
50
- if (inhalt.length === 1 && Value.length === 2)
51
- {
52
- Value = Value + allowedSonderzeichen;
53
- }
54
- if (inhalt.length === 2 && localMonat.toLocaleString().length >= 2)
55
- {
56
- Value = Value + allowedSonderzeichen;
57
- }
58
-
59
- // Prüfung, ob der Monat korrekt eingegeben wurde
60
- if (localMonat !== "undefined" && (localMonat < 1 || localMonat > 12))
61
- {
62
- error = true;
63
- }
64
- else
65
- {
66
- error = false;
67
- }
68
-
69
- // Prüfung, ob der Tag korrekt eingegeben wurde
70
- if (localTag < 1 || localTag > 31)
71
- {
72
- error = true;
73
- }
74
-
75
- if (localMonat !== "undefined")
76
- {
77
- let localAllowedTage = allowedTage[inhalt[1]];
78
- if (localAllowedTage === "undefined")
79
- {
80
- error = true;
81
- }
82
- if (localTag > localAllowedTage)
83
- {
84
- error = true;
85
- }
86
- }
87
-
88
- if (error)
89
- {
90
- alertFalschesDatum();
91
- }
92
- else
93
- {
94
- backToNormal();
95
- }
96
- }
97
- function daysInMonth()
98
- {
99
- wochenImMonat = [];
100
- monatIndex = monate.findIndex(item => item === currentMonat) + 1;
101
- let tageImMonat = new Date(currentJahr, monatIndex, 0).getDate();
102
- let localTagIndex = 0;
103
- let woche = [];
104
-
105
- for (let counter = 0; counter < tageImMonat; counter++)
106
- {
107
- localTagIndex = new Date(currentJahr, monatIndex - 1, counter).getDay();
108
- if (counter === 0)
109
- {
110
- // Am Anfang müssen erstmal x Leertage in die Woche eingefügt werden, damit der Monat
111
- // am passenden Wochentag startet => das macht es in der Anzeigeschleife leichter
112
- for (let bufferCounter = 0; bufferCounter < localTagIndex; bufferCounter++)
113
- {
114
- woche = [...woche, ""];
115
- }
116
- }
117
- woche = [...woche, counter + 1];
118
-
119
- if (woche.length >= 7)
120
- {
121
- wochenImMonat = [...wochenImMonat, woche]
122
- woche = [];
123
- }
124
- if (counter === tageImMonat - 1)
125
- {
126
- wochenImMonat = [...wochenImMonat, woche]
127
- woche = [];
128
- }
129
- }
130
- }
131
- function ignoreInput(e)
132
- {
133
- e.preventDefault();
134
- e.returnValue = false;
135
- }
136
- function setFieldStyle()
137
- {
138
- buttonStyle = `background: transparent; border: 0px; height: ${buttonHeight}px; margin-left: 10px; margin-right: 8px; margin-top: 0px; width: ${buttonHeight}px;`;
139
- divStyle = `background: white; border: 0.5px solid lightgray; border-radius: 5px; display: flex; height: ${Height}px; width: ${Width}px;`;
140
- inputStyle = `background: ${background}; border: 0px; height: ${inputHeight}px; width: ${inputWidth}px;`;
141
- }
142
- function setJahr(selectedJahr)
143
- {
144
- currentJahr = selectedJahr.currentJahr;
145
- daysInMonth();
146
- }
147
- function setMonat(selectedMonat)
148
- {
149
- currentMonat = selectedMonat.currentMonat;
150
- daysInMonth();
151
- }
152
- function setPlaceholder(tag)
153
- {
154
- if (tag !== "")
155
- {
156
- //Placeholder = getFormattedDate(tag);
157
- }
158
- }
159
- function setValue(tag)
160
- {
161
- Value = new Date(`${currentJahr}-${currentMonat}-${tag}`);
162
- datePickerHidden = true;
163
- backToNormal();
164
- }
165
- function thisKeyDown(e)
166
- {
167
- if (allowedNumbers.includes(e.key) === true)
168
- {
169
- if (Value.length >= 10)
170
- {
171
- ignoreInput(e);
172
- }
173
- checkGueltigesDatum();
174
- }
175
- else if (e.key === allowedSonderzeichen)
176
- {
177
- // 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
- {
180
- ignoreInput(e);
181
- }
182
- }
183
- else if (allowedFunctionalKeys.includes(e.key) === true)
184
- {
185
- return;
186
- }
187
- else
188
- {
189
- ignoreInput(e);
190
- }
191
- }
192
- function getValueFormatted(oldValue)
193
- {
194
- let localTag = (new Date(oldValue).getUTCDate()).toString();
195
- let localMonat = (new Date(oldValue).getMonth() + 1).toString();
196
- let localJahr = new Date(oldValue).getUTCFullYear().toString();
197
-
198
- if (localMonat.length < 2)
199
- {
200
- localMonat = `0${localMonat}`;
201
- }
202
- if (localTag.length < 2)
203
- {
204
- localTag = `0${localTag}`;
205
- }
206
- return `${localTag}.${localMonat}.${localJahr}`;
207
- }
208
-
209
- setFieldStyle();
210
- daysInMonth(currentMonat, currentJahr);
211
-
212
- $:if (Value)
213
- {
214
- Value = getValueFormatted(Value);
215
- }
216
- </script>
217
-
218
- <div style={divStyle}>
219
- <input type="text" style={inputStyle} placeholder={Placeholder} bind:value={Value} on:keydown={thisKeyDown}>
220
- <button style={buttonStyle} on:click={() => datePickerHidden = !datePickerHidden}>
221
- <img src="calendar.png" alt="" height={buttonImageHeight}>
222
- <!-- [...] -->
223
- </button>
224
-
225
- <div class="card" hidden={errorHidden} style="margin-top: 40px; position:absolute;">
226
- Ungültiges Datum
227
- </div>
228
- </div>
229
- <div class="card" hidden={datePickerHidden} style="background: white; border: 1px solid black; border-radius: 10px; margin-top: 5px; position:absolute;">
230
- <div style="margin: 10px;">
231
- <div style="display: flex;">
232
- <select class="buttonMonthSelected" bind:value={currentMonat} on:click={() => setMonat({currentMonat})}>
233
- {#each monate as monatAuswahl}
234
- <option class="buttonMonthSelector">{monatAuswahl}</option>
235
- {/each}
236
- </select>
237
- <input type="number" style="height: 40px; margin-left: 10px; width: 85px;" bind:value={currentJahr} on:click={() => setJahr({currentJahr})}>
238
- </div>
239
- <br>
240
- <table>
241
- <tr>
242
- {#each tageKurz as tag}
243
- <td><b>{tag}</b></td>
244
- {/each}
245
- </tr>
246
- {#each wochenImMonat as woche}
247
- <tr>
248
- {#each woche as tageInWoche}
249
- <td>
250
- <button class="buttonTag" on:mouseover={() => setPlaceholder(tageInWoche)} on:focus={() => setPlaceholder(tageInWoche)} on:click={() => setValue(tageInWoche)}>
251
- {tageInWoche}
252
- </button>
253
- </td>
254
- {/each}
255
- </tr>
256
- {/each}
257
- </table>
258
- </div>
259
- </div>
260
-
261
- <style>
262
- td, tr{
263
- margin: 0px;
264
- padding: 0px;
265
- }
266
- .buttonTag{
267
- background-color: transparent;
268
- border: 0px;
269
- height: 35px;
270
- text-align: center;
271
- width: 35px;
272
- }
273
- .buttonTag:hover{
274
- background-color:cornflowerblue;
275
- color: white;
276
- }
277
- .buttonMonthSelected{
278
- background-color: transparent;
279
- border-radius: 5px;
280
- text-align: left;
281
- width: 115px;
282
- }
283
- .buttonMonthSelector{
284
- background-color: transparent;
285
- border: 0px;
286
- text-align: left;
287
- width: 115px;
288
- }
289
- .buttonMonthSelector:hover{
290
- background-color:cornflowerblue;
291
- color: white;
292
- }
293
- </style>
@@ -1,20 +0,0 @@
1
- <script>
2
- export let isOpen = false;
3
- </script>
4
-
5
- {#if isOpen}
6
- <div class="z-10 absolute w-screen h-screen bg-black left-0 top-0 bg-opacity-50">
7
- </div>
8
-
9
- <div class="z-10 absolute left-[20vw] top-[10vw] w-[60vw] shadow-xl shadow-slate-700 bg-white p-8">
10
- <div>
11
- <h3 class="text-lg font-bold mb-2"><slot name="title"/></h3>
12
- </div>
13
- <div>
14
- <slot />
15
- </div>
16
- <div class="mt-8">
17
- <button class="float-right bg-gray-600 text-white p-4" on:click={() => isOpen = false}>Schließen</button>
18
- </div>
19
- </div>
20
- {/if}
@@ -1,114 +0,0 @@
1
- <script>
2
- import SvelteTable from "svelte-table";
3
-
4
- export let columns;
5
- /** @type {any[]} */
6
- export let rows;
7
- /** @type {string} */
8
- export let sortBy = "";
9
- /** @type {(string | number)[]} */
10
- export let expanded = [];
11
- /** @type {(string | number)[]} */
12
- export let selected = [];
13
- /** @type {string | null} */
14
- export let rowKey = null;
15
- /** @type {boolean} */
16
- export let expandSingle = false;
17
- /** @type {boolean} */
18
- export let selectSingle = false;
19
- /** @type {boolean} */
20
- export let selectOnClick = false;
21
- /** @type {boolean} */
22
- export let showExpandIcon = false;
23
-
24
- // Events
25
- /** @type {function | null} */
26
- export let clickCol = null;
27
- /** @type {function | null} */
28
- export let clickRow = null;
29
- /** @type {function | null} */
30
- export let clickExpand = null;
31
- /** @type {function | null} */
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
- .concat(v)
49
- .filter(v => v !== null && typeof v === "string" && v !== "")
50
- .join(" ");
51
- </script>
52
-
53
- <SvelteTable
54
- bind:columns
55
- bind:rows
56
- bind:sortBy
57
- bind:expanded
58
- bind:selected
59
- bind:rowKey
60
- bind:expandSingle
61
- bind:selectSingle
62
- bind:selectOnClick
63
- bind:showExpandIcon
64
- on:clickCol={clickCol}
65
- on:clickRow={clickRow}
66
- on:clickExpand={clickExpand}
67
- on:clickCell={clickCell}
68
- classNameTable={asStringArray(["gan-table", classNameTable])}
69
- classNameThead={asStringArray(["gan-thead", classNameThead])}
70
- classNameTbody={asStringArray(["gan-tbody", classNameTbody])}
71
- classNameSelect={asStringArray(["custom-select", classNameSelect])}
72
- classNameInput={asStringArray(["custom-input", classNameInput])}
73
- classNameRow={asStringArray(["gan-row", classNameRow])}
74
- classNameCell={asStringArray(["gan-cell", classNameCell])}
75
- classNameRowSelected={asStringArray(["row-selected", classNameRowSelected])}
76
- classNameRowExpanded={asStringArray(["row-expanded", classNameRowExpanded])}
77
- classNameExpandedContent={asStringArray(["expanded-content", classNameExpandedContent])}
78
- classNameCellExpand={asStringArray(["cell-expand", classNameCellExpand])}>
79
-
80
- <!-- Wait for better workaround. See: https://github.com/sveltejs/svelte/issues/5604 -->
81
-
82
- <!--<svelte:fragment slot="header" let:sortOrder let:sortBy>
83
- <slot name="header" {sortOrder} {sortBy}></slot>
84
- </svelte:fragment>
85
-
86
- {#if $$slots.row}
87
- <svelte:fragment slot="row" let:row let:n>
88
- <slot name="row" {row} {n}></slot>
89
- </svelte:fragment>
90
- {/if}-->
91
-
92
- <svelte:fragment slot="expanded" let:row let:n>
93
- <slot name="expanded" {row} {n} />
94
- </svelte:fragment>
95
-
96
- </SvelteTable>
97
-
98
- <style>
99
- :global(.custom-select) {
100
- font-weight: 400;
101
- color: #495057;
102
- vertical-align: middle;
103
- border: 1px solid #ced4da;
104
- border-radius: .25rem;
105
- }
106
-
107
- :global(.custom-input) {
108
- font-weight: 400;
109
- color: #495057;
110
- vertical-align: middle;
111
- border: 1px solid #ced4da;
112
- border-radius: .25rem;
113
- }
114
- </style>
@@ -1,258 +0,0 @@
1
- <script>
2
- export let AllowedDecimals = 2;
3
- export let DecimalTrenner = ",";
4
- export let KeyDownFunctionOnEnter, KeyDownFunctionOnTab;
5
- export let Height = 30;
6
- export let IsPflichtfeld = false;
7
- export let IsVorzeichenErlaubt = true;
8
- export let MinValue = 0;
9
- export let MaxValue = 0;
10
- export let Multiline = false;
11
- export let Type = "text";
12
- export let Value = "";
13
- export let Width = 120;
14
-
15
- let errorHidden = true;
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
- {
27
- switch (Type)
28
- {
29
- case "currency":
30
- case "number":
31
- checkInputNumber(e);
32
- break;
33
-
34
- case "email":
35
- checkInputEMail(e)
36
- break;
37
- }
38
-
39
- executeAdditionalFunctions(e);
40
- }
41
- function checkInputNumber(e)
42
- {
43
- let localValueString = Value.toLocaleString();
44
-
45
- // Prüfung auf Ziffern
46
- if (allowedNumbers.includes(e.key) === true)
47
- {
48
- if (isBetweenMinMax(e))
49
- {
50
- let positionDezimalTrenner = localValueString.indexOf(DecimalTrenner)
51
- if (positionDezimalTrenner > -1)
52
- {
53
- let decimals = localValueString.substring(positionDezimalTrenner);
54
- if (decimals.length > AllowedDecimals || (Type === "currency" && decimals.length > 2))
55
- {
56
- ignoreInput(e);
57
- }
58
- }
59
- }
60
- else
61
- {
62
- ignoreInput(e);
63
- }
64
- }
65
- else if (allowedDecimalTrenner.includes(e.key) === true)
66
- { // Prüfung auf Dezimaltrenner
67
- if (localValueString.split(DecimalTrenner).length >= 2)
68
- {
69
- ignoreInput(e);
70
- }
71
- else if (e.key !== DecimalTrenner)
72
- {
73
- ignoreInput(e);
74
- }
75
- }
76
- else if (IsVorzeichenErlaubt && e.key === allowedVorzeichen)
77
- { // Prüfung auf Vorzeichen
78
- if (!isBetweenMinMax(e))
79
- {
80
- ignoreInput(e);
81
- }
82
- else if (localValueString.startsWith(e.key))
83
- {
84
- ignoreInput(e);
85
- }
86
- else
87
- {
88
- Value = e.key + Value;
89
- ignoreInput(e);
90
- }
91
- }
92
- else if (allowedFunctionalKeys.includes(e.key) === true)
93
- { // Prüfung auf Funktionstasten wie [ENTF], [DEL], usw.
94
- return;
95
- }
96
- else
97
- { // Alles andere soll nicht erlaubt sein
98
- ignoreInput(e);
99
- }
100
- }
101
- function checkInputEMail(e)
102
- {
103
- let mailParts = Value.split("@");
104
- errorHidden = false; // Pauschal einen Fehler anzeigen lassen - spart Codezeilen
105
-
106
- if (mailParts[0].length > 64)
107
- {
108
- errorMessage = "Der Lokalteil der E-Mail Adresse (vor dem @-Zeichen) darf eine Maximallänge von 64 Zeichen nicht überschreiten."
109
- }
110
- else if (mailParts.length > 1 && mailParts[0].length < 1)
111
- {
112
- errorMessage = "Der Lokalteil der E-Mail Adresse (vor dem @-Zeichen) muss eine Mindestlänge von 1 Zeichen besitzen."
113
- }
114
- else if (mailParts.length > 1 && !mailParts[1].includes("."))
115
- {
116
- errorMessage = "Der Domainteil der E-Mail Adresse (nach dem @-Zeichen) muss einen Punkt (.) enthalten."
117
- }
118
- else if (Value.startsWith(".") || Value.endsWith("."))
119
- {
120
- errorMessage = "Die E-Mail Adresse darf mit einem Punkt weder beginnen noch enden."
121
- }
122
- else if (Value.startsWith("@") || Value.endsWith("@"))
123
- {
124
- errorMessage = "Die E-Mail Adresse darf mit einem @-Zeichen weder beginnen noch enden."
125
- }
126
- else if (!Value.includes("@") && e.key !== "@")
127
- {
128
- errorMessage = "@-Zeichen muss enthalten sein."
129
- }
130
- else if (Value.length > 253)
131
- {
132
- errorMessage = "Maximallänge: 254 Zeichen.";
133
- }
134
- else if (Value.length < 6)
135
- {
136
- errorMessage = "Mindestlänge: 6 Zeichen.";
137
- }
138
- else
139
- {
140
- errorHidden = true;
141
- errorMessage = ""; // einfach für die Sauberkeit
142
- }
143
- }
144
- function executeAdditionalFunctions(e)
145
- {
146
- switch (e.key)
147
- {
148
- case "Enter":
149
- if (typeof(KeyDownFunctionOnEnter) != "undefined")
150
- {
151
- KeyDownFunctionOnEnter();
152
- }
153
- break;
154
- case "Tab":
155
- if (typeof(KeyDownFunctionOnTab) != "undefined")
156
- {
157
- KeyDownFunctionOnTab();
158
- }
159
- break;
160
- }
161
- }
162
- function ignoreInput(e)
163
- {
164
- e.preventDefault();
165
- e.returnValue = false;
166
- }
167
- function isBetweenMinMax(e)
168
- {
169
- let isBetween = true;
170
- let localValueString = Value.toLocaleString()
171
-
172
- if (e.key === allowedVorzeichen)
173
- {
174
- localValueString = e.key + localValueString;
175
- }
176
- else
177
- {
178
- localValueString = localValueString + e.key;
179
- }
180
-
181
- // Replace wird benötigt, da sonst der Vergleich das deutsche "," als Dezimaltrenner nicht erkennt und ignoriert.
182
- localValueString = localValueString.replaceAll(",", ".");
183
-
184
- if (MinValue === MaxValue || MinValue > MaxValue)
185
- {
186
- return isBetween;
187
- }
188
- if (localValueString < MinValue)
189
- {
190
- Value = MinValue;
191
- isBetween = false;
192
- }
193
- else if (localValueString > MaxValue)
194
- {
195
- Value = MaxValue;
196
- isBetween = false;
197
- }
198
- return isBetween;
199
- }
200
- function thisKeyUp()
201
- {
202
- setFieldStyle();
203
- }
204
- function setFieldStyle()
205
- {
206
- if (IsPflichtfeld && Value !== "")
207
- {
208
- style = `${style} background: #f5fc99;`
209
- }
210
- else if (IsPflichtfeld && Value === "")
211
- {
212
- style = `${style} background: #fc5d5d;`
213
- }
214
- }
215
-
216
- $:if (Type)
217
- {
218
- Type = Type.toLocaleLowerCase();
219
- switch (Type)
220
- {
221
- case "currency":
222
- case "number":
223
- style = `${style} text-align: right;`
224
- break;
225
- }
226
- }
227
- $:if (IsPflichtfeld)
228
- {
229
- setFieldStyle();
230
- }
231
- </script>
232
-
233
- <!-- Datum -->
234
- {#if (Type === "date")}
235
- <input type="date" style={style} on:keydown={checkInput} on:keyup={thisKeyUp} on bind:value={Value}/>
236
- {/if}
237
-
238
- <!-- Nummerisch -->
239
- {#if (Type === "number")}
240
- <input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
241
- {/if}
242
-
243
- <!-- Text -->
244
- {#if (Type === "text" && !Multiline) || (Type === "email")}
245
- <input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
246
- {/if}
247
- {#if (Type === "text" && Multiline)}
248
- <textarea style={style} on:keydown={checkInput} bind:value={Value}/>
249
- {/if}
250
-
251
- <!-- Währung -->
252
- {#if (Type === "currency")}
253
- <input style={style} on:keydown={checkInput} on:keyup={thisKeyUp} bind:value={Value}/>
254
- {/if}
255
-
256
- <div class="card" hidden={errorHidden} style={styleError}>
257
- {errorMessage}
258
- </div>
@@ -1,11 +0,0 @@
1
- <script>
2
- import { Button } from "svelte-chota";
3
- import { mdiTrashCan } from "@mdi/js"
4
-
5
- export let Handler;
6
- export let disabled;
7
- export let title;
8
- </script>
9
-
10
- <Button error title={title} on:click={Handler} icon={mdiTrashCan} {disabled}>
11
- </Button>
@@ -1,12 +0,0 @@
1
- <script>
2
- import { Button } from "svelte-chota";
3
- import { mdiCheck } from "@mdi/js"
4
-
5
- export let Handler;
6
- export let disabled;
7
- export let title;
8
- </script>
9
-
10
- <Button primary title={title} on:click={Handler} icon={mdiCheck} {disabled}>
11
- {title}
12
- </Button>
Binary file