Get Invoker buttons back after changing Et2Textbox base

379ceeb3e5
This commit is contained in:
nathan 2022-07-21 14:05:53 -06:00
parent 2b848622fb
commit ea20784e31
2 changed files with 5 additions and 10 deletions

View File

@ -8,7 +8,7 @@
*/ */
/* eslint-disable import/no-extraneous-dependencies */ /* 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 {Et2InputWidget, Et2InputWidgetInterface} from "../Et2InputWidget/Et2InputWidget";
import {colorsDefStyles} from "../Styles/colorsDefStyles"; import {colorsDefStyles} from "../Styles/colorsDefStyles";
@ -24,7 +24,7 @@ import {colorsDefStyles} from "../Styles/colorsDefStyles";
type Constructor<T = Et2InputWidgetInterface> = new (...args : any[]) => T; type Constructor<T = Et2InputWidgetInterface> = new (...args : any[]) => T;
export const Et2InvokerMixin = dedupeMixin(<T extends Constructor<LitElement>>(superclass : T) => export const Et2InvokerMixin = dedupeMixin(<T extends Constructor<LitElement>>(superclass : T) =>
{ {
class Et2Invoker extends Et2InputWidget(superclass) class Et2Invoker extends SlotMixin(Et2InputWidget(superclass))
{ {
/** @type {any} */ /** @type {any} */
static get properties() static get properties()
@ -80,12 +80,7 @@ export const Et2InvokerMixin = dedupeMixin(<T extends Constructor<LitElement>>(s
...super.slots, ...super.slots,
suffix: () => suffix: () =>
{ {
const renderParent = document.createElement('div'); return this._invokerTemplate();
render(
this._invokerTemplate(),
renderParent
);
return /** @type {HTMLElement} */ (renderParent.firstElementChild);
}, },
}; };
} }
@ -162,7 +157,7 @@ export const Et2InvokerMixin = dedupeMixin(<T extends Constructor<LitElement>>(s
if (this._invokerNode) if (this._invokerNode)
{ {
const invokerNode = /** @type {HTMLElement & {disabled: boolean}} */ (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())
} }
} }

View File

@ -96,7 +96,7 @@ export class Et2Url extends Et2InvokerMixin(Et2Textbox)
if (!value) return; if (!value) return;
// implicit add http:// if no protocol given // implicit add http:// if no protocol given
if(value.indexOf("://") === -1) value = "http://"+value; 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 // @ts-ignore TypeScript is not recognizing that this is a LitElement