From 2b2dd1840fe53c60ad1abb0a5f43b2bc21eb3a44 Mon Sep 17 00:00:00 2001 From: dizzy Date: Fri, 29 Oct 2021 20:03:36 -0700 Subject: [Vue] make sure transcluded content is processed before query selectors in EnrichedHeadline (#18242) * make sure transcluded content is processed before query selectors in EnrichedHeadline * do not add map files in buildvue workflow * built vue files Co-authored-by: sgiehl --- plugins/CoreHome/vue/dist/CoreHome.umd.js | 70 +++++++++++----------- plugins/CoreHome/vue/dist/CoreHome.umd.min.js | 2 +- .../vue/src/EnrichedHeadline/EnrichedHeadline.vue | 63 +++++++++---------- 3 files changed, 70 insertions(+), 65 deletions(-) (limited to 'plugins/CoreHome') diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.js b/plugins/CoreHome/vue/dist/CoreHome.umd.js index 95f346e11f..ec2df57dbb 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.js @@ -1881,9 +1881,9 @@ function createAngularJsAdapter(options) { }, noScope: true })); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue?vue&type=template&id=678de864 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue?vue&type=template&id=b71c9b1c -const EnrichedHeadlinevue_type_template_id_678de864_hoisted_1 = { +const EnrichedHeadlinevue_type_template_id_b71c9b1c_hoisted_1 = { key: 0, class: "title", tabindex: "6" @@ -1914,7 +1914,7 @@ const _hoisted_11 = { }; const _hoisted_12 = ["innerHTML"]; const _hoisted_13 = ["href"]; -function EnrichedHeadlinevue_type_template_id_678de864_render(_ctx, _cache, $props, $setup, $data, $options) { +function EnrichedHeadlinevue_type_template_id_b71c9b1c_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_RateFeature = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("RateFeature"); return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { @@ -1922,7 +1922,7 @@ function EnrichedHeadlinevue_type_template_id_678de864_render(_ctx, _cache, $pro onMouseenter: _cache[1] || (_cache[1] = $event => _ctx.showIcons = true), onMouseleave: _cache[2] || (_cache[2] = $event => _ctx.showIcons = false), ref: "root" - }, [!_ctx.editUrl ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EnrichedHeadlinevue_type_template_id_678de864_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderSlot"])(_ctx.$slots, "default")])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.editUrl ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("a", { + }, [!_ctx.editUrl ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", EnrichedHeadlinevue_type_template_id_b71c9b1c_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderSlot"])(_ctx.$slots, "default")])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.editUrl ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("a", { key: 1, class: "title", href: _ctx.editUrl, @@ -1953,7 +1953,7 @@ function EnrichedHeadlinevue_type_template_id_678de864_render(_ctx, _cache, $pro href: _ctx.helpUrl }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_MoreDetails')), 9, _hoisted_13)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showInlineHelp]])], 544); } -// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue?vue&type=template&id=678de864 +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue?vue&type=template&id=b71c9b1c // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/@vue/cli-plugin-typescript/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-3!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue?vue&type=script&lang=ts @@ -2049,42 +2049,44 @@ const RateFeature = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["define mounted() { const { root - } = this.$refs; + } = this.$refs; // timeout used since angularjs does not fill out the transclude at this point - if (!this.actualInlineHelp) { - let helpNode = root.querySelector('.title .inlineHelp'); + setTimeout(() => { + if (!this.actualInlineHelp) { + let helpNode = root.querySelector('.title .inlineHelp'); - if (!helpNode && root.parentElement.nextElementSibling) { - // hack for reports :( - helpNode = root.parentElement.nextElementSibling.querySelector('.reportDocumentation'); - } + if (!helpNode && root.parentElement.nextElementSibling) { + // hack for reports :( + helpNode = root.parentElement.nextElementSibling.querySelector('.reportDocumentation'); + } - if (helpNode) { - // hackish solution to get binded html of p tag within the help node - // at this point the ng-bind-html is not yet converted into html when report is not - // initially loaded. Using $compile doesn't work. So get and set it manually - const helpDocs = helpNode.getAttribute('data-content').trim(); + if (helpNode) { + // hackish solution to get binded html of p tag within the help node + // at this point the ng-bind-html is not yet converted into html when report is not + // initially loaded. Using $compile doesn't work. So get and set it manually + const helpDocs = helpNode.getAttribute('data-content').trim(); - if (helpDocs.length) { - this.actualInlineHelp = `

${helpDocs}

`; - setTimeout(() => helpNode.remove(), 0); + if (helpDocs.length) { + this.actualInlineHelp = `

${helpDocs}

`; + setTimeout(() => helpNode.remove(), 0); + } } } - } - if (!this.actualFeatureName) { - this.actualFeatureName = root.querySelector('.title').textContent; - } + if (!this.actualFeatureName) { + this.actualFeatureName = root.querySelector('.title').textContent; + } - if (this.reportGenerated && Periods_Periods.parse(Matomo_Matomo.period, Matomo_Matomo.currentDateString).containsToday()) { - window.$(root.querySelector('.report-generated')).tooltip({ - track: true, - content: this.reportGenerated, - items: 'div', - show: false, - hide: false - }); - } + if (this.reportGenerated && Periods_Periods.parse(Matomo_Matomo.period, Matomo_Matomo.currentDateString).containsToday()) { + window.$(root.querySelector('.report-generated')).tooltip({ + track: true, + content: this.reportGenerated, + items: 'div', + show: false, + hide: false + }); + } + }); } })); @@ -2094,7 +2096,7 @@ const RateFeature = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["define -EnrichedHeadlinevue_type_script_lang_ts.render = EnrichedHeadlinevue_type_template_id_678de864_render +EnrichedHeadlinevue_type_script_lang_ts.render = EnrichedHeadlinevue_type_template_id_b71c9b1c_render /* harmony default export */ var EnrichedHeadline = (EnrichedHeadlinevue_type_script_lang_ts); // CONCATENATED MODULE: ./plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.adapter.ts diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js index 80c2b28caf..a16b928e70 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js @@ -128,7 +128,7 @@ let L;q.$inject=[],angular.module("piwikApp.service").service("piwikUrl",q);cons * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ie({component:re,scope:{show:{vue:"modelValue",default:!1},element:{default:(e,t)=>t[0]}},events:{yes:(e,t,n,r)=>{r.yes&&(t.$eval(r.yes),setTimeout(()=>{t.$apply()},0))},no:(e,t,n,r)=>{r.no&&(t.$eval(r.no),setTimeout(()=>{t.$apply()},0))},close:(e,t,n,r)=>{r.close&&(t.$eval(r.close),setTimeout(()=>{t.$apply()},0))},"update:modelValue":(e,t,n,r,a)=>{setTimeout(()=>{t.$apply(a(r.piwikDialog).assign(t,e))},0)}},$inject:["$parse"],directiveName:"piwikDialog",transclude:!0,mountPointFactory:(e,t)=>{const n=$('
');return n.appendTo(t),n[0]},postCreate:(e,t,n,r)=>{t.$watch(r.piwikDialog,(t,n)=>{n!==t&&(e.modelValue=t||!1)})},noScope:!0});const oe={key:0,class:"title",tabindex:"6"},se=["href","title"],le={class:"iconsBar"},ce=["href","title"],ue=Object(Z["createElementVNode"])("span",{class:"icon-help"},null,-1),de=[ue],pe=["title"],he=Object(Z["createElementVNode"])("span",{class:"icon-info"},null,-1),me=[he],ge={class:"ratingIcons"},fe={class:"inlineHelp"},be=["innerHTML"],we=["href"];function ye(e,t,n,r,a,i){const o=Object(Z["resolveComponent"])("RateFeature");return Object(Z["openBlock"])(),Object(Z["createElementBlock"])("div",{class:"enrichedHeadline",onMouseenter:t[1]||(t[1]=t=>e.showIcons=!0),onMouseleave:t[2]||(t[2]=t=>e.showIcons=!1),ref:"root"},[e.editUrl?Object(Z["createCommentVNode"])("",!0):(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("div",oe,[Object(Z["renderSlot"])(e.$slots,"default")])),e.editUrl?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:1,class:"title",href:e.editUrl,title:e.translate("CoreHome_ClickToEditX",e.$sanitize(e.actualFeatureName))},[Object(Z["renderSlot"])(e.$slots,"default")],8,se)):Object(Z["createCommentVNode"])("",!0),Object(Z["withDirectives"])(Object(Z["createElementVNode"])("span",le,[e.helpUrl&&!e.actualInlineHelp?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"helpIcon",href:e.helpUrl,title:e.translate("CoreHome_ExternalHelp")},de,8,ce)):Object(Z["createCommentVNode"])("",!0),e.actualInlineHelp?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:1,onClick:t[0]||(t[0]=t=>e.showInlineHelp=!e.showInlineHelp),class:Object(Z["normalizeClass"])(["helpIcon",{active:e.showInlineHelp}]),title:e.translate(e.reportGenerated?"General_HelpReport":"General_Help")},me,10,pe)):Object(Z["createCommentVNode"])("",!0),Object(Z["createElementVNode"])("div",ge,[Object(Z["createVNode"])(o,{title:e.actualFeatureName},null,8,["title"])])],512),[[Z["vShow"],e.showIcons||e.showInlineHelp]]),Object(Z["withDirectives"])(Object(Z["createElementVNode"])("div",fe,[Object(Z["createElementVNode"])("div",{innerHTML:e.$sanitize(e.actualInlineHelp)},null,8,be),e.helpUrl?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"readMore",href:e.helpUrl},Object(Z["toDisplayString"])(e.translate("General_MoreDetails")),9,we)):Object(Z["createCommentVNode"])("",!0)],512),[[Z["vShow"],e.showInlineHelp]])],544)}const De=Object(Z["defineAsyncComponent"])(()=>new Promise(e=>{window.$(document).ready(()=>{e(window.Feedback.RateFeature)})}));var Pe=Object(Z["defineComponent"])({props:{helpUrl:{type:String,default:""},editUrl:{type:String,default:""},reportGenerated:String,featureName:String,inlineHelp:String},components:{RateFeature:De},data(){return{showIcons:!1,showInlineHelp:!1,actualFeatureName:this.featureName,actualInlineHelp:this.inlineHelp}},setup(){const e=Object(Z["ref"])(null);return{root:e}},watch:{inlineHelp(e){this.actualInlineHelp=e},featureName(e){this.actualFeatureName=e}},mounted(){const{root:e}=this.$refs;if(!this.actualInlineHelp){let t=e.querySelector(".title .inlineHelp");if(!t&&e.parentElement.nextElementSibling&&(t=e.parentElement.nextElementSibling.querySelector(".reportDocumentation")),t){const e=t.getAttribute("data-content").trim();e.length&&(this.actualInlineHelp=`

${e}

`,setTimeout(()=>t.remove(),0))}}this.actualFeatureName||(this.actualFeatureName=e.querySelector(".title").textContent),this.reportGenerated&&u.parse(P.period,P.currentDateString).containsToday()&&window.$(e.querySelector(".report-generated")).tooltip({track:!0,content:this.reportGenerated,items:"div",show:!1,hide:!1})}});Pe.render=ye;var ve=Pe; + */ie({component:re,scope:{show:{vue:"modelValue",default:!1},element:{default:(e,t)=>t[0]}},events:{yes:(e,t,n,r)=>{r.yes&&(t.$eval(r.yes),setTimeout(()=>{t.$apply()},0))},no:(e,t,n,r)=>{r.no&&(t.$eval(r.no),setTimeout(()=>{t.$apply()},0))},close:(e,t,n,r)=>{r.close&&(t.$eval(r.close),setTimeout(()=>{t.$apply()},0))},"update:modelValue":(e,t,n,r,a)=>{setTimeout(()=>{t.$apply(a(r.piwikDialog).assign(t,e))},0)}},$inject:["$parse"],directiveName:"piwikDialog",transclude:!0,mountPointFactory:(e,t)=>{const n=$('
');return n.appendTo(t),n[0]},postCreate:(e,t,n,r)=>{t.$watch(r.piwikDialog,(t,n)=>{n!==t&&(e.modelValue=t||!1)})},noScope:!0});const oe={key:0,class:"title",tabindex:"6"},se=["href","title"],le={class:"iconsBar"},ce=["href","title"],ue=Object(Z["createElementVNode"])("span",{class:"icon-help"},null,-1),de=[ue],pe=["title"],he=Object(Z["createElementVNode"])("span",{class:"icon-info"},null,-1),me=[he],ge={class:"ratingIcons"},fe={class:"inlineHelp"},be=["innerHTML"],we=["href"];function ye(e,t,n,r,a,i){const o=Object(Z["resolveComponent"])("RateFeature");return Object(Z["openBlock"])(),Object(Z["createElementBlock"])("div",{class:"enrichedHeadline",onMouseenter:t[1]||(t[1]=t=>e.showIcons=!0),onMouseleave:t[2]||(t[2]=t=>e.showIcons=!1),ref:"root"},[e.editUrl?Object(Z["createCommentVNode"])("",!0):(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("div",oe,[Object(Z["renderSlot"])(e.$slots,"default")])),e.editUrl?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:1,class:"title",href:e.editUrl,title:e.translate("CoreHome_ClickToEditX",e.$sanitize(e.actualFeatureName))},[Object(Z["renderSlot"])(e.$slots,"default")],8,se)):Object(Z["createCommentVNode"])("",!0),Object(Z["withDirectives"])(Object(Z["createElementVNode"])("span",le,[e.helpUrl&&!e.actualInlineHelp?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"helpIcon",href:e.helpUrl,title:e.translate("CoreHome_ExternalHelp")},de,8,ce)):Object(Z["createCommentVNode"])("",!0),e.actualInlineHelp?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:1,onClick:t[0]||(t[0]=t=>e.showInlineHelp=!e.showInlineHelp),class:Object(Z["normalizeClass"])(["helpIcon",{active:e.showInlineHelp}]),title:e.translate(e.reportGenerated?"General_HelpReport":"General_Help")},me,10,pe)):Object(Z["createCommentVNode"])("",!0),Object(Z["createElementVNode"])("div",ge,[Object(Z["createVNode"])(o,{title:e.actualFeatureName},null,8,["title"])])],512),[[Z["vShow"],e.showIcons||e.showInlineHelp]]),Object(Z["withDirectives"])(Object(Z["createElementVNode"])("div",fe,[Object(Z["createElementVNode"])("div",{innerHTML:e.$sanitize(e.actualInlineHelp)},null,8,be),e.helpUrl?(Object(Z["openBlock"])(),Object(Z["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"readMore",href:e.helpUrl},Object(Z["toDisplayString"])(e.translate("General_MoreDetails")),9,we)):Object(Z["createCommentVNode"])("",!0)],512),[[Z["vShow"],e.showInlineHelp]])],544)}const De=Object(Z["defineAsyncComponent"])(()=>new Promise(e=>{window.$(document).ready(()=>{e(window.Feedback.RateFeature)})}));var Pe=Object(Z["defineComponent"])({props:{helpUrl:{type:String,default:""},editUrl:{type:String,default:""},reportGenerated:String,featureName:String,inlineHelp:String},components:{RateFeature:De},data(){return{showIcons:!1,showInlineHelp:!1,actualFeatureName:this.featureName,actualInlineHelp:this.inlineHelp}},setup(){const e=Object(Z["ref"])(null);return{root:e}},watch:{inlineHelp(e){this.actualInlineHelp=e},featureName(e){this.actualFeatureName=e}},mounted(){const{root:e}=this.$refs;setTimeout(()=>{if(!this.actualInlineHelp){let t=e.querySelector(".title .inlineHelp");if(!t&&e.parentElement.nextElementSibling&&(t=e.parentElement.nextElementSibling.querySelector(".reportDocumentation")),t){const e=t.getAttribute("data-content").trim();e.length&&(this.actualInlineHelp=`

${e}

`,setTimeout(()=>t.remove(),0))}}this.actualFeatureName||(this.actualFeatureName=e.querySelector(".title").textContent),this.reportGenerated&&u.parse(P.period,P.currentDateString).containsToday()&&window.$(e.querySelector(".report-generated")).tooltip({track:!0,content:this.reportGenerated,items:"div",show:!1,hide:!1})})}});Pe.render=ye;var ve=Pe; /*! * Matomo - free/libre analytics platform * diff --git a/plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue b/plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue index f9452ac24f..4adb7a43d3 100644 --- a/plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue +++ b/plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.vue @@ -161,41 +161,44 @@ export default defineComponent({ mounted() { const { root } = this.$refs; - if (!this.actualInlineHelp) { - let helpNode = root.querySelector('.title .inlineHelp'); - if (!helpNode && root.parentElement.nextElementSibling) { - // hack for reports :( - helpNode = (root.parentElement.nextElementSibling as HTMLElement) - .querySelector('.reportDocumentation'); - } + // timeout used since angularjs does not fill out the transclude at this point + setTimeout(() => { + if (!this.actualInlineHelp) { + let helpNode = root.querySelector('.title .inlineHelp'); + if (!helpNode && root.parentElement.nextElementSibling) { + // hack for reports :( + helpNode = (root.parentElement.nextElementSibling as HTMLElement) + .querySelector('.reportDocumentation'); + } - if (helpNode) { - // hackish solution to get binded html of p tag within the help node - // at this point the ng-bind-html is not yet converted into html when report is not - // initially loaded. Using $compile doesn't work. So get and set it manually - const helpDocs = helpNode.getAttribute('data-content').trim(); - if (helpDocs.length) { - this.actualInlineHelp = `

${helpDocs}

`; - setTimeout(() => helpNode.remove(), 0); + if (helpNode) { + // hackish solution to get binded html of p tag within the help node + // at this point the ng-bind-html is not yet converted into html when report is not + // initially loaded. Using $compile doesn't work. So get and set it manually + const helpDocs = helpNode.getAttribute('data-content').trim(); + if (helpDocs.length) { + this.actualInlineHelp = `

${helpDocs}

`; + setTimeout(() => helpNode.remove(), 0); + } } } - } - if (!this.actualFeatureName) { - this.actualFeatureName = root.querySelector('.title').textContent; - } + if (!this.actualFeatureName) { + this.actualFeatureName = root.querySelector('.title').textContent; + } - if (this.reportGenerated - && Periods.parse(Matomo.period, Matomo.currentDateString).containsToday() - ) { - window.$(root.querySelector('.report-generated')).tooltip({ - track: true, - content: this.reportGenerated, - items: 'div', - show: false, - hide: false, - }); - } + if (this.reportGenerated + && Periods.parse(Matomo.period, Matomo.currentDateString).containsToday() + ) { + window.$(root.querySelector('.report-generated')).tooltip({ + track: true, + content: this.reportGenerated, + items: 'div', + show: false, + hide: false, + }); + } + }); }, }); -- cgit v1.2.3