You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
6.9 KiB
1 lines
6.9 KiB
{"ast":null,"code":"import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, mergeProps, unref, withCtx, createElementBlock, Fragment, renderSlot, normalizeClass, createCommentVNode } from 'vue';\nimport { ElIcon } from '../../icon/index.mjs';\nimport { useButton } from './use-button.mjs';\nimport { buttonProps, buttonEmits } from './button.mjs';\nimport { useButtonCustomStyle } from './button-custom.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nconst __default__ = defineComponent({\n name: \"ElButton\"\n});\nconst _sfc_main = /* @__PURE__ */defineComponent({\n ...__default__,\n props: buttonProps,\n emits: buttonEmits,\n setup(__props, {\n expose,\n emit\n }) {\n const props = __props;\n const buttonStyle = useButtonCustomStyle(props);\n const ns = useNamespace(\"button\");\n const {\n _ref,\n _size,\n _type,\n _disabled,\n _props,\n shouldAddSpace,\n handleClick\n } = useButton(props, emit);\n const buttonKls = computed(() => [ns.b(), ns.m(_type.value), ns.m(_size.value), ns.is(\"disabled\", _disabled.value), ns.is(\"loading\", props.loading), ns.is(\"plain\", props.plain), ns.is(\"round\", props.round), ns.is(\"circle\", props.circle), ns.is(\"text\", props.text), ns.is(\"link\", props.link), ns.is(\"has-bg\", props.bg)]);\n expose({\n ref: _ref,\n size: _size,\n type: _type,\n disabled: _disabled,\n shouldAddSpace\n });\n return (_ctx, _cache) => {\n return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({\n ref_key: \"_ref\",\n ref: _ref\n }, unref(_props), {\n class: unref(buttonKls),\n style: unref(buttonStyle),\n onClick: unref(handleClick)\n }), {\n default: withCtx(() => [_ctx.loading ? (openBlock(), createElementBlock(Fragment, {\n key: 0\n }, [_ctx.$slots.loading ? renderSlot(_ctx.$slots, \"loading\", {\n key: 0\n }) : (openBlock(), createBlock(unref(ElIcon), {\n key: 1,\n class: normalizeClass(unref(ns).is(\"loading\"))\n }, {\n default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))]),\n _: 1\n }, 8, [\"class\"]))], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), {\n key: 1\n }, {\n default: withCtx(() => [_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), {\n key: 0\n })) : renderSlot(_ctx.$slots, \"icon\", {\n key: 1\n })]),\n _: 3\n })) : createCommentVNode(\"v-if\", true), _ctx.$slots.default ? (openBlock(), createElementBlock(\"span\", {\n key: 2,\n class: normalizeClass({\n [unref(ns).em(\"text\", \"expand\")]: unref(shouldAddSpace)\n })\n }, [renderSlot(_ctx.$slots, \"default\")], 2)) : createCommentVNode(\"v-if\", true)]),\n _: 3\n }, 16, [\"class\", \"style\", \"onClick\"]);\n };\n }\n});\nvar Button = /* @__PURE__ */_export_sfc(_sfc_main, [[\"__file\", \"button.vue\"]]);\nexport { Button as default };","map":{"version":3,"names":["name","buttonStyle","useButtonCustomStyle","props","ns","useNamespace","_ref","_size","_type","_disabled","_props","shouldAddSpace","handleClick","useButton","emit","buttonKls","computed","b","m","value","is","loading","plain","round","circle","text","link","bg","expose","ref","size","type","disabled","_ctx","_cache","openBlock","createBlock","resolveDynamicComponent","tag","mergeProps","ref_key","unref"],"sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n ref=\"_ref\"\n v-bind=\"_props\"\n :class=\"buttonKls\"\n :style=\"buttonStyle\"\n @click=\"handleClick\"\n >\n <template v-if=\"loading\">\n <slot v-if=\"$slots.loading\" name=\"loading\" />\n <el-icon v-else :class=\"ns.is('loading')\">\n <component :is=\"loadingIcon\" />\n </el-icon>\n </template>\n <el-icon v-else-if=\"icon || $slots.icon\">\n <component :is=\"icon\" v-if=\"icon\" />\n <slot v-else name=\"icon\" />\n </el-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"{ [ns.em('text', 'expand')]: shouldAddSpace }\"\n >\n <slot />\n </span>\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useButton } from './use-button'\nimport { buttonEmits, buttonProps } from './button'\nimport { useButtonCustomStyle } from './button-custom'\n\ndefineOptions({\n name: 'ElButton',\n})\n\nconst props = defineProps(buttonProps)\nconst emit = defineEmits(buttonEmits)\n\nconst buttonStyle = useButtonCustomStyle(props)\nconst ns = useNamespace('button')\nconst { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } =\n useButton(props, emit)\nconst buttonKls = computed(() => [\n ns.b(),\n ns.m(_type.value),\n ns.m(_size.value),\n ns.is('disabled', _disabled.value),\n ns.is('loading', props.loading),\n ns.is('plain', props.plain),\n ns.is('round', props.round),\n ns.is('circle', props.circle),\n ns.is('text', props.text),\n ns.is('link', props.link),\n ns.is('has-bg', props.bg),\n])\n\ndefineExpose({\n /** @description button html element */\n ref: _ref,\n /** @description button size */\n size: _size,\n /** @description button type */\n type: _type,\n /** @description button disabled */\n disabled: _disabled,\n /** @description whether adding space */\n shouldAddSpace,\n})\n</script>\n"],"mappings":";;;;;;;mCAoCc;EACZA,IAAM;AACR;;;;;;;;;;IAKM,MAAAC,WAAA,GAAcC,oBAAA,CAAqBC,KAAK;IACxC,MAAAC,EAAA,GAAKC,YAAA,CAAa,QAAQ;IAC1B;MAAEC,IAAM;MAAAC,KAAA;MAAOC,KAAO;MAAAC,SAAA;MAAWC,MAAQ;MAAAC,cAAA;MAAgBC;IAAY,IACzEC,SAAU,CAAAV,KAAA,EAAOW,IAAI;IACjB,MAAAC,SAAA,GAAYC,QAAA,CAAS,MAAM,CAC/BZ,EAAA,CAAGa,CAAE,IACLb,EAAA,CAAGc,CAAE,CAAAV,KAAA,CAAMW,KAAK,GAChBf,EAAA,CAAGc,CAAE,CAAAX,KAAA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