@zeedhi/common 1.105.0 → 1.105.1

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.
@@ -7175,10 +7175,7 @@ class GridEditable extends Grid {
7175
7175
  }
7176
7176
  let allValid = true;
7177
7177
  this.datasource.data.forEach((row) => this.columns.forEach((column) => {
7178
- const rowKey = row[this.datasource.uniqueKey];
7179
- const cellsApplied = (this.cellsApplied[rowKey] || {})[column.name];
7180
- const columnWithConditions = Object.assign(Object.assign({}, column), cellsApplied);
7181
- if (!column.isVisible || !columnWithConditions.editable)
7178
+ if (!this.isColumnEditable(column, row))
7182
7179
  return;
7183
7180
  if (!this.isValid(column, row, true))
7184
7181
  allValid = false;
@@ -7304,6 +7301,12 @@ class GridEditable extends Grid {
7304
7301
  const column = this.getColumn(columnName);
7305
7302
  this.changeCell(rowKey, rowIdx, column, value);
7306
7303
  }
7304
+ isColumnEditable(column, row) {
7305
+ const rowKey = row[this.datasource.uniqueKey];
7306
+ const cellsApplied = (this.cellsApplied[rowKey] || {})[column.name];
7307
+ const columnWithConditions = Object.assign(Object.assign({}, column), cellsApplied);
7308
+ return column.isVisible && columnWithConditions.editable && this.callCanEditRow(row);
7309
+ }
7307
7310
  /**
7308
7311
  * Changes a cell value in editedRows
7309
7312
  * @param rowKey Cell's row key
@@ -7314,7 +7317,7 @@ class GridEditable extends Grid {
7314
7317
  changeCell(rowKey, rowIdx, column, value) {
7315
7318
  const originalRow = this.datasource.data[rowIdx];
7316
7319
  // Column doesn't have component
7317
- if (!column.editable || !column.isVisible) {
7320
+ if (!this.isColumnEditable(column, originalRow)) {
7318
7321
  this.changeEditableComponent(column, originalRow, value);
7319
7322
  return;
7320
7323
  }
@@ -10441,7 +10444,7 @@ class IterableComponentRender extends Iterable {
10441
10444
  * Returns the iterable component metadata based on row data
10442
10445
  */
10443
10446
  getComponentMetadata(row) {
10444
- const exp = new RegExp(`<<${this.rowPropName}.(.[A-z]+?)>>|"<<${this.rowPropName}.(.[A-z]+?)>>"`, 'g');
10447
+ const exp = new RegExp(`<<${this.rowPropName}\\.([A-z_.]+?)>>|"<<${this.rowPropName}.(.[A-z_.]+?)>>"`, 'g');
10445
10448
  const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
10446
10449
  const metadata = JSON.stringify(this.componentMetadata)
10447
10450
  .replace(rowExp, JSON.stringify(row))
@@ -7182,10 +7182,7 @@
7182
7182
  }
7183
7183
  let allValid = true;
7184
7184
  this.datasource.data.forEach((row) => this.columns.forEach((column) => {
7185
- const rowKey = row[this.datasource.uniqueKey];
7186
- const cellsApplied = (this.cellsApplied[rowKey] || {})[column.name];
7187
- const columnWithConditions = Object.assign(Object.assign({}, column), cellsApplied);
7188
- if (!column.isVisible || !columnWithConditions.editable)
7185
+ if (!this.isColumnEditable(column, row))
7189
7186
  return;
7190
7187
  if (!this.isValid(column, row, true))
7191
7188
  allValid = false;
@@ -7311,6 +7308,12 @@
7311
7308
  const column = this.getColumn(columnName);
7312
7309
  this.changeCell(rowKey, rowIdx, column, value);
7313
7310
  }
7311
+ isColumnEditable(column, row) {
7312
+ const rowKey = row[this.datasource.uniqueKey];
7313
+ const cellsApplied = (this.cellsApplied[rowKey] || {})[column.name];
7314
+ const columnWithConditions = Object.assign(Object.assign({}, column), cellsApplied);
7315
+ return column.isVisible && columnWithConditions.editable && this.callCanEditRow(row);
7316
+ }
7314
7317
  /**
7315
7318
  * Changes a cell value in editedRows
7316
7319
  * @param rowKey Cell's row key
@@ -7321,7 +7324,7 @@
7321
7324
  changeCell(rowKey, rowIdx, column, value) {
7322
7325
  const originalRow = this.datasource.data[rowIdx];
7323
7326
  // Column doesn't have component
7324
- if (!column.editable || !column.isVisible) {
7327
+ if (!this.isColumnEditable(column, originalRow)) {
7325
7328
  this.changeEditableComponent(column, originalRow, value);
7326
7329
  return;
7327
7330
  }
@@ -10448,7 +10451,7 @@
10448
10451
  * Returns the iterable component metadata based on row data
10449
10452
  */
10450
10453
  getComponentMetadata(row) {
10451
- const exp = new RegExp(`<<${this.rowPropName}.(.[A-z]+?)>>|"<<${this.rowPropName}.(.[A-z]+?)>>"`, 'g');
10454
+ const exp = new RegExp(`<<${this.rowPropName}\\.([A-z_.]+?)>>|"<<${this.rowPropName}.(.[A-z_.]+?)>>"`, 'g');
10452
10455
  const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
10453
10456
  const metadata = JSON.stringify(this.componentMetadata)
10454
10457
  .replace(rowExp, JSON.stringify(row))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.105.0",
3
+ "version": "1.105.1",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -43,5 +43,5 @@
43
43
  "lodash.times": "4.3.*",
44
44
  "mockdate": "3.0.*"
45
45
  },
46
- "gitHead": "bac0dd5514d2a2e47f68c9e3b950e3041cf4aad4"
46
+ "gitHead": "24ad78a766b215833445a5c5ff14ff3f2fffbed1"
47
47
  }
@@ -233,6 +233,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
233
233
  * @throws RowNotFoundError If the row is not present in datasource
234
234
  */
235
235
  updateCell(rowKey: string, columnName: string, value: any): void;
236
+ private isColumnEditable;
236
237
  /**
237
238
  * Changes a cell value in editedRows
238
239
  * @param rowKey Cell's row key