/* * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { BaseElement, element } from '../../../base-ui/BaseElement.js'; @element('table-no-data') export class TableNoData extends BaseElement { static get observedAttributes() { return ['noData', 'contentWidth', 'height']; } private dataSlot: HTMLDivElement | null | undefined; private noDataIcon: HTMLDivElement | null | undefined; initElements(): void { this.dataSlot = this.shadowRoot!.querySelector('.no-data'); this.noDataIcon = this.shadowRoot!.querySelector('.d-box'); } get noData() { return this.hasAttribute('noData'); } set noData(value: boolean) { if (value) { this.setAttribute('noData', ''); } else { this.removeAttribute('noData'); } } get contentWidth() { return this.getAttribute('contentWidth') || '100%'; } set contentWidth(value) { this.shadowRoot!.querySelector('.d-box')!.style.width = value; this.setAttribute('contentWidth', value); } get contentHeight() { return this.getAttribute('contentHeight') || '80%'; } set contentHeight(value) { this.shadowRoot!.querySelector('.d-box')!.style.height = value; this.setAttribute('contentHeight', value); } initHtml(): string { return `
Sorry, no data
`; } }