@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
90 lines (89 loc) • 2.8 kB
JavaScript
import { defineComponent as p, useSlots as m, inject as g, toRef as b, computed as h, openBlock as y, createBlock as R, unref as o, mergeProps as k, createSlots as B, withCtx as n, renderSlot as s, createTextVNode as _, toDisplayString as I } from "vue";
import "../button/index.mjs";
import { useProps as P, createIconProp as r, useNameHelper as S, useLocale as v, emitEvent as x } from "@vexip-ui/config";
import { isPromise as z } from "@vexip-ui/utils";
import { formResetProps as C } from "./props.mjs";
import { FORM_ACTIONS as T } from "./symbol.mjs";
import $ from "../button/button.mjs";
const L = /* @__PURE__ */ p({
name: "FormReset",
__name: "form-reset",
props: C,
setup(a) {
const e = P("formReset", a, {
size: null,
locale: null,
type: "default",
label: null,
dashed: null,
text: null,
simple: null,
ghost: null,
disabled: null,
loading: null,
circle: null,
loadingIcon: r(),
loadingEffect: null,
icon: r(),
color: null,
buttonType: null,
block: null,
onBeforeReset: {
default: null,
isFunc: !0
}
}), i = m(), l = g(T, null), c = S("form"), d = v("form", b(e, "locale")), u = h(() => !!l || e.inherit);
async function f() {
if (e.disabled) return;
let t = !0;
typeof e.onBeforeReset == "function" && (t = e.onBeforeReset(), z(t) && (t = await t)), t !== !1 && (l == null || l.reset(), x(e.onReset));
}
return (t, F) => (y(), R(o($), k(t.$attrs, {
inherit: u.value,
class: o(c).be("reset"),
size: o(e).size,
type: o(e).type,
simple: o(e).simple,
ghost: o(e).ghost,
dashed: o(e).dashed,
text: o(e).text,
disabled: o(e).disabled,
loading: o(e).loading,
circle: o(e).circle,
"loading-icon": o(e).loadingIcon,
"loading-effect": o(e).loadingEffect,
icon: o(e).icon,
color: o(e).color,
"button-type": o(e).buttonType,
block: o(e).block,
tag: o(e).tag,
onClick: f
}), B({
default: n(() => [
s(t.$slots, "default", {}, () => [
_(I(o(e).label || o(d).reset), 1)
])
]),
_: 2
}, [
i.icon ? {
name: "icon",
fn: n(() => [
s(t.$slots, "icon")
]),
key: "0"
} : void 0,
i.loading ? {
name: "loading",
fn: n(() => [
s(t.$slots, "loading")
]),
key: "1"
} : void 0
]), 1040, ["inherit", "class", "size", "type", "simple", "ghost", "dashed", "text", "disabled", "loading", "circle", "loading-icon", "loading-effect", "icon", "color", "button-type", "block", "tag"]));
}
});
export {
L as default
};
//# sourceMappingURL=form-reset.vue2.mjs.map