diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts b/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts index e217fe0b7f45c840eb2bbbf9a1e274df67a75446..fe071d31ebaf779d0ef8c027b277210675c833be 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts +++ b/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts @@ -12,7 +12,7 @@ */ import * as $ from 'jquery'; -let Chart: any = require('TYPO3/CMS/Dashboard/Contrib/chartjs'); +import * as Chart from 'TYPO3/CMS/Dashboard/Contrib/chartjs'; class ChartInitializer { diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/Grid.ts b/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/Grid.ts index 5e982ae391c76d3be810c7485217828ad65191e3..b3cc9865903cb85b34f006bb0496d4452234a90f 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/Grid.ts +++ b/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/Grid.ts @@ -12,7 +12,7 @@ */ import * as $ from 'jquery'; -let Muuri: any = require('muuri'); +import * as Muuri from 'muuri'; import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; import AjaxRequest = require('TYPO3/CMS/Core/Ajax/AjaxRequest'); diff --git a/Build/types/TYPO3/index.d.ts b/Build/types/TYPO3/index.d.ts index 56257778e383792667ab99690c08067c8d8e05c8..5554654e17d0fd66b90e3a92bff4e09bcd3be064 100644 --- a/Build/types/TYPO3/index.d.ts +++ b/Build/types/TYPO3/index.d.ts @@ -145,9 +145,11 @@ declare module 'TYPO3/CMS/Core/Contrib/imagesloaded.pkgd.min' { declare module 'TYPO3/CMS/Recordlist/LinkBrowser'; declare module 'TYPO3/CMS/Backend/LegacyTree'; +declare module 'muuri'; declare module 'cm/lib/codemirror'; declare module 'moment'; declare module 'Sortable'; +declare module 'TYPO3/CMS/Dashboard/Contrib/chartjs'; interface JQueryTypedEvent<T extends Event> extends JQueryEventObject { originalEvent: T; diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js index 28aee839caee5f191365d7e7a8ab5a2a08e7ca7b..a10005664ecd3f70adf716777411ad534d270e32 100644 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -define(["require","exports","jquery"],(function(e,t,n){"use strict";let r=e("TYPO3/CMS/Dashboard/Contrib/chartjs");return new class{constructor(){this.selector=".dashboard-item--chart",n(()=>{this.initialize()})}initialize(){n(document).on("widgetContentRendered",this.selector,(e,t)=>{e.preventDefault();const i=n(e.currentTarget);if("undefined"===t.graphConfig)return;let s,o=i.find("canvas:first");o.length>0&&(s=o[0].getContext("2d")),"undefined"!==s&&new r(s,t.graphConfig)})}}})); \ No newline at end of file +define(["require","exports","jquery","TYPO3/CMS/Dashboard/Contrib/chartjs"],(function(e,t,n,r){"use strict";return new class{constructor(){this.selector=".dashboard-item--chart",n(()=>{this.initialize()})}initialize(){n(document).on("widgetContentRendered",this.selector,(e,t)=>{e.preventDefault();const i=n(e.currentTarget);if("undefined"===t.graphConfig)return;let s,o=i.find("canvas:first");o.length>0&&(s=o[0].getContext("2d")),"undefined"!==s&&new r(s,t.graphConfig)})}}})); \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/Grid.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/Grid.js index a0b0b814c2f16eec452737cc09930071f9474940..3c2df370506dc25f2bb8cd984a687404b512ef1c 100644 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/Grid.js +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/Grid.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -define(["require","exports","jquery","TYPO3/CMS/Core/Ajax/AjaxRequest"],(function(e,t,a,s){"use strict";let r=e("muuri");return new class{constructor(){this.selector=".dashboard-grid",a(()=>{this.initialize()})}initialize(){const e={dragEnabled:!0,dragSortHeuristics:{sortInterval:50,minDragDistance:10,minBounceBackAngle:1},layoutDuration:400,layoutEasing:"ease",dragPlaceholder:{enabled:!0,duration:400,createElement:e=>e.getElement().cloneNode(!0)},dragSortPredicate:{action:"move",threshold:30},dragStartPredicate:{handle:".js-dashboard-move-widget"},dragReleaseDuration:400,dragReleaseEasing:"ease",layout:{fillGaps:!1,rounding:!1}};if(a(this.selector).length){const t=new r(this.selector,e);t.on("dragStart",()=>{a(".dashboard-item").removeClass("dashboard-item--enableSelect")}),t.on("dragReleaseEnd",()=>{a(".dashboard-item").addClass("dashboard-item--enableSelect"),this.saveItems(t)}),a(".dashboard-item").on("widgetContentRendered",()=>{t.refreshItems().layout()})}}saveItems(e){let t=e.getItems().map((function(e){return[e.getElement().getAttribute("data-widget-key"),e.getElement().getAttribute("data-widget-hash")]}));new s(TYPO3.settings.ajaxUrls["ext-dashboard-save-widget-positions"]).post({widgets:t}).then(async e=>{await e.resolve()})}}})); \ No newline at end of file +define(["require","exports","jquery","muuri","TYPO3/CMS/Core/Ajax/AjaxRequest"],(function(e,t,a,s,r){"use strict";return new class{constructor(){this.selector=".dashboard-grid",a(()=>{this.initialize()})}initialize(){const e={dragEnabled:!0,dragSortHeuristics:{sortInterval:50,minDragDistance:10,minBounceBackAngle:1},layoutDuration:400,layoutEasing:"ease",dragPlaceholder:{enabled:!0,duration:400,createElement:e=>e.getElement().cloneNode(!0)},dragSortPredicate:{action:"move",threshold:30},dragStartPredicate:{handle:".js-dashboard-move-widget"},dragReleaseDuration:400,dragReleaseEasing:"ease",layout:{fillGaps:!1,rounding:!1}};if(a(this.selector).length){const t=new s(this.selector,e);t.on("dragStart",()=>{a(".dashboard-item").removeClass("dashboard-item--enableSelect")}),t.on("dragReleaseEnd",()=>{a(".dashboard-item").addClass("dashboard-item--enableSelect"),this.saveItems(t)}),a(".dashboard-item").on("widgetContentRendered",()=>{t.refreshItems().layout()})}}saveItems(e){let t=e.getItems().map((function(e){return[e.getElement().getAttribute("data-widget-key"),e.getElement().getAttribute("data-widget-hash")]}));new r(TYPO3.settings.ajaxUrls["ext-dashboard-save-widget-positions"]).post({widgets:t}).then(async e=>{await e.resolve()})}}})); \ No newline at end of file