Temporary work around for legacyOptions issue

This commit is contained in:
nathangray 2020-01-24 02:12:14 -07:00
parent b1272bb204
commit 71ea795a0a
6 changed files with 32 additions and 23 deletions

View File

@ -285,7 +285,7 @@ export abstract class et2_DOMWidget extends et2_widget implements et2_IDOMNode
*
* @returns {Object|null} Data for tab the widget is on
*/
get_tab_info() : object | null
get_tab_info() : {id: string, label: string, widget: et2_widget, contentDiv: JQuery} | null
{
var parent : et2_widget = this;
do {

View File

@ -285,11 +285,15 @@ var et2_widget = /** @class */ (function (_super) {
}
_node._parent = this;
this._children.splice(_idx, 0, _node);
if (_node.implements(et2_IDOMNode) && this.implements(et2_IDOMNode) && _node.parentNode) {
_node.detachFromDOM();
_node.parentNode = this.getDOMNode(_node);
_node.attachToDOM();
}
/*
Comment this out (for now)
if (_node.implements(et2_IDOMNode) && this.implements(et2_IDOMNode) && typeof _node.hasOwnProperty('parentNode') )
{
_node.detachFromDOM();
_node.parentNode = (<et2_IDOMNode><unknown>this).getDOMNode(_node);
_node.attachToDOM();
}
*/
}
else {
this.egw().debug("error", "Widget " + _node._type + " is not supported by this widget class", this);
@ -404,7 +408,7 @@ var et2_widget = /** @class */ (function (_super) {
var attrName = _attrsObj[i].name;
var attrValue = _attrsObj[i].value;
// Special handling for the legacy options
if (attrName == "options" && _proto.legacyOptions.length > 0) {
if (attrName == "options" && _proto.legacyOptions && _proto.legacyOptions.length > 0) {
// Check for modifications on legacy options here. Normal modifications
// are handled in widget constructor, but it's too late for legacy options then
if (_target.id && this.getArrayMgr("modifications").getEntry(_target.id)) {

View File

@ -535,7 +535,7 @@ Comment this out (for now)
var attrValue = _attrsObj[i].value;
// Special handling for the legacy options
if (attrName == "options" && _proto.legacyOptions.length > 0) {
if (attrName == "options" && _proto.legacyOptions && _proto.legacyOptions.length > 0) {
// Check for modifications on legacy options here. Normal modifications
// are handled in widget constructor, but it's too late for legacy options then
if (_target.id && this.getArrayMgr("modifications").getEntry(_target.id)) {

View File

@ -56,12 +56,6 @@ declare var et2_nextmatch : any;
declare var et2_nextmatch_header_bar : any;
declare var et2_nextmatch_header : any;
declare var et2_nextmatch_customfields : any;
declare var et2_nextmatch_sortheader : any;
declare var et2_nextmatch_filterheader : any;
declare var et2_nextmatch_accountfilterheader : any;
declare var et2_nextmatch_taglistheader : any;
declare var et2_nextmatch_entryheader : any;
declare var et2_nextmatch_customfilter : any;
declare var et2_nextmatch_controller : any;
declare var et2_dynheight : any;
declare var et2_nextmatch_rowProvider : any;
@ -119,12 +113,15 @@ declare var et2_radioGroup : any;
declare var et2_script : any;
declare var et2_selectAccount : any;
declare var et2_selectAccount_ro : any;
declare class et2_selectbox extends et2_inputWidget {}
declare class et2_selectbox extends et2_inputWidget {
protected options : any;
public createInputWidget();
}
declare var et2_selectbox_ro : any;
declare var et2_menulist : any;
declare var et2_split : any;
declare var et2_styles : any;
declare var et2_taglist : any;
declare class et2_taglist extends et2_selectbox {}
declare var et2_taglist_account : any;
declare var et2_taglist_email : any;
declare var et2_taglist_category : any;
@ -152,6 +149,12 @@ declare var et2_vfsUpload : any;
declare var et2_vfsSelect : any;
declare var et2_video : any;
declare var et2_IExposable : any;
declare class et2_nextmatch_sortheader extends et2_nextmatch_header {}
declare class et2_nextmatch_filterheader extends et2_nextmatch_header {}
declare class et2_nextmatch_accountfilterheader extends et2_nextmatch_header {}
declare class et2_nextmatch_taglistheader extends et2_nextmatch_header {}
declare class et2_nextmatch_entryheader extends et2_nextmatch_header {}
declare class et2_nextmatch_customfilter extends et2_nextmatch_filterheader {}
declare function et2_createWidget(type : string, params : {}, parent? : any) : any;
declare function nm_action(_action : {}, _senders : [], _target : any, _ids? : any) : void;
declare function et2_compileLegacyJS(_code : string, _widget : et2_widget, _context? : HTMLElement) : Function;

View File

@ -30,12 +30,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
et2_core_xml;
et2_core_DOMWidget;
et2_core_inputWidget;
et2_extension_nextmatch;
*/
require("./et2_core_common");
var et2_core_inheritance_1 = require("./et2_core_inheritance");
var et2_core_widget_1 = require("./et2_core_widget");
var et2_core_inputWidget_1 = require("./et2_core_inputWidget");
require("./et2_types");
var et2_core_DOMWidget_1 = require("./et2_core_DOMWidget");
// all calls to Chosen jQuery plugin as jQuery.(un)chosen() give errors which are currently suppressed with @ts-ignore
// adding npm package @types/chosen-js did NOT help :(
@ -816,7 +816,8 @@ var et2_selectbox = /** @class */ (function (_super) {
var content_options = {};
// First check type, there may be static options. There's some special handling
// for filterheaders, which have the wrong type.
var type = widget.instanceOf(et2_nextmatch_filterheader) ? attrs.widget_type || '' : widget._type;
// TODO: filterheader should always be defined, find out why it's not
var type = /* widget.instanceOf(et2_nextmatch_filterheader) ? attrs.widget_type || '' :*/ widget._type;
var type_function = type.replace('select-', '').replace('taglist-', '').replace('_ro', '') + '_options';
if (typeof this[type_function] == 'function') {
var old_type = widget._type;

View File

@ -16,13 +16,13 @@
et2_core_xml;
et2_core_DOMWidget;
et2_core_inputWidget;
et2_extension_nextmatch;
*/
import './et2_core_common';
import { ClassWithAttributes } from "./et2_core_inheritance";
import { et2_widget, et2_createWidget, et2_register_widget, WidgetConfig } from "./et2_core_widget";
import { et2_inputWidget } from './et2_core_inputWidget'
import './et2_types';
import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget";
import {et2_inputWidget} from './et2_core_inputWidget'
import {et2_DOMWidget} from "./et2_core_DOMWidget";
// all calls to Chosen jQuery plugin as jQuery.(un)chosen() give errors which are currently suppressed with @ts-ignore
@ -1093,7 +1093,8 @@ export class et2_selectbox extends et2_inputWidget
// First check type, there may be static options. There's some special handling
// for filterheaders, which have the wrong type.
var type = widget.instanceOf(et2_nextmatch_filterheader) ? attrs.widget_type || '' : widget._type;
// TODO: filterheader should always be defined, find out why it's not
var type = /* widget.instanceOf(et2_nextmatch_filterheader) ? attrs.widget_type || '' :*/ widget._type;
var type_function = type.replace('select-','').replace('taglist-','').replace('_ro','')+'_options';
if(typeof this[type_function] == 'function')
{