avalynx-form 1.0.3 → 1.0.5
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/LICENSE +1 -1
- package/README.de.md +164 -0
- package/README.md +9 -1
- package/dist/js/avalynx-form.esm.js +20 -3
- package/dist/js/avalynx-form.js +15 -2
- package/package.json +9 -9
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 Juergen Schwind an the
|
|
3
|
+
Copyright (c) 2024 Juergen Schwind an the AvalynxForm Authors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.de.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# AvalynxForm
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/avalynx-form)
|
|
4
|
+
[](https://www.npmjs.com/package/avalynx-form)
|
|
5
|
+
[](https://www.jsdelivr.com/package/npm/avalynx-form)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/avalynx/avalynx-form/actions/workflows/tests.yml)
|
|
8
|
+
[](https://codecov.io/gh/avalynx/avalynx-form)
|
|
9
|
+
[](https://github.com/avalynx/avalynx-form)
|
|
10
|
+
|
|
11
|
+
AvalynxForm ist eine leichtgewichtige, anpassbare Formular-Handling-Bibliothek für Webanwendungen. Basierend auf Bootstrap >=5.3 ohne jegliche Framework-Abhängigkeiten.
|
|
12
|
+
|
|
13
|
+
## Funktionen
|
|
14
|
+
|
|
15
|
+
- **Formular-Handling**: Vereinfacht den Prozess der Erstellung und Verwaltung von Formularen in Ihren Webanwendungen.
|
|
16
|
+
- **Bootstrap-Integration**: Entwickelt für die nahtlose Integration mit Bootstrap >= 5.3.
|
|
17
|
+
- **Einfach zu bedienen**: Einfache API zur Erstellung und Verwaltung von Formularen in Ihren Webanwendungen.
|
|
18
|
+
|
|
19
|
+
## Beispiel
|
|
20
|
+
|
|
21
|
+
Hier ist ein einfaches Beispiel für die Verwendung von AvalynxForm in Ihrem Projekt:
|
|
22
|
+
|
|
23
|
+
* [Übersicht](https://avalynx-form.jbs-newmedia.de/examples/index.html)
|
|
24
|
+
* [Formular](https://avalynx-form.jbs-newmedia.de/examples/form.html)
|
|
25
|
+
* [Formular mit langsamer Antwort](https://avalynx-form.jbs-newmedia.de/examples/form-slow-response.html)
|
|
26
|
+
* [Formular mit AvalynxSelect](https://avalynx-form.jbs-newmedia.de/examples/form-with-avalynx-select.html)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Um AvalynxForm in Ihrem Projekt zu verwenden, können Sie es direkt in Ihre HTML-Datei einbinden. Stellen Sie sicher, dass Sie Bootstrap 5.3 oder höher in Ihrem Projekt eingebunden haben, damit AvalynxForm korrekt funktioniert.
|
|
31
|
+
|
|
32
|
+
Zuerst Bootstrap einbinden:
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<!-- Bootstrap -->
|
|
36
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
37
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Dann AvalynxForm einbinden:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<script src="pfad/zu/avalynx-form.js"></script>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Ersetzen Sie `pfad/zu/avalynx-form.js` durch den tatsächlichen Pfad zur Datei in Ihrem Projekt.
|
|
47
|
+
|
|
48
|
+
## Installation über jsDelivr ([Link](https://cdn.jsdelivr.net/npm/avalynx-form/))
|
|
49
|
+
|
|
50
|
+
AvalynxForm ist auch über [jsDelivr](https://www.jsdelivr.com/) verfügbar. Sie können es wie folgt in Ihr Projekt einbinden:
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<script src="https://cdn.jsdelivr.net/npm/avalynx-form@1.0.5/dist/js/avalynx-form.js"></script>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Stellen Sie sicher, dass Sie auch die JS/CSS-Dateien von Bootstrap in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxForm zu gewährleisten.
|
|
57
|
+
|
|
58
|
+
## Installation über NPM ([Link](https://www.npmjs.com/package/avalynx-form))
|
|
59
|
+
|
|
60
|
+
AvalynxForm ist auch als npm-Paket verfügbar. Sie können es mit dem folgenden Befehl zu Ihrem Projekt hinzufügen:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install avalynx-form
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Nach der Installation können Sie AvalynxForm wie folgt in Ihre JavaScript-Datei importieren:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import { AvalynxForm } from 'avalynx-form';
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Stellen Sie sicher, dass Sie auch die JS/CSS-Dateien von Bootstrap in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxForm zu gewährleisten.
|
|
73
|
+
|
|
74
|
+
## Installation über Symfony AssetMapper
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
php bin/console importmap:require avalynx-form
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Nach der Installation können Sie AvalynxForm wie folgt in Ihre JavaScript-Datei importieren:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
import { AvalynxForm } from 'avalynx-form';
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Stellen Sie sicher, dass Sie auch die JS/CSS-Dateien von Bootstrap in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxForm zu gewährleisten.
|
|
87
|
+
|
|
88
|
+
## Installation über Symfony AssetComposer
|
|
89
|
+
|
|
90
|
+
Weitere Informationen zum Symfony AssetComposer Bundle finden Sie [hier](https://github.com/jbsnewmedia/asset-composer-bundle).
|
|
91
|
+
|
|
92
|
+
```twig
|
|
93
|
+
{% do addAssetComposer('avalynx/avalynx-form/dist/js/avalynx-form.js') %}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Stellen Sie sicher, dass Sie auch die JS/CSS-Dateien von Bootstrap in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxForm zu gewährleisten.
|
|
97
|
+
|
|
98
|
+
## Installation über Composer ([Link](https://packagist.org/packages/avalynx/avalynx-form))
|
|
99
|
+
|
|
100
|
+
AvalynxForm ist auch als Composer-Paket verfügbar. Sie können es mit dem folgenden Befehl zu Ihrem Projekt hinzufügen:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
composer require avalynx/avalynx-form
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Nach der Installation können Sie AvalynxForm wie folgt in Ihre HTML-Datei einbinden:
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<script src="vendor/avalynx/avalynx-form/dist/js/avalynx-form.js"></script>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Stellen Sie sicher, dass Sie auch die JS/CSS-Dateien von Bootstrap in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxForm zu gewährleisten.
|
|
113
|
+
|
|
114
|
+
## Verwendung
|
|
115
|
+
|
|
116
|
+
Um AvalynxForm in Ihrem Projekt zu verwenden, binden Sie die JavaScript-Datei von AvalynxForm in Ihr Projekt ein und initialisieren Sie die Klasse mit dem entsprechenden Selektor.
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
new AvalynxForm("myForm", {
|
|
120
|
+
apiParams: {
|
|
121
|
+
extraData1: 'wert1',
|
|
122
|
+
extraData2: 'wert2'
|
|
123
|
+
},
|
|
124
|
+
onSuccess: function(response) {
|
|
125
|
+
console.log('Formularübermittlung war erfolgreich:', response);
|
|
126
|
+
},
|
|
127
|
+
onError: function(response) {
|
|
128
|
+
console.error('Formularübermittlung fehlgeschlagen:', response);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Optionen
|
|
134
|
+
|
|
135
|
+
AvalynxForm ermöglicht die folgenden Optionen zur Anpassung:
|
|
136
|
+
|
|
137
|
+
- `id`: (string) Die ID des Elements, an das das Formular angehängt werden soll.
|
|
138
|
+
- `options`: Ein Objekt, das die folgenden Schlüssel enthält:
|
|
139
|
+
- `apiParams`: (object) Zusätzliche Parameter, die mit den Formulardaten gesendet werden sollen (Standard: `{}`).
|
|
140
|
+
- `loader`: (object) Eine Instanz von AvalynxLoader, die als Loader für das Modal verwendet werden soll (Standard: `null`).
|
|
141
|
+
- `onSuccess`: (function) Eine Callback-Funktion, die ausgeführt wird, wenn die Formularübermittlung erfolgreich ist (Standard: `null`).
|
|
142
|
+
- `onError`: (function) Eine Callback-Funktion, die ausgeführt wird, wenn die Formularübermittlung fehlschlägt (Standard: `null`).
|
|
143
|
+
- `onBeforeSubmit`: (function) Eine Callback-Funktion, die vor der Formularübermittlung ausgeführt wird (Standard: `null`).
|
|
144
|
+
- `onAfterSubmit`: (function) Eine Callback-Funktion, die nach der Formularübermittlung ausgeführt wird (Standard: `null`).
|
|
145
|
+
|
|
146
|
+
## Mitwirken
|
|
147
|
+
|
|
148
|
+
Beiträge sind willkommen! Wenn Sie einen Beitrag leisten möchten, erstellen Sie bitte einen Fork des Repositorys und senden Sie einen Pull-Request mit Ihren Änderungen oder Verbesserungen. Wir suchen nach Beiträgen in den folgenden Bereichen:
|
|
149
|
+
|
|
150
|
+
- Fehlerbehebungen
|
|
151
|
+
- Funktionserweiterungen
|
|
152
|
+
- Verbesserungen der Dokumentation
|
|
153
|
+
|
|
154
|
+
Bevor Sie Ihren Pull-Request absenden, stellen Sie bitte sicher, dass Ihre Änderungen gut dokumentiert sind und dem bestehenden Codierungsstil des Projekts entsprechen.
|
|
155
|
+
|
|
156
|
+
## Lizenz
|
|
157
|
+
|
|
158
|
+
AvalynxForm ist quelloffene Software, die unter der [MIT-Lizenz](LICENSE) lizenziert ist.
|
|
159
|
+
|
|
160
|
+
## Kontakt
|
|
161
|
+
|
|
162
|
+
Wenn Sie Fragen, Funktionswünsche oder Probleme haben, eröffnen Sie bitte ein Issue in unserem [GitHub-Repository](https://github.com/avalynx/avalynx-form/issues) oder senden Sie einen Pull-Request.
|
|
163
|
+
|
|
164
|
+
Vielen Dank, dass Sie AvalynxForm für Ihr Projekt in Betracht ziehen!
|
package/README.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# AvalynxForm
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/avalynx-form)
|
|
4
|
+
[](https://www.npmjs.com/package/avalynx-form)
|
|
5
|
+
[](https://www.jsdelivr.com/package/npm/avalynx-form)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/avalynx/avalynx-form/actions/workflows/tests.yml)
|
|
8
|
+
[](https://codecov.io/gh/avalynx/avalynx-form)
|
|
9
|
+
[](https://github.com/avalynx/avalynx-form)
|
|
10
|
+
|
|
3
11
|
AvalynxForm is a lightweight, customizable form handling library for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
|
|
4
12
|
|
|
5
13
|
## Features
|
|
@@ -42,7 +50,7 @@ Replace `path/to/avalynx-form.js` with the actual path to the file in your proje
|
|
|
42
50
|
AvalynxForm is also available via [jsDelivr](https://www.jsdelivr.com/). You can include it in your project like this:
|
|
43
51
|
|
|
44
52
|
```html
|
|
45
|
-
<script src="https://cdn.jsdelivr.net/npm/avalynx-form@1.0.
|
|
53
|
+
<script src="https://cdn.jsdelivr.net/npm/avalynx-form@1.0.5/dist/js/avalynx-form.js"></script>
|
|
46
54
|
```
|
|
47
55
|
|
|
48
56
|
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxForm displays correctly.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* AvalynxForm is a lightweight, customizable form handling library for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.0.
|
|
6
|
+
* @version 1.0.5
|
|
7
7
|
* @license MIT
|
|
8
8
|
* @author https://github.com/avalynx/avalynx-form/graphs/contributors
|
|
9
9
|
* @website https://github.com/avalynx/
|
|
@@ -119,7 +119,7 @@ export class AvalynxForm {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
if (response.redirect !== undefined) {
|
|
122
|
-
|
|
122
|
+
this.redirect(response.redirect);
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
125
125
|
if (response.invalid !== undefined) {
|
|
@@ -147,6 +147,10 @@ export class AvalynxForm {
|
|
|
147
147
|
if (parentElement !== null) {
|
|
148
148
|
const spanElement = parentElement.querySelector('.invalid-feedback');
|
|
149
149
|
element.classList.add('is-invalid');
|
|
150
|
+
const inputContainer = element.closest('[class*="-input-container"]');
|
|
151
|
+
if (inputContainer) {
|
|
152
|
+
inputContainer.classList.add('is-invalid');
|
|
153
|
+
}
|
|
150
154
|
if (spanElement !== null) {
|
|
151
155
|
spanElement.innerHTML = value;
|
|
152
156
|
spanElement.style.display = 'block';
|
|
@@ -162,6 +166,10 @@ export class AvalynxForm {
|
|
|
162
166
|
if (parentElement !== null) {
|
|
163
167
|
const spanElement = parentElement.querySelector('.invalid-feedback');
|
|
164
168
|
element.classList.remove('is-invalid');
|
|
169
|
+
const inputContainer = element.closest('[class*="-input-container"]');
|
|
170
|
+
if (inputContainer) {
|
|
171
|
+
inputContainer.classList.remove('is-invalid');
|
|
172
|
+
}
|
|
165
173
|
if (spanElement !== null) {
|
|
166
174
|
spanElement.innerHTML = " ";
|
|
167
175
|
spanElement.style.display = 'none';
|
|
@@ -195,4 +203,13 @@ export class AvalynxForm {
|
|
|
195
203
|
this.form.appendChild(overlay);
|
|
196
204
|
}
|
|
197
205
|
}
|
|
198
|
-
|
|
206
|
+
|
|
207
|
+
redirect(url) {
|
|
208
|
+
window.location.href = url;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* istanbul ignore next */
|
|
213
|
+
if (typeof module !== 'undefined' && module.exports) {
|
|
214
|
+
module.exports = AvalynxForm;
|
|
215
|
+
}
|
package/dist/js/avalynx-form.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* AvalynxForm is a lightweight, customizable form handling library for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.0.
|
|
6
|
+
* @version 1.0.5
|
|
7
7
|
* @license MIT
|
|
8
8
|
* @author https://github.com/avalynx/avalynx-form/graphs/contributors
|
|
9
9
|
* @website https://github.com/avalynx/
|
|
@@ -117,7 +117,7 @@ class AvalynxForm {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
if (response.redirect !== undefined) {
|
|
120
|
-
|
|
120
|
+
this.redirect(response.redirect);
|
|
121
121
|
}
|
|
122
122
|
} else {
|
|
123
123
|
if (response.invalid !== undefined) {
|
|
@@ -145,6 +145,10 @@ class AvalynxForm {
|
|
|
145
145
|
if (parentElement !== null) {
|
|
146
146
|
const spanElement = parentElement.querySelector('.invalid-feedback');
|
|
147
147
|
element.classList.add('is-invalid');
|
|
148
|
+
const inputContainer = element.closest('[class*="-input-container"]');
|
|
149
|
+
if (inputContainer) {
|
|
150
|
+
inputContainer.classList.add('is-invalid');
|
|
151
|
+
}
|
|
148
152
|
if (spanElement !== null) {
|
|
149
153
|
spanElement.innerHTML = value;
|
|
150
154
|
spanElement.style.display = 'block';
|
|
@@ -160,6 +164,10 @@ class AvalynxForm {
|
|
|
160
164
|
if (parentElement !== null) {
|
|
161
165
|
const spanElement = parentElement.querySelector('.invalid-feedback');
|
|
162
166
|
element.classList.remove('is-invalid');
|
|
167
|
+
const inputContainer = element.closest('[class*="-input-container"]');
|
|
168
|
+
if (inputContainer) {
|
|
169
|
+
inputContainer.classList.remove('is-invalid');
|
|
170
|
+
}
|
|
163
171
|
if (spanElement !== null) {
|
|
164
172
|
spanElement.innerHTML = " ";
|
|
165
173
|
spanElement.style.display = 'none';
|
|
@@ -193,8 +201,13 @@ class AvalynxForm {
|
|
|
193
201
|
this.form.appendChild(overlay);
|
|
194
202
|
}
|
|
195
203
|
}
|
|
204
|
+
|
|
205
|
+
redirect(url) {
|
|
206
|
+
window.location.href = url;
|
|
207
|
+
}
|
|
196
208
|
}
|
|
197
209
|
|
|
210
|
+
/* istanbul ignore next */
|
|
198
211
|
if (typeof module !== 'undefined' && module.exports) {
|
|
199
212
|
module.exports = AvalynxForm;
|
|
200
213
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "avalynx-form",
|
|
3
3
|
"title": "AvalynxForm",
|
|
4
4
|
"description": "AvalynxForm is a lightweight, customizable form handling library for web applications. Based on Bootstrap >=5.3 without any framework dependencies.",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.5",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/js/avalynx-form.js",
|
|
8
8
|
"module": "dist/js/avalynx-form.esm.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"package.json"
|
|
24
24
|
],
|
|
25
25
|
"author": {
|
|
26
|
-
"name": "Juergen Schwind an the
|
|
26
|
+
"name": "Juergen Schwind an the AvalynxForm Authors",
|
|
27
27
|
"url": "https://github.com/avalynx/avalynx-form/graphs/contributors"
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/avalynx/",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"bootstrap": ">=5.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@babel/core": "^7",
|
|
46
|
-
"@babel/preset-env": "^7",
|
|
47
|
-
"babel-jest": "^
|
|
48
|
-
"jest": "^
|
|
49
|
-
"jest-environment-jsdom": "^
|
|
50
|
-
"shelljs": "^0",
|
|
51
|
-
"shx": "^0"
|
|
45
|
+
"@babel/core": "^7.29.0",
|
|
46
|
+
"@babel/preset-env": "^7.29.0",
|
|
47
|
+
"babel-jest": "^30.2.0",
|
|
48
|
+
"jest": "^30.2.0",
|
|
49
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
50
|
+
"shelljs": "^0.10.0",
|
|
51
|
+
"shx": "^0.4.0"
|
|
52
52
|
}
|
|
53
53
|
}
|