This commit is contained in:
zadam
2023-11-03 12:23:14 +01:00
parent a45b801a84
commit 6dd466ddaf
9 changed files with 124 additions and 141 deletions

View File

@@ -31,7 +31,7 @@
/**
* This is the base widget for all other widgets.
*
*
* For information on using widgets, see the tutorial {@tutorial widget_basics}.
*/
class BasicWidget extends Component {
@@ -61,7 +61,7 @@ class BasicWidget extends Component {
}
}
this.children.sort((a, b) => a.position - b.position < 0 ? -1 : 1);
this.children.sort((a, b) => a.position - b.position);
return this;
}
@@ -100,7 +100,7 @@ class BasicWidget extends Component {
/**
* Accepts a string of CSS to add with the widget.
* @param {string} block
* @param {string} block
* @returns {this} for chaining
*/
cssBlock(block) {
@@ -112,7 +112,8 @@ class BasicWidget extends Component {
this.doRender();
this.$widget.attr('data-component-id', this.componentId);
this.$widget.addClass('component')
this.$widget
.addClass('component')
.prop('component', this);
if (!this.isEnabled()) {
@@ -152,9 +153,9 @@ class BasicWidget extends Component {
/**
* Method used for rendering the widget.
*
*
* Your class should override this method.
* @returns {JQuery<HTMLElement>} Your widget.
* The method is expected to create a this.$widget containing jQuery object
*/
doRender() {}