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tC,KAAKoC,aAAe,CAAEC,KAAM,aAAcC,MAAO,OAEnD,G,0TAzGG,EAAC,EAAAC,S","sources":["webpack://client-app/./src/app/components/filter/handler/filter-handler.scss","webpack://client-app/./src/app/components/filter/handler/filter-handler.html","webpack://client-app/./src/app/components/filter/handler/filter-handler.ts"],"sourcesContent":["// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.filters-list{display:flex;flex-wrap:wrap}.filter{display:inline-flex;align-items:center;justify-content:space-between;position:relative;user-select:none;white-space:nowrap}.filters-list .filter{display:flex;justify-content:stretch;background:#fff;border-radius:4px;margin-bottom:calc(15px/2);margin-right:calc(15px/2);padding:calc(15px/2) .75rem calc(15px/2) .75rem}.filters-list .filter .filter-comparison,.filters-list .filter .filter-value,.filters-list .filter .filter-sorting{margin-right:calc(15px/4);margin-left:calc(15px/4)}.filters-list .filter .filter-value-container{display:inline-flex;align-items:center;border-radius:2px;background:#efefef;padding:1px 4px;margin-left:calc(15px/2)}.filters-list .filter .btn-group{justify-content:space-between;display:flex;padding:0 8px}.input-container{border-bottom:1px solid rgba(0,0,0,.175);padding:calc(15px/2)}.input-container input,.input-container select{background:#efefef;border:none;padding:calc(15px/4) calc(15px/2);width:100%}.input-container input:focus,.input-container select:focus{outline:none}`, \"\",{\"version\":3,\"sources\":[\"webpack://./src/app/components/filter/handler/filter-handler.scss\",\"webpack://./src/resources/color-admin/_variables.scss\",\"webpack://./src/resources/customized-styles/variables.scss\"],\"names\":[],\"mappings\":\"AAMA,cACC,YAAA,CACA,cAAA,CAGD,QACC,mBAAA,CACA,kBAAA,CACA,6BAAA,CACA,iBAAA,CACA,gBAAA,CACA,kBAAA,CAEA,sBACC,YAAA,CACA,uBAAA,CACA,eC4BY,CD3BZ,iBAAA,CACA,0BAAA,CACA,yBAAA,CACA,+CAAA,CAEA,mHACC,yBAAA,CACA,wBAAA,CAGD,8CACC,mBAAA,CACA,kBAAA,CACA,iBAAA,CACA,kBE3BU,CF4BV,eAAA,CACA,wBAAA,CAGD,iCACC,6BAAA,CACA,YAAA,CACA,aAAA,CAKH,iBACC,wCAAA,CACA,oBAAA,CAEA,+CACC,kBE7CW,CF8CX,WAAA,CACA,iCAAA,CACA,UAAA,CAEA,2DACC,YAAA\",\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Module\nvar code = ` `;\n// Exports\nexport default code;","import { bindable } from \"aurelia-framework\";\r\nimport { FilterOption, ObjectFilter } from \"app/models/object-filter\";\r\nimport { ObjectValues } from \"app/models/object-values\";\r\n \r\nexport class FilterHandler {\r\n @bindable model: ObjectFilter | undefined;\r\n private sortingOptions: FilterOption[] = [];\r\n private sortingIndex: number = -1;\r\n\tpublic comparisonOptions: FilterOption[] = [];\r\n\tpublic displayState: { icon: string, title: string } | undefined;\r\n\tpublic showFilterValueInput: boolean = false;\r\n\t\r\n\r\n attached() {\r\n if (this.model?.isLocked) {\r\n if (this.model.selectedComparisonOption && this.model.selectedSortingOption) {\r\n this.comparisonOptions = [this.model.selectedComparisonOption];\r\n this.sortingOptions = [this.model.selectedSortingOption];\r\n }\r\n } else {\r\n if (this.model?.targetType == ObjectValues.targetTypes.instance){\r\n this.comparisonOptions = [\r\n ObjectValues.comparisonMethods.hasRelation\r\n ];\r\n this.sortingOptions = [\r\n ObjectValues.sortingMethods.none\r\n ];\r\n } else {\r\n switch (this.model?.type) {\r\n case ObjectValues.dataTypes.Double:\r\n case ObjectValues.dataTypes.Integer:\r\n this.comparisonOptions = [\r\n ObjectValues.comparisonMethods.hasRelation,\r\n ObjectValues.comparisonMethods.equalToOrLessThan,\r\n ObjectValues.comparisonMethods.equalTo,\r\n ObjectValues.comparisonMethods.equalToOrGreaterThan\r\n ];\r\n break;\r\n case ObjectValues.dataTypes.String:\r\n this.comparisonOptions = [\r\n ObjectValues.comparisonMethods.hasRelation,\r\n ObjectValues.comparisonMethods.contains,\r\n ObjectValues.comparisonMethods.equalTo\r\n ];\r\n break;\r\n }\r\n this.sortingOptions = [\r\n ObjectValues.sortingMethods.none,\r\n ObjectValues.sortingMethods.ascending,\r\n ObjectValues.sortingMethods.descending\r\n ];\r\n }\r\n\t\t}\r\n\t\t\r\n\r\n\t\tthis.setIndexOfSelectedSortingOption();\r\n\t\tthis.setDisplayState();\r\n let selectedComparisonOption: any = !this.model?.selectedComparisonOption;\r\n\t\tthis.showFilterValueInput = Boolean(this.model?.selectedComparisonOption) && !selectedComparisonOption[\"excludeComparison\"];\r\n\t}\r\n\r\n\t//fix is not consistent\r\n\tsetIndexOfSelectedSortingOption() {\r\n if (this.model?.selectedSortingOption) {\r\n let anyIndex = this.sortingOptions.indexOf(this.model.selectedSortingOption);\r\n if (anyIndex == -1) {\r\n //Lappeløsning to fix the lack of sorting icon\r\n anyIndex = 0;\r\n }\r\n this.sortingIndex = anyIndex;\r\n //ensures that it still gets loaded with the icon. \r\n this.model.selectedSortingOption = this.sortingOptions[this.sortingIndex];\r\n }\r\n\t}\r\n\r\n public toggleSort() {\r\n if (this.model?.selectedSortingOption) {\r\n this.sortingIndex++;\r\n if(this.sortingIndex === this.sortingOptions.length)\r\n this.sortingIndex = 0;\r\n this.model.selectedSortingOption = this.sortingOptions[this.sortingIndex];\r\n }\r\n\t}\r\n\t\r\n\tpublic toggleDisplay() {\r\n if (this.model) {\r\n this.model.hide = !this.model?.hide;\r\n }\r\n\r\n\t\tthis.setDisplayState();\r\n\t}\r\n\r\n\tpublic toggleComparison(comparison: FilterOption) {\r\n if (this.model) {\r\n this.model.selectedComparisonOption = this.model?.selectedComparisonOption === comparison ? undefined : comparison;\r\n \r\n if(this.model?.selectedComparisonOption === ObjectValues.comparisonMethods.hasRelation && Boolean(this.model.value)){\r\n delete this.model.value;\r\n }\r\n let selectedComparisonOption: any = this.model?.selectedComparisonOption;\r\n this.showFilterValueInput = this.model?.selectedComparisonOption != undefined && selectedComparisonOption[\"excludeComparison\"] == undefined;\r\n }\r\n\t}\r\n\r\n\tprivate setDisplayState() {\r\n\t\tif (this.model?.hide) {\r\n\t\t\tthis.displayState = { icon: \"far fa-eye-slash\", title: \"Hide\" }\r\n\t\t} else {\r\n\t\t\tthis.displayState = { icon: \"far fa-eye\", title: \"Show\" }\r\n\t\t}\r\n\t}\r\n}\r\n"],"names":["___CSS_LOADER_EXPORT___","push","module","id","FilterHandler","sortingOptions","sortingIndex","comparisonOptions","showFilterValueInput","attached","this","model","isLocked","selectedComparisonOption","selectedSortingOption","targetType","targetTypes","instance","comparisonMethods","hasRelation","sortingMethods","none","type","dataTypes","Double","Integer","equalToOrLessThan","equalTo","equalToOrGreaterThan","String","contains","ascending","descending","setIndexOfSelectedSortingOption","setDisplayState","Boolean","anyIndex","indexOf","toggleSort","length","toggleDisplay","hide","toggleComparison","comparison","undefined","value","displayState","icon","title","bindable"],"sourceRoot":""}