+ ${labelTemplate}
+
+
+ ${this.open && !this.noDialog ?
+ html`
+
+ {
+ // Stop bubble or it will re-show dialog
+ e.stopPropagation()
+ }}
+ @close=${() =>
+ {
+ this.removeAttribute("open");
+ this.requestUpdate("open", true);
+ }}
+ >
+
+ ` : html`
+ ${!this.noDialog ? html`
+ ` : nothing}
+ `
+ }
+
+ ${helpTextTemplate}
+
+ `;
+ }
+}
\ No newline at end of file
diff --git a/api/js/etemplate/et2_widget_diff.ts b/api/js/etemplate/et2_widget_diff.ts
index fefb03ea29..b3a74be065 100644
--- a/api/js/etemplate/et2_widget_diff.ts
+++ b/api/js/etemplate/et2_widget_diff.ts
@@ -9,202 +9,15 @@
* @copyright Nathan Gray 2012
*/
-/*egw:uses
- /vendor/bower-asset/jquery/dist/jquery.js;
- /vendor/bower-asset/diff2html/dist/diff2html.min.js;
- et2_core_valueWidget;
-*/
-import "../../../vendor/bower-asset/diff2html/dist/diff2html.min";
-import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
-import {ClassWithAttributes} from "./et2_core_inheritance";
-import {et2_valueWidget} from "./et2_core_valueWidget";
-import {et2_IDetachedDOM} from "./et2_core_interfaces";
-import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
+import {et2_register_widget} from "./et2_core_widget";
+import {Et2Diff} from "./Et2Diff/Et2Diff";
/**
* Class that displays the diff between two [text] values
*
* @augments et2_valueWidget
*/
-export class et2_diff extends et2_valueWidget implements et2_IDetachedDOM
+export class et2_diff extends Et2Diff
{
- static readonly _attributes = {
- "value": {
- "type": "any"
- }
- };
-
- private readonly diff_options: {
- "inputFormat":"diff",
- "matching": "words"
- };
- private div: HTMLDivElement;
- private mini: boolean = true;
-
- /**
- * Constructor
- */
- constructor(_parent, _attrs? : WidgetConfig, _child? : object)
- {
- // Call the inherited constructor
- super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_diff._attributes, _child || {}));
-
- // included via etemplate2.css
- //this.egw().includeCSS('../../../vendor/bower-asset/dist/dist2html.css');
- this.div = document.createElement("div");
- jQuery(this.div).addClass('et2_diff');
- }
-
- set_value( value)
- {
- jQuery(this.div).empty();
- if(typeof value == 'string') {
-
- // Diff2Html likes to have files, we don't have them
- if(value.indexOf('---') !== 0)
- {
- value = "--- diff\n+++ diff\n"+value;
- }
- // @ts-ignore
- var diff = Diff2Html.getPrettyHtml(value, this.diff_options);
- // var ui = new Diff2HtmlUI({diff: diff});
- // ui.draw(jQuery(this.div), this.diff_options);
- jQuery(this.div).append(diff);
- }
- else if(typeof value != 'object')
- {
- jQuery(this.div).append(value);
- }
- this.check_mini();
- }
-
- check_mini( )
- {
- if(!this.mini)
- {
- return false;
- }
- var view = jQuery(this.div).children();
- this.minify(view);
- var self = this;
- jQuery('