@easydata/crud 1.4.0-beta01 → 1.4.0-rc01

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.
Files changed (33) hide show
  1. package/dist/browser/easydata.css +1 -1
  2. package/dist/browser/easydata.css.map +1 -1
  3. package/dist/browser/easydata.js +735 -545
  4. package/dist/browser/easydata.js.map +1 -1
  5. package/dist/browser/easydata.min.css +1 -1
  6. package/dist/browser/easydata.min.js +1 -1
  7. package/dist/browser/easydata.min.js.LICENSE.txt +0 -2
  8. package/dist/browser/easydata.min.js.map +1 -1
  9. package/dist/bundles/easydata.crud.js +449 -270
  10. package/dist/bundles/easydata.crud.js.map +1 -1
  11. package/dist/bundles/easydata.crud.min.js +1 -1
  12. package/dist/bundles/easydata.crud.min.js.LICENSE.txt +0 -2
  13. package/dist/bundles/easydata.crud.min.js.map +1 -1
  14. package/dist/lib/filter/text_data_filter.d.ts +2 -2
  15. package/dist/lib/filter/text_data_filter.js +18 -19
  16. package/dist/lib/filter/text_data_filter.js.map +1 -1
  17. package/dist/lib/form/entity_edit_form.js.map +1 -1
  18. package/dist/lib/form/entity_form_builder.js +36 -25
  19. package/dist/lib/form/entity_form_builder.js.map +1 -1
  20. package/dist/lib/i18n/text_resources.js +1 -1
  21. package/dist/lib/i18n/text_resources.js.map +1 -1
  22. package/dist/lib/main/data_context.d.ts +12 -8
  23. package/dist/lib/main/data_context.js +37 -27
  24. package/dist/lib/main/data_context.js.map +1 -1
  25. package/dist/lib/main/easy_data_server_loader.js +2 -2
  26. package/dist/lib/main/easy_data_server_loader.js.map +1 -1
  27. package/dist/lib/views/easy_data_view_dispatcher.js +1 -0
  28. package/dist/lib/views/easy_data_view_dispatcher.js.map +1 -1
  29. package/dist/lib/views/entity_data_view.js +15 -13
  30. package/dist/lib/views/entity_data_view.js.map +1 -1
  31. package/dist/lib/views/options.d.ts +2 -0
  32. package/dist/lib/widgets/text_filter_widget.js.map +1 -1
  33. package/package.json +4 -4
@@ -842,7 +842,7 @@ var i18n_i18n;
842
842
  var utils_utils;
