UNPKG

@joker.front/ui

Version:

Joker-UI | Official native UI component library for Joker Framework. Minimalist design with full-scene components, responsive layout & dynamic interactions. Access dev docs, API references & real-world case studies on official site.

1,400 lines 479 kB
var An = Object.defineProperty; var On = (t, i, e) => i in t ? An(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e; var n = (t, i, e) => On(t, typeof i != "symbol" ? i + "" : i, e); import { Component as h, SCOPE_ID as u, createElement as P, createCommand as Be, VNode as C, combinedReply as G, ShallowObserver as Nt, createText as gt, observer as Ge, Watcher as Fn, registerGlobalFunction as Nn, registerGlobalComponent as Mn } from "@joker.front/core"; var Pn = Object.defineProperty, Jn = Object.getOwnPropertyNames, Hn = (t, i, e) => i in t ? Pn(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e, Ze = (t, i) => function() { return i || (0, t[Jn(t)[0]])((i = { exports: {} }).exports, i), i.exports; }, Fe = (t, i, e) => Hn(t, typeof i != "symbol" ? i + "" : i, e); function _e(t) { return t !== null && typeof t == "object"; } function zt(t) { return Object.prototype.toString.call(t) === "[object Object]"; } function en(t) { if (t === null || typeof t != "object") return t; let i; Array.isArray(t) ? i = [] : i = {}; let e = Object.keys(t); for (let s of e) { let r = t[s]; typeof r == "object" ? i[s] = en(r) : i[s] = r; } return i; } function Re(t, i = "") { let e = i.split("."), s = t, r, o = e.length; for (let a = 0; a < o; a++) { let l = e[a]; if (!s) break; if (a === o - 1) { r = s[l]; break; } s = s[l]; } return r; } function Bt(t, i, e) { return Array.isArray(t) && Array.isArray(i) ? Kn(t, i) : tn(t, i); } function tn(t, i, e) { if (t === i) return !0; let s = _e(t), r = _e(i); return s && r ? zt(t) && zt(i) ? Object.keys(t).length !== Object.keys(i).length ? !1 : JSON.stringify(t) === JSON.stringify(i) : t === i : !s && !r ? String(t) === String(i) : !1; } function ce(t, i) { let e = t.indexOf(i); return e > -1 && t.splice(e, 1), t; } function ut(t, i) { let e = t.findIndex((s) => i(s)); return e > -1 && t.splice(e, 1), t; } function Kn(t, i, e) { if (t.length !== i.length) return !1; for (let s = 0; s < t.length; s++) if (tn(t[s], i[s]) === !1) return !1; return !0; } function sn(t) { return Array.apply(null, { length: t }).map((i, e) => e); } function Qe(t = 32) { let i = [], e = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ]; for (let s = 0; s < t; s++) { let r = Math.round(Math.random() * (e.length - 1)); i.push(e[r]); } return i.join(""); } function Vn(t, i = "-") { return t = t || "", t.split(/(?=[A-Z])/).map((s) => s.toLowerCase()).join(i); } function jn(t = "") { return t.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); } function zn() { let t = []; function i(r) { return t.push(r), () => { ce(t, r); }; } function e() { t = []; } function s(r) { ce(t, r); } return { add: i, callbacks: t, reset: e, remove: s }; } var rn = "warn", Ut = ["silent", "error", "warn", "info"]; function Yt() { let t = /* @__PURE__ */ new Date(); function i(e, s = 2) { return e.toString().padStart(s, "0"); } return i(t.getHours()) + ":" + i(t.getMinutes()) + ":" + i(t.getSeconds()) + ":" + i(t.getMilliseconds(), 3); } function Mt(t, i, e, s) { Ut.indexOf(t) <= Ut.indexOf(rn) && (s === void 0 ? console[t](`${Yt()} [${i}]:`, e) : console[t](`${Yt()} [${i}]:`, e, s)); } function Bn(t, i, e) { Mt("info", t, i, e); } function Un(t, i, e) { Mt("warn", t, i, e); } function Yn(t, i, e) { Mt("error", t, i, e); } function Wn(t) { rn = t; } var W = { info: Bn, warn: Un, error: Yn, setLoggerLeve: Wn }, Xn = class { constructor(t = "hex") { Fe(this, "format"), Fe(this, "h", 0), Fe(this, "s", 100), Fe(this, "v", 100), Fe(this, "a", 100), Fe(this, "value", ""), this.format = t; } setVal(t, i) { this[t] = i, this.doOnChange(); } toRgb() { return It(this.h, this.s, this.v); } setFormat(t) { this.format = t, this.doOnChange(); } fromString(t) { if (!t) { this.h = 0, this.s = 100, this.v = 100, this.doOnChange(); return; } let i = (e, s, r) => { this.h = Math.max(0, Math.min(360, e)), this.s = Math.max(0, Math.min(100, s)), this.v = Math.max(0, Math.min(100, r)), this.doOnChange(); }; if (t.indexOf("rgb") !== -1) { let e = t.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((s) => s !== "").map((s, r) => r > 2 ? parseFloat(s) : parseInt(s, 10)); if (e.length === 4 ? this.a = Math.floor(e[3] * 100) : e.length === 3 && (this.a = 100), e.length >= 3) { let { h: s, s: r, v: o } = Wt(e[0], e[1], e[2]); i(s, r, o); } } else if (t.indexOf("#") !== -1) { let e = t.replace("#", "").trim(); if (!/^(?:[0-9a-fA-F]{3}){1,2}|[0-9a-fA-F]{8}$/.test(e)) return; let s = 0, r = 0, o = 0; e.length === 3 ? (s = xe(e[0] + e[0]), r = xe(e[1] + e[1]), o = xe(e[2] + e[2])) : (e.length === 6 || e.length === 8) && (s = xe(e.substring(0, 2)), r = xe(e.substring(2, 4)), o = xe(e.substring(4, 6))), e.length === 8 ? this.a = Math.floor(xe(e.substring(6)) / 255 * 100) : (e.length === 3 || e.length === 6) && (this.a = 100); let { h: a, s: l, v: d } = Wt(s, r, o); i(a, l, d); } } compare(t) { return Math.abs(t.h - this.h) < 2 && Math.abs(t.s - this.s) < 1 && Math.abs(t.v - this.v) < 1 && Math.abs(t.a - this.a) < 1; } doOnChange() { let { h: t, s: i, v: e, a: s, format: r } = this; switch (r) { case "rgba": let { r: o, g: a, b: l } = It(t, i, e); this.value = `rgba(${o}, ${a}, ${l}, ${s / 100})`; break; default: this.value = Zn(t, i, e, s / 100); } } }, qn = function(t) { return typeof t == "string" && t.indexOf(".") !== -1 && parseFloat(t) === 1; }, Gn = function(t) { return typeof t == "string" && t.indexOf("%") !== -1; }, Je = function(t, i) { qn(t) && (t = "100%"); let e = Gn(t); return t = Math.min(i, Math.max(0, parseFloat(t))), e && (t = parseInt(t * i, 10) / 100), Math.abs(t - i) < 1e-6 ? 1 : t % i / parseFloat(i); }, _t = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 }, xe = function(t) { return t.length === 2 ? (_t[t[0].toUpperCase()] || +t[0]) * 16 + (_t[t[1].toUpperCase()] || +t[1]) : _t[t[1].toUpperCase()] || +t[1]; }; function Wt(t, i, e) { t = Je(t, 255), i = Je(i, 255), e = Je(e, 255); let s = Math.max(t, i, e), r = Math.min(t, i, e), o = 0, a = 0, l = s, d = s - r; if (a = s === 0 ? 0 : d / s, s === r) o = 0; else { switch (s) { case t: o = (i - e) / d + (i < e ? 6 : 0); break; case i: o = (e - t) / d + 2; break; case e: o = (t - i) / d + 4; break; } o /= 6; } return { h: o * 360, s: a * 100, v: l * 100 }; } function It(t, i, e) { t = Je(t, 360) * 6, i = Je(i, 100), e = Je(e, 100); let s = Math.floor(t), r = t - s, o = e * (1 - i), a = e * (1 - r * i), l = e * (1 - (1 - r) * i), d = s % 6, p = [e, a, o, o, l, e][d], c = [l, e, e, a, o, o][d], f = [o, o, l, e, e, a][d]; return { r: Math.round(p * 255), g: Math.round(c * 255), b: Math.round(f * 255) }; } var Zn = function(t, i, e, s) { let r = It(t, i, e), o = Math.floor(s * r.r + (1 - s) * 255), a = Math.floor(s * r.g + (1 - s) * 255), l = Math.floor(s * r.b + (1 - s) * 255); return "#" + ("0" + o.toString(16)).slice(-2) + ("0" + a.toString(16)).slice(-2) + ("0" + l.toString(16)).slice(-2); }; function Ue(t, i, e = {}) { let s, r = !1, o = 0, a = () => { s && clearTimeout(s); }, l = (p) => { a(), r = !p; }; function d(...p) { let c = Date.now() - o; if (r) return; let f = () => { o = Date.now(), i.apply(d, p); }; function k() { s = void 0; } !e.noLeading && e.debounceMode && !s && f(), a(), e.debounceMode === void 0 && c > t ? e.noLeading ? (o = Date.now(), e.noTrailing || (s = setTimeout(e.debounceMode ? k : f, t))) : f() : e.noTrailing !== !0 && (s = setTimeout(e.debounceMode ? k : f, e.debounceMode === void 0 ? t - c : t)); } return d.cancel = l, d; } function me(t, i, e = !1) { return Ue(t, i, { debounceMode: e !== !1 }); } const Qn = /([\:\-\_]+(.))/g, ea = /^moz([A-Z])/; function m(t) { return `__joker_${t}_name__`; } function on() { return !isNaN(Number(document.documentMode)); } function nn() { return navigator.userAgent.indexOf("Edge") > -1; } function Ye(t, i) { if (t === i) return !0; if (!(t instanceof Array) || !(i instanceof Array) || t.length !== i.length) return !1; for (let e = 0; e !== t.length; ++e) if (t[e] !== i[e]) return !1; return !0; } function ta(t) { let i = []; const e = ["transform", "transition", "animation"], s = ["ms-", "webkit-"]; return e.forEach((r) => { const o = t[r]; r && o && s.forEach((a) => { i.push(a + r + ":" + o); }); }), i.join(";"); } function Et(t) { if (t !== void 0) return t = (t != null ? t : "").toString(), isNaN(parseFloat(t)) ? t : t + "px"; } function Xt(t) { let i = !1; return function(...e) { i || (i = !0, window.requestAnimationFrame((s) => { t.apply(this, e), i = !1; })); }; } function sa() { return !!window.navigator.userAgent.match(/firefox/i); } function ra(t) { return t && t.nodeType === Node.ELEMENT_NODE; } const at = (t, i) => { let e = t; for (; e; ) { if ([window, document, document.documentElement].includes(e)) return document.documentElement; if (ia(e)) return e; e = e.parentNode; } return e; }, ia = (t, i) => { const e = an(t, "overflow"); return e == null ? void 0 : e.match(/(scroll|auto|overlay)/); }, an = function(t, i) { if (!t || !i) return null; i = oa(i), i === "float" && (i = "cssFloat"); try { var e = document.defaultView && document.defaultView.getComputedStyle(t, ""); return t.style[i] || e && e[i] || null; } catch { return t.style[i]; } }, oa = function(t) { return t.replace(Qn, function(i, e, s, r) { return r ? s.toUpperCase() : s; }).replace(ea, "Moz$1"); }, na = (t, i) => { if (!t || !i) return !1; const e = t.getBoundingClientRect(); let s; return [window, document, document.documentElement, null, void 0].includes(i) ? s = { top: 0, right: window.innerWidth, bottom: window.innerHeight, left: 0 } : s = i.getBoundingClientRect(), e.top < s.bottom && e.bottom > s.top && e.right > s.left && e.left < s.right; }; let qt = () => document.documentElement.style.objectFit !== void 0; class aa extends h { constructor() { super(...arguments); n(this, "propsOption", { type: "default", nativeType: "button" }); n(this, "name", m("button")); n(this, "model", { loading: !1 }); } created() { this.$syncProp("loading"); } handleClick(e) { this.$trigger("click", void 0, e); } handleMouseEnter(e) { this.$trigger("mouseenter", void 0, e); } handleMouseLeave(e) { this.$trigger("mouseleave", void 0, e); } } let la = { render: function(t) { return [t.createElement("button", { disabled: "@(props.disabled || model.loading)", autofocus: "@props.autofocus", type: "@props.nativeType", "@click": "handleClick", "@mouseenter": "handleMouseEnter", "@mouseleave": "handleMouseLeave", class: "@([ 'jk-button', props.type || '', props.size || '', { 'is-link': props.link, 'is-disabled': props.disabled, 'is-loading': model.loading, 'is-plain': props.plain, 'is-round': props.round, 'is-circle': props.circle, 'is-fullwidth': props.fullWidth }, props.class ])" }, [t.createCommand("if", "model.loading", [t.createElement("i", { class: "jk-icon-loading" }, [])]), t.createCommand("if", "props.icon && !model.loading", [t.createElement("i", { class: "@props.icon" }, [])]), t.createCommand("if", "$sections && $sections.default && !props.circle", [t.createElement("span", {}, [t.createCommand("RenderSection", "")])])])]; } }, da = { component: aa }; var ps, cs; let Ae = class extends (cs = da.component, ps = u, cs) { constructor() { super(...arguments); n(this, ps, "4c4aa2cd"); n(this, "template", la.render); } }, pa = { render: function(t) { return [t.createElement("div", { class: "jk-button-group" }, [t.createCommand("RenderSection", "")])]; } }, ca = class extends h { }, ua = { component: ca }; var us, hs; let ha = class extends (hs = ua.component, us = u, hs) { constructor() { super(...arguments); n(this, us, "e5cf9734"); n(this, "template", pa.render); } }; class ma extends h { } let fa = { render: function(t) { return [t.createElement("i", { class: "jk-icon-@props.name @(props.class||'')" }, [])]; } }, ga = { component: ma }, _a = class extends ga.component { constructor() { super(...arguments); n(this, "template", fa.render); } }; class Ea extends h { constructor() { super(...arguments); n(this, "propsOption", { span: { type: Number, default: 24 }, tag: "div", offset: Number, pull: Number, push: Number }); } mounted() { this.$render([ P( this.props.tag, { class: "jk-col @classVal", style: "@styleVal" }, [Be("RenderSection")] ) ]); } get classVal() { let e = []; return this.setClassColItem("span", e), this.setClassColItem("offset", e), this.setClassColItem("pull", e), this.setClassColItem("push", e), this.setClassSizeItem("xs", e), this.setClassSizeItem("sm", e), this.setClassSizeItem("md", e), this.setClassSizeItem("lg", e), this.setClassSizeItem("xl", e), e.join(" "); } get styleVal() { let e = ""; if (this.gutter) { let s = this.gutter / 2 + "px"; e += `padding-left:${s};`, e += `padding-right:${s};`; } return e; } get gutter() { var s; let e = (s = this.$rootVNode) == null ? void 0 : s.closest((r) => r instanceof C.Component && r.component && r.component.name === m("layout_row")); return e ? e.component.props.gutter : 0; } setClassColItem(e, s) { let r = this.props[e]; (r || r === 0) && s.push(e === "span" ? `col-${r}` : `col-${e}-${r}`); } setClassSizeItem(e, s) { let r = this.props[e]; if (typeof r == "object") for (let o in r) s.push(o === "span" ? `col-${e}-${r}` : `col-${e}-${o}-${r}`); else r !== void 0 && s.push(`col-${e}-${r}`); } } let Ca = { render: function(t) { return []; } }, va = { component: Ea }; var ms, fs; let ba = class extends (fs = va.component, ms = u, fs) { constructor() { super(...arguments); n(this, ms, "064a439e"); n(this, "template", Ca.render); } }; class ya extends h { constructor() { super(...arguments); n(this, "name", m("layout_row")); n(this, "propsOption", { tag: "div", justify: "start", gutter: Number }); n(this, "template", () => [ P( this.props.tag, { class: "jk-row @classVal", style: "@styleVal" }, [Be("RenderSection")] ) ]); } get classVal() { let e = []; return this.props.justify !== "start" && e.push("is-justify-" + this.props.justify), this.props.align && e.push("is-align-" + this.props.align), this.props.type === "flex" && e.push("is-flex"), e.join(" "); } get styleVal() { let e = ""; if (this.props.gutter) { let s = this.props.gutter / 2; e += `margin-left:-${s}px;`, e += `margin-right:-${s}px;`; } return e; } } let Ra = { component: ya }; var gs, _s; let wa = class extends (_s = Ra.component, gs = u, _s) { constructor() { super(...arguments); n(this, gs, "af1ff92c"); } }; class ka extends h { constructor() { super(...arguments); n(this, "propsOption", { href: "javascript:void(0)", underline: !0 }); } handleClick(e) { this.$trigger("click", void 0, e); } } let Sa = { render: function(t) { return [t.createElement("a", { class: "@([ 'jk-link', props.type || 'default', { 'is-disabled': props.disabled, 'is-underline': props.underline && !props.disabled }, props.class, props.size ])", href: "@props.href", target: "@props.target", "@click": "handleClick" }, [t.createCommand("if", "props.icon", [t.createElement("i", { class: "@props.icon" }, [])]), t.createCommand("if", "$sections && $sections.default", [t.createElement("span", {}, [t.createCommand("RenderSection", "")])])])]; } }, xa = { component: ka }; var Es, Cs; let Pt = class extends (Cs = xa.component, Es = u, Cs) { constructor() { super(...arguments); n(this, Es, "5698f682"); n(this, "template", Sa.render); } }; class z extends h { constructor(...e) { super(...e); n(this, "formItemOption"); this.$on("created", () => { var s, r; (r = (s = this.model).value) != null || (s.value = void 0), this.$syncProp("value"), this.formItemOption = Ta(this); }); } get isError() { var e; return this.props.error || ((e = this.formItemOption) == null ? void 0 : e.ctrl.validateState.value) === "error"; } get form() { var e, s; return (s = (e = this.$root) == null ? void 0 : e.closest((r) => r instanceof C.Component && r.component.name === m("form"))) == null ? void 0 : s.component; } get sizeClass() { var e; return this.props.size || ((e = this.form) == null ? void 0 : e.props.size); } triggerValidate() { this.$trigger("validate"); } get value() { return this.model.value; } set value(e) { this.model.value = e; } } function Ta(t) { var e, s, r, o; if (!t.props.name) return; if (!("value" in t.model)) { W.warn("formCtrl", "The registered control does not conform to the rules of the Form form control. The [model.value] property is missing.", t); return; } let i = t.props.name; if (t.$root && t.$root instanceof C.Node) { let a = (s = (e = t.$root) == null ? void 0 : e.closest((d) => d instanceof C.Component && d.component.name === m("form"))) == null ? void 0 : s.component; if (!a) return; let l = (o = (r = t.$root) == null ? void 0 : r.closest((d) => d instanceof C.Component && d.component.name === m("form-item"))) == null ? void 0 : o.component; return a.registerFormCtrl(i, { ctrl: t, formItem: l }), t.$on("validate", () => { a == null || a.validate(i).catch((d) => { }); }), t.$on("beforeDestroy", () => { a.unRegisterFormCtrl(i, t); }), { form: a, formItem: l, ctrl: a.ctrls[i], unRegisterFormCtrl: () => { a.unRegisterFormCtrl(i, t); } }; } } class $a extends z { constructor() { super(...arguments); n(this, "model", { value: void 0, focus: !1 }); } mounted() { this.$watch( () => this.checked, (e) => { this.$getRef("radio").output.checked = e; } ), this.$getRef("radio").output.checked = this.checked; } get checked() { return this.group ? this.value === this.props.value : this.props.value; } get group() { var e; return (e = this.$rootVNode) == null ? void 0 : e.closest((s) => { var r; return s instanceof C.Component && ((r = s.component) == null ? void 0 : r.name) === m("radio_group"); }); } get value() { return this.group ? this.group.component.model.value : this.model.value; } set value(e) { this.group ? this.group.component.checked(e) : this.model.value = e, this.$getRef("radio").output.checked = this.model.value === this.props.value; } get isDisabled() { var e, s, r; return (r = (s = (e = this.group) == null ? void 0 : e.component) == null ? void 0 : s.props.disabled) != null ? r : this.props.disabled; } get tabIndex() { return this.isDisabled || this.group && this.value !== this.props.value ? -1 : 0; } get size() { var e; return ((e = this.group) == null ? void 0 : e.component.props.size) || this.props.size; } handleKeydown(e) { this.isDisabled || (this.value = this.props.value); } handleFocus(e) { this.model.focus = !0; } handleBlur(e) { this.model.focus = !1; } handleChange(e) { var s, r; (s = e.target) != null && s.output.checked && (this.value = this.props.value, (r = this.group) == null || r.component.handleChange(e, this.value)), this.$trigger("change", this.value), this.triggerValidate(); } handleClick(e) { this.$trigger("click", void 0, e); } } let Da = { render: function(t) { return [t.createElement("label", { class: "@([ 'jk-radio', props.border && size && size, props.class, isDisabled && 'is-disabled', model.focus && 'is-focus', props.border && 'is-border', checked && 'is-checked' ])", role: "radio", "aria-checked": "@(checked)", "aria-disabled": "@isDisabled", tabindex: "@tabIndex", "@click": "handleClick", "@keydown.space.stop.prevent": "handleKeydown" }, [t.createElement("span", { class: "input @(isDisabled?'is-disabled':'') @(checked?'is-checked':'')" }, [t.createElement("span", { class: "target" }, []), t.createElement("input", { ref: "radio", type: "radio", value: "@props.label", name: "@props.name", disabled: "@isDisabled", tabindex: "-1", autocomplete: "off", "@focus": "handleFocus", "@blur": "handleBlur", "@change": "handleChange" }, [])]), t.createCommand("if", "$sections.default || props.label", [t.createElement("span", { class: "label", "@keydown.stop": "__UNDEFINED_BUFFER__" }, [t.createCommand("if", "$sections.default", [t.createCommand("RenderSection", "")]), t.createCommand("else", "", [t.createCodeFunction("props.label")])])])])]; } }, Ia = { component: $a }; var vs, bs; let ln = class extends (bs = Ia.component, vs = u, bs) { constructor() { super(...arguments); n(this, vs, "1a4217e0"); n(this, "template", Da.render); } }; class La extends z { constructor() { super(...arguments); n(this, "name", m("radio_group")); n(this, "model", { value: void 0 }); } handleKeydown(e) { let s = e.event, r = e.event.target, o = this.$getRef("group").output, a = r.tagName === "INPUT" ? "[type=radio]" : "[role=radio]", l = o.querySelectorAll(a); if (l && l.length) { let d = Array.from(l).indexOf(r), p = l.length, c = o.querySelectorAll("[role=radio]"); switch (s.key) { case "ArrowLeft": case "ArrowUp": s.stopPropagation(), s.preventDefault(), d === 0 ? (c[p - 1].click(), c[p - 1].focus()) : (c[d - 1].click(), c[d - 1].focus()); break; case "ArrowRight": case "ArrowDown": s.stopPropagation(), s.preventDefault(), d === l.length - 1 ? (c[0].click(), c[0].focus()) : (c[d + 1].click(), c[d + 1].focus()); break; } } } checked(e) { this.model.value = e; } handleChange(e, s) { this.$trigger("change", s, e), this.triggerValidate(); } } let Aa = { render: function(t) { return [t.createElement("div", { class: "@(['jk-radio-group', props.class])", ref: "group", "@keydown": "handleKeydown" }, [t.createCommand("RenderSection", "")])]; } }, Oa = { component: La }, Fa = class extends Oa.component { constructor() { super(...arguments); n(this, "template", Aa.render); } }; class Na extends z { constructor() { super(...arguments); n(this, "model", { value: void 0, focus: !1 }); } mounted() { this.$watch( () => this.value === this.props.value, (e) => { this.$getRef("radio").output.checked = e; } ), this.$getRef("radio").output.checked = this.value === this.props.value; } get group() { var e; return (e = this.$rootVNode) == null ? void 0 : e.closest((s) => { var r; return s instanceof C.Component && ((r = s.component) == null ? void 0 : r.name) === m("radio_group"); }); } get value() { return this.group ? this.group.component.model.value : this.model.value; } set value(e) { this.group ? this.group.component.checked(e) : this.model.value = e, this.$getRef("radio").output.checked = this.model.value === this.props.value; } get isDisabled() { var e, s, r; return (r = (s = (e = this.group) == null ? void 0 : e.component) == null ? void 0 : s.props.disabled) != null ? r : this.props.disabled; } get tabIndex() { return this.isDisabled || this.group && this.value !== this.props.value ? -1 : 0; } get size() { var e; return ((e = this.group) == null ? void 0 : e.component.props.size) || this.sizeClass; } handleKeydown(e) { this.isDisabled || (this.value = this.props.value); } handleFocus(e) { this.model.focus = !0; } handleBlur(e) { this.model.focus = !1; } handleChange(e) { var s, r; (s = e.target) != null && s.output.checked && (this.value = this.props.value, (r = this.group) == null || r.component.handleChange(e, this.value)), this.$trigger("change", this.value), this.triggerValidate(); } } let Ma = { render: function(t) { return [t.createElement("label", { class: "@([ 'jk-radio-button', size, props.class, isDisabled && 'is-disabled', model.focus && 'is-focus', value === props.value && 'is-checked' ])", role: "radio", "aria-checked": "@(value === props.label)", "aria-disabled": "@isDisabled", tabindex: "@tabIndex", "@keydown.space.stop.prevent": "handleKeydown" }, [t.createElement("input", { ref: "radio", type: "radio", value: "@props.label", name: "@props.name", disabled: "@isDisabled", tabindex: "-1", autocomplete: "off", "@focus": "handleFocus", "@blur": "handleBlur", "@change": "handleChange" }, []), t.createElement("span", { class: "target", "@keydown.stop": "__UNDEFINED_BUFFER__" }, [t.createCommand("if", "$sections.default", [t.createCommand("RenderSection", "")]), t.createCommand("else", "", [t.createCodeFunction("props.label")])])])]; } }, Pa = { component: Na }; var ys, Rs; let Ja = class extends (Rs = Pa.component, ys = u, Rs) { constructor() { super(...arguments); n(this, ys, "48cc174d"); n(this, "template", Ma.render); } }; class Ha extends z { constructor() { super(...arguments); n(this, "model", { value: void 0, focus: !1, disabled: !1 }); n(this, "propsOption", { value: { default: !1 } }); } mounted() { this.$syncProp("disabled"), this.$watch( () => this.value === this.props.label, (e) => { this.$getRef("checkbox").output.checked = e; } ), this.$getRef("checkbox").output.checked = !!this.value; } get group() { var e; return (e = this.$rootVNode) == null ? void 0 : e.closest((s) => { var r; return s instanceof C.Component && ((r = s.component) == null ? void 0 : r.name) === m("checkbox-group"); }); } get value() { return this.group ? this.group.component.model.value.indexOf(this.props.value) > -1 : this.model.value; } set value(e) { this.group ? this.group.component.checked(this.props.value, e) : this.model.value = e, this.$getRef("checkbox").output.checked = !!this.model.value; } get isLimitDisabled() { if (this.group) { let { max: e, min: s } = this.group.component.props, r = this.group.component.model.value; return !!(e || s) && r.length >= e && !this.value || r.length <= s && this.value; } return !1; } get isDisabled() { var e, s, r; return (r = (s = (e = this.group) == null ? void 0 : e.component) == null ? void 0 : s.props.disabled) != null ? r : this.model.disabled || this.isLimitDisabled; } get tabIndex() { return this.isDisabled || this.group && this.value !== this.props.label ? -1 : 0; } get size() { var e, s; return ((e = this.group) == null ? void 0 : e.component.props.size) || this.props.size || ((s = this.formItemOption) == null ? void 0 : s.form.props.size); } handleKeydown(e) { this.isDisabled || (this.value = !this.value); } handleFocus(e) { this.model.focus = !0; } handleBlur(e) { this.model.focus = !1; } handleChange(e) { var s; this.group ? (this.value = !this.value, (s = this.group) == null || s.component.handleChange(e)) : this.value = !this.value, this.$trigger("change", this.value), this.triggerValidate(); } } let Ka = { render: function(t) { return [t.createElement("label", { class: "@([ 'jk-checkbox', size, isDisabled && 'is-disabled', model.focus && 'is-focus', props.border && 'is-border', value && 'is-checked', props.indeterminate && 'is-indeterminate', props.class ])", role: "checkbox", "aria-checked": "@value", "aria-disabled": "@isDisabled", tabindex: "@tabIndex", "@keydown.space.stop.prevent": "handleKeydown" }, [t.createElement("span", { class: "input @(isDisabled?'is-disabled':'') @(value?'is-checked':'')" }, [t.createElement("span", { class: "target" }, []), t.createElement("input", { ref: "checkbox", type: "checkbox", value: "@(props.label)", checked: "@value", name: "@props.name", disabled: "@isDisabled", tabindex: "-1", autocomplete: "off", "@focus": "handleFocus", "@blur": "handleBlur", "@change": "handleChange" }, [])]), t.createCommand("if", "$sections.default || props.label", [t.createElement("span", { class: "label", "@keydown.stop": "__UNDEFINED_BUFFER__" }, [t.createCommand("if", "$sections.default", [t.createCommand("RenderSection", "")]), t.createCommand("else", "", [t.createCodeFunction("props.label")])])])])]; } }, Va = { component: Ha }; var ws, ks; let et = class extends (ks = Va.component, ws = u, ks) { constructor() { super(...arguments); n(this, ws, "69ac0612"); n(this, "template", Ka.render); } }; class ja extends z { constructor() { super(...arguments); n(this, "propsOption", { min: Number, max: Number, value: [] }); n(this, "name", m("checkbox-group")); n(this, "model", { value: [] }); } created() { this.$syncProp("value"); } handleKeydown(e) { let s = e.event, r = e.event.target, o = this.$getRef("group").output, a = r.tagName === "INPUT" ? "[type=checkbox]" : "[role=checkbox]", l = o.querySelectorAll(a); if (l && l.length) { let d = Array.from(l).indexOf(r), p = l.length, c = o.querySelectorAll("[role=checkbox]"); switch (s.key) { case "ArrowLeft": case "ArrowUp": s.stopPropagation(), s.preventDefault(), d === 0 ? c[p - 1].focus() : c[d - 1].focus(); break; case "ArrowRight": case "ArrowDown": s.stopPropagation(), s.preventDefault(), d === l.length - 1 ? c[0].focus() : c[d + 1].focus(); break; case " ": case "Enter": s.stopPropagation(), s.preventDefault(), c[d].click(); } } } checked(e, s) { if (s) this.model.value.push(e); else { let r = this.model.value.indexOf(e); this.model.value.splice(r, 1); } } handleChange(e) { this.$trigger("change", this.model.value, e), this.triggerValidate(); } } let za = { render: function(t) { return [t.createElement("div", { class: "jk-checkbox-group", ref: "group", "@keydown": "handleKeydown" }, [t.createCommand("RenderSection", "")])]; } }, Ba = { component: ja }, Ua = class extends Ba.component { constructor() { super(...arguments); n(this, "template", za.render); } }; class Ya extends z { constructor() { super(...arguments); n(this, "model", { value: void 0, focus: !1, disabled: !1 }); } mounted() { this.$syncProp("disabled"), this.$watch( () => this.value === this.props.label, (e) => { this.$getRef("checkbox").output.checked = e; } ), this.$getRef("checkbox").output.checked = !!this.value; } get group() { var e; return (e = this.$rootVNode) == null ? void 0 : e.closest((s) => { var r; return s instanceof C.Component && ((r = s.component) == null ? void 0 : r.name) === m("checkbox-group"); }); } get value() { return this.group ? this.group.component.model.value.indexOf(this.props.value) > -1 : this.model.value; } set value(e) { this.group ? this.group.component.checked(this.props.value, e) : this.model.value = e, this.$getRef("checkbox").output.checked = !!this.model.value; } get isLimitDisabled() { if (this.group) { const { max: e, min: s } = this.group.component.props, r = this.group.component.model.value; return !!(e || s) && r.length >= e && !this.value || r.length <= s && this.value; } return !1; } get isDisabled() { var e, s, r; return (r = (s = (e = this.group) == null ? void 0 : e.component) == null ? void 0 : s.props.disabled) != null ? r : this.model.disabled || this.isLimitDisabled; } get tabIndex() { return this.isDisabled || this.group && this.value !== this.props.label ? -1 : 0; } get size() { var e; return ((e = this.group) == null ? void 0 : e.component.props.size) || this.sizeClass; } handleKeydown(e) { this.isDisabled || (this.value = !this.value); } handleFocus(e) { this.model.focus = !0; } handleBlur(e) { this.model.focus = !1; } handleChange(e) { var s; this.group ? (this.value = !this.value, (s = this.group) == null || s.component.handleChange(e)) : this.value = !this.value, this.$trigger("change", this.value), this.triggerValidate(); } } let Wa = { render: function(t) { return [t.createElement("label", { class: "@(['jk-checkbox-button', size, { 'is-disabled': isDisabled, 'is-focus': model.focus, 'is-checked': value }])", role: "checkbox", "aria-checked": "@value", "aria-disabled": "@isDisabled", tabindex: "@tabIndex", "@keydown.space.stop.prevent": "handleKeydown" }, [t.createElement("input", { ref: "checkbox", type: "checkbox", checked: "@value", name: "@props.name", disabled: "@isDisabled", tabindex: "-1", autocomplete: "off", "@focus": "handleFocus", "@blur": "handleBlur", "@change": "handleChange" }, []), t.createElement("span", { class: "target", "@keydown.stop": "__UNDEFINED_BUFFER__" }, [t.createCommand("RenderSection", ""), t.createCommand("if", "!($sections && $sections.default)", [t.createCodeFunction("props.label")])])])]; } }, Xa = { component: Ya }; var Ss, xs; let qa = class extends (xs = Xa.component, Ss = u, xs) { constructor() { super(...arguments); n(this, Ss, "bdcd7e21"); n(this, "template", Wa.render); } }; class Ga extends z { constructor() { super(...arguments); n(this, "model", { hovering: !1, focused: !1, isComposing: !1 }); n(this, "propsOption", { type: "text", autocomplete: "off", maxlength: Number, minlength: Number }); } mounted() { this.setNativeInputValue(), this.$watch( () => this.model.value, () => { this.setNativeInputValue(); } ), this.$watch( () => this.props.value, () => { this.triggerValidate(); } ), this.$watch( () => this.props.type, () => { this.setNativeInputValue(); } ), this.props.autofocus && setTimeout(() => { var e; if (this.$root) { let s = (e = this.$getRef("input")) == null ? void 0 : e.output; s == null || s.focus(); } }); } get isWordLimitVisible() { return this.props.showWordLimit && this.props.maxlength && this.props.type === "text" && !this.props.disabled && !this.props.readonly; } get validateIcon() { let e = this.formItemOption.ctrl.validateState.value; return e && { validating: "jk-icon-loading", success: "jk-icon-circle-check", error: "jk-icon-circle-close" }[e]; } get textLength() { return typeof this.value == "number" ? String(this.value).length : (this.value || "").length; } get inputExceed() { return this.isWordLimitVisible && this.textLength > this.props.maxlength; } get nativeInputValue() { return this.value === null || this.value === void 0 ? "" : String(this.value); } get showClear() { return (this.props.forceShowClearable || this.props.clearable && !this.props.disabled && !this.props.readonly) && this.nativeInputValue && (this.model.focused || this.model.hovering); } get suffixVisable() { var e; return this.$sections.suffix || this.props.suffixIcon || this.showClear || this.isWordLimitVisible || ((e = this.formItemOption) == null ? void 0 : e.ctrl.validateState.value) && this.props.statusIcon; } clear() { this.value = "", this.setNativeInputValue(), this.$trigger("input", this.value), this.$trigger("change", this.value), this.$trigger("clear"), this.$trigger("validate"); } focus() { var e; (e = this.$getRef("input")) == null || e.output.focus(); } blur() { var e; (e = this.$getRef("input")) == null || e.output.blur(); } select() { var e; (e = this.$getRef("input")) == null || e.output.select(); } //#region 事件 handleHover(e, s) { this.model.hovering = s; } handleFocus(e) { this.model.focused = !0, this.$trigger("focus", this.value, e); } handleBlur(e) { this.model.focused = !1, this.$trigger("blur", this.value, e), this.triggerValidate(); } handleChange(e) { this.$trigger("change", e.event.target.value); } handleInput(e) { this.model.isComposing || e.event.target.value !== this.value && (this.$trigger("input", e.event.target.value, e), this.value = e.event.target.value); } handleCompositionStart(e) { this.$trigger("compositionstart", void 0, e), this.model.isComposing = !0; } handleCompositionUpdate(e) { this.$trigger("compositionupdate", void 0, e); } handleCompositionEnd(e) { this.$trigger("compositionend", void 0, e), this.model.isComposing && (this.model.isComposing = !1, this.handleInput(e)); } handleKeydown(e) { this.model.isComposing || this.$trigger("keydown", this.value, e); } handleKeyup(e) { this.$trigger("keyup", this.value, e); } handleSuffixClick(e) { this.$trigger("suffix-click", this.value, e); } //#endregion setNativeInputValue() { var s; let e = (s = this.$getRef("input")) == null ? void 0 : s.output; e && e.value !== this.nativeInputValue && (e.value = this.nativeInputValue); } } let Za = { render: function(t) { return [t.createElement("div", { ref: "container", class: "@([ 'jk-input', props.class, sizeClass, { 'is-disabled': props.disabled, 'is-exceed': inputExceed, 'is-error': isError, group: $sections.prepend || $sections.append, 'group-append': $sections.append, 'group-prepend': $sections.prepend, prefix: $sections.prefix || props.prefixIcon, suffix: $sections.suffix || props.suffixIcon || props.clearable } ])", "@mouseenter": "handleHover(true)", "@mouseleave": "handleHover(false)" }, [t.createCommand("if", "$sections.prepend", [t.createElement("div", { class: "prepend" }, [t.createCommand("RenderSection", '"prepend"')])]), t.createElement("input", { ref: "input", tabindex: "@props.tabindex", disabled: "@props.disabled", readonly: "@props.readonly", autocomplete: "@props.autocomplete", autofocus: "@props.autofocus", "aria-label": "@props.label", placeholder: "@props.placeholder", maxlength: "@props.maxlength", minlength: "@props.minlength", "@input": "handleInput", "@focus": "handleFocus", "@blur": "handleBlur", "@change": "handleChange", "@keydown": "handleKeydown", "@keyup": "handleKeyup", "@compositionstart": "handleCompositionStart", "@compositionupdate": "handleCompositionUpdate", "@compositionend": "handleCompositionEnd", type: "@props.type" }, []), t.createCommand("if", "$sections.prefix || props.prefixIcon", [t.createElement("span", { class: "prefix" }, [t.createCommand("RenderSection", '"prefix"'), t.createCommand("if", "props.prefixIcon", [t.createElement("i", { class: "@props.prefixIcon" }, [])])])]), t.createCommand("if", "suffixVisable", [t.createElement("span", { class: "suffix" }, [t.createCommand("if", "!showClear || !isWordLimitVisible", [t.createCommand("RenderSection", '"suffix"'), t.createCommand("if", "props.suffixIcon", [t.createElement("i", { class: "@props.suffixIcon", "@click": "handleSuffixClick" }, [])])]), t.createCommand("if", "showClear", [t.createElement("i", { class: "clear jk-icon-circle-close", "@mousedown.stop": "__UNDEFINED_BUFFER__", "@click.stop": "clear" }, [])]), t.createCommand("elseif", "isWordLimitVisible", [t.createElement("span", { class: "count" }, [t.createElement("span", { class: "inner" }, [t.createCodeFunction("textLength"), t.createText("/"), t.createCodeFunction("props.maxlength")])])]), t.createCommand("elseif", "formItemOption && formItemOption.ctrl.validateState.value", [t.createElement("i", { class: "validate @validateIcon" }, [])])])]), t.createCommand("if", "$sections.append", [t.createElement("div", { class: "append" }, [t.createCommand("RenderSection", '"append"')])])])]; } }, Qa = { component: Ga }; var Ts, $s; let ke = class extends ($s = Qa.component, Ts = u, $s) { constructor() { super(...arguments); n(this, Ts, "f5fdf4cd"); n(this, "template", Za.render); } }, ne; const el = ` height:0 !important; visibility:hidden !important; overflow:hidden !important; position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important `, tl = [ "letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing" ]; function sl(t) { const i = window.getComputedStyle(t), e = i.getPropertyValue("box-sizing"), s = parseFloat(i.getPropertyValue("padding-bottom")) + parseFloat(i.getPropertyValue("padding-top")), r = parseFloat(i.getPropertyValue("border-bottom-width")) + parseFloat(i.getPropertyValue("border-top-width")); return { contextStyle: tl.map((a) => `${a}:${i.getPropertyValue(a)}`).join(";"), paddingSize: s, borderSize: r, boxSizing: e }; } function Gt(t, i = 1, e) { ne || (ne = document.createElement("textarea"), document.body.appendChild(ne)); let { paddingSize: s, borderSize: r, boxSizing: o, contextStyle: a } = sl(t); ne.setAttribute("style", `${a};${el}`), ne.value = t.value || t.placeholder || ""; let l = ne.scrollHeight; const d = { height: "", minHeight: "" }; o === "border-box" ? l = l + r : o === "content-box" && (l = l - s), ne.value = ""; let p = ne.scrollHeight - s; if (i !== void 0) { let c = p * i; o === "border-box" && (c = c + s + r), l = Math.max(c, l), d.minHeight = `${c}px`; } if (e !== void 0) { let c = p * e; o === "border-box" && (c = c + s + r), l = Math.min(c, l); } return d.height = `${l}px`, ne.parentNode && ne.parentNode.removeChild(ne), ne = void 0, d; } class rl extends z { constructor() { super(...arguments); n(this, "model", { hovering: !1, focused: !1, textareaStyle: {}, isComposing: !1 }); n(this, "propsOption", { autocomplete: "off", maxlength: Number, minlength: Number, rows: Number }); } mounted() { this.setNativeInputValue(), this.$watch( () => this.props.value, () => { this.setNativeInputValue(); } ), this.$watch( () => this.value, () => { this.resize(); } ), this.resize(), this.props.autofocus && setTimeout(() => { var e; if (this.$root) { let s = (e = this.$getRef("input")) == null ? void 0 : e.output; s == null || s.focus(); } }); } get isWordLimitVisible() { return this.props.showWordLimit && this.props.maxlength && !this.props.disabled && !this.props.readonly; } get textLength() { return typeof this.value == "number" ? String(this.value).length : (this.value || "").length; } get inputExceed() { return this.isWordLimitVisible && this.textLength > this.props.maxlength; } get nativeInputValue() { return this.value === null || this.value === void 0 ? "" : String(this.value); } get style() { let e = []; return this.props.resize && e.push(`resize:${this.props.resize}`), this.model.textareaStyle.height && !this.props.rows && e.push(`height:${this.model.textareaStyle.height}`), this.model.textareaStyle["min-height"] && e.push(`min-height:${this.model.textareaStyle["min-height"]}`), e.join(";"); } clear() { this.$getRef("input") && (this.value = "", this.$getRef("input").output.value = ""); } focus() { var e; (e = this.$getRef("input")) == null || e.output.focus(); } blur() { var e; (e = this.$getRef("input")) == null || e.output.blur(); } select() { var e; (e = this.$getRef("input")) == null || e.output.select(); } resize() { var e, s; if (this.props.autosize) { let r = Gt( (e = this.$getRef("input")) == null ? void 0 : e.output, this.props.autosize.minRows, this.props.autosize.maxRows ); this.model.textareaStyle = { "min-height": r.minHeight, height: r.height }; } else { let r = Gt((s = this.$getRef("input")) == null ? void 0 : s.output).minHeight; this.model.textareaStyle = { height: r, "min-height": r }; } } //#region 事件 handleHover(e, s) { this.model.hovering = s; } handleFocus(e) { this.model.focused = !0, this.$trigger("focus", this.value, e); } handleBlur(e) { this.model.focused = !1, this.$trigger("blur", this.value, e), this.triggerValidate(); } handleChange(e) { this.$trigger("change", e.event.target.value); } handleInput(e) { this.model.isComposing || e.event.target.value !== this.value && (this.$trigger("input", e.event.target.value, e), this.value = e.event.target.value); } handleCompositionStart(e) { this.$trigger("compositionstart", void 0, e), this.model.isComposing = !0; } handleCompositionUpdate(e) { this.$trigger("compositionupdate", void 0, e); } handleCompositionEnd(e) { this.$trigger("compositionend", void 0, e), this.model.isComposing && (this.model.isComposing = !1, this.handleInput(e)); } handleKeyDown(e) { this.model.isComposing || this.$trigger("keydown", this.value, e); } //#endregion setNativeInputValue() { var s; let e = (s = this.$getRef("input")) == null ? void 0 : s.output; e && e.value !== this.nativeInputValue && (e.value = this.nativeInputValue); } } let il = { render: function(t) { return [t.createElement("div", { class: "@(['jk-textarea', props.class, { 'is-error': isError, 'is-disabled': props.disabled, 'is-exceed': inputExceed }])", "@mouseenter": "handleHover(true)", "@mouseleave": "handleHover(false)" }, [t.createElement("textarea", { ref: "input", tabindex: "@props.tabindex", disabled: "@props.disabled", readonly: "@props.readonly", autocomplete: "@props.autocomplete", autofocus: "@props.autofocus", "aria-label": "@props.label", placeholder: "@props.placeholder", maxlength: "@props.maxlength", minlength: "@props.minlength", rows: "@props.rows", style: "@style", "@input": "handleInput", "@focus": "handleFocus", "@blur": "handleBlur", "@change": "handleChange", "@keydown": "handleKeyDown", "@compositionstart": "handleCompositionStart", "@compositionupdate": "handleCompositionUpdate", "@compositionend": "handleCompositionEnd" }, [t.createText("")]), t.createCommand("if", "isWordLimitVisible", [t.createElement("span", { class: "count" }, [t.createCodeFunction("textLength"), t.createText("/"), t.createCodeFunction("this.props.maxlength")])])])]; } }, ol = { component: rl }; var Ds, Is; let nl = class extends (Is = ol.component, Ds = u, Is) { constructor() { super(...arguments); n(this, Ds, "f63929ec"); n(this, "template", il.render); } }; const X = "JOKERUI"; class al extends z { constructor() { super(...arguments); n(this, "components", { JokerInput: ke }); n(this, "propsOption", { step: { type: Number, default: 1 }, max: { type: Number, default: 1 / 0 }, min: { type: Number, default: -1 / 0 }, precision: Number }); n(this, "model", { userInput: null }); } mounted() { this.$watch( () => this.value, (e) => { let s = e === void 0 ? e : Number(e); if (e !== void 0) { if (isNaN(e)) return; if (this.props.stepStrictly) { let r = this.getPrecision(this.props.step), o = Math.pow(10, r); s = Math.round(s / this.props.step) * o * this.props.step / o, this.props.precision !== void 0 && (s = this.toPrecision(s, this.props.precision)); } if (s >= this.props.max && (s = this.props.max), s <= this.props.min && (s = this.props.min), this.value === s) return; this.value = Number(s), this.value = isNaN(this.value) ? void 0 : this.value, this.model.userInput = null, this.$trigger("input", s); } } ), this.value = this.value === void 0 ? void 0 : Number(this.value), this.value = isNaN(this.value) ? void 0 : this.value; } get controlsAtRight() { return !this.props.hiddenControls && this.props.controlsPosition === "right"; } get minDisabled() { return this.props.disabled ? !0 : this.decrease(this.value) < this.props.min; } get maxDisabled() { return this.props.disabled ? !0 : this.increase(this.value) > this.props.max; } get numPrecision() { let e = this.getPrecision(this.props.step); if (this.props.precision !== void 0) { if (this.props.precision >= 0 && this.props.precision === parseInt(this.props.precision.toString(), 10)) return e > this.props.precision && W.warn( X, "[number] The calculation precision of the value is greater t