You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
1.2 KiB
1 line
1.2 KiB
11 months ago
|
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-escape-keydown/index.ts"],"sourcesContent":["import { onMounted, onBeforeUnmount } from 'vue'\nimport { on, off } from '@element-plus/utils/dom'\nimport { EVENT_CODE } from '@element-plus/utils/aria'\n\nexport const useEscapeKeydown = (handler?: (e: KeyboardEvent) => void) => {\n const cachedHandler = (e: Event) => {\n const event = e as KeyboardEvent\n if (event.key === EVENT_CODE.esc) {\n handler?.(event)\n }\n }\n onMounted(() => {\n on(document, 'keydown', cachedHandler)\n })\n\n onBeforeUnmount(() => {\n off(document, 'keydown', cachedHandler)\n })\n}\n"],"names":[],"mappings":";;;;AAGY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,EAAE,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK;AAC/B,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC;AACpB,IAAI,IAAI,KAAK,CAAC,GAAG,KAAK,UAAU,CAAC,GAAG,EAAE;AACtC,MAAM,OAAO,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAChD,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAC3C,GAAG,CAAC,CAAC;AACL,EAAE,eAAe,CAAC,MAAM;AACxB,IAAI,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAC5C,GAAG,CAAC,CAAC;AACL;;;;"}
|