@limetech/lime-elements 37.53.1 → 37.53.3

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +11 -8
  4. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
  5. package/dist/cjs/limel-table.cjs.entry.js +32 -10
  6. package/dist/cjs/limel-table.cjs.entry.js.map +1 -1
  7. package/dist/collection/components/table/table-selection.js +16 -8
  8. package/dist/collection/components/table/table-selection.js.map +1 -1
  9. package/dist/collection/components/table/table.js +24 -6
  10. package/dist/collection/components/table/table.js.map +1 -1
  11. package/dist/collection/components/table/table.types.js.map +1 -1
  12. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/link-plugin.js +11 -8
  13. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/link-plugin.js.map +1 -1
  14. package/dist/esm/index.js.map +1 -1
  15. package/dist/esm/limel-prosemirror-adapter.entry.js +11 -8
  16. package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
  17. package/dist/esm/limel-table.entry.js +32 -10
  18. package/dist/esm/limel-table.entry.js.map +1 -1
  19. package/dist/lime-elements/index.esm.js.map +1 -1
  20. package/dist/lime-elements/lime-elements.esm.js +1 -1
  21. package/dist/lime-elements/{p-1d581d7d.entry.js → p-20017fe1.entry.js} +2 -2
  22. package/dist/lime-elements/p-20017fe1.entry.js.map +1 -0
  23. package/dist/lime-elements/{p-cc5d8b3f.entry.js → p-852e7a2b.entry.js} +2 -2
  24. package/dist/lime-elements/p-852e7a2b.entry.js.map +1 -0
  25. package/dist/types/components/table/table-selection.d.ts +4 -2
  26. package/dist/types/components/table/table.d.ts +4 -3
  27. package/dist/types/components/table/table.types.d.ts +7 -0
  28. package/dist/types/components.d.ts +4 -4
  29. package/package.json +1 -1
  30. package/dist/lime-elements/p-1d581d7d.entry.js.map +0 -1
  31. package/dist/lime-elements/p-cc5d8b3f.entry.js.map +0 -1
@@ -23996,6 +23996,7 @@ class Selection {
23996
23996
  }
23997
23997
 
23998
23998
  const LIMEL_CHECKBOX = 'limel-checkbox';
23999
+ const getRowId = (data) => { var _a; return (_a = data.id) !== null && _a !== void 0 ? _a : data; };
23999
24000
  /**
24000
24001
  * Provides row selection to Tabulator with shift-click support for range selections
24001
24002
  */
@@ -24030,7 +24031,13 @@ class TableSelection {
24030
24031
  else {
24031
24032
  this.updateRowSelectors(this.selection.toggleSelection(rowPosition));
24032
24033
  }
24033
- this.selectEvent.emit(this.selection.items);
24034
+ this.selectEvent.emit(this.selection.items.map(this.getRowData));
24035
+ };
24036
+ this.getRowData = (item) => {
24037
+ if (typeof item === 'object') {
24038
+ return item;
24039
+ }
24040
+ return this.getTable().getRow(item).getData();
24034
24041
  };
24035
24042
  this.updateRowSelectors = (changeSet) => {
24036
24043
  changeSet.indexes
@@ -24054,7 +24061,7 @@ class TableSelection {
24054
24061
  this.getRowByIndex = (index) => {
24055
24062
  return this.getTable().getRowFromPosition(index, true);
24056
24063
  };
24057
- this.selection = new Selection((index) => this.getRowByIndex(index).getData());
24064
+ this.selection = new Selection((index) => getRowId(this.getRowByIndex(index).getData()));
24058
24065
  }
24059
24066
  /**
24060
24067
  * @returns Returns `true` when the selection is non-empty, otherwise `false`
@@ -24073,13 +24080,15 @@ class TableSelection {
24073
24080
  *
24074
24081
  * @param data - The selected items
24075
24082
  */
24076
- setSelection(data) {
24077
- if (isEqual(this.selection.items, data)) {
24083
+ setSelection(data = []) {
24084
+ const newItems = data.map(getRowId);
24085
+ if (this.selection.size === data.length &&
24086
+ this.selection.items.every((oldItem, index) => oldItem === newItems[index])) {
24078
24087
  return;
24079
24088
  }
24080
- this.selection.items = data;
24089
+ this.selection.items = newItems;
24081
24090
  const rows = this.getActiveRows();
24082
- rows.forEach((row) => this.updateRowSelector(row, this.selection.has(row.getData())));
24091
+ rows.forEach((row) => this.updateRowSelector(row, this.selection.has(getRowId(row.getData()))));
24083
24092
  }
24084
24093
  /**
24085
24094
  * Prepends a checkbox column used for row selection to the given column definitions
@@ -24110,7 +24119,7 @@ class TableSelection {
24110
24119
  return (cell) => {
24111
24120
  const element = this.pool.get(LIMEL_CHECKBOX);
24112
24121
  setElementProperties(element, {
24113
- checked: this.selection.has(cell.getData()),
24122
+ checked: this.selection.has(getRowId(cell.getData())),
24114
24123
  });
24115
24124
  element.style.display = 'inline-block';
24116
24125
  return element;
@@ -24247,7 +24256,9 @@ const Table = class {
24247
24256
  this.formatRows();
24248
24257
  }
24249
24258
  updateData(newData = [], oldData = []) {
24250
- if (isEqual(newData, oldData)) {
24259
+ const newIds = new Set(newData.map((item) => { var _a; return (_a = item.id) !== null && _a !== void 0 ? _a : item; }));
24260
+ if (oldData.every((item) => { var _a; return newIds.has((_a = item.id) !== null && _a !== void 0 ? _a : item); })) {
24261
+ this.tabulator.updateOrAddData(newData);
24251
24262
  return;
24252
24263
  }
24253
24264
  this.pool.releaseAll();
@@ -24526,7 +24537,7 @@ const Table = class {
24526
24537
  // Not a data row, probably a CalcComponent
24527
24538
  return;
24528
24539
  }
24529
- if (this.activeRow === row.getData()) {
24540
+ if (this.isActiveRow(row)) {
24530
24541
  this.activeRow = null;
24531
24542
  }
24532
24543
  else {
@@ -24538,7 +24549,7 @@ const Table = class {
24538
24549
  this.tabulator.getRows().forEach(this.formatRow);
24539
24550
  }
24540
24551
  formatRow(row) {
24541
- if (this.activeRow === row.getData()) {
24552
+ if (this.isActiveRow(row)) {
24542
24553
  row.getElement().classList.add('active');
24543
24554
  }
24544
24555
  else {
@@ -24553,6 +24564,17 @@ const Table = class {
24553
24564
  row.getElement().prepend(element);
24554
24565
  }
24555
24566
  }
24567
+ isActiveRow(row) {
24568
+ var _a;
24569
+ if (!this.activeRow) {
24570
+ return false;
24571
+ }
24572
+ const activeRowId = (_a = this.activeRow.id) !== null && _a !== void 0 ? _a : null;
24573
+ if (activeRowId !== null) {
24574
+ return activeRowId === row.getData().id;
24575
+ }
24576
+ return this.activeRow === row.getData();
24577
+ }
24556
24578
  calculatePageCount() {
24557
24579
  let total = this.totalRows;
24558
24580
  if (!total) {