1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { LitTable } from '../../../../base-ui/table/lit-table.js'; 17 18export function resizeObserver( 19 parentEl: HTMLElement, 20 tableEl: LitTable, 21 tblOffsetHeight: number = 45, 22 loadingPage?: HTMLElement, 23 loadingPageOffsetHeight: number = 24 24) { 25 new ResizeObserver((entries) => { 26 if (parentEl.clientHeight != 0) { 27 // @ts-ignore 28 tableEl?.shadowRoot.querySelector('.table').style.height = parentEl.clientHeight - tblOffsetHeight + 'px'; 29 tableEl?.reMeauseHeight(); 30 if (loadingPage) { 31 loadingPage.style.height = parentEl.clientHeight - loadingPageOffsetHeight + 'px'; 32 } 33 } 34 }).observe(parentEl); 35} 36 37export function showButtonMenu(filter: any, isShow: boolean) { 38 if (isShow) { 39 filter.setAttribute('tree', ''); 40 filter.setAttribute('input', ''); 41 filter.setAttribute('inputLeftText', ''); 42 } else { 43 filter.removeAttribute('tree'); 44 filter.removeAttribute('input'); 45 filter.removeAttribute('inputLeftText'); 46 } 47} 48