1 line
8.2 KiB
JSON
1 line
8.2 KiB
JSON
{"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 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}"],"mappings":"AAAA,OAAO,SAASA,QAAQA,CAACC,KAAK,EAAE;EAC9B,OAAO,CAAC,EAAEA,KAAK,CAACC,WAAW,IAAID,KAAK,CAACE,UAAU,CAAC;AAClD;AACA,OAAO,SAASC,eAAeA,CAACH,KAAK,EAAE;EACrC,OAAO,CAAC,EAAEA,KAAK,CAACI,MAAM,IAAIJ,KAAK,CAACK,MAAM,IAAIL,KAAK,CAACM,UAAU,CAAC;AAC7D;;AAEA;AACA,SAASC,UAAUA,CAACC,KAAK,EAAEC,MAAM,EAAEC,KAAK,EAAE;EACxC;EACA;EACA;EACA,IAAIC,aAAa,GAAGF,MAAM,CAACG,SAAS,CAAC,IAAI,CAAC;;EAE1C;EACA,IAAIC,QAAQ,GAAGC,MAAM,CAACC,MAAM,CAACP,KAAK,EAAE;IAClCC,MAAM,EAAE;MACNC,KAAK,EAAEC;IACT,CAAC;IACDA,aAAa,EAAE;MACbD,KAAK,EAAEC;IACT;EACF,CAAC,CAAC;;EAEF;EACAA,aAAa,CAACD,KAAK,GAAGA,KAAK;;EAE3B;EACA;EACA,IAAI,OAAOD,MAAM,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,CAAClB,KAAK,CAACwB,MAAM;IAC9B,QAAQF,MAAM;MACZ,KAAK,OAAO;QACVJ,OAAO,CAACV,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/B;MACF,KAAK,KAAK;QACRU,OAAO,CAACV,iBAAiB,CAACe,GAAG,EAAEA,GAAG,CAAC;QACnC;MACF;QACEL,OAAO,CAACV,iBAAiB,CAAC,CAAC,EAAEe,GAAG,CAAC;IACrC;EACF;AACF","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |