1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 15:07:44 +00:00
Files
matomo/plugins/Dashboard/vue/dist/Dashboard.umd.min.js
Shelby Ludlow d9103ac8e9 Edit dashboard button icons + tooltips (#23274)
* Add Tooltips directives to buttons and change icons

* add dashboard-customize icon and update dashboard icon

* Build woff2 file

* Update TagManager ContainerSelector tooltips, moving tooltips for DashboardSettings, revert icon.

* updates expected UI test files

* Built Vue files

* updates expected UI test files

* Build vue files

---------

Co-authored-by: spludlow <spludlow@users.noreply.github.com>
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: caddoo <1169490+caddoo@users.noreply.github.com>
Co-authored-by: innocraft-automation <innocraft-automation@users.noreply.github.com>
2025-06-03 13:02:37 +02:00

20 خطوط
9.3 KiB
JavaScript
Generated

(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue")):"function"===typeof define&&define.amd?define(["CoreHome"],t):"object"===typeof exports?exports["Dashboard"]=t(require("CoreHome"),require("vue")):e["Dashboard"]=t(e["CoreHome"],e["Vue"])})("undefined"!==typeof self?self:this,(function(e,t){return function(e){var t={};function o(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,a){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(a,r,function(t){return e[t]}.bind(null,r));return a},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="plugins/Dashboard/vue/dist/",o(o.s="fae3")}({"19dc":function(t,o){t.exports=e},"8bbf":function(e,o){e.exports=t},fae3:function(e,t,o){"use strict";if(o.r(t),o.d(t,"DashboardStore",(function(){return l})),o.d(t,"Dashboard",(function(){return D})),o.d(t,"DashboardSettings",(function(){return P})),"undefined"!==typeof window){var a=window.document.currentScript,r=a&&a.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(o.p=r[1])}var s=o("8bbf"),n=o("19dc");function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/class d{constructor(){i(this,"privateState",Object(s["reactive"])({dashboards:[]})),i(this,"state",Object(s["computed"])(()=>Object(s["readonly"])(this.privateState))),i(this,"dashboards",Object(s["computed"])(()=>this.state.value.dashboards)),i(this,"dashboardsPromise",null)}getDashboard(e){return this.getAllDashboards().then(t=>t.find(t=>parseInt(""+t.id,10)===parseInt(""+e,10)))}getDashboardLayout(e){return n["AjaxHelper"].fetch({module:"Dashboard",action:"getDashboardLayout",idDashboard:e},{withTokenInUrl:!0})}reloadAllDashboards(){return this.dashboardsPromise=null,this.getAllDashboards()}getAllDashboards(){return this.dashboardsPromise||(this.dashboardsPromise=n["AjaxHelper"].fetch({method:"Dashboard.getDashboards",filter_limit:"-1"}).then(e=>(e&&(this.privateState.dashboards=e),this.dashboards.value))),this.dashboardsPromise}}var l=new d;
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/const{$:c}=window;function b(e,t,o){const a=c(".dashboardSettings");a.show(),window.initTopControls(),c("#topBars").length||(a.after(c("#Dashboard")),c("#Dashboard ul li").removeClass("active"),c("#Dashboard_embeddedIndex_"+e).addClass("active")),window.widgetsHelper.getAvailableWidgets(),c("#dashboardWidgetsArea").off("dashboardempty",window.showEmptyDashboardNotification).on("dashboardempty",window.showEmptyDashboardNotification).dashboard({idDashboard:e,layout:o,name:t?t.name:""});const r=c("#columnPreview").find(">div");r.each((function(){const e=[];c("div",this).each((function(){e.push(this.className.replace(/width-/,""))})),c(this).attr("layout",e.join("-"))})),r.off("click.renderDashboard"),r.on("click.renderDashboard",(function(){r.removeClass("choosen"),c(this).addClass("choosen")}))}function u(e){return new Promise(e=>setTimeout(e)).then(()=>Promise.resolve(window.widgetsHelper.firstGetAvailableWidgetsCall)).then(()=>{const t=c("#dashboardWidgetsArea");return t.dashboard("destroyWidgets"),t.empty(),Promise.all([l.getDashboard(e),l.getDashboardLayout(e)])}).then(([t,o])=>new Promise(a=>{c(()=>{b(e,t,o),a()})}))}function h(){c(".top_controls .dashboard-manager").hide(),c("#dashboardWidgetsArea").dashboard("destroy")}function m(e){"Widgetize"!==e.module&&"Dashboard_Dashboard"!==e.category&&h()}function p(e){u(e)}var D={mounted(e,t){u(t.value.idDashboard),Object(s["watch"])(()=>n["MatomoUrl"].parsed.value,e=>{m(e)}),n["Matomo"].on("Dashboard.loadDashboard",p)},unmounted(){m(n["MatomoUrl"].parsed.value),n["Matomo"].off("Dashboard.loadDashboard",p)}};const f=["title"],g=Object(s["createElementVNode"])("span",{class:"icon icon-dashboard-customize"},null,-1),v={class:"dropdown positionInViewport"},O={class:"submenu"},j={class:"addWidget"},w=Object(s["createElementVNode"])("ul",{class:"widgetpreview-categorylist"},null,-1),y={class:"manageDashboard"},A=["onClick","disabled","title","data-action"],S=["onClick","disabled","title","data-action"],k=Object(s["createElementVNode"])("ul",{class:"widgetpreview-widgetlist"},null,-1),C=Object(s["createElementVNode"])("div",{class:"widgetpreview-preview"},null,-1);function _(e,t,o,a,r,n){const i=Object(s["resolveDirective"])("tooltips"),d=Object(s["resolveDirective"])("expand-on-click");return Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{ref:"root",class:"dashboard-manager piwikSelector borderedControl piwikTopControl dashboardSettings",onClick:t[0]||(t[0]=t=>e.onOpen())},[Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("a",{class:"title",title:e.translate("Dashboard_ManageDashboard"),tabindex:"4",ref:"expander"},[g,Object(s["createTextVNode"])(Object(s["toDisplayString"])(e.translate("Dashboard_Dashboard")),1)],8,f)),[[i]]),Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("div",v,[Object(s["createElementVNode"])("ul",O,[Object(s["createElementVNode"])("li",null,[Object(s["createElementVNode"])("div",j,Object(s["toDisplayString"])(e.translate("Dashboard_AddAWidget")),1),w]),Object(s["createElementVNode"])("li",null,[Object(s["createElementVNode"])("div",y,Object(s["toDisplayString"])(e.translate("Dashboard_ManageDashboard")),1),Object(s["createElementVNode"])("ul",null,[(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.dashboardActions,(t,o)=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("li",{key:o,onClick:t=>e.onClickAction(t,o),disabled:e.isActionDisabled[o]?"disabled":void 0,title:e.actionTooltips[o]||void 0,"data-action":o},Object(s["toDisplayString"])(e.translate(t)),9,A))),128))])]),(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.generalActions,(t,o)=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("li",{key:o,onClick:t=>e.onClickAction(t,o),class:"generalAction",disabled:e.isActionDisabled[o]?"disabled":void 0,title:e.actionTooltips[o]||void 0,"data-action":o},Object(s["toDisplayString"])(e.translate(t)),9,S))),128))]),k,C])),[[i,{show:!1}]])])),[[d,{expander:"expander",onClosed:e.onClose}]])}const{$:E}=window;function N(e){return!E("#dashboardWidgetsArea").find(`[widgetId="${e}"]`).length}function x(e){window.MATOMO_DASHBOARD_SETTINGS_WIDGET_SELECTED_NOOP||E("#dashboardWidgetsArea").dashboard("addWidget",e.uniqueId,1,e.parameters,!0,!1)}var T=Object(s["defineComponent"])({directives:{ExpandOnClick:n["ExpandOnClick"],Tooltips:n["Tooltips"]},data(){return{isActionDisabled:{},actionTooltips:{}}},setup(){const e=Object(s["ref"])(null),t=Object(s["ref"])(null),o=()=>{e.value.widgetPreview({isWidgetAvailable:N,onSelect:e=>{window.widgetsHelper.getWidgetObjectFromUniqueId(e,e=>{t.value.click(),x(e)})},resetOnSelect:!0})};return Object(s["onMounted"])(()=>{n["Matomo"].postEvent("Dashboard.DashboardSettings.mounted",t.value),e.value=E(t.value),o(),n["Matomo"].on("WidgetsStore.reloaded",()=>{o()}),e.value.hide()}),{root:t,rootJQuery:e}},computed:{isUserNotAnonymous(){return!!n["Matomo"].userLogin&&"anonymous"!==n["Matomo"].userLogin},isSuperUser(){return this.isUserNotAnonymous&&n["Matomo"].hasSuperUserAccess},isUserHasSomeAdminAccess(){return this.isUserNotAnonymous&&n["Matomo"].userHasSomeAdminAccess},dashboardActions(){const e={resetDashboard:"Dashboard_ResetDashboard",showChangeDashboardLayoutDialog:"Dashboard_ChangeDashboardLayout"};return this.isUserNotAnonymous&&(e.renameDashboard="Dashboard_RenameDashboard",e.removeDashboard="Dashboard_RemoveDashboard"),this.isSuperUser&&(e.setAsDefaultWidgets="Dashboard_SetAsDefaultWidgets"),this.isUserHasSomeAdminAccess&&(e.copyDashboardToUser="Dashboard_CopyDashboardToUser"),e},generalActions(){const e={};return this.isUserNotAnonymous&&(e.createDashboard="Dashboard_CreateNewDashboard"),e}},methods:{onClickAction(e,t){e.target.getAttribute("disabled")||window[t]()},onOpen(){E("#dashboardWidgetsArea").dashboard("isDefaultDashboard")?(this.isActionDisabled.removeDashboard=!0,this.actionTooltips.removeDashboard=Object(n["translate"])("Dashboard_RemoveDefaultDashboardNotPossible")):(this.isActionDisabled.removeDashboard=!1,this.actionTooltips.removeDashboard=void 0)},onClose(){this.rootJQuery.widgetPreview("reset")}}});T.render=_;var P=T;
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/}})}));
//# sourceMappingURL=Dashboard.umd.min.js.map