843
843
  (function (utils) {
844
844
  function getAllDataTypes() {
845
- return Object.values(DataType);
845
+ return Object.values(DataType).filter(function (item) { return typeof item === "number"; });
846
846
  }
847
847
  utils.getAllDataTypes = getAllDataTypes;
848
848
  function getDateDataTypes() {
@@ -850,12 +850,16 @@ var utils_utils;
850
850
  }
851
851
  utils.getDateDataTypes = getDateDataTypes;
852
852
  function getStringDataTypes() {
853
- return [DataType.String, DataType.Memo];
853
+ return [DataType.String, DataType.Memo, DataType.FixedChar];
854
854
  }
855
855
  utils.getStringDataTypes = getStringDataTypes;
856
856
  var _numericTypes = [DataType.Byte, DataType.Word, DataType.Int32,
857
- DataType.Int64, DataType.Float, DataType.Currency];
858
- var _intTypes = [DataType.Byte, DataType.Word, DataType.Int32, DataType.Int64];
857
+ DataType.Int64, DataType.Float, DataType.Currency, DataType.Autoinc];
858
+ function getNumericDataTypes() {
859
+ return _numericTypes;
860
+ }
861
+ utils.getNumericDataTypes = getNumericDataTypes;
862
+ var _intTypes = [DataType.Byte, DataType.Word, DataType.Int32, DataType.Int64, DataType.Autoinc];
859
863
  //-------------- object functions -------------------
860
864
  /**
861
865
  * Copy the content of all objests passed in `args` parameters into `target`
@@ -920,7 +924,7 @@ var utils_utils;
920
924
  hashSet.set(sourceVal, target[key]);
921
925
  }
922
926
  else {
923
- if (typeof target[key] == 'undefined') {
927
+ if (typeof target[key] == 'undefined' || target[key] == null) {
924
928
  target[key] = Object.create(Object.getPrototypeOf(sourceVal));
925
929
  }
926
930
  hashSet.set(sourceVal, target[key]);
@@ -1449,7 +1453,7 @@ var http_client_HttpClient = /** @class */ (function () {
1449
1453
  var desc = {
1450
1454
  method: method,
1451
1455
  url: url,
1452
- headers: __assign({}, this.defaultHeaders, options.headers || {}),
1456
+ headers: __assign(__assign({}, this.defaultHeaders), options.headers || {}),
1453
1457
  queryParams: options.queryParams || {},
1454
1458
  data: data
1455
1459
  };
@@ -1595,6 +1599,12 @@ var MetaEntity = /** @class */ (function () {
1595
1599
  };
1596
1600
  internalProcessEntity(this);
1597
1601
  };
1602
+ MetaEntity.prototype.getFirstPrimaryAttr = function () {
1603
+ return this.getPrimaryAttrs()[0];
1604
+ };
1605
+ MetaEntity.prototype.getPrimaryAttrs = function () {
1606
+ return this.attributes.filter(function (attr) { return attr.isPrimaryKey; });
1607
+ };
1598
1608
  return MetaEntity;
1599
1609
  }());
1600
1610
 
@@ -2213,9 +2223,9 @@ var meta_data_MetaData = /** @class */ (function () {
2213
2223
  }());
2214
2224
 
2215
2225
  //# sourceMappingURL=meta_data.js.map
2216
- // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/core/dist/lib/data/aggr_calculator.js
2217
- var aggr_calculator_assign = (undefined && undefined.__assign) || function () {
2218
- aggr_calculator_assign = Object.assign || function(t) {
2226
+ // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/core/dist/lib/data/aggr_settings.js
2227
+ var aggr_settings_assign = (undefined && undefined.__assign) || function () {
2228
+ aggr_settings_assign = Object.assign || function(t) {
2219
2229
  for (var s, i = 1, n = arguments.length; i < n; i++) {
2220
2230
  s = arguments[i];
2221
2231
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -2223,7 +2233,7 @@ var aggr_calculator_assign = (undefined && undefined.__assign) || function () {
2223
2233
  }
2224
2234
  return t;
2225
2235
  };
2226
- return aggr_calculator_assign.apply(this, arguments);
2236
+ return aggr_settings_assign.apply(this, arguments);
2227
2237
  };
2228
2238
  /**
2229
2239
  * Defines aggregations settings for the current context.
@@ -2236,16 +2246,32 @@ var AggregationSettings = /** @class */ (function () {
2236
2246
  this.groups = [];
2237
2247
  this.useGrandTotals = false;
2238
2248
  this.useRecordCount = false;
2239
- this.caseSensitiveGroups = false;
2249
+ this._caseSensitiveGroups = false;
2240
2250
  this.COUNT_FIELD_NAME = 'GRPRECCNT';
2241
2251
  }
2252
+ Object.defineProperty(AggregationSettings.prototype, "caseSensitiveGroups", {
2253
+ get: function () {
2254
+ return this._caseSensitiveGroups;
2255
+ },
2256
+ set: function (value) {
2257
+ this._caseSensitiveGroups = value;
2258
+ this.updateCompareProc();
2259
+ },
2260
+ enumerable: true,
2261
+ configurable: true
2262
+ });
2263
+ AggregationSettings.prototype.updateCompareProc = function () {
2264
+ this.compareValues = this._caseSensitiveGroups
2265
+ ? this.strictCompare
2266
+ : this.caseInsensitiveCompare;
2267
+ };
2242
2268
  AggregationSettings.prototype.addGroup = function (settings) {
2243
2269
  var cols = settings.columns || this.colStore.getColumnIds(settings.from, settings.to);
2244
2270
  if (!this.colStore.validateColumns(cols))
2245
2271
  throw "Invalid columns: " + cols;
2246
2272
  if (this.hasColumnsInUse(cols))
2247
2273
  throw "Can't add same columns to different groups/aggregates";
2248
- this.groups.push(aggr_calculator_assign({ columns: cols, aggregates: null }, settings));
2274
+ this.groups.push(aggr_settings_assign({ columns: cols }, settings));
2249
2275
  return this;
2250
2276
  };
2251
2277
  AggregationSettings.prototype.addAggregateColumn = function (colIndexOrId, funcId) {
@@ -2270,7 +2296,7 @@ var AggregationSettings = /** @class */ (function () {
2270
2296
  var cols = [];
2271
2297
  var mappedGrops = this.groups.map(function (grp) {
2272
2298
  cols = cols.concat(grp.columns);
2273
- return aggr_calculator_assign({}, grp, { columns: Array.from(cols), aggregates: Array.from(_this.aggregates) });
2299
+ return aggr_settings_assign(aggr_settings_assign({}, grp), { columns: Array.from(cols), aggregates: Array.from(_this.aggregates) });
2274
2300
  });
2275
2301
  return mappedGrops;
2276
2302
  };
@@ -2362,10 +2388,35 @@ var AggregationSettings = /** @class */ (function () {
2362
2388
  }
2363
2389
  }
2364
2390
  };
2391
+ AggregationSettings.prototype.buildGroupKey = function (group, row) {
2392
+ var caseInsensitive = !this.caseSensitiveGroups;
2393
+ var result = {};
2394
+ if (group) {
2395
+ for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
2396
+ var colId = _a[_i];
2397
+ var keyVal = row.getValue(colId);
2398
+ if (caseInsensitive && typeof (keyVal) === 'string') {
2399
+ keyVal = keyVal.toLowerCase();
2400
+ }
2401
+ result[colId] = keyVal;
2402
+ }
2403
+ }
2404
+ return result;
2405
+ };
2406
+ //returns true if value1 == value2
2407
+ AggregationSettings.prototype.strictCompare = function (value1, value2) {
2408
+ return value1 === value2;
2409
+ };
2410
+ //makes a case insensative comparision of two values and return true if there are equal
2411
+ AggregationSettings.prototype.caseInsensitiveCompare = function (value1, value2) {
2412
+ var val1 = (typeof value1 === 'string') ? value1.toLowerCase() : value1;
2413
+ var val2 = (typeof value2 === 'string') ? value2.toLowerCase() : value2;
2414
+ return val1 === val2;
2415
+ };
2365
2416
  return AggregationSettings;
2366
2417
  }());
2367
2418
 
2368
- //# sourceMappingURL=aggr_calculator.js.map
2419
+ //# sourceMappingURL=aggr_settings.js.map
2369
2420
  // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/core/dist/lib/data/data_column.js
2370
2421
 
2371
2422
 
@@ -2393,6 +2444,7 @@ var data_column_DataColumn = /** @class */ (function () {
2393
2444
  this.groupFooterColumnTemplate = desc.gfct;
2394
2445
  this.style = desc.style || {};
2395
2446
  this.description = desc.description;
2447
+ this.calculatedWidth = 0;
2396
2448
  }
2397
2449
  return DataColumn;
2398
2450
  }());
@@ -2432,9 +2484,10 @@ var data_column_DataColumnList = /** @class */ (function () {
2432
2484
  .map(function (col, index) { return index; });
2433
2485
  };
2434
2486
  DataColumnList.prototype.put = function (index, col) {
2435
- //!!!!!!!!!check on "out of index"
2436
- this.items[index] = col;
2437
- this.updateDateColumnIdx();
2487
+ if (index >= 0 && index < this.count) {
2488
+ this.items[index] = col;
2489
+ this.updateDateColumnIdx();
2490
+ }
2438
2491
  };
2439
2492
  DataColumnList.prototype.move = function (col, newIndex) {
2440
2493
  var oldIndex = this.items.indexOf(col);
@@ -2444,8 +2497,12 @@ var data_column_DataColumnList = /** @class */ (function () {
2444
2497
  }
2445
2498
  };
2446
2499
  DataColumnList.prototype.get = function (index) {
2447
- //!!!!!!!!!check on "out of index"
2448
- return this.items[index];
2500
+ if (index >= 0 && index < this.count) {
2501
+ return this.items[index];
2502
+ }
2503
+ else {
2504
+ return null;
2505
+ }
2449
2506
  };
2450
2507
  DataColumnList.prototype.getIndex = function (id) {
2451
2508
  return this.mapper[id];
@@ -2529,16 +2586,23 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2529
2586
  function EasyDataTable(options) {
2530
2587
  this._chunkSize = 1000;
2531
2588
  this._elasticChunks = false;
2532
- // object keeps number keys sorted
2533
- this.chunkMap = {};
2589
+ this.cachedRows = [];
2534
2590
  this.total = 0;
2535
2591
  this.loader = null;
2536
2592
  this.needTotal = true;
2593
+ this.isInMemory = false;
2537
2594
  options = options || {};
2538
2595
  this._chunkSize = options.chunkSize || this._chunkSize;
2539
2596
  this._elasticChunks = options.elasticChunks || this._elasticChunks;
2540
2597
  this.loader = options.loader;
2598
+ if (typeof options.inMemory !== 'undefined') {
2599
+ this.isInMemory = options.inMemory;
2600
+ }
2601
+ if (this.isInMemory) {
2602
+ this.needTotal = false;
2603
+ }
2541
2604
  this._columns = new data_column_DataColumnList();
2605
+ this.onUpdate = options.onUpdate;
2542
2606
  if (options.columns) {
2543
2607
  for (var _i = 0, _a = options.columns; _i < _a.length; _i++) {
2544
2608
  var colDesc = _a[_i];
@@ -2569,7 +2633,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2569
2633
  this._chunkSize = value;
2570
2634
  this.total = 0;
2571
2635
  this.needTotal = !this.elasticChunks;
2572
- this.chunkMap = {};
2636
+ this.cachedRows = [];
2573
2637
  },
2574
2638
  enumerable: true,
2575
2639
  configurable: true
@@ -2582,7 +2646,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2582
2646
  this._elasticChunks = value;
2583
2647
  this.total = 0;
2584
2648
  this.needTotal = !this.elasticChunks;
2585
- this.chunkMap = {};
2649
+ this.cachedRows = [];
2586
2650
  },
2587
2651
  enumerable: true,
2588
2652
  configurable: true
@@ -2610,22 +2674,12 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2610
2674
  endIndex = this.total;
2611
2675
  }
2612
2676
  }
2613
- var lbChunk = Math.trunc(fromIndex / this._chunkSize);
2614
- var ubChunk = Math.trunc((endIndex - 1) / this._chunkSize);
2615
- var allChunksCached = true;
2616
- for (var i = lbChunk; i <= ubChunk; i++) {
2617
- if (!this.chunkMap[i]) {
2618
- allChunksCached = false;
2619
- break;
2620
- }
2677
+ if (this.isInMemory && endIndex > this.cachedRows.length) {
2678
+ endIndex = this.cachedRows.length;
2621
2679
  }
2680
+ var allChunksCached = endIndex <= this.cachedRows.length;
2622
2681
  if (allChunksCached) {
2623
- var resultArr = [];
2624
- for (var i = lbChunk; i <= ubChunk; i++) {
2625
- resultArr = resultArr.concat(this.chunkMap[i].rows);
2626
- }
2627
- var firstChunkOffset = this.chunkMap[lbChunk].offset;
2628
- return Promise.resolve(resultArr.slice(fromIndex - firstChunkOffset, endIndex - firstChunkOffset));
2682
+ return Promise.resolve(this.cachedRows.slice(fromIndex, endIndex));
2629
2683
  }
2630
2684
  //if loader is not defined
2631
2685
  if (!this.loader) {
@@ -2636,53 +2690,34 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2636
2690
  if (this.needTotal) {
2637
2691
  this.needTotal = false;
2638
2692
  }
2639
- var limit = this._chunkSize * (ubChunk - lbChunk + 1);
2640
- if (this.elasticChunks)
2641
- limit++;
2642
- return this.loader.loadChunk({
2643
- offset: lbChunk * this._chunkSize,
2693
+ var offset = this.cachedRows.length;
2694
+ var limit = endIndex - offset;
2695
+ if (limit < this._chunkSize) {
2696
+ limit = this._chunkSize;
2697
+ }
2698
+ var resultPromise = this.loader.loadChunk({
2699
+ offset: offset,
2644
2700
  limit: limit,
2645
2701
  needTotal: needTotal
2646
2702
  })
2647
2703
  .then(function (result) {
2648
- var chunks = result.table.getCachedChunks();
2649
2704
  if (needTotal) {
2650
2705
  _this.total = result.total;
2651
- if (endIndex > _this.total) {
2652
- endIndex = _this.total;
2653
- }
2654
2706
  }
2655
- var index = lbChunk;
2656
- for (var _i = 0, chunks_1 = chunks; _i < chunks_1.length; _i++) {
2657
- var chunk = chunks_1[_i];
2658
- _this.chunkMap[index] = {
2659
- offset: index * _this._chunkSize,
2660
- rows: chunk.rows
2661
- };
2662
- index++;
2707
+ Array.prototype.push.apply(_this.cachedRows, result.table.getCachedRows());
2708
+ if (endIndex > _this.cachedRows.length) {
2709
+ endIndex = _this.cachedRows.length;
2663
2710
  }
2664
2711
  if (_this.elasticChunks) {
2665
2712
  var count_1 = result.table.getCachedCount();
2666
- if (count_1 > 0) {
2667
- var chunk = _this.chunkMap[index - 1];
2668
- if (count_1 === limit) {
2669
- chunk.rows.splice(chunk.rows.length - 1, 1);
2670
- if (chunk.rows.length == 0) {
2671
- delete _this.chunkMap[index - 1];
2672
- }
2673
- }
2674
- if (count_1 < limit) {
2675
- _this.total = _this.getCachedCount();
2676
- }
2713
+ if (count_1 < limit) {
2714
+ _this.total = _this.cachedRows.length;
2677
2715
  }
2678
2716
  }
2679
- var resultArr = [];
2680
- for (var i = lbChunk; i <= ubChunk; i++) {
2681
- resultArr = resultArr.concat(_this.chunkMap[i].rows);
2682
- }
2683
- var firstChunkOffset = _this.chunkMap[lbChunk].offset;
2684
- return resultArr.slice(fromIndex - firstChunkOffset, endIndex - firstChunkOffset);
2717
+ _this.fireUpdated();
2718
+ return _this.cachedRows.slice(fromIndex, endIndex);
2685
2719
  });
2720
+ return resultPromise;
2686
2721
  };
2687
2722
  EasyDataTable.prototype.getRow = function (index) {
2688
2723
  return this.getRows({ offset: index, limit: 1 })
@@ -2694,14 +2729,13 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2694
2729
  EasyDataTable.prototype.setTotal = function (total) {
2695
2730
  this.total = total;
2696
2731
  this.needTotal = false;
2697
- this.chunkMap = {};
2698
2732
  };
2699
2733
  EasyDataTable.prototype.getCachedCount = function () {
2700
- return this.getCachedRows().length;
2734
+ return this.cachedRows.length;
2701
2735
  };
2702
2736
  EasyDataTable.prototype.clear = function () {
2703
2737
  this.columns.clear();
2704
- this.chunkMap = {};
2738
+ this.cachedRows = [];
2705
2739
  this.total = 0;
2706
2740
  this.needTotal = !this._elasticChunks;
2707
2741
  };
@@ -2734,60 +2768,33 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2734
2768
  }
2735
2769
  return null;
2736
2770
  };
2737
- EasyDataTable.prototype.addRow = function (rowOrValue) {
2771
+ EasyDataTable.prototype.addRow = function (rowOrValues) {
2738
2772
  var newRow;
2739
- if (Array.isArray(rowOrValue)) {
2773
+ if (Array.isArray(rowOrValues)) {
2774
+ var values = rowOrValues;
2740
2775
  var dateIdx = this._columns.getDateColumnIndexes();
2741
2776
  if (dateIdx.length > 0) {
2742
2777
  for (var _i = 0, dateIdx_1 = dateIdx; _i < dateIdx_1.length; _i++) {
2743
2778
  var idx = dateIdx_1[_i];
2744
- if (rowOrValue[idx]) {
2745
- rowOrValue[idx] = this.mapDate(rowOrValue[idx], this._columns.get(idx).type);
2779
+ if (values[idx]) {
2780
+ values[idx] = this.mapDate(values[idx], this._columns.get(idx).type);
2746
2781
  }
2747
2782
  }
2748
2783
  }
2749
- newRow = new DataRow(this._columns, rowOrValue);
2784
+ newRow = new DataRow(this._columns, values);
2750
2785
  }
2751
2786
  else {
2752
- newRow = this.createRow(rowOrValue);
2753
- }
2754
- var lastChunk = this.getLastChunk();
2755
- if (!lastChunk || lastChunk.rows.length >= this._chunkSize) {
2756
- lastChunk = this.createChunk();
2787
+ newRow = this.createRow(rowOrValues);
2757
2788
  }
2758
- lastChunk.rows.push(newRow);
2789
+ this.cachedRows.push(newRow);
2759
2790
  var cachedTotal = this.getCachedCount();
2760
2791
  if (cachedTotal > this.total) {
2761
2792
  this.total = cachedTotal;
2762
2793
  }
2763
2794
  return newRow;
2764
2795
  };
2765
- EasyDataTable.prototype.createChunk = function (index) {
2766
- if (typeof index == 'undefined') {
2767
- index = this.getLastChunkIndex() + 1;
2768
- }
2769
- var chunk = { offset: index * this._chunkSize, rows: [] };
2770
- this.chunkMap[index] = chunk;
2771
- return chunk;
2772
- };
2773
- EasyDataTable.prototype.getLastChunkIndex = function () {
2774
- var keys = Object.keys(this.chunkMap);
2775
- return keys.length > 0
2776
- ? parseInt(keys[keys.length - 1])
2777
- : -1;
2778
- };
2779
- EasyDataTable.prototype.getLastChunk = function () {
2780
- var index = this.getLastChunkIndex();
2781
- return index > -1
2782
- ? this.chunkMap[index]
2783
- : null;
2784
- };
2785
2796
  EasyDataTable.prototype.getCachedRows = function () {
2786
- return this.getCachedChunks()
2787
- .reduce(function (acc, v) { return acc.concat(v.rows); }, []);
2788
- };
2789
- EasyDataTable.prototype.getCachedChunks = function () {
2790
- return Object.values(this.chunkMap);
2797
+ return this.cachedRows;
2791
2798
  };
2792
2799
  EasyDataTable.prototype.totalIsKnown = function () {
2793
2800
  if (this.elasticChunks) {
@@ -2796,6 +2803,11 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2796
2803
  }
2797
2804
  return !this.needTotal;
2798
2805
  };
2806
+ EasyDataTable.prototype.fireUpdated = function () {
2807
+ if (this.onUpdate) {
2808
+ this.onUpdate(this);
2809
+ }
2810
+ };
2799
2811
  return EasyDataTable;
2800
2812
  }());
2801
2813
 
@@ -2980,7 +2992,6 @@ i18n_i18n.resetLocales();
2980
2992
 
2981
2993
 
2982
2994
 
2983
- //data
2984
2995
 
2985
2996
 
2986
2997
 
@@ -3026,11 +3037,11 @@ var text_data_filter_assign = (undefined && undefined.__assign) || function () {
3026
3037
  };
3027
3038
 
3028
3039
  var text_data_filter_TextDataFilter = /** @class */ (function () {
3029
- function TextDataFilter(loader, sourceTable, entityId, isLookup) {
3040
+ function TextDataFilter(loader, sourceTable, sourceId, isLookup) {
3030
3041
  if (isLookup === void 0) { isLookup = false; }
3031
3042
  this.loader = loader;
3032
3043
  this.sourceTable = sourceTable;
3033
- this.entityId = entityId;
3044
+ this.sourceId = sourceId;
3034
3045
  this.isLookup = isLookup;
3035
3046
  this.filterValue = '';
3036
3047
  //turns off client-side search
@@ -3067,7 +3078,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
3067
3078
  limit: this.sourceTable.chunkSize,
3068
3079
  needTotal: true,
3069
3080
  filters: filters_1,
3070
- entityId: this.entityId,
3081
+ sourceId: this.sourceId,
3071
3082
  lookup: this.isLookup
3072
3083
  })
3073
3084
  .then(function (data) {
@@ -3075,7 +3086,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
3075
3086
  chunkSize: _this.sourceTable.chunkSize,
3076
3087
  loader: {
3077
3088
  loadChunk: function (params) { return _this.loader
3078
- .loadChunk(text_data_filter_assign({}, params, { filters: filters_1, entityId: _this.entityId, lookup: _this.isLookup })); }
3089
+ .loadChunk(text_data_filter_assign(text_data_filter_assign({}, params), { filters: filters_1, sourceId: _this.sourceId, lookup: _this.isLookup })); }
3079
3090
  }
3080
3091
  });
3081
3092
  for (var _i = 0, _a = _this.sourceTable.columns.getItems(); _i < _a.length; _i++) {
@@ -3096,26 +3107,26 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
3096
3107
  return new Promise(function (resolve, reject) {
3097
3108
  var filteredTable = new easy_data_table_EasyDataTable({
3098
3109
  chunkSize: _this.sourceTable.chunkSize,
3110
+ inMemory: true
3099
3111
  });
3100
3112
  for (var _i = 0, _a = _this.sourceTable.columns.getItems(); _i < _a.length; _i++) {
3101
3113
  var col = _a[_i];
3102
3114
  filteredTable.columns.add(col);
3103
3115
  }
3104
3116
  var words = _this.filterValue.split('||').map(function (w) { return w.trim().toLowerCase(); });
3117
+ var suitableColumns = _this.sourceTable.columns.getItems()
3118
+ .filter(function (col) { return utils_utils.isIntType(col.type)
3119
+ || utils_utils.getStringDataTypes().indexOf(col.type) >= 0; });
3105
3120
  var hasEnterance = function (row) {
3106
- for (var _i = 0, _a = _this.sourceTable.columns.getItems(); _i < _a.length; _i++) {
3107
- var col = _a[_i];
3108
- if (utils_utils.isIntType(col.type)
3109
- || utils_utils.getStringDataTypes().indexOf(col.type) >= 0) {
3110
- var value = row.getValue(col.id);
3111
- if (value) {
3112
- var normalized = value.toString()
3113
- .toLowerCase();
3114
- for (var _b = 0, words_1 = words; _b < words_1.length; _b++) {
3115
- var word = words_1[_b];
3116
- if (normalized.indexOf(word) >= 0) {
3117
- return true;
3118
- }
3121
+ for (var _i = 0, suitableColumns_1 = suitableColumns; _i < suitableColumns_1.length; _i++) {
3122
+ var col = suitableColumns_1[_i];
3123
+ var value = row.getValue(col.id);
3124
+ if (value) {
3125
+ var normalized = value.toString().toLowerCase();
3126
+ for (var _a = 0, words_1 = words; _a < words_1.length; _a++) {
3127
+ var word = words_1[_a];
3128
+ if (normalized.indexOf(word) >= 0) {
3129
+ return true;
3119
3130
  }
3120
3131
  }
3121
3132
  }
@@ -3128,8 +3139,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
3128
3139
  filteredTable.addRow(row);
3129
3140
  }
3130
3141
  }
3131
- if (filteredTable.getCachedCount() == 0)
3132
- filteredTable.setTotal(0);
3142
+ filteredTable.setTotal(filteredTable.getCachedCount());
3133
3143
  resolve(filteredTable);
3134
3144
  });
3135
3145
  };
@@ -3479,6 +3489,13 @@ var dom_elem_builder_extends = (undefined && undefined.__extends) || (function (
3479
3489
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3480
3490
  };
3481
3491
  })();
3492
+ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
3493
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
3494
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
3495
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
3496
+ r[k] = a[j];
3497
+ return r;
3498
+ };
3482
3499
 
3483
3500
  var DomElementBuilder = /** @class */ (function () {
3484
3501
  function DomElementBuilder(tag, parent) {
@@ -3549,7 +3566,7 @@ var DomElementBuilder = /** @class */ (function () {
3549
3566
  classNames[_i - 1] = arguments[_i];
3550
3567
  }
3551
3568
  if (className) {
3552
- var fullList = className.trim().split(" ").concat(classNames);
3569
+ var fullList = __spreadArrays(className.trim().split(" "), classNames);
3553
3570
  for (var i = 0; i < fullList.length; i++)
3554
3571
  this.element.classList.add(fullList[i]);
3555
3572
  }
@@ -3561,7 +3578,7 @@ var DomElementBuilder = /** @class */ (function () {
3561
3578
  classNames[_i - 1] = arguments[_i];
3562
3579
  }
3563
3580
  if (className) {
3564
- var fullList = className.trim().split(" ").concat(classNames);
3581
+ var fullList = __spreadArrays(className.trim().split(" "), classNames);
3565
3582
  for (var i = 0; i < fullList.length; i++)
3566
3583
  this.element.classList.remove(fullList[i]);
3567
3584
  }
@@ -4128,6 +4145,14 @@ var drag_manager_DragManager = /** @class */ (function () {
4128
4145
  //global variable
4129
4146
  var eqDragManager = new drag_manager_DragManager();
4130
4147
  //# sourceMappingURL=drag_manager.js.map
4148
+ // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/grid/easy_grid_options.js
4149
+ var AutoResizeColumns;
4150
+ (function (AutoResizeColumns) {
4151
+ AutoResizeColumns[AutoResizeColumns["Always"] = 0] = "Always";
4152
+ AutoResizeColumns[AutoResizeColumns["Once"] = 1] = "Once";
4153
+ AutoResizeColumns[AutoResizeColumns["Never"] = 2] = "Never";
4154
+ })(AutoResizeColumns || (AutoResizeColumns = {}));
4155
+ //# sourceMappingURL=easy_grid_options.js.map
4131
4156
  // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/grid/easy_grid_cell_renderer.js
4132
4157
 
4133
4158
 
@@ -4279,13 +4304,7 @@ var easy_grid_cell_renderer_GridCellRendererStore = /** @class */ (function () {
4279
4304
  // CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/grid/easy_grid_columns.js
4280
4305
 
4281
4306
 
4282
- var DEFAULT_WIDTH = 150;
4283
- var DEFAULT_WIDTH_NUMBER = 120;
4284
- var DEFAULT_WIDTH_DATE = 200;
4285
- var DEFAULT_WIDTH_BOOL = 80;
4286
4307
  var DEFAULT_WIDTH_STRING = 250;
4287
- var MIN_WIDTH_STRING = 100;
4288
- var MAX_WIDTH_STRING = 500;
4289
4308
  var ROW_NUM_WIDTH = 60;
4290
4309
  var GridColumnAlign;
4291
4310
  (function (GridColumnAlign) {
@@ -4317,31 +4336,18 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
4317
4336
  this.isRowNum = false;
4318
4337
  this.dataColumn = column;
4319
4338
  this.grid = grid;
4339
+ var widthOptions = grid.options.columnWidths || {};
4320
4340
  if (column) {
4321
4341
  if (column.style.alignment) {
4322
4342
  this.align = MapAlignment(column.style.alignment);
4323
4343
  }
4324
- var coltype = column.type;
4325
- var cellType = this.grid.cellRendererStore.getCellType(coltype);
4326
- switch (cellType) {
4327
- case CellRendererType.NUMBER:
4328
- this.width = DEFAULT_WIDTH_NUMBER;
4329
- break;
4330
- case CellRendererType.DATETIME:
4331
- this.width = DEFAULT_WIDTH_DATE;
4332
- break;
4333
- case CellRendererType.BOOL:
4334
- this.width = DEFAULT_WIDTH_BOOL;
4335
- break;
4336
- default:
4337
- this.width = DEFAULT_WIDTH_STRING;
4338
- }
4344
+ this.width = (widthOptions && widthOptions[this.type]) ? widthOptions[this.type].default : DEFAULT_WIDTH_STRING;
4339
4345
  this.cellRenderer = this.grid.cellRendererStore.getDefaultRenderer(column.type);
4340
4346
  this._description = column.description;
4341
4347
  }
4342
4348
  else if (isRowNum) {
4343
4349
  this.isRowNum = true;
4344
- this.width = ROW_NUM_WIDTH;
4350
+ this.width = (widthOptions && widthOptions.rowNumColumn) ? widthOptions.rowNumColumn.default : ROW_NUM_WIDTH;
4345
4351
  this._label = '';
4346
4352
  this.cellRenderer = this.grid.cellRendererStore.getDefaultRendererByType(CellRendererType.NUMBER);
4347
4353
  }
@@ -4387,9 +4393,10 @@ var easy_grid_columns_GridColumnList = /** @class */ (function () {
4387
4393
  GridColumnList.prototype.sync = function (columnList, hasRowNumCol) {
4388
4394
  if (hasRowNumCol === void 0) { hasRowNumCol = true; }
4389
4395
  this.clear();
4390
- if (hasRowNumCol) {
4391
- var rowNumCol = new easy_grid_columns_GridColumn(null, this.grid, true);
4392
- this.add(rowNumCol);
4396
+ var rowNumCol = new easy_grid_columns_GridColumn(null, this.grid, true);
4397
+ this.add(rowNumCol);
4398
+ if (!hasRowNumCol) {
4399
+ rowNumCol.isVisible = false;
4393
4400
  }
4394
4401
  if (columnList) {
4395
4402
  for (var _i = 0, _a = columnList.getItems(); _i < _a.length; _i++) {
@@ -4463,6 +4470,14 @@ var easy_grid_assign = (undefined && undefined.__assign) || function () {
4463
4470
  };
4464
4471
  return easy_grid_assign.apply(this, arguments);
4465
4472
  };
4473
+ var easy_grid_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
4474
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4475
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
4476
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
4477
+ r[k] = a[j];
4478
+ return r;
4479
+ };
4480
+
4466
4481
 
4467
4482
 
4468
4483
 
@@ -4495,6 +4510,35 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4495
4510
  pageSize: 30,
4496
4511
  pageSizeItems: [20, 30, 50, 100, 200]
4497
4512
  },
4513
+ columnWidths: {
4514
+ autoResize: AutoResizeColumns.Once,
4515
+ stringColumns: {
4516
+ min: 100,
4517
+ max: 500,
4518
+ default: 250
4519
+ },
4520
+ numberColumns: {
4521
+ min: 60,
4522
+ default: 120
4523
+ },
4524
+ boolColumns: {
4525
+ min: 50,
4526
+ default: 80
4527
+ },
4528
+ dateColumns: {
4529
+ min: 80,
4530
+ default: 200
4531
+ },
4532
+ otherColumns: {
4533
+ min: 100,
4534
+ max: 500,
4535
+ default: 250
4536
+ },
4537
+ rowNumColumn: {
4538
+ min: 40,
4539
+ default: 60
4540
+ }
4541
+ },
4498
4542
  addColumns: false,
4499
4543
  viewportRowsCount: null,
4500
4544
  showActiveRow: true
@@ -4502,7 +4546,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4502
4546
  this.rowsOnPagePromise = null;
4503
4547
  this.containerInitialHeight = 0;
4504
4548
  this.firstRender = true;
4505
- this.compareValues = this.strictCompare;
4506
4549
  this.prevRowTotals = null;
4507
4550
  this.landingIndex = -1;
4508
4551
  this.landingSlot = domel('div')
@@ -4514,7 +4557,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4514
4557
  if (options && options.paging) {
4515
4558
  options.paging = utils_utils.assign(this.defaultDataGridOptions.paging, options.paging);
4516
4559
  }
4517
- this.options = easy_grid_assign({}, this.defaultDataGridOptions, options);
4560
+ this.options = this.mergeOptions(options);
4561
+ this.processColumnWidthsOptions();
4518
4562
  if (!this.options.slot)
4519
4563
  throw Error('"slot" parameter is required to initialize EasyDataGrid');
4520
4564
  if (!this.options.dataTable)
@@ -4526,6 +4570,42 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4526
4570
  this.setSlot(this.options.slot);
4527
4571
  this.init(this.options);
4528
4572
  }
4573
+ EasyGrid.prototype.mergeOptions = function (options) {
4574
+ var colWidthOptions = utils_utils.assignDeep({}, this.defaultDataGridOptions.columnWidths, options.columnWidths);
4575
+ var pagingOptions = utils_utils.assignDeep({}, this.defaultDataGridOptions.paging, options.paging);
4576
+ var result = utils_utils.assign({}, this.defaultDataGridOptions, options);
4577
+ result.columnWidths = colWidthOptions;
4578
+ result.paging = pagingOptions;
4579
+ return result;
4580
+ };
4581
+ EasyGrid.prototype.processColumnWidthsOptions = function () {
4582
+ var widthOptions = this.options.columnWidths;
4583
+ if (!widthOptions)
4584
+ return;
4585
+ //string columns
4586
+ utils_utils.getStringDataTypes().forEach(function (dataType) {
4587
+ widthOptions[dataType] = easy_grid_assign(easy_grid_assign({}, widthOptions.stringColumns), widthOptions[dataType]);
4588
+ });
4589
+ //numeric columns
4590
+ utils_utils.getNumericDataTypes().forEach(function (dataType) {
4591
+ widthOptions[dataType] = easy_grid_assign(easy_grid_assign({}, widthOptions.numberColumns), widthOptions[dataType]);
4592
+ });
4593
+ //bool columns
4594
+ widthOptions[DataType.Bool] = easy_grid_assign(easy_grid_assign({}, widthOptions.boolColumns), widthOptions[DataType.Bool]);
4595
+ //date columns
4596
+ utils_utils.getDateDataTypes().forEach(function (dataType) {
4597
+ widthOptions[dataType] = easy_grid_assign(easy_grid_assign({}, widthOptions.dateColumns), widthOptions[dataType]);
4598
+ });
4599
+ //other columns
4600
+ var knownTypes = easy_grid_spreadArrays(utils_utils.getStringDataTypes(), utils_utils.getNumericDataTypes(), utils_utils.getDateDataTypes(), [
4601
+ DataType.Bool
4602
+ ]);
4603
+ utils_utils.getAllDataTypes().forEach(function (dataType) {
4604
+ if (!(dataType in knownTypes)) {
4605
+ widthOptions[dataType] = easy_grid_assign(easy_grid_assign({}, widthOptions.otherColumns), widthOptions[dataType]);
4606
+ }
4607
+ });
4608
+ };
4529
4609
  EasyGrid.prototype.setSlot = function (slot) {
4530
4610
  if (typeof slot === 'string') {
4531
4611
  if (slot.length) {
@@ -4672,10 +4752,20 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4672
4752
  }
4673
4753
  else {
4674
4754
  setTimeout(function () {
4675
- _this.updateHeight();
4676
- _this.firstRender = false;
4755
+ _this.updateHeight()
4756
+ .then(function () {
4757
+ _this.firstRender = false;
4758
+ });
4677
4759
  }, 100);
4678
4760
  }
4761
+ var needAutoResize = this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
4762
+ if (needAutoResize) {
4763
+ this.bodyCellContainerDiv.style.visibility = 'hidden';
4764
+ setTimeout(function () {
4765
+ _this.resizeColumns();
4766
+ _this.bodyCellContainerDiv.style.visibility = null;
4767
+ }, 20);
4768
+ }
4679
4769
  };
4680
4770
  EasyGrid.prototype.updateHeight = function () {
4681
4771
  var _this = this;
@@ -4752,7 +4842,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4752
4842
  var _this = this;
4753
4843
  var colBuilder = domel('div')
4754
4844
  .addClass(this.cssPrefix + "-header-cell")
4755
- .data('col-idx', "" + (index + 1))
4845
+ .data('col-idx', "" + index)
4756
4846
  .setStyle('width', column.width + "px");
4757
4847
  if (column.dataColumn) {
4758
4848
  colBuilder
@@ -4790,14 +4880,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4790
4880
  }
4791
4881
  return colDiv;
4792
4882
  };
4793
- EasyGrid.prototype.strictCompare = function (value1, value2) {
4794
- return value1 !== value2;
4795
- };
4796
- EasyGrid.prototype.caseInsensitiveCompare = function (value1, value2) {
4797
- var val1 = (typeof value1 === 'string') ? value1.toLowerCase() : value1;
4798
- var val2 = (typeof value2 === 'string') ? value2.toLowerCase() : value2;
4799
- return val1 !== val2;
4800
- };
4801
4883
  EasyGrid.prototype.renderBody = function () {
4802
4884
  var _this = this;
4803
4885
  this.bodyDiv = domel('div')
@@ -4811,10 +4893,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4811
4893
  .addClass(this.cssPrefix + "-cell-container")
4812
4894
  .toDOM();
4813
4895
  var showAggrs = this.canShowAggregates();
4814
- this.compareValues = this.caseInsensitiveCompare;
4815
- if (showAggrs && this.options.aggregates.settings.caseSensitiveGroups) {
4816
- this.compareValues = this.strictCompare;
4817
- }
4818
4896
  if (this.dataTable) {
4819
4897
  this.showProgress();
4820
4898
  this.rowsOnPagePromise = this.getRowsToRender()
@@ -4824,15 +4902,22 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4824
4902
  //prevent double rendering (bad solution, we have to figure out how to avoid this behavior properly)
4825
4903
  _this.bodyCellContainerDiv.innerHTML = '';
4826
4904
  _this.prevRowTotals = null;
4905
+ var rowsToRender = 0;
4827
4906
  if (rows.length) {
4828
4907
  var groups_1 = showAggrs
4829
4908
  ? _this.options.aggregates.settings.getGroups()
4830
4909
  : [];
4910
+ rowsToRender = (rows.length < _this.pagination.pageSize)
4911
+ ? rows.length
4912
+ : _this.pagination.pageSize;
4831
4913
  rows.forEach(function (row, index) {
4832
4914
  if (showAggrs)
4833
4915
  _this.updateTotalsState(groups_1, row);
4834
- var tr = _this.renderRow(row, index);
4835
- _this.bodyCellContainerDiv.appendChild(tr);
4916
+ //we don't actually render the last row
4917
+ if (index < rowsToRender) {
4918
+ var tr = _this.renderRow(row, index);
4919
+ _this.bodyCellContainerDiv.appendChild(tr);
4920
+ }
4836
4921
  });
4837
4922
  var showGrandTotalsOnEachPage = _this.options.aggregates && _this.options.aggregates.showGrandTotalsOnEachPage;
4838
4923
  if (showAggrs && (_this.isLastPage() || showGrandTotalsOnEachPage)) {
@@ -4843,7 +4928,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4843
4928
  var containerWidth = _this.getContainerWidth();
4844
4929
  domel(_this.bodyCellContainerDiv)
4845
4930
  .setStyle('width', containerWidth + "px");
4846
- return rows.length;
4931
+ return rowsToRender;
4847
4932
  })
4848
4933
  .catch(function (error) { console.error(error); return 0; });
4849
4934
  }
@@ -4851,7 +4936,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4851
4936
  domel(_this.headerViewportDiv)
4852
4937
  .setStyle('margin-left', "-" + _this.bodyViewportDiv.scrollLeft + "px");
4853
4938
  });
4854
- this.bodyViewportDiv.addEventListener('keydown', this.onVieportKeydown.bind(this));
4939
+ this.bodyViewportDiv.addEventListener('keydown', this.onViewportKeydown.bind(this));
4855
4940
  };
4856
4941
  EasyGrid.prototype.isLastPage = function () {
4857
4942
  if (this.dataTable.elasticChunks) {
@@ -4877,7 +4962,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4877
4962
  var group = groups[level - 1];
4878
4963
  for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
4879
4964
  var col = _a[_i];
4880
- if (this.compareValues(this.prevRowTotals.getValue(col), newRow.getValue(col))) {
4965
+ if (!aggrSettings.compareValues(this.prevRowTotals.getValue(col), newRow.getValue(col))) {
4881
4966
  changeLevel = level;
4882
4967
  break;
4883
4968
  }
@@ -4938,8 +5023,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4938
5023
  });
4939
5024
  var aggrContainer = this.options.aggregates.calculator.getAggrContainer();
4940
5025
  var aggrCols = aggrSettings.getAggregates().map(function (c) { return c.colId; });
4941
- var key = this.buildGroupKey(group, row);
4942
- aggrContainer.getAggregates(level, key)
5026
+ var key = aggrSettings.buildGroupKey(group, row);
5027
+ aggrContainer.getAggregateData(level, key)
4943
5028
  .then(function (values) {
4944
5029
  for (var _i = 0, aggrCols_1 = aggrCols; _i < aggrCols_1.length; _i++) {
4945
5030
  var aggrColId = aggrCols_1[_i];
@@ -4980,34 +5065,20 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4980
5065
  }
4981
5066
  }
4982
5067
  if (groupFooterTemplate) {
4983
- var cellDiv_1 = _this.renderCell(column, colIndex, val, rowElement);
5068
+ var cellDiv_1 = _this.renderCell(column, index, val, rowElement);
4984
5069
  var innerCell = cellDiv_1.firstChild;
4985
5070
  val = innerCell.innerHTML;
4986
5071
  val = _this.applyGroupColumnTemplate(groupFooterTemplate, val, values[aggrSettings.COUNT_FIELD_NAME]);
4987
5072
  }
4988
5073
  }
4989
- var cellDiv = _this.renderCell(column, colIndex, val, rowElement);
5074
+ var cellDiv = _this.renderCell(column, index, val, rowElement);
4990
5075
  rowElement.appendChild(cellDiv);
4991
5076
  });
4992
5077
  })
4993
5078
  .catch(function (error) { return console.error(error); });
4994
5079
  return rowElement;
4995
5080
  };
4996
- EasyGrid.prototype.buildGroupKey = function (group, row) {
4997
- var aggrSettings = this.options.aggregates.settings;
4998
- var caseInsensitive = aggrSettings && !aggrSettings.caseSensitiveGroups;
4999
- var result = {};
5000
- for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
5001
- var colId = _a[_i];
5002
- var keyVal = row.getValue(colId);
5003
- if (caseInsensitive && typeof (keyVal) === 'string') {
5004
- keyVal = keyVal.toLowerCase();
5005
- }
5006
- result[colId] = keyVal;
5007
- }
5008
- return result;
5009
- };
5010
- EasyGrid.prototype.onVieportKeydown = function (ev) {
5081
+ EasyGrid.prototype.onViewportKeydown = function (ev) {
5011
5082
  if (this.options.showActiveRow) {
5012
5083
  var rowCount = this.bodyCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-row").length;
5013
5084
  var newValue = void 0;
@@ -5061,13 +5132,17 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5061
5132
  }
5062
5133
  }
5063
5134
  };
5135
+ /** Returns a promise with the list of the rows to render on one page.
5136
+ * The list contains pageSize+1 row to make it possible
5137
+ * to render the totals row (if it appears to be on the edge between pages)
5138
+ */
5064
5139
  EasyGrid.prototype.getRowsToRender = function () {
5065
5140
  if (this.options.paging.enabled === false) {
5066
5141
  return Promise.resolve(this.dataTable.getCachedRows());
5067
5142
  }
5068
5143
  return this.dataTable.getRows({
5069
- page: this.pagination.page,
5070
- pageSize: this.pagination.pageSize
5144
+ offset: (this.pagination.page - 1) * this.pagination.pageSize,
5145
+ limit: this.pagination.pageSize + 1
5071
5146
  })
5072
5147
  .catch(function (error) {
5073
5148
  console.error(error);
@@ -5163,13 +5238,13 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5163
5238
  if (this.options.showActiveRow && index == this.activeRowIndex) {
5164
5239
  rowBuilder.addClass(this.cssPrefix + "-row-active");
5165
5240
  }
5166
- this.columns.getItems().forEach(function (column) {
5241
+ this.columns.getItems().forEach(function (column, index) {
5167
5242
  if (!column.isVisible) {
5168
5243
  return;
5169
5244
  }
5170
5245
  var colindex = column.isRowNum ? -1 : _this.dataTable.columns.getIndex(column.dataColumn.id);
5171
5246
  var val = column.isRowNum ? indexGlobal + 1 : row.getValue(colindex);
5172
- rowElement.appendChild(_this.renderCell(column, colindex, val, rowElement));
5247
+ rowElement.appendChild(_this.renderCell(column, index, val, rowElement));
5173
5248
  });
5174
5249
  return rowElement;
5175
5250
  };
@@ -5441,6 +5516,85 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5441
5516
  EasyGrid.prototype.focus = function () {
5442
5517
  this.bodyViewportDiv.focus();
5443
5518
  };
5519
+ EasyGrid.prototype.resizeColumns = function () {
5520
+ if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
5521
+ return;
5522
+ var containerWidth = this.bodyCellContainerDiv.style.width;
5523
+ this.bodyCellContainerDiv.style.visibility = 'hidden';
5524
+ this.bodyCellContainerDiv.style.width = '1px';
5525
+ var sumWidth = 0;
5526
+ var columns = this.columns.getItems();
5527
+ var headerCells = this.headerCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-header-cell");
5528
+ var headerIdx = 0;
5529
+ var _loop_1 = function (idx) {
5530
+ var column = columns[idx];
5531
+ if (!column.isVisible)
5532
+ return "continue";
5533
+ var calculatedWidth = this_1.options.columnWidths.autoResize !== AutoResizeColumns.Always && column.dataColumn
5534
+ ? column.dataColumn.calculatedWidth
5535
+ : 0;
5536
+ var cellValues = this_1.bodyCellContainerDiv.querySelectorAll("." + this_1.cssPrefix + "-cell[data-col-idx=\"" + idx + "\"] > ." + this_1.cssPrefix + "-cell-value");
5537
+ var maxWidth = 0;
5538
+ if (calculatedWidth > 0) {
5539
+ sumWidth += calculatedWidth;
5540
+ column.width = calculatedWidth;
5541
+ cellValues.forEach(function (value) {
5542
+ value.parentElement.style.width = calculatedWidth + "px";
5543
+ });
5544
+ headerCells[headerIdx].style.width = calculatedWidth + "px";
5545
+ headerIdx++;
5546
+ }
5547
+ else if (cellValues.length > 0) {
5548
+ cellValues.forEach(function (value) {
5549
+ value.parentElement.style.width = null;
5550
+ var width = value.parentElement.offsetWidth;
5551
+ if (width > maxWidth) {
5552
+ maxWidth = width;
5553
+ }
5554
+ });
5555
+ maxWidth += 3;
5556
+ var maxOption = column.isRowNum
5557
+ ? this_1.options.columnWidths.rowNumColumn.max || 500
5558
+ : this_1.options.columnWidths[column.dataColumn.type].max || 2000;
5559
+ var minOption = column.isRowNum
5560
+ ? this_1.options.columnWidths.rowNumColumn.min || 0
5561
+ : this_1.options.columnWidths[column.dataColumn.type].min || 20;
5562
+ if (maxWidth > maxOption) {
5563
+ maxWidth = maxOption;
5564
+ }
5565
+ if (maxWidth < minOption) {
5566
+ maxWidth = minOption;
5567
+ }
5568
+ if (utils_utils.isNumericType(column.type)) {
5569
+ //increase the calculated width in 1.3 times for numeric columns
5570
+ maxWidth = Math.round(maxWidth * 1.3);
5571
+ }
5572
+ sumWidth += maxWidth;
5573
+ column.width = maxWidth;
5574
+ cellValues.forEach(function (value) {
5575
+ value.parentElement.style.width = maxWidth + "px";
5576
+ });
5577
+ headerCells[headerIdx].style.width = maxWidth + "px";
5578
+ headerIdx++;
5579
+ if (column.dataColumn) {
5580
+ column.dataColumn.calculatedWidth = maxWidth;
5581
+ }
5582
+ }
5583
+ };
5584
+ var this_1 = this;
5585
+ for (var idx = 0; idx < this.columns.count; idx++) {
5586
+ _loop_1(idx);
5587
+ }
5588
+ if (sumWidth > 0) {
5589
+ this.bodyCellContainerDiv.style.width = sumWidth + "px";
5590
+ this.headerCellContainerDiv.style.width = sumWidth + "px";
5591
+ }
5592
+ else {
5593
+ this.bodyCellContainerDiv.style.width = containerWidth;
5594
+ this.headerCellContainerDiv.style.width = containerWidth;
5595
+ }
5596
+ this.bodyCellContainerDiv.style.visibility = null;
5597
+ };
5444
5598
  return EasyGrid;
5445
5599
  }());
5446
5600
 
@@ -6627,6 +6781,7 @@ addEasyDataUITexts();
6627
6781
 
6628
6782
 
6629
6783
 
6784
+
6630
6785
  //datetimepicker
6631
6786
 
6632
6787
 
@@ -7132,12 +7287,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7132
7287
  var lookupTable = new easy_data_table_EasyDataTable({
7133
7288
  loader: {
7134
7289
  loadChunk: function (chunkParams) { return _this.context.getDataLoader()
7135
- .loadChunk(entity_form_builder_assign({}, chunkParams, { id: lookupEntity.id })); }
7290
+ .loadChunk(entity_form_builder_assign(entity_form_builder_assign({}, chunkParams), { id: lookupEntity.id })); }
7136
7291
  }
7137
7292
  });
7138
7293
  _this.context.getDataLoader()
7139
- .loadChunk({ offset: 0, limit: 1000, needTotal: true, entityId: lookupEntity.id })
7294
+ .loadChunk({ offset: 0, limit: 1000, needTotal: true, sourceId: lookupEntity.id })
7140
7295
  .then(function (data) {
7296
+ var _a;
7141
7297
  var _loop_1 = function (col) {
7142
7298
  var attrs = lookupEntity.attributes.filter(function (attr) {
7143
7299
  return attr.id == col.id && (attr.isPrimaryKey || attr.showInLookup);
@@ -7146,13 +7302,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7146
7302
  lookupTable.columns.add(col);
7147
7303
  }
7148
7304
  };
7149
- for (var _i = 0, _a = data.table.columns.getItems(); _i < _a.length; _i++) {
7150
- var col = _a[_i];
7305
+ for (var _i = 0, _b = data.table.columns.getItems(); _i < _b.length; _i++) {
7306
+ var col = _b[_i];
7151
7307
  _loop_1(col);
7152
7308
  }
7153
7309
  lookupTable.setTotal(data.total);
7154
- for (var _b = 0, _c = data.table.getCachedRows(); _b < _c.length; _b++) {
7155
- var row = _c[_b];
7310
+ for (var _c = 0, _d = data.table.getCachedRows(); _c < _d.length; _c++) {
7311
+ var row = _d[_c];
7156
7312
  lookupTable.addRow(row);
7157
7313
  }
7158
7314
  var ds = new DefaultDialogService();
@@ -7191,7 +7347,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7191
7347
  .join(', ');
7192
7348
  };
7193
7349
  if (selectedValue) {
7194
- _this.context.getEntity(selectedValue, lookupEntity.id)
7350
+ var attr_1 = lookupEntity.getFirstPrimaryAttr();
7351
+ var key = attr_1.id.substring(attr_1.id.lastIndexOf('.') + 1);
7352
+ _this.context.fetchRecord((_a = {}, _a[key] = selectedValue, _a), lookupEntity.id)
7195
7353
  .then(function (data) {
7196
7354
  if (data.entity) {
7197
7355
  updateSelectedValue(data.entity);
@@ -7239,7 +7397,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7239
7397
  }); });
7240
7398
  });
7241
7399
  };
7242
- EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, readOnly, value) {
7400
+ EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, value, readOnly, hidden) {
7243
7401
  var _this = this;
7244
7402
  var horizClass = isIE
7245
7403
  ? 'kfrm-fields-ie is-horizontal'
@@ -7260,6 +7418,8 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7260
7418
  .addClass(horizClass)
7261
7419
  .addChild('input', function (b) {
7262
7420
  inputEl = b.toDOM();
7421
+ b.name(attr.id);
7422
+ b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
7263
7423
  if (readOnly) {
7264
7424
  b.attr('readonly', '');
7265
7425
  }
@@ -7283,8 +7443,6 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7283
7443
  }
7284
7444
  });
7285
7445
  }
7286
- b.name(attr.id);
7287
- b.type(_this.resolveInputType(attr.dataType));
7288
7446
  b.value((utils_utils.IsDefinedAndNotNull(value)
7289
7447
  ? utils_utils.dateTimeToStr(value, editFormat)
7290
7448
  : ''));
@@ -7326,7 +7484,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7326
7484
  }).toDOM(); });
7327
7485
  });
7328
7486
  };
7329
- EntityEditFormBuilder.prototype.setupListField = function (parent, attr, readOnly, values, value) {
7487
+ EntityEditFormBuilder.prototype.setupListField = function (parent, attr, value, values, readOnly) {
7330
7488
  var _this = this;
7331
7489
  domel(parent)
7332
7490
  .addChild('div', function (b) { return b
@@ -7359,12 +7517,14 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7359
7517
  b.attr('accept', accept);
7360
7518
  });
7361
7519
  };
7362
- EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, readOnly, value) {
7520
+ EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, value, readOnly, hidden) {
7363
7521
  var _this = this;
7364
7522
  domel(parent)
7365
7523
  .addChild('input', function (b) {
7366
- if (readOnly)
7524
+ if (readOnly) {
7367
7525
  b.attr('readonly', '');
7526
+ }
7527
+ b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
7368
7528
  b.name(attr.id)
7369
7529
  .type(_this.resolveInputType(attr.dataType));
7370
7530
  if (attr.dataType == DataType.Bool) {
@@ -7379,7 +7539,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7379
7539
  }
7380
7540
  });
7381
7541
  };
7382
- EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr, readOnly, value) {
7542
+ EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr, value, readOnly) {
7383
7543
  // feature: modify size in value editor ??
7384
7544
  domel(parent)
7385
7545
  .addChild('textarea', function (b) {
@@ -7387,6 +7547,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7387
7547
  b.attr('readonly', '');
7388
7548
  b.attr('name', attr.id);
7389
7549
  b.setStyle('height', "120px");
7550
+ b.value(utils_utils.IsDefinedAndNotNull(value)
7551
+ ? value.toString()
7552
+ : '');
7390
7553
  });
7391
7554
  };
7392
7555
  EntityEditFormBuilder.prototype.addFormField = function (parent, attr) {
@@ -7413,16 +7576,17 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7413
7576
  .setStyle('display', 'inline-block'); });
7414
7577
  }
7415
7578
  });
7579
+ var hidden = attr.isPrimaryKey;
7416
7580
  if (attr.kind === EntityAttrKind.Lookup) {
7417
7581
  this.setupLookupField(parent, attr, readOnly, value);
7418
7582
  return;
7419
7583
  }
7420
7584
  switch (editor.tag) {
7421
7585
  case EditorTag.DateTime:
7422
- this.setupDateTimeField(parent, attr, readOnly, value);
7586
+ this.setupDateTimeField(parent, attr, value, readOnly, hidden);
7423
7587
  break;
7424
7588
  case EditorTag.List:
7425
- this.setupListField(parent, attr, readOnly, editor.values, value);
7589
+ this.setupListField(parent, attr, value, editor.values, readOnly);
7426
7590
  break;
7427
7591
  case EditorTag.File:
7428
7592
  this.setupFileField(parent, attr, readOnly, editor.accept);
@@ -7430,10 +7594,10 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7430
7594
  case EditorTag.Edit:
7431
7595
  default:
7432
7596
  if (editor.multiline) {
7433
- this.setupTextArea(parent, attr, readOnly, value);
7597
+ this.setupTextArea(parent, attr, value, readOnly);
7434
7598
  }
7435
7599
  else {
7436
- this.setupTextField(parent, attr, readOnly, value);
7600
+ this.setupTextField(parent, attr, value, readOnly, hidden);
7437
7601
  }
7438
7602
  break;
7439
7603
  }
@@ -7485,13 +7649,15 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7485
7649
  this.form['setHtmlInt'](formHtml);
7486
7650
  for (var _i = 0, _a = this.context.getActiveEntity().attributes; _i < _a.length; _i++) {
7487
7651
  var attr = _a[_i];
7488
- if (this.params.isEditForm) {
7489
- if (!attr.showOnEdit)
7490
- continue;
7491
- }
7492
- else {
7493
- if (!attr.showOnCreate)
7494
- continue;
7652
+ if (!attr.isPrimaryKey) {
7653
+ if (this.params.isEditForm) {
7654
+ if (!attr.showOnEdit)
7655
+ continue;
7656
+ }
7657
+ else {
7658
+ if (!attr.showOnCreate)
7659
+ continue;
7660
+ }
7495
7661
  }
7496
7662
  this.addFormField(fb.toDOM(), attr);
7497
7663
  }
@@ -7526,8 +7692,8 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
7526
7692
  }
7527
7693
  EasyDataServerLoader.prototype.loadChunk = function (params) {
7528
7694
  var _this = this;
7529
- var url = this.context.resolveEndpoint('GetEntities', { entityId: params.entityId || this.context.getActiveEntity().id });
7530
- delete params.entityId;
7695
+ var url = this.context.resolveEndpoint('FetchDataset', { sourceId: params.sourceId || this.context.getActiveEntity().id });
7696
+ delete params.sourceId;
7531
7697
  this.context.startProcess();
7532
7698
  var http = this.context.getHttpClient();
7533
7699
  return http.post(url, params)
@@ -7564,6 +7730,17 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
7564
7730
 
7565
7731
 
7566
7732
  // CONCATENATED MODULE: ./src/main/data_context.ts
7733
+ var data_context_assign = (undefined && undefined.__assign) || function () {
7734
+ data_context_assign = Object.assign || function(t) {
7735
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7736
+ s = arguments[i];
7737
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7738
+ t[p] = s[p];
7739
+ }
7740
+ return t;
7741
+ };
7742
+ return data_context_assign.apply(this, arguments);
7743
+ };
7567
7744
 
7568
7745
 
7569
7746
 
@@ -7576,9 +7753,8 @@ var data_context_DataContext = /** @class */ (function () {
7576
7753
  this.model = new meta_data_MetaData();
7577
7754
  this.model.id = options.metaDataId || '__default';
7578
7755
  this.dataLoader = new easy_data_server_loader_EasyDataServerLoader(this);
7579
- this.data = new easy_data_table_EasyDataTable({
7580
- loader: this.dataLoader
7581
- });
7756
+ var dataTableOptions = data_context_assign({ loader: this.dataLoader }, options.dataTable);
7757
+ this.data = new easy_data_table_EasyDataTable(dataTableOptions);
7582
7758
  this.setDefaultEndpoints(this.options.endpoint || '/api/easydata');
7583
7759
  }
7584
7760
  DataContext.prototype.getActiveEntity = function () {
@@ -7597,8 +7773,8 @@ var data_context_DataContext = /** @class */ (function () {
7597
7773
  DataContext.prototype.getDataLoader = function () {
7598
7774
  return this.dataLoader;
7599
7775
  };
7600
- DataContext.prototype.createFilter = function (entityId, data, isLookup) {
7601
- return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(), entityId || this.activeEntity.id, isLookup);
7776
+ DataContext.prototype.createFilter = function (sourceId, data, isLookup) {
7777
+ return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(), sourceId || this.activeEntity.id, isLookup);
7602
7778
  };
7603
7779
  DataContext.prototype.loadMetaData = function () {
7604
7780
  var _this = this;
@@ -7622,7 +7798,7 @@ var data_context_DataContext = /** @class */ (function () {
7622
7798
  DataContext.prototype.getHttpClient = function () {
7623
7799
  return this.http;
7624
7800
  };
7625
- DataContext.prototype.getEntities = function () {
7801
+ DataContext.prototype.fetchDataset = function () {
7626
7802
  var _this = this;
7627
7803
  this.data.clear();
7628
7804
  return this.dataLoader.loadChunk({ offset: 0, limit: this.data.chunkSize, needTotal: true })
@@ -7639,33 +7815,33 @@ var data_context_DataContext = /** @class */ (function () {
7639
7815
  return _this.data;
7640
7816
  });
7641
7817
  };
7642
- DataContext.prototype.getEntity = function (id, entityId) {
7818
+ DataContext.prototype.fetchRecord = function (keys, sourceId) {
7643
7819
  var _this = this;
7644
- var url = this.resolveEndpoint('GetEntity', { id: id,
7645
- entityId: entityId || this.activeEntity.id });
7820
+ var url = this.resolveEndpoint('FetchRecord', { sourceId: sourceId || this.activeEntity.id });
7646
7821
  this.startProcess();
7647
- return this.http.get(url).getPromise()
7822
+ return this.http.get(url, { queryParams: keys })
7648
7823
  .finally(function () { return _this.endProcess(); });
7649
7824
  };
7650
- DataContext.prototype.createEntity = function (obj, entityId) {
7825
+ DataContext.prototype.createRecord = function (obj, sourceId) {
7651
7826
  var _this = this;
7652
- var url = this.resolveEndpoint('CreateEntity', { entityId: entityId || this.activeEntity.id });
7827
+ var url = this.resolveEndpoint('CreateRecord', { sourceId: sourceId || this.activeEntity.id });
7653
7828
  this.startProcess();
7654
- return this.http.post(url, obj, { dataType: 'json' }).getPromise().finally(function () { return _this.endProcess(); });
7829
+ return this.http.post(url, obj, { dataType: 'json' })
7830
+ .finally(function () { return _this.endProcess(); });
7655
7831
  };
7656
- DataContext.prototype.updateEntity = function (id, obj, entityId) {
7832
+ DataContext.prototype.updateRecord = function (obj, sourceId) {
7657
7833
  var _this = this;
7658
- var url = this.resolveEndpoint('UpdateEntity', { id: id,
7659
- entityId: entityId || this.activeEntity.id });
7834
+ var url = this.resolveEndpoint('UpdateRecord', { sourceId: sourceId || this.activeEntity.id });
7660
7835
  this.startProcess();
7661
- return this.http.post(url, obj, { dataType: 'json' }).getPromise().finally(function () { return _this.endProcess(); });
7836
+ return this.http.post(url, obj, { dataType: 'json' })
7837
+ .finally(function () { return _this.endProcess(); });
7662
7838
  };
7663
- DataContext.prototype.deleteEntity = function (id, entityId) {
7839
+ DataContext.prototype.deleteRecord = function (obj, sourceId) {
7664
7840
  var _this = this;
7665
- var url = this.resolveEndpoint('DeleteEntity', { id: id,
7666
- entityId: entityId || this.activeEntity.id });
7841
+ var url = this.resolveEndpoint('DeleteRecord', { sourceId: sourceId || this.activeEntity.id });
7667
7842
  this.startProcess();
7668
- return this.http.post(url, null).getPromise().finally(function () { return _this.endProcess(); });
7843
+ return this.http.post(url, obj, { dataType: 'json' })
7844
+ .finally(function () { return _this.endProcess(); });
7669
7845
  };
7670
7846
  DataContext.prototype.setEndpoint = function (key, value) {
7671
7847
  this.endpoints.set(key, value);
@@ -7690,7 +7866,7 @@ var data_context_DataContext = /** @class */ (function () {
7690
7866
  if (opt == 'modelId') {
7691
7867
  optVal = this.model.getId();
7692
7868
  }
7693
- else if (opt == 'entityId') {
7869
+ else if (opt == 'sourceId') {
7694
7870
  optVal = this.activeEntity.id;
7695
7871
  }
7696
7872
  else {
@@ -7712,11 +7888,11 @@ var data_context_DataContext = /** @class */ (function () {
7712
7888
  };
7713
7889
  DataContext.prototype.setDefaultEndpoints = function (endpointBase) {
7714
7890
  this.setEnpointIfNotExist('GetMetaData', combinePath(endpointBase, 'models/{modelId}'));
7715
- this.setEnpointIfNotExist('GetEntities', combinePath(endpointBase, 'models/{modelId}/crud/{entityId}/fetch'));
7716
- this.setEnpointIfNotExist('GetEntity', combinePath(endpointBase, 'models/{modelId}/crud/{entityId}/fetch/{id}'));
7717
- this.setEnpointIfNotExist('CreateEntity', combinePath(endpointBase, 'models/{modelId}/crud/{entityId}/create'));
7718
- this.setEnpointIfNotExist('UpdateEntity', combinePath(endpointBase, 'models/{modelId}/crud/{entityId}/update/{id}'));
7719
- this.setEnpointIfNotExist('DeleteEntity', combinePath(endpointBase, 'models/{modelId}/crud/{entityId}/delete/{id}'));
7891
+ this.setEnpointIfNotExist('FetchDataset', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
7892
+ this.setEnpointIfNotExist('FetchRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
7893
+ this.setEnpointIfNotExist('CreateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/create'));
7894
+ this.setEnpointIfNotExist('UpdateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/update'));
7895
+ this.setEnpointIfNotExist('DeleteRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/delete'));
7720
7896
  };
7721
7897
  return DataContext;
7722
7898
  }());
@@ -7849,7 +8025,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
7849
8025
  };
7850
8026
  EntityDataView.prototype.renderGrid = function () {
7851
8027
  var _this = this;
7852
- this.context.getEntities()
8028
+ this.context.fetchDataset()
7853
8029
  .then(function (result) {
7854
8030
  var gridSlot = document.createElement('div');
7855
8031
  _this.slot.appendChild(gridSlot);
@@ -7862,7 +8038,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
7862
8038
  allowPageSizeChange: true,
7863
8039
  pageSizeItems: [15, 30, 50, 100, 200]
7864
8040
  },
7865
- addColumns: true,
8041
+ addColumns: _this.context.getActiveEntity().isEditable,
7866
8042
  addColumnsTitle: i18n_i18n.getText('AddBtnTitle'),
7867
8043
  showActiveRow: false,
7868
8044
  onAddColumnClick: _this.addClickHandler.bind(_this),
@@ -7920,7 +8096,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
7920
8096
  if (!form.validate())
7921
8097
  return false;
7922
8098
  form.getData()
7923
- .then(function (obj) { return _this.context.createEntity(obj); })
8099
+ .then(function (obj) { return _this.context.createRecord(obj); })
7924
8100
  .then(function () {
7925
8101
  return _this.refreshData();
7926
8102
  })
@@ -7951,12 +8127,10 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
7951
8127
  .replace('{entity}', activeEntity.caption),
7952
8128
  body: form.getHtml(),
7953
8129
  onSubmit: function () {
7954
- var keyAttrs = activeEntity.attributes.filter(function (attr) { return attr.isPrimaryKey; });
7955
- var keys = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
7956
8130
  if (!form.validate())
7957
8131
  return false;
7958
8132
  form.getData()
7959
- .then(function (obj) { return _this.context.updateEntity(keys.join(':'), obj); })
8133
+ .then(function (obj) { return _this.context.updateRecord(obj); })
7960
8134
  .then(function () {
7961
8135
  return _this.refreshData();
7962
8136
  })
@@ -7977,16 +8151,20 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
7977
8151
  .then(function (row) {
7978
8152
  if (row) {
7979
8153
  var activeEntity = _this.context.getActiveEntity();
7980
- var keyAttrs = activeEntity.attributes.filter(function (attr) { return attr.isPrimaryKey; });
7981
- var keys_1 = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
7982
- var entityId = keyAttrs.map(function (attr, index) { return attr.id + ":" + keys_1[index]; }).join(';');
8154
+ var keyAttrs = activeEntity.getPrimaryAttrs();
8155
+ var keyVals_1 = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
8156
+ var keys_1 = keyAttrs.reduce(function (val, attr, index) {
8157
+ var property = attr.id.substring(attr.id.lastIndexOf('.') + 1);
8158
+ val[property] = keyVals_1[index];
8159
+ return val;
8160
+ }, {});
7983
8161
  _this.dlg.openConfirm(i18n_i18n.getText('DeleteDlgCaption')
7984
8162
  .replace('{entity}', activeEntity.caption), i18n_i18n.getText('DeleteDlgMessage')
7985
- .replace('{entityId}', entityId))
8163
+ .replace('{recordId}', Object.keys(keys_1)
8164
+ .map(function (key) { return key + ":" + keys_1[key]; }).join(';')))
7986
8165
  .then(function (result) {
7987
8166
  if (result) {
7988
- //pass entityId in future
7989
- _this.context.deleteEntity(keys_1.join(':'))
8167
+ _this.context.deleteRecord(keys_1)
7990
8168
  .then(function () {
7991
8169
  return _this.refreshData();
7992
8170
  })
@@ -8008,7 +8186,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
8008
8186
  };
8009
8187
  EntityDataView.prototype.refreshData = function () {
8010
8188
  var _this = this;
8011
- return this.context.getEntities()
8189
+ return this.context.fetchDataset()
8012
8190
  .then(function () {
8013
8191
  _this.grid.refresh();
8014
8192
  });
@@ -8094,6 +8272,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
8094
8272
  parent.insertBefore(progressBarSlot, parent.firstElementChild);
8095
8273
  this.context = new data_context_DataContext({
8096
8274
  endpoint: options.endpoint,
8275
+ dataTable: options.dataTable,
8097
8276
  onProcessStart: function () { return bar.show(); },
8098
8277
  onProcessEnd: function () { return bar.hide(); }
8099
8278
  });
@@ -8194,7 +8373,7 @@ function addEasyDataCRUDTexts() {
8194
8373
  AddDlgCaption: 'Create {entity}',
8195
8374
  EditDlgCaption: 'Edit {entity}',
8196
8375
  DeleteDlgCaption: 'Delete {entity}',
8197
- DeleteDlgMessage: 'Are you shure about removing this entity: [{entityId}]?',
8376
+ DeleteDlgMessage: 'Are you sure you want to remove this record: {{recordId}}?',
8198
8377
  EntityMenuDesc: 'Click on an entity to view/edit its content',
8199
8378
  BackToEntities: 'Back to entities',
8200
8379
  SearchBtn: 'Search',