{"version":3,"sources":["webpack:///../WCC.UI/App/components/tags/list/list.html?4fcb","webpack:///../WCC.UI/App/components/tags/list/list.scss?6ad4","webpack:///../WCC.UI/App/components/tags/list/list.ts","webpack:///../WCC.UI/App/managers/tags/readonlyCollection.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/tags/list/list.scss","webpack:///../WCC.UI/App/components/tags/list/list.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","components","preload","TagsListVM","constructor","model","info","effects","_model$click","labels","oActiveTag","ko","observable","onClick","tag","this","clickHandler","activateTag","_this$oActiveTag","oIsActive","readOnlyMode","flattenComputed","readOnly","simpleUIMode","simpleUI","defaultManager","pureComputed","ignoreDependencies","getDefaultManager","tags","remove","manager","pluck","m","sortBy","t","tagValue","loadingTags","loading","updatingTags","updating","hasTags","any","showNoTags","editAllowed","allowEdit","removeAllowed","_this$manager$allowRe","_this$manager","allowRemove","ready","click","_","noop","applyBindingsToNode","element","config","register","ReadOnlyCollectionTagsManager","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","TagsManagerBase","jsonManager","super","tagsCollection","addHandler","add","removeHandler","subscribe","update","addTag","jsonTag","Promise","resolve","reject","Error","removeTag","source","find","contentTagId","then","load","clone","map","isRemoveAllowed","undefined","system","SystemHelpers","html","getTemplatesAndResources","forEach","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___","push"],"mappings":"kIAAA,UAAO,CACC,kGACA,wDAIC,KAJ4C,EAAF,SAAYA,EAASC,GAG5D,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,+DCNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,6IAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,E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,SAASC,KAAKC,YAAYH,QAEhE,+B,6JCLDjG,EADkC,EAAQ,wDAChCqG,EAA4B,IAE9BC,KAAK,CAACzG,EAAOC,EAAI,uRAAwR,KAEjTD,EAAOG,QAAUA,G,6GCHjBH,EAAOG,QAFI","file":"255.50b7e4f49233f4cb1186.js","sourcesContent":["define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./list.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!./list.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 { Func } from 'interfaces/func';\r\nimport { inject, injectable } from 'inversify';\r\nimport { PureComputed, Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport TagsManagerBase from 'managers/tags/base';\r\nimport ReadOnlyCollectionTagsManager, { ReadOnlyCollectionTagsManagerConfig } from 'managers/tags/readonlyCollection';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport { Tag } from 'models/tag';\r\nimport './list.html';\r\nimport './list.scss';\r\n\r\ncomponents.preload('tag', 'entity-tag');\r\n\r\ninterface TagsListConfig {\r\n manager?: SubscribableOrNullableValue\r\n tags?: SubscribableOrNullableValue>\r\n simpleUI?: SubscribableOrNullableValue\r\n readOnly?: SubscribableOrNullableValue\r\n remove?: Action<[Tag]> | Func, [Tag]>\r\n click?: Action<[Tag]>\r\n}\r\n\r\n@injectable()\r\nexport default class TagsListVM {\r\n private clickHandler: (tag: Tag) => void\r\n\r\n labels = labels\r\n\r\n manager: Subscribable\r\n\r\n tags: Subscribable>\r\n oActiveTag = ko.observable();\r\n loadingTags: Subscribable\r\n updatingTags: Subscribable\r\n hasTags: Subscribable\r\n showNoTags: Subscribable\r\n \r\n readOnly: Subscribable\r\n ready: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) model: TagsListConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.effects) private effects: EffectsContainer\r\n ) {\r\n const readOnlyMode = ko.flattenComputed(model.readOnly, false);\r\n const simpleUIMode = ko.flattenComputed(model.simpleUI, true);\r\n\r\n const defaultManager = ko.pureComputed(() => ko.ignoreDependencies(() => this.getDefaultManager({\r\n tags: model.tags,\r\n remove: model.remove\r\n })));\r\n\r\n this.manager = ko.flattenComputed(model.manager, defaultManager);\r\n\r\n this.tags = this.manager.pluck(m => m.tags, []).sortBy(t => t.tagValue());\r\n this.loadingTags = this.manager.pluck(m => m.loading, true);\r\n this.updatingTags = this.manager.pluck(m => m.updating, false);\r\n this.hasTags = this.tags.any();\r\n this.showNoTags = ko.pureComputed(() => !simpleUIMode() && !this.hasTags());\r\n\r\n const editAllowed = this.manager.pluck(m => m.allowEdit, false);\r\n const removeAllowed = ko.pureComputed(() => this.manager()?.allowRemove() ?? false);\r\n \r\n this.readOnly = ko.pureComputed(() => readOnlyMode() || !editAllowed() && !removeAllowed());\r\n\r\n this.ready = ko.pureComputed(() => !this.loadingTags());\r\n\r\n this.clickHandler = model.click ?? _.noop;\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'css': {\r\n 'tags-list': true\r\n }\r\n }, this);\r\n }\r\n\r\n onClick = (tag: Tag) => this.clickHandler(tag)\r\n\r\n activateTag = (tag: Tag) => {\r\n this.oActiveTag()?.oIsActive(false);\r\n tag.oIsActive(true);\r\n this.oActiveTag(tag);\r\n }\r\n\r\n private getDefaultManager(config: ReadOnlyCollectionTagsManagerConfig): TagsManagerBase {\r\n return this.effects.register(new ReadOnlyCollectionTagsManager(config));\r\n }\r\n}","import { PureComputed, Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport { JSONTag, Tag } from 'models/tag';\r\nimport TagsManagerBase from './base';\r\n\r\nexport interface ReadOnlyCollectionTagsManagerConfig {\r\n tags?: SubscribableOrNullableValue>\r\n add?: (tag: JSONTag) => void | Promise\r\n remove?: (tag: Tag) => void | Promise\r\n}\r\n\r\nexport default class ReadOnlyCollectionTagsManager extends TagsManagerBase {\n private tagsCollection: Subscribable>\n\n private addHandler?: (tag: JSONTag) => void | Promise\n private removeHandler?: (tag: Tag) => void | Promise\n\n constructor(jsonManager: ReadOnlyCollectionTagsManagerConfig) {\n super();\n\n this.tagsCollection = ko.flattenComputed(jsonManager.tags, []);\n\n this.addHandler = jsonManager.add;\n this.removeHandler = jsonManager.remove;\n\n this.effects.register([\n this.tagsCollection.subscribe(this.update, this)\n ]);\n }\n\n addTag(jsonTag: JSONTag): Promise {\n if (this.addHandler)\n return Promise.resolve(this.addHandler(jsonTag));\r\n else\r\n return Promise.reject(new Error('no add handler is provided'))\r\n }\n\n removeTag(tag: Tag) {\n if (this.removeHandler)\n return this.source.find(tag.contentTagId()).then(this.removeHandler, _.noop);\n else\n return Promise.reject(new Error('no remove handler is provided'))\n }\n\n protected load(): Array {\n return _.clone(this.tagsCollection());\n }\n\n protected override map(tag: any) {\n return tag;\n }\n\n protected override isRemoveAllowed() {\n return this.removeHandler != undefined;\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, \".tags-list{display:inline;position:relative;line-height:150%}.tags-list__tag,.tags-list__tag tag{line-height:150%;animation-duration:300ms;margin:2px 0}.tags-list__cover{display:flex;justify-content:center;align-items:center}.tags-list__tag-active{position:relative;z-index:1}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}