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QAAQD,EAASM,oBACpBF,MAAM,qBAAqBS,4BAE5Bb,EAASM,kBAAoBA,EACzBL,QAAQD,EAASK,OACpB7G,KAAK0G,mBAAmBF,GAG3B,CACO,qBAAAc,CAAsBf,GAC5B,IAAIC,EAAWxG,KAAKqG,cAAcE,GAC9BC,GAAYC,QAAQD,KACvBA,EAASM,uBAAoB5F,EAC7BlB,KAAK+G,YAAYR,EAAIC,GAEvB,CAEO,+BAAOe,CAAyBrC,EAAYsC,GAElD,IAAIC,EAAehB,QAAQ,UAASiB,MAAMC,GAAGzC,EAAM0C,cAAcC,UAAWL,IACzEtC,EAAM0C,cAAcC,UACpB,UAASH,MAAMI,QAAQ5C,EAAM0C,cAAcC,UAAWL,GACzD,OAAIf,QAAQgB,GACJM,SAASN,EAAaO,WAAWC,aAAa,cAAc/H,QAE5D,CACT,CAEO,iBAAOgI,CAAWC,EAAgBC,EAAkBC,EAAgBC,GAC1E,QAAIF,EAAW,GAAKA,GAAYD,EAAQI,QAAUJ,IAAYE,IAC9DF,EAAQK,OAAOJ,EAAU,EAAGC,EAAQC,IACpCD,EAAQG,OAAOF,EAAU,GAClB,GACR,CAEO,oBAAOG,CAAcC,EAAaN,EAAkBE,GAC1D,GAAIF,EAAW,GAAKA,GAAYM,EAAKH,QAAUH,GAAYE,EAAU,OAAO,EAC5E,IAAIK,EAAWD,EAAKN,GAGpB,OAFAM,EAAKF,OAAOJ,EAAU,EAAGM,EAAKJ,IAC9BI,EAAKF,OAAOF,EAAU,EAAGK,IAClB,CACR,E","sources":["webpack://client-app/./src/app/services/color-legend/instance-color-data-collection.ts","webpack://client-app/./src/app/services/color-legend/color-legend-service.ts","webpack://client-app/./src/app/services/color-legend/color-legend-utils.ts","webpack://client-app/./src/app/services/context-menu-service.ts","webpack://client-app/./src/app/services/d-n-d-service.ts"],"sourcesContent":["import {InstanceColorData} from \"../../models/color-legend-dto\";\r\n\r\nexport class InstanceColorDataCollection {\r\n\t\r\n\tprivate entityLabelToValueMap: Map = new Map();\r\n\r\n\tclear(): void {\r\n\t\tthis.entityLabelToValueMap.clear();\r\n\t}\r\n\r\n\tgetEntityLabels(value: string): number[] {\r\n\t\tlet entityLabels: number[] = [];\r\n\t\t\r\n\t\tthis.entityLabelToValueMap.forEach((instanceValue, entityLabel) => {\r\n\t\t\tif (instanceValue === value)\r\n\t\t\t\tentityLabels.push(entityLabel);\r\n\t\t})\r\n\t\treturn entityLabels;\r\n\t}\r\n\r\n\tgetAllEntityLabels(): number[] {\r\n\t\tlet entityLabels: number[] = [];\r\n\r\n\t\tthis.entityLabelToValueMap.forEach((instanceValue, entityLabel) => {\r\n\t\t\tentityLabels.push(entityLabel);\r\n\t\t})\r\n\t\treturn entityLabels;\r\n\t}\r\n\r\n\tgetValue(entityLabel: number): string {\r\n\t\tlet value: string | undefined = this.entityLabelToValueMap?.get(entityLabel)\r\n\t\treturn value ? value : \"\";\r\n\t}\r\n\r\n\tpush(...instanceColorData: InstanceColorData[]): void {\r\n\t\tinstanceColorData.forEach(data => {\r\n\t\t\tthis.entityLabelToValueMap.set(data.entityLabel, data.value);\r\n\t\t})\r\n\t}\r\n}\r\n","import Color from \"color\";\r\nimport {I18N} from \"aurelia-i18n\";\r\nimport {autoinject} from \"aurelia-framework\";\r\nimport {ColorLegendData} from \"./color-legend-data\";\r\nimport {IColorLegendService} from \"./i-color-legend-service\";\r\nimport {ApiClient} from \"../api-client\";\r\nimport {AppContextService} from \"../app-context-service\";\r\nimport {ValueFilter} from \"../../models/object-filter\";\r\nimport {ColorInfoDto, InstanceColorData} from \"../../models/color-legend-dto\";\r\nimport {UsedTypeValuesContainer} from \"../../project/work-area/color-legend/used-type-values-container\";\r\nimport {FakeFilterMimicEnum} from \"../../project/work-area/color-legend/fake-filter-mimic-enum\";\r\nimport {FakeStaticValueFilter} from \"../../project/work-area/color-legend/fake-static-value-filter\";\r\nimport {signalBindings} from \"aurelia-binding\";\r\nimport {InstanceColorDataCollection} from \"./instance-color-data-collection\";\r\nimport {ColorLegendUtils} from \"./color-legend-utils\";\r\n\r\n/**\r\n * Keeps the active color data in memory to be used by other components \r\n */\r\n@autoinject\r\nexport class ColorLegendService implements IColorLegendService {\r\n\r\n\t// TODO Opens up for transitive visibility (not good)\r\n\tget currentColorData(): ColorLegendData | undefined {\r\n\t\treturn this._currentColorData;\r\n\t}\r\n\r\n\tget isDataReady(): boolean {\r\n\t\treturn this._currentColorData != undefined || this._currentColorData != null;\r\n\t}\r\n\r\n\tprivate _currentColorData: ColorLegendData | undefined;\r\n\tprivate instanceColorDataCollection: InstanceColorDataCollection = new InstanceColorDataCollection();\r\n\t\r\n\tconstructor(private api: ApiClient, private appContext: AppContextService, private i18n: I18N) {\r\n\t\t\r\n\t}\r\n\t\r\n\tupdateColorMap(value: string, color: Color): void {\r\n\t\tif (this.currentColorData == undefined) return;\t// No color map to update. Return\r\n\t\tthis.currentColorData.colorMap.set(value, color);\r\n }\r\n\r\n\tasync setActiveValueFilter(valueFilter: ValueFilter): Promise {\r\n\r\n\t\t// Category\r\n\t\tif (ColorLegendUtils.isCategory(valueFilter)) {\r\n\r\n\t\t\tlet colorInfo: ColorInfoDto = await this.api.project(this.appContext.projectId).get(`ColorLegend/GetColorInfoForCategories`,)\r\n\t\t\t\t.handleError(this.i18n.tr('Error_Title_Generic'), \"Could not retrieve color legends.\")\r\n\t\t\t\t.jsonResult();\r\n\r\n\t\t\tthis._currentColorData = {\r\n\t\t\t\tisCategory: true,\r\n\t\t\t\tisFamilyName: false,\r\n\t\t\t\tisTypeName: false,\r\n\r\n\t\t\t\tdefinitionId: null,\r\n\t\t\t\tcolorMap: this.extractColorMap(colorInfo),\r\n\t\t\t\tusedValuesContainer: new UsedTypeValuesContainer(colorInfo.usedTypeValues),\r\n\r\n\t\t\t\thasValueList: false,\r\n\t\t\t\tvalueListItemOrdering: null\r\n\t\t\t}\r\n\r\n\t\t\tsignalBindings('colors-changed');\t// Re-renders the view model\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// The rest (value list and other parameters)\r\n\t\tlet colorInfo: ColorInfoDto = await this.api.project(this.appContext.projectId).get(`ColorLegend/GetColorInfo/${valueFilter.targetId}`)\r\n\t\t\t.handleError(this.i18n.tr('Error_Title_Generic'), \"Could not retrieve color legends.\")\r\n\t\t\t.jsonResult();\r\n\r\n\t\tthis._currentColorData = {\r\n\t\t\tisCategory: false,\r\n\t\t\tisFamilyName: this.isFamilyName(valueFilter),\r\n\t\t\tisTypeName: this.isTypeName(valueFilter),\r\n\r\n\t\t\tcolorMap: this.extractColorMap(colorInfo),\r\n\t\t\tusedValuesContainer: new UsedTypeValuesContainer(colorInfo.usedTypeValues),\r\n\t\t\tdefinitionId: valueFilter.targetId ? valueFilter.targetId : null,\r\n\r\n\t\t\thasValueList: colorInfo.isValueList,\r\n\t\t\tvalueListItemOrdering: this.extractValueListOrdering(colorInfo)\r\n\t\t}\r\n\r\n\t\tsignalBindings('colors-changed');\t// Re-renders the view model\r\n\t}\r\n\r\n\tpublic updateData(value: string, typeId: string): void {\r\n\t\tthis.currentColorData?.usedValuesContainer.updateType(typeId, value);\r\n\t\tif (!this.currentColorData?.colorMap.has(value)) {\r\n\t\t\tthis.currentColorData?.colorMap.set(value, new Color(this.getRandomColor()));\r\n\t\t}\r\n\t}\r\n\r\n\tpublic getRandomColor() : string {\r\n\t\tconst letters = '0123456789ABCDEF';\r\n\t\tlet color = '#';\r\n\t\tfor (let i = 0; i < 6; i++) {\r\n\t\t\tcolor += letters[Math.floor(Math.random() * 16)];\r\n\t\t}\r\n\t\treturn color;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Creates a map with color objects\r\n\t * @param colorInfo the retrieved info from the backend\r\n\t * @private\r\n\t */\r\n\tprivate extractColorMap(colorInfo: ColorInfoDto) {\r\n\t\tconst colorMapEntries: [string, string][] = Object.entries(colorInfo.colorMap);\r\n\t\tconst colorObjectsEntries: [string, Color][] = colorMapEntries.map(value => [value[0], new Color(value[1])]);\r\n\t\treturn new Map(colorObjectsEntries);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a map with the ordering of the value list items\r\n\t * @param colorInfo the retrieved info from the backend\r\n\t * @private\r\n\t */\r\n\tprivate extractValueListOrdering(colorInfo: ColorInfoDto) : Map | null {\r\n\t\tif (colorInfo.valueListItemOrdering === null) return null;\r\n\t\t\r\n\t\tconst orderingEntries: [string, number][] = Object.entries(colorInfo.valueListItemOrdering);\r\n\t\treturn new Map(orderingEntries);\r\n\t}\r\n\r\n\t\r\n\r\n\tprivate isFamilyName(valueFilter: ValueFilter) {\t\t\r\n\t\tif (valueFilter instanceof FakeStaticValueFilter) {\r\n\t\t\treturn valueFilter.isMimicking === FakeFilterMimicEnum.FAMILY;\r\n\t\t}\r\n\t\t\r\n\t\treturn false;\r\n\t}\r\n\r\n\tprivate isTypeName(valueFilter: ValueFilter) {\r\n\t\tif (valueFilter instanceof FakeStaticValueFilter) {\r\n\t\t\treturn valueFilter.isMimicking === FakeFilterMimicEnum.TYPE;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\tpublic clearColorInfo(): void {\r\n\t\tthis._currentColorData = undefined;\r\n\t\tsignalBindings('colors-changed');\t// Re-renders the view model\r\n\t}\r\n\r\n\tclearInstanceData(): void {\r\n\t\tthis.instanceColorDataCollection.clear();\r\n\t}\r\n\r\n\tgetInstanceEntityLabels(value: string): number[] {\r\n\t\treturn this.instanceColorDataCollection.getEntityLabels(value);\r\n\t}\r\n\t\r\n\tgetAllEntityLabels(): number[] {\r\n\t\treturn this.instanceColorDataCollection.getAllEntityLabels();\r\n\t}\r\n\r\n\tgetInstanceValue(entityLabel: number): string {\r\n\t\treturn this.instanceColorDataCollection.getValue(entityLabel);\r\n\t}\r\n\r\n\tinsertInstanceData(...instances: InstanceColorData[]): void {\r\n\t\tthis.instanceColorDataCollection.push(...instances);\r\n\t}\r\n}\r\n\r\n","import {ValueFilter} from \"../../models/object-filter\";\r\nimport {ObjectValues} from \"../../models/object-values\";\r\n\r\nexport class ColorLegendUtils {\r\n\t\r\n\t/**\r\n\t * Tells whether the active value filter is a category.\r\n\t * The category filter is a special case, which may need to be treated differently.\r\n\t * @param filter\r\n\t */\r\n\tstatic isCategory(filter: ValueFilter): boolean {\r\n\t\treturn filter.targetType == ObjectValues.targetTypes.category;\r\n\t}\r\n}\r\n","import { Placement, VirtualElement } from \"@popperjs/core\";\r\nimport { autoinject } from \"aurelia-framework\";\r\n\r\n@autoinject\r\nexport class ContextMenuService {\r\n\tpublic isOpen: boolean = false;\r\n\tpublic actions: any[] | null = [];\r\n\tpublic contextElement: VirtualElement | any;\r\n public placement: Placement = \"right-start\";\r\n\r\n public open(event: Event, actions: any[] ,placement: Placement = \"right-start\", closeAllOnClick: boolean = true) {\r\n this.contextElement = {\r\n getBoundingClientRect: this.buildContextElement(event),\r\n };\r\n this.isOpen = true;\r\n if (closeAllOnClick){\r\n actions.forEach(x => {\r\n x.setup.postAction = () => this.close();\r\n });\r\n }\t\t\r\n this.placement = placement; \r\n // Demo of how to setup actions \r\n\t\tif (false){// ToDo change if statement to false\r\n // context-button-action\r\n let buttonService = {\r\n buttonAction: () => { alert(\"Button action clicked\") }\r\n };\r\n actions = [\r\n { viewKey: \"button\", setup: { textKey: \"buttonAction\", actionKey: \"buttonAction\", service: buttonService, postAction: () => this.close() } }\r\n ];\r\n // context-toggle-action\r\n let toggleService = {\r\n toggleValue: true,\r\n };\r\n actions.push(...[\r\n { viewKey: \"toggle\", setup: { textKey: \"toggleAction\", toggleKey: \"toggleValue\", service: toggleService } }\r\n ]);\r\n // context-select-action\r\n let selectService = {\r\n selectValues: [\"Wrong\", \"Maybe\", \"Correct\"],\r\n selectedValue: \"Maybe\",\r\n selectWithSideEffect(value: string){\r\n selectService.selectedValue = value;\r\n alert(\"selecting: \" + value + \" has sideeffects\");\r\n }\r\n };\r\n actions.push(...[\r\n { viewKey: \"select\", setup: { textKey: \"This is Wrong\", toggleKey: \"selectedValue\", valueKey: \"Wrong\", service: selectService } },\r\n { viewKey: \"select\", setup: { textKey: \"Maybe\", toggleKey: \"selectedValue\", service: selectService } },\r\n { viewKey: \"select\", setup: { textKey: \"Correct\", actionKey: \"selectWithSideEffect\", toggleKey: \"selectedValue\", service: selectService } },\r\n ]);\r\n // context-number-action\r\n // context-range-action\r\n let numberService = {\r\n numberValue: 23\r\n }\r\n actions.push({ viewKey: \"number\", setup: { textKey: \"setNumber\", valueKey: \"numberValue\", minValue: \"1\", maxValue: \"100\", step: \"1\", unit: \"%\", service: numberService} });\r\n actions.push({ viewKey: \"range\", setup: { textKey: \"setNumber\", valueKey: \"numberValue\", minValue: \"1\", maxValue: \"100\", step: \"1\", unit: \"%\", service: numberService } });\r\n \r\n actions.push({ viewKey: \"text\", setup: { textKey: \"This is just regular text\"}});\r\n\r\n\t\t}\r\n\t\tthis.actions = actions;\r\n }\r\n \r\n public close() {\r\n\t\tthis.isOpen = false;\r\n\t\tthis.actions = null;\r\n\t}\r\n\r\n\tprivate buildContextElement(evt: any) {\r\n\t\treturn () => ({\r\n width: 0,\r\n height: 0,\r\n top: evt.clientY,\r\n right: evt.clientX,\r\n bottom: evt.clientY,\r\n left: evt.clientX,\r\n });\r\n }\r\n}\r\n","import Sortable, { Swap, MultiDrag } from 'sortablejs';\r\n\r\ninterface SortableList {\r\n\tinteractionConfig?: any;\r\n\tview?: any;\r\n\tsortableInstance?: any;\r\n}\r\n\r\n// Primary purpose of this service is to coordinate sortableJs setup between html lists and viewmodel logic\r\nexport class DnDService {\r\n\tprivate sortableLists: { [listId: string]: SortableList | undefined } = {};\r\n\r\n\tconstructor() {\r\n\t\t//Sortable.mount(new Swap());\r\n\t}\r\n\r\n\tprivate ensureAndGetSortable(id: string): SortableList | undefined {\r\n\t\tlet sortable = this.sortableLists[id];\r\n\t\tif (!Boolean(sortable)) {\r\n\t\t\tsortable = {};\r\n\t\t\tthis.sortableLists[id] = sortable;\r\n\t\t}\r\n\t\treturn sortable;\r\n\t}\r\n\tprivate initializeSortable(sortable: SortableList) {\r\n\t\tif (Boolean(sortable.sortableInstance)) {\r\n\t\t\talert(`Sortable list id: ${sortable.view.id}. already initialized`);\r\n\t\t}\r\n\t\tsortable.sortableInstance = Sortable[\"create\"](sortable.view, sortable.interactionConfig);\r\n\r\n\t}\r\n\tprivate endSortable(id: string, sortable: SortableList) {\r\n\t\tif (Boolean(sortable.sortableInstance)) {\r\n\t\t\tsortable.sortableInstance.destroy();\r\n\t\t\tsortable.sortableInstance = undefined;\r\n\t\t}\r\n\t\tif (!Boolean(sortable.view) && !Boolean(sortable.interactionConfig)) {\r\n\t\t\tthis.sortableLists[id] = undefined;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerListView(listView: Element) {\r\n\t\tlet sortable = this.ensureAndGetSortable(listView.id);\r\n\t\tif (Boolean(sortable?.view)) {\r\n\t\t\talert(`Sortable list id: ${listView.id}. view already exists`);\r\n\t\t}\r\n\t\tif (sortable) {\r\n\t\t\tsortable.view = listView;\r\n\t\t\tif (Boolean(sortable.interactionConfig)) {\r\n\t\t\t\tthis.initializeSortable(sortable);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tpublic unregisterListView(id: string) {\r\n\t\tlet sortable = this.sortableLists[id];\r\n\t\tif (sortable && Boolean(sortable)) {\r\n\t\t\tsortable.view = undefined;\r\n\t\t\tthis.endSortable(id, sortable);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic attachListInteraction(listId: string, interactionConfig: any) {\r\n\t\tlet sortable = this.ensureAndGetSortable(listId);\r\n\t\tif (sortable) {\r\n\t\t\tif (Boolean(sortable.interactionConfig)) {\r\n\t\t\t\talert(`Sortable list id: ${listId}. config already exists`);\r\n\t\t\t}\r\n\t\t\tsortable.interactionConfig = interactionConfig;\r\n\t\t\tif (Boolean(sortable.view)) {\r\n\t\t\t\tthis.initializeSortable(sortable);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tpublic detachListInteraction(id: string) {\r\n\t\tlet sortable = this.sortableLists[id];\r\n\t\tif (sortable && Boolean(sortable)) {\r\n\t\t\tsortable.interactionConfig = undefined;\r\n\t\t\tthis.endSortable(id, sortable);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static getNewIndexFromAttribute(event: any, sortableItemClass: string): number {\r\n\r\n\t\tlet sortableItem = Boolean(Sortable.utils.is(event.originalEvent.toElement, sortableItemClass))\r\n\t\t\t? event.originalEvent.toElement\r\n\t\t\t: Sortable.utils.closest(event.originalEvent.toElement, sortableItemClass);\r\n\t\tif (Boolean(sortableItem)) {\r\n\t\t\treturn parseInt(sortableItem.attributes.getNamedItem(\"data-index\").value);\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\r\n\tpublic static moveToList(newList: any[], newIndex: number, oldList: any[], oldIndex: number): boolean {\r\n\t\tif (newIndex < 0 || newIndex >= newList.length || newList === oldList) return false;\r\n\t\tnewList.splice(newIndex, 0, oldList[oldIndex]);\r\n\t\toldList.splice(oldIndex, 1);\r\n\t\treturn true;\r\n\t}\r\n\r\n\tpublic static swapListItems(list: any[], newIndex: number, oldIndex: number): boolean {\r\n\t\tif (newIndex < 0 || newIndex >= list.length || newIndex == oldIndex) return false;\r\n\t\tlet swapItem = list[newIndex];\r\n\t\tlist.splice(newIndex, 1, list[oldIndex]);\r\n\t\tlist.splice(oldIndex, 1, swapItem);\r\n\t\treturn true;\r\n\t}\r\n}\r\n"],"names":["InstanceColorDataCollection","entityLabelToValueMap","Map","clear","this","getEntityLabels","value","entityLabels","forEach","instanceValue","entityLabel","push","getAllEntityLabels","getValue","get","instanceColorData","data","set","ColorLegendService","currentColorData","_currentColorData","isDataReady","undefined","constructor","api","appContext","i18n","instanceColorDataCollection","updateColorMap","color","colorMap","setActiveValueFilter","valueFilter","isCategory","colorInfo","project","projectId","handleError","tr","jsonResult","isFamilyName","isTypeName","definitionId","extractColorMap","usedValuesContainer","usedTypeValues","hasValueList","valueListItemOrdering","targetId","isValueList","extractValueListOrdering","updateData","typeId","updateType","has","getRandomColor","i","Math","floor","random","colorObjectsEntries","Object","entries","map","orderingEntries","isMimicking","FAMILY","TYPE","clearColorInfo","clearInstanceData","getInstanceEntityLabels","getInstanceValue","insertInstanceData","instances","autoinject","I18N","ColorLegendUtils","filter","targetType","targetTypes","category","ContextMenuService","isOpen","actions","placement","open","event","closeAllOnClick","contextElement","getBoundingClientRect","buildContextElement","x","setup","postAction","close","evt","width","height","top","clientY","right","clientX","bottom","left","DnDService","sortableLists","ensureAndGetSortable","id","sortable","Boolean","initializeSortable","sortableInstance","alert","view","interactionConfig","endSortable","destroy","registerListView","listView","unregisterListView","attachListInteraction","listId","detachListInteraction","getNewIndexFromAttribute","sortableItemClass","sortableItem","utils","is","originalEvent","toElement","closest","parseInt","attributes","getNamedItem","moveToList","newList","newIndex","oldList","oldIndex","length","splice","swapListItems","list","swapItem"],"sourceRoot":""}