@timlassiter11/yatl 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -39,7 +39,6 @@ __export(src_exports, {
39
39
  YatlStateChangeEvent: () => YatlStateChangeEvent,
40
40
  YatlTable: () => YatlTable,
41
41
  createRegexTokenizer: () => createRegexTokenizer,
42
- findColumn: () => findColumn,
43
42
  whitespaceTokenizer: () => whitespaceTokenizer
44
43
  });
45
44
  module.exports = __toCommonJS(src_exports);
@@ -228,6 +227,9 @@ function widthsToGridTemplates(widths, defaultWidth = "1fr") {
228
227
  function isCompareable(value) {
229
228
  return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value instanceof Date;
230
229
  }
230
+ function isDisplayColumn(col) {
231
+ return col?.role !== "internal";
232
+ }
231
233
 
232
234
  // src/yatl-table.ts
233
235
  var import_lit3 = require("lit");
@@ -343,7 +345,8 @@ var yatl_table_styles_default = import_lit2.css`
343
345
  border-bottom: none;
344
346
  }
345
347
 
346
- .header .cell::after,
348
+ .header.reorderable .cell::after,
349
+ .header .cell.sortable::after,
347
350
  .row:not(.header)::after {
348
351
  content: '';
349
352
  position: absolute;
@@ -404,7 +407,8 @@ var yatl_table_styles_default = import_lit2.css`
404
407
  :host {
405
408
  display: block;
406
409
  height: 100%;
407
- width: 100%;
410
+ width: fit-content;
411
+ overflow: auto;
408
412
  }
409
413
 
410
414
  .table {
@@ -499,7 +503,7 @@ var yatl_table_styles_default = import_lit2.css`
499
503
  flex-shrink: 0;
500
504
 
501
505
  position: sticky;
502
- bottom: 0;
506
+ inset: 0;
503
507
  z-index: var(--header-z-index);
504
508
  }
505
509
 
@@ -570,12 +574,12 @@ var YatlTable = class extends import_lit3.LitElement {
570
574
  this._enableSearchTokenization = false;
571
575
  this._enableSearchScoring = false;
572
576
  this._columns = [];
573
- this._columnStates = [];
577
+ this._columnDefinitionMap = /* @__PURE__ */ new Map();
578
+ this._columnStateMap = /* @__PURE__ */ new Map();
574
579
  this._columnOrder = [];
575
580
  this._storageOptions = null;
576
581
  this._data = [];
577
582
  this._searchQuery = "";
578
- this._searchIncludedFields = [];
579
583
  this._searchTokenizer = whitespaceTokenizer;
580
584
  this._filters = null;
581
585
  this._filteredData = [];
@@ -598,6 +602,8 @@ var YatlTable = class extends import_lit3.LitElement {
598
602
  this.resizeState = null;
599
603
  // Column drag & drop state
600
604
  this.dragColumn = null;
605
+ this.sortable = false;
606
+ this.resizable = false;
601
607
  this.enableVirtualScroll = false;
602
608
  this.enableSearchHighlight = true;
603
609
  this.enableColumnReorder = true;
@@ -609,12 +615,11 @@ var YatlTable = class extends import_lit3.LitElement {
609
615
  // #endregion
610
616
  // #region --- Event Handlers ---
611
617
  this.handleHeaderClicked = (event, column) => {
612
- const target = event.target;
613
- if (!column.sortable || target.classList.contains("resizer")) {
618
+ if (this.resizeState) {
614
619
  return;
615
620
  }
616
621
  const multiSort = event.shiftKey;
617
- const state2 = this.getColumnState(column.field);
622
+ const state2 = this.getOrCreateColumnState(column.field);
618
623
  if (!state2?.sort) {
619
624
  this.sort(column.field, "asc", !multiSort);
620
625
  } else if (state2.sort.order === "asc") {
@@ -641,11 +646,13 @@ var YatlTable = class extends import_lit3.LitElement {
641
646
  );
642
647
  });
643
648
  };
644
- this.handleResizeMouseUp = (_event) => {
649
+ this.handleResizeMouseUp = (event) => {
645
650
  window.removeEventListener("mousemove", this.handleResizeMouseMove);
646
651
  window.removeEventListener("mouseup", this.handleResizeMouseUp);
647
652
  document.body.style.cursor = "";
648
653
  if (this.resizeState?.active) {
654
+ event.preventDefault();
655
+ event.stopPropagation();
649
656
  const finalWidth = parseFloat(
650
657
  this.resizeState.currentWidths[this.resizeState.columnIndex]
651
658
  );
@@ -655,7 +662,9 @@ var YatlTable = class extends import_lit3.LitElement {
655
662
  this.columnWidths = columnWidths;
656
663
  this.dispatchEvent(new YatlColumnResizeEvent(state2.field, state2.width));
657
664
  }
658
- this.resizeState = null;
665
+ setTimeout(() => {
666
+ this.resizeState = null;
667
+ });
659
668
  };
660
669
  this.handleDragColumnStart = (event, field) => {
661
670
  const target = event.target;
@@ -698,7 +707,7 @@ var YatlTable = class extends import_lit3.LitElement {
698
707
  const dropIndex = newColumnOrder.findIndex((col) => col === field);
699
708
  if (dragIndex > -1 && dropIndex > -1) {
700
709
  const [draggedColumn] = newColumnOrder.splice(dragIndex, 1);
701
- const droppedColumn = findColumn(field, this.columns);
710
+ const droppedColumn = this.getColumn(field);
702
711
  if (!droppedColumn) return;
703
712
  newColumnOrder.splice(dropIndex, 0, draggedColumn);
704
713
  const reorderEvent = new YatlColumnReorderEvent(
@@ -752,17 +761,24 @@ var YatlTable = class extends import_lit3.LitElement {
752
761
  const oldValue = this._columns;
753
762
  this._columns = columns;
754
763
  this.filterDirty = true;
764
+ this._columnDefinitionMap = /* @__PURE__ */ new Map();
765
+ for (const column of this.columns) {
766
+ this._columnDefinitionMap.set(column.field, column);
767
+ }
755
768
  this.requestUpdate("columns", oldValue);
756
769
  }
770
+ get displayColumns() {
771
+ return this._columns.filter(isDisplayColumn);
772
+ }
757
773
  get columnOrder() {
758
774
  const finalOrder = /* @__PURE__ */ new Set();
759
775
  for (const field of this._columnOrder) {
760
- const col = findColumn(field, this.columns);
776
+ const col = this.getDisplayColumn(field);
761
777
  if (col) {
762
778
  finalOrder.add(field);
763
779
  }
764
780
  }
765
- for (const col of this.columns) {
781
+ for (const col of this.displayColumns) {
766
782
  if (!finalOrder.has(col.field)) {
767
783
  finalOrder.add(col.field);
768
784
  }
@@ -780,15 +796,15 @@ var YatlTable = class extends import_lit3.LitElement {
780
796
  get columnVisibility() {
781
797
  return this.columnOrder.map((field) => ({
782
798
  field,
783
- visible: this.getColumnState(field).visible
799
+ visible: this.getOrCreateColumnState(field).visible
784
800
  }));
785
801
  }
786
802
  set columnVisibility(columns) {
787
803
  const oldValue = this.columnVisibility;
788
804
  let changed = false;
789
805
  for (const column of columns) {
790
- const columnState = this.getColumnState(column.field);
791
- if (columnState && columnState.visible !== column.visible) {
806
+ const columnState = this.getOrCreateColumnState(column.field);
807
+ if (columnState.visible !== column.visible) {
792
808
  changed = true;
793
809
  columnState.visible = column.visible;
794
810
  }
@@ -800,7 +816,7 @@ var YatlTable = class extends import_lit3.LitElement {
800
816
  }
801
817
  get columnSort() {
802
818
  return this.columnOrder.map((field) => {
803
- const sortState = this.getColumnState(field).sort;
819
+ const sortState = this.getOrCreateColumnState(field).sort;
804
820
  return {
805
821
  field,
806
822
  // We need to make a copy of sort state so
@@ -813,7 +829,7 @@ var YatlTable = class extends import_lit3.LitElement {
813
829
  const oldValue = this.columnSort;
814
830
  let changed = false;
815
831
  for (const column of columns) {
816
- const columnState = this.getColumnState(column.field);
832
+ const columnState = this.getOrCreateColumnState(column.field);
817
833
  if (columnState && (columnState.sort?.order !== column.sort?.order || columnState.sort?.priority !== column.sort?.priority)) {
818
834
  changed = true;
819
835
  columnState.sort = column.sort;
@@ -828,15 +844,15 @@ var YatlTable = class extends import_lit3.LitElement {
828
844
  get columnWidths() {
829
845
  return this.columnOrder.map((field) => ({
830
846
  field,
831
- width: this.getColumnState(field).width
847
+ width: this.getOrCreateColumnState(field).width
832
848
  }));
833
849
  }
834
850
  set columnWidths(columns) {
835
851
  const oldValue = this.columnWidths;
836
852
  let changed = false;
837
853
  for (const column of columns) {
838
- const columnState = this.getColumnState(column.field);
839
- if (columnState && columnState.width !== column.width) {
854
+ const columnState = this.getOrCreateColumnState(column.field);
855
+ if (columnState.width !== column.width) {
840
856
  changed = true;
841
857
  columnState.width = column.width;
842
858
  }
@@ -859,18 +875,6 @@ var YatlTable = class extends import_lit3.LitElement {
859
875
  this.filterDirty = true;
860
876
  this.requestUpdate("searchQuery", oldValue);
861
877
  }
862
- get searchIncludedFields() {
863
- return this._searchIncludedFields;
864
- }
865
- set searchIncludedFields(fields) {
866
- if (this._searchIncludedFields === fields) {
867
- return;
868
- }
869
- const oldValue = this._searchIncludedFields;
870
- this._searchIncludedFields = fields;
871
- this.filterDirty = true;
872
- this.requestUpdate("searchIncludedFields", oldValue);
873
- }
874
878
  get searchTokenizer() {
875
879
  return this._searchTokenizer;
876
880
  }
@@ -932,6 +936,15 @@ var YatlTable = class extends import_lit3.LitElement {
932
936
  }
933
937
  // #endregion
934
938
  // #region --- Public Methods ---
939
+ getColumn(field) {
940
+ return this._columnDefinitionMap.get(field);
941
+ }
942
+ getDisplayColumn(field) {
943
+ const column = this._columnDefinitionMap.get(field);
944
+ if (column && isDisplayColumn(column)) {
945
+ return column;
946
+ }
947
+ }
935
948
  /**
936
949
  * Gets a copy of the current state of the table.
937
950
  */
@@ -941,7 +954,7 @@ var YatlTable = class extends import_lit3.LitElement {
941
954
  filters: this.filters,
942
955
  columnOrder: this.columnOrder,
943
956
  columns: this.columns.map((column) => {
944
- const state2 = this.getColumnState(column.field);
957
+ const state2 = this.getOrCreateColumnState(column.field);
945
958
  return {
946
959
  field: column.field,
947
960
  visible: state2.visible,
@@ -966,10 +979,8 @@ var YatlTable = class extends import_lit3.LitElement {
966
979
  this.columnOrder = state2.columnOrder;
967
980
  }
968
981
  if ("columns" in state2 && state2.columns !== void 0) {
969
- const newColumnStates = [];
970
982
  for (const newState of state2.columns) {
971
- const currentState = this.getColumnState(newState.field);
972
- newColumnStates.push(currentState);
983
+ const currentState = this.getOrCreateColumnState(newState.field);
973
984
  if (!newState) {
974
985
  continue;
975
986
  }
@@ -983,7 +994,6 @@ var YatlTable = class extends import_lit3.LitElement {
983
994
  currentState.width = newState.width;
984
995
  }
985
996
  }
986
- this._columnStates = newColumnStates;
987
997
  this.requestUpdate();
988
998
  }
989
999
  }
@@ -1043,15 +1053,15 @@ var YatlTable = class extends import_lit3.LitElement {
1043
1053
  return;
1044
1054
  }
1045
1055
  state2.visible = visible;
1046
- this.columnVisibility = visibilityStates;
1056
+ this.columnVisibility = [...visibilityStates];
1047
1057
  }
1048
1058
  /**
1049
1059
  * Toggles the visibility of hte specified column
1050
1060
  * @param field - The field name of the column to toggle.
1051
1061
  */
1052
1062
  toggleColumnVisibility(field) {
1053
- const state2 = this.getColumnState(field);
1054
- this.setColumnVisibility(field, !state2);
1063
+ const state2 = this.getOrCreateColumnState(field);
1064
+ this.setColumnVisibility(field, !state2.visible);
1055
1065
  }
1056
1066
  /**
1057
1067
  * Shows the specified column
@@ -1074,16 +1084,16 @@ var YatlTable = class extends import_lit3.LitElement {
1074
1084
  */
1075
1085
  export(filename, all = false) {
1076
1086
  const data = all ? this.data : this.filteredData;
1077
- const rows = [...data.values()];
1078
- const columnData = this.columnData;
1079
- const csvHeaders = columnData.filter((col) => all || col.state?.visible).map((col) => `"${col.options.title}"`).join(",");
1080
- const csvRows = rows.map((row) => {
1087
+ const columnData = this.displayColumns;
1088
+ const csvHeaders = columnData.filter((column) => all || this.getOrCreateColumnState(column.field).visible).map((column) => `"${column.title}"`).join(",");
1089
+ const csvRows = data.map((row) => {
1081
1090
  const list = [];
1082
- for (const col of columnData) {
1083
- let value = getNestedValue(row, col.field);
1084
- if (all || col.state.visible) {
1085
- if (typeof col.options.valueFormatter === "function") {
1086
- value = col.options.valueFormatter(value, row);
1091
+ for (const column of columnData) {
1092
+ const state2 = this.getOrCreateColumnState(column.field);
1093
+ let value = getNestedValue(row, column.field);
1094
+ if (all || state2.visible) {
1095
+ if (typeof column.valueFormatter === "function") {
1096
+ value = column.valueFormatter(value, row);
1087
1097
  }
1088
1098
  value = String(value).replace('"', '""');
1089
1099
  list.push(`"${value}"`);
@@ -1218,7 +1228,7 @@ var YatlTable = class extends import_lit3.LitElement {
1218
1228
  // #endregion
1219
1229
  // #region --- Render Methods ---
1220
1230
  renderColumnSortIcon(column, state2) {
1221
- return column.sortable ? import_lit3.html`<div
1231
+ return column.sortable ?? this.sortable ? import_lit3.html`<div
1222
1232
  part="header-sort-icon"
1223
1233
  class=${(0, import_class_map.classMap)({
1224
1234
  "sort-icon": true,
@@ -1228,7 +1238,7 @@ var YatlTable = class extends import_lit3.LitElement {
1228
1238
  ></div>` : import_lit3.nothing;
1229
1239
  }
1230
1240
  renderColumnResizer(column, _state) {
1231
- return column.resizable ? import_lit3.html`<div
1241
+ return column.resizable ?? this.resizable ? import_lit3.html`<div
1232
1242
  part="header-resizer"
1233
1243
  class="resizer"
1234
1244
  @click=${(event) => event.stopPropagation()}
@@ -1236,9 +1246,12 @@ var YatlTable = class extends import_lit3.LitElement {
1236
1246
  ></div>` : import_lit3.nothing;
1237
1247
  }
1238
1248
  renderHeaderCell(field) {
1239
- const column = findColumn(field, this.columns);
1240
- const state2 = this.getColumnState(column.field);
1241
- if (state2.visible == false) {
1249
+ const column = this.getDisplayColumn(field);
1250
+ if (!column) {
1251
+ return import_lit3.nothing;
1252
+ }
1253
+ const state2 = this.getOrCreateColumnState(field);
1254
+ if (!state2.visible) {
1242
1255
  return import_lit3.nothing;
1243
1256
  }
1244
1257
  return import_lit3.html`
@@ -1246,7 +1259,7 @@ var YatlTable = class extends import_lit3.LitElement {
1246
1259
  part="cell header-cell"
1247
1260
  class=${(0, import_class_map.classMap)({
1248
1261
  cell: true,
1249
- sortable: column.sortable ?? false
1262
+ sortable: column.sortable ?? this.sortable
1250
1263
  })}
1251
1264
  draggable=${(0, import_if_defined.ifDefined)(this.enableColumnReorder ? true : void 0)}
1252
1265
  data-field=${column.field}
@@ -1270,8 +1283,13 @@ var YatlTable = class extends import_lit3.LitElement {
1270
1283
  `;
1271
1284
  }
1272
1285
  renderHeader() {
1286
+ const classes = {
1287
+ "header": true,
1288
+ "row": true,
1289
+ "reorderable": this.enableColumnReorder
1290
+ };
1273
1291
  return import_lit3.html`
1274
- <div part="header" class="header row">
1292
+ <div part="header" class=${(0, import_class_map.classMap)(classes)}>
1275
1293
  ${this.columnOrder.map((field) => this.renderHeaderCell(field))}
1276
1294
  </div>
1277
1295
  `;
@@ -1287,11 +1305,14 @@ var YatlTable = class extends import_lit3.LitElement {
1287
1305
  return this.enableSearchHighlight && indices ? highlightText(String(value), indices[column.field]) : value;
1288
1306
  }
1289
1307
  renderCell(field, row) {
1290
- const column = findColumn(field, this.columns);
1291
- const state2 = this.getColumnState(column.field);
1292
- if (!state2.visible) {
1308
+ const column = this.getDisplayColumn(field);
1309
+ if (!column) {
1293
1310
  return import_lit3.nothing;
1294
1311
  }
1312
+ const state2 = this.getOrCreateColumnState(field);
1313
+ if (!state2.visible) {
1314
+ return;
1315
+ }
1295
1316
  let value = getNestedValue(row, column.field);
1296
1317
  let userParts = column.cellParts?.call(this, value, column.field, row);
1297
1318
  if (Array.isArray(userParts)) {
@@ -1565,8 +1586,8 @@ var YatlTable = class extends import_lit3.LitElement {
1565
1586
  return false;
1566
1587
  }
1567
1588
  } else {
1568
- const col = findColumn(field, this.columns);
1569
- const filterCallback = col ? col.filter : void 0;
1589
+ const column = this.getColumn(field);
1590
+ const filterCallback = column ? column.filter : void 0;
1570
1591
  if (!this.filterField(value, filter, filterCallback)) {
1571
1592
  return false;
1572
1593
  }
@@ -1575,8 +1596,8 @@ var YatlTable = class extends import_lit3.LitElement {
1575
1596
  return true;
1576
1597
  }
1577
1598
  filterRows() {
1578
- const searchableFields = [...this.columnData.values()].filter((col) => col.options.searchable).map((c) => c.field);
1579
- const fields = [...searchableFields, ...this.searchIncludedFields];
1599
+ const columnData = [...this.columns];
1600
+ const fields = columnData.filter((column) => column.searchable).map((column) => column.field);
1580
1601
  this._filteredData = this.data.filter((row, index) => {
1581
1602
  const metadata = this.rowMetadata.get(row);
1582
1603
  metadata.searchScore = 0;
@@ -1615,22 +1636,18 @@ var YatlTable = class extends import_lit3.LitElement {
1615
1636
  // #region --- Sort Methods ---
1616
1637
  compareRows(a, b, field) {
1617
1638
  let aValue, bValue;
1618
- const columnData = findColumn(field, this.columnData);
1619
- if (!columnData.state.sort) {
1639
+ const state2 = this.getOrCreateColumnState(field);
1640
+ if (!state2.sort) {
1620
1641
  return 0;
1621
1642
  }
1622
1643
  const aMetadata = this.rowMetadata.get(a);
1623
1644
  const bMetadata = this.rowMetadata.get(b);
1624
- if (columnData.state.sort?.order === "asc") {
1625
- aValue = aMetadata.sortValues[columnData.field];
1626
- bValue = bMetadata.sortValues[columnData.field];
1645
+ if (state2.sort?.order === "asc") {
1646
+ aValue = aMetadata.sortValues[field];
1647
+ bValue = bMetadata.sortValues[field];
1627
1648
  } else {
1628
- aValue = bMetadata.sortValues[columnData.field];
1629
- bValue = aMetadata.sortValues[columnData.field];
1630
- }
1631
- if (typeof columnData.options.sorter === "function") {
1632
- const ret = columnData.options.sorter(aValue, bValue);
1633
- if (ret !== 0) return ret;
1649
+ aValue = bMetadata.sortValues[field];
1650
+ bValue = aMetadata.sortValues[field];
1634
1651
  }
1635
1652
  const aIsNull = aValue == null;
1636
1653
  const bIsNull = bValue == null;
@@ -1645,7 +1662,7 @@ var YatlTable = class extends import_lit3.LitElement {
1645
1662
  this.filterRows();
1646
1663
  return;
1647
1664
  }
1648
- const sortedColumns = this.columnData.filter((col) => col.state.visible && col.state.sort).sort((a, b) => b.state.sort.priority - a.state.sort.priority);
1665
+ const sortedStates = [...this._columnStateMap.values()].filter((state2) => state2.visible && state2.sort).sort((a, b) => b.sort.priority - a.sort.priority);
1649
1666
  this._filteredData = this._filteredData.toSorted((a, b) => {
1650
1667
  const aMetadata = this.rowMetadata.get(a);
1651
1668
  const bMetadata = this.rowMetadata.get(b);
@@ -1655,8 +1672,8 @@ var YatlTable = class extends import_lit3.LitElement {
1655
1672
  if (aValue > bValue) return -1;
1656
1673
  if (aValue < bValue) return 1;
1657
1674
  }
1658
- for (const col of sortedColumns) {
1659
- const comp = this.compareRows(a, b, col.field);
1675
+ for (const state2 of sortedStates) {
1676
+ const comp = this.compareRows(a, b, state2.field);
1660
1677
  if (comp !== 0) {
1661
1678
  return comp;
1662
1679
  }
@@ -1680,8 +1697,8 @@ var YatlTable = class extends import_lit3.LitElement {
1680
1697
  this.rowMetadata.set(row, metadata);
1681
1698
  for (const column of this.columns) {
1682
1699
  const value = getNestedValue(row, column.field);
1683
- if (typeof column.sortValue === "function") {
1684
- metadata.sortValues[column.field] = column.sortValue(value);
1700
+ if (typeof column.sorter === "function") {
1701
+ metadata.sortValues[column.field] = column.sorter(value);
1685
1702
  } else if (typeof value === "string") {
1686
1703
  metadata.sortValues[column.field] = value.toLocaleLowerCase();
1687
1704
  } else if (isCompareable(value)) {
@@ -1699,12 +1716,6 @@ var YatlTable = class extends import_lit3.LitElement {
1699
1716
  );
1700
1717
  }
1701
1718
  }
1702
- for (const field of this.searchIncludedFields) {
1703
- const value = getNestedValue(row, field);
1704
- if (typeof value === "string") {
1705
- metadata.searchValues[field] = value.toLocaleLowerCase();
1706
- }
1707
- }
1708
1719
  }
1709
1720
  }
1710
1721
  updateInternalQuery() {
@@ -1719,19 +1730,12 @@ var YatlTable = class extends import_lit3.LitElement {
1719
1730
  this.queryTokens.push(...this.searchTokenizer(this.searchQuery));
1720
1731
  }
1721
1732
  }
1722
- get columnData() {
1723
- return this.columns.map((column) => ({
1724
- field: column.field,
1725
- options: column,
1726
- state: this.getColumnState(column.field)
1727
- }));
1728
- }
1729
1733
  /**
1730
1734
  * Gets the width of each column in the
1731
1735
  * order they will appear in the grid.
1732
1736
  */
1733
1737
  getGridWidths() {
1734
- return this.columnOrder.map((field) => this.getColumnState(field)).filter((state2) => state2.visible).map((state2) => state2.width);
1738
+ return this.columnOrder.map((field) => this.getOrCreateColumnState(field)).filter((state2) => state2.visible).map((state2) => state2.width);
1735
1739
  }
1736
1740
  scheduleSave() {
1737
1741
  window.clearTimeout(this.saveTimer);
@@ -1739,16 +1743,20 @@ var YatlTable = class extends import_lit3.LitElement {
1739
1743
  this.saveStateToStorage();
1740
1744
  }, STATE_SAVE_DEBOUNCE);
1741
1745
  }
1742
- getColumnState(field) {
1743
- let state2 = findColumn(field, this._columnStates);
1746
+ /**
1747
+ * Gets the column state associated with the given field.
1748
+ * If the state doesn't exist, a default state will be created.
1749
+ */
1750
+ getOrCreateColumnState(field) {
1751
+ let state2 = this._columnStateMap.get(field);
1744
1752
  if (!state2) {
1745
1753
  state2 = {
1746
1754
  field,
1747
1755
  visible: true,
1748
- sort: null,
1749
- width: null
1756
+ width: null,
1757
+ sort: null
1750
1758
  };
1751
- this._columnStates.push(state2);
1759
+ this._columnStateMap.set(field, state2);
1752
1760
  }
1753
1761
  return state2;
1754
1762
  }
@@ -1842,7 +1850,7 @@ var YatlTable = class extends import_lit3.LitElement {
1842
1850
  this.tableElement.querySelectorAll(".header .cell").forEach((element) => {
1843
1851
  const field2 = element.dataset.field;
1844
1852
  if (field2) {
1845
- const state2 = this.getColumnState(field2);
1853
+ const state2 = this.getOrCreateColumnState(field2);
1846
1854
  if (state2) {
1847
1855
  state2.width = element.getBoundingClientRect().width;
1848
1856
  }
@@ -1889,6 +1897,12 @@ __decorateClass([
1889
1897
  __decorateClass([
1890
1898
  (0, import_decorators.state)()
1891
1899
  ], YatlTable.prototype, "_filteredData", 2);
1900
+ __decorateClass([
1901
+ (0, import_decorators.property)({ type: Boolean, attribute: "sortable" })
1902
+ ], YatlTable.prototype, "sortable", 2);
1903
+ __decorateClass([
1904
+ (0, import_decorators.property)({ type: Boolean, attribute: "resizable" })
1905
+ ], YatlTable.prototype, "resizable", 2);
1892
1906
  __decorateClass([
1893
1907
  (0, import_decorators.property)({ type: Boolean, attribute: "enable-virtual-scroll" })
1894
1908
  ], YatlTable.prototype, "enableVirtualScroll", 2);
@@ -1934,9 +1948,6 @@ __decorateClass([
1934
1948
  __decorateClass([
1935
1949
  (0, import_decorators.property)({ type: String, attribute: "search-query" })
1936
1950
  ], YatlTable.prototype, "searchQuery", 1);
1937
- __decorateClass([
1938
- (0, import_decorators.property)({ type: Array, attribute: "search-included-fields" })
1939
- ], YatlTable.prototype, "searchIncludedFields", 1);
1940
1951
  __decorateClass([
1941
1952
  (0, import_decorators.property)({ attribute: false })
1942
1953
  ], YatlTable.prototype, "searchTokenizer", 1);
@@ -1968,7 +1979,6 @@ YatlTable = __decorateClass([
1968
1979
  YatlStateChangeEvent,
1969
1980
  YatlTable,
1970
1981
  createRegexTokenizer,
1971
- findColumn,
1972
1982
  whitespaceTokenizer
1973
1983
  });
1974
1984
  //# sourceMappingURL=index.js.map