llnet-vue-floating-form
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -1,4 +0,87 @@ | ||
import { _ as f } from "./Number-CSLyv0xc.js"; | ||
import { ref as r, onMounted as p, watch as T, openBlock as h, createElementBlock as v, normalizeClass as g, createElementVNode as u } from "vue"; | ||
import y from "quill"; | ||
const b = { class: "editor" }, _ = { | ||
__name: "Editor", | ||
props: { | ||
label: { | ||
type: String, | ||
default: "Floating standard" | ||
}, | ||
modelValue: { | ||
type: String, | ||
default: "" | ||
}, | ||
contentType: { | ||
type: String, | ||
default: "html" | ||
}, | ||
layout: { | ||
type: String, | ||
default: "floating-field", | ||
validator: (o) => ["floating-field", "floating-default"].includes(o) | ||
} | ||
}, | ||
emits: ["update:modelValue"], | ||
setup(o, { emit: s }) { | ||
const a = r(null), t = r(null); | ||
let l = null; | ||
const d = s, n = o; | ||
function c(e) { | ||
n.contentType === "html" ? m(e) : f(e); | ||
} | ||
function m(e) { | ||
t.value.root.innerHTML = e; | ||
} | ||
function f(e) { | ||
t.value.root.innerText = e; | ||
} | ||
return p(() => { | ||
var e; | ||
t.value = new y(a.value, { | ||
theme: "snow", | ||
modules: { | ||
toolbar: [ | ||
["bold", "italic", "underline", "strike"], | ||
["blockquote", "code-block"], | ||
[{ header: 1 }, { header: 2 }], | ||
[{ list: "ordered" }, { list: "bullet" }], | ||
[{ script: "sub" }, { script: "super" }], | ||
[{ indent: "-1" }, { indent: "+1" }], | ||
[{ direction: "rtl" }], | ||
[{ size: ["small", !1, "large", "huge"] }] | ||
] | ||
} | ||
}), c(n.modelValue), (e = t.value) == null || e.on("text-change", () => { | ||
let i = null; | ||
switch (n.contentType) { | ||
case "text": | ||
i = t.value.root.innerText; | ||
break; | ||
case "html": | ||
default: | ||
i = t.value.getSemanticHTML(); | ||
break; | ||
} | ||
l && clearTimeout(l), l = setTimeout(() => { | ||
d("update:modelValue", i); | ||
}, 500); | ||
}); | ||
}), T(() => n.modelValue, (e) => { | ||
t.value.root.innerHTML !== e && (t.value.hasFocus() || (l && clearTimeout(l), l = setTimeout(() => { | ||
t.value.root.innerHTML = e; | ||
}, 500))); | ||
}, { deep: !0 }), (e, i) => (h(), v("div", { | ||
class: g(o.layout) | ||
}, [ | ||
u("div", b, [ | ||
u("div", { | ||
ref_key: "editor", | ||
ref: a | ||
}, null, 512) | ||
]) | ||
], 2)); | ||
} | ||
}; | ||
export { | ||
f as default | ||
_ as default | ||
}; |
@@ -1,4 +0,90 @@ | ||
import { _ as f } from "./Number-CSLyv0xc.js"; | ||
import { ref as i, computed as c, openBlock as d, createElementBlock as g, normalizeClass as y, withDirectives as v, createElementVNode as b, mergeProps as V, vModelText as N, createVNode as M, createBlock as k, createCommentVNode as E } from "vue"; | ||
import { _ as w } from "./Label-eedKib_X.js"; | ||
import { _ as S } from "./InfoIcon-B2j-ihXV.js"; | ||
const h = { | ||
__name: "Number", | ||
props: { | ||
label: { | ||
type: String, | ||
default: "Floating standard" | ||
}, | ||
modelValue: { | ||
type: [String, Number], | ||
default: null | ||
}, | ||
modelModifiers: { | ||
type: Object, | ||
default: () => ({}) | ||
}, | ||
format: { | ||
type: String, | ||
default: "int", | ||
validator: (l) => ["int", "float"].includes(l) | ||
}, | ||
layout: { | ||
type: String, | ||
default: "floating-field", | ||
validator: (l) => ["floating-field", "floating-default"].includes(l) | ||
}, | ||
info: { | ||
type: Function, | ||
default: null | ||
}, | ||
infoMessage: { | ||
type: String, | ||
default: "" | ||
} | ||
}, | ||
emits: ["update:modelValue"], | ||
setup(l, { emit: m }) { | ||
const u = i(null), r = i(null); | ||
i(null); | ||
const t = l, s = m, n = c({ | ||
get: () => typeof t.modelValue == "number" || t.modelValue !== null ? Number(t.modelValue) : null, | ||
set: (e) => { | ||
t.format === "int" ? e = parseInt(e) : t.format === "float" && (e = parseFloat(e)), isNaN(e) && (e = null), s("update:modelValue", e); | ||
} | ||
}), p = (e) => { | ||
var a; | ||
t.modelModifiers && ((a = t.modelModifiers) != null && a.float) ? e.target.value = e.target.value.replace(/[^0-9\.\,]/g, "") : e.target.value = e.target.value.replace(/[^0-9]/g, ""), n.value = e.target.value; | ||
}; | ||
return (e, a) => { | ||
var f; | ||
return d(), g("div", { | ||
ref_key: "wrapperEl", | ||
ref: u, | ||
class: y([ | ||
((f = n.value) == null ? void 0 : f.length) === 0 ? "empty" : "has-content", | ||
l.layout === "floating-field" ? "floating-field" : "floating-default", | ||
l.info ? "has-info" : void 0 | ||
]) | ||
}, [ | ||
v(b("input", V({ | ||
ref_key: "inputEl", | ||
ref: r, | ||
type: "text", | ||
class: "input", | ||
placeholder: " ", | ||
"onUpdate:modelValue": a[0] || (a[0] = (o) => n.value = o) | ||
}, l.modelModifiers, { | ||
onInput: a[1] || (a[1] = (o) => p(o)), | ||
inputmode: "numeric" | ||
}), null, 16), [ | ||
[N, n.value] | ||
]), | ||
M(w, { label: l.label }, null, 8, ["label"]), | ||
l.info ? (d(), k(S, { | ||
key: 0, | ||
info: l.info, | ||
"input-el": r.value, | ||
"wrapper-el": u.value, | ||
value: n.value, | ||
message: l.infoMessage | ||
}, null, 8, ["info", "input-el", "wrapper-el", "value", "message"])) : E("", !0) | ||
], 2); | ||
}; | ||
} | ||
}; | ||
export { | ||
f as default | ||
h as default | ||
}; |
{ | ||
"name": "llnet-vue-floating-form", | ||
"private": false, | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "author": "LLNet", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
162006
2385
28
11