Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/js/ui/vue/components/reaction/dist/
Upload File :
Current File : /var/www/homesaver/www/bitrix/js/ui/vue/components/reaction/dist/reaction.bundle.js.map

{"version":3,"file":"reaction.bundle.js","sources":["../src/reaction.js"],"sourcesContent":["/**\n * Bitrix UI\n * Reaction picker Vue component\n *\n * @package bitrix\n * @subpackage ui\n * @copyright 2001-2019 Bitrix\n */\n\nimport 'ui.fonts.opensans';\nimport \"./reaction.css\";\nimport \"./icons.css\";\n\nimport {BitrixVue} from 'ui.vue';\nimport { BaseEvent, EventEmitter } from 'main.core.events';\n\nconst ReactionType = Object.freeze({\n\tnone: 'none',\n\tlike: 'like',\n\tkiss: 'kiss',\n\tlaugh: 'laugh',\n\twonder: 'wonder',\n\tcry: 'cry',\n\tangry: 'angry',\n});\n\nconst ReactionOrder = ['like', 'kiss', 'laugh', 'wonder', 'cry', 'angry'];\n\nBitrixVue.component('bx-reaction',\n{\n\t/**\n\t * @emits 'set' {values: object}\n\t * @emits 'list' {action: string, type: string}\n\t */\n\tprops:\n\t{\n\t\tid: { default: ''},\n\t\tvalues: { default: {}},\n\t\tuserId: { default: 0},\n\t\topenList: { default: true},\n\t},\n\tdata()\n\t{\n\t\treturn {\n\t\t\tlocalValues: {},\n\t\t\tuserReaction: ReactionType.none,\n\t\t\tbuttonAnimate: false,\n\t\t}\n\t},\n\tcreated()\n\t{\n\t\tthis.localValues = Object.assign({}, this.values);\n\t\tEventEmitter.subscribe('ui:reaction:press', this.onPress);\n\t},\n\tdestroy()\n\t{\n\t\tEventEmitter.unsubscribe('ui:reaction:press', this.onPress);\n\t},\n\twatch:\n\t{\n\t\tvalues(values)\n\t\t{\n\t\t\tthis.localValues = Object.assign({}, values);\n\t\t},\n\t},\n\tmethods:\n\t{\n\t\tlist()\n\t\t{\n\t\t\tif (this.openList)\n\t\t\t{\n\t\t\t\t// todo open list\n\t\t\t}\n\t\t\tthis.$emit('list', {values: this.localValues});\n\t\t},\n\n\t\tpress(emotion = ReactionType.like)\n\t\t{\n\t\t\tif (this.userReaction === ReactionType.none)\n\t\t\t{\n\t\t\t\tif (!this.localValues[emotion])\n\t\t\t\t{\n\t\t\t\t\tthis.localValues = Object.assign({}, this.localValues, {[emotion]: []});\n\t\t\t\t}\n\n\t\t\t\tthis.localValues[emotion].push(this.userId);\n\n\t\t\t\tthis.buttonAnimate = true;\n\t\t\t\tsetTimeout(() => this.buttonAnimate = false, 400);\n\n\t\t\t\tthis.$emit('set', {action: 'set', type: emotion});\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\n\t\t\t\tif (this.localValues[this.userReaction])\n\t\t\t\t{\n\t\t\t\t\tthis.localValues[this.userReaction] = this.localValues[this.userReaction].filter(element => element !== this.userId);\n\t\t\t\t}\n\n\t\t\t\tthis.$emit('set', {action: 'remove', type: this.userReaction});\n\t\t\t}\n\t\t},\n\n\t\tonPress(event: BaseEvent)\n\t\t{\n\t\t\tconst data = event.getData();\n\t\t\tif (!this.id || data.id !== this.id)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (!data.emotion)\n\t\t\t{\n\t\t\t\tdata.emotion = ReactionType.like\n\t\t\t}\n\n\t\t\tthis.press(data.emotion);\n\t\t}\n\t},\n\tcomputed:\n\t{\n\t\ttypes()\n\t\t{\n\t\t\tthis.userReaction = ReactionType.none;\n\n\t\t\treturn ReactionOrder.filter(type =>\n\t\t\t{\n\t\t\t\tif (\n\t\t\t\t\ttypeof this.localValues[type] === 'undefined'\n\t\t\t\t\t|| !(this.localValues[type] instanceof Array)\n\t\t\t\t\t|| this.localValues[type].length <= 0\n\t\t\t\t)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tthis.userId > 0\n\t\t\t\t\t&& this.userReaction === ReactionType.none\n\t\t\t\t\t&& this.localValues[type].includes(this.userId)\n\t\t\t\t)\n\t\t\t\t{\n\t\t\t\t\tthis.userReaction = type;\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t}).map(type => {\n\t\t\t\treturn {type, count: this.localValues[type].length}\n\t\t\t});\n\t\t},\n\n\t\tcounter()\n\t\t{\n\t\t\treturn this.types.map(element => element.count).reduce((result, value) => result + value, 0);\n\t\t},\n\n\t\tisTypesShowed()\n\t\t{\n\t\t\tif (this.counter <= 0)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (this.userReaction !== ReactionType.none && this.counter === 1)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tisMobile()\n\t\t{\n\t\t\tconst UA = navigator.userAgent.toLowerCase();\n\n\t\t\treturn (\n\t\t\t\tUA.includes('android')\n\t\t\t\t|| UA.includes('iphone')\n\t\t\t\t|| UA.includes('ipad')\n\t\t\t\t|| UA.includes('bitrixmobile')\n\t\t\t)\n\t\t},\n\t},\n\ttemplate: `\n\t\t<div :class=\"['ui-vue-reaction', {'ui-vue-reaction-mobile': isMobile}]\">\n\t\t\t<transition name=\"ui-vue-reaction-result-animation\">\n\t\t\t\t<div v-if=\"isTypesShowed\" class=\"ui-vue-reaction-result\" @click=\"list\">\n\t\t\t\t\t<transition-group tag=\"div\" class=\"ui-vue-reaction-result-types\" name=\"ui-vue-reaction-result-type-animation\" >\n\t\t\t\t\t\t<span v-for=\"element in types\" :class=\"['ui-vue-reaction-result-type', 'ui-vue-reaction-icon-'+element.type]\" :key=\"element.type\"></span>\n\t\t\t\t\t</transition-group>\t\n\t\t\t\t\t<div class=\"ui-vue-reaction-result-counter\">{{counter}}</div>\n\t\t\t\t</div>\n\t\t\t</transition>\n\t\t\t<div v-if=\"userId > 0\"  class=\"ui-vue-reaction-button\" @click.prevent=\"press()\">\n\t\t\t\t<div class=\"ui-vue-reaction-button-container\">\n\t\t\t\t\t<div :class=\"['ui-vue-reaction-button-icon', 'ui-vue-reaction-icon-'+userReaction, {'ui-vue-reaction-button-pressed': buttonAnimate}]\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t`\n});\n"],"names":["ReactionType","Object","freeze","none","like","kiss","laugh","wonder","cry","angry","ReactionOrder","BitrixVue","component","props","id","values","userId","openList","data","localValues","userReaction","buttonAnimate","created","assign","EventEmitter","subscribe","onPress","destroy","unsubscribe","watch","methods","list","$emit","press","emotion","push","setTimeout","action","type","filter","element","event","getData","computed","types","Array","length","includes","map","count","counter","reduce","result","value","isTypesShowed","isMobile","UA","navigator","userAgent","toLowerCase","template"],"mappings":";;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CASA,IAAMA,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC;GAClCC,IAAI,EAAE,MAAM;GACZC,IAAI,EAAE,MAAM;GACZC,IAAI,EAAE,MAAM;GACZC,KAAK,EAAE,OAAO;GACdC,MAAM,EAAE,QAAQ;GAChBC,GAAG,EAAE,KAAK;GACVC,KAAK,EAAE;CACR,CAAC,CAAC;CAEF,IAAMC,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC;AAEzEC,iBAAS,CAACC,SAAS,CAAC,aAAa,EACjC;;CAEA;CACA;CACA;GACCC,KAAK,EACL;KACCC,EAAE,EAAE;OAAE,WAAS;MAAG;KAClBC,MAAM,EAAE;OAAE,WAAS;MAAG;KACtBC,MAAM,EAAE;OAAE,WAAS;MAAE;KACrBC,QAAQ,EAAE;OAAE,WAAS;;IACrB;GACDC,IAAI,kBACJ;KACC,OAAO;OACNC,WAAW,EAAE,EAAE;OACfC,YAAY,EAAEpB,YAAY,CAACG,IAAI;OAC/BkB,aAAa,EAAE;MACf;IACD;GACDC,OAAO,qBACP;KACC,IAAI,CAACH,WAAW,GAAGlB,MAAM,CAACsB,MAAM,CAAC,EAAE,EAAE,IAAI,CAACR,MAAM,CAAC;KACjDS,6BAAY,CAACC,SAAS,CAAC,mBAAm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