UNPKG

@digital-blueprint/cabinet-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/cabinet-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/cabinet-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/cabinet-app/) | [Cabinet Bundle](https://github

94 lines (79 loc) 2.77 kB
import {createInstance} from './i18n.js'; import {css, html} from 'lit'; import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import DBPCabinetLitElement from "./dbp-cabinet-lit-element"; import * as commonUtils from '@dbp-toolkit/common/utils'; import * as commonStyles from '@dbp-toolkit/common/styles'; import {Icon} from "@dbp-toolkit/common"; import {classMap} from "lit/directives/class-map.js"; import {Activity} from './activity.js'; import metadata from './dbp-cabinet-search.metadata.json'; class CabinetSearch extends ScopedElementsMixin(DBPCabinetLitElement) { constructor() { super(); this._i18n = createInstance(); this.lang = this._i18n.language; this.activity = new Activity(metadata); this.entryPointUrl = ''; } static get scopedElements() { return { 'dbp-icon': Icon, }; } static get properties() { return { ...super.properties, lang: {type: String}, entryPointUrl: { type: String, attribute: 'entry-point-url' }, }; } update(changedProperties) { changedProperties.forEach((oldValue, propName) => { switch (propName) { case 'lang': this._i18n.changeLanguage(this.lang); if (this.cabinetRequestsTable) { this.cabinetRequestsTable.setLocale(this.lang); } break; } }); super.update(changedProperties); } disconnectedCallback() { super.disconnectedCallback(); } connectedCallback() { super.connectedCallback(); this._loginStatus = ''; this._loginState = []; this.updateComplete.then(() => { }); } static get styles() { // language=css return css` ${commonStyles.getThemeCSS()} ${commonStyles.getGeneralCSS(false)} ${commonStyles.getLinkCss()} ${commonStyles.getNotificationCSS()} ${commonStyles.getActivityCSS()} ${commonStyles.getModalDialogCSS()} ${commonStyles.getButtonCSS()} ${commonStyles.getRadioAndCheckboxCss()} `; } render() { const i18n = this._i18n; return html` <div class="control ${classMap({hidden: this.isLoggedIn() || !this.isLoading() || !this.loadingTranslations })}"> <span class="loading"> <dbp-mini-spinner text=${i18n.t('loading-message')}></dbp-mini-spinner> </span> </div> Implementation here `; } } commonUtils.defineCustomElement('dbp-cabinet-search', CabinetSearch);