@ecomplus/widget-martan 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.12](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-martan@1.1.11...@ecomplus/widget-martan@1.1.12) (2024-05-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ecomplus/widget-martan
|
|
9
|
+
|
|
10
|
+
## [1.1.11](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-martan@1.1.10...@ecomplus/widget-martan@1.1.11) (2024-05-07)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @ecomplus/widget-martan
|
|
13
|
+
|
|
6
14
|
## [1.1.10](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-martan@1.1.9...@ecomplus/widget-martan@1.1.10) (2024-05-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @ecomplus/widget-martan
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://widgetMartan/./src/widgets/reviews/Score.vue?9823","webpack://widgetMartan/./src/widgets/reviews/Score.vue?0dac","webpack://widgetMartan/./src/widgets/reviews/Score.vue?52ee","webpack://widgetMartan/./src/utils/textToNumber.js","webpack://widgetMartan/src/widgets/reviews/Score.vue","webpack://widgetMartan/./src/widgets/reviews/Score.vue?c887","webpack://widgetMartan/./src/utils/get-width.js","webpack://widgetMartan/./src/widgets/reviews/Score.vue","webpack://widgetMartan/./src/widgets/reviews/Score.vue?36a1"],"names":["content","__esModule","default","module","i","locals","exports","add","___CSS_LOADER_API_IMPORT___","push","numberToText","text","name","props","reviews","type","Object","list","orderRating","total","average","one","two","three","four","five","averageTotal","offset","starColor","String","data","maxReviews","methods","getWidth","rating","toFixed","setRating","e","removeClass","Promise","resolve","Array","from","$refs","options","children","map","option","style","removeProperty","childNodes","stroke","color","classList","remove","catch","console","error","el","opacity","forEach","index","$parent","$emit","component","_vm","this","_h","$createElement","_c","_self","ref","staticClass","_l","key","on","$event","_v","_s","staticStyle","attrs","width"],"mappings":"oGAGA,IAAIA,EAAU,EAAQ,IACnBA,EAAQC,aAAYD,EAAUA,EAAQE,SACnB,iBAAZF,IAAsBA,EAAU,CAAC,CAACG,EAAOC,EAAIJ,EAAS,MAC7DA,EAAQK,SAAQF,EAAOG,QAAUN,EAAQK,SAG/BE,EADH,EAAQ,GAAwEL,SACzE,WAAYF,GAAS,EAAM,K,gCCT5C,O,oBCEAM,EADkC,EAAQ,EAChCE,EAA4B,IAE9BC,KAAK,CAACN,EAAOC,EAAI,g4BAAi4B,KAE15BD,EAAOG,QAAUA,G,uCCNjB,MAeMI,EAAgBC,IACpB,OAAQA,GACN,KAAK,EACH,MAAO,MACT,KAAK,EACH,MAAO,MACT,KAAK,EACH,MAAO,QACT,KAAK,EACH,MAAO,OACT,KAAK,EACH,MAAO,SCkBE,IC5CuL,ED4CvL,CACfC,KAAA,QAEAC,MAAA,CACAC,QAAA,CACAC,KAAAC,OACAd,QAAA,CACAe,KAAA,GACAC,YAAA,KACAC,MAAA,EACAC,QAAA,CACAC,IAAA,EACAC,IAAA,EACAC,MAAA,EACAC,KAAA,EACAC,KAAA,GAEAC,aAAA,EACAC,OAAA,IAIAC,UAAA,CACAb,KAAAc,OACA3B,QAAA,YAIA4B,UACA,CACAC,WAAA,IAIAC,QAAA,CACAC,SE5EO,SAAkBnB,EAASoB,GAChC,OAAsB,IAAlBpB,EAAQK,MAAoB,MAG7B,IAAML,EAAQM,QAAQV,EAAawB,IACpCpB,EAAQK,OACRgB,UAHM,KF0EVzB,eACA0B,UAAA,eAAAC,EAAAH,GAeA,QAdAI,KACA,IAAAC,QAAAC,IAQAA,EAPAC,MAAAC,KAAA,KAAA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AAS,KAAK,QAAU,YAAY,eAAe,IAAI,OAAS,UAAU,KAAO,OAAO,iBAAiB,QAAQ,kBAAkB,UAAU,CAACX,EAAG,OAAO,CAACW,MAAM,CAAC,OAAS,OAAO,EAAI,gBAAgB,KAAO,UAAUX,EAAG,OAAO,CAACW,MAAM,CAAC,EAAI,iRAAiR,eAAe,IAAI,KAAO,sBAAsBX,EAAG,MAAM,CAACG,YAAY,mBAAmB,CAACH,EAAG,MAAM,CAACG,YAAY,gBAAgBxB,MAAM,CACpoCiC,MAAOhB,EAAIhC,SAASgC,EAAInD,QAAS+C,GACjC,mBAAoBI,EAAIrC,WAAa,WAChCyC,EAAG,MAAM,CAACG,YAAY,mBAAmB,CAACH,EAAG,OAAO,CAACJ,EAAIY,GAAGZ,EAAIa,GAAGb,EAAInD,QAAQM,QAAQ6C,EAAIvD,aAAamD,QAAYQ,EAAG,OAAO,CAACJ,EAAIY,GAAG,IAAIZ,EAAIa,GAAGb,EAAIhC,SAASgC,EAAInD,QAAS+C,IAAQ,OAAOQ,EAAG,OAAO,CAACG,YAAY,oBAAoB,CAACH,EAAG,MAAM,CAACG,YAAY,iCAAiCQ,MAAM,CAAC,MAAQ,6BAA6B,MAAQ,KAAK,OAAS,KAAK,QAAU,YAAY,eAAe,IAAI,OAAS,eAAe,KAAO,OAAO,iBAAiB,QAAQ,kBAAkB,UAAU,CAACX,EAAG,OAAO,CAACW,MAAM,CAAC,OAAS,OAAO,EAAI,gBAAgB,KAAO,UAAUX,EAAG,OAAO,CAACW,MAAM,CAAC,EAAI,kBAAkBX,EAAG,OAAO,CAACW,MAAM,CAAC,EAAI,2BAA0B,KAC/nB,IDQpB,EACA,KACA,KACA,MAIa,UAAAhB,E","file":"widget-martan.4.min.js","sourcesContent":["// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = require(\"!!../../../../../node_modules/css-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/dist/cjs.js??ref--2-2!../../../../../node_modules/sass-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=style&index=0&id=ced6d2fe&prod&lang=css\");\nif(content.__esModule) content = content.default;\nif(typeof content === 'string') content = [[module.id, content, '']];\nif(content.locals) module.exports = content.locals;\n// add the styles to the DOM\nvar add = require(\"!../../../../../node_modules/vue-style-loader/lib/addStylesClient.js\").default\nvar update = add(\"774c1cb8\", content, true, {});","export * from \"-!../../../../../node_modules/vue-style-loader/index.js!../../../../../node_modules/css-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/dist/cjs.js??ref--2-2!../../../../../node_modules/sass-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=style&index=0&id=ced6d2fe&prod&lang=css\"","// 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, \".mt-rating-remove{align-items:center;cursor:pointer;display:flex;visibility:hidden}.mt-rating__list.is-active .mt-rating-remove{visibility:visible}.mt-average__options li:hover{cursor:pointer}.mt-rating__list{align-items:center;display:flex;height:23px;transition:opacity .25s ease-in-out}.mt-rating__list.is-active .mt-rating-total,.mt-rating__list:hover .mt-rating-total{visibility:visible}.mt-rating__list:hover{opacity:.9}.mt-rating-meter{background-color:#e3e6e6;border-radius:50px;box-shadow:inset 0 0 0 1px #e3e6e6;display:flex;height:10px;overflow:hidden;width:100%}.mt-average__options{list-style:none;margin:0;max-width:800px;padding:0;width:100%}.mt-rating-star{align-items:center;justify-content:space-around;margin-left:5px;width:30px}.mt-rating-star,.mt-rating-total{color:#757373;display:flex;font-size:12px}.mt-rating-total{gap:3px;margin-left:2px;visibility:hidden;width:50px}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","const textToNumber = (number) => {\n switch (number) {\n case 'one':\n return 1\n case 'two':\n return 2\n case 'three':\n return 3\n case 'four':\n return 4\n case 'five':\n return 5\n }\n}\n\nconst numberToText = (text) => {\n switch (text) {\n case 1:\n return 'one'\n case 2:\n return 'two'\n case 3:\n return 'three'\n case 4:\n return 'four'\n case 5:\n return 'five'\n }\n}\n\nexport { textToNumber, numberToText }\n","<template>\n <ul class=\"mt-average__options\" ref=\"options\">\n <li class=\"mt-rating__list\" v-for=\"index in maxReviews\" :key=\"index\"\n @click=\"(reviews.total === 0 ? null : setRating($event, index))\">\n <div class=\"mt-rating-star\">\n <span>{{ index }}</span>\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" stroke-width=\"2\"\n stroke=\"#E6E3E3\" style=\"color:#E6E3E3;\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z\"\n stroke-width=\"0\" fill=\"currentColor\" />\n </svg>\n </div>\n\n\n <div class=\"mt-rating-meter\">\n <div class=\"mt-rating-bar\" v-bind:style=\"{\n width: getWidth(reviews, index),\n 'background-color': starColor || 'red',\n }\" />\n </div>\n\n <div class=\"mt-rating-total\">\n <span>{{ reviews.average[numberToText(index)] }}</span>\n <span>({{ getWidth(reviews, index) }})</span>\n\n <span class=\"mt-rating-remove\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon icon-tabler icon-tabler-x\"\n width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M18 6l-12 12\"></path>\n <path d=\"M6 6l12 12\"></path>\n </svg></span>\n </div>\n </li>\n </ul>\n</template>\n\n<script>\nimport { getWidth } from './../../utils/get-width'\nimport { numberToText } from './../../utils/textToNumber'\n\nexport default {\n name: 'Score',\n\n props: {\n reviews: {\n type: Object,\n default: {\n list: [],\n orderRating: null,\n total: 0,\n average: {\n one: 0,\n two: 0,\n three: 0,\n four: 0,\n five: 0\n },\n averageTotal: 0,\n offset: 0,\n }\n },\n\n starColor: {\n type: String,\n default: '#212529'\n },\n },\n\n data () {\n return {\n maxReviews: 5,\n };\n },\n\n methods: {\n getWidth,\n numberToText,\n setRating: async function (e, rating) {\n const removeClass = () =>\n new Promise((resolve) => {\n const res = Array.from(this.$refs.options.children).map((option) => {\n option.style.removeProperty(\"opacity\");\n option.children[0].childNodes[2].style.stroke = \"rgb(227, 230, 230)\";\n option.children[0].childNodes[2].style.color = 'rgb(227, 230, 230)';\n\n return option.classList.remove(\"is-active\");\n });\n resolve(res);\n });\n\n await removeClass().catch(e => console.error(e))\n\n if (rating !== this.reviews.orderRating) {\n const el = Array.from(this.$refs.options.children)[rating - 1];\n el.classList.add(\"is-active\");\n el.style.opacity = 1;\n el.children[0].childNodes[2].style.stroke = this.starColor;\n el.children[0].childNodes[2].style.color = this.starColor;\n Array.from(this.$refs.options.children).forEach((option, index) => {\n if (index !== rating - 1) {\n option.style.opacity = \".5\";\n }\n });\n }\n\n this.$parent.$emit('updateOrderByAverage', { rating })\n },\n },\n};\n</script>\n\n\n<style>\n.mt-rating-remove {\n visibility: hidden;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.mt-rating__list.is-active .mt-rating-remove {\n visibility: visible;\n}\n\n.mt-average__options li:hover {\n cursor: pointer;\n}\n\n.mt-rating__list {\n display: flex;\n align-items: center;\n height: 23px;\n transition: opacity .25s ease-in-out;\n}\n\n.mt-rating__list.is-active .mt-rating-total,\n.mt-rating__list:hover .mt-rating-total {\n visibility: visible;\n}\n\n.mt-rating__list:hover {\n opacity: 0.9;\n}\n\n.mt-rating-meter {\n overflow: hidden;\n box-shadow: inset 0 0 0 1px #e3e6e6;\n background-color: #e3e6e6;\n height: 10px;\n width: 100%;\n border-radius: 50px;\n display: flex;\n}\n\n.mt-average__options {\n margin: 0;\n list-style: none;\n padding: 0;\n max-width: 800px;\n width: 100%;\n}\n\n.mt-rating-star {\n display: flex;\n width: 30px;\n justify-content: space-around;\n font-size: 12px;\n color: #757373;\n align-items: center;\n margin-left: 5px;\n}\n\n.mt-rating-total {\n visibility: hidden;\n width: 50px;\n font-size: 12px;\n color: #757373;\n margin-left: 2px;\n display: flex;\n gap: 3px;\n}\n</style>\n","import mod from \"-!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=script&lang=js\"","import { numberToText } from './textToNumber'\n\n// calcula a % usando a média de avaliacoes / total de avaliacoes do produto\nexport function getWidth(reviews, rating) {\n if (reviews.total === 0) return '0%'\n\n return `${(\n (100 * reviews.average[numberToText(rating)]) /\n reviews.total\n ).toFixed()}%`\n}\n","import { render, staticRenderFns } from \"./Score.vue?vue&type=template&id=ced6d2fe\"\nimport script from \"./Score.vue?vue&type=script&lang=js\"\nexport * from \"./Score.vue?vue&type=script&lang=js\"\nimport style0 from \"./Score.vue?vue&type=style&index=0&id=ced6d2fe&prod&lang=css\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{ref:\"options\",staticClass:\"mt-average__options\"},_vm._l((_vm.maxReviews),function(index){return _c('li',{key:index,staticClass:\"mt-rating__list\",on:{\"click\":function($event){(_vm.reviews.total === 0 ? null : _vm.setRating($event, index))}}},[_c('div',{staticClass:\"mt-rating-star\"},[_c('span',[_vm._v(_vm._s(index))]),_c('svg',{staticStyle:{\"color\":\"#E6E3E3\"},attrs:{\"xmlns\":\"http://www.w3.org/2000/svg\",\"width\":\"14\",\"height\":\"14\",\"viewBox\":\"0 0 24 24\",\"stroke-width\":\"2\",\"stroke\":\"#E6E3E3\",\"fill\":\"none\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\"}},[_c('path',{attrs:{\"stroke\":\"none\",\"d\":\"M0 0h24v24H0z\",\"fill\":\"none\"}}),_c('path',{attrs:{\"d\":\"M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z\",\"stroke-width\":\"0\",\"fill\":\"currentColor\"}})])]),_c('div',{staticClass:\"mt-rating-meter\"},[_c('div',{staticClass:\"mt-rating-bar\",style:({\n width: _vm.getWidth(_vm.reviews, index),\n 'background-color': _vm.starColor || 'red',\n })})]),_c('div',{staticClass:\"mt-rating-total\"},[_c('span',[_vm._v(_vm._s(_vm.reviews.average[_vm.numberToText(index)]))]),_c('span',[_vm._v(\"(\"+_vm._s(_vm.getWidth(_vm.reviews, index))+\")\")]),_c('span',{staticClass:\"mt-rating-remove\"},[_c('svg',{staticClass:\"icon icon-tabler icon-tabler-x\",attrs:{\"xmlns\":\"http://www.w3.org/2000/svg\",\"width\":\"15\",\"height\":\"15\",\"viewBox\":\"0 0 24 24\",\"stroke-width\":\"2\",\"stroke\":\"currentColor\",\"fill\":\"none\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\"}},[_c('path',{attrs:{\"stroke\":\"none\",\"d\":\"M0 0h24v24H0z\",\"fill\":\"none\"}}),_c('path',{attrs:{\"d\":\"M18 6l-12 12\"}}),_c('path',{attrs:{\"d\":\"M6 6l12 12\"}})])])])])}),0)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://widgetMartan/./src/widgets/reviews/Score.vue?9823","webpack://widgetMartan/./src/widgets/reviews/Score.vue?0dac","webpack://widgetMartan/./src/widgets/reviews/Score.vue?52ee","webpack://widgetMartan/./src/utils/textToNumber.js","webpack://widgetMartan/src/widgets/reviews/Score.vue","webpack://widgetMartan/./src/widgets/reviews/Score.vue?c887","webpack://widgetMartan/./src/utils/get-width.js","webpack://widgetMartan/./src/widgets/reviews/Score.vue","webpack://widgetMartan/./src/widgets/reviews/Score.vue?36a1"],"names":["content","__esModule","default","module","i","locals","exports","add","___CSS_LOADER_API_IMPORT___","push","numberToText","text","name","props","reviews","type","Object","list","orderRating","total","average","one","two","three","four","five","averageTotal","offset","starColor","String","data","maxReviews","methods","getWidth","rating","toFixed","setRating","e","removeClass","Promise","resolve","Array","from","$refs","options","children","map","option","style","removeProperty","childNodes","stroke","color","classList","remove","catch","console","error","el","opacity","forEach","index","$parent","$emit","component","_vm","this","_h","$createElement","_c","_self","ref","staticClass","_l","key","on","$event","_v","_s","staticStyle","attrs","width"],"mappings":"oGAGA,IAAIA,EAAU,EAAQ,IACnBA,EAAQC,aAAYD,EAAUA,EAAQE,SACnB,iBAAZF,IAAsBA,EAAU,CAAC,CAACG,EAAOC,EAAIJ,EAAS,MAC7DA,EAAQK,SAAQF,EAAOG,QAAUN,EAAQK,SAG/BE,EADH,EAAQ,GAAwEL,SACzE,WAAYF,GAA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,mBAAmB,CAACH,EAAG,OAAO,CAACJ,EAAIY,GAAGZ,EAAIa,GAAGb,EAAInD,QAAQM,QAAQ6C,EAAIvD,aAAamD,QAAYQ,EAAG,OAAO,CAACJ,EAAIY,GAAG,IAAIZ,EAAIa,GAAGb,EAAIhC,SAASgC,EAAInD,QAAS+C,IAAQ,OAAOQ,EAAG,OAAO,CAACG,YAAY,oBAAoB,CAACH,EAAG,MAAM,CAACG,YAAY,iCAAiCQ,MAAM,CAAC,MAAQ,6BAA6B,MAAQ,KAAK,OAAS,KAAK,QAAU,YAAY,eAAe,IAAI,OAAS,eAAe,KAAO,OAAO,iBAAiB,QAAQ,kBAAkB,UAAU,CAACX,EAAG,OAAO,CAACW,MAAM,CAAC,OAAS,OAAO,EAAI,gBAAgB,KAAO,UAAUX,EAAG,OAAO,CAACW,MAAM,CAAC,EAAI,kBAAkBX,EAAG,OAAO,CAACW,MAAM,CAAC,EAAI,2BAA0B,KAC/nB,IDQpB,EACA,KACA,KACA,MAIa,UAAAhB,E","file":"widget-martan.4.min.js","sourcesContent":["// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = require(\"!!../../../../../node_modules/css-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/dist/cjs.js??ref--2-2!../../../../../node_modules/sass-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=style&index=0&id=ced6d2fe&prod&lang=css\");\nif(content.__esModule) content = content.default;\nif(typeof content === 'string') content = [[module.id, content, '']];\nif(content.locals) module.exports = content.locals;\n// add the styles to the DOM\nvar add = require(\"!../../../../../node_modules/vue-style-loader/lib/addStylesClient.js\").default\nvar update = add(\"774c1cb8\", content, true, {});","export * from \"-!../../../../../node_modules/vue-style-loader/index.js!../../../../../node_modules/css-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/dist/cjs.js??ref--2-2!../../../../../node_modules/sass-loader/dist/cjs.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=style&index=0&id=ced6d2fe&prod&lang=css\"","// 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, \".mt-rating-remove{align-items:center;cursor:pointer;display:flex;visibility:hidden}.mt-rating__list.is-active .mt-rating-remove{visibility:visible}.mt-average__options li:hover{cursor:pointer}.mt-rating__list{align-items:center;display:flex;height:23px;transition:opacity .25s ease-in-out}.mt-rating__list.is-active .mt-rating-total,.mt-rating__list:hover .mt-rating-total{visibility:visible}.mt-rating__list:hover{opacity:.9}.mt-rating-meter{background-color:#e3e6e6;border-radius:50px;box-shadow:inset 0 0 0 1px #e3e6e6;display:flex;height:10px;overflow:hidden;width:100%}.mt-average__options{list-style:none;margin:0;max-width:800px;padding:0;width:100%}.mt-rating-star{align-items:center;justify-content:space-around;margin-left:5px;width:30px}.mt-rating-star,.mt-rating-total{color:#757373;display:flex;font-size:12px}.mt-rating-total{gap:3px;margin-left:2px;visibility:hidden;width:50px}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","const textToNumber = (number) => {\n switch (number) {\n case 'one':\n return 1\n case 'two':\n return 2\n case 'three':\n return 3\n case 'four':\n return 4\n case 'five':\n return 5\n }\n}\n\nconst numberToText = (text) => {\n switch (text) {\n case 1:\n return 'one'\n case 2:\n return 'two'\n case 3:\n return 'three'\n case 4:\n return 'four'\n case 5:\n return 'five'\n }\n}\n\nexport { textToNumber, numberToText }\n","<template>\n <ul class=\"mt-average__options\" ref=\"options\">\n <li class=\"mt-rating__list\" v-for=\"index in maxReviews\" :key=\"index\"\n @click=\"(reviews.total === 0 ? null : setRating($event, index))\">\n <div class=\"mt-rating-star\">\n <span>{{ index }}</span>\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" stroke-width=\"2\"\n stroke=\"#E6E3E3\" style=\"color:#E6E3E3;\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z\"\n stroke-width=\"0\" fill=\"currentColor\" />\n </svg>\n </div>\n\n\n <div class=\"mt-rating-meter\">\n <div class=\"mt-rating-bar\" v-bind:style=\"{\n width: getWidth(reviews, index),\n 'background-color': starColor || 'red',\n }\" />\n </div>\n\n <div class=\"mt-rating-total\">\n <span>{{ reviews.average[numberToText(index)] }}</span>\n <span>({{ getWidth(reviews, index) }})</span>\n\n <span class=\"mt-rating-remove\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon icon-tabler icon-tabler-x\"\n width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M18 6l-12 12\"></path>\n <path d=\"M6 6l12 12\"></path>\n </svg></span>\n </div>\n </li>\n </ul>\n</template>\n\n<script>\nimport { getWidth } from './../../utils/get-width'\nimport { numberToText } from './../../utils/textToNumber'\n\nexport default {\n name: 'Score',\n\n props: {\n reviews: {\n type: Object,\n default: {\n list: [],\n orderRating: null,\n total: 0,\n average: {\n one: 0,\n two: 0,\n three: 0,\n four: 0,\n five: 0\n },\n averageTotal: 0,\n offset: 0,\n }\n },\n\n starColor: {\n type: String,\n default: '#212529'\n },\n },\n\n data () {\n return {\n maxReviews: 5,\n };\n },\n\n methods: {\n getWidth,\n numberToText,\n setRating: async function (e, rating) {\n const removeClass = () =>\n new Promise((resolve) => {\n const res = Array.from(this.$refs.options.children).map((option) => {\n option.style.removeProperty(\"opacity\");\n option.children[0].childNodes[2].style.stroke = \"rgb(227, 230, 230)\";\n option.children[0].childNodes[2].style.color = 'rgb(227, 230, 230)';\n\n return option.classList.remove(\"is-active\");\n });\n resolve(res);\n });\n\n await removeClass().catch(e => console.error(e))\n\n if (rating !== this.reviews.orderRating) {\n const el = Array.from(this.$refs.options.children)[rating - 1];\n el.classList.add(\"is-active\");\n el.style.opacity = 1;\n el.children[0].childNodes[2].style.stroke = this.starColor;\n el.children[0].childNodes[2].style.color = this.starColor;\n Array.from(this.$refs.options.children).forEach((option, index) => {\n if (index !== rating - 1) {\n option.style.opacity = \".5\";\n }\n });\n }\n\n this.$parent.$emit('updateOrderByAverage', { rating })\n },\n },\n};\n</script>\n\n\n<style>\n.mt-rating-remove {\n visibility: hidden;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.mt-rating__list.is-active .mt-rating-remove {\n visibility: visible;\n}\n\n.mt-average__options li:hover {\n cursor: pointer;\n}\n\n.mt-rating__list {\n display: flex;\n align-items: center;\n height: 23px;\n transition: opacity .25s ease-in-out;\n}\n\n.mt-rating__list.is-active .mt-rating-total,\n.mt-rating__list:hover .mt-rating-total {\n visibility: visible;\n}\n\n.mt-rating__list:hover {\n opacity: 0.9;\n}\n\n.mt-rating-meter {\n overflow: hidden;\n box-shadow: inset 0 0 0 1px #e3e6e6;\n background-color: #e3e6e6;\n height: 10px;\n width: 100%;\n border-radius: 50px;\n display: flex;\n}\n\n.mt-average__options {\n margin: 0;\n list-style: none;\n padding: 0;\n max-width: 800px;\n width: 100%;\n}\n\n.mt-rating-star {\n display: flex;\n width: 30px;\n justify-content: space-around;\n font-size: 12px;\n color: #757373;\n align-items: center;\n margin-left: 5px;\n}\n\n.mt-rating-total {\n visibility: hidden;\n width: 50px;\n font-size: 12px;\n color: #757373;\n margin-left: 2px;\n display: flex;\n gap: 3px;\n}\n</style>\n","import mod from \"-!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Score.vue?vue&type=script&lang=js\"","import { numberToText } from './textToNumber'\n\n// calcula a % usando a média de avaliacoes / total de avaliacoes do produto\nexport function getWidth(reviews, rating) {\n if (reviews.total === 0) return '0%'\n\n return `${(\n (100 * reviews.average[numberToText(rating)]) /\n reviews.total\n ).toFixed()}%`\n}\n","import { render, staticRenderFns } from \"./Score.vue?vue&type=template&id=ced6d2fe\"\nimport script from \"./Score.vue?vue&type=script&lang=js\"\nexport * from \"./Score.vue?vue&type=script&lang=js\"\nimport style0 from \"./Score.vue?vue&type=style&index=0&id=ced6d2fe&prod&lang=css\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{ref:\"options\",staticClass:\"mt-average__options\"},_vm._l((_vm.maxReviews),function(index){return _c('li',{key:index,staticClass:\"mt-rating__list\",on:{\"click\":function($event){(_vm.reviews.total === 0 ? null : _vm.setRating($event, index))}}},[_c('div',{staticClass:\"mt-rating-star\"},[_c('span',[_vm._v(_vm._s(index))]),_c('svg',{staticStyle:{\"color\":\"#E6E3E3\"},attrs:{\"xmlns\":\"http://www.w3.org/2000/svg\",\"width\":\"14\",\"height\":\"14\",\"viewBox\":\"0 0 24 24\",\"stroke-width\":\"2\",\"stroke\":\"#E6E3E3\",\"fill\":\"none\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\"}},[_c('path',{attrs:{\"stroke\":\"none\",\"d\":\"M0 0h24v24H0z\",\"fill\":\"none\"}}),_c('path',{attrs:{\"d\":\"M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z\",\"stroke-width\":\"0\",\"fill\":\"currentColor\"}})])]),_c('div',{staticClass:\"mt-rating-meter\"},[_c('div',{staticClass:\"mt-rating-bar\",style:({\n width: _vm.getWidth(_vm.reviews, index),\n 'background-color': _vm.starColor || 'red',\n })})]),_c('div',{staticClass:\"mt-rating-total\"},[_c('span',[_vm._v(_vm._s(_vm.reviews.average[_vm.numberToText(index)]))]),_c('span',[_vm._v(\"(\"+_vm._s(_vm.getWidth(_vm.reviews, index))+\")\")]),_c('span',{staticClass:\"mt-rating-remove\"},[_c('svg',{staticClass:\"icon icon-tabler icon-tabler-x\",attrs:{\"xmlns\":\"http://www.w3.org/2000/svg\",\"width\":\"15\",\"height\":\"15\",\"viewBox\":\"0 0 24 24\",\"stroke-width\":\"2\",\"stroke\":\"currentColor\",\"fill\":\"none\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\"}},[_c('path',{attrs:{\"stroke\":\"none\",\"d\":\"M0 0h24v24H0z\",\"fill\":\"none\"}}),_c('path',{attrs:{\"d\":\"M18 6l-12 12\"}}),_c('path',{attrs:{\"d\":\"M6 6l12 12\"}})])])])])}),0)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }"],"sourceRoot":""}
|