import { c as o } from "../../chunks/runtime.js";
import { usePropertyChange as h } from "@arcgis/lumina/controllers";
import { reEmitEvent as i } from "@arcgis/lumina/controllers/accessor";
import s from "@geoscene/core/layers/Layer.js";
import a from "@geoscene/core/widgets/FeatureTable.js";
import { LitElement as d, createEvent as l, noShadowRoot as r } from "@arcgis/lumina";
import { m as g } from "../../chunks/useWidget.js";
import { e as m, g as c } from "../../chunks/component-utils.js";
import { css as u } from "@lit/reactive-element/css-tag.js";
/*! All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
v4.33.18 */
const w = u`@layer{geoscene-feature-table{display:block}.geoscene-feature-table{width:100%;height:100%}}`, p = g(a);
class b extends d {
  constructor() {
    super(...arguments), this.widget = p(this), this.viewModel = this.widget.viewModel, this.attachmentsColumns = this.widget.attachmentsColumns, this.attributeTableTemplate = this.widget.attributeTableTemplate, this.actionColumn = this.widget.actionColumn, this.actionColumnConfig = this.widget.actionColumnConfig, this.activeFilters = this.widget.activeFilters, this.activeSortOrders = this.widget.activeSortOrders, this.allColumns = this.widget.allColumns, this.allRelatedTablesVisible = this.widget.allRelatedTablesVisible, this.allVisibleColumns = this.widget.allVisibleColumns, this.attachmentsEnabled = this.widget.attachmentsEnabled, this.attachmentsViewOptions = this.widget.attachmentsViewOptions, this.autoDestroyDisabled = !1, this.autoRefreshDisabled = this.widget.autoRefreshEnabled, this.columnPerformanceModeDisabled = this.widget.columnPerformanceModeEnabled, this.columnReorderingDisabled = this.widget.columnReorderingEnabled, this.columns = this.widget.columns, this.definitionExpression = this.widget.definitionExpression, this.description = this.widget.description, this.editingEnabled = this.widget.editingEnabled, this.effectiveSize = this.widget.effectiveSize, this.fieldColumns = this.widget.fieldColumns, this.filterBySelectionEnabled = this.widget.filterBySelectionEnabled, this.filterGeometry = this.widget.filterGeometry, this.groupColumns = this.widget.groupColumns, this.hideColumnDescriptions = this.widget.visibleElements.columnDescriptions, this.hiddenFields = this.widget.hiddenFields, this.hideColumnMenuItemsSortAscending = this.widget.visibleElements.columnMenuItems.sortAscending, this.hideColumnMenuItemsSortDescending = this.widget.visibleElements.columnMenuItems.sortDescending, this.hideColumnMenus = this.widget.visibleElements.columnMenus, this.hideHeader = this.widget.visibleElements.header, this.hideLayerDropdownIcons = this.widget.visibleElements.layerDropdownIcons, this.hideMenu = this.widget.visibleElements.menu, this.hideMenuItemsClearSelection = this.widget.visibleElements.menuItems.clearSelection, this.hideMenuItemsDeleteSelection = this.widget.visibleElements.menuItems.deleteSelection, this.hideMenuItemsExportSelectionToCsv = this.widget.visibleElements.menuItems.exportSelectionToCSV, this.hideMenuItemsRefreshData = this.widget.visibleElements.menuItems.refreshData, this.hideMenuItemsSelectedRecordsShowAllToggle = this.widget.visibleElements.menuItems.selectedRecordsShowAllToggle, this.hideMenuItemsSelectedRecordsShowSelectedToggle = this.widget.visibleElements.menuItems.selectedRecordsShowSelectedToggle, this.hideMenuItemsToggleColumns = this.widget.visibleElements.menuItems.toggleColumns, this.hideMenuItemsZoomToSelection = this.widget.visibleElements.menuItems.zoomToSelection, this.hideProgress = this.widget.visibleElements.progress, this.hideSelectionColumn = this.widget.visibleElements.selectionColumn, this.hideTooltips = this.widget.visibleElements.tooltips, this.highlightDisabled = this.widget.highlightEnabled, this.highlightIds = this.widget.highlightIds, this.initialSize = this.widget.initialSize, this.icon = this.widget.icon, this.isQueryingOrSyncing = this.widget.isQueryingOrSyncing, this.label = this.widget.label, this.layer = this.widget.layer, this.layerView = this.widget.layerView, this.layers = this.widget.layers, this.maxSize = this.widget.maxSize, this.menuConfig = this.widget.menuConfig, this.multipleSelectionDisabled = this.widget.multipleSelectionEnabled, this.multipleSortEnabled = this.widget.multiSortEnabled, this.multipleSortPriority = this.widget.multipleSortPriority, this.navigationScale = this.widget.navigationScale, this.noDataMessage = this.widget.noDataMessage, this.objectIds = this.widget.objectIds, this.outFields = this.widget.outFields, this.pageCount = this.widget.pageCount, this.pageIndex = this.widget.pageIndex, this.pageSize = this.widget.pageSize, this.paginationEnabled = this.widget.paginationEnabled, this.position = "manual", this.relatedRecordsEnabled = this.widget.relatedRecordsEnabled, this.relatedTable = this.widget.relatedTable, this.relatedTables = this.widget.relatedTables, this.relationshipColumns = this.widget.relationshipColumns, this.returnGeometryEnabled = this.widget.returnGeometryEnabled, this.returnMEnabled = this.widget.returnMEnabled, this.returnZEnabled = this.widget.returnZEnabled, this.rowHighlightIds = this.widget.rowHighlightIds, this.size = this.widget.size, this.showLayerDropdown = this.widget.visibleElements.layerDropdown, this.state = this.widget.state, this.supportsAddAttachments = this.widget.supportsAddAttachments, this.supportsAttachments = this.widget.supportsAttachments, this.supportsDeleteAttachments = this.widget.supportsDeleteAttachments, this.supportsResizeAttachments = this.widget.supportsResizeAttachments, this.supportsUpdateAttachments = this.widget.supportsUpdateAttachments, this.syncTemplateOnChangesDisabled = this.widget.syncTemplateOnChangesEnabled, this.tableController = this.widget.tableController, this.tableDisabled = this.widget.disabled, this.tableParent = this.widget.tableParent, this.tableTemplate = this.widget.tableTemplate, this.timeExtent = this.widget.timeExtent, this.timeZone = this.widget.timeZone, this.visibleColumns = this.widget.visibleColumns, this.geosceneCellClick = i(() => this.widget, "cell-click"), this.geosceneCellKeydown = i(() => this.widget, "cell-keydown"), this.geosceneCellPointerout = i(() => this.widget, "cell-pointerout"), this.geosceneCellPointerover = i(() => this.widget, "cell-pointerover"), this.geosceneColumnReorder = i(() => this.widget, "column-reorder"), this.geoscenePropertyChange = h()("effectiveSize", "isQueryingOrSyncing", "layerView", "size", "state"), this.geosceneReady = l(), this.geosceneSelectionChange = l();
  }
  static {
    this.properties = { attachmentsColumns: 0, attributeTableTemplate: 0, actionColumn: 0, actionColumnConfig: 0, activeFilters: 0, activeSortOrders: 0, allColumns: 0, allRelatedTablesVisible: 4, allVisibleColumns: 0, attachmentsEnabled: 5, attachmentsViewOptions: 0, autoDestroyDisabled: 5, autoRefreshDisabled: 5, columnPerformanceModeDisabled: 5, columnReorderingDisabled: 5, columns: 0, definitionExpression: 1, description: 1, editingEnabled: 5, effectiveSize: 8, fieldColumns: 0, filterBySelectionEnabled: 5, filterGeometry: 0, groupColumns: 0, hideColumnDescriptions: 5, hiddenFields: 0, hideColumnMenuItemsSortAscending: 5, hideColumnMenuItemsSortDescending: 5, hideColumnMenus: 5, hideHeader: 5, hideLayerDropdownIcons: 5, hideMenu: 5, hideMenuItemsClearSelection: 5, hideMenuItemsDeleteSelection: 5, hideMenuItemsExportSelectionToCsv: 5, hideMenuItemsRefreshData: 5, hideMenuItemsSelectedRecordsShowAllToggle: 5, hideMenuItemsSelectedRecordsShowSelectedToggle: 5, hideMenuItemsToggleColumns: 5, hideMenuItemsZoomToSelection: 5, hideProgress: 5, hideSelectionColumn: 5, hideTooltips: 5, highlightDisabled: 5, highlightIds: 0, initialSize: 9, icon: 1, isQueryingOrSyncing: 4, label: 1, layer: 0, layerItemId: 1, layerUrl: 1, layerView: 0, layers: 0, maxSize: 9, menuConfig: 0, multipleSelectionDisabled: 5, multipleSortEnabled: 5, multipleSortPriority: 1, navigationScale: 1, noDataMessage: 1, objectIds: 0, outFields: 0, pageCount: 8, pageIndex: 9, pageSize: 9, paginationEnabled: 5, position: 1, referenceElement: 1, relatedRecordsEnabled: 5, relatedTable: 0, relatedTables: 0, relationshipColumns: 0, returnGeometryEnabled: 5, returnMEnabled: 5, returnZEnabled: 5, rowHighlightIds: 0, size: 8, showLayerDropdown: 5, state: 3, supportsAddAttachments: 4, supportsAttachments: 4, supportsDeleteAttachments: 4, supportsResizeAttachments: 4, supportsUpdateAttachments: 4, syncTemplateOnChangesDisabled: 5, tableController: 0, tableDisabled: 5, tableParent: 0, tableTemplate: 0, timeExtent: 0, timeZone: 1, visibleColumns: 0 };
  }
  static {
    this.shadowRootOptions = r;
  }
  static {
    this.styles = w;
  }
  async deleteSelection(e) {
    await this.widget?.deleteSelection(e);
  }
  async destroy() {
    await this.manager.destroy();
  }
  async exportSelectionToCSV(e) {
    await this.widget?.exportSelectionToCSV(e);
  }
  async findColumn(e) {
    return this.widget?.findColumn(e);
  }
  async goToPage(e) {
    this.widget.goToPage(e);
  }
  async hideColumn(e) {
    this.widget?.hideColumn(e);
  }
  async nextPage() {
    this.widget.nextPage();
  }
  async previousPage() {
    this.widget.previousPage();
  }
  async refresh() {
    await this.widget?.refresh();
  }
  async scrollToBottom() {
    this.widget.scrollToBottom();
  }
  async scrollToIndex(e) {
    this.widget?.scrollToIndex(e);
  }
  async scrollToLeft() {
    this.widget.scrollLeft();
  }
  async scrollToRow(e) {
    this.widget?.scrollToRow(e);
  }
  async scrollToTop() {
    this.widget.scrollToTop();
  }
  async showAllColumns() {
    this.widget?.showAllColumns();
  }
  async showColumn(e) {
    this.widget?.showColumn(e);
  }
  async sortColumn(e, t) {
    this.widget?.sortColumn(e, t);
  }
  async zoomToSelection() {
    this.widget?.zoomToSelection();
  }
  load() {
    this.manager.onLifecycle(() => this.widget.highlightIds.on("change", this.geosceneSelectionChange.emit));
  }
  willUpdate(e) {
    if (e.has("layerItemId") && (m(this.layerItemId) ? this.layer = null : this.layerItemId && s.fromPortalItem({
      portalItem: {
        id: this.layerItemId
      }
    }).then((t) => {
      this.layer = t;
    }).catch(console.error)), e.has("layerUrl")) {
      const t = this.layerUrl;
      t ? s.fromGeoSceneServerUrl({
        url: t
      }).then((n) => {
        this.layer = n;
      }).catch(console.error) : this.layer = null;
    }
  }
  loaded() {
    c(this)?.classList.add("geoscene-feature-table");
  }
}
o("geoscene-feature-table", b);
export {
  b as GeosceneFeatureTable
};