Calendar to TS working

This commit is contained in:
nathangray 2020-02-27 13:37:36 -07:00
parent 0f898acbb2
commit 08b6cce51d
8 changed files with 11314 additions and 8716 deletions

4144
calendar/js/app.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
"use strict";
/* /*
* Egroupware * Egroupware
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@ -7,12 +8,24 @@
* @author Nathan Gray * @author Nathan Gray
* @version $Id$ * @version $Id$
*/ */
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*egw:uses /*egw:uses
et2_widget_taglist; et2_widget_taglist;
*/ */
var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
/** /**
* Tag list widget customised for calendar owner, which can be a user * Tag list widget customised for calendar owner, which can be a user
* account or group, or an entry from almost any app, or an email address * account or group, or an entry from almost any app, or an email address
@ -23,117 +36,109 @@
* @see http://nicolasbize.github.io/magicsuggest/ * @see http://nicolasbize.github.io/magicsuggest/
* @augments et2_selectbox * @augments et2_selectbox
*/ */
var et2_calendar_owner = (function(){ "use strict"; return et2_taglist_email.extend( var et2_calendar_owner = /** @class */ (function (_super) {
{ __extends(et2_calendar_owner, _super);
attributes: { function et2_calendar_owner() {
"autocomplete_url": { var _this = _super !== null && _super.apply(this, arguments) || this;
"default": "calendar_owner_etemplate_widget::ajax_owner" // Allows sub-widgets to override options to the library
}, _this.lib_options = {
"autocomplete_params": { autoSelect: false,
"name": "Autocomplete parameters", groupBy: 'app',
"type": "any", minChars: 2,
"default": {}, selectFirst: true,
"description": "Extra parameters passed to autocomplete URL. It should be a stringified JSON object." // This option will also expand when the selection is changed
}, // via code, which we do not want
allowFreeEntries: { //expandOnFocus: true
"default": false, toggleOnClick: true
ignore: true };
}, return _this;
select_options: { }
"type": "any", et2_calendar_owner.prototype.doLoadingFinished = function () {
"name": "Select options", _super.prototype.doLoadingFinished.call(this);
// Set to empty object to use selectbox's option finding var widget = this;
"default": {}, // onChange fired when losing focus, which is different from normal
"description": "Internally used to hold the select options." this._oldValue = this.taglist.getValue();
} return true;
}, };
et2_calendar_owner.prototype.selectionRenderer = function (item) {
// Allows sub-widgets to override options to the library if (this && this.options && this.options.allowFreeEntries) {
lib_options: { return _super.prototype.selectionRenderer.call(this, item);
autoSelect: false, }
groupBy: 'app', else {
minChars: 2, var label = jQuery('<span>').text(item.label);
selectFirst: true, if (item.class)
// This option will also expand when the selection is changed label.addClass(item.class);
// via code, which we do not want if (typeof item.title != 'undefined')
//expandOnFocus: true label.attr('title', item.title);
toggleOnClick: true if (typeof item.data != 'undefined')
}, label.attr('data', item.data);
if (typeof item.icon != 'undefined') {
var wrapper = jQuery('<div>').addClass('et2_taglist_tags_icon_wrapper');
doLoadingFinished: function() { jQuery('<span/>')
this._super.apply(this, arguments); .addClass('et2_taglist_tags_icon')
.css({ "background-image": "url(" + (item.icon.match(/^(http|https|\/)/) ? item.icon : egw.image(item.icon, item.app)) + ")" })
var widget = this; .appendTo(wrapper);
// onChange fired when losing focus, which is different from normal label.appendTo(wrapper);
this._oldValue = this.taglist.getValue(); return wrapper;
}
return true; return label;
}, }
};
selectionRenderer: function(item) et2_calendar_owner.prototype.getValue = function () {
{ if (this.taglist == null)
if(this && this.options && this.options.allowFreeEntries) return null;
{ return this.taglist.getValue();
return this._super.apply(this,arguments); };
} /**
else * Override parent to handle our special additional data types (c#,r#,etc.) when they
{ * are not available client side.
var label = jQuery('<span>').text(item.label); *
if (item.class) label.addClass(item.class); * @param {string|string[]} _value array of selected owners, which can be a number,
if (typeof item.title != 'undefined') label.attr('title', item.title); * or a number prefixed with one character indicating the resource type.
if (typeof item.data != 'undefined') label.attr('data', item.data); */
if (typeof item.icon != 'undefined') et2_calendar_owner.prototype.set_value = function (_value) {
{ _super.prototype.set_value.call(this, _value);
var wrapper = jQuery('<div>').addClass('et2_taglist_tags_icon_wrapper'); // If parent didn't find a label, label will be the same as ID so we
jQuery('<span/>') // can find them that way
.addClass('et2_taglist_tags_icon') for (var i = 0; i < this.options.value.length; i++) {
.css({"background-image": "url("+(item.icon.match(/^(http|https|\/)/) ? item.icon : egw.image(item.icon, item.app))+")"}) var value = this.options.value[i];
.appendTo(wrapper); if (value.id == value.label) {
label.appendTo(wrapper); // Proper label was not fount by parent - ask directly
return wrapper; egw.json('calendar_owner_etemplate_widget::ajax_owner', value.id, function (data) {
} this.widget.options.value[this.i].label = data;
return label; this.widget.set_value(this.widget.options.value);
} }, this, true, { widget: this, i: i }).sendRequest();
}, }
}
getValue: function() if (this.taglist) {
{ this.taglist.clear(true);
if(this.taglist == null) return null; this.taglist.addToSelection(this.options.value, true);
return this.taglist.getValue(); }
}, };
et2_calendar_owner._attributes = {
/** "autocomplete_url": {
* Override parent to handle our special additional data types (c#,r#,etc.) when they "default": "calendar_owner_etemplate_widget::ajax_owner"
* are not available client side. },
* "autocomplete_params": {
* @param {string|string[]} _value array of selected owners, which can be a number, "name": "Autocomplete parameters",
* or a number prefixed with one character indicating the resource type. "type": "any",
*/ "default": {},
set_value: function(_value) "description": "Extra parameters passed to autocomplete URL. It should be a stringified JSON object."
{ },
this._super.apply(this, arguments); allowFreeEntries: {
"default": false,
// If parent didn't find a label, label will be the same as ID so we ignore: true
// can find them that way },
for(var i = 0; i < this.options.value.length; i++) select_options: {
{ "type": "any",
var value = this.options.value[i]; "name": "Select options",
if(value.id == value.label) // Set to empty object to use selectbox's option finding
{ "default": {},
// Proper label was not fount by parent - ask directly "description": "Internally used to hold the select options."
egw.json('calendar_owner_etemplate_widget::ajax_owner',value.id,function(data) { }
this.widget.options.value[this.i].label = data; };
this.widget.set_value(this.widget.options.value); return et2_calendar_owner;
}, this,true,{widget: this, i: i}).sendRequest(); }(et2_taglist_email));
} exports.et2_calendar_owner = et2_calendar_owner;
} et2_core_widget_1.et2_register_widget(et2_calendar_owner, ["calendar-owner"]);
//# sourceMappingURL=et2_widget_owner.js.map
if(this.taglist)
{
this.taglist.clear(true);
this.taglist.addToSelection(this.options.value,true);
}
}
});}).call(this);
et2_register_widget(et2_calendar_owner, ["calendar-owner"]);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff