Commit ff316096 authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Anja Leichsenring
Browse files

[TASK] Streamline usage of contrib packages in TypeScript

No need to use a fully qualified namespace for
3rd party modules that are placed in TYPO3/CMS/Core/Contrib.
There are usually aliases configured in the requirejs configuration,
and if they are missing, we add them now.

This change additionally drops an unneded module declaration
for "TYPO3/CMS/Core/Contrib/imagesloaded.pkgd.min" which is
not needed when simply using "imagesloaded" as module name.

Commands used:

  grunt build

Releases: master, 10.4
Resolves: #92725
Change-Id: I6e7c02104050202d5c1a8bd0d7546a1496f5636c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65693


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 9cddf73b
......@@ -12,7 +12,7 @@
*/
import $ from 'jquery';
import 'TYPO3/CMS/Core/Contrib/jquery.minicolors';
import 'jquery/minicolors';
/**
* Module: TYPO3/CMS/Backend/ColorPicker
......
......@@ -12,7 +12,7 @@
*/
import $ from 'jquery';
import 'TYPO3/CMS/Core/Contrib/jquery.autocomplete';
import 'jquery/autocomplete';
import FormEngine = require('TYPO3/CMS/Backend/FormEngine');
// data structure returned by SuggestWizardDefaultReceiver::queryTable()
......
......@@ -18,7 +18,7 @@ import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse';
import FormEngineValidation = require('TYPO3/CMS/Backend/FormEngineValidation');
import AjaxRequest = require('TYPO3/CMS/Core/Ajax/AjaxRequest');
import Cropper from 'cropperjs';
import ImagesLoaded = require('TYPO3/CMS/Core/Contrib/imagesloaded.pkgd.min');
import ImagesLoaded = require('imagesloaded');
import Icons = require('./Icons');
import Modal = require('./Modal');
import ThrottleEvent from 'TYPO3/CMS/Core/Event/ThrottleEvent';
......
......@@ -127,11 +127,6 @@ interface Window {
/**
* Needed type declarations for provided libs
*/
declare module 'TYPO3/CMS/Core/Contrib/imagesloaded.pkgd.min' {
import imagesloaded from 'imagesloaded';
export = imagesloaded;
}
declare module 'muuri';
declare module 'cm/lib/codemirror';
declare module 'flatpickr/flatpickr.min';
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery","TYPO3/CMS/Core/Contrib/jquery.minicolors"],(function(t,e,r){"use strict";r=__importDefault(r);return new class{constructor(){this.selector=".t3js-color-picker"}initialize(){r.default(this.selector).minicolors({format:"hex",position:"bottom left",theme:"bootstrap"}),r.default(document).on("change",".t3js-colorpicker-value-trigger",t=>{const e=r.default(t.target);""!==e.val()&&(e.closest(".t3js-formengine-field-item").find(".t3js-color-picker").val(e.val()).trigger("paste"),e.val(""))}),r.default(document).on("blur",".t3js-color-picker",t=>{const e=r.default(t.target);e.closest(".t3js-formengine-field-item").find('input[type="hidden"]').val(e.val()),""===e.val()&&e.trigger("paste")})}}}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery","jquery/minicolors"],(function(t,e,r){"use strict";r=__importDefault(r);return new class{constructor(){this.selector=".t3js-color-picker"}initialize(){r.default(this.selector).minicolors({format:"hex",position:"bottom left",theme:"bootstrap"}),r.default(document).on("change",".t3js-colorpicker-value-trigger",t=>{const e=r.default(t.target);""!==e.val()&&(e.closest(".t3js-formengine-field-item").find(".t3js-color-picker").val(e.val()).trigger("paste"),e.val(""))}),r.default(document).on("blur",".t3js-color-picker",t=>{const e=r.default(t.target);e.closest(".t3js-formengine-field-item").find('input[type="hidden"]').val(e.val()),""===e.val()&&e.trigger("paste")})}}}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine","TYPO3/CMS/Core/Contrib/jquery.autocomplete"],(function(e,t,a,s){"use strict";a=__importDefault(a);return class{constructor(e){a.default(()=>{this.initialize(e)})}initialize(e){const t=e.closest(".t3-form-suggest-container"),i=e.dataset.tablename,o=e.dataset.fieldname,n=e.dataset.field,r=parseInt(e.dataset.uid,10),l=parseInt(e.dataset.pid,10),d=e.dataset.datastructureidentifier,u=e.dataset.flexformsheetname,m=e.dataset.flexformfieldname,c=e.dataset.flexformcontainername,f=e.dataset.flexformcontainerfieldname,p=parseInt(e.dataset.minchars,10),g=TYPO3.settings.ajaxUrls.record_suggest,x={tableName:i,fieldName:o,uid:r,pid:l,dataStructureIdentifier:d,flexFormSheetName:u,flexFormFieldName:m,flexFormContainerName:c,flexFormContainerFieldName:f};a.default(e).autocomplete({serviceUrl:g,params:x,type:"POST",paramName:"value",dataType:"json",minChars:p,groupBy:"typeLabel",containerClass:"autocomplete-results",appendTo:t,forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,noSuggestionNotice:'<div class="autocomplete-info">No results</div>',minLength:p,preventBadQueries:!1,transformResult:e=>({suggestions:e.map(e=>({value:e.text,data:e}))}),formatResult:e=>a.default("<div>").append(a.default('<a class="autocomplete-suggestion-link" href="#">'+e.data.sprite+e.data.text+"</a></div>").attr({"data-label":e.data.label,"data-table":e.data.table,"data-uid":e.data.uid})).html(),onSearchComplete:function(){t.classList.add("open")},beforeRender:function(e){e.attr("style",""),t.classList.add("open")},onHide:function(){t.classList.remove("open")},onSelect:function(){!function(t){let i="";i="select"===e.dataset.fieldtype?t.dataset.uid:t.dataset.table+"_"+t.dataset.uid,s.setSelectOptionFromExternalSource(n,i,t.dataset.label,t.dataset.label),s.Validation.markFieldAsChanged(a.default(document.querySelector('input[name="'+n+'"]')))}(t.querySelector(".autocomplete-selected a"))}})}}}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","TYPO3/CMS/Backend/FormEngine","jquery/autocomplete"],(function(e,t,a,s){"use strict";a=__importDefault(a);return class{constructor(e){a.default(()=>{this.initialize(e)})}initialize(e){const t=e.closest(".t3-form-suggest-container"),i=e.dataset.tablename,n=e.dataset.fieldname,o=e.dataset.field,l=parseInt(e.dataset.uid,10),r=parseInt(e.dataset.pid,10),d=e.dataset.datastructureidentifier,u=e.dataset.flexformsheetname,m=e.dataset.flexformfieldname,c=e.dataset.flexformcontainername,f=e.dataset.flexformcontainerfieldname,p=parseInt(e.dataset.minchars,10),g=TYPO3.settings.ajaxUrls.record_suggest,x={tableName:i,fieldName:n,uid:l,pid:r,dataStructureIdentifier:d,flexFormSheetName:u,flexFormFieldName:m,flexFormContainerName:c,flexFormContainerFieldName:f};a.default(e).autocomplete({serviceUrl:g,params:x,type:"POST",paramName:"value",dataType:"json",minChars:p,groupBy:"typeLabel",containerClass:"autocomplete-results",appendTo:t,forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,noSuggestionNotice:'<div class="autocomplete-info">No results</div>',minLength:p,preventBadQueries:!1,transformResult:e=>({suggestions:e.map(e=>({value:e.text,data:e}))}),formatResult:e=>a.default("<div>").append(a.default('<a class="autocomplete-suggestion-link" href="#">'+e.data.sprite+e.data.text+"</a></div>").attr({"data-label":e.data.label,"data-table":e.data.table,"data-uid":e.data.uid})).html(),onSearchComplete:function(){t.classList.add("open")},beforeRender:function(e){e.attr("style",""),t.classList.add("open")},onHide:function(){t.classList.remove("open")},onSelect:function(){!function(t){let i="";i="select"===e.dataset.fieldtype?t.dataset.uid:t.dataset.table+"_"+t.dataset.uid,s.setSelectOptionFromExternalSource(o,i,t.dataset.label,t.dataset.label),s.Validation.markFieldAsChanged(a.default(document.querySelector('input[name="'+o+'"]')))}(t.querySelector(".autocomplete-selected a"))}})}}}));
\ No newline at end of file
......@@ -1376,6 +1376,7 @@ class PageRenderer implements SingletonInterface
'autosize' => $corePath . 'autosize',
'taboverride' => $corePath . 'taboverride.min',
'jquery/autocomplete' => $corePath . 'jquery.autocomplete',
'jquery/minicolors' => $corePath . 'jquery.minicolors',
'd3' => $corePath . 'd3/d3',
'Sortable' => $corePath . 'Sortable.min',
'tablesort' => $corePath . 'tablesort',
......
......@@ -6,7 +6,7 @@ var require = {
'TYPO3/CMS/Backend': 'sysext/backend/Resources/Public/JavaScript',
'TYPO3/CMS/Install': 'sysext/install/Resources/Public/JavaScript',
'jquery': 'sysext/core/Resources/Public/JavaScript/Contrib/jquery/jquery.min',
'TYPO3/CMS/Core/Contrib/jquery.minicolors': 'sysext/core/Resources/Public/JavaScript/Contrib/jquery.minicolors',
'jquery/minicolors': 'sysext/core/Resources/Public/JavaScript/Contrib/jquery.minicolors',
'bootstrap': 'sysext/core/Resources/Public/JavaScript/Contrib/bootstrap/bootstrap',
'chosen': 'sysext/install/Resources/Public/JavaScript/chosen.jquery.min',
'nprogress': 'sysext/core/Resources/Public/JavaScript/Contrib/nprogress'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment