{"version":3,"sources":["webpack:///../WCC.UI/App/components/droparea/droparea.html?9bad","webpack:///../WCC.UI/App/components/droparea/droparea.scss?4119","webpack:///../WCC.UI/App/components/droparea/droparea.ts","webpack:///../WCC.UI/App/helpers/dataTransfer.ts","webpack:///../WCC.UI/App/managers/dragAndDrop/base.ts","webpack:///../WCC.UI/App/managers/dragAndDrop/files.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/droparea/droparea.scss","webpack:///../WCC.UI/App/components/droparea/droparea.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","DropAreaModel","constructor","file","ko","observable","DropAreaVM","configOrModel","info","effects","onDrop","isDisabled","_configOrModel$onDrop","_","noop","disabled","manager","register","DragAndDropFilesManager","element","files","each","this","active","inactive","not","applyBindingsToNode","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","getFilesFromDataTransfer","dt","items","Array","from","filter","item","kind","map","getAsFile","getTextFromDataTransfer","Promise","resolve","type","slice","forEach","getAsString","getData","DragAndDropManager","config","withEffects","dragEntersCount","is","v","unwrap","onDropFunc","extractor","flattenComputed","undefined","DOMHelpers","onNodeEvent","document","body","onDragEnter","bind","onDragOver","onDragLeave","onDropMain","dispose","e","preventDefault","inc","dec","originalEvent","dataTransfer","data","super","extend","system","SystemHelpers","html","getTemplatesAndResources","node","head","appendChild","___CSS_LOADER_API_IMPORT___","push"],"mappings":"qIAAA,UAAO,CACC,qGACA,wDAIC,KAJyC,EAAF,SAAYA,EAASC,GAGzD,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,kECNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,gJAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,EAASO,GAI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EAAE,IAAIoE,OAAO5B,EAAQ,CACrCO,UAAW1B,W,8HCNvB,WAOC,KAPD,aACI,MAAMgD,EAAS,EAAQ,mCAAkBC,cAEzC,OAAO,SAAUC,GACbF,EAAOG,yBAAyBD,GAC3BnC,SAAQ,SAAUqC,GAAQrB,SAASsB,KAAKC,YAAYF,QAEhE,+B,gKCLDvF,EADkC,EAAQ,wDAChC0F,EAA4B,IAE9BC,KAAK,CAAC9F,EAAOC,EAAI,ocAAqc,KAE9dD,EAAOG,QAAUA,G,gHCHjBH,EAAOG,QAFI","file":"189.5f9a173e95833c09e42e.js","sourcesContent":["define([\n \"!!../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./droparea.html\", \n \"!../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./droparea.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Observable, Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport DragAndDropFilesManager from 'managers/dragAndDrop/files';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport './droparea.html';\r\nimport './droparea.scss';\r\n\r\nexport class DropAreaModel {\n file: Observable = ko.observable();\n\n constructor() { }\n}\n\nexport interface DropAreaVMConfig {\n disabled?: SubscribableOrNullableValue\n onDrop?: Action<[File]>\r\n}\n\n@injectable()\nexport default class DropAreaVM {\n active: Subscribable\n inactive: Subscribable\n\n constructor(\n @inject(wccModules.componentConfig) configOrModel: DropAreaModel | DropAreaVMConfig,\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\n @inject(wccModules.effects) effects: EffectsContainer\n ) {\n let onDrop: Action<[File]>\n let isDisabled: SubscribableOrNullableValue\n\n if (configOrModel instanceof DropAreaModel) {\n onDrop = file => configOrModel.file(file)\r\n } else {\n onDrop = configOrModel.onDrop ?? _.noop;\r\n isDisabled = configOrModel.disabled;\r\n }\n\n const manager = effects.register(new DragAndDropFilesManager({\n element: info.element as HTMLElement,\n disabled: isDisabled,\n onDrop: files => _(files).each(file => onDrop(file))\n }));\n\n this.active = manager.active;\n this.inactive = this.active.not();\n\n ko.applyBindingsToNode(info.element, {\n 'css': {\n 'active': this.active\n }\n });\n }\n}","export function getFilesFromDataTransfer(dt: DataTransfer) {\r\n if (dt.items) {\r\n return Array.from(dt.items)\r\n .filter(item => item.kind == 'file')\r\n .map(item => item.getAsFile() as File);\r\n } else {\r\n return Array.from(dt.files);\r\n }\r\n}\r\n\r\nexport function getTextFromDataTransfer(dt: DataTransfer) {\r\n return new Promise(resolve => {\r\n if (dt.items) {\r\n Array.from(dt.items)\r\n .filter(item => item.kind == 'string' && item.type == \"text/plain\")\r\n .slice(0, 1)\r\n .forEach(item => item.getAsString(resolve));\r\n } else {\r\n resolve(dt.getData('text'));\r\n }\r\n })\r\n}","import { DOMHelpers } from 'helpers/dom';\r\nimport { Func } from 'interfaces/func';\r\nimport { Observable, SubscribableOrNullableValue } from 'knockout';\r\nimport { withEffects } from 'mixins/withEffects';\r\n\r\nexport interface DragAndDropManagerConfig {\n element: SubscribableOrNullableValue\r\n extractor: Func | Func, [DataTransfer]>\r\n disabled?: SubscribableOrNullableValue\r\n\r\n onDrop: Action<[T, JQuery.TriggeredEvent]> \r\n}\n\nexport default class DragAndDropManager {\n private effects = withEffects();\n\n private element: Observable\n private onDropFunc: Action<[T, JQuery.TriggeredEvent]>\n private extractor: Func | Func, [DataTransfer]>\n\n private dragEntersCount = ko.observable(0);\n\n active = this.dragEntersCount.is(v => v > 0);\n\n constructor(config: DragAndDropManagerConfig) {\n this.element = ko.observable(config.element).unwrap();\n this.onDropFunc = config.onDrop || _.noop;\n this.extractor = config.extractor || _.noop;\n\n const isDisabled = ko.flattenComputed(config.disabled, false);\n\n this.effects.register((element, isDisabled) => {\n if (element != undefined && !isDisabled) {\n return [\n DOMHelpers.onNodeEvent(document.body, 'dragenter', this.onDragEnter.bind(this)),\n DOMHelpers.onNodeEvent(document.body, 'dragover', this.onDragOver.bind(this)),\n DOMHelpers.onNodeEvent(document.body, 'dragleave', this.onDragLeave.bind(this)),\n DOMHelpers.onNodeEvent(document.body, 'drop', this.onDropMain.bind(this)),\n DOMHelpers.onNodeEvent(element, 'drop', this.onDrop.bind(this))\n ];\n }\n }, [this.element, isDisabled]);\n }\n\n dispose() {\n this.effects.dispose();\r\n }\n\n private onDragEnter(e: JQuery.TriggeredEvent) {\n e.preventDefault();\n this.dragEntersCount.inc();\n }\n\n private onDragOver(e: JQuery.TriggeredEvent) {\n e.preventDefault();\n }\n\n private onDragLeave(e: JQuery.TriggeredEvent) {\n e.preventDefault();\n this.dragEntersCount.dec();\n }\n\n private onDropMain(e: JQuery.TriggeredEvent) {\n e.preventDefault();\n this.dragEntersCount(0);\n }\n\n private async onDrop(e: JQuery.TriggeredEvent) {\n e.preventDefault();\n\n const dt = (e.originalEvent as DragEvent).dataTransfer;\n if (dt != undefined) {\n const data = await Promise.resolve(this.extractor(dt));\n this.onDropFunc(data, e);\n }\n }\n}","import { getFilesFromDataTransfer } from 'helpers/dataTransfer';\r\nimport DragAndDropManager, { DragAndDropManagerConfig } from './base';\r\n\nexport default class DragAndDropFilesManager extends DragAndDropManager {\n constructor(config: Omit, 'extractor'>) {\n const finalConfig = _({}).extend(config, {\n extractor: getFilesFromDataTransfer\n }) as DragAndDropManagerConfig;\n\n super(finalConfig);\n }\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"wcc-droparea{position:relative;display:flex;justify-content:center;align-items:center;border:1px dashed #c6c6c6;cursor:pointer;box-shadow:0 0 0 0 transparent;transition:box-shadow .4s ease-in-out}wcc-droparea .droparea-label{text-align:center;animation-duration:350ms}wcc-droparea .droparea-label p:last-child{margin-bottom:0}wcc-droparea.active{box-shadow:0 0 10px 0px #fff}wcc-droparea.active,wcc-droparea:hover{color:#5ca2dd;border-color:#5ca2dd}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}