{"version":3,"sources":["webpack:///../WCC.UI/App/components/tags/picker/picker.html?4ef0","webpack:///../WCC.UI/App/components/tags/picker/picker.scss?5c9f","webpack:///../WCC.UI/App/components/tags/picker/picker.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/tags/picker/picker.scss","webpack:///../WCC.UI/App/components/tags/picker/picker.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","components","preload","TagsPickerVM","constructor","config","info","effects","selectedTags","ko","observableArray","toggle","_ref","tag","this","allowMultiple","includes","remove","push","selectedTag","clear","tags","flattenComputed","observable","unwrap","multiple","isRootHidden","hideRoot","items","map","isSelected","is","register","_","last","undefined","length","applyBindingsToNode","element","select","ids","filter","t","contentTagId","WCCError","messages","InvalidRequest","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","system","SystemHelpers","html","getTemplatesAndResources","forEach","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___"],"mappings":"sIAAA,UAAO,CACC,sGACA,wDAIC,KAJ4C,EAAF,SAAYA,EAASC,GAG5D,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,mECNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,iJAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,EAASO,GAI1BF,EAAOG,QAAUR,EAAQS,QAAU,I,q2BCTnCC,EAAWC,QAAQ,OAenB,IAAqBC,EAArB,MAUIC,YACwCC,EACFC,EACNC,GAPhC,KAAAC,aAAeC,EAAGC,kBA+ClB,KAAAC,OAASC,IAA8B,IAA7B,IAAEC,GAAuBD,EAC3BE,KAAKC,gBACDD,KAAKN,eAAeQ,SAASH,GAC7BC,KAAKN,aAAaS,OAAOJ,GAEzBC,KAAKN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KC,YAAYH,QAEhE,+B,iKCLD5D,EADkC,EAAQ,wDAChCgE,EAA4B,IAE9B7C,KAAK,CAACtB,EAAOC,EAAI,mDAAoD,KAE7ED,EAAOG,QAAUA,G,iHCHjBH,EAAOG,QAFI","file":"316.ef561d35c3b90ac0f949.js","sourcesContent":["define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./picker.html\", \n \"!../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./picker.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Observable, PureComputed, Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport { Tag } from 'models/tag';\r\nimport WCCError from 'models/wccError';\r\nimport './picker.html';\r\nimport './picker.scss';\r\n\ncomponents.preload('tag');\n\nexport interface TagsPickerVMConfig {\n tags: SubscribableOrNullableValue>\r\n selectedTag?: SubscribableOrNullableValue\r\n multiple?: SubscribableOrNullableValue\r\n hideRoot?: SubscribableOrNullableValue\r\n}\n\ninterface TagsPickerVMItem {\n tag: Tag,\r\n isSelected: PureComputed\r\n}\n\n@injectable()\nexport default class TagsPickerVM {\n private allowMultiple: Subscribable\n\n items: Subscribable>\n selectedTag: Observable\n\n selectedTags = ko.observableArray();\n\n isRootHidden: SubscribableOrNullableValue\n\n constructor(\n @inject(wccModules.componentConfig) config: TagsPickerVMConfig,\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\n @inject(wccModules.effects) effects: EffectsContainer\n ) {\n const tags = ko.flattenComputed(config.tags, []);\n this.selectedTag = ko.observable(config.selectedTag).unwrap(false);\n this.allowMultiple = ko.flattenComputed(config.multiple, false);\n this.isRootHidden = config.hideRoot;\n\n this.items = tags.map(tag => ({\n tag: tag,\r\n isSelected: this.selectedTags.is(tags => tags.includes(tag))\r\n }));\n\n effects.register(tags => {\n const selectedTag = _.last(tags);\n\n if (this.selectedTag() != selectedTag)\n this.selectedTag(selectedTag);\r\n }, [this.selectedTags]);\n\n effects.register(selectedTag => {\n if (selectedTag == undefined && this.selectedTags().length > 0)\r\n this.clear();\r\n }, [this.selectedTag]);\n\n ko.applyBindingsToNode(info.element, {\n 'css': {\n 'tag-picker': true\n }\n });\n }\n\n select(ids: Array) {\n const tags = this.items().map(i => i.tag).filter(t => ids.includes(t.contentTagId()));\r\n\r\n if (!this.allowMultiple() && tags.length > 1)\r\n throw new WCCError(messages.InvalidRequest);\r\n\r\n this.selectedTags(tags);\r\n }\n\n toggle = ({ tag }: TagsPickerVMItem) => {\n if (this.allowMultiple()) {\n if (this.selectedTags().includes(tag))\n this.selectedTags.remove(tag);\n else\n this.selectedTags.push(tag);\n } else {\n if (this.selectedTag() != tag)\n this.selectedTags([tag]);\r\n }\n }\n\n clear = () => {\n this.selectedTags([]);\r\n }\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".tag-picker{display:flex;flex-wrap:wrap;gap:3px}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}