@shival99/z-ui 2.0.54 → 2.0.55

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.
@@ -5296,6 +5296,8 @@ class ZTableComponent {
5296
5296
  range: config.range !== false,
5297
5297
  contextMenu: config.contextMenu !== false,
5298
5298
  copyWithHeaders: config.copyWithHeaders !== false,
5299
+ disabledColumnIds: config.disabledColumnIds,
5300
+ isCellDisabled: config.isCellDisabled,
5299
5301
  };
5300
5302
  }, ...(ngDevMode ? [{ debugName: "cellSelectionOptions" }] : []));
5301
5303
  canUseCellSelection = computed(() => this.cellSelectionOptions().enabled, ...(ngDevMode ? [{ debugName: "canUseCellSelection" }] : []));
@@ -7422,6 +7424,9 @@ class ZTableComponent {
7422
7424
  if (event.button !== 0) {
7423
7425
  return;
7424
7426
  }
7427
+ if (!this._isSelectableCell(row, columnId)) {
7428
+ return;
7429
+ }
7425
7430
  if (this._isCellSelectionDragTarget(event.target)) {
7426
7431
  return;
7427
7432
  }
@@ -7450,6 +7455,9 @@ class ZTableComponent {
7450
7455
  if (!this.cellSelectionAnchor()) {
7451
7456
  return;
7452
7457
  }
7458
+ if (!this._isSelectableCell(row, columnId)) {
7459
+ return;
7460
+ }
7453
7461
  if (this._isIgnoredCellSelectionTarget(event.target)) {
7454
7462
  return;
7455
7463
  }
@@ -7473,7 +7481,7 @@ class ZTableComponent {
7473
7481
  this.openContentRowMenu(event, row);
7474
7482
  return;
7475
7483
  }
7476
- if (!this._isSelectableCellColumn(columnId)) {
7484
+ if (!this._isSelectableCell(row, columnId)) {
7477
7485
  this.openContentRowMenu(event, row);
7478
7486
  return;
7479
7487
  }
@@ -7895,6 +7903,9 @@ class ZTableComponent {
7895
7903
  const row = rows[rowIndex];
7896
7904
  const visibleCells = row.getVisibleCells();
7897
7905
  for (const cell of visibleCells) {
7906
+ if (!this._isSelectableCell(row, cell.column.id)) {
7907
+ continue;
7908
+ }
7898
7909
  const rect = this._getRenderedCellVisualRect(cell, rowIndex, rows, visibleCells, selectableColumnIds);
7899
7910
  if (!rect) {
7900
7911
  continue;
@@ -7979,7 +7990,14 @@ class ZTableComponent {
7979
7990
  if (!row) {
7980
7991
  continue;
7981
7992
  }
7982
- lines.push(range.columnIds.map(columnId => this._formatCellClipboardValue(row.getValue(columnId))).join('\t'));
7993
+ lines.push(range.columnIds
7994
+ .map(columnId => {
7995
+ if (!this._isSelectableCell(row, columnId)) {
7996
+ return '';
7997
+ }
7998
+ return this._formatCellClipboardValue(row.getValue(columnId));
7999
+ })
8000
+ .join('\t'));
7983
8001
  }
7984
8002
  return lines.join('\n');
7985
8003
  }
@@ -7989,6 +8007,9 @@ class ZTableComponent {
7989
8007
  .map(column => column.id);
7990
8008
  }
7991
8009
  _isSelectableCellColumn(columnId) {
8010
+ if (this.cellSelectionOptions().disabledColumnIds?.includes(columnId)) {
8011
+ return false;
8012
+ }
7992
8013
  if (isZTableColumnTypeById(columnId, this.zConfig().columns, 'select')) {
7993
8014
  return false;
7994
8015
  }
@@ -8003,6 +8024,22 @@ class ZTableComponent {
8003
8024
  }
8004
8025
  return true;
8005
8026
  }
8027
+ _isSelectableCell(row, columnId) {
8028
+ if (!this._isSelectableCellColumn(columnId)) {
8029
+ return false;
8030
+ }
8031
+ const { isCellDisabled } = this.cellSelectionOptions();
8032
+ if (!isCellDisabled) {
8033
+ return true;
8034
+ }
8035
+ return !isCellDisabled({
8036
+ row: row.original,
8037
+ rowId: row.id,
8038
+ rowIndex: row.index,
8039
+ columnId,
8040
+ column: this._findColumnConfig(columnId),
8041
+ });
8042
+ }
8006
8043
  _isIgnoredCellSelectionTarget(target) {
8007
8044
  if (!(target instanceof HTMLElement)) {
8008
8045
  return false;