Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/vue3/directives/hint/dist/ |
Upload File : |
{"version":3,"file":"hint.bundle.js","sources":["../src/tooltip.js","../src/directive.js"],"sourcesContent":["import { Event, Tag, Text, Type } from 'main.core';\nimport { Popup, type PopupOptions } from 'main.popup';\n\nexport type HintParams = {\n\ttext: string,\n\thtml: string,\n\tpopupOptions: PopupOptions,\n\tposition: 'top',\n\ttimeout: number,\n\tinteractivity: boolean,\n};\n\nclass Tooltip\n{\n\tpopup: ?Popup;\n\tcursorOnPopup: boolean;\n\n\tconstructor(): void\n\t{\n\t\tthis.popup = null;\n\t\tthis.cursorOnPopup = false;\n\t}\n\n\tshow(element: HTMLElement, params: HintParams): void\n\t{\n\t\tthis.hide(false);\n\n\t\tconst popupOptions: PopupOptions = {\n\t\t\tid: `bx-vue-hint-${Date.now()}`,\n\t\t\tbindElement: element,\n\t\t\tbindOptions: {\n\t\t\t\tposition: (params.position === 'top') ? 'top' : 'bottom',\n\t\t\t},\n\t\t\tcontent: Tag.render`\n\t\t\t\t<span class='ui-hint-content'>${this.#getText(element, params)}</span>\n\t\t\t`,\n\t\t\tdarkMode: true,\n\t\t\tautoHide: true,\n\t\t\tcacheable: false,\n\t\t\tanimation: 'fading',\n\t\t\t...(params.popupOptions ?? null),\n\t\t};\n\n\t\tthis.popup = new Popup(popupOptions);\n\t\tthis.popup.show();\n\n\t\tif (params.interactivity && this.popup?.getPopupContainer())\n\t\t{\n\t\t\tEvent.bind(this.popup.getPopupContainer(), 'mouseenter', () => {\n\t\t\t\tthis.cursorOnPopup = true;\n\t\t\t});\n\t\t\tEvent.bind(this.popup.getPopupContainer(), 'mouseleave', () => {\n\t\t\t\tthis.cursorOnPopup = false;\n\t\t\t\tthis.hide(true);\n\t\t\t});\n\t\t}\n\t}\n\n\thide(isInteractive: boolean): void\n\t{\n\t\tif (isInteractive)\n\t\t{\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (this.popup && this.popup.getPopupContainer() && !(this.cursorOnPopup))\n\t\t\t\t{\n\t\t\t\t\tthis.popup.close();\n\t\t\t\t}\n\t\t\t}, 100);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.popup?.close();\n\t\t}\n\t}\n\n\t#getText(element: HTMLElement, params: HintParams): string\n\t{\n\t\tif (Type.isStringFilled(params) && Type.isUndefined(element.dataset.hintHtml))\n\t\t{\n\t\t\treturn Text.encode(params);\n\t\t}\n\n\t\treturn params.html || Text.encode(params.text) || params;\n\t}\n}\n\nexport const tooltip = new Tooltip();\n","/**\n * Hint Vue directive\n *\n * @package bitrix\n * @subpackage ui\n * @copyright 2001-2025 Bitrix\n */\n\n/*\n\t<span v-hint=\"$Bitrix.Loc.getMessage('HINT_HTML')\" data-hint-html>Html code</span>\n\t<span v-hint=\"{text: 'Text node'}\">Plain text</span>\n\t<span v-hint=\"{html: '<b>Html</b> code'}\">Html code</span>\n\t<span v-hint=\"{text: 'Custom position top and light mode', position: 'top', popupOptions: {darkMode: false}}\">\n\t\tText top on light panel\n\t</span>\n\t<span v-hint=\"{text: 'Hint text <a>More</a>', interactivity: true}\">Hint with clickable link</span>\n*/\n\nimport { Event, Type } from 'main.core';\nimport 'ui.hint';\n\nimport { tooltip, type HintParams } from './tooltip';\nexport type { HintParams };\n\nexport const hint = {\n\tasync mounted(element: HTMLElement, { value }: { value: HintParams | Function }): Promise<void>\n\t{\n\t\tif (!value)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tEvent.bind(element, 'mouseenter', () => onMouseEnter(element, getParams(value)));\n\t\tconst isInteractive = value.interactivity ?? false;\n\t\tEvent.bind(element, 'mouseleave', () => hideTooltip(isInteractive));\n\t\tEvent.bind(element, 'click', () => hideTooltip());\n\t},\n};\n\nlet showTimeout = null;\n\nfunction onMouseEnter(element: HTMLElement, params: HintParams): void\n{\n\tclearTimeouts();\n\tshowTimeout = setTimeout(() => showTooltip(element, params), params.timeout ?? 0);\n}\n\nfunction showTooltip(element: HTMLElement, params: HintParams): void\n{\n\tclearTimeouts();\n\ttooltip.show(element, params);\n}\n\nfunction hideTooltip(isInteractive): void\n{\n\tclearTimeouts();\n\ttooltip.hide(isInteractive);\n}\n\nfunction clearTimeouts(): void\n{\n\tclearTimeout(showTimeout);\n}\n\nfunction getParams(value: HintParams | Function): HintParams\n{\n\treturn Type.isFunction(value) ? value() : value;\n}\n"],"names":["Tooltip","constructor","popup","cursorOnPopup","show","element","params","hide","popupOptions","id","Date","now","bindElement","bindOptions","position","content","Tag","render","darkMode","autoHide","cacheable","animation","Popup","interactivity","getPopupContainer","Event","bind","isInteractive","setTimeout","close","Type","isStringFilled","isUndefined","dataset","hintHtml","Text","encode","html","text","tooltip","hint","mounted","value","onMouseEnter","getParams","hideTooltip","showTimeout","clearTimeouts","showTooltip","timeout","clearTimeout","isFunction"],"mappings":";;;;;;;;AAAA,CACsD;CAWtD,MAAMA,OAAO,CACb;GAICC,WAAW,GACX;KAAA;OAAA;;KACC,IAAI,CAACC,KAAK,GAAG,IAAI;KACjB,IAAI,CAACC,aAAa,GAAG,KAAK;;GAG3BC,IAAI,CAACC,OAAoB,EAAEC,MAAkB,EAC7C;KAAA;KACC,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC;KAEhB,MAAMC,YAA0B,GAAG;OAClCC,EAAE,EAAG,eAAcC,IAAI,CAACC,GAAG,EAAG,EAAC;OAC/BC,WAAW,EAAEP,OAAO;OACpBQ,WAAW,EAAE;SACZC,QAAQ,EAAGR,MAAM,CAACQ,QAAQ,KAAK,KAAK,GAAI,KAAK,GAAG;QAChD;OACDC,OAAO,EAAEC,aAA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