测试
This commit is contained in:
6
frontend/node_modules/element-plus/lib/hooks/use-modal/index.d.ts
generated
vendored
Normal file
6
frontend/node_modules/element-plus/lib/hooks/use-modal/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { Ref } from 'vue';
|
||||
type ModalInstance = {
|
||||
handleClose: () => void;
|
||||
};
|
||||
export declare const useModal: (instance: ModalInstance, visibleRef: Ref<boolean>) => void;
|
||||
export {};
|
||||
34
frontend/node_modules/element-plus/lib/hooks/use-modal/index.js
generated
vendored
Normal file
34
frontend/node_modules/element-plus/lib/hooks/use-modal/index.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var vue = require('vue');
|
||||
var core = require('@vueuse/core');
|
||||
var event = require('../../utils/dom/event.js');
|
||||
var aria = require('../../constants/aria.js');
|
||||
|
||||
const modalStack = [];
|
||||
const closeModal = (e) => {
|
||||
if (modalStack.length === 0)
|
||||
return;
|
||||
const code = event.getEventCode(e);
|
||||
if (code === aria.EVENT_CODE.esc) {
|
||||
e.stopPropagation();
|
||||
const topModal = modalStack[modalStack.length - 1];
|
||||
topModal.handleClose();
|
||||
}
|
||||
};
|
||||
const useModal = (instance, visibleRef) => {
|
||||
vue.watch(visibleRef, (val) => {
|
||||
if (val) {
|
||||
modalStack.push(instance);
|
||||
} else {
|
||||
modalStack.splice(modalStack.indexOf(instance), 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (core.isClient)
|
||||
core.useEventListener(document, "keydown", closeModal);
|
||||
|
||||
exports.useModal = useModal;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/element-plus/lib/hooks/use-modal/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/hooks/use-modal/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-modal/index.ts"],"sourcesContent":["import { watch } from 'vue'\nimport { isClient, useEventListener } from '@vueuse/core'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { getEventCode } from '@element-plus/utils'\n\nimport type { Ref } from 'vue'\n\ntype ModalInstance = {\n handleClose: () => void\n}\n\nconst modalStack: ModalInstance[] = []\n\nconst closeModal = (e: KeyboardEvent) => {\n if (modalStack.length === 0) return\n const code = getEventCode(e)\n if (code === EVENT_CODE.esc) {\n e.stopPropagation()\n const topModal = modalStack[modalStack.length - 1]\n topModal.handleClose()\n }\n}\n\nexport const useModal = (instance: ModalInstance, visibleRef: Ref<boolean>) => {\n watch(visibleRef, (val) => {\n if (val) {\n modalStack.push(instance)\n } else {\n modalStack.splice(modalStack.indexOf(instance), 1)\n }\n })\n}\n\nif (isClient) useEventListener(document, 'keydown', closeModal)\n"],"names":["getEventCode","EVENT_CODE","watch","isClient","useEventListener"],"mappings":";;;;;;;;;AAIA,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK;AAC1B,EAAE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;AAC7B,IAAI,OAAO;AACX,EAAE,MAAM,IAAI,GAAGA,kBAAY,CAAC,CAAC,CAAC,CAAC;AAC/B,EAAE,IAAI,IAAI,KAAKC,eAAU,CAAC,GAAG,EAAE;AAC/B,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACxB,IAAI,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvD,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;AAC3B,GAAG;AACH,CAAC,CAAC;AACU,MAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,UAAU,KAAK;AAClD,EAAEC,SAAK,CAAC,UAAU,EAAE,CAAC,GAAG,KAAK;AAC7B,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAChC,KAAK,MAAM;AACX,MAAM,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AACzD,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE;AACF,IAAIC,aAAQ;AACZ,EAAEC,qBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;;;;"}
|
||||
Reference in New Issue
Block a user