diff --git a/api/js/etemplate/Et2Taglist/EgwOption.ts b/api/js/etemplate/Et2Taglist/EgwOption.ts new file mode 100644 index 0000000000..67b0829207 --- /dev/null +++ b/api/js/etemplate/Et2Taglist/EgwOption.ts @@ -0,0 +1,65 @@ +/** + * EGroupware eTemplate2 - TaglistOption widget (WebComponent) + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package etemplate + * @subpackage api + * @link https://www.egroupware.org + * @author Hadi Nategh + */ + +import { LionOption } from '@lion/listbox'; +import {css, html} from "@lion/core"; + +export class EgwOption extends LionOption { + + static get properties() { + return { + ...super.properties, + title: {type: String}, + icon: {type: String} + }; + } + constructor() { + super(); + this.title = ''; + this.icon = ''; + } + + static get styles() { + return [ + ...super.styles, + css` + :host([checked]) { + visibility: hidden; + } + `, + ]; + } + + render () + { + return html` + ${this.icon + ? html` ` + : '' } + ${super.render()} + `; + } +} +customElements.define('egw-option', EgwOption); + +export class EgwOptionEmail extends EgwOption { + +} +customElements.define('egw-option-email', EgwOptionEmail); + +export class EgwOptionState extends EgwOption { + +} +customElements.define('egw-option-state', EgwOptionState); + +export class EgwOptionCategory extends EgwOption { + +} +customElements.define('egw-option-category', EgwOptionCategory); \ No newline at end of file diff --git a/api/js/etemplate/Et2Taglist/Et2Taglist.ts b/api/js/etemplate/Et2Taglist/Et2Taglist.ts index 92a82fb8d7..68ff6d33ac 100644 --- a/api/js/etemplate/Et2Taglist/Et2Taglist.ts +++ b/api/js/etemplate/Et2Taglist/Et2Taglist.ts @@ -10,17 +10,16 @@ -import {css, html, LitElement} from "@lion/core"; -import { ScopedElementsMixin } from '@open-wc/scoped-elements'; -import {TaglistOption, TaglistOptionEmail} from "./TaglistOption"; -import {TaglistComboBox} from "./TaglistComboBox"; +import {css, html, PropertyValues, render, repeat, TemplateResult} from "@lion/core"; import {Et2widgetWithSelectMixin} from "../Et2Select/Et2WidgetWithSelectMixin"; +import {LionCombobox} from "@lion/combobox"; import {TaglistSelection} from "./TaglistSelection"; +import {SelectOption} from "../Et2Select/FindSelectOptions"; /** * Taglist base class implementation */ -export class Et2Taglist extends Et2widgetWithSelectMixin(ScopedElementsMixin(LitElement)) +export class Et2Taglist extends Et2widgetWithSelectMixin(LionCombobox) { static get styles() { @@ -37,9 +36,21 @@ export class Et2Taglist extends Et2widgetWithSelectMixin(ScopedElementsMixin(Lit { return { ...super.properties, - multiple : {type : Boolean}, - + multiple: {type : Boolean}, + } + } + /** + * @type {SlotsMap} + */ + get slots() { + return { + ...super.slots, + "selection-display": () => { + return html ``; + } } } @@ -49,37 +60,42 @@ export class Et2Taglist extends Et2widgetWithSelectMixin(ScopedElementsMixin(Lit } - // can be overriden for other taglist type implementations - static get taglistOptionImp () {return TaglistOption}; - static get taglistComboboxImp () {return TaglistComboBox}; - static get taglistSelectionImp () {return TaglistSelection}; - - static get scopedElements() { - return { - 'taglist-combobox': this.taglistComboboxImp, - 'taglist-option': this.taglistOptionImp, - 'taglist-selection': this.taglistSelectionImp - }; + /** + * Get the node where we're putting the options + * + * If this were a normal selectbox, this would be just the