`;\n// Exports\nexport default code;","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","import { DialogController} from 'aurelia-dialog';\r\nimport { ModalMessageOptions } from 'app/services/modal-service';\r\nimport { autoinject } from 'aurelia-framework';\r\nimport {SyncStatusDto} from \"../../models/tender/sync-status-dto\";\r\n\r\ninterface ModalMessageOptionsSyncStatus extends ModalMessageOptions{\r\n\tsyncStatus: SyncStatusDto;\r\n\tuseQuantities: boolean;\r\n\tlastFullSync: SyncStatusDto;\r\n}\r\n\r\n@autoinject\r\nexport class ModalConfirmSyncStatus {\r\n\t\r\n\tpublic model: ModalMessageOptionsSyncStatus | undefined;\r\n\tpublic isPartiallySynced: boolean = false;\r\n\t\r\n constructor(protected dialog: DialogController){\r\n }\r\n\r\n async activate(model: ModalMessageOptionsSyncStatus) {\r\n\t\tthis.model = model;\r\n\t\tthis.determineSyncStatus()\r\n\t}\r\n \r\n public ok(){\r\n this.dialog.ok();\r\n }\r\n public cancel(){\r\n this.dialog.cancel();\r\n }\r\n\r\n\tprivate determineSyncStatus() : void {\r\n\t\tlet syncStatus : SyncStatusDto | undefined = this.model?.syncStatus;\r\n\r\n\t\tthis.isPartiallySynced = false;\r\n\t\tif (syncStatus) {\r\n\r\n\t\t\tconst missingTypes = syncStatus.typesInSync < syncStatus.typesInTotal;\r\n\t\t\tconst missingInstances = syncStatus.instancesInSync < syncStatus.instancesInTotal;\r\n\t\t\t\r\n\t\t\tif (this.model?.useQuantities) {\r\n\t\t\t\t\r\n\t\t\t\tif (missingInstances || missingTypes) {\r\n\t\t\t\t\tthis.isPartiallySynced = true\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\t// Ignore instances when we are not using quantities\r\n\t\t\t\tif (missingTypes) {\r\n\t\t\t\t\tthis.isPartiallySynced = true\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n","import { DialogController} from 'aurelia-dialog';\r\nimport { ModalMessageOptions } from 'app/services/modal-service';\r\nimport { autoinject } from 'aurelia-framework';\r\n\r\n@autoinject\r\nexport class ModalConfirm {\r\n\tpublic model: ModalMessageOptions | undefined;\r\n constructor(protected dialog: DialogController){}\r\n\r\n activate(model: ModalMessageOptions) {\r\n this.model = model;\r\n }\r\n public ok(){\r\n this.dialog.ok();\r\n }\r\n public cancel(){\r\n this.dialog.cancel();\r\n }\r\n}\r\n","import { DialogController} from 'aurelia-dialog';\r\nimport { ModalMessageOptions } from 'app/services/modal-service';\r\nimport { autoinject } from 'aurelia-framework';\r\n\r\n@autoinject\r\nexport class ModalLog {\r\n\tpublic model: ModalMessageOptions | undefined;\r\n constructor(protected dialog: DialogController){}\r\n activate(model: ModalMessageOptions) { this.model = model; }\r\n public ok(){ this.dialog.ok(); }\r\n public cancel(){ this.dialog.cancel(); }\r\n}\r\n","import { Router } from 'aurelia-router';\r\nimport { DialogController} from 'aurelia-dialog';\r\nimport { ModalMessageOptions } from 'app/services/modal-service';\r\nimport { autoinject } from 'aurelia-framework';\r\n\r\nimport { NavigationOptions } from 'aurelia-history';\r\nimport { EnsureUserSignedInStep } from 'shell/EnsureUserSignedInStep';\r\nimport { ApiClient } from 'app/services/api-client';\r\n\r\n@autoinject\r\nexport class ModalMessage {\r\n public model: ModalMessageOptions | undefined;\r\n constructor(protected dialog: DialogController, private router: Router){}\r\n\r\n activate(model: ModalMessageOptions) {\r\n this.model = model;\r\n }\r\n\tattached() { this.focusField_ASAP('mm-closeButton'); }\r\n\r\n\r\n\tpublic focusField_ASAP(fieldId:string) { \r\n\t\tthis.forceFocus(fieldId);\r\n\t\t//setTimeout(() => this.forceFocus(fieldId), 100); // JG: Er det netop fordi det er en lambda, at 'this' virker i denne kontekst?\r\n\t}\r\n\r\n\tforceFocus(fieldId:string) { console.log('force_ASAP');\r\n\t\tlet inputField = document.getElementById(fieldId); \r\n\t\tif (!inputField) {\r\n\t\t\tconsole.warn('hmm, cant find field', fieldId);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tinputField!.focus(); \r\n\t\t//console.log('now gave focus to ', fieldId, inputField);\r\n\t}\r\n\r\n public reset() { // resetbutton. // grep food.\r\n\t\tthis.impl_reset();\r\n\t\t//try {} catch (s) { console.trace(s); }\r\n\t}\r\n\r\n\tpublic impl_reset() { // resetbutton. // grep food.\r\n\t\tlet r:Router = this.router;\r\n\t\tconsole.log('impl_reset');\r\n\t\t/*\r\n\t\tconsole.log('r.history:', r.history);\r\n\t\tconsole.log('baseUrl:', r.baseUrl); // empty string\r\n\t\tconsole.log('navigation:', r.navigation); // array just with href:aox\r\n\t\tconsole.log('currentInstruction:', r.currentInstruction); // null\r\n\t\t*/\r\n\r\n\t\t//console.log('calling ok');\r\n\t\t//this.dialog.ok(); // JG: I used to try this ABOVE the navigate, but maywe we should leave it entirely out.\r\n\t\t//console.log('after calling ok');\r\n\r\n\t\t//'/#'; // '/#/';\r\n\t //let new_url = '/#/login?byReset=true';\r\n\t\t//let new_url = '/#/login?byReset=true'; //'/'; \r\n\t\tlet new_url_ = 'login'; //'/'; \r\n\t\tconsole.log('modal-message.reset attempts redirect to ', new_url_);\r\n\r\n\r\n\t\t// Better to clear 'accxess_token':\r\n\t\t//EnsureUserSignedInStep.kickedOutByReset = true; // trying to see if authorize-step can help us.\r\n sessionStorage.removeItem(ApiClient.STORAGE_LABEL);//impl_reset // 'accxess_token'); // trying to force login.\r\n\r\n\t\t//r.reset(); // if we do this, there is no routes left to work.. it is sort of like clearing the entire app/root.\r\n\t\tconst opts:NavigationOptions = { replace:true };\r\n\t\tr.navigateToRoute(new_url_,{byReset:true},opts);\r\n\r\n\t\tconst msg = \"reset: make sure aurelia doesn't continue the rendering process, by now throwing an err.\";\r\n\t\tconsole.warn(msg);\r\n\t\tthis.dialog.ok({errorReset: msg}); // we are passing this data to whoever is awaiting this dialog.\r\n\r\n\t\t//throw msg; // hmm, it is not US that should throw, it's the guys outside..\r\n }\r\n\r\n public ok(){ \r\n\t\tif (this.model?.showReset) {\r\n\t\t\tconst msg = \"pressing OK when showReset was enabled, so we will make sure aurelia doesn't continue the rendering process, by now throwing an err.\";\r\n\t\t\tconsole.warn(msg);\r\n\t\t\tthis.dialog.ok({errorReset: msg}); // we are passing this data to whoever is awaiting this dialog.\r\n\t\r\n\t\t} else { // plain/normal case.\r\n\t\t\tthis.dialog.ok(); \r\n\t\t}\r\n\t}\r\n\r\n public cancel(){ this.dialog.cancel(); }\r\n}\r\n\r\n\r\n\r\n/* Det her bliver ved at fejle\r\n- den ryger ud i noget af den hidtidige history state (?)\r\n- den forsøger dels at loade aox.ts igen,\r\nog dels også andre ting.\r\nDet er frusterende, fordi address bar faktisk ER skiftet til /#/login,\r\nmen fejlene i konsollen viser, at aurelia stadig forsøger at aktivere den gamle state (som ikke er logget ind mere,\r\nså den udløser bare tons af 401, der ikke vil gå væk før vi får lavet en ren/korrekt login. \r\n\r\nSå, vi burde nok se på, hvad man kan gøre for at resette det navigate-fis?\r\n*/\r\n\r\n// let params = ['byReset']; // give us a marker to recognise who sent us.\r\n// JG: This requires more, to work. Because /login is caught in same trap..\r\n//window.location.href = '/'; // aha, this bypasses # !\r\n//window.location.href = '/#/login'; // consider if we can even make it press the login button?\r\n// ? \trefreshNavigation(): void;\r\n// ? useViewPortDefaults\r\n//this.router.navigateToRoute('login', params, {replace:true} );\r\n\r\n// JG: Ja, det virker så ikke, den siger 'ERROR [app-router] Error: Route not found: login'\r\n// Den fik vist lavet DET HER: http://localhost:8080/#/#/login\r\n//this.router.navigate('/#/login', {replace:true} ); // JG: Jeg tror det har PRÆCIST samme effekt som navigateToRoute - det er bare en anden måde at sige præcist det samme på.\r\n\r\n// vi må IKKE bruge router.reset(), siger dokumentationen.(iøvrigt laver den også noget helt andet..?)\r\n/* JG - jeg gentager,\r\nmed det her, bliver den alligevel ved\r\nat gentage gammel aurelia historie.\r\nSaa vi boer istedet grave i,\r\nhvordan man i aurelia 'kommer ud' af loeget (groensagen). \r\n*/\r\n"],"names":["___CSS_LOADER_EXPORT___","push","module","id","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","ModalConfirmSyncStatus","dialog","isPartiallySynced","determineSyncStatus","ok","cancel","syncStatus","missingTypes","typesInSync","typesInTotal","missingInstances","instancesInSync","instancesInTotal","useQuantities","DialogController","ModalConfirm","ModalLog","ModalMessage","router","focusField_ASAP","fieldId","forceFocus","inputField","document","getElementById","focus","reset","impl_reset","r","new_url_","sessionStorage","removeItem","STORAGE_LABEL","navigateToRoute","byReset","replace","msg","errorReset","showReset"],"sourceRoot":""}