@zeedhi/common 1.114.0 → 1.116.0

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.
@@ -4434,6 +4434,9 @@ class DateRange extends TextInput {
4434
4434
  userAppendIconClick({ event, element, component });
4435
4435
  }
4436
4436
  };
4437
+ if (this.value && Array.isArray(this.value)) {
4438
+ this.internalDisplayValue = this.formatter(this.value);
4439
+ }
4437
4440
  }
4438
4441
  /**
4439
4442
  * Character that will separate the two dates
@@ -9713,6 +9716,22 @@ class TreeDataStructure {
9713
9716
  }
9714
9717
  return result;
9715
9718
  }
9719
+ loadChildren(row, rowIndex = -1) {
9720
+ return __awaiter(this, void 0, void 0, function* () {
9721
+ const { uniqueKey } = this.originalDatasource;
9722
+ let index = rowIndex;
9723
+ if (index === -1) {
9724
+ index = this.findDataIndex(this.treeData, row[uniqueKey]);
9725
+ }
9726
+ const originalData = [...this.originalDatasource.data];
9727
+ const data = yield this.originalDatasource.addFilter(this.parentField, row[uniqueKey]);
9728
+ originalData.splice(index + 1, 0, ...data);
9729
+ this.originalDatasource.data = originalData;
9730
+ this.originalDatasource.currentRow = this.clearRow(row);
9731
+ delete this.originalDatasource.filter[this.parentField];
9732
+ return data;
9733
+ });
9734
+ }
9716
9735
  /**
9717
9736
  * Expands or collapses a row
9718
9737
  * @param row Row object
@@ -9727,17 +9746,7 @@ class TreeDataStructure {
9727
9746
  && this.fetchOnDemand
9728
9747
  && rowData.tree__children.length === 1
9729
9748
  && !rowData.tree__children[0][uniqueKey]) {
9730
- let index = rowIndex;
9731
- if (index === -1) {
9732
- index = this.findDataIndex(this.treeData, row[uniqueKey]);
9733
- }
9734
- const originalData = [...this.originalDatasource.data];
9735
- const data = yield this.originalDatasource.addFilter(this.parentField, row[uniqueKey]);
9736
- originalData.splice(index + 1, 0, ...data);
9737
- this.originalDatasource.data = originalData;
9738
- this.originalDatasource.currentRow = this.clearRow(row);
9739
- delete this.originalDatasource.filter[this.parentField];
9740
- return data;
9749
+ return this.loadChildren(row, rowIndex);
9741
9750
  }
9742
9751
  return undefined;
9743
9752
  });
@@ -15461,6 +15470,11 @@ class TreeGrid extends Grid {
15461
15470
  return response;
15462
15471
  });
15463
15472
  }
15473
+ loadChildren(row, rowIndex = -1) {
15474
+ return __awaiter(this, void 0, void 0, function* () {
15475
+ yield this.treeDataStructure.loadChildren(row, rowIndex);
15476
+ });
15477
+ }
15464
15478
  /**
15465
15479
  * Expands or collapses a row
15466
15480
  * @param row Row object
@@ -4441,6 +4441,9 @@
4441
4441
  userAppendIconClick({ event, element, component });
4442
4442
  }
4443
4443
  };
4444
+ if (this.value && Array.isArray(this.value)) {
4445
+ this.internalDisplayValue = this.formatter(this.value);
4446
+ }
4444
4447
  }
4445
4448
  /**
4446
4449
  * Character that will separate the two dates
@@ -9720,6 +9723,22 @@
9720
9723
  }
9721
9724
  return result;
9722
9725
  }
9726
+ loadChildren(row, rowIndex = -1) {
9727
+ return __awaiter(this, void 0, void 0, function* () {
9728
+ const { uniqueKey } = this.originalDatasource;
9729
+ let index = rowIndex;
9730
+ if (index === -1) {
9731
+ index = this.findDataIndex(this.treeData, row[uniqueKey]);
9732
+ }
9733
+ const originalData = [...this.originalDatasource.data];
9734
+ const data = yield this.originalDatasource.addFilter(this.parentField, row[uniqueKey]);
9735
+ originalData.splice(index + 1, 0, ...data);
9736
+ this.originalDatasource.data = originalData;
9737
+ this.originalDatasource.currentRow = this.clearRow(row);
9738
+ delete this.originalDatasource.filter[this.parentField];
9739
+ return data;
9740
+ });
9741
+ }
9723
9742
  /**
9724
9743
  * Expands or collapses a row
9725
9744
  * @param row Row object
@@ -9734,17 +9753,7 @@
9734
9753
  && this.fetchOnDemand
9735
9754
  && rowData.tree__children.length === 1
9736
9755
  && !rowData.tree__children[0][uniqueKey]) {
9737
- let index = rowIndex;
9738
- if (index === -1) {
9739
- index = this.findDataIndex(this.treeData, row[uniqueKey]);
9740
- }
9741
- const originalData = [...this.originalDatasource.data];
9742
- const data = yield this.originalDatasource.addFilter(this.parentField, row[uniqueKey]);
9743
- originalData.splice(index + 1, 0, ...data);
9744
- this.originalDatasource.data = originalData;
9745
- this.originalDatasource.currentRow = this.clearRow(row);
9746
- delete this.originalDatasource.filter[this.parentField];
9747
- return data;
9756
+ return this.loadChildren(row, rowIndex);
9748
9757
  }
9749
9758
  return undefined;
9750
9759
  });
@@ -15468,6 +15477,11 @@
15468
15477
  return response;
15469
15478
  });
15470
15479
  }
15480
+ loadChildren(row, rowIndex = -1) {
15481
+ return __awaiter(this, void 0, void 0, function* () {
15482
+ yield this.treeDataStructure.loadChildren(row, rowIndex);
15483
+ });
15484
+ }
15471
15485
  /**
15472
15486
  * Expands or collapses a row
15473
15487
  * @param row Row object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.114.0",
3
+ "version": "1.116.0",
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": "de1ca24dc7963c2b201defc04d50e054225e54bc"
46
+ "gitHead": "322902d25131c090c4a2f945eadc00ce03dc615e"
47
47
  }
@@ -70,6 +70,7 @@ export declare class TreeGrid extends Grid implements ITreeGrid {
70
70
  * @returns The response is an array of promises.
71
71
  */
72
72
  deleteRows(): Promise<any[]>;
73
+ loadChildren(row: IDictionary, rowIndex?: number): Promise<void>;
73
74
  /**
74
75
  * Expands or collapses a row
75
76
  * @param row Row object
@@ -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
+ }
@@ -103,6 +103,7 @@ export declare class TreeDataStructure {
103
103
  * @returns next row index
104
104
  */
105
105
  nextOpenedRow(rowIdx: number): number;
106
+ loadChildren(row: IDictionary, rowIndex?: number): Promise<IDictionary<any>[]>;
106
107
  /**
107
108
  * Expands or collapses a row
108
109
  * @param row Row object
@@ -1,3 +0,0 @@
1
- import { IDictionary } from '@zeedhi/core';
2
- declare const uniqueBy: (a: IDictionary[], key: string) => IDictionary<any>[];
3
- export { uniqueBy };