UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines • 809 B
{"version":3,"file":"clearNativeValue.mjs","names":[],"sources":["../../../src/base-ui/Input/clearNativeValue.ts"],"sourcesContent":["export const clearNativeValue = (element: HTMLInputElement | HTMLTextAreaElement | null) => {\n if (!element) return;\n const prototype =\n element instanceof HTMLTextAreaElement\n ? HTMLTextAreaElement.prototype\n : HTMLInputElement.prototype;\n Object.getOwnPropertyDescriptor(prototype, 'value')?.set?.call(element, '');\n element.dispatchEvent(new Event('input', { bubbles: true }));\n element.focus();\n};\n"],"mappings":";AAAA,MAAa,oBAAoB,YAA2D;CAC1F,IAAI,CAAC,SAAS;CACd,MAAM,YACJ,mBAAmB,sBACf,oBAAoB,YACpB,iBAAiB;CACvB,OAAO,yBAAyB,WAAW,OAAO,CAAC,EAAE,KAAK,KAAK,SAAS,EAAE;CAC1E,QAAQ,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC,CAAC;CAC3D,QAAQ,MAAM;AAChB"}