@signal24/vue-foundation 4.7.2 → 4.7.3

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.
@@ -252,8 +252,9 @@ const Q = Symbol("FormMaskState");
252
252
  function ft(e, t, n) {
253
253
  const i = e instanceof Element ? e : _e(e);
254
254
  i.classList.add("vf-masked");
255
- const s = t instanceof Element ? t : i.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0], o = s.tagName === "INPUT" ? s.value : s.innerHTML;
256
- s.setAttribute("disabled", "disabled"), s.innerText = n ?? "Please wait...";
255
+ const s = t instanceof Element ? t : i.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0];
256
+ let o;
257
+ s && (o = s.tagName === "INPUT" ? s.value : s.innerHTML, s.setAttribute("disabled", "disabled"), s.innerText = n ?? "Please wait...");
257
258
  const l = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
258
259
  return l.forEach((c) => c.setAttribute("disabled", "disabled")), i[Q] = {
259
260
  disabledElements: l,
@@ -263,7 +264,7 @@ function ft(e, t, n) {
263
264
  }
264
265
  function He(e) {
265
266
  const t = e instanceof Element ? e : _e(e), n = t[Q];
266
- n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((i) => i.removeAttribute("disabled")), n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled"), delete t[Q]);
267
+ n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((i) => i.removeAttribute("disabled")), n.waitButton && (n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled")), delete t[Q]);
267
268
  }
268
269
  function _e(e) {
269
270
  const t = e.$.vnode.el;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.7.2",
4
+ "version": "4.7.3",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "bin": {
@@ -50,8 +50,8 @@ const FormMaskState = Symbol('FormMaskState');
50
50
  interface IFormMaskState {
51
51
  [FormMaskState]?: {
52
52
  disabledElements: HTMLElement[];
53
- waitButton: HTMLElement;
54
- buttonHtml: string;
53
+ waitButton?: HTMLElement;
54
+ buttonHtml?: string;
55
55
  };
56
56
  }
57
57
  type FormMaskElement = Element & IFormMaskState;
@@ -62,10 +62,13 @@ export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, button
62
62
 
63
63
  const buttonEl = (
64
64
  buttonSelector instanceof Element ? buttonSelector : form.querySelectorAll(buttonSelector ?? 'button:not([disabled]):not([type="button"])')[0]
65
- ) as HTMLElement;
66
- const originalButtonHtml = buttonEl.tagName === 'INPUT' ? (buttonEl as HTMLInputElement).value : buttonEl.innerHTML;
67
- buttonEl.setAttribute('disabled', 'disabled');
68
- buttonEl.innerText = buttonText ?? 'Please wait...';
65
+ ) as HTMLElement | undefined;
66
+ let originalButtonHtml: string | undefined;
67
+ if (buttonEl) {
68
+ originalButtonHtml = buttonEl.tagName === 'INPUT' ? (buttonEl as HTMLInputElement).value : buttonEl.innerHTML;
69
+ buttonEl.setAttribute('disabled', 'disabled');
70
+ buttonEl.innerText = buttonText ?? 'Please wait...';
71
+ }
69
72
 
70
73
  const inputsQR = form.querySelectorAll('input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])');
71
74
  const inputs = [...inputsQR] as HTMLElement[];
@@ -89,8 +92,11 @@ export function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance) {
89
92
  form.classList.remove('vf-masked');
90
93
 
91
94
  state.disabledElements.forEach(el => el.removeAttribute('disabled'));
92
- state.waitButton.innerHTML = state.buttonHtml;
93
- state.waitButton.removeAttribute('disabled');
95
+
96
+ if (state.waitButton) {
97
+ state.waitButton.innerHTML = state.buttonHtml!;
98
+ state.waitButton.removeAttribute('disabled');
99
+ }
94
100
 
95
101
  delete (form as FormMaskElement)[FormMaskState];
96
102
  }