@element-plus/nightly 0.0.20220130 → 0.0.20220203
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +336 -228
- package/dist/index.full.min.js +8 -8
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +8 -8
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +337 -230
- 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.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/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/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/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/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/cascader/index.d.ts +44 -0
- package/es/components/cascader/src/index.mjs +1 -7
- package/es/components/cascader/src/index.mjs.map +1 -1
- package/es/components/cascader/src/index.vue.d.ts +22 -0
- package/es/components/dialog/index.d.ts +4 -0
- package/es/components/dialog/src/dialog.d.ts +1 -0
- package/es/components/dialog/src/dialog.mjs +4 -0
- package/es/components/dialog/src/dialog.mjs.map +1 -1
- package/es/components/dialog/src/dialog.vue.d.ts +4 -0
- package/es/components/dialog/src/dialog2.mjs +12 -3
- package/es/components/dialog/src/dialog2.mjs.map +1 -1
- package/es/components/drawer/index.d.ts +3 -0
- package/es/components/drawer/src/drawer.d.ts +1 -0
- package/es/components/drawer/src/drawer.vue.d.ts +3 -0
- package/es/components/message-box/src/index.mjs +133 -113
- package/es/components/message-box/src/index.mjs.map +1 -1
- package/es/components/message-box/src/index.vue.d.ts +14 -4
- package/es/components/message-box/src/message-box.type.d.ts +2 -0
- package/es/components/popover/index.d.ts +4 -0
- package/es/components/popover/src/index.mjs +14 -4
- package/es/components/popover/src/index.mjs.map +1 -1
- package/es/components/popover/src/index.vue.d.ts +2 -0
- package/es/components/scrollbar/index.d.ts +11 -0
- package/es/components/scrollbar/src/scrollbar.vue.d.ts +11 -0
- package/es/components/scrollbar/src/scrollbar2.mjs +13 -10
- package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
- package/es/components/scrollbar/src/thumb.vue.d.ts +11 -0
- package/es/components/scrollbar/src/thumb2.mjs +11 -5
- package/es/components/scrollbar/src/thumb2.mjs.map +1 -1
- package/es/components/skeleton/index.d.ts +37 -2
- package/es/components/skeleton/src/skeleton-item.vue.d.ts +13 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +10 -2
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.vue.d.ts +11 -0
- package/es/components/skeleton/src/skeleton2.mjs +11 -8
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/index.mjs.map +1 -1
- package/es/hooks/use-draggable/index.d.ts +2 -0
- package/es/hooks/use-draggable/index.mjs +65 -0
- package/es/hooks/use-draggable/index.mjs.map +1 -0
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/cascader/index.d.ts +44 -0
- package/lib/components/cascader/src/index.js +1 -7
- package/lib/components/cascader/src/index.js.map +1 -1
- package/lib/components/cascader/src/index.vue.d.ts +22 -0
- package/lib/components/dialog/index.d.ts +4 -0
- package/lib/components/dialog/src/dialog.d.ts +1 -0
- package/lib/components/dialog/src/dialog.js +4 -0
- package/lib/components/dialog/src/dialog.js.map +1 -1
- package/lib/components/dialog/src/dialog.vue.d.ts +4 -0
- package/lib/components/dialog/src/dialog2.js +11 -2
- package/lib/components/dialog/src/dialog2.js.map +1 -1
- package/lib/components/drawer/index.d.ts +3 -0
- package/lib/components/drawer/src/drawer.d.ts +1 -0
- package/lib/components/drawer/src/drawer.vue.d.ts +3 -0
- package/lib/components/message-box/src/index.js +140 -120
- package/lib/components/message-box/src/index.js.map +1 -1
- package/lib/components/message-box/src/index.vue.d.ts +14 -4
- package/lib/components/message-box/src/message-box.type.d.ts +2 -0
- package/lib/components/popover/index.d.ts +4 -0
- package/lib/components/popover/src/index.js +14 -4
- package/lib/components/popover/src/index.js.map +1 -1
- package/lib/components/popover/src/index.vue.d.ts +2 -0
- package/lib/components/scrollbar/index.d.ts +11 -0
- package/lib/components/scrollbar/src/scrollbar.vue.d.ts +11 -0
- package/lib/components/scrollbar/src/scrollbar2.js +12 -9
- package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
- package/lib/components/scrollbar/src/thumb.vue.d.ts +11 -0
- package/lib/components/scrollbar/src/thumb2.js +11 -5
- package/lib/components/scrollbar/src/thumb2.js.map +1 -1
- package/lib/components/skeleton/index.d.ts +37 -2
- package/lib/components/skeleton/src/skeleton-item.vue.d.ts +13 -1
- package/lib/components/skeleton/src/skeleton-item2.js +10 -2
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.vue.d.ts +11 -0
- package/lib/components/skeleton/src/skeleton2.js +12 -9
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +60 -58
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-draggable/index.d.ts +2 -0
- package/lib/hooks/use-draggable/index.js +69 -0
- package/lib/hooks/use-draggable/index.js.map +1 -0
- package/lib/index.js +60 -58
- package/lib/index.js.map +1 -1
- 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/tags.json +1 -1
- package/theme-chalk/el-dialog.css +1 -1
- package/theme-chalk/el-message-box.css +1 -1
- package/theme-chalk/el-popper.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/dialog.scss +7 -0
- package/theme-chalk/src/message-box.scss +26 -15
- package/theme-chalk/src/popper.scss +6 -6
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../packages/components/message-box/src/index.vue"],"sourcesContent":["<template>\n <transition name=\"fade-in-linear\" @after-leave=\"$emit('vanish')\">\n <el-overlay\n v-show=\"visible\"\n :z-index=\"zIndex\"\n :overlay-class=\"['is-message-box', modalClass]\"\n :mask=\"modal\"\n @click.self=\"handleWrapperClick\"\n >\n <div\n ref=\"root\"\n v-trap-focus\n role=\"dialog\"\n :aria-label=\"title || 'dialog'\"\n aria-modal=\"true\"\n :class=\"[\n 'el-message-box',\n customClass,\n { 'el-message-box--center': center },\n ]\"\n :style=\"customStyle\"\n >\n <div\n v-if=\"title !== null && title !== undefined\"\n class=\"el-message-box__header\"\n >\n <div class=\"el-message-box__title\">\n <el-icon\n v-if=\"iconComponent && center\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <span>{{ title }}</span>\n </div>\n <button\n v-if=\"showClose\"\n type=\"button\"\n class=\"el-message-box__headerbtn\"\n aria-label=\"Close\"\n @click=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n @keydown.prevent.enter=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n >\n <el-icon class=\"el-message-box__close\"><close /></el-icon>\n </button>\n </div>\n <div class=\"el-message-box__content\">\n <div class=\"el-message-box__container\">\n <el-icon\n v-if=\"iconComponent && !center && hasMessage\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <div v-if=\"hasMessage\" class=\"el-message-box__message\">\n <slot>\n <p v-if=\"!dangerouslyUseHTMLString\">{{ message }}</p>\n <p v-else v-html=\"message\"></p>\n </slot>\n </div>\n </div>\n <div v-show=\"showInput\" class=\"el-message-box__input\">\n <el-input\n ref=\"inputRef\"\n v-model=\"inputValue\"\n :type=\"inputType\"\n :placeholder=\"inputPlaceholder\"\n :class=\"{ invalid: validateError }\"\n @keydown.prevent.enter=\"handleInputEnter\"\n />\n <div\n class=\"el-message-box__errormsg\"\n :style=\"{\n visibility: !!editorErrorMessage ? 'visible' : 'hidden',\n }\"\n >\n {{ editorErrorMessage }}\n </div>\n </div>\n </div>\n <div class=\"el-message-box__btns\">\n <el-button\n v-if=\"showCancelButton\"\n :loading=\"cancelButtonLoading\"\n :class=\"[cancelButtonClass]\"\n :round=\"roundButton\"\n :size=\"btnSize\"\n @click=\"handleAction('cancel')\"\n @keydown.prevent.enter=\"handleAction('cancel')\"\n >\n {{ cancelButtonText || t('el.messagebox.cancel') }}\n </el-button>\n <el-button\n v-show=\"showConfirmButton\"\n ref=\"confirmRef\"\n type=\"primary\"\n :loading=\"confirmButtonLoading\"\n :class=\"[confirmButtonClasses]\"\n :round=\"roundButton\"\n :disabled=\"confirmButtonDisabled\"\n :size=\"btnSize\"\n @click=\"handleAction('confirm')\"\n @keydown.prevent.enter=\"handleAction('confirm')\"\n >\n {{ confirmButtonText || t('el.messagebox.confirm') }}\n </el-button>\n </div>\n </div>\n </el-overlay>\n </transition>\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onMounted,\n onBeforeUnmount,\n computed,\n watch,\n reactive,\n ref,\n toRefs,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport { TrapFocus } from '@element-plus/directives'\nimport {\n useModal,\n useLockscreen,\n useLocale,\n useRestoreActive,\n usePreventGlobal,\n useSize,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { ElOverlay } from '@element-plus/components/overlay'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { on, off } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\nimport { isValidComponentSize } from '@element-plus/utils/validators'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { TypeComponents, TypeComponentsMap } from '@element-plus/utils/icon'\n\nimport type { ComponentPublicInstance, PropType } from 'vue'\nimport type { ComponentSize } from '@element-plus/utils/types'\nimport type {\n Action,\n MessageBoxState,\n MessageBoxType,\n} from './message-box.type'\n\nexport default defineComponent({\n name: 'ElMessageBox',\n directives: {\n TrapFocus,\n },\n components: {\n ElButton,\n ElInput,\n ElOverlay,\n ElIcon,\n ...TypeComponents,\n },\n inheritAttrs: false,\n props: {\n buttonSize: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n modal: {\n type: Boolean,\n default: true,\n },\n lockScroll: {\n type: Boolean,\n default: true,\n },\n showClose: {\n type: Boolean,\n default: true,\n },\n closeOnClickModal: {\n type: Boolean,\n default: true,\n },\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n closeOnHashChange: {\n type: Boolean,\n default: true,\n },\n center: Boolean,\n roundButton: {\n default: false,\n type: Boolean,\n },\n container: {\n type: String, // default append to body\n default: 'body',\n },\n boxType: {\n type: String as PropType<MessageBoxType>,\n default: '',\n },\n },\n emits: ['vanish', 'action'],\n setup(props, { emit }) {\n // const popup = usePopup(props, doClose)\n const { t } = useLocale()\n const visible = ref(false)\n // s represents state\n const state = reactive<MessageBoxState>({\n beforeClose: null,\n callback: null,\n cancelButtonText: '',\n cancelButtonClass: '',\n confirmButtonText: '',\n confirmButtonClass: '',\n customClass: '',\n customStyle: {},\n dangerouslyUseHTMLString: false,\n distinguishCancelAndClose: false,\n icon: '',\n inputPattern: null,\n inputPlaceholder: '',\n inputType: 'text',\n inputValue: null,\n inputValidator: null,\n inputErrorMessage: '',\n message: null,\n modalFade: true,\n modalClass: '',\n showCancelButton: false,\n showConfirmButton: true,\n type: '',\n title: undefined,\n showInput: false,\n action: '' as Action,\n confirmButtonLoading: false,\n cancelButtonLoading: false,\n confirmButtonDisabled: false,\n editorErrorMessage: '',\n // refer to: https://github.com/ElemeFE/element/commit/2999279ae34ef10c373ca795c87b020ed6753eed\n // seemed ok for now without this state.\n // isOnComposition: false, // temporary remove\n validateError: false,\n zIndex: PopupManager.nextZIndex(),\n })\n\n const typeClass = computed(() => {\n const type = state.type\n return type && TypeComponentsMap[type]\n ? `el-message-box-icon--${type}`\n : ''\n })\n\n const btnSize = useSize(\n computed(() => props.buttonSize),\n { prop: true, form: true, formItem: true }\n )\n\n const iconComponent = computed(\n () => state.icon || TypeComponentsMap[state.type] || ''\n )\n const hasMessage = computed(() => !!state.message)\n const inputRef = ref<ComponentPublicInstance>(null)\n const confirmRef = ref<ComponentPublicInstance>(null)\n\n const confirmButtonClasses = computed(() => state.confirmButtonClass)\n\n watch(\n () => state.inputValue,\n async (val) => {\n await nextTick()\n if (props.boxType === 'prompt' && val !== null) {\n validate()\n }\n },\n { immediate: true }\n )\n\n watch(\n () => visible.value,\n (val) => {\n if (val) {\n if (props.boxType === 'alert' || props.boxType === 'confirm') {\n nextTick().then(() => {\n confirmRef.value?.$el?.focus?.()\n })\n }\n state.zIndex = PopupManager.nextZIndex()\n }\n if (props.boxType !== 'prompt') return\n if (val) {\n nextTick().then(() => {\n if (inputRef.value && inputRef.value.$el) {\n getInputElement().focus()\n }\n })\n } else {\n state.editorErrorMessage = ''\n state.validateError = false\n }\n }\n )\n\n onMounted(async () => {\n await nextTick()\n if (props.closeOnHashChange) {\n on(window, 'hashchange', doClose)\n }\n })\n\n onBeforeUnmount(() => {\n if (props.closeOnHashChange) {\n off(window, 'hashchange', doClose)\n }\n })\n\n function doClose() {\n if (!visible.value) return\n visible.value = false\n nextTick(() => {\n if (state.action) emit('action', state.action)\n })\n }\n\n const handleWrapperClick = () => {\n if (props.closeOnClickModal) {\n handleAction(state.distinguishCancelAndClose ? 'close' : 'cancel')\n }\n }\n\n const handleInputEnter = () => {\n if (state.inputType !== 'textarea') {\n return handleAction('confirm')\n }\n }\n\n const handleAction = (action: Action) => {\n if (props.boxType === 'prompt' && action === 'confirm' && !validate()) {\n return\n }\n\n state.action = action\n\n if (state.beforeClose) {\n state.beforeClose?.(action, state, doClose)\n } else {\n doClose()\n }\n }\n\n const validate = () => {\n if (props.boxType === 'prompt') {\n const inputPattern = state.inputPattern\n if (inputPattern && !inputPattern.test(state.inputValue || '')) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n const inputValidator = state.inputValidator\n if (typeof inputValidator === 'function') {\n const validateResult = inputValidator(state.inputValue)\n if (validateResult === false) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n if (typeof validateResult === 'string') {\n state.editorErrorMessage = validateResult\n state.validateError = true\n return false\n }\n }\n }\n state.editorErrorMessage = ''\n state.validateError = false\n return true\n }\n\n const getInputElement = () => {\n const inputRefs = inputRef.value.$refs\n return (inputRefs.input || inputRefs.textarea) as HTMLElement\n }\n\n const handleClose = () => {\n handleAction('close')\n }\n\n // when close on press escape is disabled, pressing esc should not callout\n // any other message box and close any other dialog-ish elements\n // e.g. Dialog has a close on press esc feature, and when it closes, it calls\n // props.beforeClose method to make a intermediate state by callout a message box\n // for some verification or alerting. then if we allow global event liek this\n // to dispatch, it could callout another message box.\n if (props.closeOnPressEscape) {\n useModal(\n {\n handleClose,\n },\n visible\n )\n } else {\n usePreventGlobal(\n visible,\n 'keydown',\n (e: KeyboardEvent) => e.code === EVENT_CODE.esc\n )\n }\n\n // locks the screen to prevent scroll\n if (props.lockScroll) {\n useLockscreen(visible)\n }\n\n // restore to prev active element.\n useRestoreActive(visible)\n\n return {\n ...toRefs(state),\n visible,\n hasMessage,\n typeClass,\n btnSize,\n iconComponent,\n confirmButtonClasses,\n inputRef,\n confirmRef,\n doClose, // for outside usage\n handleClose, // for out side usage\n handleWrapperClick,\n handleInputEnter,\n handleAction,\n t,\n }\n },\n})\n</script>\n"],"names":["defineComponent","TrapFocus","ElButton","ElInput","ElOverlay","ElIcon","TypeComponents","isValidComponentSize","useLocale","ref","reactive","PopupManager","computed","TypeComponentsMap","useSize","nextTick","_withCtx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4JA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,eACVC;AAAA;AAAA,EAEF,YAAY;AAAA,cACVC;AAAA,aACAC;AAAA,eACAC;AAAA,YACAC;AAAA,OACGC;AAAA;AAAA,EAEL,cAAc;AAAA,EACd,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAWC;AAAA;AAAA,IAEb,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,mBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,mBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,QAAQ;AAAA,IACR,aAAa;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA;AAAA,IAER,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA;AAAA;AAAA,EAGb,OAAO,CAAC,UAAU;AAAA,EAClB,MAAM,OAAO,EAAE,QAAQ;AAErB,UAAM,EAAE,MAAMC;AACd,UAAM,UAAUC,QA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BACC,cAAK;AAAA,gBAAiB;gBAGgB;;AAIvC,iDAAgD;AAAA;AAAA;;;;;kBAGpD;AAAA;AAeQ;AAZ4B;;AACzB;;;AAGL;;;;AAEmB;AAIZ,8BAFK;AAAwB,0EAClC,oBAA+B;;AAArB;;;;;;AAYZ;AANc;;kBAEb;AAAe,kBACf;AAAW,kBACX;AAAK,kBACL;AAAuB;;AASpB;AANE,yBACA;AAAA,4CAAkC;AAAA;;;;AAXtB;;;;AAqBE;;AACrB;AACK,gBACL;AAAkB,gBAClB,OAAM;AAAA,gBACN;AAAK,gBACL;AAAO;;;;;;;AAiBE;AAXM,qBACZ;AAAA;AACH,gBACA;AAAK,gBACL;AAAkB,gBAClB;AAAU,gBACV;AAAM,gBACN,WAAK;AAAA,gBACL;AAAO;;;;;;;AATiB;;;;;;;;;AAhGhB;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../packages/components/message-box/src/index.vue"],"sourcesContent":["<template>\n <transition name=\"fade-in-linear\" @after-leave=\"$emit('vanish')\">\n <el-overlay\n v-show=\"visible\"\n :z-index=\"zIndex\"\n :overlay-class=\"['is-message-box', modalClass]\"\n :mask=\"modal\"\n >\n <div\n class=\"el-overlay-message-box\"\n @click=\"overlayEvent.onClick\"\n @mousedown=\"overlayEvent.onMousedown\"\n @mouseup=\"overlayEvent.onMouseup\"\n >\n <div\n ref=\"rootRef\"\n v-trap-focus\n role=\"dialog\"\n :aria-label=\"title || 'dialog'\"\n aria-modal=\"true\"\n :class=\"[\n 'el-message-box',\n customClass,\n { 'el-message-box--center': center, 'is-draggable': draggable },\n ]\"\n :style=\"customStyle\"\n @click.stop=\"\"\n >\n <div\n v-if=\"title !== null && title !== undefined\"\n ref=\"headerRef\"\n class=\"el-message-box__header\"\n >\n <div class=\"el-message-box__title\">\n <el-icon\n v-if=\"iconComponent && center\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <span>{{ title }}</span>\n </div>\n <button\n v-if=\"showClose\"\n type=\"button\"\n class=\"el-message-box__headerbtn\"\n aria-label=\"Close\"\n @click=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n @keydown.prevent.enter=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n >\n <el-icon class=\"el-message-box__close\">\n <close />\n </el-icon>\n </button>\n </div>\n <div class=\"el-message-box__content\">\n <div class=\"el-message-box__container\">\n <el-icon\n v-if=\"iconComponent && !center && hasMessage\"\n class=\"el-message-box__status\"\n :class=\"typeClass\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <div v-if=\"hasMessage\" class=\"el-message-box__message\">\n <slot>\n <p v-if=\"!dangerouslyUseHTMLString\">{{ message }}</p>\n <p v-else v-html=\"message\"></p>\n </slot>\n </div>\n </div>\n <div v-show=\"showInput\" class=\"el-message-box__input\">\n <el-input\n ref=\"inputRef\"\n v-model=\"inputValue\"\n :type=\"inputType\"\n :placeholder=\"inputPlaceholder\"\n :class=\"{ invalid: validateError }\"\n @keydown.prevent.enter=\"handleInputEnter\"\n />\n <div\n class=\"el-message-box__errormsg\"\n :style=\"{\n visibility: !!editorErrorMessage ? 'visible' : 'hidden',\n }\"\n >\n {{ editorErrorMessage }}\n </div>\n </div>\n </div>\n <div class=\"el-message-box__btns\">\n <el-button\n v-if=\"showCancelButton\"\n :loading=\"cancelButtonLoading\"\n :class=\"[cancelButtonClass]\"\n :round=\"roundButton\"\n :size=\"btnSize\"\n @click=\"handleAction('cancel')\"\n @keydown.prevent.enter=\"handleAction('cancel')\"\n >\n {{ cancelButtonText || t('el.messagebox.cancel') }}\n </el-button>\n <el-button\n v-show=\"showConfirmButton\"\n ref=\"confirmRef\"\n type=\"primary\"\n :loading=\"confirmButtonLoading\"\n :class=\"[confirmButtonClasses]\"\n :round=\"roundButton\"\n :disabled=\"confirmButtonDisabled\"\n :size=\"btnSize\"\n @click=\"handleAction('confirm')\"\n @keydown.prevent.enter=\"handleAction('confirm')\"\n >\n {{ confirmButtonText || t('el.messagebox.confirm') }}\n </el-button>\n </div>\n </div>\n </div>\n </el-overlay>\n </transition>\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onMounted,\n onBeforeUnmount,\n computed,\n watch,\n reactive,\n ref,\n toRefs,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport { TrapFocus } from '@element-plus/directives'\nimport {\n useModal,\n useLockscreen,\n useLocale,\n useRestoreActive,\n usePreventGlobal,\n useSize,\n useDraggable,\n useSameTarget,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { ElOverlay } from '@element-plus/components/overlay'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { on, off } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\nimport { isValidComponentSize } from '@element-plus/utils/validators'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { TypeComponents, TypeComponentsMap } from '@element-plus/utils/icon'\n\nimport type { PropType } from 'vue'\nimport type { ComponentSize } from '@element-plus/utils/types'\nimport type {\n Action,\n MessageBoxState,\n MessageBoxType,\n} from './message-box.type'\n\nexport default defineComponent({\n name: 'ElMessageBox',\n directives: {\n TrapFocus,\n },\n components: {\n ElButton,\n ElInput,\n ElOverlay,\n ElIcon,\n ...TypeComponents,\n },\n inheritAttrs: false,\n props: {\n buttonSize: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n modal: {\n type: Boolean,\n default: true,\n },\n lockScroll: {\n type: Boolean,\n default: true,\n },\n showClose: {\n type: Boolean,\n default: true,\n },\n closeOnClickModal: {\n type: Boolean,\n default: true,\n },\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n closeOnHashChange: {\n type: Boolean,\n default: true,\n },\n center: Boolean,\n draggable: Boolean,\n roundButton: {\n default: false,\n type: Boolean,\n },\n container: {\n type: String, // default append to body\n default: 'body',\n },\n boxType: {\n type: String as PropType<MessageBoxType>,\n default: '',\n },\n },\n emits: ['vanish', 'action'],\n setup(props, { emit }) {\n // const popup = usePopup(props, doClose)\n const { t } = useLocale()\n const visible = ref(false)\n // s represents state\n const state = reactive<MessageBoxState>({\n beforeClose: null,\n callback: null,\n cancelButtonText: '',\n cancelButtonClass: '',\n confirmButtonText: '',\n confirmButtonClass: '',\n customClass: '',\n customStyle: {},\n dangerouslyUseHTMLString: false,\n distinguishCancelAndClose: false,\n icon: '',\n inputPattern: null,\n inputPlaceholder: '',\n inputType: 'text',\n inputValue: null,\n inputValidator: null,\n inputErrorMessage: '',\n message: null,\n modalFade: true,\n modalClass: '',\n showCancelButton: false,\n showConfirmButton: true,\n type: '',\n title: undefined,\n showInput: false,\n action: '' as Action,\n confirmButtonLoading: false,\n cancelButtonLoading: false,\n confirmButtonDisabled: false,\n editorErrorMessage: '',\n // refer to: https://github.com/ElemeFE/element/commit/2999279ae34ef10c373ca795c87b020ed6753eed\n // seemed ok for now without this state.\n // isOnComposition: false, // temporary remove\n validateError: false,\n zIndex: PopupManager.nextZIndex(),\n })\n\n const typeClass = computed(() => {\n const type = state.type\n return type && TypeComponentsMap[type]\n ? `el-message-box-icon--${type}`\n : ''\n })\n\n const btnSize = useSize(\n computed(() => props.buttonSize),\n { prop: true, form: true, formItem: true }\n )\n\n const iconComponent = computed(\n () => state.icon || TypeComponentsMap[state.type] || ''\n )\n const hasMessage = computed(() => !!state.message)\n const rootRef = ref<HTMLElement>()\n const headerRef = ref<HTMLElement>()\n const inputRef = ref<HTMLElement>()\n const confirmRef = ref<HTMLElement>()\n\n const confirmButtonClasses = computed(() => state.confirmButtonClass)\n\n watch(\n () => state.inputValue,\n async (val) => {\n await nextTick()\n if (props.boxType === 'prompt' && val !== null) {\n validate()\n }\n },\n { immediate: true }\n )\n\n watch(\n () => visible.value,\n (val) => {\n if (val) {\n if (props.boxType === 'alert' || props.boxType === 'confirm') {\n nextTick().then(() => {\n confirmRef.value?.$el?.focus?.()\n })\n }\n state.zIndex = PopupManager.nextZIndex()\n }\n if (props.boxType !== 'prompt') return\n if (val) {\n nextTick().then(() => {\n if (inputRef.value && inputRef.value.$el) {\n getInputElement().focus()\n }\n })\n } else {\n state.editorErrorMessage = ''\n state.validateError = false\n }\n }\n )\n\n const draggable = computed(() => props.draggable)\n useDraggable(rootRef, headerRef, draggable)\n\n onMounted(async () => {\n await nextTick()\n if (props.closeOnHashChange) {\n on(window, 'hashchange', doClose)\n }\n })\n\n onBeforeUnmount(() => {\n if (props.closeOnHashChange) {\n off(window, 'hashchange', doClose)\n }\n })\n\n function doClose() {\n if (!visible.value) return\n visible.value = false\n nextTick(() => {\n if (state.action) emit('action', state.action)\n })\n }\n\n const handleWrapperClick = () => {\n if (props.closeOnClickModal) {\n handleAction(state.distinguishCancelAndClose ? 'close' : 'cancel')\n }\n }\n\n const overlayEvent = useSameTarget(handleWrapperClick)\n\n const handleInputEnter = () => {\n if (state.inputType !== 'textarea') {\n return handleAction('confirm')\n }\n }\n\n const handleAction = (action: Action) => {\n if (props.boxType === 'prompt' && action === 'confirm' && !validate()) {\n return\n }\n\n state.action = action\n\n if (state.beforeClose) {\n state.beforeClose?.(action, state, doClose)\n } else {\n doClose()\n }\n }\n\n const validate = () => {\n if (props.boxType === 'prompt') {\n const inputPattern = state.inputPattern\n if (inputPattern && !inputPattern.test(state.inputValue || '')) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n const inputValidator = state.inputValidator\n if (typeof inputValidator === 'function') {\n const validateResult = inputValidator(state.inputValue)\n if (validateResult === false) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n if (typeof validateResult === 'string') {\n state.editorErrorMessage = validateResult\n state.validateError = true\n return false\n }\n }\n }\n state.editorErrorMessage = ''\n state.validateError = false\n return true\n }\n\n const getInputElement = () => {\n const inputRefs = inputRef.value.$refs\n return (inputRefs.input || inputRefs.textarea) as HTMLElement\n }\n\n const handleClose = () => {\n handleAction('close')\n }\n\n // when close on press escape is disabled, pressing esc should not callout\n // any other message box and close any other dialog-ish elements\n // e.g. Dialog has a close on press esc feature, and when it closes, it calls\n // props.beforeClose method to make a intermediate state by callout a message box\n // for some verification or alerting. then if we allow global event liek this\n // to dispatch, it could callout another message box.\n if (props.closeOnPressEscape) {\n useModal(\n {\n handleClose,\n },\n visible\n )\n } else {\n usePreventGlobal(\n visible,\n 'keydown',\n (e: KeyboardEvent) => e.code === EVENT_CODE.esc\n )\n }\n\n // locks the screen to prevent scroll\n if (props.lockScroll) {\n useLockscreen(visible)\n }\n\n // restore to prev active element.\n useRestoreActive(visible)\n\n return {\n ...toRefs(state),\n overlayEvent,\n visible,\n hasMessage,\n typeClass,\n btnSize,\n iconComponent,\n confirmButtonClasses,\n rootRef,\n headerRef,\n inputRef,\n confirmRef,\n doClose, // for outside usage\n handleClose, // for out side usage\n handleWrapperClick,\n handleInputEnter,\n handleAction,\n t,\n }\n },\n})\n</script>\n"],"names":["defineComponent","TrapFocus","ElButton","ElInput","ElOverlay","ElIcon","TypeComponents","isValidComponentSize","useLocale","ref","reactive","PopupManager","computed","TypeComponentsMap","useSize","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,eACVC;AAAA;AAAA,EAEF,YAAY;AAAA,cACVC;AAAA,aACAC;AAAA,eACAC;AAAA,YACAC;AAAA,OACGC;AAAA;AAAA,EAEL,cAAc;AAAA,EACd,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAWC;AAAA;AAAA,IAEb,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,mBAAmB;AAAA,MACj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AGT;AACE;AACA;AAAqC;AAGvC;AACE;AAAa;AASf;AACE;AACE,QACE;AAAA;AAEF;AAGF;AAG8C;AAKhD;AACE;AAAc;AAIhB;AAEA;AAAO;AACK;AACV,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;AApbU;AACC;;;;;;;AAsCyB;;;;;;;;;;;;;;AApEP;AAAE;;;AACjC;AAEkB;AACF;AACF;;;AAqHN;AAlHE;AACA;AACmB,YACxB;AAA+B;;;AAGjB;AAET;AACH,cACD,cAAW;AAAM,cAChB,cAAK;AAAA;;AAA8C;;;;AAM9C;;;AAGE;AAaA;AAP2B;;AACxB;;;AAGL;;;;AAEsB;;;kBAIxB;AAAI;AACC,kBACL;AAAA,kBACC,cAAK;AAAA,kBAAmB;kBAGgB;;AAIzC,mDACW;AAAA;AAAA;;;;;;AAIf;AAeQ;AAZ4B;;AACzB;;;AAGL;;;;AAEmB;AAIZ,gCAFK;AAAwB,4EAClC,oBAA+B;;AAArB;;;;;;AAYZ;AANc;;oBAEb;AAAe,oBACf;AAAW,oBACX;AAAK,oBACL;AAAuB;;AASpB;AANE,2BACA;AAAA,8CAAoC;AAAA;;;;AAXxB;;;;AAqBE;;AACrB;AACK,kBACL;AAAkB,kBAClB,OAAM;AAAA,kBACN;AAAK,kBACL;AAAO;;;;;;;AAiBE;AAXM,uBACZ;AAAA;AACH,kBACA;AAAK,kBACL;AAAkB,kBAClB;AAAU,kBACV;AAAM,kBACN,WAAK;AAAA,kBACL;AAAO;;;;;;;AATiB;;;;;;;;;;AAzGlB;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
2
|
import type { ComponentSize } from 'element-plus/es/utils/types';
|
|
3
3
|
import type { Action, MessageBoxState, MessageBoxType } from './message-box.type';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -31,6 +31,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
31
31
|
default: boolean;
|
|
32
32
|
};
|
|
33
33
|
center: BooleanConstructor;
|
|
34
|
+
draggable: BooleanConstructor;
|
|
34
35
|
roundButton: {
|
|
35
36
|
default: boolean;
|
|
36
37
|
type: BooleanConstructor;
|
|
@@ -44,14 +45,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
45
|
default: string;
|
|
45
46
|
};
|
|
46
47
|
}, {
|
|
48
|
+
overlayEvent: {
|
|
49
|
+
onClick: (e: MouseEvent) => void;
|
|
50
|
+
onMousedown: (e: MouseEvent) => void;
|
|
51
|
+
onMouseup: (e: MouseEvent) => void;
|
|
52
|
+
};
|
|
47
53
|
visible: import("vue").Ref<boolean>;
|
|
48
54
|
hasMessage: import("vue").ComputedRef<boolean>;
|
|
49
55
|
typeClass: import("vue").ComputedRef<string>;
|
|
50
56
|
btnSize: import("vue").ComputedRef<ComponentSize>;
|
|
51
57
|
iconComponent: import("vue").ComputedRef<any>;
|
|
52
58
|
confirmButtonClasses: import("vue").ComputedRef<string>;
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
rootRef: import("vue").Ref<HTMLElement | undefined>;
|
|
60
|
+
headerRef: import("vue").Ref<HTMLElement | undefined>;
|
|
61
|
+
inputRef: import("vue").Ref<HTMLElement | undefined>;
|
|
62
|
+
confirmRef: import("vue").Ref<HTMLElement | undefined>;
|
|
55
63
|
doClose: () => void;
|
|
56
64
|
handleClose: () => void;
|
|
57
65
|
handleWrapperClick: () => void;
|
|
@@ -220,7 +228,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
220
228
|
unmounted?: (() => void) | undefined;
|
|
221
229
|
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
222
230
|
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
223
|
-
errorCaptured?: ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
231
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
224
232
|
delimiters?: [string, string] | undefined;
|
|
225
233
|
__differentiator?: string | number | symbol | undefined;
|
|
226
234
|
__isBuiltIn?: boolean | undefined;
|
|
@@ -1825,6 +1833,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1825
1833
|
default: boolean;
|
|
1826
1834
|
};
|
|
1827
1835
|
center: BooleanConstructor;
|
|
1836
|
+
draggable: BooleanConstructor;
|
|
1828
1837
|
roundButton: {
|
|
1829
1838
|
default: boolean;
|
|
1830
1839
|
type: BooleanConstructor;
|
|
@@ -1842,6 +1851,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1842
1851
|
onAction?: ((...args: any[]) => any) | undefined;
|
|
1843
1852
|
}, {
|
|
1844
1853
|
center: boolean;
|
|
1854
|
+
draggable: boolean;
|
|
1845
1855
|
showClose: boolean;
|
|
1846
1856
|
closeOnClickModal: boolean;
|
|
1847
1857
|
closeOnPressEscape: boolean;
|
|
@@ -65,6 +65,8 @@ export interface ElMessageBoxOptions {
|
|
|
65
65
|
confirmButtonClass?: string;
|
|
66
66
|
/** Whether to align the content in center */
|
|
67
67
|
center?: boolean;
|
|
68
|
+
/** Whether MessageBox can be drag */
|
|
69
|
+
draggable?: boolean;
|
|
68
70
|
/** Content of the MessageBox */
|
|
69
71
|
message?: string | VNode;
|
|
70
72
|
/** Title of the MessageBox */
|
|
@@ -839,6 +839,8 @@ declare const _Popover: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
839
839
|
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
840
840
|
} & Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").ShallowUnwrapRef<import("..").ElPopperInjectionContext> & {} & {} & import("vue").ComponentCustomProperties) | null | undefined>;
|
|
841
841
|
hide: () => void;
|
|
842
|
+
afterEnter: () => void;
|
|
843
|
+
afterLeave: () => void;
|
|
842
844
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
843
845
|
title: StringConstructor;
|
|
844
846
|
width: import("../../utils/props").BuildPropReturn<(StringConstructor | NumberConstructor)[], number, unknown, unknown, unknown>;
|
|
@@ -1783,6 +1785,8 @@ export declare const ElPopover: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1783
1785
|
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
1784
1786
|
} & Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").ShallowUnwrapRef<import("..").ElPopperInjectionContext> & {} & {} & import("vue").ComponentCustomProperties) | null | undefined>;
|
|
1785
1787
|
hide: () => void;
|
|
1788
|
+
afterEnter: () => void;
|
|
1789
|
+
afterLeave: () => void;
|
|
1786
1790
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1787
1791
|
title: StringConstructor;
|
|
1788
1792
|
width: import("../../utils/props").BuildPropReturn<(StringConstructor | NumberConstructor)[], number, unknown, unknown, unknown>;
|
|
@@ -18,7 +18,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
18
18
|
},
|
|
19
19
|
props: popover.usePopoverProps,
|
|
20
20
|
emits,
|
|
21
|
-
setup(props) {
|
|
21
|
+
setup(props, { emit }) {
|
|
22
22
|
const tooltipRef = vue.ref(null);
|
|
23
23
|
const popperRef = vue.computed(() => {
|
|
24
24
|
var _a;
|
|
@@ -49,12 +49,20 @@ const _sfc_main = vue.defineComponent({
|
|
|
49
49
|
var _a;
|
|
50
50
|
(_a = tooltipRef.value) == null ? void 0 : _a.hide();
|
|
51
51
|
};
|
|
52
|
+
const afterEnter = () => {
|
|
53
|
+
emit("after-enter");
|
|
54
|
+
};
|
|
55
|
+
const afterLeave = () => {
|
|
56
|
+
emit("after-leave");
|
|
57
|
+
};
|
|
52
58
|
return {
|
|
53
59
|
kls,
|
|
54
60
|
style,
|
|
55
61
|
tooltipRef,
|
|
56
62
|
popperRef,
|
|
57
|
-
hide
|
|
63
|
+
hide,
|
|
64
|
+
afterEnter,
|
|
65
|
+
afterLeave
|
|
58
66
|
};
|
|
59
67
|
}
|
|
60
68
|
});
|
|
@@ -71,7 +79,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
71
79
|
enterable: _ctx.enterable,
|
|
72
80
|
"popper-class": _ctx.kls,
|
|
73
81
|
"popper-style": _ctx.style,
|
|
74
|
-
persistent: ""
|
|
82
|
+
persistent: "",
|
|
83
|
+
onShow: _ctx.afterEnter,
|
|
84
|
+
onHide: _ctx.afterLeave
|
|
75
85
|
}), {
|
|
76
86
|
content: vue.withCtx(() => [
|
|
77
87
|
_ctx.title ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, vue.toDisplayString(_ctx.title), 1)) : vue.createCommentVNode("v-if", true),
|
|
@@ -83,7 +93,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
83
93
|
_ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
|
|
84
94
|
]),
|
|
85
95
|
_: 3
|
|
86
|
-
}, 16, ["aria-label", "effect", "enterable", "popper-class", "popper-style"]);
|
|
96
|
+
}, 16, ["aria-label", "effect", "enterable", "popper-class", "popper-style", "onShow", "onHide"]);
|
|
87
97
|
}
|
|
88
98
|
var Popover = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
89
99
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../packages/components/popover/src/index.vue"],"sourcesContent":["<template>\n <el-tooltip\n ref=\"tooltipRef\"\n v-bind=\"$attrs\"\n :aria-label=\"title\"\n :effect=\"effect\"\n :enterable=\"enterable\"\n :popper-class=\"kls\"\n :popper-style=\"style\"\n persistent\n >\n <template v-if=\"$slots.reference\">\n <slot name=\"reference\" />\n </template>\n\n <template #content>\n <div v-if=\"title\" class=\"el-popover__title\" role=\"title\">\n {{ title }}\n </div>\n <slot>\n {{ content }}\n </slot>\n </template>\n </el-tooltip>\n</template>\n<script lang=\"ts\">\nimport { defineComponent, computed, ref, unref } from 'vue'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { isString } from '@element-plus/utils/util'\nimport { usePopoverProps } from './popover'\n\nimport type { StyleValue } from 'vue'\n\nconst emits = ['update:visible', 'after-enter', 'after-leave']\n\nconst NAME = 'ElPopover'\n\nexport default defineComponent({\n name: NAME,\n components: {\n ElTooltip,\n },\n props: usePopoverProps,\n emits,\n setup(props) {\n const tooltipRef = ref<InstanceType<typeof ElTooltip> | null>(null)\n const popperRef = computed(() => {\n return unref(tooltipRef)?.popperRef\n })\n const width = computed(() => {\n if (isString(props.width)) {\n return props.width as string\n }\n return `${props.width}px`\n })\n\n const style = computed(() => {\n return [\n {\n width: width.value,\n },\n props.popperStyle,\n ] as StyleValue\n })\n\n const kls = computed(() => {\n return [\n { 'el-popover--plain': !!props.content },\n 'el-popover',\n props.popperClass,\n ]\n })\n\n const hide = () => {\n tooltipRef.value?.hide()\n }\n\n return {\n kls,\n style,\n tooltipRef,\n popperRef,\n hide,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ElTooltip","usePopoverProps","ref","computed"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../packages/components/popover/src/index.vue"],"sourcesContent":["<template>\n <el-tooltip\n ref=\"tooltipRef\"\n v-bind=\"$attrs\"\n :aria-label=\"title\"\n :effect=\"effect\"\n :enterable=\"enterable\"\n :popper-class=\"kls\"\n :popper-style=\"style\"\n persistent\n @show=\"afterEnter\"\n @hide=\"afterLeave\"\n >\n <template v-if=\"$slots.reference\">\n <slot name=\"reference\" />\n </template>\n\n <template #content>\n <div v-if=\"title\" class=\"el-popover__title\" role=\"title\">\n {{ title }}\n </div>\n <slot>\n {{ content }}\n </slot>\n </template>\n </el-tooltip>\n</template>\n<script lang=\"ts\">\nimport { defineComponent, computed, ref, unref } from 'vue'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { isString } from '@element-plus/utils/util'\nimport { usePopoverProps } from './popover'\n\nimport type { StyleValue } from 'vue'\n\nconst emits = ['update:visible', 'after-enter', 'after-leave']\n\nconst NAME = 'ElPopover'\n\nexport default defineComponent({\n name: NAME,\n components: {\n ElTooltip,\n },\n props: usePopoverProps,\n emits,\n setup(props, { emit }) {\n const tooltipRef = ref<InstanceType<typeof ElTooltip> | null>(null)\n const popperRef = computed(() => {\n return unref(tooltipRef)?.popperRef\n })\n const width = computed(() => {\n if (isString(props.width)) {\n return props.width as string\n }\n return `${props.width}px`\n })\n\n const style = computed(() => {\n return [\n {\n width: width.value,\n },\n props.popperStyle,\n ] as StyleValue\n })\n\n const kls = computed(() => {\n return [\n { 'el-popover--plain': !!props.content },\n 'el-popover',\n props.popperClass,\n ]\n })\n\n const hide = () => {\n tooltipRef.value?.hide()\n }\n\n const afterEnter = () => {\n emit('after-enter')\n }\n\n const afterLeave = () => {\n emit('after-leave')\n }\n\n return {\n kls,\n style,\n tooltipRef,\n popperRef,\n hide,\n afterEnter,\n afterLeave,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ElTooltip","usePopoverProps","ref","computed"],"mappings":";;;;;;;;;;;AAmCA,MAAM,QAAQ,CAAC,kBAAkB,eAAe;AAEhD,MAAM,OAAO;AAEb,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,eACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP;AAAA,EACA,MAAM,OAAO,EAAE,QAAQ;AACrB,UAAM,aAAaC,QAA2C;AAC9D,UAAM,YAAYC,aAAS,MAAM;AAC/B,aAAO;AAAmB;AAE5B;AACE,UAAI,2BAAuB;AACzB;AAAa;AAEf;AAAgB;AAGlB;AACE;AAAO;AACL;AACe;AAAA;AAET;AAAA;AAIV;AACE,aAAO;AAAA;AAC0B,QAC/B;AAAA,QACA;AAAM;AAAA;AAIV;AACE,iBAAW;AAAO;AAGpB,uBAAmB;AACjB;AAAK;AAGP,UAAM;AACJ;AAAK;AAGP,WAAO;AAAA,MACL;AAAA;AACA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;AA5EuB;AAA0B;;;;SAdlD;AAAiB;AACH;AACH,IACX;AAAc,IACd;AAAc,IACf,gBAAU;AAAA,IACT;AAAM,IACN;AAAM;;AAMI;AACO;AAKT;AADF;;;;AATyB;;;;;;;;;;;"}
|
|
@@ -838,6 +838,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
838
838
|
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
839
839
|
} & Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").ShallowUnwrapRef<import("../..").ElPopperInjectionContext> & {} & {} & import("vue").ComponentCustomProperties) | null | undefined>;
|
|
840
840
|
hide: () => void;
|
|
841
|
+
afterEnter: () => void;
|
|
842
|
+
afterLeave: () => void;
|
|
841
843
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
842
844
|
title: StringConstructor;
|
|
843
845
|
width: import("../../../utils/props").BuildPropReturn<(StringConstructor | NumberConstructor)[], number, unknown, unknown, unknown>;
|
|
@@ -11,6 +11,17 @@ export declare const ElScrollbar: import("../../utils/types").SFCWithInstall<imp
|
|
|
11
11
|
readonly always: import("../../utils/props").BuildPropReturn<BooleanConstructor, false, unknown, unknown, unknown>;
|
|
12
12
|
readonly minSize: import("../../utils/props").BuildPropReturn<NumberConstructor, 20, unknown, unknown, unknown>;
|
|
13
13
|
}, {
|
|
14
|
+
ns: {
|
|
15
|
+
namespace: import("vue").ComputedRef<string>;
|
|
16
|
+
b: (blockSuffix?: string) => string;
|
|
17
|
+
e: (element?: string | undefined) => string;
|
|
18
|
+
m: (modifier?: string | undefined) => string;
|
|
19
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
20
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
21
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
22
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
23
|
+
is: (name: string, state?: boolean) => string;
|
|
24
|
+
};
|
|
14
25
|
scrollbar$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
15
26
|
wrap$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
16
27
|
resize$: import("vue").Ref<HTMLElement | undefined>;
|
|
@@ -12,6 +12,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
12
12
|
readonly always: import("../../../utils/props").BuildPropReturn<BooleanConstructor, false, unknown, unknown, unknown>;
|
|
13
13
|
readonly minSize: import("../../../utils/props").BuildPropReturn<NumberConstructor, 20, unknown, unknown, unknown>;
|
|
14
14
|
}, {
|
|
15
|
+
ns: {
|
|
16
|
+
namespace: import("vue").ComputedRef<string>;
|
|
17
|
+
b: (blockSuffix?: string) => string;
|
|
18
|
+
e: (element?: string | undefined) => string;
|
|
19
|
+
m: (modifier?: string | undefined) => string;
|
|
20
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
21
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
22
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
23
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
24
|
+
is: (name: string, state?: boolean) => string;
|
|
25
|
+
};
|
|
15
26
|
scrollbar$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
16
27
|
wrap$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
17
28
|
resize$: import("vue").Ref<HTMLElement | undefined>;
|
|
@@ -7,9 +7,11 @@ var core = require('@vueuse/core');
|
|
|
7
7
|
var util = require('../../../utils/util.js');
|
|
8
8
|
var error = require('../../../utils/error.js');
|
|
9
9
|
require('../../../tokens/index.js');
|
|
10
|
+
require('../../../hooks/index.js');
|
|
10
11
|
var bar = require('./bar2.js');
|
|
11
12
|
var scrollbar = require('./scrollbar.js');
|
|
12
13
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
14
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
13
15
|
var scrollbar$1 = require('../../../tokens/scrollbar.js');
|
|
14
16
|
|
|
15
17
|
const _sfc_main = vue.defineComponent({
|
|
@@ -20,6 +22,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
20
22
|
props: scrollbar.scrollbarProps,
|
|
21
23
|
emits: scrollbar.scrollbarEmits,
|
|
22
24
|
setup(props, { emit }) {
|
|
25
|
+
const ns = index.useNamespace("scrollbar");
|
|
23
26
|
let stopResizeObserver = void 0;
|
|
24
27
|
let stopResizeListener = void 0;
|
|
25
28
|
const scrollbar$ = vue.ref();
|
|
@@ -99,6 +102,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
99
102
|
vue.nextTick(() => update());
|
|
100
103
|
});
|
|
101
104
|
return {
|
|
105
|
+
ns,
|
|
102
106
|
scrollbar$,
|
|
103
107
|
wrap$,
|
|
104
108
|
resize$,
|
|
@@ -117,26 +121,25 @@ const _sfc_main = vue.defineComponent({
|
|
|
117
121
|
};
|
|
118
122
|
}
|
|
119
123
|
});
|
|
120
|
-
const _hoisted_1 = {
|
|
121
|
-
ref: "scrollbar$",
|
|
122
|
-
class: "el-scrollbar"
|
|
123
|
-
};
|
|
124
124
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
125
125
|
const _component_bar = vue.resolveComponent("bar");
|
|
126
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
126
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
127
|
+
ref: "scrollbar$",
|
|
128
|
+
class: vue.normalizeClass(_ctx.ns.b())
|
|
129
|
+
}, [
|
|
127
130
|
vue.createElementVNode("div", {
|
|
128
131
|
ref: "wrap$",
|
|
129
132
|
class: vue.normalizeClass([
|
|
130
133
|
_ctx.wrapClass,
|
|
131
|
-
"
|
|
132
|
-
_ctx.
|
|
134
|
+
_ctx.ns.e("wrap"),
|
|
135
|
+
{ [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
|
|
133
136
|
]),
|
|
134
137
|
style: vue.normalizeStyle(_ctx.style),
|
|
135
138
|
onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
|
|
136
139
|
}, [
|
|
137
140
|
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
|
|
138
141
|
ref: "resize$",
|
|
139
|
-
class: vue.normalizeClass(["
|
|
142
|
+
class: vue.normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
|
|
140
143
|
style: vue.normalizeStyle(_ctx.viewStyle)
|
|
141
144
|
}, {
|
|
142
145
|
default: vue.withCtx(() => [
|
|
@@ -154,7 +157,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
154
157
|
"ratio-x": _ctx.ratioX,
|
|
155
158
|
"ratio-y": _ctx.ratioY
|
|
156
159
|
}, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : vue.createCommentVNode("v-if", true)
|
|
157
|
-
],
|
|
160
|
+
], 2);
|
|
158
161
|
}
|
|
159
162
|
var Scrollbar = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
160
163
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbar$\" class=\"
|
|
1
|
+
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbar$\" :class=\"ns.b()\">\n <div\n ref=\"wrap$\"\n :class=\"[\n wrapClass,\n ns.e('wrap'),\n { [ns.em('wrap', 'hidden-default')]: !native },\n ]\"\n :style=\"style\"\n @scroll=\"handleScroll\"\n >\n <component\n :is=\"tag\"\n ref=\"resize$\"\n :class=\"[ns.e('view'), viewClass]\"\n :style=\"viewStyle\"\n >\n <slot />\n </component>\n </div>\n <template v-if=\"!native\">\n <bar\n ref=\"barRef\"\n :height=\"sizeHeight\"\n :width=\"sizeWidth\"\n :always=\"always\"\n :ratio-x=\"ratioX\"\n :ratio-y=\"ratioY\"\n ></bar>\n </template>\n </div>\n</template>\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n nextTick,\n onMounted,\n provide,\n ref,\n watch,\n reactive,\n} from 'vue'\nimport { useResizeObserver, useEventListener } from '@vueuse/core'\nimport { addUnit, isNumber } from '@element-plus/utils/util'\nimport { debugWarn } from '@element-plus/utils/error'\nimport { scrollbarContextKey } from '@element-plus/tokens'\nimport { useNamespace } from '@element-plus/hooks'\nimport Bar from './bar.vue'\n\nimport { scrollbarProps, scrollbarEmits } from './scrollbar'\nimport type { StyleValue, CSSProperties } from 'vue'\n\nexport default defineComponent({\n name: 'ElScrollbar',\n components: {\n Bar,\n },\n props: scrollbarProps,\n emits: scrollbarEmits,\n\n setup(props, { emit }) {\n const ns = useNamespace('scrollbar')\n\n let stopResizeObserver: (() => void) | undefined = undefined\n let stopResizeListener: (() => void) | undefined = undefined\n\n const scrollbar$ = ref<HTMLDivElement>()\n const wrap$ = ref<HTMLDivElement>()\n const resize$ = ref<HTMLElement>()\n\n const sizeWidth = ref('0')\n const sizeHeight = ref('0')\n const barRef = ref()\n const moveX = ref(0)\n const moveY = ref(0)\n const ratioY = ref(1)\n const ratioX = ref(1)\n const SCOPE = 'ElScrollbar'\n const GAP = 4 // top 2 + bottom 2 of bar instance\n\n const style = computed<StyleValue>(() => {\n const style: CSSProperties = {}\n if (props.height) style.height = addUnit(props.height)\n if (props.maxHeight) style.maxHeight = addUnit(props.maxHeight)\n return [props.wrapStyle, style]\n })\n\n const handleScroll = () => {\n if (wrap$.value) {\n barRef.value?.handleScroll(wrap$.value)\n\n emit('scroll', {\n scrollTop: wrap$.value.scrollTop,\n scrollLeft: wrap$.value.scrollLeft,\n })\n }\n }\n\n const setScrollTop = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(SCOPE, 'value must be a number')\n return\n }\n wrap$.value!.scrollTop = value\n }\n\n const setScrollLeft = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(SCOPE, 'value must be a number')\n return\n }\n wrap$.value!.scrollLeft = value\n }\n\n const update = () => {\n if (!wrap$.value) return\n\n const offsetHeight = wrap$.value.offsetHeight - GAP\n const offsetWidth = wrap$.value.offsetWidth - GAP\n\n const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight\n const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth\n const height = Math.max(originalHeight, props.minSize)\n const width = Math.max(originalWidth, props.minSize)\n\n ratioY.value =\n originalHeight /\n (offsetHeight - originalHeight) /\n (height / (offsetHeight - height))\n ratioX.value =\n originalWidth /\n (offsetWidth - originalWidth) /\n (width / (offsetWidth - width))\n\n sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : ''\n sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : ''\n }\n\n watch(\n () => props.noresize,\n (noresize) => {\n if (noresize) {\n stopResizeObserver?.()\n stopResizeListener?.()\n } else {\n ;({ stop: stopResizeObserver } = useResizeObserver(resize$, update))\n stopResizeListener = useEventListener('resize', update)\n }\n },\n { immediate: true }\n )\n\n provide(\n scrollbarContextKey,\n reactive({\n scrollbarElement: scrollbar$,\n wrapElement: wrap$,\n })\n )\n\n onMounted(() => {\n if (!props.native) nextTick(() => update())\n })\n\n return {\n ns,\n scrollbar$,\n wrap$,\n resize$,\n barRef,\n moveX,\n moveY,\n ratioX,\n ratioY,\n sizeWidth,\n sizeHeight,\n style,\n update,\n handleScroll,\n setScrollTop,\n setScrollLeft,\n }\n },\n})\n</script>\n"],"names":["defineComponent","Bar","scrollbarProps","scrollbarEmits","useNamespace","ref","computed","addUnit","_openBlock"],"mappings":";;;;;;;;;;;;;;;;AAsDA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,SACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP,OAAOC;AAAA,EAEP,MAAM,OAAO,EAAE,QAAQ;AACrB,UAAM,KAAKC,mBAAa;AAExB,QAAI,qBAA+C;AACnD,QAAI,qBAA+C;AAEnD,UAAM,aAAaC;AACnB,UAAM,QAAQA;AACd,UAAM,UAAUA;AAEhB,UAAM,YAAYA,QAAI;AACtB,UAAM,aAAaA,QAAI;AACvB,UAAM,SAASA;AACf,UAAM,QAAQA,QAAI;AAClB,UAAM,QAAQA,QAAI;AAClB,UAAM,SAASA,QAAI;AACnB,UAAM,SAASA,QAAI;AACnB,UAAM,QAAQ;AACd,UAAM,MAAM;AAEZ,UAAM,QAAQC,aAAqB,MAAM;AACvC,YAAM,SAAuB;AAC7B,UAAI,MAAM;AAAQ,eAAM,SAASC,aAAQ,MAAM;AAC/C,UAAI,MAAM;AAAW,eAAM,YAAYA,aAAQ,MAAM;AACrD,aAAO,CAAC,MAAM,WAAW;AAAA;AAG3B,UAAM,eAAe,MAAM;AACzB,UAAI;AACF,eAAO;AAEP;AAAe,qBACF;AAAY,UACvB;AAAwB;AAAA;AAAA;AAK9B;AACE,UAAI;AACF,8BAAiB;AACjB;AAAA;AAEF;AAAyB;AAG3B;AACE,UAAI;AACF,8BAAiB;AACjB;AAAA;AAEF;AAA0B;AAG5B;AACE,UAAI;AAAc;AAElB;AACA,YAAM,oBAAoB,MAAM;AAEhC,YAAM,qCAAqC,MAAM;AACjD,YAAM;AACN,YAAM,wCAAwC;AAC9C,YAAM,aAAa,IAAI,eAAe;AAEtC;AAIA,aAAO,QACL,gDAEC;AAEH,kCAA4B;AAC5B,gBAAU,oCAAoC,GAAG,YAAY;AAAA;AAG/D;AAGI,cAAI;AACF;AACA;AAAA;AAEA;AAAC,QAAC;AACF;AAAgD;AAAA,OAGpD;AAGF;AAEW;AACW,MAClB;AAAa;AAIjB;AACE;AAAmB,iBAAS,MAAM;AAAA;AAGpC;AAAO;AACL,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;AArLiB,SAAOC;AAAA;;AAC1B;AACa;AACL;AAAqB;AAAU,aAAyB;AAAE;;;AAMzD;;;AAIQ;AACP,QACL;AAAgB;;;AAET;;;;OAGK;AAAA;;AAET,MACH;AAAA,MACA;AAAO,MACP,YAAQ;AAAA,MACR;AAAS,MACT;AAAS;;;;;;;;;"}
|
|
@@ -5,6 +5,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5
5
|
readonly ratio: import("../../../utils/props").BuildPropReturn<NumberConstructor, unknown, true, unknown, unknown>;
|
|
6
6
|
readonly always: BooleanConstructor;
|
|
7
7
|
}, {
|
|
8
|
+
ns: {
|
|
9
|
+
namespace: import("vue").ComputedRef<string>;
|
|
10
|
+
b: (blockSuffix?: string) => string;
|
|
11
|
+
e: (element?: string | undefined) => string;
|
|
12
|
+
m: (modifier?: string | undefined) => string;
|
|
13
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
14
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
15
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
16
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
17
|
+
is: (name: string, state?: boolean) => string;
|
|
18
|
+
};
|
|
8
19
|
instance: import("vue").Ref<HTMLDivElement | undefined>;
|
|
9
20
|
thumb: import("vue").Ref<HTMLDivElement | undefined>;
|
|
10
21
|
bar: import("vue").ComputedRef<{
|
|
@@ -6,10 +6,12 @@ var vue = require('vue');
|
|
|
6
6
|
var core = require('@vueuse/core');
|
|
7
7
|
require('../../../tokens/index.js');
|
|
8
8
|
var error = require('../../../utils/error.js');
|
|
9
|
+
require('../../../hooks/index.js');
|
|
9
10
|
var util = require('./util.js');
|
|
10
11
|
var thumb = require('./thumb.js');
|
|
11
12
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
12
13
|
var scrollbar = require('../../../tokens/scrollbar.js');
|
|
14
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
13
15
|
|
|
14
16
|
const COMPONENT_NAME = "Thumb";
|
|
15
17
|
const _sfc_main = vue.defineComponent({
|
|
@@ -17,6 +19,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
17
19
|
props: thumb.thumbProps,
|
|
18
20
|
setup(props) {
|
|
19
21
|
const scrollbar$1 = vue.inject(scrollbar.scrollbarContextKey);
|
|
22
|
+
const ns = index.useNamespace("scrollbar");
|
|
20
23
|
if (!scrollbar$1)
|
|
21
24
|
error.throwError(COMPONENT_NAME, "can not inject scrollbar context");
|
|
22
25
|
const instance = vue.ref();
|
|
@@ -102,6 +105,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
102
105
|
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
|
|
103
106
|
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
|
|
104
107
|
return {
|
|
108
|
+
ns,
|
|
105
109
|
instance,
|
|
106
110
|
thumb,
|
|
107
111
|
bar,
|
|
@@ -113,25 +117,27 @@ const _sfc_main = vue.defineComponent({
|
|
|
113
117
|
}
|
|
114
118
|
});
|
|
115
119
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
116
|
-
return vue.openBlock(), vue.createBlock(vue.Transition, {
|
|
120
|
+
return vue.openBlock(), vue.createBlock(vue.Transition, {
|
|
121
|
+
name: _ctx.ns.b("fade")
|
|
122
|
+
}, {
|
|
117
123
|
default: vue.withCtx(() => [
|
|
118
124
|
vue.withDirectives(vue.createElementVNode("div", {
|
|
119
125
|
ref: "instance",
|
|
120
|
-
class: vue.normalizeClass(["
|
|
126
|
+
class: vue.normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
|
|
121
127
|
onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
|
|
122
128
|
}, [
|
|
123
129
|
vue.createElementVNode("div", {
|
|
124
130
|
ref: "thumb",
|
|
125
|
-
class: "
|
|
131
|
+
class: vue.normalizeClass(_ctx.ns.e("thumb")),
|
|
126
132
|
style: vue.normalizeStyle(_ctx.thumbStyle),
|
|
127
133
|
onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
|
|
128
|
-
}, null,
|
|
134
|
+
}, null, 38)
|
|
129
135
|
], 34), [
|
|
130
136
|
[vue.vShow, _ctx.always || _ctx.visible]
|
|
131
137
|
])
|
|
132
138
|
]),
|
|
133
139
|
_: 1
|
|
134
|
-
});
|
|
140
|
+
}, 8, ["name"]);
|
|
135
141
|
}
|
|
136
142
|
var Thumb = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
137
143
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thumb2.js","sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition name=\"
|
|
1
|
+
{"version":3,"file":"thumb2.js","sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n ></div>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n inject,\n onBeforeUnmount,\n ref,\n toRef,\n} from 'vue'\nimport { useEventListener, isClient } from '@vueuse/core'\nimport { scrollbarContextKey } from '@element-plus/tokens'\nimport { throwError } from '@element-plus/utils/error'\nimport { useNamespace } from '@element-plus/hooks'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport { thumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nexport default defineComponent({\n name: COMPONENT_NAME,\n props: thumbProps,\n\n setup(props) {\n const scrollbar = inject(scrollbarContextKey)\n const ns = useNamespace('scrollbar')\n\n if (!scrollbar)\n throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\n const instance = ref<HTMLDivElement>()\n const thumb = ref<HTMLDivElement>()\n\n const thumbState = ref({})\n const visible = ref(false)\n\n let cursorDown = false\n let cursorLeave = false\n let originalOnSelectStart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = isClient ? document.onselectstart : null\n\n const bar = computed(\n () => BAR_MAP[props.vertical ? 'vertical' : 'horizontal']\n )\n\n const thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n )\n\n const offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n )\n\n const clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n }\n\n const clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage *\n scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n }\n\n const startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n }\n\n const mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage *\n scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n }\n\n const mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n }\n\n const mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n }\n\n const mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n }\n\n onBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n })\n\n const restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n }\n\n useEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n )\n useEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n )\n\n return {\n ns,\n instance,\n thumb,\n bar,\n thumbStyle,\n visible,\n clickTrackHandler,\n clickThumbHandler,\n }\n },\n})\n</script>\n"],"names":["defineComponent","thumbProps","scrollbar","inject","scrollbarContextKey","useNamespace","ref","isClient","computed","BAR_MAP","renderThumbStyle","toRef"],"mappings":";;;;;;;;;;;;;;;AAmCA,MAAM,iBAAiB;AACvB,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,OAAOC;AAAA,EAEP,MAAM,OAAO;AACX,UAAMC,cAAYC,WAAOC;AACzB,UAAM,KAAKC,mBAAa;AAExB,QAAI,CAACH;AACH,uBAAW,gBAAgB;AAE7B,UAAM,WAAWI;AACjB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;SAhMe;AAAI;;;AACrB,yBAEM;AAAU;AACR,QACL;AAAW;;AAEZ;AACa;AACL,UACL;AAAO,UACP,0BAAS;AAAA;;;AATM;;;;;;;;;;;"}
|
|
@@ -5,6 +5,17 @@ export declare const ElSkeleton: import("../../utils/types").SFCWithInstall<impo
|
|
|
5
5
|
readonly loading: import("../../utils/props").BuildPropReturn<BooleanConstructor, true, unknown, unknown, unknown>;
|
|
6
6
|
readonly throttle: import("../../utils/props").BuildPropReturn<NumberConstructor, unknown, unknown, unknown, unknown>;
|
|
7
7
|
}, {
|
|
8
|
+
ns: {
|
|
9
|
+
namespace: import("vue").ComputedRef<string>;
|
|
10
|
+
b: (blockSuffix?: string) => string;
|
|
11
|
+
e: (element?: string | undefined) => string;
|
|
12
|
+
m: (modifier?: string | undefined) => string;
|
|
13
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
14
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
15
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
16
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
17
|
+
is: (name: string, state?: boolean) => string;
|
|
18
|
+
};
|
|
8
19
|
uiLoading: import("vue").Ref<boolean>;
|
|
9
20
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
21
|
readonly animated: import("../../utils/props").BuildPropReturn<BooleanConstructor, false, unknown, unknown, unknown>;
|
|
@@ -21,7 +32,19 @@ export declare const ElSkeleton: import("../../utils/types").SFCWithInstall<impo
|
|
|
21
32
|
}>> & {
|
|
22
33
|
SkeletonItem: import("vue").DefineComponent<{
|
|
23
34
|
readonly variant: import("../../utils/props").BuildPropReturn<StringConstructor, "text", unknown, "text" | "button" | "circle" | "caption" | "h1" | "h3" | "p" | "image" | "rect", unknown>;
|
|
24
|
-
},
|
|
35
|
+
}, {
|
|
36
|
+
ns: {
|
|
37
|
+
namespace: import("vue").ComputedRef<string>;
|
|
38
|
+
b: (blockSuffix?: string) => string;
|
|
39
|
+
e: (element?: string | undefined) => string;
|
|
40
|
+
m: (modifier?: string | undefined) => string;
|
|
41
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
42
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
43
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
44
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
45
|
+
is: (name: string, state?: boolean) => string;
|
|
46
|
+
};
|
|
47
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
48
|
readonly variant: import("../../utils/props").BuildPropReturn<StringConstructor, "text", unknown, "text" | "button" | "circle" | "caption" | "h1" | "h3" | "p" | "image" | "rect", unknown>;
|
|
26
49
|
}>>, {
|
|
27
50
|
variant: import("../../utils/props").BuildPropType<StringConstructor, "text" | "button" | "circle" | "caption" | "h1" | "h3" | "p" | "image" | "rect", unknown>;
|
|
@@ -30,7 +53,19 @@ export declare const ElSkeleton: import("../../utils/types").SFCWithInstall<impo
|
|
|
30
53
|
export default ElSkeleton;
|
|
31
54
|
export declare const ElSkeletonItem: import("../../utils/types").SFCWithInstall<import("vue").DefineComponent<{
|
|
32
55
|
readonly variant: import("../../utils/props").BuildPropReturn<StringConstructor, "text", unknown, "text" | "button" | "circle" | "caption" | "h1" | "h3" | "p" | "image" | "rect", unknown>;
|
|
33
|
-
},
|
|
56
|
+
}, {
|
|
57
|
+
ns: {
|
|
58
|
+
namespace: import("vue").ComputedRef<string>;
|
|
59
|
+
b: (blockSuffix?: string) => string;
|
|
60
|
+
e: (element?: string | undefined) => string;
|
|
61
|
+
m: (modifier?: string | undefined) => string;
|
|
62
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
63
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
64
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
65
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
66
|
+
is: (name: string, state?: boolean) => string;
|
|
67
|
+
};
|
|
68
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
69
|
readonly variant: import("../../utils/props").BuildPropReturn<StringConstructor, "text", unknown, "text" | "button" | "circle" | "caption" | "h1" | "h3" | "p" | "image" | "rect", unknown>;
|
|
35
70
|
}>>, {
|
|
36
71
|
variant: import("../../utils/props").BuildPropType<StringConstructor, "text" | "button" | "circle" | "caption" | "h1" | "h3" | "p" | "image" | "rect", unknown>;
|