\\r\\n\\r\\n\";","module.exports = \"\\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n\\r\\n\";","export abstract class ContextAction {\r\n protected actionKey: string | undefined = \"\";\r\n public textKey: string = \"\";\r\n public icon?: string;\r\n public isDisabled?: boolean;\r\n protected service: any;\r\n private _postAction?: Function\r\n\r\n protected baseSetup(model: { textKey: string, icon?: string, isDisabled?: boolean, actionKey?: string, service: any, postAction?: Function}){\r\n this.textKey = model.textKey;\r\n this.icon = model.icon;\r\n this.isDisabled = model.isDisabled;\r\n\t\tthis.actionKey = model.actionKey;\r\n this.service = model.service;\r\n this._postAction = model.postAction;\r\n }\r\n\r\n protected postAction(){\r\n if(this._postAction && Boolean(this._postAction) && Boolean(this.actionKey))\r\n this._postAction();\r\n }\r\n}\r\n","import { ContextAction } from 'app/components/context-menu/actions/context-action-model';\r\nimport { autoinject } from 'aurelia-framework';\r\n\r\n@autoinject\r\nexport class ContextButtonAction extends ContextAction {\r\n\r\n\tpublic activate(model: { textKey: string, icon?: string, isDisabled?: boolean, actionKey?: string, service: any, postAction?: Function}){\r\n this.baseSetup(model);\r\n\r\n\t}\r\n\r\n public perform(){\r\n if (this.actionKey) {\r\n this.service[this.actionKey]();\r\n this.postAction();\r\n }\r\n }\r\n}\r\n","import { ContextAction } from 'app/components/context-menu/actions/context-action-model';\r\nimport { autoinject } from 'aurelia-framework';\r\n\r\n@autoinject\r\nexport class ContextLineAction extends ContextAction {\r\n\r\n\tpublic activate(model: { textKey: string, service: any, postAction?: Function}){\r\n this.baseSetup(model);\r\n\r\n\t}\r\n\r\n public perform() {\r\n if (this.actionKey) {\r\n this.service[this.actionKey]();\r\n this.postAction();\r\n }\r\n }\r\n}\r\n//d","import { ContextAction } from 'app/components/context-menu/actions/context-action-model';\r\nimport { autoinject } from 'aurelia-framework';\r\n\r\n@autoinject\r\nexport class ContextNumberAction extends ContextAction {\r\n //@bindable public data: any;\r\n\tpublic valueKey: string | undefined;\r\n\tpublic minValue: string | undefined;\r\n\tpublic maxValue: string | undefined;\r\n\tpublic step: string | undefined;\r\n public unit: string | undefined;\r\n public state: any;\r\n\r\n /*public attached() {\r\n this.setModel(this.data);\r\n }*/\r\n\r\n\tpublic activate(data: any) {\r\n //this.data = data;\r\n this.setModel(data);\r\n }\r\n \r\n private setModel(model: {textKey: string, valueKey: string, service: any, actionKey?: string, state?: any, minValue?: string, maxValue?: string, step?: string, unit?: string, postAction?: Function}){\r\n // Use action key if changing the number should have side effects\r\n if(Boolean(model)){\r\n this.baseSetup(model);\r\n this.valueKey = model.valueKey;\r\n this.minValue = Boolean(model.minValue) ? model.minValue : \"\";\r\n this.maxValue = Boolean(model.maxValue) ? model.maxValue : \"\";\r\n this.step = Boolean(model.step) ? model.step : \"1\";\r\n this.unit = Boolean(model.unit) ? model.unit : \"\";\r\n this.state = Boolean(model.state) ? model.state : model.service; // use state if the value/number and actionKey is not in the service/object\r\n }\r\n }\r\n\r\n public perform() {\r\n if(this.actionKey && this.valueKey && Boolean(this.actionKey))\r\n this.service[this.actionKey](parseFloat(this.state[this.valueKey]));\r\n this.postAction();\r\n }\r\n \r\n public stepUp() {\r\n if (this.valueKey && this.step) {\r\n this.doStep(parseFloat(this.state[this.valueKey])+parseFloat(this.step));\r\n }\r\n }\r\n public stepDown() {\r\n if (this.valueKey && this.step) {\r\n this.doStep(parseFloat(this.state[this.valueKey])-parseFloat(this.step));\r\n }\r\n }\r\n\r\n protected doStep(newValue: number) {\r\n if (this.actionKey && Boolean(this.actionKey)) {\r\n this.service[this.actionKey](newValue);\r\n }\r\n else {\r\n if (this.valueKey) {\r\n this.state[this.valueKey] = newValue;\r\n }\r\n }\r\n this.postAction();\r\n }\r\n}\r\n","import { autoinject } from 'aurelia-framework';\r\nimport { ContextNumberAction } from './context-number-action';\r\n\r\n@autoinject\r\nexport class ContextRangeAction extends ContextNumberAction {\r\n\r\n}\r\n","import { ContextToggleAction } from './context-toggle-action';\r\n\r\nexport class ContextSelectAction extends ContextToggleAction {\r\n\tpublic valueKey: string | undefined;\r\n\t\r\n\tactivate(model: { textKey: string, actionKey?: string, toggleKey: string, valueKey?: string, service: any, state?: any, postAction?: Function}) { \r\n super.activate(model);\r\n\t\tthis.valueKey = Boolean(model.valueKey) ? model.valueKey : model.textKey; // use value key if a the value is different then the text dispalyed\r\n }\r\n \r\n public perform(){\r\n if(this.actionKey && Boolean(this.actionKey))\r\n this.service[this.actionKey](this.valueKey);\r\n this.postAction();\r\n }\r\n}\r\n","import { ContextAction } from 'app/components/context-menu/actions/context-action-model';\r\nimport { autoinject } from 'aurelia-framework';\r\n\r\n@autoinject\r\nexport class ContextTextAction extends ContextAction {\r\n\r\n\tpublic activate(model: { textKey: string, actionKey?: string, service: any, postAction?: Function}){\r\n this.baseSetup(model);\r\n\r\n\t}\r\n\r\n public perform() {\r\n if (this.actionKey) {\r\n this.service[this.actionKey]();\r\n this.postAction();\r\n }\r\n }\r\n}\r\n//d","import { ContextAction } from 'app/components/context-menu/actions/context-action-model';\r\nexport class ContextToggleAction extends ContextAction {\r\n public toggleKey: string | undefined;\r\n public state: any;\r\n \r\n\tactivate(model: {textKey: string, actionKey?: string, toggleKey: string, service: any, state?: any, postAction?: Function}) {\r\n // Use action key if toggling should have side effects\r\n this.baseSetup(model);\r\n\t\tthis.toggleKey = model.toggleKey;\r\n this.state = Boolean(model.state) ? model.state : model.service; // use state if the toggle value and actionKey is not in the service/object\r\n\t}\r\n\r\n public perform(){\r\n if(this.actionKey && this.toggleKey && Boolean(this.actionKey)) {\r\n this.service[this.actionKey](this.state[this.toggleKey]);\r\n this.postAction(); \r\n }\r\n }\r\n}\r\n","import { createPopper, Instance } from '@popperjs/core';\r\nimport { ContextMenuService } from './../../services/context-menu-service';\r\nimport { autoinject } from \"aurelia-framework\";\r\n\r\n@autoinject\r\nexport class ContextMenu {\r\n\tprivate actionOutsideListener: any;\r\n\tprivate keyPressListener: any;\r\n\tprivate popper: Instance | undefined;\r\n\r\n\tconstructor(public service: ContextMenuService, private element: Element) {\r\n\t}\r\n\r\n\tattached() {\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.popper = createPopper(this.service.contextElement, this.element, {\r\n\t\t\t\tplacement: this.service.placement\r\n\t\t\t});\r\n\t\t\tthis.actionOutsideListener = (event: any) => {\r\n\t\t\t\tif (event == undefined) { return; }\r\n\t\t\t\tlet elm:Node = this.element;\r\n\t\t\t\tif (elm == undefined) { return; }\r\n\r\n\t\t\t\tlet xx:string = typeof elm;\r\n\t\t\t\tconsole.log(`actionOutsideListener ${xx}: ${elm}`);\r\n\r\n\t\t\t\tif (!('contains' in elm)) { console.warn(`contains not in ${elm}`, elm); }\r\n\r\n\t\t\t\t// interface Element extends Node, ARIAMixin, Animatable, ChildNode, InnerHTML, NonDocumentTypeChildNode, ParentNode, Slottable {\r\n\r\n\t\t\t\t// Uncaught TypeError: Node.contains: Argument 1 does not implement interface Node.\r\n\t\t\t\t// part of the issue here seems a race condition:\r\n\t\t\t\t// IF we just log this.element, by the time we inspect it in the console,\r\n\t\t\t\t// it apparently has 'stabilized' to be a proper DOM node.\r\n\t\t\t\t// So, I suspect the problem is, that it is part of the DOM that is mutating, at the time we inspect it?\t\t\t\t \r\n\r\n\t\t\t\t// Det hjælper ikke noget at logge denne, da den når at blive til et rigtigt Element (?), til det tidspunkt hvor vi får en chance for at kigge.\r\n\t\t\t\t// console.log('actionOutsideListener,element:', this.element, 'target:',event);\r\n\r\n\t\t\t\t// We need elm to support the interface Node, to be able to call stuff on it.\r\n\t\t\t\tif (!elm.contains(event.target)) {\r\n\t\t\t\t\tthis.service.close();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tthis.keyPressListener = (event: any) => {\r\n\t\t\t\tif (event.key === 'Escape' || event.which === 27 || event.keyCode === 27) {\r\n\t\t\t\t\tthis.service.close();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\twindow.addEventListener('mouseup', this.actionOutsideListener);\r\n\t\t\twindow.addEventListener('wheel', this.actionOutsideListener);\r\n\t\t\twindow.addEventListener('blur', this.actionOutsideListener);\r\n\t\t\twindow.addEventListener('touchstart', this.actionOutsideListener);\r\n\t\t\twindow.addEventListener(\"keydown\", this.keyPressListener);\r\n\t\t}, 50);\r\n\t}\r\n\r\n\tdetached() {\r\n\t\twindow.removeEventListener('mouseup', this.actionOutsideListener);\r\n\t\twindow.removeEventListener('wheel', this.actionOutsideListener);\r\n\t\twindow.removeEventListener('blur', this.actionOutsideListener);\r\n\t\twindow.removeEventListener('touchstart', this.actionOutsideListener);\r\n\t\twindow.removeEventListener(\"keydown\", this.keyPressListener);\r\n\r\n\t\tthis.popper?.destroy();\r\n\t}\r\n}\r\n"],"names":["___CSS_LOADER_EXPORT___","push","module","id","exports","ContextAction","actionKey","textKey","baseSetup","model","this","icon","isDisabled","service","_postAction","postAction","Boolean","ContextButtonAction","activate","perform","autoinject","ContextLineAction","ContextNumberAction","data","setModel","valueKey","minValue","maxValue","step","unit","state","parseFloat","stepUp","doStep","stepDown","newValue","ContextRangeAction","ContextSelectAction","ContextToggleAction","super","ContextTextAction","toggleKey","ContextMenu","constructor","element","attached","setTimeout","popper","contextElement","placement","actionOutsideListener","event","undefined","elm","xx","console","log","warn","contains","target","close","keyPressListener","key","which","keyCode","window","addEventListener","detached","removeEventListener","destroy","Element"],"sourceRoot":""}