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YR,EAAIC,GAEvB,CAEO9B,gCAAgCQ,EAAYqC,GAElD,IAAIC,EAAef,QAAQ,mBAAkBvB,EAAMuC,cAAcC,UAAWH,IACzErC,EAAMuC,cAAcC,UACpB,wBAAuBxC,EAAMuC,cAAcC,UAAWH,GACzD,OAAId,QAAQe,GACJG,SAASH,EAAaI,WAAWC,aAAa,cAAcxH,QAE5D,CACT,CAEOqE,kBAAkBoD,EAAgBC,EAAkBC,EAAgBC,GAC1E,QAAIF,EAAW,GAAKA,GAAYD,EAAQI,QAAUJ,IAAYE,IAC9DF,EAAQK,OAAOJ,EAAU,EAAGC,EAAQC,IACpCD,EAAQG,OAAOF,EAAU,GAClB,GACR,CAEOvD,qBAAqB0D,EAAaL,EAAkBE,GAC1D,GAAIF,EAAW,GAAKA,GAAYK,EAAKF,QAAUH,GAAYE,EAAU,OAAO,EAC5E,IAAII,EAAWD,EAAKL,GAGpB,OAFAK,EAAKD,OAAOJ,EAAU,EAAGK,EAAKH,IAC9BG,EAAKD,OAAOF,EAAU,EAAGI,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","async","valueFilter","colorInfo","project","projectId","handleError","tr","jsonResult","isCategory","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","clearColorInfo","clearInstanceData","getInstanceEntityLabels","getInstanceValue","insertInstanceData","instances","autoinject","I18N","ColorLegendUtils","static","filter","targetType","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","sortableItemClass","sortableItem","originalEvent","toElement","parseInt","attributes","getNamedItem","newList","newIndex","oldList","oldIndex","length","splice","list","swapItem"],"sourceRoot":""}