@signal24/vue-foundation 4.13.0 → 4.13.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/dist/src/config.d.ts +1 -0
- package/dist/src/directives/confirm-button.d.ts +6 -1
- package/dist/vue-foundation.es.js +61 -58
- package/package.json +1 -1
- package/src/config.ts +3 -1
- package/src/directives/confirm-button.ts +14 -4
- package/src/directives/datetime.ts +5 -1
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-4.0.2.cjs +0 -893
package/dist/src/config.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { ObjectDirective } from 'vue';
|
|
2
|
-
|
|
2
|
+
interface ConfirmButtonOptions {
|
|
3
|
+
text?: string | null;
|
|
4
|
+
class?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const vConfirmButton: ObjectDirective<HTMLElement, ConfirmButtonOptions>;
|
|
7
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ve = Object.defineProperty;
|
|
2
2
|
var Fe = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var E = (e, t, n) => (Fe(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
-
import { defineComponent as C, defineProps as _e, defineEmits as Ne, ref as O, computed as
|
|
4
|
+
import { defineComponent as C, defineProps as _e, defineEmits as Ne, ref as O, computed as _, openBlock as d, createElementBlock as u, createElementVNode as w, toDisplayString as x, withDirectives as j, createCommentVNode as b, Fragment as U, renderList as J, vModelSelect as Re, getCurrentInstance as ee, onMounted as L, normalizeClass as k, normalizeStyle as Ke, withModifiers as te, renderSlot as K, reactive as je, h as W, Teleport as Ue, markRaw as We, onBeforeUnmount as ne, resolveDirective as Oe, createBlock as be, createSlots as Pe, withCtx as Y, createTextVNode as ae, vModelText as qe, watch as ce, onActivated as ke, onDeactivated as Se } from "vue";
|
|
5
5
|
import { compact as ze, debounce as Xe, isEqual as Ce, upperFirst as Ye, startCase as Ze, cloneDeep as Ge, remove as Qe } from "lodash";
|
|
6
6
|
import { escapeHtml as Je } from "@vue/shared";
|
|
7
7
|
import { escapeHtml as ni } from "@vue/shared";
|
|
@@ -11,7 +11,7 @@ const nt = C({
|
|
|
11
11
|
setup() {
|
|
12
12
|
const e = _e();
|
|
13
13
|
Ne(["update:modelValue"]);
|
|
14
|
-
const t = O(null), n =
|
|
14
|
+
const t = O(null), n = _(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null), i = O(e.modelValue ?? null);
|
|
15
15
|
return { props: e, options: t, renderOptions: n, selectedItem: i };
|
|
16
16
|
},
|
|
17
17
|
watch: {
|
|
@@ -85,14 +85,14 @@ const Mn = /* @__PURE__ */ xe(nt, [["render", lt]]), rt = /* @__PURE__ */ C({
|
|
|
85
85
|
if (m.y === "center")
|
|
86
86
|
c = y.top + y.height / 2 - f.height / 2, h.push("anchored-center-y");
|
|
87
87
|
else {
|
|
88
|
-
const
|
|
89
|
-
c =
|
|
88
|
+
const H = (y.bottom + f.height < window.innerHeight || m.y === "below") && m.y !== "above";
|
|
89
|
+
c = H ? y.bottom : y.top - f.height, h.push(H ? "anchored-top" : "anchored-bottom");
|
|
90
90
|
}
|
|
91
91
|
if (m.x === "center")
|
|
92
92
|
T = y.left + y.width / 2 - f.width / 2, h.push("anchored-center-x");
|
|
93
93
|
else {
|
|
94
|
-
const
|
|
95
|
-
T =
|
|
94
|
+
const H = (y.left + f.width < window.innerWidth || m.x === "left") && m.x !== "right";
|
|
95
|
+
T = H ? y.left : y.right - f.width, h.push(H ? "anchored-left" : "anchored-right");
|
|
96
96
|
}
|
|
97
97
|
return {
|
|
98
98
|
styles: {
|
|
@@ -199,13 +199,14 @@ function $n(e, t) {
|
|
|
199
199
|
});
|
|
200
200
|
return () => P(n);
|
|
201
201
|
}
|
|
202
|
-
const
|
|
202
|
+
const M = {
|
|
203
203
|
unhandledErrorSupportText: "please contact support",
|
|
204
204
|
errorHandler: (e) => console.error("Unhandled error:", e),
|
|
205
|
-
|
|
205
|
+
defaultDateFormat: "M/d/yy",
|
|
206
|
+
defaultDateTimeFormat: "M/d/yy H:mm"
|
|
206
207
|
};
|
|
207
208
|
function Bn(e) {
|
|
208
|
-
Object.assign(
|
|
209
|
+
Object.assign(M, e);
|
|
209
210
|
}
|
|
210
211
|
class z extends Error {
|
|
211
212
|
constructor(t) {
|
|
@@ -217,20 +218,20 @@ function ut(e) {
|
|
|
217
218
|
|
|
218
219
|
${oe(e).message}
|
|
219
220
|
|
|
220
|
-
Please refresh the page and try again. If this error persists, ${
|
|
221
|
+
Please refresh the page and try again. If this error persists, ${M.unhandledErrorSupportText}.`;
|
|
221
222
|
}
|
|
222
223
|
function oe(e) {
|
|
223
224
|
return e instanceof Error ? e : new Error(String(e));
|
|
224
225
|
}
|
|
225
226
|
async function Vn(e, t) {
|
|
226
227
|
const n = oe(e);
|
|
227
|
-
return n instanceof z ||
|
|
228
|
+
return n instanceof z || M.errorHandler(n), t ? de(t, n) : de(n);
|
|
228
229
|
}
|
|
229
230
|
async function Fn(e) {
|
|
230
231
|
const t = oe(e);
|
|
231
|
-
t instanceof z ||
|
|
232
|
+
t instanceof z || M.errorHandler(t);
|
|
232
233
|
}
|
|
233
|
-
const
|
|
234
|
+
const B = Symbol("MaskState");
|
|
234
235
|
function _n(e, t) {
|
|
235
236
|
const n = e.$.vnode.el, i = n.closest(".vf-modal");
|
|
236
237
|
return ht(i ?? n, t);
|
|
@@ -240,14 +241,14 @@ function Nn(e) {
|
|
|
240
241
|
return Me(n ?? t);
|
|
241
242
|
}
|
|
242
243
|
function ht(e, t) {
|
|
243
|
-
if (!e[
|
|
244
|
+
if (!e[B]) {
|
|
244
245
|
const n = document.createElement("div");
|
|
245
|
-
n.classList.add("vf-mask"), e.appendChild(n), e[
|
|
246
|
+
n.classList.add("vf-mask"), e.appendChild(n), e[B] = { maskEl: n };
|
|
246
247
|
}
|
|
247
|
-
return e[
|
|
248
|
+
return e[B].maskEl.innerText = t ?? "", () => Me(e);
|
|
248
249
|
}
|
|
249
250
|
function Me(e) {
|
|
250
|
-
e[
|
|
251
|
+
e[B] && e.removeChild(e[B].maskEl);
|
|
251
252
|
}
|
|
252
253
|
const Q = Symbol("FormMaskState");
|
|
253
254
|
function ft(e, t, n) {
|
|
@@ -290,7 +291,7 @@ const pt = ["id"], mt = {
|
|
|
290
291
|
setup(e, { expose: t }) {
|
|
291
292
|
const n = ee(), i = e;
|
|
292
293
|
t({ mask: m, unmask: y, hide: f, unhide: h });
|
|
293
|
-
const s = O(), o = O(), r = O(!1), l =
|
|
294
|
+
const s = O(), o = O(), r = O(!1), l = _(() => ze([i.class, r.value && "hidden"]));
|
|
294
295
|
L(() => {
|
|
295
296
|
var c;
|
|
296
297
|
document.body.classList.add("vf-modal-open"), i.closeOnMaskClick && (window.addEventListener("keydown", p), (c = s.value) == null || c.addEventListener("click", a));
|
|
@@ -330,7 +331,7 @@ const pt = ["id"], mt = {
|
|
|
330
331
|
w("form", {
|
|
331
332
|
action: ".",
|
|
332
333
|
class: k(["vf-modal", { scrolls: c.scrolls }]),
|
|
333
|
-
onSubmit: T[0] || (T[0] = te((
|
|
334
|
+
onSubmit: T[0] || (T[0] = te((I) => c.$emit("formSubmit"), ["prevent"])),
|
|
334
335
|
ref_key: "form",
|
|
335
336
|
ref: o
|
|
336
337
|
}, [
|
|
@@ -363,7 +364,7 @@ const pt = ["id"], mt = {
|
|
|
363
364
|
callback: { type: Function }
|
|
364
365
|
},
|
|
365
366
|
setup(e) {
|
|
366
|
-
const t = e, n =
|
|
367
|
+
const t = e, n = _(() => t.message instanceof Error ? ut(t.message) : t.message);
|
|
367
368
|
return (i, s) => {
|
|
368
369
|
const o = Oe("autofocus");
|
|
369
370
|
return d(), be(gt, {
|
|
@@ -465,7 +466,7 @@ function Lt(e) {
|
|
|
465
466
|
function Kn() {
|
|
466
467
|
return St();
|
|
467
468
|
}
|
|
468
|
-
const
|
|
469
|
+
const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@#$%^&*()_+{}|:\"<>?qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM", It = {
|
|
469
470
|
props: {
|
|
470
471
|
modelValue: {
|
|
471
472
|
type: null,
|
|
@@ -577,7 +578,7 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
577
578
|
}
|
|
578
579
|
} else
|
|
579
580
|
this.nullTitle && e.unshift({
|
|
580
|
-
key:
|
|
581
|
+
key: D,
|
|
581
582
|
title: this.nullTitle
|
|
582
583
|
});
|
|
583
584
|
return e;
|
|
@@ -603,7 +604,7 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
603
604
|
},
|
|
604
605
|
effectiveOptions() {
|
|
605
606
|
var e;
|
|
606
|
-
this.modelValue && !this.selectedOption && this.handleValueChanged(), this.highlightedOptionKey && !this.effectiveOptions.find((t) => t.key == this.highlightedOptionKey) && (this.highlightedOptionKey = ((e = this.effectiveOptions[0]) == null ? void 0 : e.key) ??
|
|
607
|
+
this.modelValue && !this.selectedOption && this.handleValueChanged(), this.highlightedOptionKey && !this.effectiveOptions.find((t) => t.key == this.highlightedOptionKey) && (this.highlightedOptionKey = ((e = this.effectiveOptions[0]) == null ? void 0 : e.key) ?? D);
|
|
607
608
|
}
|
|
608
609
|
},
|
|
609
610
|
async mounted() {
|
|
@@ -660,7 +661,7 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
660
661
|
},
|
|
661
662
|
setHighlightedOptionKey(e) {
|
|
662
663
|
var t;
|
|
663
|
-
this.selectedOption ? this.highlightedOptionKey = this.getOptionKey(this.selectedOption) : e ? this.highlightedOptionKey = ((t = this.effectiveOptions) == null ? void 0 : t[0].key) ??
|
|
664
|
+
this.selectedOption ? this.highlightedOptionKey = this.getOptionKey(this.selectedOption) : e ? this.highlightedOptionKey = ((t = this.effectiveOptions) == null ? void 0 : t[0].key) ?? D : this.nullTitle && (this.highlightedOptionKey = D);
|
|
664
665
|
},
|
|
665
666
|
getOptionKey(e) {
|
|
666
667
|
var t;
|
|
@@ -709,7 +710,7 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
709
710
|
},
|
|
710
711
|
selectOption(e) {
|
|
711
712
|
var t;
|
|
712
|
-
if (this.isSearching = !1, e.key ==
|
|
713
|
+
if (this.isSearching = !1, e.key == D)
|
|
713
714
|
this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null;
|
|
714
715
|
else if (e.key === he) {
|
|
715
716
|
const n = this.searchText.trim();
|
|
@@ -793,10 +794,10 @@ const Nt = /* @__PURE__ */ xe(It, [["render", _t]]), jn = /* @__PURE__ */ C({
|
|
|
793
794
|
},
|
|
794
795
|
emits: ["update:modelValue"],
|
|
795
796
|
setup(e, { emit: t }) {
|
|
796
|
-
const n = e, i =
|
|
797
|
+
const n = e, i = _(() => Array.isArray(n.options) ? n.options.map((l) => ({ value: l, label: l })) : Object.entries(n.options).map(([l, a]) => ({
|
|
797
798
|
value: l,
|
|
798
799
|
label: a
|
|
799
|
-
}))), s =
|
|
800
|
+
}))), s = _(() => n.formatter ? (l) => {
|
|
800
801
|
var a;
|
|
801
802
|
return (a = n.formatter) == null ? void 0 : a.call(n, l.label);
|
|
802
803
|
} : (l) => l.label), o = t, r = O(i.value.find((l) => l.value === n.modelValue) ?? null);
|
|
@@ -947,10 +948,10 @@ function qn(e, t) {
|
|
|
947
948
|
return c();
|
|
948
949
|
const T = h.innerHTML;
|
|
949
950
|
h.classList.add("pending-confirm"), h.innerText = "Confirm";
|
|
950
|
-
const
|
|
951
|
-
h.classList.remove("pending-confirm"), h.innerHTML = T, h.removeEventListener("mouseleave",
|
|
951
|
+
const I = () => {
|
|
952
|
+
h.classList.remove("pending-confirm"), h.innerHTML = T, h.removeEventListener("mouseleave", I);
|
|
952
953
|
};
|
|
953
|
-
h.addEventListener("mouseleave",
|
|
954
|
+
h.addEventListener("mouseleave", I), f.stopPropagation();
|
|
954
955
|
}
|
|
955
956
|
}
|
|
956
957
|
const tn = (e) => new Promise((t) => setTimeout(t, e)), zn = (e) => tn(e * 1e3);
|
|
@@ -984,11 +985,11 @@ function Gn(e, t) {
|
|
|
984
985
|
}
|
|
985
986
|
function sn(e, t) {
|
|
986
987
|
const n = {};
|
|
987
|
-
if (t.elScrolledToBottom && (n.el = new
|
|
988
|
+
if (t.elScrolledToBottom && (n.el = new V(e.vnode.el, t.elScrolledToBottom)), t.ancestorScrolledToBottom) {
|
|
988
989
|
const i = De(e.vnode.el);
|
|
989
|
-
i ? n.ancestor = new
|
|
990
|
+
i ? n.ancestor = new V(i, t.ancestorScrolledToBottom) : console.warn("[VueFoundation] No scollable ancestor found for component:", e);
|
|
990
991
|
}
|
|
991
|
-
t.windowScrolledToBottom && (n.window = new
|
|
992
|
+
t.windowScrolledToBottom && (n.window = new V(window, t.windowScrolledToBottom)), e[le] = n;
|
|
992
993
|
}
|
|
993
994
|
function on(e) {
|
|
994
995
|
var n, i, s;
|
|
@@ -1008,7 +1009,7 @@ function De(e) {
|
|
|
1008
1009
|
const n = window.getComputedStyle(t);
|
|
1009
1010
|
return Z.includes(n.overflow) || Z.includes(n.overflowX) || Z.includes(n.overflowY) ? t : De(t);
|
|
1010
1011
|
}
|
|
1011
|
-
class
|
|
1012
|
+
class V {
|
|
1012
1013
|
constructor(t, n) {
|
|
1013
1014
|
E(this, "isTripped", !1);
|
|
1014
1015
|
E(this, "onScrollWithContext", this.onScroll.bind(this));
|
|
@@ -1040,25 +1041,27 @@ function ve(e, t) {
|
|
|
1040
1041
|
}
|
|
1041
1042
|
const rn = {
|
|
1042
1043
|
mounted: an
|
|
1043
|
-
},
|
|
1044
|
-
function an(e) {
|
|
1045
|
-
e.addEventListener("click", (
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1044
|
+
}, A = Symbol("ConfirmState");
|
|
1045
|
+
function an(e, t) {
|
|
1046
|
+
e.addEventListener("click", (n) => {
|
|
1047
|
+
var r, l;
|
|
1048
|
+
const i = Date.now(), s = ((r = t.value) == null ? void 0 : r.text) !== void 0 ? t.value.text : "Confirm";
|
|
1049
|
+
if (e[A]) {
|
|
1050
|
+
if (i - e[A].initTime < 300)
|
|
1049
1051
|
return;
|
|
1050
|
-
e[
|
|
1052
|
+
e[A].resetHandler(), e.dispatchEvent(new Event("confirm"));
|
|
1051
1053
|
return;
|
|
1052
1054
|
}
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
initTime:
|
|
1055
|
+
n.preventDefault(), n.stopImmediatePropagation();
|
|
1056
|
+
const o = {
|
|
1057
|
+
initTime: i,
|
|
1056
1058
|
preconfirmHtml: e.innerHTML,
|
|
1057
1059
|
resetHandler: () => {
|
|
1058
|
-
|
|
1060
|
+
var a;
|
|
1061
|
+
s && (e.innerHTML = o.preconfirmHtml), (a = t.value) != null && a.class && e.classList.remove(t.value.class), e.blur(), e.removeEventListener("mouseout", o.resetHandler), delete e[A];
|
|
1059
1062
|
}
|
|
1060
1063
|
};
|
|
1061
|
-
e[
|
|
1064
|
+
e[A] = o, s && (e.innerHTML = s), (l = t.value) != null && l.class && e.classList.add(t.value.class), e.addEventListener("mouseout", o.resetHandler);
|
|
1062
1065
|
});
|
|
1063
1066
|
}
|
|
1064
1067
|
const cn = {
|
|
@@ -1091,7 +1094,7 @@ function hn(e, t) {
|
|
|
1091
1094
|
const g = /* @__PURE__ */ new Date();
|
|
1092
1095
|
g.getFullYear() == o.getFullYear() && g.getMonth() == o.getMonth() && g.getDate() == o.getDate() && (n = "at", r = "HH:mm");
|
|
1093
1096
|
}
|
|
1094
|
-
r || (r =
|
|
1097
|
+
r || (e.attributes.getNamedItem("date-only") !== null ? r = M.defaultDateFormat : r = M.defaultDateTimeFormat);
|
|
1095
1098
|
let l = G(o, r);
|
|
1096
1099
|
return n && (l = n + " " + l), l;
|
|
1097
1100
|
}
|
|
@@ -1110,7 +1113,7 @@ const mn = {
|
|
|
1110
1113
|
beforeMount: Ee,
|
|
1111
1114
|
updated: Ee,
|
|
1112
1115
|
unmounted: $e
|
|
1113
|
-
},
|
|
1116
|
+
}, N = Symbol("HasAutoFocused"), re = [];
|
|
1114
1117
|
function vn() {
|
|
1115
1118
|
re.forEach(Ae);
|
|
1116
1119
|
}
|
|
@@ -1122,17 +1125,17 @@ function Ee(e, t) {
|
|
|
1122
1125
|
if (!t.value)
|
|
1123
1126
|
return $e(e);
|
|
1124
1127
|
const n = new Date(t.value), i = (r = e.attributes.getNamedItem("base-time")) == null ? void 0 : r.value, s = n.getTime() - (i ? new Date(i).getTime() - t.value * 1e3 : 0), o = e.getAttribute("no-seconds") === null;
|
|
1125
|
-
e[
|
|
1128
|
+
e[N] || re.push(e), e[N] = {
|
|
1126
1129
|
startTs: s,
|
|
1127
1130
|
includeSeconds: o
|
|
1128
1131
|
}, Ae(e);
|
|
1129
1132
|
}
|
|
1130
1133
|
function Ae(e) {
|
|
1131
|
-
const t = e[
|
|
1134
|
+
const t = e[N], n = Math.round((Date.now() - t.startTs) / 1e3);
|
|
1132
1135
|
e.innerText = yn(n, t.includeSeconds);
|
|
1133
1136
|
}
|
|
1134
1137
|
function $e(e) {
|
|
1135
|
-
e[
|
|
1138
|
+
e[N] && (Qe(re, e), delete e[N]), e.innerText = "-";
|
|
1136
1139
|
}
|
|
1137
1140
|
function yn(e, t) {
|
|
1138
1141
|
const n = [], i = Math.floor(e / 86400);
|
|
@@ -1142,17 +1145,17 @@ function yn(e, t) {
|
|
|
1142
1145
|
const o = Math.floor(e / 60);
|
|
1143
1146
|
return (i || s || o) && n.push(o + "m"), t ? n.length || n.push("0m") : (e -= o * 60, n.push(e + "s")), n.join(" ");
|
|
1144
1147
|
}
|
|
1145
|
-
const
|
|
1148
|
+
const $ = Symbol("InfiniteScrollHandler"), gn = {
|
|
1146
1149
|
mounted(e, t) {
|
|
1147
|
-
e[
|
|
1150
|
+
e[$] = new V(e, t.value);
|
|
1148
1151
|
},
|
|
1149
1152
|
updated(e, t) {
|
|
1150
1153
|
var n;
|
|
1151
|
-
(n = e[
|
|
1154
|
+
(n = e[$]) == null || n.uninstall(), e[$] = new V(e, t.value);
|
|
1152
1155
|
},
|
|
1153
1156
|
unmounted(e) {
|
|
1154
1157
|
var t;
|
|
1155
|
-
(t = e[
|
|
1158
|
+
(t = e[$]) == null || t.uninstall(), delete e[$];
|
|
1156
1159
|
}
|
|
1157
1160
|
}, En = {
|
|
1158
1161
|
beforeMount: Te,
|
|
@@ -1165,7 +1168,7 @@ const Tn = {
|
|
|
1165
1168
|
mounted: we,
|
|
1166
1169
|
updated: we,
|
|
1167
1170
|
unmounted: Be
|
|
1168
|
-
},
|
|
1171
|
+
}, F = Symbol("TooltipState");
|
|
1169
1172
|
function we(e, t) {
|
|
1170
1173
|
var i;
|
|
1171
1174
|
let n = ((i = e.attributes.getNamedItem("tip")) == null ? void 0 : i.value) ?? t.value;
|
|
@@ -1174,13 +1177,13 @@ function we(e, t) {
|
|
|
1174
1177
|
content: n,
|
|
1175
1178
|
html: e.getAttribute("html") !== null
|
|
1176
1179
|
};
|
|
1177
|
-
e[
|
|
1180
|
+
e[F] ? e[F].configure(s) : e[F] = new wn(e, s);
|
|
1178
1181
|
} else
|
|
1179
1182
|
Be(e);
|
|
1180
1183
|
}
|
|
1181
1184
|
function Be(e) {
|
|
1182
1185
|
var t;
|
|
1183
|
-
(t = e[
|
|
1186
|
+
(t = e[F]) == null || t.destroy(), delete e[F];
|
|
1184
1187
|
}
|
|
1185
1188
|
class wn {
|
|
1186
1189
|
constructor(t, n) {
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
interface IOptions {
|
|
2
2
|
unhandledErrorSupportText: string;
|
|
3
3
|
errorHandler: (err: Error) => void;
|
|
4
|
+
defaultDateFormat: string;
|
|
4
5
|
defaultDateTimeFormat: string;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
export const VfOptions: IOptions = {
|
|
8
9
|
unhandledErrorSupportText: 'please contact support',
|
|
9
10
|
errorHandler: err => console.error('Unhandled error:', err),
|
|
10
|
-
|
|
11
|
+
defaultDateFormat: 'M/d/yy',
|
|
12
|
+
defaultDateTimeFormat: 'M/d/yy H:mm'
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
export function configureVf(options: Partial<IOptions>) {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { DirectiveBinding } from 'vue';
|
|
1
2
|
import type { ObjectDirective } from 'vue';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
interface ConfirmButtonOptions {
|
|
5
|
+
text?: string | null;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const vConfirmButton: ObjectDirective<HTMLElement, ConfirmButtonOptions> = {
|
|
4
10
|
mounted: fn
|
|
5
11
|
};
|
|
6
12
|
|
|
@@ -14,9 +20,10 @@ interface IConfirmElement {
|
|
|
14
20
|
[ConfirmState]?: IConfirmState;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
function fn(el: HTMLElement & IConfirmElement) {
|
|
23
|
+
function fn(el: HTMLElement & IConfirmElement, binding: DirectiveBinding<ConfirmButtonOptions>) {
|
|
18
24
|
el.addEventListener('click', e => {
|
|
19
25
|
const now = Date.now();
|
|
26
|
+
const confirmText = binding.value?.text !== undefined ? binding.value.text : 'Confirm';
|
|
20
27
|
|
|
21
28
|
if (el[ConfirmState]) {
|
|
22
29
|
if (now - el[ConfirmState].initTime < 300) {
|
|
@@ -35,15 +42,18 @@ function fn(el: HTMLElement & IConfirmElement) {
|
|
|
35
42
|
initTime: now,
|
|
36
43
|
preconfirmHtml: el.innerHTML,
|
|
37
44
|
resetHandler: () => {
|
|
38
|
-
el.innerHTML = confirmState.preconfirmHtml;
|
|
45
|
+
if (confirmText) el.innerHTML = confirmState.preconfirmHtml;
|
|
46
|
+
if (binding.value?.class) el.classList.remove(binding.value.class);
|
|
39
47
|
el.blur();
|
|
40
48
|
|
|
41
49
|
el.removeEventListener('mouseout', confirmState.resetHandler);
|
|
42
50
|
delete el[ConfirmState];
|
|
43
51
|
}
|
|
44
52
|
};
|
|
53
|
+
|
|
45
54
|
el[ConfirmState] = confirmState;
|
|
46
|
-
el.innerHTML =
|
|
55
|
+
if (confirmText) el.innerHTML = confirmText;
|
|
56
|
+
if (binding.value?.class) el.classList.add(binding.value.class);
|
|
47
57
|
|
|
48
58
|
el.addEventListener('mouseout', confirmState.resetHandler);
|
|
49
59
|
});
|
|
@@ -38,7 +38,11 @@ function getDateTimeValue(el: HTMLElement, binding: DirectiveBinding<string>) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (!formatSpec) {
|
|
41
|
-
|
|
41
|
+
if (el.attributes.getNamedItem('date-only') !== null) {
|
|
42
|
+
formatSpec = VfOptions.defaultDateFormat;
|
|
43
|
+
} else {
|
|
44
|
+
formatSpec = VfOptions.defaultDateTimeFormat;
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
let result = format(theDate, formatSpec);
|
package/.yarn/install-state.gz
DELETED
|
Binary file
|