avalynx-form 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -15,6 +15,7 @@ Here's a simple example of how to use AvalynxForm in your project:
15
15
  * [Overview](https://avalynx-form.jbs-newmedia.de/examples/index.html)
16
16
  * [Form](https://avalynx-form.jbs-newmedia.de/examples/form.html)
17
17
  * [Form with slow response](https://avalynx-form.jbs-newmedia.de/examples/form-slow-response.html)
18
+ * [Form with AvalynxSelect](https://avalynx-form.jbs-newmedia.de/examples/form-with-avalynx-select.html)
18
19
 
19
20
  ## Installation
20
21
 
@@ -41,7 +42,7 @@ Replace `path/to/avalynx-form.js` with the actual path to the file in your proje
41
42
  AvalynxForm is also available via [jsDelivr](https://www.jsdelivr.com/). You can include it in your project like this:
42
43
 
43
44
  ```html
44
- <script src="https://cdn.jsdelivr.net/npm/avalynx-form@1.0.0/dist/js/avalynx-form.js"></script>
45
+ <script src="https://cdn.jsdelivr.net/npm/avalynx-form@1.0.2/dist/js/avalynx-form.js"></script>
45
46
  ```
46
47
 
47
48
  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.0
6
+ * @version 1.0.2
7
7
  * @license MIT
8
8
  * @author https://github.com/avalynx/avalynx-datatable/graphs/contributors
9
9
  * @website https://github.com/avalynx/
@@ -19,6 +19,8 @@
19
19
  *
20
20
  */
21
21
 
22
+ import * as bootstrap from 'bootstrap';
23
+
22
24
  export class AvalynxForm {
23
25
  constructor(id, options = {}) {
24
26
  this.form = document.getElementById(id);
@@ -26,6 +28,9 @@ export class AvalynxForm {
26
28
  console.error("AvalynxForm: Element with id '" + id + "' not found");
27
29
  return;
28
30
  }
31
+ if (options === null || typeof options !== 'object') {
32
+ options = {};
33
+ }
29
34
  this.id = id;
30
35
  this.options = {
31
36
  apiParams: {},
@@ -120,7 +125,7 @@ export class AvalynxForm {
120
125
  }
121
126
 
122
127
  showInvalidFeedback(key, value) {
123
- const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}["]`);
128
+ const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}\\["]`);
124
129
  elements.forEach(element => {
125
130
  const parentElement = element.closest('.form-group') || element.parentElement;
126
131
  if (parentElement !== null) {
@@ -135,7 +140,7 @@ export class AvalynxForm {
135
140
  }
136
141
 
137
142
  clearInvalidFeedback(key) {
138
- const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}["]`);
143
+ const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}\\["]`);
139
144
  elements.forEach(element => {
140
145
  const parentElement = element.closest('.form-group') || element.parentElement;
141
146
  if (parentElement !== null) {
@@ -174,4 +179,4 @@ export class AvalynxForm {
174
179
  this.form.appendChild(overlay);
175
180
  }
176
181
  }
177
- }
182
+ }
@@ -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.0
6
+ * @version 1.0.2
7
7
  * @license MIT
8
8
  * @author https://github.com/avalynx/avalynx-datatable/graphs/contributors
9
9
  * @website https://github.com/avalynx/
@@ -26,6 +26,9 @@ class AvalynxForm {
26
26
  console.error("AvalynxForm: Element with id '" + id + "' not found");
27
27
  return;
28
28
  }
29
+ if (options === null || typeof options !== 'object') {
30
+ options = {};
31
+ }
29
32
  this.id = id;
30
33
  this.options = {
31
34
  apiParams: {},
@@ -120,7 +123,7 @@ class AvalynxForm {
120
123
  }
121
124
 
122
125
  showInvalidFeedback(key, value) {
123
- const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}["]`);
126
+ const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}\\["]`);
124
127
  elements.forEach(element => {
125
128
  const parentElement = element.closest('.form-group') || element.parentElement;
126
129
  if (parentElement !== null) {
@@ -135,7 +138,7 @@ class AvalynxForm {
135
138
  }
136
139
 
137
140
  clearInvalidFeedback(key) {
138
- const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}["]`);
141
+ const elements = document.querySelectorAll(`#${key}, [name="${key}"], [name="${key}[]"], [name^="${key}\\["]`);
139
142
  elements.forEach(element => {
140
143
  const parentElement = element.closest('.form-group') || element.parentElement;
141
144
  if (parentElement !== null) {
@@ -175,3 +178,7 @@ class AvalynxForm {
175
178
  }
176
179
  }
177
180
  }
181
+
182
+ if (typeof module !== 'undefined' && module.exports) {
183
+ module.exports = AvalynxForm;
184
+ }
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.0",
5
+ "version": "1.0.2",
6
6
  "license": "MIT",
7
7
  "main": "dist/js/avalynx-form.js",
8
8
  "module": "dist/js/avalynx-form.esm.js",