151 lines
5.7 KiB
JavaScript
151 lines
5.7 KiB
JavaScript
import { LoadingOutlined } from '@ant-design/icons-vue';
|
|
import { defineComponent, h, useSlots, computed, mergeProps, unref, withCtx, createVNode, renderSlot, createCommentVNode, createBlock, openBlock, ref, useSSRContext } from 'vue';
|
|
import { ssrRenderComponent, ssrRenderClass, ssrRenderSlot, ssrRenderAttrs } from 'vue/server-renderer';
|
|
import { b as baseButtonIconSize, u as usePrefix, i as icons } from './BasicIconOld-93vAWohq.mjs';
|
|
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import { L as Button } from './server.mjs';
|
|
import { S as Spin } from './index-BMAjr3Fm.mjs';
|
|
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "BasicIcon",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
icon: {},
|
|
color: { default: null },
|
|
size: {}
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const { prefixCls } = usePrefix("icons");
|
|
const tempIcon = ref();
|
|
const refIcon = ref();
|
|
tempIcon.value = icons[`${props.icon}`];
|
|
const color = computed(() => {
|
|
return props.color;
|
|
});
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(`<span${ssrRenderAttrs(mergeProps({
|
|
ref_key: "refIcon",
|
|
ref: refIcon,
|
|
style: { color: color.value },
|
|
class: [[unref(prefixCls)], "!flex"]
|
|
}, _attrs))} data-v-a7e11651>${tempIcon.value ?? ""}</span>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
_sfc_main$1.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/BasicPacks/BasicIcon.vue");
|
|
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
};
|
|
const BasicIcon = /* @__PURE__ */ Object.assign(_export_sfc(_sfc_main$1, [["__scopeId", "data-v-a7e11651"]]), { __name: "BasicPacksBasicIcon" });
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "BasicButton",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
icon: {},
|
|
iconSize: { default: baseButtonIconSize },
|
|
iconClass: { default: "" },
|
|
suffixIcon: { type: Boolean },
|
|
type: {},
|
|
size: {},
|
|
loading: { type: Boolean },
|
|
curve: { type: Boolean, default: false }
|
|
},
|
|
setup(__props) {
|
|
const indicator = h(LoadingOutlined, {
|
|
style: {
|
|
fontSize: "24px"
|
|
},
|
|
spin: true
|
|
});
|
|
const slot = useSlots();
|
|
const _class = computed(() => {
|
|
if (!slot.default) {
|
|
return "!px-1 !py-1";
|
|
}
|
|
return "";
|
|
});
|
|
const _loading = computed(() => {
|
|
if (props.loading) {
|
|
return "flex";
|
|
} else return "unset";
|
|
});
|
|
const { prefixCls } = usePrefix("main-button");
|
|
const props = __props;
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_AButton = Button;
|
|
const _component_ASpin = Spin;
|
|
const _cssVars = { style: {
|
|
":--v0012da73": _loading.value
|
|
} };
|
|
_push(ssrRenderComponent(_component_AButton, mergeProps({
|
|
type: props.type,
|
|
size: props.size,
|
|
class: [unref(prefixCls), _class.value, __props.curve ? "!rounded-full" : ""],
|
|
disabled: __props.loading
|
|
}, _attrs, _cssVars), {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_component_ASpin, {
|
|
spinning: __props.loading,
|
|
size: "small",
|
|
class: "absolute",
|
|
style: { "position-area": "center" },
|
|
indicator: unref(indicator)
|
|
}, null, _parent2, _scopeId));
|
|
_push2(`<div class="${ssrRenderClass([[{ "flex-row-reverse": __props.suffixIcon }, __props.loading ? "op-30" : ""], "flex items-center gap-1 justify-center flex-row-reverse gap-2 py-1 px-2 w-full h-full transition-all text-xs"])}"${_scopeId}>`);
|
|
if (_ctx.$slots.default) {
|
|
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
|
|
} else {
|
|
_push2(`<!---->`);
|
|
}
|
|
if (__props.icon) {
|
|
_push2(ssrRenderComponent(BasicIcon, {
|
|
size: __props.iconSize,
|
|
icon: __props.icon,
|
|
class: __props.iconClass
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
_push2(`<!---->`);
|
|
}
|
|
_push2(`</div>`);
|
|
} else {
|
|
return [
|
|
createVNode(_component_ASpin, {
|
|
spinning: __props.loading,
|
|
size: "small",
|
|
class: "absolute",
|
|
style: { "position-area": "center" },
|
|
indicator: unref(indicator)
|
|
}, null, 8, ["spinning", "indicator"]),
|
|
createVNode("div", {
|
|
class: ["flex items-center gap-1 justify-center flex-row-reverse gap-2 py-1 px-2 w-full h-full transition-all text-xs", [{ "flex-row-reverse": __props.suffixIcon }, __props.loading ? "op-30" : ""]]
|
|
}, [
|
|
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
|
|
__props.icon ? (openBlock(), createBlock(BasicIcon, {
|
|
key: 1,
|
|
size: __props.iconSize,
|
|
icon: __props.icon,
|
|
class: __props.iconClass
|
|
}, null, 8, ["size", "icon", "class"])) : createCommentVNode("", true)
|
|
], 2)
|
|
];
|
|
}
|
|
}),
|
|
_: 3
|
|
}, _parent));
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/BasicPacks/BasicButton.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
const BasicButton = Object.assign(_sfc_main, { __name: "BasicPacksBasicButton" });
|
|
|
|
export { BasicButton as B };
|