PromoCursed/node_modules/.cache/babel-loader/2cef9e6dfebfeaff311cfdf3a05e145ba340e0b9815849ced1cf27807369fdfb.json

1 line
8.2 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"export function hasAddon(props) {\n return !!(props.addonBefore || props.addonAfter);\n}\nexport function hasPrefixSuffix(props) {\n return !!(props.prefix || props.suffix || props.allowClear);\n}\n\n// TODO: It's better to use `Proxy` replace the `element.value`. But we still need support IE11.\nfunction cloneEvent(event, target, value) {\n // A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type=\"file\"> elements.\n // As of the last update, this bug was still marked as \"NEW,\" indicating that it might not have been resolved yet.\n // https://bugs.webkit.org/show_bug.cgi?id=28123\n var currentTarget = target.cloneNode(true);\n\n // click clear icon\n var newEvent = Object.create(event, {\n target: {\n value: currentTarget\n },\n currentTarget: {\n value: currentTarget\n }\n });\n\n // Fill data\n currentTarget.value = value;\n\n // Fill selection. Some type like `email` not support selection\n // https://github.com/ant-design/ant-design/issues/47833\n if (typeof target.selectionStart === 'number' && typeof target.selectionEnd === 'number') {\n currentTarget.selectionStart = target.selectionStart;\n currentTarget.selectionEnd = target.selectionEnd;\n }\n currentTarget.setSelectionRange = function () {\n target.setSelectionRange.apply(target, arguments);\n };\n return newEvent;\n}\nexport function resolveOnChange(target, e, onChange, targetValue) {\n if (!onChange) {\n return;\n }\n var event = e;\n if (e.type === 'click') {\n // Clone a new target for event.\n // Avoid the following usage, the setQuery method gets the original value.\n //\n // const [query, setQuery] = React.useState('');\n // <Input\n // allowClear\n // value={query}\n // onChange={(e)=> {\n // setQuery((prevStatus) => e.target.value);\n // }}\n // />\n\n event = cloneEvent(e, target, '');\n onChange(event);\n return;\n }\n\n // Trigger by composition event, this means we need force change the input value\n // https://github.com/ant-design/ant-design/issues/45737\n // https://github.com/ant-design/ant-design/issues/46598\n if (target.type !== 'file' && targetValue !== undefined) {\n event = cloneEvent(e, target, targetValue);\n onChange(event);\n return;\n }\n onChange(event);\n}\nexport function triggerFocus(element, option) {\n if (!element) return;\n element.focus(option);\n\n // Selection content\n var _ref = option || {},\n cursor = _ref.cursor;\n if (cursor) {\n var len = element.value.length;\n switch (cursor) {\n case 'start':\n element.setSelectionRange(0, 0);\n break;\n case 'end':\n element.setSelectionRange(len, len);\n break;\n default:\n element.setSelectionRange(0, len);\n }\n }\n}","map":{"version":3,"names":["hasAddon","props","addonBefore","addonAfter","hasPrefixSuffix","prefix","suffix","allowClear","cloneEvent","event","target","value","currentTarget","cloneNode","newEvent","Object","create","selectionStart","selectionEnd","setSelectionRange","apply","arguments","resolveOnChange","e","onChange","targetValue","type","undefined","triggerFocus","element","option","focus","_ref","cursor","len","length"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-input/es/utils/commonUtils.js"],"sourcesContent":["export function hasAddon(props) {\n return !!(props.addonBefore || props.addonAfter);\n}\nexport function hasPrefixSuffix(props) {\n return !!(props.prefix || props.suffix || props.allowClear);\n}\n\n// TODO: It's better to use `Proxy` replace the `element.value`. But we still need support IE11.\nfunction cloneEvent(event, target, value) {\n // A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type=\"file\"> elements.\n // As of the last update, this bug was still marked as \"NEW,\" indicating that it might no