@zeedhi/common 1.104.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.
@@ -4419,6 +4419,18 @@ class DateRange extends TextInput {
4419
4419
  this.internalValue = [];
4420
4420
  this.value = this.internalValue; // forces value accessor to be called if necessary
4421
4421
  }
4422
+ get value() {
4423
+ return this.internalValue;
4424
+ }
4425
+ set value(value) {
4426
+ if (this.internalValue !== value) {
4427
+ this.internalDisplayValue = this.formatter(value);
4428
+ this.internalValue = value;
4429
+ }
4430
+ if (value === null) {
4431
+ this.internalValue = [];
4432
+ }
4433
+ }
4422
4434
  /**
4423
4435
  * Assign the updated mask to mask property
4424
4436
  */
@@ -7163,10 +7175,7 @@ class GridEditable extends Grid {
7163
7175
  }
7164
7176
  let allValid = true;
7165
7177
  this.datasource.data.forEach((row) => this.columns.forEach((column) => {
7166
- const rowKey = row[this.datasource.uniqueKey];
7167
- const cellsApplied = (this.cellsApplied[rowKey] || {})[column.name];
7168
- const columnWithConditions = Object.assign(Object.assign({}, column), cellsApplied);
7169
- if (!column.isVisible || !columnWithConditions.editable)
7178
+ if (!this.isColumnEditable(column, row))
7170
7179
  return;
7171
7180
  if (!this.isValid(column, row, true))
7172
7181
  allValid = false;
@@ -7292,6 +7301,12 @@ class GridEditable extends Grid {
7292
7301
  const column = this.getColumn(columnName);
7293
7302
  this.changeCell(rowKey, rowIdx, column, value);
7294
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
+ }
7295
7310
  /**
7296
7311
  * Changes a cell value in editedRows
7297
7312
  * @param rowKey Cell's row key
@@ -7302,7 +7317,7 @@ class GridEditable extends Grid {
7302
7317
  changeCell(rowKey, rowIdx, column, value) {
7303
7318
  const originalRow = this.datasource.data[rowIdx];
7304
7319
  // Column doesn't have component
7305
- if (!column.editable || !column.isVisible) {
7320
+ if (!this.isColumnEditable(column, originalRow)) {
7306
7321
  this.changeEditableComponent(column, originalRow, value);
7307
7322
  return;
7308
7323
  }
@@ -10429,7 +10444,7 @@ class IterableComponentRender extends Iterable {
10429
10444
  * Returns the iterable component metadata based on row data
10430
10445
  */
10431
10446
  getComponentMetadata(row) {
10432
- 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');
10433
10448
  const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
10434
10449
  const metadata = JSON.stringify(this.componentMetadata)
10435
10450
  .replace(rowExp, JSON.stringify(row))
@@ -4426,6 +4426,18 @@
4426
4426
  this.internalValue = [];
4427
4427
  this.value = this.internalValue; // forces value accessor to be called if necessary
4428
4428
  }
4429
+ get value() {
4430
+ return this.internalValue;
4431
+ }
4432
+ set value(value) {
4433
+ if (this.internalValue !== value) {
4434
+ this.internalDisplayValue = this.formatter(value);
4435
+ this.internalValue = value;
4436
+ }
4437
+ if (value === null) {
4438
+ this.internalValue = [];
4439
+ }
4440
+ }
4429
4441
  /**
4430
4442
  * Assign the updated mask to mask property
4431
4443
  */
@@ -7170,10 +7182,7 @@
7170
7182
  }
7171
7183
  let allValid = true;
7172
7184
  this.datasource.data.forEach((row) => this.columns.forEach((column) => {
7173
- const rowKey = row[this.datasource.uniqueKey];
7174
- const cellsApplied = (this.cellsApplied[rowKey] || {})[column.name];
7175
- const columnWithConditions = Object.assign(Object.assign({}, column), cellsApplied);
7176
- if (!column.isVisible || !columnWithConditions.editable)
7185
+ if (!this.isColumnEditable(column, row))
7177
7186
  return;
7178
7187
  if (!this.isValid(column, row, true))
7179
7188
  allValid = false;
@@ -7299,6 +7308,12 @@
7299
7308
  const column = this.getColumn(columnName);
7300
7309
  this.changeCell(rowKey, rowIdx, column, value);
7301
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
+ }
7302
7317
  /**
7303
7318
  * Changes a cell value in editedRows
7304
7319
  * @param rowKey Cell's row key
@@ -7309,7 +7324,7 @@
7309
7324
  changeCell(rowKey, rowIdx, column, value) {
7310
7325
  const originalRow = this.datasource.data[rowIdx];
7311
7326
  // Column doesn't have component
7312
- if (!column.editable || !column.isVisible) {
7327
+ if (!this.isColumnEditable(column, originalRow)) {
7313
7328
  this.changeEditableComponent(column, originalRow, value);
7314
7329
  return;
7315
7330
  }
@@ -10436,7 +10451,7 @@
10436
10451
  * Returns the iterable component metadata based on row data
10437
10452
  */
10438
10453
  getComponentMetadata(row) {
10439
- 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');
10440
10455
  const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
10441
10456
  const metadata = JSON.stringify(this.componentMetadata)
10442
10457
  .replace(rowExp, JSON.stringify(row))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.104.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": "7d5f6ddbcabc8c6b93629ab72b178d48a400f906"
46
+ "gitHead": "24ad78a766b215833445a5c5ff14ff3f2fffbed1"
47
47
  }
@@ -88,6 +88,8 @@ export declare class DateRange extends TextInput implements IDateRange {
88
88
  parser(value: string): any;
89
89
  get displayValue(): string;
90
90
  set displayValue(newValue: string);
91
+ get value(): any;
92
+ set value(value: any);
91
93
  /**
92
94
  * Assign the updated mask to mask property
93
95
  */
@@ -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