var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import './search.js';
import './filter.js';
import './view-options.js';
import './add-row/add-row.js';
import { ShadowlessElement, WithDisposable } from '@blockeditor/lit';
import { css, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import { repeat } from 'lit/directives/repeat.js';
import { renderUniLit } from '../../../../_common/components/uni-component/uni-component.js';
import { viewRendererManager } from '../../data-view.js';
const styles = css `
  .affine-database-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 150ms cubic-bezier(0.42, 0, 1, 1);
  }

  .toolbar-hover-container:hover .affine-database-toolbar {
    visibility: visible;
    opacity: 1;
  }

  .show-toolbar {
    visibility: visible;
    opacity: 1;
  }

  @media print {
    .affine-database-toolbar {
      display: none;
    }
  }
`;
let DataViewHeaderTools = class DataViewHeaderTools extends WithDisposable(ShadowlessElement) {
    constructor() {
        super(...arguments);
        this.showToolBar = false;
    }
    render() {
        if (this.view.isDeleted) {
            return;
        }
        const classList = classMap({
            'show-toolbar': this.showToolBar,
            'affine-database-toolbar': true,
        });
        const tools = viewRendererManager.getView(this.view.type).tools;
        return html ` <div class="${classList}">
      ${repeat(tools ?? [], uni => {
            const props = {
                view: this.view,
                viewMethod: this.viewMethod,
            };
            return renderUniLit(uni, props);
        })}
    </div>`;
    }
};
DataViewHeaderTools.styles = styles;
__decorate([
    property({ attribute: false })
], DataViewHeaderTools.prototype, "viewMethod", void 0);
__decorate([
    property({ attribute: false })
], DataViewHeaderTools.prototype, "view", void 0);
__decorate([
    state()
], DataViewHeaderTools.prototype, "showToolBar", void 0);
DataViewHeaderTools = __decorate([
    customElement('data-view-header-tools')
], DataViewHeaderTools);
export { DataViewHeaderTools };
export const renderTools = (view, viewMethod) => {
    return html ` <data-view-header-tools
    .viewMethod="${viewMethod}"
    .view="${view}"
  ></data-view-header-tools>`;
};
//# sourceMappingURL=tools.js.map