Get nextmatch-entryheader working

This commit is contained in:
nathangray 2020-02-05 13:48:50 -07:00
parent 458137851d
commit 8dc41fd07a
5 changed files with 4566 additions and 2495 deletions

View File

@ -63,6 +63,7 @@ var et2_core_DOMWidget_1 = require("./et2_core_DOMWidget");
var et2_core_baseWidget_1 = require("./et2_core_baseWidget"); var et2_core_baseWidget_1 = require("./et2_core_baseWidget");
var et2_core_inputWidget_1 = require("./et2_core_inputWidget"); var et2_core_inputWidget_1 = require("./et2_core_inputWidget");
var et2_widget_selectbox_1 = require("./et2_widget_selectbox"); var et2_widget_selectbox_1 = require("./et2_widget_selectbox");
//import {et2_selectAccount} from "./et2_widget_SelectAccount";
var et2_extension_nextmatch_rowProvider_1 = require("./et2_extension_nextmatch_rowProvider"); var et2_extension_nextmatch_rowProvider_1 = require("./et2_extension_nextmatch_rowProvider");
var et2_extension_nextmatch_controller_1 = require("./et2_extension_nextmatch_controller"); var et2_extension_nextmatch_controller_1 = require("./et2_extension_nextmatch_controller");
var et2_dataview_1 = require("./et2_dataview"); var et2_dataview_1 = require("./et2_dataview");
@ -2962,136 +2963,156 @@ et2_core_widget_1.et2_register_widget(et2_nextmatch_filterheader, ['nextmatch-fi
/** /**
* Filter by account * Filter by account
*/ */
var et2_nextmatch_accountfilterheader = /** @class */ (function (_super) { // class et2_nextmatch_accountfilterheader extends et2_selectAccount implements et2_INextmatchHeader, et2_IResizeable
__extends(et2_nextmatch_accountfilterheader, _super); // {
function et2_nextmatch_accountfilterheader() { // /**
return _super !== null && _super.apply(this, arguments) || this; // * Override to add change handler
} // *
/** // */
* Override to add change handler // createInputWidget( )
* // {
* @memberOf et2_nextmatch_accountfilterheader // // Make sure there's an option for all
*/ // if(!this.options.empty_label && !this.options.select_options[""])
et2_nextmatch_accountfilterheader.prototype.createInputWidget = function () { // {
// Make sure there's an option for all // this.options.empty_label = this.options.label ? this.options.label : egw.lang("All");
if (!this.options.empty_label && !this.options.select_options[""]) { // }
this.options.empty_label = this.options.label ? this.options.label : egw.lang("All"); // super.createInputWidget(this, arguments);
} //
_super.prototype.createInputWidget.call(this, this, arguments); // this.input.change(this, function(event) {
this.input.change(this, function (event) { // if(typeof event.data.nextmatch == 'undefined')
if (typeof event.data.nextmatch == 'undefined') { // {
// Not fully set up yet // // Not fully set up yet
return; // return;
} // }
var col_filter = {}; // var col_filter = {};
col_filter[event.data.id] = event.data.getValue(); // col_filter[event.data.id] = event.data.getValue();
event.data.nextmatch.applyFilters({ col_filter: col_filter }); // event.data.nextmatch.applyFilters({col_filter: col_filter});
}); // });
}; //
/** // }
* Set nextmatch is the function which has to be implemented for the //
* et2_INextmatchHeader interface. // /**
* // * Set nextmatch is the function which has to be implemented for the
* @param {et2_nextmatch} _nextmatch // * et2_INextmatchHeader interface.
*/ // *
et2_nextmatch_accountfilterheader.prototype.setNextmatch = function (_nextmatch) { // * @param {et2_nextmatch} _nextmatch
this.nextmatch = _nextmatch; // */
// Set current filter value from nextmatch settings // setNextmatch( _nextmatch)
if (this.nextmatch.activeFilters.col_filter && this.nextmatch.activeFilters.col_filter[this.id]) { // {
this.set_value(this.nextmatch.activeFilters.col_filter[this.id]); // this.nextmatch = _nextmatch;
} //
}; // // Set current filter value from nextmatch settings
// Make sure selectbox is not longer than the column // if(this.nextmatch.activeFilters.col_filter && this.nextmatch.activeFilters.col_filter[this.id])
et2_nextmatch_accountfilterheader.prototype.resize = function () { // {
var max = jQuery(this.parentNode).innerWidth() - 4; // this.set_value(this.nextmatch.activeFilters.col_filter[this.id]);
var surroundings = this.getSurroundings()._widgetSurroundings; // }
for (var i = 0; i < surroundings.length; i++) { // }
max -= jQuery(surroundings[i]).outerWidth(); // // Make sure selectbox is not longer than the column
} // resize( )
this.input.css("max-width", max + "px"); // {
}; // var max = jQuery(this.parentNode).innerWidth() - 4;
return et2_nextmatch_accountfilterheader; // var surroundings = this.getSurroundings()._widgetSurroundings;
}(et2_selectAccount)); // for(var i = 0; i < surroundings.length; i++)
et2_core_widget_1.et2_register_widget(et2_nextmatch_accountfilterheader, ['nextmatch-accountfilter']); // {
// max -= jQuery(surroundings[i]).outerWidth();
// }
// this.input.css("max-width",max + "px");
// }
//
// }
// et2_register_widget(et2_nextmatch_accountfilterheader, ['nextmatch-accountfilter']);
/** /**
* Filter allowing multiple values to be selected, base on a taglist instead * Filter allowing multiple values to be selected, base on a taglist instead
* of a regular selectbox * of a regular selectbox
* *
* @augments et2_taglist * @augments et2_taglist
*/ */
var et2_nextmatch_taglistheader = /** @class */ (function (_super) { // class et2_nextmatch_taglistheader extends et2_taglist implements et2_INextmatchHeader, et2_IResizeable
__extends(et2_nextmatch_taglistheader, _super); // {
function et2_nextmatch_taglistheader() { // static readonly _attributes : any = {
return _super !== null && _super.apply(this, arguments) || this; // autocomplete_url: { default: ''},
} // multiple: { default: 'toggle'},
// onchange: {
// // @ts-ignore
// default: function(event) {
// if(typeof this.nextmatch === 'undefined')
// {
// // Not fully set up yet
// return;
// }
// var col_filter = {};
// col_filter[this.id] = this.getValue();
// // Set value so it's there for response (otherwise it gets cleared if options are updated)
// //event.data.set_value(event.data.input.val());
//
// this.nextmatch.applyFilters({col_filter: col_filter});
// }
// },
// rows: { default: 2},
// class: {default: 'nm_filterheader_taglist'}
// };
// private nextmatch: et2_nextmatch;
//
// /**
// * Override to add change handler
// *
// * @memberOf et2_nextmatch_filterheader
// */
// createInputWidget( )
// {
// // Make sure there's an option for all
// if(!this.options.empty_label && (!this.options.select_options || !this.options.select_options[""]))
// {
// this.options.empty_label = this.options.label ? this.options.label : egw.lang("All");
// }
// super.createInputWidget();
// }
//
// /**
// * Disable toggle if there are 2 or less options
// * @param {Object[]} options
// */
// set_select_options(options)
// {
// if(options && options.length <= 2 && this.options.multiple == 'toggle')
// {
// this.set_multiple(false);
// }
// super.set_select_options(options)
// }
//
// /**
// * Set nextmatch is the function which has to be implemented for the
// * et2_INextmatchHeader interface.
// *
// * @param {et2_nextmatch} _nextmatch
// */
// setNextmatch( _nextmatch)
// {
// this.nextmatch = _nextmatch;
//
// // Set current filter value from nextmatch settings
// if(this.nextmatch.activeFilters.col_filter && typeof this.nextmatch.activeFilters.col_filter[this.id] != "undefined")
// {
// this.set_value(this.nextmatch.activeFilters.col_filter[this.id]);
//
// // Make sure it's set in the nextmatch
// _nextmatch.activeFilters.col_filter[this.id] = this.getValue();
// }
// }
//
// // Make sure selectbox is not longer than the column
// resize( )
// {
// this.div.css("height",'');
// this.div.css("max-width",jQuery(this.parentNode).innerWidth() + "px");
// super.resize();
// }
//
// }
// et2_register_widget(et2_nextmatch_taglistheader, ['nextmatch-taglistheader']);
/** /**
* Override to add change handler * Nextmatch filter that can filter for a selected entry
*
* @memberOf et2_nextmatch_filterheader
*/
et2_nextmatch_taglistheader.prototype.createInputWidget = function () {
// Make sure there's an option for all
if (!this.options.empty_label && (!this.options.select_options || !this.options.select_options[""])) {
this.options.empty_label = this.options.label ? this.options.label : egw.lang("All");
}
_super.prototype.createInputWidget.call(this);
};
/**
* Disable toggle if there are 2 or less options
* @param {Object[]} options
*/
et2_nextmatch_taglistheader.prototype.set_select_options = function (options) {
if (options && options.length <= 2 && this.options.multiple == 'toggle') {
this.set_multiple(false);
}
_super.prototype.set_select_options.call(this, options);
};
/**
* Set nextmatch is the function which has to be implemented for the
* et2_INextmatchHeader interface.
*
* @param {et2_nextmatch} _nextmatch
*/
et2_nextmatch_taglistheader.prototype.setNextmatch = function (_nextmatch) {
this.nextmatch = _nextmatch;
// Set current filter value from nextmatch settings
if (this.nextmatch.activeFilters.col_filter && typeof this.nextmatch.activeFilters.col_filter[this.id] != "undefined") {
this.set_value(this.nextmatch.activeFilters.col_filter[this.id]);
// Make sure it's set in the nextmatch
_nextmatch.activeFilters.col_filter[this.id] = this.getValue();
}
};
// Make sure selectbox is not longer than the column
et2_nextmatch_taglistheader.prototype.resize = function () {
this.div.css("height", '');
this.div.css("max-width", jQuery(this.parentNode).innerWidth() + "px");
_super.prototype.resize.call(this);
};
et2_nextmatch_taglistheader._attributes = {
autocomplete_url: { default: '' },
multiple: { default: 'toggle' },
onchange: {
// @ts-ignore
default: function (event) {
if (typeof this.nextmatch === 'undefined') {
// Not fully set up yet
return;
}
var col_filter = {};
col_filter[this.id] = this.getValue();
// Set value so it's there for response (otherwise it gets cleared if options are updated)
//event.data.set_value(event.data.input.val());
this.nextmatch.applyFilters({ col_filter: col_filter });
}
},
rows: { default: 2 },
class: { default: 'nm_filterheader_taglist' }
};
return et2_nextmatch_taglistheader;
}(et2_taglist));
et2_core_widget_1.et2_register_widget(et2_nextmatch_taglistheader, ['nextmatch-taglistheader']);
/**
* @augments et2_link_entry
*/ */
var et2_nextmatch_entryheader = /** @class */ (function (_super) { var et2_nextmatch_entryheader = /** @class */ (function (_super) {
__extends(et2_nextmatch_entryheader, _super); __extends(et2_nextmatch_entryheader, _super);

View File

@ -49,6 +49,7 @@ import {et2_DOMWidget} from "./et2_core_DOMWidget";
import {et2_baseWidget} from "./et2_core_baseWidget"; import {et2_baseWidget} from "./et2_core_baseWidget";
import {et2_inputWidget} from "./et2_core_inputWidget"; import {et2_inputWidget} from "./et2_core_inputWidget";
import {et2_selectbox} from "./et2_widget_selectbox"; import {et2_selectbox} from "./et2_widget_selectbox";
//import {et2_selectAccount} from "./et2_widget_SelectAccount";
import {et2_nextmatch_rowProvider} from "./et2_extension_nextmatch_rowProvider"; import {et2_nextmatch_rowProvider} from "./et2_extension_nextmatch_rowProvider";
import {et2_nextmatch_controller} from "./et2_extension_nextmatch_controller"; import {et2_nextmatch_controller} from "./et2_extension_nextmatch_controller";
@ -2703,7 +2704,8 @@ class et2_nextmatch_header_bar extends et2_DOMWidget implements et2_INextmatchHe
* @param nm_div * @param nm_div
* @memberOf et2_nextmatch_header_bar * @memberOf et2_nextmatch_header_bar
*/ */
constructor(_parent : et2_nextmatch, _attrs? : WidgetConfig, _child? : object) { constructor(_parent : et2_nextmatch, _attrs? : WidgetConfig, _child? : object)
{
super(_parent, [_parent,_parent.options.settings], ClassWithAttributes.extendAttributes(et2_nextmatch_header_bar._attributes, _child || {})); super(_parent, [_parent,_parent.options.settings], ClassWithAttributes.extendAttributes(et2_nextmatch_header_bar._attributes, _child || {}));
this.nextmatch = _parent; this.nextmatch = _parent;
this.div = jQuery(document.createElement("div")) this.div = jQuery(document.createElement("div"))
@ -3765,65 +3767,64 @@ et2_register_widget(et2_nextmatch_filterheader, ['nextmatch-filterheader']);
/** /**
* Filter by account * Filter by account
*/ */
class et2_nextmatch_accountfilterheader extends et2_selectAccount implements et2_INextmatchHeader, et2_IResizeable // class et2_nextmatch_accountfilterheader extends et2_selectAccount implements et2_INextmatchHeader, et2_IResizeable
{ // {
/** // /**
* Override to add change handler // * Override to add change handler
* // *
* @memberOf et2_nextmatch_accountfilterheader // */
*/ // createInputWidget( )
createInputWidget( ) // {
{ // // Make sure there's an option for all
// Make sure there's an option for all // if(!this.options.empty_label && !this.options.select_options[""])
if(!this.options.empty_label && !this.options.select_options[""]) // {
{ // this.options.empty_label = this.options.label ? this.options.label : egw.lang("All");
this.options.empty_label = this.options.label ? this.options.label : egw.lang("All"); // }
} // super.createInputWidget(this, arguments);
super.createInputWidget(this, arguments); //
// this.input.change(this, function(event) {
this.input.change(this, function(event) { // if(typeof event.data.nextmatch == 'undefined')
if(typeof event.data.nextmatch == 'undefined') // {
{ // // Not fully set up yet
// Not fully set up yet // return;
return; // }
} // var col_filter = {};
var col_filter = {}; // col_filter[event.data.id] = event.data.getValue();
col_filter[event.data.id] = event.data.getValue(); // event.data.nextmatch.applyFilters({col_filter: col_filter});
event.data.nextmatch.applyFilters({col_filter: col_filter}); // });
}); //
// }
} //
// /**
/** // * Set nextmatch is the function which has to be implemented for the
* Set nextmatch is the function which has to be implemented for the // * et2_INextmatchHeader interface.
* et2_INextmatchHeader interface. // *
* // * @param {et2_nextmatch} _nextmatch
* @param {et2_nextmatch} _nextmatch // */
*/ // setNextmatch( _nextmatch)
setNextmatch( _nextmatch) // {
{ // this.nextmatch = _nextmatch;
this.nextmatch = _nextmatch; //
// // Set current filter value from nextmatch settings
// Set current filter value from nextmatch settings // if(this.nextmatch.activeFilters.col_filter && this.nextmatch.activeFilters.col_filter[this.id])
if(this.nextmatch.activeFilters.col_filter && this.nextmatch.activeFilters.col_filter[this.id]) // {
{ // this.set_value(this.nextmatch.activeFilters.col_filter[this.id]);
this.set_value(this.nextmatch.activeFilters.col_filter[this.id]); // }
} // }
} // // Make sure selectbox is not longer than the column
// Make sure selectbox is not longer than the column // resize( )
resize( ) // {
{ // var max = jQuery(this.parentNode).innerWidth() - 4;
var max = jQuery(this.parentNode).innerWidth() - 4; // var surroundings = this.getSurroundings()._widgetSurroundings;
var surroundings = this.getSurroundings()._widgetSurroundings; // for(var i = 0; i < surroundings.length; i++)
for(var i = 0; i < surroundings.length; i++) // {
{ // max -= jQuery(surroundings[i]).outerWidth();
max -= jQuery(surroundings[i]).outerWidth(); // }
} // this.input.css("max-width",max + "px");
this.input.css("max-width",max + "px"); // }
} //
// }
} // et2_register_widget(et2_nextmatch_accountfilterheader, ['nextmatch-accountfilter']);
et2_register_widget(et2_nextmatch_accountfilterheader, ['nextmatch-accountfilter']);
/** /**
* Filter allowing multiple values to be selected, base on a taglist instead * Filter allowing multiple values to be selected, base on a taglist instead
@ -3831,93 +3832,93 @@ et2_register_widget(et2_nextmatch_accountfilterheader, ['nextmatch-accountfilter
* *
* @augments et2_taglist * @augments et2_taglist
*/ */
class et2_nextmatch_taglistheader extends et2_taglist implements et2_INextmatchHeader, et2_IResizeable // class et2_nextmatch_taglistheader extends et2_taglist implements et2_INextmatchHeader, et2_IResizeable
{ // {
static readonly _attributes : any = { // static readonly _attributes : any = {
autocomplete_url: { default: ''}, // autocomplete_url: { default: ''},
multiple: { default: 'toggle'}, // multiple: { default: 'toggle'},
onchange: { // onchange: {
// @ts-ignore // // @ts-ignore
default: function(event) { // default: function(event) {
if(typeof this.nextmatch === 'undefined') // if(typeof this.nextmatch === 'undefined')
{ // {
// Not fully set up yet // // Not fully set up yet
return; // return;
} // }
var col_filter = {}; // var col_filter = {};
col_filter[this.id] = this.getValue(); // col_filter[this.id] = this.getValue();
// Set value so it's there for response (otherwise it gets cleared if options are updated) // // Set value so it's there for response (otherwise it gets cleared if options are updated)
//event.data.set_value(event.data.input.val()); // //event.data.set_value(event.data.input.val());
//
this.nextmatch.applyFilters({col_filter: col_filter}); // this.nextmatch.applyFilters({col_filter: col_filter});
} // }
}, // },
rows: { default: 2}, // rows: { default: 2},
class: {default: 'nm_filterheader_taglist'} // class: {default: 'nm_filterheader_taglist'}
}; // };
private nextmatch: et2_nextmatch; // private nextmatch: et2_nextmatch;
//
// /**
// * Override to add change handler
// *
// * @memberOf et2_nextmatch_filterheader
// */
// createInputWidget( )
// {
// // Make sure there's an option for all
// if(!this.options.empty_label && (!this.options.select_options || !this.options.select_options[""]))
// {
// this.options.empty_label = this.options.label ? this.options.label : egw.lang("All");
// }
// super.createInputWidget();
// }
//
// /**
// * Disable toggle if there are 2 or less options
// * @param {Object[]} options
// */
// set_select_options(options)
// {
// if(options && options.length <= 2 && this.options.multiple == 'toggle')
// {
// this.set_multiple(false);
// }
// super.set_select_options(options)
// }
//
// /**
// * Set nextmatch is the function which has to be implemented for the
// * et2_INextmatchHeader interface.
// *
// * @param {et2_nextmatch} _nextmatch
// */
// setNextmatch( _nextmatch)
// {
// this.nextmatch = _nextmatch;
//
// // Set current filter value from nextmatch settings
// if(this.nextmatch.activeFilters.col_filter && typeof this.nextmatch.activeFilters.col_filter[this.id] != "undefined")
// {
// this.set_value(this.nextmatch.activeFilters.col_filter[this.id]);
//
// // Make sure it's set in the nextmatch
// _nextmatch.activeFilters.col_filter[this.id] = this.getValue();
// }
// }
//
// // Make sure selectbox is not longer than the column
// resize( )
// {
// this.div.css("height",'');
// this.div.css("max-width",jQuery(this.parentNode).innerWidth() + "px");
// super.resize();
// }
//
// }
// et2_register_widget(et2_nextmatch_taglistheader, ['nextmatch-taglistheader']);
/** /**
* Override to add change handler * Nextmatch filter that can filter for a selected entry
*
* @memberOf et2_nextmatch_filterheader
*/
createInputWidget( )
{
// Make sure there's an option for all
if(!this.options.empty_label && (!this.options.select_options || !this.options.select_options[""]))
{
this.options.empty_label = this.options.label ? this.options.label : egw.lang("All");
}
super.createInputWidget();
}
/**
* Disable toggle if there are 2 or less options
* @param {Object[]} options
*/
set_select_options(options)
{
if(options && options.length <= 2 && this.options.multiple == 'toggle')
{
this.set_multiple(false);
}
super.set_select_options(options)
}
/**
* Set nextmatch is the function which has to be implemented for the
* et2_INextmatchHeader interface.
*
* @param {et2_nextmatch} _nextmatch
*/
setNextmatch( _nextmatch)
{
this.nextmatch = _nextmatch;
// Set current filter value from nextmatch settings
if(this.nextmatch.activeFilters.col_filter && typeof this.nextmatch.activeFilters.col_filter[this.id] != "undefined")
{
this.set_value(this.nextmatch.activeFilters.col_filter[this.id]);
// Make sure it's set in the nextmatch
_nextmatch.activeFilters.col_filter[this.id] = this.getValue();
}
}
// Make sure selectbox is not longer than the column
resize( )
{
this.div.css("height",'');
this.div.css("max-width",jQuery(this.parentNode).innerWidth() + "px");
super.resize();
}
}
et2_register_widget(et2_nextmatch_taglistheader, ['nextmatch-taglistheader']);
/**
* @augments et2_link_entry
*/ */
class et2_nextmatch_entryheader extends et2_link_entry implements et2_INextmatchHeader class et2_nextmatch_entryheader extends et2_link_entry implements et2_INextmatchHeader
{ {

View File

@ -3,7 +3,9 @@ declare module eT2
} }
declare var etemplate2 : any; declare var etemplate2 : any;
declare class et2_widget{} declare class et2_widget{
destroy()
}
declare class et2_DOMWidget extends et2_widget{} declare class et2_DOMWidget extends et2_widget{}
declare class et2_baseWidget extends et2_DOMWidget{} declare class et2_baseWidget extends et2_DOMWidget{}
declare class et2_valueWidget extends et2_baseWidget{} declare class et2_valueWidget extends et2_baseWidget{}
@ -87,7 +89,7 @@ declare var et2_diff : any;
declare var et2_dropdown_button : any; declare var et2_dropdown_button : any;
declare var et2_entry : any; declare var et2_entry : any;
declare var et2_favorites : any; declare var et2_favorites : any;
declare var et2_file : any; declare class et2_file extends et2_widget {}
declare var et2_grid : any; declare var et2_grid : any;
declare var et2_groupbox : any; declare var et2_groupbox : any;
declare var et2_groupbox_legend : any; declare var et2_groupbox_legend : any;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff