@zeedhi/common 1.88.1 → 1.89.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.
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Zeedhi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ This repository includes one file originally copied from https://github.com/vuetifyjs/vuetify/
24
+ under /blob/v1.5.16/packages/vuetify/src/util/, mask.ts.
@@ -3147,6 +3147,7 @@ class Dialog extends Component {
3147
3147
  }
3148
3148
  },
3149
3149
  stop: true,
3150
+ index: 89,
3150
3151
  },
3151
3152
  esc: {
3152
3153
  event: () => {
@@ -3162,6 +3163,7 @@ class Dialog extends Component {
3162
3163
  this.hide();
3163
3164
  }
3164
3165
  },
3166
+ index: 89,
3165
3167
  stop: true,
3166
3168
  },
3167
3169
  };
@@ -5721,41 +5723,13 @@ FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, r
5721
5723
  if (!Object.keys(currentRow).length)
5722
5724
  return typeof value === 'object' ? '' : value;
5723
5725
  const textColumn = formatterDataText || dataText;
5724
- if (textColumn) {
5725
- if (typeof textColumn === 'string') {
5726
- return currentRow[textColumn] || value;
5727
- }
5728
- const dataTextNames = [];
5729
- const masks = [];
5730
- textColumn.forEach((text) => {
5731
- if (typeof text === 'string') {
5732
- dataTextNames.push(text);
5733
- masks.push('');
5734
- }
5735
- else {
5736
- dataTextNames.push(text.name);
5737
- if (Accessor.isAccessorDefinition(text.mask)) {
5738
- const [controller, accessor] = Accessor.getAccessor(text.mask);
5739
- masks.push(Loader.getInstance(controller)[accessor]);
5740
- }
5741
- else {
5742
- masks.push(text.mask);
5743
- }
5744
- }
5745
- });
5746
- return dataTextNames.reduce((result, columnName, index) => {
5747
- const rowCell = currentRow[columnName];
5748
- if (rowCell !== undefined && rowCell !== null) {
5749
- const separator = index > 0 ? (dataTextSeparator || ' | ') : '';
5750
- const mask = masks[index];
5751
- const maskValue = typeof mask === 'function' ? mask(rowCell) : mask;
5752
- const masked = masks[index] ? Mask.getValueWithMask(rowCell, maskValue) : rowCell;
5753
- return result + separator + masked;
5754
- }
5755
- return result;
5756
- }, '');
5726
+ if (!textColumn)
5727
+ return value;
5728
+ if (typeof textColumn === 'string') {
5729
+ return currentRow[textColumn] || value;
5757
5730
  }
5758
- return value;
5731
+ const formatterFn = FormatterParserProvider.getFormatter('ZdSelect');
5732
+ return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator });
5759
5733
  });
5760
5734
  FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', ({ column, value, row, componentProps, }) => {
5761
5735
  if (!value || !Array.isArray(value) || value.length === 0)
@@ -5955,21 +5929,25 @@ class Grid extends Iterable {
5955
5929
  up: {
5956
5930
  event: this.navigateUp.bind(this),
5957
5931
  stop: true,
5932
+ index: 99,
5958
5933
  active: true,
5959
5934
  },
5960
5935
  down: {
5961
5936
  event: this.navigateDown.bind(this),
5962
5937
  stop: true,
5938
+ index: 99,
5963
5939
  active: true,
5964
5940
  },
5965
5941
  pageup: {
5966
5942
  event: this.navigatePageUp.bind(this),
5967
5943
  stop: true,
5944
+ index: 99,
5968
5945
  active: true,
5969
5946
  },
5970
5947
  pagedown: {
5971
5948
  event: this.navigatePageDown.bind(this),
5972
5949
  stop: true,
5950
+ index: 99,
5973
5951
  active: true,
5974
5952
  },
5975
5953
  };
@@ -6357,6 +6335,7 @@ class GridEditable extends Grid {
6357
6335
  * Enter edit mode on double click
6358
6336
  */
6359
6337
  this.doubleClickEdit = false;
6338
+ this.singleEdit = false;
6360
6339
  /**
6361
6340
  * Edited rows
6362
6341
  * @private
@@ -6376,6 +6355,7 @@ class GridEditable extends Grid {
6376
6355
  this.cancelEditedRowsKeyMapping = {
6377
6356
  esc: {
6378
6357
  event: this.cancelEditedRows.bind(this),
6358
+ index: 99,
6379
6359
  stop: true,
6380
6360
  input: true,
6381
6361
  active: true,
@@ -6385,6 +6365,7 @@ class GridEditable extends Grid {
6385
6365
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
6386
6366
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
6387
6367
  this.editingNewRows = this.getInitValue('editingNewRows', props.editingNewRows, this.editingNewRows);
6368
+ this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
6388
6369
  this.createAccessors();
6389
6370
  }
6390
6371
  onMounted(element) {
@@ -6493,6 +6474,13 @@ class GridEditable extends Grid {
6493
6474
  });
6494
6475
  }
6495
6476
  }
6477
+ getVisibleValue(row, column) {
6478
+ const key = row[this.datasource.uniqueKey];
6479
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
6480
+ return this.editedRows[key][column.name];
6481
+ }
6482
+ return row[column.name];
6483
+ }
6496
6484
  /**
6497
6485
  * Returns editable component properties based on the column definition
6498
6486
  * @param column Column definition
@@ -6503,13 +6491,7 @@ class GridEditable extends Grid {
6503
6491
  getEditableComponent(column, row, cellProps, events) {
6504
6492
  const key = row[this.datasource.uniqueKey];
6505
6493
  const compName = this.getCompName(key, column.name);
6506
- let colValue;
6507
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
6508
- colValue = this.editedRows[key][column.name];
6509
- }
6510
- else {
6511
- colValue = row[column.name];
6512
- }
6494
+ const colValue = this.getVisibleValue(row, column);
6513
6495
  const componentProps = merge({}, column.componentProps, cellProps === null || cellProps === void 0 ? void 0 : cellProps.componentProps);
6514
6496
  let compEvents = {};
6515
6497
  if (componentProps && componentProps.events) {
@@ -6650,7 +6632,9 @@ class GridEditable extends Grid {
6650
6632
  */
6651
6633
  cancelEditedRows() {
6652
6634
  return __awaiter(this, void 0, void 0, function* () {
6635
+ const { page } = this.datasource;
6653
6636
  yield this.cancelAddedRows();
6637
+ yield this.datasource.setPage(page);
6654
6638
  this.editing = false;
6655
6639
  this.editedRows = {};
6656
6640
  this.invalidComponents = {};
@@ -6658,7 +6642,7 @@ class GridEditable extends Grid {
6658
6642
  }
6659
6643
  cancelAddedRows() {
6660
6644
  return __awaiter(this, void 0, void 0, function* () {
6661
- const { data, page } = this.datasource;
6645
+ const { data } = this.datasource;
6662
6646
  const allData = this.datasource.allData || data;
6663
6647
  Promise.resolve(allData);
6664
6648
  for (let index = allData.length - 1; index >= 0; index -= 1) {
@@ -6668,8 +6652,6 @@ class GridEditable extends Grid {
6668
6652
  }
6669
6653
  }
6670
6654
  yield this.datasource.updateData(allData);
6671
- yield this.datasource.get();
6672
- yield this.datasource.setPage(page);
6673
6655
  });
6674
6656
  }
6675
6657
  addDataRow(row) {
@@ -6685,6 +6667,7 @@ class GridEditable extends Grid {
6685
6667
  */
6686
6668
  saveEditedRows(revalidate = false) {
6687
6669
  return __awaiter(this, void 0, void 0, function* () {
6670
+ const { page } = this.datasource;
6688
6671
  yield this.cancelAddedRows();
6689
6672
  const response = yield Promise.all(this.getEditedRows(revalidate).map((row) => this.addDataRow(row)));
6690
6673
  this.editing = false;
@@ -6692,7 +6675,7 @@ class GridEditable extends Grid {
6692
6675
  this.addedRows = {};
6693
6676
  this.invalidComponents = {};
6694
6677
  this.addedRows = {};
6695
- yield this.datasource.get();
6678
+ yield this.datasource.setPage(page);
6696
6679
  return response;
6697
6680
  });
6698
6681
  }
@@ -6701,7 +6684,7 @@ class GridEditable extends Grid {
6701
6684
  * @param revalidate Defines if the fields should be revalidated
6702
6685
  * @throws Will throw when it finds an invalid row
6703
6686
  */
6704
- getEditedRows(revalidate = false) {
6687
+ getEditedRows(revalidate = false, silent = false) {
6705
6688
  const editedRows = [];
6706
6689
  Object.keys(this.editedRows).forEach((key) => {
6707
6690
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
@@ -6712,7 +6695,7 @@ class GridEditable extends Grid {
6712
6695
  delete row[`${attr}_original`];
6713
6696
  }
6714
6697
  });
6715
- if (!this.isGridValid(revalidate)) {
6698
+ if (!silent && !this.isGridValid(revalidate)) {
6716
6699
  throw new Error('Invalid rows');
6717
6700
  }
6718
6701
  editedRows.push(row);
@@ -7484,16 +7467,19 @@ class Select extends TextInput {
7484
7467
  yield this.setValue(this.value, false);
7485
7468
  this.removePushedValue();
7486
7469
  }
7487
- if (this.pushedValue && this.indexOf(this.pushedValue) === -1) {
7488
- const filterValue = this.pushedValue[this.dataValue];
7489
- const foundInData = this.datasource.data.find(this.getCondition(filterValue));
7490
- if (!foundInData) {
7491
- this.datasource.data.unshift(this.pushedValue);
7492
- }
7493
- }
7470
+ this.insertSelected();
7494
7471
  return response;
7495
7472
  });
7496
7473
  }
7474
+ insertSelected() {
7475
+ if (this.datasource.search || !this.pushedValue || this.indexOf(this.pushedValue) !== -1)
7476
+ return;
7477
+ const filterValue = this.pushedValue[this.dataValue];
7478
+ const foundInData = this.datasource.data.find(this.getCondition(filterValue));
7479
+ if (!foundInData) {
7480
+ this.datasource.data.unshift(this.pushedValue);
7481
+ }
7482
+ }
7497
7483
  get search() {
7498
7484
  return this.searchValue;
7499
7485
  }
@@ -7773,14 +7759,14 @@ class Select extends TextInput {
7773
7759
  loadMore() {
7774
7760
  return __awaiter(this, void 0, void 0, function* () {
7775
7761
  yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
7776
- if (!this.datasource.search) {
7777
- this.afterLoad();
7778
- const { dataValue } = this;
7779
- const isSelected = this.selectValue && this.pushedValue && this.selectValue[dataValue] === this.pushedValue[dataValue];
7780
- if (isSelected)
7781
- return;
7782
- this.removePushedValue();
7783
- }
7762
+ if (this.datasource.search)
7763
+ return;
7764
+ this.afterLoad();
7765
+ const { dataValue } = this;
7766
+ const isSelected = this.selectValue && this.pushedValue && this.selectValue[dataValue] === this.pushedValue[dataValue];
7767
+ if (isSelected)
7768
+ return;
7769
+ this.removePushedValue();
7784
7770
  });
7785
7771
  }
7786
7772
  /**
@@ -9889,7 +9875,6 @@ class SelectMultiple extends Select {
9889
9875
  const parsedValue = this.parserFn(value, this);
9890
9876
  if (parsedValue !== this.datasource.search) {
9891
9877
  yield this.datasource.setSearch(parsedValue);
9892
- this.insertSelected();
9893
9878
  }
9894
9879
  });
9895
9880
  }
@@ -9918,6 +9903,7 @@ class SelectMultiple extends Select {
9918
9903
  yield this.updateSearch(value);
9919
9904
  }
9920
9905
  else {
9906
+ this.datasource.search = value;
9921
9907
  if (!this.manualMode) {
9922
9908
  this.datasource.data = [...this.cachedData];
9923
9909
  this.datasource.total = this.cachedTotal;
@@ -9945,29 +9931,11 @@ class SelectMultiple extends Select {
9945
9931
  if (!value || value.length === 0) {
9946
9932
  return [];
9947
9933
  }
9948
- const dataTextNames = [];
9949
- const masks = [];
9950
- this.dataText.forEach((text) => {
9951
- if (typeof text === 'string') {
9952
- dataTextNames.push(text);
9953
- masks.push('');
9954
- }
9955
- else {
9956
- dataTextNames.push(text.name);
9957
- masks.push(text.mask);
9958
- }
9959
- });
9934
+ const selectFormatter = FormatterParserProvider.getFormatter('ZdSelect');
9960
9935
  const formattedValue = value.map((row) => {
9961
9936
  const isDisabled = this.dataDisabled && row[this.dataDisabled];
9962
9937
  const formattedRow = { value: row[this.dataValue], disabled: isDisabled, originalRow: row };
9963
- formattedRow.text = dataTextNames.reduce((result, columnName, index) => {
9964
- if (row[columnName]) {
9965
- const separator = index > 0 ? this.dataTextSeparator : '';
9966
- const masked = masks[index] ? Mask.getValueWithMask(row[columnName], masks[index]) : row[columnName];
9967
- return result + separator + masked;
9968
- }
9969
- return result;
9970
- }, '');
9938
+ formattedRow.text = selectFormatter(row, this);
9971
9939
  return formattedRow;
9972
9940
  });
9973
9941
  return formattedValue;
@@ -9997,7 +9965,6 @@ class SelectMultiple extends Select {
9997
9965
  const foundInData = this.datasource.data.find(this.getCondition(value));
9998
9966
  return !foundInData;
9999
9967
  });
10000
- this.insertSelected();
10001
9968
  if (!this.datasource.search) {
10002
9969
  this.setCache();
10003
9970
  }
@@ -10069,9 +10036,6 @@ class SelectMultiple extends Select {
10069
10036
  return __awaiter(this, void 0, void 0, function* () {
10070
10037
  if (!this.preventLoadOnFocus) {
10071
10038
  yield this.datasource.get();
10072
- const values = this.datasource.data.map((row) => row[this.dataValue]);
10073
- // remove inserted items that are already in datasource
10074
- this.insertedValues = this.insertedValues.filter((inserted) => !values.includes(inserted[this.dataValue]));
10075
10039
  this.preventLoadOnFocus = true;
10076
10040
  }
10077
10041
  this.setCache();
@@ -12643,11 +12607,13 @@ class TreeGrid extends Grid {
12643
12607
  right: {
12644
12608
  event: this.navigateToggle.bind(this, false),
12645
12609
  stop: true,
12610
+ index: 99,
12646
12611
  active: true,
12647
12612
  },
12648
12613
  left: {
12649
12614
  event: this.navigateToggle.bind(this, true),
12650
12615
  stop: true,
12616
+ index: 99,
12651
12617
  active: true,
12652
12618
  },
12653
12619
  };
@@ -12884,6 +12850,7 @@ class TreeGridEditable extends TreeGrid {
12884
12850
  * Editing rows
12885
12851
  */
12886
12852
  this.editing = false;
12853
+ this.singleEdit = false;
12887
12854
  /**
12888
12855
  * Edited rows
12889
12856
  * @private
@@ -12901,6 +12868,7 @@ class TreeGridEditable extends TreeGrid {
12901
12868
  this.cancelEditedRowsKeyMapping = {
12902
12869
  esc: {
12903
12870
  event: this.cancelEditedRows.bind(this),
12871
+ index: 99,
12904
12872
  stop: true,
12905
12873
  input: true,
12906
12874
  active: true,
@@ -12908,6 +12876,7 @@ class TreeGridEditable extends TreeGrid {
12908
12876
  };
12909
12877
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
12910
12878
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
12879
+ this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
12911
12880
  this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
12912
12881
  this.createAccessors();
12913
12882
  }
@@ -13017,6 +12986,13 @@ class TreeGridEditable extends TreeGrid {
13017
12986
  });
13018
12987
  }
13019
12988
  }
12989
+ getVisibleValue(row, column) {
12990
+ const key = row[this.datasource.uniqueKey];
12991
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
12992
+ return this.editedRows[key][column.name];
12993
+ }
12994
+ return row[column.name];
12995
+ }
13020
12996
  /**
13021
12997
  * Returns editable component properties based on the column definition
13022
12998
  * @param column Column definition
@@ -13027,13 +13003,7 @@ class TreeGridEditable extends TreeGrid {
13027
13003
  getEditableComponent(column, row, cellProps, events) {
13028
13004
  const key = row[this.datasource.uniqueKey];
13029
13005
  const compName = this.getCompName(key, column.name);
13030
- let colValue;
13031
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
13032
- colValue = this.editedRows[key][column.name];
13033
- }
13034
- else {
13035
- colValue = row[column.name];
13036
- }
13006
+ const colValue = this.getVisibleValue(row, column);
13037
13007
  const componentProps = merge({}, column.componentProps, cellProps.componentProps);
13038
13008
  let compEvents = {};
13039
13009
  if (componentProps && componentProps.events) {
@@ -13129,10 +13099,24 @@ class TreeGridEditable extends TreeGrid {
13129
13099
  * @param column Column
13130
13100
  * @param row Row
13131
13101
  */
13132
- isValid(column, row) {
13102
+ isValid(column, row, revalidate = false) {
13133
13103
  const key = row[this.datasource.uniqueKey];
13134
13104
  const compName = this.getCompName(key, column.name);
13135
- return !Object.prototype.hasOwnProperty.call(this.invalidComponents, compName);
13105
+ if (!revalidate) {
13106
+ return !Object.prototype.hasOwnProperty.call(this.invalidComponents, compName);
13107
+ }
13108
+ try {
13109
+ const input = this.getComponent(key, column.name);
13110
+ const isValid = input.validate();
13111
+ this.checkCompValidity(input);
13112
+ return isValid;
13113
+ }
13114
+ catch (e) {
13115
+ if (e instanceof InstanceNotFoundError) {
13116
+ return true;
13117
+ }
13118
+ throw e;
13119
+ }
13136
13120
  }
13137
13121
  /**
13138
13122
  * Cancels all edited rows and enable grid components
@@ -13175,7 +13159,7 @@ class TreeGridEditable extends TreeGrid {
13175
13159
  * Retrieves all edited rows if they are valid
13176
13160
  * @throws Will throw when it finds an invalid row
13177
13161
  */
13178
- getEditedRows() {
13162
+ getEditedRows(revalidate = false, silent = false) {
13179
13163
  const editedRows = [];
13180
13164
  Object.keys(this.editedRows).forEach((key) => {
13181
13165
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
@@ -13188,15 +13172,29 @@ class TreeGridEditable extends TreeGrid {
13188
13172
  delete row[attr];
13189
13173
  }
13190
13174
  });
13191
- if (!this.isGridValid()) {
13175
+ if (!silent && !this.isGridValid(revalidate)) {
13192
13176
  throw new Error('Invalid rows');
13193
13177
  }
13194
13178
  editedRows.push(row);
13195
13179
  });
13196
13180
  return editedRows;
13197
13181
  }
13198
- isGridValid() {
13199
- return Object.keys(this.invalidComponents).length === 0;
13182
+ /**
13183
+ * Checks whether the grid is valid or not
13184
+ * @param revalidate Defines if the fields should be revalidated
13185
+ */
13186
+ isGridValid(revalidate = false) {
13187
+ if (!revalidate) {
13188
+ return Object.keys(this.invalidComponents).length === 0;
13189
+ }
13190
+ let allValid = true;
13191
+ this.datasource.data.forEach((row) => this.columns.forEach((column) => {
13192
+ if (!column.isVisible || !column.editable)
13193
+ return;
13194
+ if (!this.isValid(column, row, true))
13195
+ allValid = false;
13196
+ }));
13197
+ return allValid;
13200
13198
  }
13201
13199
  /**
13202
13200
  * Gets the editable component name
@@ -13872,7 +13870,7 @@ class PDFReport extends BaseReport {
13872
13870
  else if (column.componentProps && Object.keys(column.componentProps).length) {
13873
13871
  const { component } = column.componentProps;
13874
13872
  if (this.isNumberComponent(component)) {
13875
- format = { type: 'float' };
13873
+ format = { type: 'float', params: {} };
13876
13874
  mask = this.checkAccessor(column.componentProps.mask);
13877
13875
  if (mask) {
13878
13876
  format.params = {};
@@ -3154,6 +3154,7 @@
3154
3154
  }
3155
3155
  },
3156
3156
  stop: true,
3157
+ index: 89,
3157
3158
  },
3158
3159
  esc: {
3159
3160
  event: () => {
@@ -3169,6 +3170,7 @@
3169
3170
  this.hide();
3170
3171
  }
3171
3172
  },
3173
+ index: 89,
3172
3174
  stop: true,
3173
3175
  },
3174
3176
  };
@@ -5728,41 +5730,13 @@
5728
5730
  if (!Object.keys(currentRow).length)
5729
5731
  return typeof value === 'object' ? '' : value;
5730
5732
  const textColumn = formatterDataText || dataText;
5731
- if (textColumn) {
5732
- if (typeof textColumn === 'string') {
5733
- return currentRow[textColumn] || value;
5734
- }
5735
- const dataTextNames = [];
5736
- const masks = [];
5737
- textColumn.forEach((text) => {
5738
- if (typeof text === 'string') {
5739
- dataTextNames.push(text);
5740
- masks.push('');
5741
- }
5742
- else {
5743
- dataTextNames.push(text.name);
5744
- if (core.Accessor.isAccessorDefinition(text.mask)) {
5745
- const [controller, accessor] = core.Accessor.getAccessor(text.mask);
5746
- masks.push(core.Loader.getInstance(controller)[accessor]);
5747
- }
5748
- else {
5749
- masks.push(text.mask);
5750
- }
5751
- }
5752
- });
5753
- return dataTextNames.reduce((result, columnName, index) => {
5754
- const rowCell = currentRow[columnName];
5755
- if (rowCell !== undefined && rowCell !== null) {
5756
- const separator = index > 0 ? (dataTextSeparator || ' | ') : '';
5757
- const mask = masks[index];
5758
- const maskValue = typeof mask === 'function' ? mask(rowCell) : mask;
5759
- const masked = masks[index] ? core.Mask.getValueWithMask(rowCell, maskValue) : rowCell;
5760
- return result + separator + masked;
5761
- }
5762
- return result;
5763
- }, '');
5733
+ if (!textColumn)
5734
+ return value;
5735
+ if (typeof textColumn === 'string') {
5736
+ return currentRow[textColumn] || value;
5764
5737
  }
5765
- return value;
5738
+ const formatterFn = core.FormatterParserProvider.getFormatter('ZdSelect');
5739
+ return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator });
5766
5740
  });
5767
5741
  core.FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', ({ column, value, row, componentProps, }) => {
5768
5742
  if (!value || !Array.isArray(value) || value.length === 0)
@@ -5962,21 +5936,25 @@
5962
5936
  up: {
5963
5937
  event: this.navigateUp.bind(this),
5964
5938
  stop: true,
5939
+ index: 99,
5965
5940
  active: true,
5966
5941
  },
5967
5942
  down: {
5968
5943
  event: this.navigateDown.bind(this),
5969
5944
  stop: true,
5945
+ index: 99,
5970
5946
  active: true,
5971
5947
  },
5972
5948
  pageup: {
5973
5949
  event: this.navigatePageUp.bind(this),
5974
5950
  stop: true,
5951
+ index: 99,
5975
5952
  active: true,
5976
5953
  },
5977
5954
  pagedown: {
5978
5955
  event: this.navigatePageDown.bind(this),
5979
5956
  stop: true,
5957
+ index: 99,
5980
5958
  active: true,
5981
5959
  },
5982
5960
  };
@@ -6364,6 +6342,7 @@
6364
6342
  * Enter edit mode on double click
6365
6343
  */
6366
6344
  this.doubleClickEdit = false;
6345
+ this.singleEdit = false;
6367
6346
  /**
6368
6347
  * Edited rows
6369
6348
  * @private
@@ -6383,6 +6362,7 @@
6383
6362
  this.cancelEditedRowsKeyMapping = {
6384
6363
  esc: {
6385
6364
  event: this.cancelEditedRows.bind(this),
6365
+ index: 99,
6386
6366
  stop: true,
6387
6367
  input: true,
6388
6368
  active: true,
@@ -6392,6 +6372,7 @@
6392
6372
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
6393
6373
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
6394
6374
  this.editingNewRows = this.getInitValue('editingNewRows', props.editingNewRows, this.editingNewRows);
6375
+ this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
6395
6376
  this.createAccessors();
6396
6377
  }
6397
6378
  onMounted(element) {
@@ -6500,6 +6481,13 @@
6500
6481
  });
6501
6482
  }
6502
6483
  }
6484
+ getVisibleValue(row, column) {
6485
+ const key = row[this.datasource.uniqueKey];
6486
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
6487
+ return this.editedRows[key][column.name];
6488
+ }
6489
+ return row[column.name];
6490
+ }
6503
6491
  /**
6504
6492
  * Returns editable component properties based on the column definition
6505
6493
  * @param column Column definition
@@ -6510,13 +6498,7 @@
6510
6498
  getEditableComponent(column, row, cellProps, events) {
6511
6499
  const key = row[this.datasource.uniqueKey];
6512
6500
  const compName = this.getCompName(key, column.name);
6513
- let colValue;
6514
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
6515
- colValue = this.editedRows[key][column.name];
6516
- }
6517
- else {
6518
- colValue = row[column.name];
6519
- }
6501
+ const colValue = this.getVisibleValue(row, column);
6520
6502
  const componentProps = merge__default["default"]({}, column.componentProps, cellProps === null || cellProps === void 0 ? void 0 : cellProps.componentProps);
6521
6503
  let compEvents = {};
6522
6504
  if (componentProps && componentProps.events) {
@@ -6657,7 +6639,9 @@
6657
6639
  */
6658
6640
  cancelEditedRows() {
6659
6641
  return __awaiter(this, void 0, void 0, function* () {
6642
+ const { page } = this.datasource;
6660
6643
  yield this.cancelAddedRows();
6644
+ yield this.datasource.setPage(page);
6661
6645
  this.editing = false;
6662
6646
  this.editedRows = {};
6663
6647
  this.invalidComponents = {};
@@ -6665,7 +6649,7 @@
6665
6649
  }
6666
6650
  cancelAddedRows() {
6667
6651
  return __awaiter(this, void 0, void 0, function* () {
6668
- const { data, page } = this.datasource;
6652
+ const { data } = this.datasource;
6669
6653
  const allData = this.datasource.allData || data;
6670
6654
  Promise.resolve(allData);
6671
6655
  for (let index = allData.length - 1; index >= 0; index -= 1) {
@@ -6675,8 +6659,6 @@
6675
6659
  }
6676
6660
  }
6677
6661
  yield this.datasource.updateData(allData);
6678
- yield this.datasource.get();
6679
- yield this.datasource.setPage(page);
6680
6662
  });
6681
6663
  }
6682
6664
  addDataRow(row) {
@@ -6692,6 +6674,7 @@
6692
6674
  */
6693
6675
  saveEditedRows(revalidate = false) {
6694
6676
  return __awaiter(this, void 0, void 0, function* () {
6677
+ const { page } = this.datasource;
6695
6678
  yield this.cancelAddedRows();
6696
6679
  const response = yield Promise.all(this.getEditedRows(revalidate).map((row) => this.addDataRow(row)));
6697
6680
  this.editing = false;
@@ -6699,7 +6682,7 @@
6699
6682
  this.addedRows = {};
6700
6683
  this.invalidComponents = {};
6701
6684
  this.addedRows = {};
6702
- yield this.datasource.get();
6685
+ yield this.datasource.setPage(page);
6703
6686
  return response;
6704
6687
  });
6705
6688
  }
@@ -6708,7 +6691,7 @@
6708
6691
  * @param revalidate Defines if the fields should be revalidated
6709
6692
  * @throws Will throw when it finds an invalid row
6710
6693
  */
6711
- getEditedRows(revalidate = false) {
6694
+ getEditedRows(revalidate = false, silent = false) {
6712
6695
  const editedRows = [];
6713
6696
  Object.keys(this.editedRows).forEach((key) => {
6714
6697
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
@@ -6719,7 +6702,7 @@
6719
6702
  delete row[`${attr}_original`];
6720
6703
  }
6721
6704
  });
6722
- if (!this.isGridValid(revalidate)) {
6705
+ if (!silent && !this.isGridValid(revalidate)) {
6723
6706
  throw new Error('Invalid rows');
6724
6707
  }
6725
6708
  editedRows.push(row);
@@ -7491,16 +7474,19 @@
7491
7474
  yield this.setValue(this.value, false);
7492
7475
  this.removePushedValue();
7493
7476
  }
7494
- if (this.pushedValue && this.indexOf(this.pushedValue) === -1) {
7495
- const filterValue = this.pushedValue[this.dataValue];
7496
- const foundInData = this.datasource.data.find(this.getCondition(filterValue));
7497
- if (!foundInData) {
7498
- this.datasource.data.unshift(this.pushedValue);
7499
- }
7500
- }
7477
+ this.insertSelected();
7501
7478
  return response;
7502
7479
  });
7503
7480
  }
7481
+ insertSelected() {
7482
+ if (this.datasource.search || !this.pushedValue || this.indexOf(this.pushedValue) !== -1)
7483
+ return;
7484
+ const filterValue = this.pushedValue[this.dataValue];
7485
+ const foundInData = this.datasource.data.find(this.getCondition(filterValue));
7486
+ if (!foundInData) {
7487
+ this.datasource.data.unshift(this.pushedValue);
7488
+ }
7489
+ }
7504
7490
  get search() {
7505
7491
  return this.searchValue;
7506
7492
  }
@@ -7780,14 +7766,14 @@
7780
7766
  loadMore() {
7781
7767
  return __awaiter(this, void 0, void 0, function* () {
7782
7768
  yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
7783
- if (!this.datasource.search) {
7784
- this.afterLoad();
7785
- const { dataValue } = this;
7786
- const isSelected = this.selectValue && this.pushedValue && this.selectValue[dataValue] === this.pushedValue[dataValue];
7787
- if (isSelected)
7788
- return;
7789
- this.removePushedValue();
7790
- }
7769
+ if (this.datasource.search)
7770
+ return;
7771
+ this.afterLoad();
7772
+ const { dataValue } = this;
7773
+ const isSelected = this.selectValue && this.pushedValue && this.selectValue[dataValue] === this.pushedValue[dataValue];
7774
+ if (isSelected)
7775
+ return;
7776
+ this.removePushedValue();
7791
7777
  });
7792
7778
  }
7793
7779
  /**
@@ -9896,7 +9882,6 @@
9896
9882
  const parsedValue = this.parserFn(value, this);
9897
9883
  if (parsedValue !== this.datasource.search) {
9898
9884
  yield this.datasource.setSearch(parsedValue);
9899
- this.insertSelected();
9900
9885
  }
9901
9886
  });
9902
9887
  }
@@ -9925,6 +9910,7 @@
9925
9910
  yield this.updateSearch(value);
9926
9911
  }
9927
9912
  else {
9913
+ this.datasource.search = value;
9928
9914
  if (!this.manualMode) {
9929
9915
  this.datasource.data = [...this.cachedData];
9930
9916
  this.datasource.total = this.cachedTotal;
@@ -9952,29 +9938,11 @@
9952
9938
  if (!value || value.length === 0) {
9953
9939
  return [];
9954
9940
  }
9955
- const dataTextNames = [];
9956
- const masks = [];
9957
- this.dataText.forEach((text) => {
9958
- if (typeof text === 'string') {
9959
- dataTextNames.push(text);
9960
- masks.push('');
9961
- }
9962
- else {
9963
- dataTextNames.push(text.name);
9964
- masks.push(text.mask);
9965
- }
9966
- });
9941
+ const selectFormatter = core.FormatterParserProvider.getFormatter('ZdSelect');
9967
9942
  const formattedValue = value.map((row) => {
9968
9943
  const isDisabled = this.dataDisabled && row[this.dataDisabled];
9969
9944
  const formattedRow = { value: row[this.dataValue], disabled: isDisabled, originalRow: row };
9970
- formattedRow.text = dataTextNames.reduce((result, columnName, index) => {
9971
- if (row[columnName]) {
9972
- const separator = index > 0 ? this.dataTextSeparator : '';
9973
- const masked = masks[index] ? core.Mask.getValueWithMask(row[columnName], masks[index]) : row[columnName];
9974
- return result + separator + masked;
9975
- }
9976
- return result;
9977
- }, '');
9945
+ formattedRow.text = selectFormatter(row, this);
9978
9946
  return formattedRow;
9979
9947
  });
9980
9948
  return formattedValue;
@@ -10004,7 +9972,6 @@
10004
9972
  const foundInData = this.datasource.data.find(this.getCondition(value));
10005
9973
  return !foundInData;
10006
9974
  });
10007
- this.insertSelected();
10008
9975
  if (!this.datasource.search) {
10009
9976
  this.setCache();
10010
9977
  }
@@ -10076,9 +10043,6 @@
10076
10043
  return __awaiter(this, void 0, void 0, function* () {
10077
10044
  if (!this.preventLoadOnFocus) {
10078
10045
  yield this.datasource.get();
10079
- const values = this.datasource.data.map((row) => row[this.dataValue]);
10080
- // remove inserted items that are already in datasource
10081
- this.insertedValues = this.insertedValues.filter((inserted) => !values.includes(inserted[this.dataValue]));
10082
10046
  this.preventLoadOnFocus = true;
10083
10047
  }
10084
10048
  this.setCache();
@@ -12650,11 +12614,13 @@
12650
12614
  right: {
12651
12615
  event: this.navigateToggle.bind(this, false),
12652
12616
  stop: true,
12617
+ index: 99,
12653
12618
  active: true,
12654
12619
  },
12655
12620
  left: {
12656
12621
  event: this.navigateToggle.bind(this, true),
12657
12622
  stop: true,
12623
+ index: 99,
12658
12624
  active: true,
12659
12625
  },
12660
12626
  };
@@ -12891,6 +12857,7 @@
12891
12857
  * Editing rows
12892
12858
  */
12893
12859
  this.editing = false;
12860
+ this.singleEdit = false;
12894
12861
  /**
12895
12862
  * Edited rows
12896
12863
  * @private
@@ -12908,6 +12875,7 @@
12908
12875
  this.cancelEditedRowsKeyMapping = {
12909
12876
  esc: {
12910
12877
  event: this.cancelEditedRows.bind(this),
12878
+ index: 99,
12911
12879
  stop: true,
12912
12880
  input: true,
12913
12881
  active: true,
@@ -12915,6 +12883,7 @@
12915
12883
  };
12916
12884
  this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
12917
12885
  this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
12886
+ this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
12918
12887
  this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
12919
12888
  this.createAccessors();
12920
12889
  }
@@ -13024,6 +12993,13 @@
13024
12993
  });
13025
12994
  }
13026
12995
  }
12996
+ getVisibleValue(row, column) {
12997
+ const key = row[this.datasource.uniqueKey];
12998
+ if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
12999
+ return this.editedRows[key][column.name];
13000
+ }
13001
+ return row[column.name];
13002
+ }
13027
13003
  /**
13028
13004
  * Returns editable component properties based on the column definition
13029
13005
  * @param column Column definition
@@ -13034,13 +13010,7 @@
13034
13010
  getEditableComponent(column, row, cellProps, events) {
13035
13011
  const key = row[this.datasource.uniqueKey];
13036
13012
  const compName = this.getCompName(key, column.name);
13037
- let colValue;
13038
- if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.name)) {
13039
- colValue = this.editedRows[key][column.name];
13040
- }
13041
- else {
13042
- colValue = row[column.name];
13043
- }
13013
+ const colValue = this.getVisibleValue(row, column);
13044
13014
  const componentProps = merge__default["default"]({}, column.componentProps, cellProps.componentProps);
13045
13015
  let compEvents = {};
13046
13016
  if (componentProps && componentProps.events) {
@@ -13136,10 +13106,24 @@
13136
13106
  * @param column Column
13137
13107
  * @param row Row
13138
13108
  */
13139
- isValid(column, row) {
13109
+ isValid(column, row, revalidate = false) {
13140
13110
  const key = row[this.datasource.uniqueKey];
13141
13111
  const compName = this.getCompName(key, column.name);
13142
- return !Object.prototype.hasOwnProperty.call(this.invalidComponents, compName);
13112
+ if (!revalidate) {
13113
+ return !Object.prototype.hasOwnProperty.call(this.invalidComponents, compName);
13114
+ }
13115
+ try {
13116
+ const input = this.getComponent(key, column.name);
13117
+ const isValid = input.validate();
13118
+ this.checkCompValidity(input);
13119
+ return isValid;
13120
+ }
13121
+ catch (e) {
13122
+ if (e instanceof core.InstanceNotFoundError) {
13123
+ return true;
13124
+ }
13125
+ throw e;
13126
+ }
13143
13127
  }
13144
13128
  /**
13145
13129
  * Cancels all edited rows and enable grid components
@@ -13182,7 +13166,7 @@
13182
13166
  * Retrieves all edited rows if they are valid
13183
13167
  * @throws Will throw when it finds an invalid row
13184
13168
  */
13185
- getEditedRows() {
13169
+ getEditedRows(revalidate = false, silent = false) {
13186
13170
  const editedRows = [];
13187
13171
  Object.keys(this.editedRows).forEach((key) => {
13188
13172
  const row = Object.assign(Object.assign({}, this.editedRows[key].originalRow), this.editedRows[key]);
@@ -13195,15 +13179,29 @@
13195
13179
  delete row[attr];
13196
13180
  }
13197
13181
  });
13198
- if (!this.isGridValid()) {
13182
+ if (!silent && !this.isGridValid(revalidate)) {
13199
13183
  throw new Error('Invalid rows');
13200
13184
  }
13201
13185
  editedRows.push(row);
13202
13186
  });
13203
13187
  return editedRows;
13204
13188
  }
13205
- isGridValid() {
13206
- return Object.keys(this.invalidComponents).length === 0;
13189
+ /**
13190
+ * Checks whether the grid is valid or not
13191
+ * @param revalidate Defines if the fields should be revalidated
13192
+ */
13193
+ isGridValid(revalidate = false) {
13194
+ if (!revalidate) {
13195
+ return Object.keys(this.invalidComponents).length === 0;
13196
+ }
13197
+ let allValid = true;
13198
+ this.datasource.data.forEach((row) => this.columns.forEach((column) => {
13199
+ if (!column.isVisible || !column.editable)
13200
+ return;
13201
+ if (!this.isValid(column, row, true))
13202
+ allValid = false;
13203
+ }));
13204
+ return allValid;
13207
13205
  }
13208
13206
  /**
13209
13207
  * Gets the editable component name
@@ -13879,7 +13877,7 @@
13879
13877
  else if (column.componentProps && Object.keys(column.componentProps).length) {
13880
13878
  const { component } = column.componentProps;
13881
13879
  if (this.isNumberComponent(component)) {
13882
- format = { type: 'float' };
13880
+ format = { type: 'float', params: {} };
13883
13881
  mask = this.checkAccessor(column.componentProps.mask);
13884
13882
  if (mask) {
13885
13883
  format.params = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.88.1",
3
+ "version": "1.89.1",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -42,5 +42,6 @@
42
42
  "@types/lodash.times": "4.3.*",
43
43
  "lodash.times": "4.3.*",
44
44
  "mockdate": "3.0.*"
45
- }
45
+ },
46
+ "gitHead": "b8f34057380d34e71990d639009264adf0a652e6"
46
47
  }
@@ -26,10 +26,6 @@ export declare class GridColumn extends Column implements IGridColumn {
26
26
  events?: import("..").IComponentEvents<import("@zeedhi/core").IEventParam<any>> | undefined;
27
27
  directives?: import("..").IComponentDirectives | undefined;
28
28
  isVisible?: string | boolean | undefined;
29
- /**
30
- * Creates a new Grid Column.
31
- * @param props Grid column properties
32
- */
33
29
  dark?: boolean | undefined;
34
30
  light?: boolean | undefined;
35
31
  keyMap?: import("@zeedhi/core").IKeyMap<import("@zeedhi/core").IEventParam<any>> | undefined;
@@ -1,5 +1,6 @@
1
- import { IDictionary } from '@zeedhi/core';
1
+ import { IDictionary, IKeyMap } from '@zeedhi/core';
2
2
  import { IGridColumnEditable, IGridEditable } from './interfaces';
3
+ import { Input } from '../zd-input/input';
3
4
  import { Grid } from '..';
4
5
  import { GridColumnEditable } from './grid-column-editable';
5
6
  /**
@@ -25,6 +26,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
25
26
  row: IDictionary<any>;
26
27
  component: GridEditable;
27
28
  }) => boolean;
29
+ singleEdit: boolean;
28
30
  /**
29
31
  * Edited rows
30
32
  * @private
@@ -41,7 +43,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
41
43
  */
42
44
  private invalidComponents;
43
45
  editingNewRows: boolean;
44
- protected cancelEditedRowsKeyMapping: any;
46
+ protected cancelEditedRowsKeyMapping: IKeyMap;
45
47
  constructor(props: IGridEditable);
46
48
  onMounted(element: any): void;
47
49
  onBeforeDestroy(): void;
@@ -87,6 +89,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
87
89
  * @param element DOM Element
88
90
  */
89
91
  selectAllClick(isSelected: boolean, event: Event, element: any): void;
92
+ getVisibleValue(row: IDictionary, column: IGridColumnEditable): any;
90
93
  /**
91
94
  * Returns editable component properties based on the column definition
92
95
  * @param column Column definition
@@ -111,7 +114,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
111
114
  /**
112
115
  * change event of editable components
113
116
  */
114
- private changeEditableComponent;
117
+ protected changeEditableComponent(column: IGridColumnEditable, row: IDictionary<any>, value: any, component?: Input): void;
115
118
  private updateOriginalRow;
116
119
  /**
117
120
  * Checks if column is edited
@@ -143,7 +146,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
143
146
  * @param revalidate Defines if the fields should be revalidated
144
147
  * @throws Will throw when it finds an invalid row
145
148
  */
146
- getEditedRows(revalidate?: boolean): IDictionary<any>[];
149
+ getEditedRows(revalidate?: boolean, silent?: boolean): IDictionary<any>[];
147
150
  /**
148
151
  * Checks whether the grid is valid or not
149
152
  * @param revalidate Defines if the fields should be revalidated
@@ -1,4 +1,4 @@
1
- import { IDictionary } from '@zeedhi/core';
1
+ import { IDictionary, IKeyMap } from '@zeedhi/core';
2
2
  import { Component } from '../zd-component/component';
3
3
  import { IComponent, IComponentRender } from '../zd-component/interfaces';
4
4
  import { Iterable } from '../zd-iterable/iterable';
@@ -145,7 +145,7 @@ export declare class Grid extends Iterable implements IGrid {
145
145
  * @param props Grid properties
146
146
  */
147
147
  constructor(props: IGrid);
148
- protected navigationKeyMapping: any;
148
+ protected navigationKeyMapping: IKeyMap;
149
149
  onMounted(element: any): void;
150
150
  onBeforeDestroy(): void;
151
151
  /**
@@ -64,6 +64,7 @@ export interface IGridEditable extends IGrid {
64
64
  columns?: IGridColumnEditable[];
65
65
  doubleClickEdit?: boolean;
66
66
  events?: IGridEditableEvents;
67
+ singleEdit?: boolean;
67
68
  canEditRow?: (args: {
68
69
  row: IDictionary<any>;
69
70
  component: GridEditable;
@@ -123,6 +123,7 @@ export declare class Select extends TextInput implements ISelect {
123
123
  */
124
124
  private getDefaultDatasource;
125
125
  overrideGet(): void;
126
+ protected insertSelected(): void;
126
127
  get search(): string;
127
128
  set search(value: string);
128
129
  /**
@@ -66,7 +66,7 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
66
66
  /**
67
67
  * Inserts selected items in datasource
68
68
  */
69
- private insertSelected;
69
+ protected insertSelected(): void;
70
70
  protected removePushedValue(): void;
71
71
  protected doSearch(value: string): Promise<void>;
72
72
  /**
@@ -13,6 +13,7 @@ export interface ITreeGridEditable extends ITreeGrid {
13
13
  columns?: IGridColumnEditable[];
14
14
  doubleClickEdit?: boolean;
15
15
  events?: IGridEditableEvents;
16
+ singleEdit?: boolean;
16
17
  canEditRow?: (args: {
17
18
  row: IDictionary<any>;
18
19
  component: TreeGridEditable;
@@ -19,6 +19,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
19
19
  row: IDictionary<any>;
20
20
  component: TreeGridEditable;
21
21
  }) => boolean;
22
+ singleEdit: boolean;
22
23
  /**
23
24
  * Edited rows
24
25
  * @private
@@ -79,6 +80,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
79
80
  * @param element DOM Element
80
81
  */
81
82
  selectAllClick(isSelected: boolean, event?: Event, element?: any): void;
83
+ getVisibleValue(row: IDictionary, column: IGridColumnEditable): any;
82
84
  /**
83
85
  * Returns editable component properties based on the column definition
84
86
  * @param column Column definition
@@ -116,7 +118,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
116
118
  * @param column Column
117
119
  * @param row Row
118
120
  */
119
- isValid(column: IGridColumnEditable, row: IDictionary): boolean;
121
+ isValid(column: IGridColumnEditable, row: IDictionary, revalidate?: boolean): boolean;
120
122
  /**
121
123
  * Cancels all edited rows and enable grid components
122
124
  */
@@ -135,8 +137,12 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
135
137
  * Retrieves all edited rows if they are valid
136
138
  * @throws Will throw when it finds an invalid row
137
139
  */
138
- getEditedRows(): IDictionary<any>[];
139
- isGridValid(): boolean;
140
+ getEditedRows(revalidate?: boolean, silent?: boolean): IDictionary<any>[];
141
+ /**
142
+ * Checks whether the grid is valid or not
143
+ * @param revalidate Defines if the fields should be revalidated
144
+ */
145
+ isGridValid(revalidate?: boolean): boolean;
140
146
  /**
141
147
  * Gets the editable component name
142
148
  * @param key Row unique key
@@ -0,0 +1,12 @@
1
+ export interface IJSONObject {
2
+ path: string;
3
+ }
4
+ export declare class JsonCacheService {
5
+ /**
6
+ * jsons collection
7
+ */
8
+ static jsonCollection: IJSONObject[];
9
+ static saveJSONCache(jsonCollection: IJSONObject[]): Promise<void>;
10
+ static getJSONCache(path: string): any;
11
+ static clearJSONCache(jsonCollection: IJSONObject[]): void;
12
+ }