@signal24/vue-foundation 4.3.2 → 4.3.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.3.2",
4
+ "version": "4.3.4",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "bin": {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Teleport to="#vf-modal-target">
3
3
  <div :id="id" class="vf-overlay vf-modal-wrap" :class="props.class" ref="overlay">
4
- <form action="." class="vf-modal" :class="{ scrolls }" @submit.prevent="$emit('formSubmit')">
4
+ <form action="." class="vf-modal" :class="{ scrolls }" @submit.prevent="$emit('formSubmit')" ref="form">
5
5
  <div v-if="$slots.header" class="vf-modal-header">
6
6
  <slot name="header" />
7
7
  <i v-if="props.closeX" class="close" @click="closeParent"></i>
@@ -20,6 +20,7 @@
20
20
  <script lang="ts" setup>
21
21
  import { getCurrentInstance, onBeforeUnmount, onMounted, ref } from 'vue';
22
22
 
23
+ import { maskForm, unmaskForm } from '../helpers/mask';
23
24
  import { removeModalInjectionByInternalInstance } from './modal-container';
24
25
 
25
26
  const instance = getCurrentInstance();
@@ -33,8 +34,10 @@ const props = defineProps<{
33
34
  }>();
34
35
 
35
36
  defineEmits(['formSubmit']);
37
+ defineExpose({ mask, unmask });
36
38
 
37
39
  const overlay = ref<HTMLElement>();
40
+ const form = ref<HTMLFormElement>();
38
41
 
39
42
  onMounted(() => {
40
43
  document.body.classList.add('vf-modal-open');
@@ -71,6 +74,14 @@ function handleEscapeKey(e: KeyboardEvent) {
71
74
  function closeParent() {
72
75
  removeModalInjectionByInternalInstance(instance!);
73
76
  }
77
+
78
+ function mask() {
79
+ maskForm(form.value!);
80
+ }
81
+
82
+ function unmask() {
83
+ unmaskForm(form.value!);
84
+ }
74
85
  </script>
75
86
 
76
87
  <style lang="scss">
@@ -61,7 +61,7 @@ export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, button
61
61
  form.classList.add('vf-masked');
62
62
 
63
63
  const buttonEl = (
64
- buttonSelector instanceof Element ? buttonSelector : form.querySelectorAll(buttonSelector ?? 'button:not([disabled])')[0]
64
+ buttonSelector instanceof Element ? buttonSelector : form.querySelectorAll(buttonSelector ?? 'button:not([disabled]):not([type="button"])')[0]
65
65
  ) as HTMLElement;
66
66
  const originalButtonHtml = buttonEl.tagName === 'INPUT' ? (buttonEl as HTMLInputElement).value : buttonEl.innerHTML;
67
67
  buttonEl.setAttribute('disabled', 'disabled');
@@ -65,6 +65,8 @@ export function installApiClientInterceptors({ apiClient, onRequest, onError, Ca
65
65
  if (err.status === 422) {
66
66
  return reject(new UserError(err.body.error));
67
67
  }
68
+
69
+ err.message = `${err.body.error} (${err.status})`;
68
70
  }
69
71
  if (onError) {
70
72
  const handlerResult = onError(err, options);