@formixru/b2b-ui 1.0.0 → 1.0.1
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/components/form/index.js +7 -7
package/CHANGELOG.md
ADDED
package/package.json
CHANGED
|
@@ -17,8 +17,8 @@ const initFormContent = ($b) => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const send = async ($b, url, method, data) => {
|
|
20
|
-
url = new URL(url || $b.action, location.origin);
|
|
21
|
-
method = method || $b.method;
|
|
20
|
+
url = new URL(url || $b.getAttribute('action'), location.origin);
|
|
21
|
+
method = method || $b.getAttribute('method');
|
|
22
22
|
data = data || new FormData($b);
|
|
23
23
|
const options = {
|
|
24
24
|
method,
|
|
@@ -173,11 +173,11 @@ document.body.addEventListener('submit', (event) => {
|
|
|
173
173
|
const { target } = event;
|
|
174
174
|
const $b = target.closest('.form');
|
|
175
175
|
if ($b) {
|
|
176
|
-
const $submitButton = $b.querySelector('.form__submit-button[type="submit"]');
|
|
177
|
-
if ($submitButton) {
|
|
178
|
-
$submitButton.disabled = true;
|
|
179
|
-
}
|
|
180
176
|
if ($b.classList.contains('form_captcha') && window.smartCaptcha) {
|
|
177
|
+
const $submitButton = $b.querySelector('.form__submit-button[type="submit"]');
|
|
178
|
+
if ($submitButton) {
|
|
179
|
+
$submitButton.disabled = true;
|
|
180
|
+
}
|
|
181
181
|
const $token = $b.querySelector('input[name="smart-token"]');
|
|
182
182
|
if ($token && $token.value) {
|
|
183
183
|
if ($b.classList.contains('form_ajax')) {
|
|
@@ -211,7 +211,7 @@ document.body.addEventListener('change', (event) => {
|
|
|
211
211
|
if (target.classList.contains('form__trigger')) {
|
|
212
212
|
$form.requestSubmit();
|
|
213
213
|
} else if (target.dataset.request) {
|
|
214
|
-
const { name, value } = target.dataset.request;
|
|
214
|
+
const { name, value } = JSON.parse(target.dataset.request);
|
|
215
215
|
$form.insertAdjacentHTML('afterbegin', `<input type="hidden" name="${name}" value="${value}">`);
|
|
216
216
|
$form.requestSubmit();
|
|
217
217
|
} else if (target.closest('.form__option')) {
|