@element-plus/nightly 0.0.20240522 → 0.0.20240525
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.full.js +11 -8
- package/dist/index.full.min.js +9 -9
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +10 -10
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +11 -8
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/affix/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +117 -26
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +26 -117
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker2.mjs +7 -6
- package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
- package/es/components/index.mjs +4 -4
- package/es/components/popconfirm/index.mjs +2 -2
- package/es/components/popconfirm/src/popconfirm.mjs +47 -110
- package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm2.mjs +110 -47
- package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
- package/es/components/slider/src/button.mjs +93 -21
- package/es/components/slider/src/button.mjs.map +1 -1
- package/es/components/slider/src/button2.mjs +21 -93
- package/es/components/slider/src/button2.mjs.map +1 -1
- package/es/components/slider/src/slider2.mjs +1 -1
- package/es/components/switch/index.mjs +2 -2
- package/es/components/switch/src/switch.mjs +85 -242
- package/es/components/switch/src/switch.mjs.map +1 -1
- package/es/components/switch/src/switch2.mjs +242 -85
- package/es/components/switch/src/switch2.mjs.map +1 -1
- package/es/components/text/index.mjs +2 -2
- package/es/components/text/src/text.mjs +38 -24
- package/es/components/text/src/text.mjs.map +1 -1
- package/es/components/text/src/text2.mjs +24 -38
- package/es/components/text/src/text2.mjs.map +1 -1
- package/es/components/tree/src/tree.mjs +5 -2
- package/es/components/tree/src/tree.mjs.map +1 -1
- package/es/index.mjs +4 -4
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +117 -27
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +27 -117
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/color-picker/src/color-picker2.js +6 -5
- package/lib/components/color-picker/src/color-picker2.js.map +1 -1
- package/lib/components/index.js +4 -4
- package/lib/components/popconfirm/index.js +2 -2
- package/lib/components/popconfirm/src/popconfirm.js +48 -110
- package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm2.js +110 -48
- package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
- package/lib/components/slider/src/button.js +93 -22
- package/lib/components/slider/src/button.js.map +1 -1
- package/lib/components/slider/src/button2.js +22 -93
- package/lib/components/slider/src/button2.js.map +1 -1
- package/lib/components/slider/src/slider2.js +1 -1
- package/lib/components/switch/index.js +2 -2
- package/lib/components/switch/src/switch.js +85 -241
- package/lib/components/switch/src/switch.js.map +1 -1
- package/lib/components/switch/src/switch2.js +241 -85
- package/lib/components/switch/src/switch2.js.map +1 -1
- package/lib/components/text/index.js +2 -2
- package/lib/components/text/src/text.js +38 -24
- package/lib/components/text/src/text.js.map +1 -1
- package/lib/components/text/src/text2.js +24 -38
- package/lib/components/text/src/text2.js.map +1 -1
- package/lib/components/tree/src/tree.js +4 -1
- package/lib/components/tree/src/tree.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/theme-chalk/el-tree-select.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/tree-select.scss +5 -0
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker2.js","sources":["../../../../../../packages/components/color-picker/src/color-picker.vue"],"sourcesContent":["<template>\n <el-tooltip\n ref=\"popper\"\n :visible=\"showPicker\"\n :show-arrow=\"false\"\n :fallback-placements=\"['bottom', 'top', 'right', 'left']\"\n :offset=\"0\"\n :gpu-acceleration=\"false\"\n :popper-class=\"[ns.be('picker', 'panel'), ns.b('dropdown'), popperClass]\"\n :stop-popper-mouse-event=\"false\"\n effect=\"light\"\n trigger=\"click\"\n :teleported=\"teleported\"\n :transition=\"`${ns.namespace.value}-zoom-in-top`\"\n persistent\n @hide=\"setShowPicker(false)\"\n >\n <template #content>\n <div v-click-outside=\"handleClickOutside\" @keydown.esc=\"handleEsc\">\n <div :class=\"ns.be('dropdown', 'main-wrapper')\">\n <hue-slider ref=\"hue\" class=\"hue-slider\" :color=\"color\" vertical />\n <sv-panel ref=\"sv\" :color=\"color\" />\n </div>\n <alpha-slider v-if=\"showAlpha\" ref=\"alpha\" :color=\"color\" />\n <predefine\n v-if=\"predefine\"\n ref=\"predefine\"\n :color=\"color\"\n :colors=\"predefine\"\n />\n <div :class=\"ns.be('dropdown', 'btns')\">\n <span :class=\"ns.be('dropdown', 'value')\">\n <el-input\n ref=\"inputRef\"\n v-model=\"customInput\"\n :validate-event=\"false\"\n size=\"small\"\n @keyup.enter=\"handleConfirm\"\n @blur=\"handleConfirm\"\n />\n </span>\n <el-button\n :class=\"ns.be('dropdown', 'link-btn')\"\n text\n size=\"small\"\n @click=\"clear\"\n >\n {{ t('el.colorpicker.clear') }}\n </el-button>\n <el-button\n plain\n size=\"small\"\n :class=\"ns.be('dropdown', 'btn')\"\n @click=\"confirmValue\"\n >\n {{ t('el.colorpicker.confirm') }}\n </el-button>\n </div>\n </div>\n </template>\n <template #default>\n <div\n :id=\"buttonId\"\n ref=\"triggerRef\"\n :class=\"btnKls\"\n role=\"button\"\n :aria-label=\"buttonAriaLabel\"\n :aria-labelledby=\"buttonAriaLabelledby\"\n :aria-description=\"\n t('el.colorpicker.description', { color: modelValue || '' })\n \"\n :aria-disabled=\"colorDisabled\"\n :tabindex=\"colorDisabled ? -1 : tabindex\"\n @keydown=\"handleKeyDown\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n >\n <div v-if=\"colorDisabled\" :class=\"ns.be('picker', 'mask')\" />\n <div :class=\"ns.be('picker', 'trigger')\" @click=\"handleTrigger\">\n <span :class=\"[ns.be('picker', 'color'), ns.is('alpha', showAlpha)]\">\n <span\n :class=\"ns.be('picker', 'color-inner')\"\n :style=\"{\n backgroundColor: displayedColor,\n }\"\n >\n <el-icon\n v-show=\"modelValue || showPanelColor\"\n :class=\"[ns.be('picker', 'icon'), ns.is('icon-arrow-down')]\"\n >\n <arrow-down />\n </el-icon>\n <el-icon\n v-show=\"!modelValue && !showPanelColor\"\n :class=\"[ns.be('picker', 'empty'), ns.is('icon-close')]\"\n >\n <close />\n </el-icon>\n </span>\n </span>\n </div>\n </div>\n </template>\n </el-tooltip>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n watch,\n} from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { ElButton } from '@element-plus/components/button'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ClickOutside as vClickOutside } from '@element-plus/directives'\nimport { ElTooltip } from '@element-plus/components/tooltip'\nimport { ElInput } from '@element-plus/components/input'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n useDeprecated,\n useFocusController,\n useLocale,\n useNamespace,\n} from '@element-plus/hooks'\nimport { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { debugWarn } from '@element-plus/utils'\nimport { ArrowDown, Close } from '@element-plus/icons-vue'\nimport AlphaSlider from './components/alpha-slider.vue'\nimport HueSlider from './components/hue-slider.vue'\nimport Predefine from './components/predefine.vue'\nimport SvPanel from './components/sv-panel.vue'\nimport Color from './utils/color'\nimport {\n colorPickerContextKey,\n colorPickerEmits,\n colorPickerProps,\n} from './color-picker'\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\n\ndefineOptions({\n name: 'ElColorPicker',\n})\nconst props = defineProps(colorPickerProps)\nconst emit = defineEmits(colorPickerEmits)\n\nconst { t } = useLocale()\nconst ns = useNamespace('color')\nconst { formItem } = useFormItem()\nconst colorSize = useFormSize()\nconst colorDisabled = useFormDisabled()\n\nconst { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst hue = ref<InstanceType<typeof HueSlider>>()\nconst sv = ref<InstanceType<typeof SvPanel>>()\nconst alpha = ref<InstanceType<typeof AlphaSlider>>()\nconst popper = ref<TooltipInstance>()\nconst triggerRef = ref()\nconst inputRef = ref()\n\nconst {\n isFocused,\n handleFocus: _handleFocus,\n handleBlur,\n} = useFocusController(triggerRef, {\n beforeBlur(event) {\n return popper.value?.isFocusInsideContent(event)\n },\n afterBlur() {\n setShowPicker(false)\n resetColor()\n },\n})\n\nconst handleFocus = (event: FocusEvent) => {\n if (colorDisabled.value) return blur()\n _handleFocus(event)\n}\n\n// active-change is used to prevent modelValue changes from triggering.\nlet shouldActiveChange = true\n\nconst color = reactive(\n new Color({\n enableAlpha: props.showAlpha,\n format: props.colorFormat || '',\n value: props.modelValue,\n })\n) as Color\n\nconst showPicker = ref(false)\nconst showPanelColor = ref(false)\nconst customInput = ref('')\n\nconst displayedColor = computed(() => {\n if (!props.modelValue && !showPanelColor.value) {\n return 'transparent'\n }\n return displayedRgb(color, props.showAlpha)\n})\n\nconst currentColor = computed(() => {\n return !props.modelValue && !showPanelColor.value ? '' : color.value\n})\n\nconst buttonAriaLabel = computed<string | undefined>(() => {\n return !isLabeledByFormItem.value\n ? props.label || props.ariaLabel || t('el.colorpicker.defaultLabel')\n : undefined\n})\n\nuseDeprecated(\n {\n from: 'label',\n replacement: 'aria-label',\n version: '2.8.0',\n scope: 'el-color-picker',\n ref: 'https://element-plus.org/en-US/component/color-picker.html',\n },\n computed(() => !!props.label)\n)\n\nconst buttonAriaLabelledby = computed<string | undefined>(() => {\n return isLabeledByFormItem.value ? formItem?.labelId : undefined\n})\n\nconst btnKls = computed(() => {\n return [\n ns.b('picker'),\n ns.is('disabled', colorDisabled.value),\n ns.bm('picker', colorSize.value),\n ns.is('focused', isFocused.value),\n ]\n})\n\nfunction displayedRgb(color: Color, showAlpha: boolean) {\n if (!(color instanceof Color)) {\n throw new TypeError('color should be instance of _color Class')\n }\n\n const { r, g, b } = color.toRgb()\n return showAlpha\n ? `rgba(${r}, ${g}, ${b}, ${color.get('alpha') / 100})`\n : `rgb(${r}, ${g}, ${b})`\n}\n\nfunction setShowPicker(value: boolean) {\n showPicker.value = value\n}\n\nconst debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true })\n\nfunction show() {\n if (colorDisabled.value) return\n setShowPicker(true)\n}\n\nfunction hide() {\n debounceSetShowPicker(false)\n resetColor()\n}\n\nfunction resetColor() {\n nextTick(() => {\n if (props.modelValue) {\n color.fromString(props.modelValue)\n } else {\n color.value = ''\n nextTick(() => {\n showPanelColor.value = false\n })\n }\n })\n}\n\nfunction handleTrigger() {\n if (colorDisabled.value) return\n debounceSetShowPicker(!showPicker.value)\n}\n\nfunction handleConfirm() {\n color.fromString(customInput.value)\n}\n\nfunction confirmValue() {\n const value = color.value\n emit(UPDATE_MODEL_EVENT, value)\n emit('change', value)\n if (props.validateEvent) {\n formItem?.validate('change').catch((err) => debugWarn(err))\n }\n debounceSetShowPicker(false)\n // check if modelValue change, if not change, then reset color.\n nextTick(() => {\n const newColor = new Color({\n enableAlpha: props.showAlpha,\n format: props.colorFormat || '',\n value: props.modelValue,\n })\n if (!color.compare(newColor)) {\n resetColor()\n }\n })\n}\n\nfunction clear() {\n debounceSetShowPicker(false)\n emit(UPDATE_MODEL_EVENT, null)\n emit('change', null)\n if (props.modelValue !== null && props.validateEvent) {\n formItem?.validate('change').catch((err) => debugWarn(err))\n }\n resetColor()\n}\n\nfunction handleClickOutside(event: Event) {\n if (!showPicker.value) return\n hide()\n\n if (isFocused.value) {\n const _event = new FocusEvent('focus', event)\n handleBlur(_event)\n }\n}\n\nfunction handleEsc(event: KeyboardEvent) {\n event.preventDefault()\n event.stopPropagation()\n setShowPicker(false)\n resetColor()\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n switch (event.code) {\n case EVENT_CODE.enter:\n case EVENT_CODE.space:\n event.preventDefault()\n event.stopPropagation()\n show()\n inputRef.value.focus()\n break\n case EVENT_CODE.esc:\n handleEsc(event)\n break\n }\n}\n\nfunction focus() {\n triggerRef.value.focus()\n}\n\nfunction blur() {\n triggerRef.value.blur()\n}\n\nonMounted(() => {\n if (props.modelValue) {\n customInput.value = currentColor.value\n }\n})\n\nwatch(\n () => props.modelValue,\n (newVal) => {\n if (!newVal) {\n showPanelColor.value = false\n } else if (newVal && newVal !== color.value) {\n shouldActiveChange = false\n color.fromString(newVal)\n }\n }\n)\n\nwatch(\n () => currentColor.value,\n (val) => {\n customInput.value = val\n shouldActiveChange && emit('activeChange', val)\n shouldActiveChange = true\n }\n)\n\nwatch(\n () => color.value,\n () => {\n if (!props.modelValue && !showPanelColor.value) {\n showPanelColor.value = true\n }\n }\n)\n\nwatch(\n () => showPicker.value,\n () => {\n nextTick(() => {\n hue.value?.update()\n sv.value?.update()\n alpha.value?.update()\n })\n }\n)\n\nprovide(colorPickerContextKey, {\n currentColor,\n})\n\ndefineExpose({\n /**\n * @description current color object\n */\n color,\n /**\n * @description manually show ColorPicker\n */\n show,\n /**\n * @description manually hide ColorPicker\n */\n hide,\n /**\n * @description focus the input element\n */\n focus,\n /**\n * @description blur the input element\n */\n blur,\n})\n</script>\n"],"names":["useLocale","useNamespace","useFormItem","useFormSize","useFormDisabled","useFormItemInputId","ref","useFocusController","Color","computed","color","useDeprecated","debounce","nextTick","UPDATE_MODEL_EVENT","debugWarn","EVENT_CODE","onMounted","watch","provide","colorPickerContextKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAqJc,CAAA;AAAA,EACZ,IAAM,EAAA,eAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAM,MAAA,EAAE,MAAMA,eAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAKC,qBAAa,OAAO,CAAA,CAAA;AAC/B,IAAM,MA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AA;AAAA,IAIA,MAAA,CAAA;AAAA,aAIAV,OAAA;AAAA,MAIA,IAAA;AAAA,MAIA,IAAA;AAAA,MACD,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"color-picker2.js","sources":["../../../../../../packages/components/color-picker/src/color-picker.vue"],"sourcesContent":["<template>\n <el-tooltip\n ref=\"popper\"\n :visible=\"showPicker\"\n :show-arrow=\"false\"\n :fallback-placements=\"['bottom', 'top', 'right', 'left']\"\n :offset=\"0\"\n :gpu-acceleration=\"false\"\n :popper-class=\"[ns.be('picker', 'panel'), ns.b('dropdown'), popperClass]\"\n :stop-popper-mouse-event=\"false\"\n effect=\"light\"\n trigger=\"click\"\n :teleported=\"teleported\"\n :transition=\"`${ns.namespace.value}-zoom-in-top`\"\n persistent\n @hide=\"setShowPicker(false)\"\n >\n <template #content>\n <div v-click-outside=\"handleClickOutside\" @keydown.esc=\"handleEsc\">\n <div :class=\"ns.be('dropdown', 'main-wrapper')\">\n <hue-slider ref=\"hue\" class=\"hue-slider\" :color=\"color\" vertical />\n <sv-panel ref=\"sv\" :color=\"color\" />\n </div>\n <alpha-slider v-if=\"showAlpha\" ref=\"alpha\" :color=\"color\" />\n <predefine\n v-if=\"predefine\"\n ref=\"predefine\"\n :color=\"color\"\n :colors=\"predefine\"\n />\n <div :class=\"ns.be('dropdown', 'btns')\">\n <span :class=\"ns.be('dropdown', 'value')\">\n <el-input\n ref=\"inputRef\"\n v-model=\"customInput\"\n :validate-event=\"false\"\n size=\"small\"\n @keyup.enter=\"handleConfirm\"\n @blur=\"handleConfirm\"\n />\n </span>\n <el-button\n :class=\"ns.be('dropdown', 'link-btn')\"\n text\n size=\"small\"\n @click=\"clear\"\n >\n {{ t('el.colorpicker.clear') }}\n </el-button>\n <el-button\n plain\n size=\"small\"\n :class=\"ns.be('dropdown', 'btn')\"\n @click=\"confirmValue\"\n >\n {{ t('el.colorpicker.confirm') }}\n </el-button>\n </div>\n </div>\n </template>\n <template #default>\n <div\n :id=\"buttonId\"\n ref=\"triggerRef\"\n v-bind=\"$attrs\"\n :class=\"btnKls\"\n role=\"button\"\n :aria-label=\"buttonAriaLabel\"\n :aria-labelledby=\"buttonAriaLabelledby\"\n :aria-description=\"\n t('el.colorpicker.description', { color: modelValue || '' })\n \"\n :aria-disabled=\"colorDisabled\"\n :tabindex=\"colorDisabled ? -1 : tabindex\"\n @keydown=\"handleKeyDown\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n >\n <div v-if=\"colorDisabled\" :class=\"ns.be('picker', 'mask')\" />\n <div :class=\"ns.be('picker', 'trigger')\" @click=\"handleTrigger\">\n <span :class=\"[ns.be('picker', 'color'), ns.is('alpha', showAlpha)]\">\n <span\n :class=\"ns.be('picker', 'color-inner')\"\n :style=\"{\n backgroundColor: displayedColor,\n }\"\n >\n <el-icon\n v-show=\"modelValue || showPanelColor\"\n :class=\"[ns.be('picker', 'icon'), ns.is('icon-arrow-down')]\"\n >\n <arrow-down />\n </el-icon>\n <el-icon\n v-show=\"!modelValue && !showPanelColor\"\n :class=\"[ns.be('picker', 'empty'), ns.is('icon-close')]\"\n >\n <close />\n </el-icon>\n </span>\n </span>\n </div>\n </div>\n </template>\n </el-tooltip>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n watch,\n} from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { ElButton } from '@element-plus/components/button'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ClickOutside as vClickOutside } from '@element-plus/directives'\nimport { ElTooltip } from '@element-plus/components/tooltip'\nimport { ElInput } from '@element-plus/components/input'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n useDeprecated,\n useFocusController,\n useLocale,\n useNamespace,\n} from '@element-plus/hooks'\nimport { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { debugWarn } from '@element-plus/utils'\nimport { ArrowDown, Close } from '@element-plus/icons-vue'\nimport AlphaSlider from './components/alpha-slider.vue'\nimport HueSlider from './components/hue-slider.vue'\nimport Predefine from './components/predefine.vue'\nimport SvPanel from './components/sv-panel.vue'\nimport Color from './utils/color'\nimport {\n colorPickerContextKey,\n colorPickerEmits,\n colorPickerProps,\n} from './color-picker'\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\n\ndefineOptions({\n name: 'ElColorPicker',\n})\nconst props = defineProps(colorPickerProps)\nconst emit = defineEmits(colorPickerEmits)\n\nconst { t } = useLocale()\nconst ns = useNamespace('color')\nconst { formItem } = useFormItem()\nconst colorSize = useFormSize()\nconst colorDisabled = useFormDisabled()\n\nconst { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst hue = ref<InstanceType<typeof HueSlider>>()\nconst sv = ref<InstanceType<typeof SvPanel>>()\nconst alpha = ref<InstanceType<typeof AlphaSlider>>()\nconst popper = ref<TooltipInstance>()\nconst triggerRef = ref()\nconst inputRef = ref()\n\nconst {\n isFocused,\n handleFocus: _handleFocus,\n handleBlur,\n} = useFocusController(triggerRef, {\n beforeBlur(event) {\n return popper.value?.isFocusInsideContent(event)\n },\n afterBlur() {\n setShowPicker(false)\n resetColor()\n },\n})\n\nconst handleFocus = (event: FocusEvent) => {\n if (colorDisabled.value) return blur()\n _handleFocus(event)\n}\n\n// active-change is used to prevent modelValue changes from triggering.\nlet shouldActiveChange = true\n\nconst color = reactive(\n new Color({\n enableAlpha: props.showAlpha,\n format: props.colorFormat || '',\n value: props.modelValue,\n })\n) as Color\n\nconst showPicker = ref(false)\nconst showPanelColor = ref(false)\nconst customInput = ref('')\n\nconst displayedColor = computed(() => {\n if (!props.modelValue && !showPanelColor.value) {\n return 'transparent'\n }\n return displayedRgb(color, props.showAlpha)\n})\n\nconst currentColor = computed(() => {\n return !props.modelValue && !showPanelColor.value ? '' : color.value\n})\n\nconst buttonAriaLabel = computed<string | undefined>(() => {\n return !isLabeledByFormItem.value\n ? props.label || props.ariaLabel || t('el.colorpicker.defaultLabel')\n : undefined\n})\n\nuseDeprecated(\n {\n from: 'label',\n replacement: 'aria-label',\n version: '2.8.0',\n scope: 'el-color-picker',\n ref: 'https://element-plus.org/en-US/component/color-picker.html',\n },\n computed(() => !!props.label)\n)\n\nconst buttonAriaLabelledby = computed<string | undefined>(() => {\n return isLabeledByFormItem.value ? formItem?.labelId : undefined\n})\n\nconst btnKls = computed(() => {\n return [\n ns.b('picker'),\n ns.is('disabled', colorDisabled.value),\n ns.bm('picker', colorSize.value),\n ns.is('focused', isFocused.value),\n ]\n})\n\nfunction displayedRgb(color: Color, showAlpha: boolean) {\n if (!(color instanceof Color)) {\n throw new TypeError('color should be instance of _color Class')\n }\n\n const { r, g, b } = color.toRgb()\n return showAlpha\n ? `rgba(${r}, ${g}, ${b}, ${color.get('alpha') / 100})`\n : `rgb(${r}, ${g}, ${b})`\n}\n\nfunction setShowPicker(value: boolean) {\n showPicker.value = value\n}\n\nconst debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true })\n\nfunction show() {\n if (colorDisabled.value) return\n setShowPicker(true)\n}\n\nfunction hide() {\n debounceSetShowPicker(false)\n resetColor()\n}\n\nfunction resetColor() {\n nextTick(() => {\n if (props.modelValue) {\n color.fromString(props.modelValue)\n } else {\n color.value = ''\n nextTick(() => {\n showPanelColor.value = false\n })\n }\n })\n}\n\nfunction handleTrigger() {\n if (colorDisabled.value) return\n debounceSetShowPicker(!showPicker.value)\n}\n\nfunction handleConfirm() {\n color.fromString(customInput.value)\n}\n\nfunction confirmValue() {\n const value = color.value\n emit(UPDATE_MODEL_EVENT, value)\n emit('change', value)\n if (props.validateEvent) {\n formItem?.validate('change').catch((err) => debugWarn(err))\n }\n debounceSetShowPicker(false)\n // check if modelValue change, if not change, then reset color.\n nextTick(() => {\n const newColor = new Color({\n enableAlpha: props.showAlpha,\n format: props.colorFormat || '',\n value: props.modelValue,\n })\n if (!color.compare(newColor)) {\n resetColor()\n }\n })\n}\n\nfunction clear() {\n debounceSetShowPicker(false)\n emit(UPDATE_MODEL_EVENT, null)\n emit('change', null)\n if (props.modelValue !== null && props.validateEvent) {\n formItem?.validate('change').catch((err) => debugWarn(err))\n }\n resetColor()\n}\n\nfunction handleClickOutside(event: Event) {\n if (!showPicker.value) return\n hide()\n\n if (isFocused.value) {\n const _event = new FocusEvent('focus', event)\n handleBlur(_event)\n }\n}\n\nfunction handleEsc(event: KeyboardEvent) {\n event.preventDefault()\n event.stopPropagation()\n setShowPicker(false)\n resetColor()\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n switch (event.code) {\n case EVENT_CODE.enter:\n case EVENT_CODE.space:\n event.preventDefault()\n event.stopPropagation()\n show()\n inputRef.value.focus()\n break\n case EVENT_CODE.esc:\n handleEsc(event)\n break\n }\n}\n\nfunction focus() {\n triggerRef.value.focus()\n}\n\nfunction blur() {\n triggerRef.value.blur()\n}\n\nonMounted(() => {\n if (props.modelValue) {\n customInput.value = currentColor.value\n }\n})\n\nwatch(\n () => props.modelValue,\n (newVal) => {\n if (!newVal) {\n showPanelColor.value = false\n } else if (newVal && newVal !== color.value) {\n shouldActiveChange = false\n color.fromString(newVal)\n }\n }\n)\n\nwatch(\n () => currentColor.value,\n (val) => {\n customInput.value = val\n shouldActiveChange && emit('activeChange', val)\n shouldActiveChange = true\n }\n)\n\nwatch(\n () => color.value,\n () => {\n if (!props.modelValue && !showPanelColor.value) {\n showPanelColor.value = true\n }\n }\n)\n\nwatch(\n () => showPicker.value,\n () => {\n nextTick(() => {\n hue.value?.update()\n sv.value?.update()\n alpha.value?.update()\n })\n }\n)\n\nprovide(colorPickerContextKey, {\n currentColor,\n})\n\ndefineExpose({\n /**\n * @description current color object\n */\n color,\n /**\n * @description manually show ColorPicker\n */\n show,\n /**\n * @description manually hide ColorPicker\n */\n hide,\n /**\n * @description focus the input element\n */\n focus,\n /**\n * @description blur the input element\n */\n blur,\n})\n</script>\n"],"names":["useLocale","useNamespace","useFormItem","useFormSize","useFormDisabled","useFormItemInputId","ref","useFocusController","Color","computed","color","useDeprecated","debounce","nextTick","UPDATE_MODEL_EVENT","debugWarn","EVENT_CODE","onMounted","watch","provide","colorPickerContextKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAsJc,CAAA;AAAA,EACZ,IAAM,EAAA,eAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAM,MAAA,EAAE,MAAMA,eAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAKC,qBAAa,OAAO,CAAA,CAAA;AAC/B,IAAM,MAAA,EAAE,aAAaC,uBAAY,EAAA,CAAA;AACjC,IAAA,MAAM,YAAYC,8BAAY,EAAA,CAAA;AAC9B,IAAA,MAAM,gBAAgBC,kCAAgB,EAAA,CAAA;AAEtC,IAAA,MAAM,EAAE,OAAA,EAAS,QAAU,EAAA,mBAAA,EAAA,GAAwBC,+BAAmB,KAAO,EAAA;AAAA,MAC3E,eAAiB,EAAA,QAAA;AAAA,KAClB,CAAA,CAAA;AAED,IAAA,MAAM,MAAMC,OAAoC,EAAA,CAAA;AAChD,IAAA,MAAM,KAAKA,OAAkC,EAAA,CAAA;AAC7C,IAAA,MAAM,QAAQA,OAAsC,EAAA,CAAA;AACpD,IAAA,MAAM,SAASA,OAAqB,EAAA,CAAA;AACpC,IAAA,MAAM,aAAaA,OAAI,EAAA,CAAA;AACvB,IAAA,MAAM,WAAWA,OAAI,EAAA,CAAA;AAErB,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,WAAa,EAAA,YAAA;AAAA,MACb,UAAA;AAAA,KAAA,GACEC,2BAAmB,UAAY,EAAA;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IAAAQ,SAAA,CAAA,MAAe,UAAA,CAAA,KAAA,EAAA,MAAA;AACb,MAAAL,mBAAkB;AAClB,QAAA,UAAU,EAAO,EAAA,CAAA;AACjB,QAAA,CAAA,EAAA,GAAM,SAAc,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,EAAA,CAAA;AAAA,QACrB,CAAA,EAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,EAAA,CAAA;AAAA,QAEL,CAAA,EAAA,GAAA,KAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,EAAA,CAAA;AAEA,OAAA,CAAA,CAAA;AAA+B,KAC7B,CAAA,CAAA;AAAA,IACFM,WAAC,CAAAC,iCAAA,EAAA;AAED,MAAa,YAAA;AAAA,KAIX,CAAA,CAAA;AAAA,IAIA,MAAA,CAAA;AAAA,aAIAV,OAAA;AAAA,MAIA,IAAA;AAAA,MAIA,IAAA;AAAA,MACD,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/components/index.js
CHANGED
|
@@ -83,7 +83,7 @@ var index$1c = require('./message/index.js');
|
|
|
83
83
|
var index$1d = require('./message-box/index.js');
|
|
84
84
|
var index$1e = require('./notification/index.js');
|
|
85
85
|
var index$1f = require('./popover/index.js');
|
|
86
|
-
var affix = require('./affix/src/
|
|
86
|
+
var affix = require('./affix/src/affix2.js');
|
|
87
87
|
var alert = require('./alert/src/alert.js');
|
|
88
88
|
var autocomplete = require('./autocomplete/src/autocomplete.js');
|
|
89
89
|
var avatar = require('./avatar/src/avatar.js');
|
|
@@ -147,7 +147,7 @@ var overlay = require('./overlay/src/overlay.js');
|
|
|
147
147
|
var pageHeader = require('./page-header/src/page-header.js');
|
|
148
148
|
var pagination = require('./pagination/src/pagination.js');
|
|
149
149
|
var constants$9 = require('./pagination/src/constants.js');
|
|
150
|
-
var popconfirm = require('./popconfirm/src/
|
|
150
|
+
var popconfirm = require('./popconfirm/src/popconfirm.js');
|
|
151
151
|
var popper = require('./popper/src/popper.js');
|
|
152
152
|
var trigger$1 = require('./popper/src/trigger.js');
|
|
153
153
|
var content$1 = require('./popper/src/content.js');
|
|
@@ -181,7 +181,7 @@ var useSpace = require('./space/src/use-space.js');
|
|
|
181
181
|
var statistic = require('./statistic/src/statistic.js');
|
|
182
182
|
var item$1 = require('./steps/src/item.js');
|
|
183
183
|
var steps = require('./steps/src/steps.js');
|
|
184
|
-
var _switch = require('./switch/src/
|
|
184
|
+
var _switch = require('./switch/src/switch.js');
|
|
185
185
|
var constants$f = require('./table-v2/src/constants.js');
|
|
186
186
|
var tableV2 = require('./table-v2/src/table-v2.js');
|
|
187
187
|
var _private = require('./table-v2/src/private.js');
|
|
@@ -194,7 +194,7 @@ var tabNav = require('./tabs/src/tab-nav.js');
|
|
|
194
194
|
var tabPane = require('./tabs/src/tab-pane.js');
|
|
195
195
|
var constants$g = require('./tabs/src/constants.js');
|
|
196
196
|
var tag = require('./tag/src/tag.js');
|
|
197
|
-
var text = require('./text/src/
|
|
197
|
+
var text = require('./text/src/text2.js');
|
|
198
198
|
var utils = require('./time-picker/src/utils.js');
|
|
199
199
|
var constants$h = require('./time-picker/src/constants.js');
|
|
200
200
|
var props = require('./time-picker/src/common/props.js');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('../../utils/index.js');
|
|
6
|
-
var popconfirm$1 = require('./src/
|
|
7
|
-
var popconfirm = require('./src/
|
|
6
|
+
var popconfirm$1 = require('./src/popconfirm2.js');
|
|
7
|
+
var popconfirm = require('./src/popconfirm.js');
|
|
8
8
|
var install = require('../../utils/vue/install.js');
|
|
9
9
|
|
|
10
10
|
const ElPopconfirm = install.withInstall(popconfirm$1["default"]);
|
|
@@ -2,119 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var index$3 = require('../../icon/index.js');
|
|
8
|
-
var index$2 = require('../../tooltip/index.js');
|
|
9
|
-
require('../../../hooks/index.js');
|
|
5
|
+
require('../../button/index.js');
|
|
6
|
+
var iconsVue = require('@element-plus/icons-vue');
|
|
10
7
|
require('../../../utils/index.js');
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
8
|
+
require('../../tooltip/index.js');
|
|
9
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
10
|
+
var button = require('../../button/src/button.js');
|
|
11
|
+
var icon = require('../../../utils/vue/icon.js');
|
|
12
|
+
var content = require('../../tooltip/src/content.js');
|
|
16
13
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
trigger: "click",
|
|
53
|
-
effect: "light"
|
|
54
|
-
}, _ctx.$attrs, {
|
|
55
|
-
"popper-class": `${vue.unref(ns).namespace.value}-popover`,
|
|
56
|
-
"popper-style": vue.unref(style$1),
|
|
57
|
-
teleported: _ctx.teleported,
|
|
58
|
-
"fallback-placements": ["bottom", "top", "right", "left"],
|
|
59
|
-
"hide-after": _ctx.hideAfter,
|
|
60
|
-
persistent: _ctx.persistent
|
|
61
|
-
}), {
|
|
62
|
-
content: vue.withCtx(() => [
|
|
63
|
-
vue.createElementVNode("div", {
|
|
64
|
-
class: vue.normalizeClass(vue.unref(ns).b())
|
|
65
|
-
}, [
|
|
66
|
-
vue.createElementVNode("div", {
|
|
67
|
-
class: vue.normalizeClass(vue.unref(ns).e("main"))
|
|
68
|
-
}, [
|
|
69
|
-
!_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.ElIcon), {
|
|
70
|
-
key: 0,
|
|
71
|
-
class: vue.normalizeClass(vue.unref(ns).e("icon")),
|
|
72
|
-
style: vue.normalizeStyle({ color: _ctx.iconColor })
|
|
73
|
-
}, {
|
|
74
|
-
default: vue.withCtx(() => [
|
|
75
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
|
|
76
|
-
]),
|
|
77
|
-
_: 1
|
|
78
|
-
}, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
|
|
79
|
-
vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
|
|
80
|
-
], 2),
|
|
81
|
-
vue.createElementVNode("div", {
|
|
82
|
-
class: vue.normalizeClass(vue.unref(ns).e("action"))
|
|
83
|
-
}, [
|
|
84
|
-
vue.createVNode(vue.unref(index$4.ElButton), {
|
|
85
|
-
size: "small",
|
|
86
|
-
type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
|
|
87
|
-
text: _ctx.cancelButtonType === "text",
|
|
88
|
-
onClick: cancel
|
|
89
|
-
}, {
|
|
90
|
-
default: vue.withCtx(() => [
|
|
91
|
-
vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
|
|
92
|
-
]),
|
|
93
|
-
_: 1
|
|
94
|
-
}, 8, ["type", "text"]),
|
|
95
|
-
vue.createVNode(vue.unref(index$4.ElButton), {
|
|
96
|
-
size: "small",
|
|
97
|
-
type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
|
|
98
|
-
text: _ctx.confirmButtonType === "text",
|
|
99
|
-
onClick: confirm
|
|
100
|
-
}, {
|
|
101
|
-
default: vue.withCtx(() => [
|
|
102
|
-
vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
|
|
103
|
-
]),
|
|
104
|
-
_: 1
|
|
105
|
-
}, 8, ["type", "text"])
|
|
106
|
-
], 2)
|
|
107
|
-
], 2)
|
|
108
|
-
]),
|
|
109
|
-
default: vue.withCtx(() => [
|
|
110
|
-
_ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
|
|
111
|
-
]),
|
|
112
|
-
_: 3
|
|
113
|
-
}, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
|
|
114
|
-
};
|
|
14
|
+
const popconfirmProps = runtime.buildProps({
|
|
15
|
+
title: String,
|
|
16
|
+
confirmButtonText: String,
|
|
17
|
+
cancelButtonText: String,
|
|
18
|
+
confirmButtonType: {
|
|
19
|
+
type: String,
|
|
20
|
+
values: button.buttonTypes,
|
|
21
|
+
default: "primary"
|
|
22
|
+
},
|
|
23
|
+
cancelButtonType: {
|
|
24
|
+
type: String,
|
|
25
|
+
values: button.buttonTypes,
|
|
26
|
+
default: "text"
|
|
27
|
+
},
|
|
28
|
+
icon: {
|
|
29
|
+
type: icon.iconPropType,
|
|
30
|
+
default: () => iconsVue.QuestionFilled
|
|
31
|
+
},
|
|
32
|
+
iconColor: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "#f90"
|
|
35
|
+
},
|
|
36
|
+
hideIcon: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
hideAfter: {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 200
|
|
43
|
+
},
|
|
44
|
+
teleported: content.useTooltipContentProps.teleported,
|
|
45
|
+
persistent: content.useTooltipContentProps.persistent,
|
|
46
|
+
width: {
|
|
47
|
+
type: [String, Number],
|
|
48
|
+
default: 150
|
|
115
49
|
}
|
|
116
50
|
});
|
|
117
|
-
|
|
51
|
+
const popconfirmEmits = {
|
|
52
|
+
confirm: (e) => e instanceof MouseEvent,
|
|
53
|
+
cancel: (e) => e instanceof MouseEvent
|
|
54
|
+
};
|
|
118
55
|
|
|
119
|
-
exports
|
|
56
|
+
exports.popconfirmEmits = popconfirmEmits;
|
|
57
|
+
exports.popconfirmProps = popconfirmProps;
|
|
120
58
|
//# sourceMappingURL=popconfirm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popconfirm.js","sources":["../../../../../../packages/components/popconfirm/src/popconfirm.
|
|
1
|
+
{"version":3,"file":"popconfirm.js","sources":["../../../../../../packages/components/popconfirm/src/popconfirm.ts"],"sourcesContent":["import { buttonTypes } from '@element-plus/components/button'\nimport { QuestionFilled } from '@element-plus/icons-vue'\nimport { buildProps, iconPropType } from '@element-plus/utils'\nimport { useTooltipContentProps } from '@element-plus/components/tooltip'\nimport type { ExtractPropTypes } from 'vue'\nimport type Popconfirm from './popconfirm.vue'\n\nexport const popconfirmProps = buildProps({\n /**\n * @description Title\n */\n title: String,\n /**\n * @description Confirm button text\n */\n confirmButtonText: String,\n /**\n * @description Cancel button text\n */\n cancelButtonText: String,\n /**\n * @description Confirm button type\n */\n confirmButtonType: {\n type: String,\n values: buttonTypes,\n default: 'primary',\n },\n /**\n * @description Cancel button type\n */\n cancelButtonType: {\n type: String,\n values: buttonTypes,\n default: 'text',\n },\n /**\n * @description Icon Component\n */\n icon: {\n type: iconPropType,\n default: () => QuestionFilled,\n },\n /**\n * @description Icon color\n */\n iconColor: {\n type: String,\n default: '#f90',\n },\n /**\n * @description is hide Icon\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n /**\n * @description delay of disappear, in millisecond\n */\n hideAfter: {\n type: Number,\n default: 200,\n },\n /**\n * @description whether popconfirm is teleported to the body\n */\n teleported: useTooltipContentProps.teleported,\n /**\n * @description when popconfirm inactive and `persistent` is `false` , popconfirm will be destroyed\n */\n persistent: useTooltipContentProps.persistent,\n /**\n * @description popconfirm width, min width 150px\n */\n width: {\n type: [String, Number],\n default: 150,\n },\n} as const)\n\nexport const popconfirmEmits = {\n /**\n * @description triggers when click confirm button\n */\n confirm: (e: MouseEvent) => e instanceof MouseEvent,\n /**\n * @description triggers when click cancel button\n */\n cancel: (e: MouseEvent) => e instanceof MouseEvent,\n}\n\nexport type PopconfirmEmits = typeof popconfirmEmits\n\nexport type PopconfirmProps = ExtractPropTypes<typeof popconfirmProps>\n\nexport type PopconfirmInstance = InstanceType<typeof Popconfirm>\n"],"names":["buildProps","buttonTypes","iconPropType","QuestionFilled","useTooltipContentProps"],"mappings":";;;;;;;;;;;;;AAIY,MAAC,eAAe,GAAGA,kBAAU,CAAC;AAC1C,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,iBAAiB,EAAE,MAAM;AAC3B,EAAE,gBAAgB,EAAE,MAAM;AAC1B,EAAE,iBAAiB,EAAE;AACrB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAEC,kBAAW;AACvB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAEA,kBAAW;AACvB,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAEC,iBAAY;AACtB,IAAI,OAAO,EAAE,MAAMC,uBAAc;AACjC,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,UAAU,EAAEC,8BAAsB,CAAC,UAAU;AAC/C,EAAE,UAAU,EAAEA,8BAAsB,CAAC,UAAU;AAC/C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,UAAU;AACzC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,UAAU;AACxC;;;;;"}
|
|
@@ -2,57 +2,119 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
6
|
-
var
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var index$4 = require('../../button/index.js');
|
|
7
|
+
var index$3 = require('../../icon/index.js');
|
|
8
|
+
var index$2 = require('../../tooltip/index.js');
|
|
9
|
+
require('../../../hooks/index.js');
|
|
7
10
|
require('../../../utils/index.js');
|
|
8
|
-
require('
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var popconfirm = require('./popconfirm.js');
|
|
12
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
13
|
+
var index = require('../../../hooks/use-locale/index.js');
|
|
14
|
+
var index$1 = require('../../../hooks/use-namespace/index.js');
|
|
15
|
+
var style = require('../../../utils/dom/style.js');
|
|
13
16
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
17
|
+
const __default__ = vue.defineComponent({
|
|
18
|
+
name: "ElPopconfirm"
|
|
19
|
+
});
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
21
|
+
...__default__,
|
|
22
|
+
props: popconfirm.popconfirmProps,
|
|
23
|
+
emits: popconfirm.popconfirmEmits,
|
|
24
|
+
setup(__props, { emit }) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const { t } = index.useLocale();
|
|
27
|
+
const ns = index$1.useNamespace("popconfirm");
|
|
28
|
+
const tooltipRef = vue.ref();
|
|
29
|
+
const hidePopper = () => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
|
|
32
|
+
};
|
|
33
|
+
const style$1 = vue.computed(() => {
|
|
34
|
+
return {
|
|
35
|
+
width: style.addUnit(props.width)
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const confirm = (e) => {
|
|
39
|
+
emit("confirm", e);
|
|
40
|
+
hidePopper();
|
|
41
|
+
};
|
|
42
|
+
const cancel = (e) => {
|
|
43
|
+
emit("cancel", e);
|
|
44
|
+
hidePopper();
|
|
45
|
+
};
|
|
46
|
+
const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
|
|
47
|
+
const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return vue.openBlock(), vue.createBlock(vue.unref(index$2.ElTooltip), vue.mergeProps({
|
|
50
|
+
ref_key: "tooltipRef",
|
|
51
|
+
ref: tooltipRef,
|
|
52
|
+
trigger: "click",
|
|
53
|
+
effect: "light"
|
|
54
|
+
}, _ctx.$attrs, {
|
|
55
|
+
"popper-class": `${vue.unref(ns).namespace.value}-popover`,
|
|
56
|
+
"popper-style": vue.unref(style$1),
|
|
57
|
+
teleported: _ctx.teleported,
|
|
58
|
+
"fallback-placements": ["bottom", "top", "right", "left"],
|
|
59
|
+
"hide-after": _ctx.hideAfter,
|
|
60
|
+
persistent: _ctx.persistent
|
|
61
|
+
}), {
|
|
62
|
+
content: vue.withCtx(() => [
|
|
63
|
+
vue.createElementVNode("div", {
|
|
64
|
+
class: vue.normalizeClass(vue.unref(ns).b())
|
|
65
|
+
}, [
|
|
66
|
+
vue.createElementVNode("div", {
|
|
67
|
+
class: vue.normalizeClass(vue.unref(ns).e("main"))
|
|
68
|
+
}, [
|
|
69
|
+
!_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.ElIcon), {
|
|
70
|
+
key: 0,
|
|
71
|
+
class: vue.normalizeClass(vue.unref(ns).e("icon")),
|
|
72
|
+
style: vue.normalizeStyle({ color: _ctx.iconColor })
|
|
73
|
+
}, {
|
|
74
|
+
default: vue.withCtx(() => [
|
|
75
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
}, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
|
|
79
|
+
vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
|
|
80
|
+
], 2),
|
|
81
|
+
vue.createElementVNode("div", {
|
|
82
|
+
class: vue.normalizeClass(vue.unref(ns).e("action"))
|
|
83
|
+
}, [
|
|
84
|
+
vue.createVNode(vue.unref(index$4.ElButton), {
|
|
85
|
+
size: "small",
|
|
86
|
+
type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
|
|
87
|
+
text: _ctx.cancelButtonType === "text",
|
|
88
|
+
onClick: cancel
|
|
89
|
+
}, {
|
|
90
|
+
default: vue.withCtx(() => [
|
|
91
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
|
|
92
|
+
]),
|
|
93
|
+
_: 1
|
|
94
|
+
}, 8, ["type", "text"]),
|
|
95
|
+
vue.createVNode(vue.unref(index$4.ElButton), {
|
|
96
|
+
size: "small",
|
|
97
|
+
type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
|
|
98
|
+
text: _ctx.confirmButtonType === "text",
|
|
99
|
+
onClick: confirm
|
|
100
|
+
}, {
|
|
101
|
+
default: vue.withCtx(() => [
|
|
102
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
|
|
103
|
+
]),
|
|
104
|
+
_: 1
|
|
105
|
+
}, 8, ["type", "text"])
|
|
106
|
+
], 2)
|
|
107
|
+
], 2)
|
|
108
|
+
]),
|
|
109
|
+
default: vue.withCtx(() => [
|
|
110
|
+
_ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
|
|
111
|
+
]),
|
|
112
|
+
_: 3
|
|
113
|
+
}, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
|
|
114
|
+
};
|
|
49
115
|
}
|
|
50
116
|
});
|
|
51
|
-
|
|
52
|
-
confirm: (e) => e instanceof MouseEvent,
|
|
53
|
-
cancel: (e) => e instanceof MouseEvent
|
|
54
|
-
};
|
|
117
|
+
var Popconfirm = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "popconfirm.vue"]]);
|
|
55
118
|
|
|
56
|
-
exports
|
|
57
|
-
exports.popconfirmProps = popconfirmProps;
|
|
119
|
+
exports["default"] = Popconfirm;
|
|
58
120
|
//# sourceMappingURL=popconfirm2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popconfirm2.js","sources":["../../../../../../packages/components/popconfirm/src/popconfirm.
|
|
1
|
+
{"version":3,"file":"popconfirm2.js","sources":["../../../../../../packages/components/popconfirm/src/popconfirm.vue"],"sourcesContent":["<template>\n <el-tooltip\n ref=\"tooltipRef\"\n trigger=\"click\"\n effect=\"light\"\n v-bind=\"$attrs\"\n :popper-class=\"`${ns.namespace.value}-popover`\"\n :popper-style=\"style\"\n :teleported=\"teleported\"\n :fallback-placements=\"['bottom', 'top', 'right', 'left']\"\n :hide-after=\"hideAfter\"\n :persistent=\"persistent\"\n >\n <template #content>\n <div :class=\"ns.b()\">\n <div :class=\"ns.e('main')\">\n <el-icon\n v-if=\"!hideIcon && icon\"\n :class=\"ns.e('icon')\"\n :style=\"{ color: iconColor }\"\n >\n <component :is=\"icon\" />\n </el-icon>\n {{ title }}\n </div>\n <div :class=\"ns.e('action')\">\n <el-button\n size=\"small\"\n :type=\"cancelButtonType === 'text' ? '' : cancelButtonType\"\n :text=\"cancelButtonType === 'text'\"\n @click=\"cancel\"\n >\n {{ finalCancelButtonText }}\n </el-button>\n <el-button\n size=\"small\"\n :type=\"confirmButtonType === 'text' ? '' : confirmButtonType\"\n :text=\"confirmButtonType === 'text'\"\n @click=\"confirm\"\n >\n {{ finalConfirmButtonText }}\n </el-button>\n </div>\n </div>\n </template>\n <template v-if=\"$slots.reference\">\n <slot name=\"reference\" />\n </template>\n </el-tooltip>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport ElIcon from '@element-plus/components/icon'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { addUnit } from '@element-plus/utils'\nimport { popconfirmEmits, popconfirmProps } from './popconfirm'\n\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\n\ndefineOptions({\n name: 'ElPopconfirm',\n})\n\nconst props = defineProps(popconfirmProps)\nconst emit = defineEmits(popconfirmEmits)\n\nconst { t } = useLocale()\nconst ns = useNamespace('popconfirm')\nconst tooltipRef = ref<TooltipInstance>()\n\nconst hidePopper = () => {\n tooltipRef.value?.onClose?.()\n}\n\nconst style = computed(() => {\n return {\n width: addUnit(props.width),\n }\n})\n\nconst confirm = (e: MouseEvent) => {\n emit('confirm', e)\n hidePopper()\n}\nconst cancel = (e: MouseEvent) => {\n emit('cancel', e)\n hidePopper()\n}\n\nconst finalConfirmButtonText = computed(\n () => props.confirmButtonText || t('el.popconfirm.confirmButtonText')\n)\nconst finalCancelButtonText = computed(\n () => props.cancelButtonText || t('el.popconfirm.cancelButtonText')\n)\n</script>\n"],"names":["useLocale","useNamespace","ref","style","computed","addUnit"],"mappings":";;;;;;;;;;;;;;;;uCA8Dc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,EAAE,MAAMA,eAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAKC,qBAAa,YAAY,CAAA,CAAA;AACpC,IAAA,MAAM,aAAaC,OAAqB,EAAA,CAAA;AAExC,IAAA,MAAM,aAAa,MAAM;AACvB,MAAA,IAAA,EAAA,EAAA,EAAA,CAAW;AAAiB,MAC9B,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,UAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAEA,KAAM,CAAA;AACJ,IAAO,MAAAC,OAAA,GAAAC,YAAA,CAAA,MAAA;AAAA,MACL,OAAA;AAA0B,QAC5B,KAAA,EAAAC,aAAA,CAAA,KAAA,CAAA,KAAA,CAAA;AAAA,OACD,CAAA;AAED,KAAM,CAA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