Skip to content
Snippets Groups Projects
Commit fe5445bd authored by Frank Naegler's avatar Frank Naegler Committed by Anja Leichsenring
Browse files

[TASK] Migrate TYPO3/CMS/Lowlevel/* to TypeScript

Resolves: #87922
Releases: master
Change-Id: I77f1973c656b3b2538a37cd2f4dc2b04358a7198
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60257


Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 549158d6
Branches
Tags
No related merge requests found
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import * as $ from 'jquery';
import 'TYPO3/CMS/Backend/jquery.clearable';
/**
* Module: TYPO3/CMS/Lowlevel/ConfigurationView
* JavaScript for Configuration View
*/
class ConfigurationView {
private $searchFields: JQuery = $('input[name="searchString"]');
private searchResultShown: boolean = ('' !== this.$searchFields.first().val());
constructor() {
// make search field clearable
this.$searchFields.clearable({
onClear: (): void => {
if (this.searchResultShown) {
$(this.$searchFields).closest('form').submit();
}
},
});
if (self.location.hash) {
// scroll page down, so the just opened subtree is visible after reload and not hidden by doc header
$('html, body').scrollTop((document.documentElement.scrollTop || document.body.scrollTop) - 80);
}
}
}
export = new ConfigurationView();
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import * as $ from 'jquery';
import DateTimePicker = require('TYPO3/CMS/Backend/DateTimePicker');
import 'TYPO3/CMS/Backend/jquery.clearable';
/**
* Module: TYPO3/CMS/Lowlevel/QueryGenerator
* This module handle the QueryGenerator forms.
*/
class QueryGenerator {
private form: JQuery = null;
private limitField: JQuery = null;
constructor() {
this.initialize();
}
/**
* Initialize the QueryGenerator object
*/
private initialize(): void {
this.form = $('form[name="queryform"]');
this.limitField = $('#queryLimit');
this.form.on('click', '.t3js-submit-click', (e: JQueryEventObject): void => {
e.preventDefault();
this.doSubmit();
});
this.form.on('change', '.t3js-submit-change', (e: JQueryEventObject): void => {
e.preventDefault();
this.doSubmit();
});
this.form.on('click', '.t3js-limit-submit input[type="button"]', (e: JQueryEventObject): void => {
e.preventDefault();
this.setLimit($(e.currentTarget).data('value'));
this.doSubmit();
});
this.form.on('click', '.t3js-addfield', (e: JQueryEventObject): void => {
e.preventDefault();
const $field = $(e.currentTarget);
this.addValueToField($field.data('field'), $field.val());
});
this.form.find('.t3js-clearable').clearable({
onClear: (): void => {
this.doSubmit();
},
});
}
/**
* Submit the form
*/
private doSubmit(): void {
this.form.submit();
}
/**
* Set query limit
*
* @param {String} value
*/
private setLimit(value: string): void {
this.limitField.val(value);
}
/**
* Add value to text field
*
* @param {String} field the name of the field
* @param {String} value the value to add
*/
private addValueToField(field: string, value: string): void {
const $target = this.form.find('[name="' + field + '"]');
const currentValue = $target.val();
$target.val(currentValue + ',' + value);
}
}
export = new QueryGenerator();
......@@ -10,28 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Module: TYPO3/CMS/Lowlevel/ConfigurationView
* JavaScript for Configuration View
* @exports TYPO3/CMS/Lowlevel/ConfigurationView
*/
define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
var $searchFields = $('input[name="searchString"]');
var searchResultShown = ('' !== $searchFields.first().val());
// make search field clearable
$searchFields.clearable({
onClear: function() {
if (searchResultShown) {
$(this).closest('form').submit();
}
}
});
if (self.location.hash) {
// scroll page down, so the just opened subtree is visible after reload and not hidden by doc header
$("html, body").scrollTop((document.documentElement.scrollTop || document.body.scrollTop) - 80);
}
});
define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(e,s,r){"use strict";return new function(){var e=this;this.$searchFields=r('input[name="searchString"]'),this.searchResultShown=""!==this.$searchFields.first().val(),this.$searchFields.clearable({onClear:function(){e.searchResultShown&&r(e.$searchFields).closest("form").submit()}}),self.location.hash&&r("html, body").scrollTop((document.documentElement.scrollTop||document.body.scrollTop)-80)}});
\ No newline at end of file
......@@ -10,83 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Module: TYPO3/CMS/Lowlevel/QueryGenerator
* This module handle the QueryGenerator forms.
*/
define(['jquery', 'TYPO3/CMS/Backend/DateTimePicker', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
/**
* The QueryGenerator AMD module
*
* @type {{form: null, limitField: null}}
* @exports TYPO3/CMS/Lowlevel/QueryGenerator
*/
var QueryGenerator = {
form: null,
limitField: null
};
/**
* Initialize the QueryGenerator object
*/
QueryGenerator.initialize = function() {
QueryGenerator.form = $('form[name="queryform"]');
QueryGenerator.limitField = $('#queryLimit');
QueryGenerator.form.on('click', '.t3js-submit-click', function(e) {
e.preventDefault();
QueryGenerator.doSubmit();
});
QueryGenerator.form.on('change', '.t3js-submit-change', function(e) {
e.preventDefault();
QueryGenerator.doSubmit();
});
QueryGenerator.form.on('click', '.t3js-limit-submit button', function(e) {
e.preventDefault();
QueryGenerator.setLimit($(this).data('value'));
QueryGenerator.doSubmit();
});
QueryGenerator.form.on('click', '.t3js-addfield', function(e) {
e.preventDefault();
QueryGenerator.addValueToField($(this).data('field'), $(this).val());
});
QueryGenerator.form.find('.t3js-clearable').clearable({
onClear: function() {
QueryGenerator.doSubmit();
}
});
};
/**
* Submit the form
*/
QueryGenerator.doSubmit = function() {
QueryGenerator.form.submit();
};
/**
* Set query limit
*
* @param {String} value
*/
QueryGenerator.setLimit = function(value) {
QueryGenerator.limitField.val(value);
};
/**
* Add value to text field
*
* @param {String} field the name of the field
* @param {String} value the value to add
*/
QueryGenerator.addValueToField = function(field, value) {
var $target = QueryGenerator.form.find('[name="' + field + '"]');
var currentValue = $target.val();
$target.val(currentValue + ',' + value);
};
// Initialize
QueryGenerator.initialize();
return QueryGenerator;
});
define(["require","exports","jquery","TYPO3/CMS/Backend/jquery.clearable"],function(t,i,e){"use strict";return new(function(){function t(){this.form=null,this.limitField=null,this.initialize()}return t.prototype.initialize=function(){var t=this;this.form=e('form[name="queryform"]'),this.limitField=e("#queryLimit"),this.form.on("click",".t3js-submit-click",function(i){i.preventDefault(),t.doSubmit()}),this.form.on("change",".t3js-submit-change",function(i){i.preventDefault(),t.doSubmit()}),this.form.on("click",'.t3js-limit-submit input[type="button"]',function(i){i.preventDefault(),t.setLimit(e(i.currentTarget).data("value")),t.doSubmit()}),this.form.on("click",".t3js-addfield",function(i){i.preventDefault();var n=e(i.currentTarget);t.addValueToField(n.data("field"),n.val())}),this.form.find(".t3js-clearable").clearable({onClear:function(){t.doSubmit()}})},t.prototype.doSubmit=function(){this.form.submit()},t.prototype.setLimit=function(t){this.limitField.val(t)},t.prototype.addValueToField=function(t,i){var e=this.form.find('[name="'+t+'"]'),n=e.val();e.val(n+","+i)},t}())});
\ No newline at end of file
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