package.cjs.react-utils.metaClick.metaClick.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"metaClick.js","names":["_ramda","require","handleMetaClick","curry","history","params","event","options","arguments","length","undefined","isMetaKeyPressed","window","open","pathname","_options$isHistoryRep","isHistoryReplace","historyMethod","replace","push","exports","ctrlKey","metaKey"],"sources":["../../../../src/react-utils/metaClick/metaClick.js"],"sourcesContent":["import { curry } from \"ramda\";\n\nexport const handleMetaClick = curry((history, params, event, options = {}) => {\n if (isMetaKeyPressed(event)) {\n return window.open(params.pathname || params, \"_blank\");\n }\n\n const { isHistoryReplace = false } = options;\n const historyMethod = isHistoryReplace ? history.replace : history.push;\n\n return historyMethod(params);\n});\n\nexport const isMetaKeyPressed = event => !!(event?.ctrlKey || event?.metaKey);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,IAAMC,eAAe,GAAG,IAAAC,YAAK,EAAC,UAACC,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAmB;EAAA,IAAjBC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACxE,IAAIG,gBAAgB,CAACL,KAAK,CAAC,EAAE;IAC3B,OAAOM,MAAM,CAACC,IAAI,CAACR,MAAM,CAACS,QAAQ,IAAIT,MAAM,EAAE,QAAQ,CAAC;EACzD;EAEA,IAAAU,qBAAA,GAAqCR,OAAO,CAApCS,gBAAgB;IAAhBA,gBAAgB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;EAChC,IAAME,aAAa,GAAGD,gBAAgB,GAAGZ,OAAO,CAACc,OAAO,GAAGd,OAAO,CAACe,IAAI;EAEvE,OAAOF,aAAa,CAACZ,MAAM,CAAC;AAC9B,CAAC,CAAC;AAACe,OAAA,CAAAlB,eAAA,GAAAA,eAAA;AAEI,IAAMS,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGL,KAAK;EAAA,OAAI,CAAC,EAAEA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEe,OAAO,IAAIf,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEgB,OAAO,CAAC;AAAA;AAACF,OAAA,CAAAT,gBAAA,GAAAA,gBAAA"}