@element-plus/nightly 0.0.20220202 → 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 +207 -116
- package/dist/index.full.min.js +6 -6
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +6 -6
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +208 -118
- 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/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/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/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/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/index.css +1 -1
- package/theme-chalk/src/dialog.scss +7 -0
- package/theme-chalk/src/message-box.scss +26 -15
- 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,o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B,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,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,WAAW;AAAA,IACX,aAAa;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA;AAAA,IAER,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,SAAS;AAAA,M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C;;;;;;;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 */
|
package/lib/hooks/index.d.ts
CHANGED
package/lib/hooks/index.js
CHANGED
|
@@ -4,28 +4,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var index = require('./use-attrs/index.js');
|
|
6
6
|
var index$1 = require('./use-common-props/index.js');
|
|
7
|
-
var index$2 = require('./use-
|
|
8
|
-
var index$3 = require('./use-
|
|
9
|
-
var index$4 = require('./use-
|
|
10
|
-
var index$5 = require('./use-
|
|
11
|
-
var index$6 = require('./use-
|
|
12
|
-
var index$7 = require('./use-
|
|
13
|
-
var index$8 = require('./use-
|
|
14
|
-
var index$9 = require('./use-
|
|
15
|
-
var index$a = require('./use-
|
|
16
|
-
var index$b = require('./use-
|
|
17
|
-
var index$c = require('./use-
|
|
18
|
-
var index$d = require('./use-
|
|
19
|
-
var index$e = require('./use-
|
|
20
|
-
var index$f = require('./use-
|
|
21
|
-
var index$g = require('./use-
|
|
22
|
-
var index$h = require('./use-
|
|
23
|
-
var index$i = require('./use-
|
|
24
|
-
var index$j = require('./use-
|
|
25
|
-
var index$k = require('./use-
|
|
26
|
-
var index$l = require('./use-
|
|
27
|
-
var index$m = require('./use-
|
|
28
|
-
var index$n = require('./use-
|
|
7
|
+
var index$2 = require('./use-draggable/index.js');
|
|
8
|
+
var index$3 = require('./use-focus/index.js');
|
|
9
|
+
var index$4 = require('./use-form-item/index.js');
|
|
10
|
+
var index$5 = require('./use-global-config/index.js');
|
|
11
|
+
var index$6 = require('./use-locale/index.js');
|
|
12
|
+
var index$7 = require('./use-lockscreen/index.js');
|
|
13
|
+
var index$8 = require('./use-modal/index.js');
|
|
14
|
+
var index$9 = require('./use-model-toggle/index.js');
|
|
15
|
+
var index$a = require('./use-prevent-global/index.js');
|
|
16
|
+
var index$b = require('./use-prop/index.js');
|
|
17
|
+
var index$c = require('./use-restore-active/index.js');
|
|
18
|
+
var index$d = require('./use-same-target/index.js');
|
|
19
|
+
var index$e = require('./use-teleport/index.js');
|
|
20
|
+
var index$f = require('./use-throttle-render/index.js');
|
|
21
|
+
var index$g = require('./use-timeout/index.js');
|
|
22
|
+
var index$h = require('./use-transition-fallthrough/index.js');
|
|
23
|
+
var index$i = require('./use-id/index.js');
|
|
24
|
+
var index$j = require('./use-escape-keydown/index.js');
|
|
25
|
+
var index$k = require('./use-popper-container/index.js');
|
|
26
|
+
var index$l = require('./use-intermediate-render/index.js');
|
|
27
|
+
var index$m = require('./use-delayed-toggle/index.js');
|
|
28
|
+
var index$n = require('./use-forward-ref/index.js');
|
|
29
|
+
var index$o = require('./use-namespace/index.js');
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
|
|
@@ -33,40 +34,41 @@ exports.useAttrs = index.useAttrs;
|
|
|
33
34
|
exports.useDisabled = index$1.useDisabled;
|
|
34
35
|
exports.useSize = index$1.useSize;
|
|
35
36
|
exports.useSizeProp = index$1.useSizeProp;
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
49
|
-
exports.
|
|
50
|
-
exports.
|
|
51
|
-
exports.
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
56
|
-
exports.
|
|
57
|
-
exports.
|
|
58
|
-
exports.
|
|
59
|
-
exports.
|
|
60
|
-
exports.
|
|
61
|
-
exports.
|
|
62
|
-
exports.
|
|
63
|
-
exports.
|
|
64
|
-
exports.
|
|
65
|
-
exports.
|
|
66
|
-
exports.
|
|
67
|
-
exports.
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
70
|
-
exports.
|
|
71
|
-
exports.
|
|
37
|
+
exports.useDraggable = index$2.useDraggable;
|
|
38
|
+
exports.useFocus = index$3.useFocus;
|
|
39
|
+
exports.useFormItem = index$4.useFormItem;
|
|
40
|
+
exports.provideGlobalConfig = index$5.provideGlobalConfig;
|
|
41
|
+
exports.useGlobalConfig = index$5.useGlobalConfig;
|
|
42
|
+
exports.buildLocaleContext = index$6.buildLocaleContext;
|
|
43
|
+
exports.buildTranslator = index$6.buildTranslator;
|
|
44
|
+
exports.translate = index$6.translate;
|
|
45
|
+
exports.useLocale = index$6.useLocale;
|
|
46
|
+
exports.useLockscreen = index$7.useLockscreen;
|
|
47
|
+
exports.useModal = index$8.useModal;
|
|
48
|
+
exports.createModelToggleComposable = index$9.createModelToggleComposable;
|
|
49
|
+
exports.useModelToggle = index$9.useModelToggle;
|
|
50
|
+
exports.useModelToggleEmits = index$9.useModelToggleEmits;
|
|
51
|
+
exports.useModelToggleProps = index$9.useModelToggleProps;
|
|
52
|
+
exports.usePreventGlobal = index$a.usePreventGlobal;
|
|
53
|
+
exports.useProp = index$b.useProp;
|
|
54
|
+
exports.useRestoreActive = index$c.useRestoreActive;
|
|
55
|
+
exports.useSameTarget = index$d.useSameTarget;
|
|
56
|
+
exports.useTeleport = index$e.useTeleport;
|
|
57
|
+
exports.useThrottleRender = index$f.useThrottleRender;
|
|
58
|
+
exports.useTimeout = index$g.useTimeout;
|
|
59
|
+
exports.useTransitionFallthrough = index$h.useTransitionFallthrough;
|
|
60
|
+
exports.useTransitionFallthroughEmits = index$h.useTransitionFallthroughEmits;
|
|
61
|
+
exports.ID_INJECTION_KEY = index$i.ID_INJECTION_KEY;
|
|
62
|
+
exports.useId = index$i.useId;
|
|
63
|
+
exports.useEscapeKeydown = index$j.useEscapeKeydown;
|
|
64
|
+
exports.POPPER_CONTAINER_ID = index$k.POPPER_CONTAINER_ID;
|
|
65
|
+
exports.POPPER_CONTAINER_SELECTOR = index$k.POPPER_CONTAINER_SELECTOR;
|
|
66
|
+
exports.usePopperContainer = index$k.usePopperContainer;
|
|
67
|
+
exports.useDelayedRender = index$l.useDelayedRender;
|
|
68
|
+
exports.useDelayedToggle = index$m.useDelayedToggle;
|
|
69
|
+
exports.useDelayedToggleProps = index$m.useDelayedToggleProps;
|
|
70
|
+
exports.FORWARD_REF_INJECTION_KEY = index$n.FORWARD_REF_INJECTION_KEY;
|
|
71
|
+
exports.useForwardRef = index$n.useForwardRef;
|
|
72
|
+
exports.useForwardRefDirective = index$n.useForwardRefDirective;
|
|
73
|
+
exports.useNamespace = index$o.useNamespace;
|
|
72
74
|
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var util = require('../../utils/util.js');
|
|
7
|
+
|
|
8
|
+
const useDraggable = (targetRef, dragRef, draggable) => {
|
|
9
|
+
let transform = {
|
|
10
|
+
offsetX: 0,
|
|
11
|
+
offsetY: 0
|
|
12
|
+
};
|
|
13
|
+
const onMousedown = (e) => {
|
|
14
|
+
const downX = e.clientX;
|
|
15
|
+
const downY = e.clientY;
|
|
16
|
+
const { offsetX, offsetY } = transform;
|
|
17
|
+
const targetRect = targetRef.value.getBoundingClientRect();
|
|
18
|
+
const targetLeft = targetRect.left;
|
|
19
|
+
const targetTop = targetRect.top;
|
|
20
|
+
const targetWidth = targetRect.width;
|
|
21
|
+
const targetHeight = targetRect.height;
|
|
22
|
+
const clientWidth = document.documentElement.clientWidth;
|
|
23
|
+
const clientHeight = document.documentElement.clientHeight;
|
|
24
|
+
const minLeft = -targetLeft + offsetX;
|
|
25
|
+
const minTop = -targetTop + offsetY;
|
|
26
|
+
const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
|
|
27
|
+
const maxTop = clientHeight - targetTop - targetHeight + offsetY;
|
|
28
|
+
const onMousemove = (e2) => {
|
|
29
|
+
const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
|
|
30
|
+
const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
|
|
31
|
+
transform = {
|
|
32
|
+
offsetX: moveX,
|
|
33
|
+
offsetY: moveY
|
|
34
|
+
};
|
|
35
|
+
targetRef.value.style.transform = `translate(${util.addUnit(moveX)}, ${util.addUnit(moveY)})`;
|
|
36
|
+
};
|
|
37
|
+
const onMouseup = () => {
|
|
38
|
+
document.removeEventListener("mousemove", onMousemove);
|
|
39
|
+
document.removeEventListener("mouseup", onMouseup);
|
|
40
|
+
};
|
|
41
|
+
document.addEventListener("mousemove", onMousemove);
|
|
42
|
+
document.addEventListener("mouseup", onMouseup);
|
|
43
|
+
};
|
|
44
|
+
const onDraggable = () => {
|
|
45
|
+
if (dragRef.value && targetRef.value) {
|
|
46
|
+
dragRef.value.addEventListener("mousedown", onMousedown);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const offDraggable = () => {
|
|
50
|
+
if (dragRef.value && targetRef.value) {
|
|
51
|
+
dragRef.value.removeEventListener("mousedown", onMousedown);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
vue.onMounted(() => {
|
|
55
|
+
vue.watchEffect(() => {
|
|
56
|
+
if (draggable.value) {
|
|
57
|
+
onDraggable();
|
|
58
|
+
} else {
|
|
59
|
+
offDraggable();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
vue.onBeforeUnmount(() => {
|
|
64
|
+
offDraggable();
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.useDraggable = useDraggable;
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-draggable/index.ts"],"sourcesContent":["import { onBeforeUnmount, onMounted, watchEffect } from 'vue'\nimport { addUnit } from '@element-plus/utils/util'\nimport type { Ref, ComputedRef } from 'vue'\n\nexport const useDraggable = (\n targetRef: Ref<HTMLElement | undefined>,\n dragRef: Ref<HTMLElement | undefined>,\n draggable: ComputedRef<boolean>\n) => {\n let transform = {\n offsetX: 0,\n offsetY: 0,\n }\n\n const onMousedown = (e: MouseEvent) => {\n const downX = e.clientX\n const downY = e.clientY\n const { offsetX, offsetY } = transform\n\n const targetRect = targetRef.value.getBoundingClientRect()\n const targetLeft = targetRect.left\n const targetTop = targetRect.top\n const targetWidth = targetRect.width\n const targetHeight = targetRect.height\n\n const clientWidth = document.documentElement.clientWidth\n const clientHeight = document.documentElement.clientHeight\n\n const minLeft = -targetLeft + offsetX\n const minTop = -targetTop + offsetY\n const maxLeft = clientWidth - targetLeft - targetWidth + offsetX\n const maxTop = clientHeight - targetTop - targetHeight + offsetY\n\n const onMousemove = (e: MouseEvent) => {\n const moveX = Math.min(\n Math.max(offsetX + e.clientX - downX, minLeft),\n maxLeft\n )\n const moveY = Math.min(\n Math.max(offsetY + e.clientY - downY, minTop),\n maxTop\n )\n\n transform = {\n offsetX: moveX,\n offsetY: moveY,\n }\n targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(\n moveY\n )})`\n }\n\n const onMouseup = () => {\n document.removeEventListener('mousemove', onMousemove)\n document.removeEventListener('mouseup', onMouseup)\n }\n\n document.addEventListener('mousemove', onMousemove)\n document.addEventListener('mouseup', onMouseup)\n }\n\n const onDraggable = () => {\n if (dragRef.value && targetRef.value) {\n dragRef.value.addEventListener('mousedown', onMousedown)\n }\n }\n\n const offDraggable = () => {\n if (dragRef.value && targetRef.value) {\n dragRef.value.removeEventListener('mousedown', onMousedown)\n }\n }\n\n onMounted(() => {\n watchEffect(() => {\n if (draggable.value) {\n onDraggable()\n } else {\n offDraggable()\n }\n })\n })\n\n onBeforeUnmount(() => {\n offDraggable()\n })\n}\n"],"names":["addUnit","onMounted","watchEffect","onBeforeUnmount"],"mappings":";;;;;;;AAEY,MAAC,YAAY,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,KAAK;AAC/D,EAAE,IAAI,SAAS,GAAG;AAClB,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,OAAO,EAAE,CAAC;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK;AAC7B,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC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Y,EAAE,CAAC;AACvB,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG,CAAC,CAAC;AACL,EAAEC,mBAAe,CAAC,MAAM;AACxB,IAAI,YAAY,EAAE,CAAC;AACnB,GAAG,CAAC,CAAC;AACL;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -164,28 +164,29 @@ var index$1a = require('./directives/mousewheel/index.js');
|
|
|
164
164
|
var index$1b = require('./directives/resize/index.js');
|
|
165
165
|
var index$1c = require('./hooks/use-attrs/index.js');
|
|
166
166
|
var index$1d = require('./hooks/use-common-props/index.js');
|
|
167
|
-
var index$1e = require('./hooks/use-
|
|
168
|
-
var index$1f = require('./hooks/use-
|
|
169
|
-
var index$1g = require('./hooks/use-
|
|
170
|
-
var index$1h = require('./hooks/use-
|
|
171
|
-
var index$1i = require('./hooks/use-
|
|
172
|
-
var index$1j = require('./hooks/use-
|
|
173
|
-
var index$1k = require('./hooks/use-
|
|
174
|
-
var index$1l = require('./hooks/use-
|
|
175
|
-
var index$1m = require('./hooks/use-
|
|
176
|
-
var index$1n = require('./hooks/use-
|
|
177
|
-
var index$1o = require('./hooks/use-
|
|
178
|
-
var index$1p = require('./hooks/use-
|
|
179
|
-
var index$1q = require('./hooks/use-
|
|
180
|
-
var index$1r = require('./hooks/use-
|
|
181
|
-
var index$1s = require('./hooks/use-
|
|
182
|
-
var index$1t = require('./hooks/use-
|
|
183
|
-
var index$1u = require('./hooks/use-
|
|
184
|
-
var index$1v = require('./hooks/use-
|
|
185
|
-
var index$1w = require('./hooks/use-
|
|
186
|
-
var index$1x = require('./hooks/use-
|
|
187
|
-
var index$1y = require('./hooks/use-
|
|
188
|
-
var index$1z = require('./hooks/use-
|
|
167
|
+
var index$1e = require('./hooks/use-draggable/index.js');
|
|
168
|
+
var index$1f = require('./hooks/use-focus/index.js');
|
|
169
|
+
var index$1g = require('./hooks/use-form-item/index.js');
|
|
170
|
+
var index$1h = require('./hooks/use-global-config/index.js');
|
|
171
|
+
var index$1i = require('./hooks/use-locale/index.js');
|
|
172
|
+
var index$1j = require('./hooks/use-lockscreen/index.js');
|
|
173
|
+
var index$1k = require('./hooks/use-modal/index.js');
|
|
174
|
+
var index$1l = require('./hooks/use-model-toggle/index.js');
|
|
175
|
+
var index$1m = require('./hooks/use-prevent-global/index.js');
|
|
176
|
+
var index$1n = require('./hooks/use-prop/index.js');
|
|
177
|
+
var index$1o = require('./hooks/use-restore-active/index.js');
|
|
178
|
+
var index$1p = require('./hooks/use-same-target/index.js');
|
|
179
|
+
var index$1q = require('./hooks/use-teleport/index.js');
|
|
180
|
+
var index$1r = require('./hooks/use-throttle-render/index.js');
|
|
181
|
+
var index$1s = require('./hooks/use-timeout/index.js');
|
|
182
|
+
var index$1t = require('./hooks/use-transition-fallthrough/index.js');
|
|
183
|
+
var index$1u = require('./hooks/use-id/index.js');
|
|
184
|
+
var index$1v = require('./hooks/use-escape-keydown/index.js');
|
|
185
|
+
var index$1w = require('./hooks/use-popper-container/index.js');
|
|
186
|
+
var index$1x = require('./hooks/use-intermediate-render/index.js');
|
|
187
|
+
var index$1y = require('./hooks/use-delayed-toggle/index.js');
|
|
188
|
+
var index$1z = require('./hooks/use-forward-ref/index.js');
|
|
189
|
+
var index$1A = require('./hooks/use-namespace/index.js');
|
|
189
190
|
var form = require('./tokens/form.js');
|
|
190
191
|
var button$1 = require('./tokens/button.js');
|
|
191
192
|
var breadcrumb$1 = require('./tokens/breadcrumb.js');
|
|
@@ -445,42 +446,43 @@ exports.useAttrs = index$1c.useAttrs;
|
|
|
445
446
|
exports.useDisabled = index$1d.useDisabled;
|
|
446
447
|
exports.useSize = index$1d.useSize;
|
|
447
448
|
exports.useSizeProp = index$1d.useSizeProp;
|
|
448
|
-
exports.
|
|
449
|
-
exports.
|
|
450
|
-
exports.
|
|
451
|
-
exports.
|
|
452
|
-
exports.
|
|
453
|
-
exports.
|
|
454
|
-
exports.
|
|
455
|
-
exports.
|
|
456
|
-
exports.
|
|
457
|
-
exports.
|
|
458
|
-
exports.
|
|
459
|
-
exports.
|
|
460
|
-
exports.
|
|
461
|
-
exports.
|
|
462
|
-
exports.
|
|
463
|
-
exports.
|
|
464
|
-
exports.
|
|
465
|
-
exports.
|
|
466
|
-
exports.
|
|
467
|
-
exports.
|
|
468
|
-
exports.
|
|
469
|
-
exports.
|
|
470
|
-
exports.
|
|
471
|
-
exports.
|
|
472
|
-
exports.
|
|
473
|
-
exports.
|
|
474
|
-
exports.
|
|
475
|
-
exports.
|
|
476
|
-
exports.
|
|
477
|
-
exports.
|
|
478
|
-
exports.
|
|
479
|
-
exports.
|
|
480
|
-
exports.
|
|
481
|
-
exports.
|
|
482
|
-
exports.
|
|
483
|
-
exports.
|
|
449
|
+
exports.useDraggable = index$1e.useDraggable;
|
|
450
|
+
exports.useFocus = index$1f.useFocus;
|
|
451
|
+
exports.useFormItem = index$1g.useFormItem;
|
|
452
|
+
exports.provideGlobalConfig = index$1h.provideGlobalConfig;
|
|
453
|
+
exports.useGlobalConfig = index$1h.useGlobalConfig;
|
|
454
|
+
exports.buildLocaleContext = index$1i.buildLocaleContext;
|
|
455
|
+
exports.buildTranslator = index$1i.buildTranslator;
|
|
456
|
+
exports.translate = index$1i.translate;
|
|
457
|
+
exports.useLocale = index$1i.useLocale;
|
|
458
|
+
exports.useLockscreen = index$1j.useLockscreen;
|
|
459
|
+
exports.useModal = index$1k.useModal;
|
|
460
|
+
exports.createModelToggleComposable = index$1l.createModelToggleComposable;
|
|
461
|
+
exports.useModelToggle = index$1l.useModelToggle;
|
|
462
|
+
exports.useModelToggleEmits = index$1l.useModelToggleEmits;
|
|
463
|
+
exports.useModelToggleProps = index$1l.useModelToggleProps;
|
|
464
|
+
exports.usePreventGlobal = index$1m.usePreventGlobal;
|
|
465
|
+
exports.useProp = index$1n.useProp;
|
|
466
|
+
exports.useRestoreActive = index$1o.useRestoreActive;
|
|
467
|
+
exports.useSameTarget = index$1p.useSameTarget;
|
|
468
|
+
exports.useTeleport = index$1q.useTeleport;
|
|
469
|
+
exports.useThrottleRender = index$1r.useThrottleRender;
|
|
470
|
+
exports.useTimeout = index$1s.useTimeout;
|
|
471
|
+
exports.useTransitionFallthrough = index$1t.useTransitionFallthrough;
|
|
472
|
+
exports.useTransitionFallthroughEmits = index$1t.useTransitionFallthroughEmits;
|
|
473
|
+
exports.ID_INJECTION_KEY = index$1u.ID_INJECTION_KEY;
|
|
474
|
+
exports.useId = index$1u.useId;
|
|
475
|
+
exports.useEscapeKeydown = index$1v.useEscapeKeydown;
|
|
476
|
+
exports.POPPER_CONTAINER_ID = index$1w.POPPER_CONTAINER_ID;
|
|
477
|
+
exports.POPPER_CONTAINER_SELECTOR = index$1w.POPPER_CONTAINER_SELECTOR;
|
|
478
|
+
exports.usePopperContainer = index$1w.usePopperContainer;
|
|
479
|
+
exports.useDelayedRender = index$1x.useDelayedRender;
|
|
480
|
+
exports.useDelayedToggle = index$1y.useDelayedToggle;
|
|
481
|
+
exports.useDelayedToggleProps = index$1y.useDelayedToggleProps;
|
|
482
|
+
exports.FORWARD_REF_INJECTION_KEY = index$1z.FORWARD_REF_INJECTION_KEY;
|
|
483
|
+
exports.useForwardRef = index$1z.useForwardRef;
|
|
484
|
+
exports.useForwardRefDirective = index$1z.useForwardRefDirective;
|
|
485
|
+
exports.useNamespace = index$1A.useNamespace;
|
|
484
486
|
exports.elFormItemKey = form.elFormItemKey;
|
|
485
487
|
exports.elFormKey = form.elFormKey;
|
|
486
488
|
exports.buttonGroupContextKey = button$1.buttonGroupContextKey;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/element-plus/index.ts"],"sourcesContent":["import installer from './defaults'\nexport * from '@element-plus/components'\nexport * from '@element-plus/directives'\nexport * from '@element-plus/hooks'\nexport * from '@element-plus/tokens'\nexport * from '@element-plus/utils/popup-manager'\nexport { makeInstaller } from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n"],"names":["installer"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/element-plus/index.ts"],"sourcesContent":["import installer from './defaults'\nexport * from '@element-plus/components'\nexport * from '@element-plus/directives'\nexport * from '@element-plus/hooks'\nexport * from '@element-plus/tokens'\nexport * from '@element-plus/utils/popup-manager'\nexport { makeInstaller } from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n"],"names":["installer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOY,MAAC,OAAO,GAAGA,mBAAS,CAAC,QAAQ;AAC7B,MAAC,OAAO,GAAGA,mBAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.20220203";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20220203'\n"],"names":[],"mappings":";;;;AAAY,MAAC,OAAO,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@element-plus/nightly",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20220203",
|
|
4
4
|
"description": "A Component Library for Vue 3",
|
|
5
5
|
"homepage": "https://element-plus.org/",
|
|
6
6
|
"keywords": [
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"not ie 11",
|
|
74
74
|
"not op_mini all"
|
|
75
75
|
],
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "fb50b4ff8d1bca88e7159869f41f87d5edaf3134"
|
|
77
77
|
}
|