/
dimamir
/
authentik
Обзор
Документация
Войти
/
dimamir
/
authentik
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
web/src/elements/LoadingOverlay.ts
63 строки
2 KB
Ken Sternberg
web: provide storybook demos and docs for existing tests (#11651)
14 окт 2024, 20:30
Не верифицирован
14 окт 2024, 20:30
0a1d283
Код
Авторство
О чём код?
import { AKElement } from "@goauthentik/elements/Base"; import "@goauthentik/elements/EmptyState"; import { type SlottedTemplateResult, type Spread } from "@goauthentik/elements/types"; import { spread } from "@open-wc/lit-helpers"; import { css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators.js"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; export interface ILoadingOverlay { topmost?: boolean; } @customElement("ak-loading-overlay") export class LoadingOverlay extends AKElement implements ILoadingOverlay { // Do not camelize: https://www.merriam-webster.com/dictionary/topmost @property({ type: Boolean, attribute: "topmost" }) topmost = false; static get styles() { return [ PFBase, css` :host { display: flex; height: 100%; width: 100%; justify-content: center; align-items: center; position: absolute; background-color: var(--pf-global--BackgroundColor--dark-transparent-200); z-index: 1; } :host([topmost]) { z-index: 999; } `, ]; } render() { return html`<ak-empty-state loading header=""> <span slot="body"><slot></slot></span> </ak-empty-state>`; } } export function akLoadingOverlay( properties: ILoadingOverlay, content: SlottedTemplateResult = nothing, ) { const message = typeof content === "string" ? html`<span>${content}</span>` : content; return html`<ak-loading-overlay ${spread(properties as Spread)} >${message}</ak-loading-overlay >`; } declare global { interface HTMLElementTagNameMap { "ak-loading-overlay": LoadingOverlay; } }