From ea20784e315e34c522e5384328f2c1dd689a4c54 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 21 Jul 2022 14:05:53 -0600 Subject: [PATCH] Get Invoker buttons back after changing Et2Textbox base 379ceeb3e51a9a8643fcbe0a837830a4619fc67f --- api/js/etemplate/Et2Url/Et2InvokerMixin.ts | 13 ++++--------- api/js/etemplate/Et2Url/Et2Url.ts | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/api/js/etemplate/Et2Url/Et2InvokerMixin.ts b/api/js/etemplate/Et2Url/Et2InvokerMixin.ts index 9d38cbdc65..b64ceef640 100644 --- a/api/js/etemplate/Et2Url/Et2InvokerMixin.ts +++ b/api/js/etemplate/Et2Url/Et2InvokerMixin.ts @@ -8,7 +8,7 @@ */ /* eslint-disable import/no-extraneous-dependencies */ -import {css, dedupeMixin, html, LitElement, render} from '@lion/core'; +import {css, dedupeMixin, html, LitElement, SlotMixin} from '@lion/core'; import {Et2InputWidget, Et2InputWidgetInterface} from "../Et2InputWidget/Et2InputWidget"; import {colorsDefStyles} from "../Styles/colorsDefStyles"; @@ -24,7 +24,7 @@ import {colorsDefStyles} from "../Styles/colorsDefStyles"; type Constructor = new (...args : any[]) => T; export const Et2InvokerMixin = dedupeMixin(>(superclass : T) => { - class Et2Invoker extends Et2InputWidget(superclass) + class Et2Invoker extends SlotMixin(Et2InputWidget(superclass)) { /** @type {any} */ static get properties() @@ -80,12 +80,7 @@ export const Et2InvokerMixin = dedupeMixin(>(s ...super.slots, suffix: () => { - const renderParent = document.createElement('div'); - render( - this._invokerTemplate(), - renderParent - ); - return /** @type {HTMLElement} */ (renderParent.firstElementChild); + return this._invokerTemplate(); }, }; } @@ -162,7 +157,7 @@ export const Et2InvokerMixin = dedupeMixin(>(s if (this._invokerNode) { const invokerNode = /** @type {HTMLElement & {disabled: boolean}} */ (this._invokerNode); - invokerNode.disabled = this.disabled || this._isEmpty() || this.hasFeedbackFor.length > 0; + invokerNode.disabled = this.disabled || !this.value || (this.input && !this.input.reportValidity()) } } diff --git a/api/js/etemplate/Et2Url/Et2Url.ts b/api/js/etemplate/Et2Url/Et2Url.ts index 8b389e04bd..f72cd93dc5 100644 --- a/api/js/etemplate/Et2Url/Et2Url.ts +++ b/api/js/etemplate/Et2Url/Et2Url.ts @@ -96,7 +96,7 @@ export class Et2Url extends Et2InvokerMixin(Et2Textbox) if (!value) return; // implicit add http:// if no protocol given if(value.indexOf("://") === -1) value = "http://"+value; - egw.open_link(value, '_blank'); + this.egw().open_link(value, '_blank'); } } // @ts-ignore TypeScript is not recognizing that this is a LitElement