From 4adff37f6f4a18d5f57ad7119d090ba3147456f7 Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 7 Feb 2020 09:31:10 -0700 Subject: [PATCH] Fix missing / not set attributes --- api/js/etemplate/et2_widget_link.js | 8 +++---- api/js/etemplate/et2_widget_link.ts | 35 +++++++++++++++++------------ 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/api/js/etemplate/et2_widget_link.js b/api/js/etemplate/et2_widget_link.js index 71c4cb1b94..7dd37fba91 100644 --- a/api/js/etemplate/et2_widget_link.js +++ b/api/js/etemplate/et2_widget_link.js @@ -434,7 +434,7 @@ var et2_link_apps = /** @class */ (function (_super) { _attrs.select_options = select_options; _super.prototype.transformAttributes.call(this, _attrs); }; - et2_link_apps.attributes = { + et2_link_apps._attributes = { "only_app": { "name": "Application", "type": "string", @@ -989,7 +989,7 @@ var et2_link_entry = /** @class */ (function (_super) { delete this.options.value.id; } }; - et2_link_entry.attributes = { + et2_link_entry._attributes = { "value": { "type": "any", "default": {} @@ -1401,7 +1401,7 @@ var et2_link_string = /** @class */ (function (_super) { this._labelContainer.contents().not(this.list).remove(); } }; - et2_link_string.attributes = { + et2_link_string._attributes = { "application": { "name": "Application", "type": "string", @@ -1846,7 +1846,7 @@ var et2_link_list = /** @class */ (function (_super) { $td.html('' + dirs.join('/') + ': - ' + filename); } }; - et2_link_list.attributes = { + et2_link_list._attributes = { "show_deleted": { "name": "Show deleted", "type": "boolean", diff --git a/api/js/etemplate/et2_widget_link.ts b/api/js/etemplate/et2_widget_link.ts index 1b95a66d02..ffe763bb52 100644 --- a/api/js/etemplate/et2_widget_link.ts +++ b/api/js/etemplate/et2_widget_link.ts @@ -468,7 +468,7 @@ et2_register_widget(et2_link_to, ["link-to"]); */ export class et2_link_apps extends et2_selectbox { - static readonly attributes: any = { + static readonly _attributes: any = { "only_app": { "name": "Application", "type": "string", @@ -545,7 +545,7 @@ et2_register_widget(et2_link_apps, ["link-apps"]); */ export class et2_link_entry extends et2_inputWidget { - static readonly attributes : any = { + static readonly _attributes : any = { "value": { "type": "any", "default": {} @@ -614,8 +614,6 @@ export class et2_link_entry extends et2_inputWidget { super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_link_entry._attributes, _child || {})); - - this.search = null; this.clear = null; this.app_select = null; @@ -663,10 +661,14 @@ export class et2_link_entry extends et2_inputWidget // Application selection jQuery.widget( "custom.iconselectmenu", jQuery.ui.selectmenu, { - _setText: function(element, value){ - if(element === this.buttonText){ + _setText: function(element, value) + { + if(element === this.buttonText) + { this._setButtonText(value); - } else { + } + else + { this._superApply(element, value); } }, @@ -699,7 +701,8 @@ export class et2_link_entry extends et2_inputWidget var li = jQuery( "
  • ", {class:"et2_link_entry_app_option"}), wrapper = jQuery( "
    ", {text: item.label} ); - if ( item.disabled ) { + if ( item.disabled ) + { li.addClass( "ui-state-disabled" ); } ul.addClass(self.div.attr("class")); @@ -728,7 +731,8 @@ export class et2_link_entry extends et2_inputWidget self.options.value.app = self.app_select.val(); }); var opt_count = 0; - for(var key in this.options.select_options) { + for(var key in this.options.select_options) + { opt_count++; var option = jQuery(document.createElement("option")) .attr("value", key) @@ -817,7 +821,8 @@ export class et2_link_entry extends et2_inputWidget }); // Custom display (colors) - this.search.data("uiAutocomplete")._renderItem = function(ul, item) { + this.search.data("uiAutocomplete")._renderItem = function(ul, item) + { var li = jQuery(document.createElement('li')) .data("item.autocomplete", item); var extra : any = {}; @@ -852,7 +857,8 @@ export class et2_link_entry extends et2_inputWidget }; // Bind to enter key to start search early - this.search.keydown(function(e) { + this.search.keydown(function(e) + { var keycode = (e.keyCode ? e.keyCode : e.which); if(keycode == 13 && !self.processing) { @@ -866,7 +872,8 @@ export class et2_link_entry extends et2_inputWidget // Clear / last button this.clear = jQuery(document.createElement("span")) .addClass("ui-icon ui-icon-close") - .click(function(e){ + .click(function(e) + { if (!self.search) return; // only gives an error, we should never get into that situation // No way to tell if the results is open, so if they click the button while open, it clears if(self.last_search && self.last_search != self.search.val()) @@ -1485,7 +1492,7 @@ et2_register_widget(et2_link, ["link", "link-entry_ro"]); */ export class et2_link_string extends et2_valueWidget implements et2_IDetachedDOM { - static readonly attributes : any = { + static readonly _attributes : any = { "application": { "name": "Application", "type": "string", @@ -1740,7 +1747,7 @@ et2_register_widget(et2_link_string, ["link-string"]); */ export class et2_link_list extends et2_link_string { - static readonly attributes : any = { + static readonly _attributes : any = { "show_deleted": { "name": "Show deleted", "type": "boolean",