@easydata/crud 1.3.6 → 1.4.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.
- package/dist/browser/easydata.css +11 -3
- package/dist/browser/easydata.css.map +1 -1
- package/dist/browser/easydata.js +821 -583
- package/dist/browser/easydata.js.map +1 -1
- package/dist/browser/easydata.min.css +1 -1
- package/dist/browser/easydata.min.js +1 -1
- package/dist/browser/easydata.min.js.LICENSE.txt +0 -2
- package/dist/browser/easydata.min.js.map +1 -1
- package/dist/bundles/easydata.crud.js +541 -314
- package/dist/bundles/easydata.crud.js.map +1 -1
- package/dist/bundles/easydata.crud.min.js +1 -1
- package/dist/bundles/easydata.crud.min.js.LICENSE.txt +0 -2
- package/dist/bundles/easydata.crud.min.js.map +1 -1
- package/dist/lib/filter/text_data_filter.d.ts +2 -2
- package/dist/lib/filter/text_data_filter.js +18 -19
- package/dist/lib/filter/text_data_filter.js.map +1 -1
- package/dist/lib/form/entity_edit_form.js.map +1 -1
- package/dist/lib/form/entity_form_builder.js +47 -28
- package/dist/lib/form/entity_form_builder.js.map +1 -1
- package/dist/lib/i18n/text_resources.js +2 -1
- package/dist/lib/i18n/text_resources.js.map +1 -1
- package/dist/lib/main/data_context.d.ts +12 -8
- package/dist/lib/main/data_context.js +37 -27
- package/dist/lib/main/data_context.js.map +1 -1
- package/dist/lib/main/easy_data_server_loader.js +2 -2
- package/dist/lib/main/easy_data_server_loader.js.map +1 -1
- package/dist/lib/views/easy_data_view_dispatcher.js +1 -0
- package/dist/lib/views/easy_data_view_dispatcher.js.map +1 -1
- package/dist/lib/views/entity_data_view.js +17 -15
- package/dist/lib/views/entity_data_view.js.map +1 -1
- package/dist/lib/views/options.d.ts +2 -0
- package/dist/lib/widgets/text_filter_widget.js.map +1 -1
- 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
|
-
|
|
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/
|
|
2217
|
-
var
|
|
2218
|
-
|
|
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
|
|
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.
|
|
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(
|
|
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
|
|
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=
|
|
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
|
|
|
@@ -2392,6 +2443,8 @@ var data_column_DataColumn = /** @class */ (function () {
|
|
|
2392
2443
|
this.displayFormat = desc.dfmt;
|
|
2393
2444
|
this.groupFooterColumnTemplate = desc.gfct;
|
|
2394
2445
|
this.style = desc.style || {};
|
|
2446
|
+
this.description = desc.description;
|
|
2447
|
+
this.calculatedWidth = 0;
|
|
2395
2448
|
}
|
|
2396
2449
|
return DataColumn;
|
|
2397
2450
|
}());
|
|
@@ -2431,9 +2484,10 @@ var data_column_DataColumnList = /** @class */ (function () {
|
|
|
2431
2484
|
.map(function (col, index) { return index; });
|
|
2432
2485
|
};
|
|
2433
2486
|
DataColumnList.prototype.put = function (index, col) {
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2487
|
+
if (index >= 0 && index < this.count) {
|
|
2488
|
+
this.items[index] = col;
|
|
2489
|
+
this.updateDateColumnIdx();
|
|
2490
|
+
}
|
|
2437
2491
|
};
|
|
2438
2492
|
DataColumnList.prototype.move = function (col, newIndex) {
|
|
2439
2493
|
var oldIndex = this.items.indexOf(col);
|
|
@@ -2443,8 +2497,12 @@ var data_column_DataColumnList = /** @class */ (function () {
|
|
|
2443
2497
|
}
|
|
2444
2498
|
};
|
|
2445
2499
|
DataColumnList.prototype.get = function (index) {
|
|
2446
|
-
|
|
2447
|
-
|
|
2500
|
+
if (index >= 0 && index < this.count) {
|
|
2501
|
+
return this.items[index];
|
|
2502
|
+
}
|
|
2503
|
+
else {
|
|
2504
|
+
return null;
|
|
2505
|
+
}
|
|
2448
2506
|
};
|
|
2449
2507
|
DataColumnList.prototype.getIndex = function (id) {
|
|
2450
2508
|
return this.mapper[id];
|
|
@@ -2528,16 +2586,23 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2528
2586
|
function EasyDataTable(options) {
|
|
2529
2587
|
this._chunkSize = 1000;
|
|
2530
2588
|
this._elasticChunks = false;
|
|
2531
|
-
|
|
2532
|
-
this.chunkMap = {};
|
|
2589
|
+
this.cachedRows = [];
|
|
2533
2590
|
this.total = 0;
|
|
2534
2591
|
this.loader = null;
|
|
2535
2592
|
this.needTotal = true;
|
|
2593
|
+
this.isInMemory = false;
|
|
2536
2594
|
options = options || {};
|
|
2537
2595
|
this._chunkSize = options.chunkSize || this._chunkSize;
|
|
2538
2596
|
this._elasticChunks = options.elasticChunks || this._elasticChunks;
|
|
2539
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
|
+
}
|
|
2540
2604
|
this._columns = new data_column_DataColumnList();
|
|
2605
|
+
this.onUpdate = options.onUpdate;
|
|
2541
2606
|
if (options.columns) {
|
|
2542
2607
|
for (var _i = 0, _a = options.columns; _i < _a.length; _i++) {
|
|
2543
2608
|
var colDesc = _a[_i];
|
|
@@ -2568,7 +2633,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2568
2633
|
this._chunkSize = value;
|
|
2569
2634
|
this.total = 0;
|
|
2570
2635
|
this.needTotal = !this.elasticChunks;
|
|
2571
|
-
this.
|
|
2636
|
+
this.cachedRows = [];
|
|
2572
2637
|
},
|
|
2573
2638
|
enumerable: true,
|
|
2574
2639
|
configurable: true
|
|
@@ -2581,7 +2646,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2581
2646
|
this._elasticChunks = value;
|
|
2582
2647
|
this.total = 0;
|
|
2583
2648
|
this.needTotal = !this.elasticChunks;
|
|
2584
|
-
this.
|
|
2649
|
+
this.cachedRows = [];
|
|
2585
2650
|
},
|
|
2586
2651
|
enumerable: true,
|
|
2587
2652
|
configurable: true
|
|
@@ -2609,22 +2674,12 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2609
2674
|
endIndex = this.total;
|
|
2610
2675
|
}
|
|
2611
2676
|
}
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
var allChunksCached = true;
|
|
2615
|
-
for (var i = lbChunk; i <= ubChunk; i++) {
|
|
2616
|
-
if (!this.chunkMap[i]) {
|
|
2617
|
-
allChunksCached = false;
|
|
2618
|
-
break;
|
|
2619
|
-
}
|
|
2677
|
+
if (this.isInMemory && endIndex > this.cachedRows.length) {
|
|
2678
|
+
endIndex = this.cachedRows.length;
|
|
2620
2679
|
}
|
|
2680
|
+
var allChunksCached = endIndex <= this.cachedRows.length;
|
|
2621
2681
|
if (allChunksCached) {
|
|
2622
|
-
|
|
2623
|
-
for (var i = lbChunk; i <= ubChunk; i++) {
|
|
2624
|
-
resultArr = resultArr.concat(this.chunkMap[i].rows);
|
|
2625
|
-
}
|
|
2626
|
-
var firstChunkOffset = this.chunkMap[lbChunk].offset;
|
|
2627
|
-
return Promise.resolve(resultArr.slice(fromIndex - firstChunkOffset, endIndex - firstChunkOffset));
|
|
2682
|
+
return Promise.resolve(this.cachedRows.slice(fromIndex, endIndex));
|
|
2628
2683
|
}
|
|
2629
2684
|
//if loader is not defined
|
|
2630
2685
|
if (!this.loader) {
|
|
@@ -2635,53 +2690,34 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2635
2690
|
if (this.needTotal) {
|
|
2636
2691
|
this.needTotal = false;
|
|
2637
2692
|
}
|
|
2638
|
-
var
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
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,
|
|
2643
2700
|
limit: limit,
|
|
2644
2701
|
needTotal: needTotal
|
|
2645
2702
|
})
|
|
2646
2703
|
.then(function (result) {
|
|
2647
|
-
var chunks = result.table.getCachedChunks();
|
|
2648
2704
|
if (needTotal) {
|
|
2649
2705
|
_this.total = result.total;
|
|
2650
|
-
if (endIndex > _this.total) {
|
|
2651
|
-
endIndex = _this.total;
|
|
2652
|
-
}
|
|
2653
2706
|
}
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
_this.chunkMap[index] = {
|
|
2658
|
-
offset: index * _this._chunkSize,
|
|
2659
|
-
rows: chunk.rows
|
|
2660
|
-
};
|
|
2661
|
-
index++;
|
|
2707
|
+
Array.prototype.push.apply(_this.cachedRows, result.table.getCachedRows());
|
|
2708
|
+
if (endIndex > _this.cachedRows.length) {
|
|
2709
|
+
endIndex = _this.cachedRows.length;
|
|
2662
2710
|
}
|
|
2663
2711
|
if (_this.elasticChunks) {
|
|
2664
2712
|
var count_1 = result.table.getCachedCount();
|
|
2665
|
-
if (count_1
|
|
2666
|
-
|
|
2667
|
-
if (count_1 === limit) {
|
|
2668
|
-
chunk.rows.splice(chunk.rows.length - 1, 1);
|
|
2669
|
-
if (chunk.rows.length == 0) {
|
|
2670
|
-
delete _this.chunkMap[index - 1];
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
if (count_1 < limit) {
|
|
2674
|
-
_this.total = _this.getCachedCount();
|
|
2675
|
-
}
|
|
2713
|
+
if (count_1 < limit) {
|
|
2714
|
+
_this.total = _this.cachedRows.length;
|
|
2676
2715
|
}
|
|
2677
2716
|
}
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
resultArr = resultArr.concat(_this.chunkMap[i].rows);
|
|
2681
|
-
}
|
|
2682
|
-
var firstChunkOffset = _this.chunkMap[lbChunk].offset;
|
|
2683
|
-
return resultArr.slice(fromIndex - firstChunkOffset, endIndex - firstChunkOffset);
|
|
2717
|
+
_this.fireUpdated();
|
|
2718
|
+
return _this.cachedRows.slice(fromIndex, endIndex);
|
|
2684
2719
|
});
|
|
2720
|
+
return resultPromise;
|
|
2685
2721
|
};
|
|
2686
2722
|
EasyDataTable.prototype.getRow = function (index) {
|
|
2687
2723
|
return this.getRows({ offset: index, limit: 1 })
|
|
@@ -2693,14 +2729,13 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2693
2729
|
EasyDataTable.prototype.setTotal = function (total) {
|
|
2694
2730
|
this.total = total;
|
|
2695
2731
|
this.needTotal = false;
|
|
2696
|
-
this.chunkMap = {};
|
|
2697
2732
|
};
|
|
2698
2733
|
EasyDataTable.prototype.getCachedCount = function () {
|
|
2699
|
-
return this.
|
|
2734
|
+
return this.cachedRows.length;
|
|
2700
2735
|
};
|
|
2701
2736
|
EasyDataTable.prototype.clear = function () {
|
|
2702
2737
|
this.columns.clear();
|
|
2703
|
-
this.
|
|
2738
|
+
this.cachedRows = [];
|
|
2704
2739
|
this.total = 0;
|
|
2705
2740
|
this.needTotal = !this._elasticChunks;
|
|
2706
2741
|
};
|
|
@@ -2733,60 +2768,33 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2733
2768
|
}
|
|
2734
2769
|
return null;
|
|
2735
2770
|
};
|
|
2736
|
-
EasyDataTable.prototype.addRow = function (
|
|
2771
|
+
EasyDataTable.prototype.addRow = function (rowOrValues) {
|
|
2737
2772
|
var newRow;
|
|
2738
|
-
if (Array.isArray(
|
|
2773
|
+
if (Array.isArray(rowOrValues)) {
|
|
2774
|
+
var values = rowOrValues;
|
|
2739
2775
|
var dateIdx = this._columns.getDateColumnIndexes();
|
|
2740
2776
|
if (dateIdx.length > 0) {
|
|
2741
2777
|
for (var _i = 0, dateIdx_1 = dateIdx; _i < dateIdx_1.length; _i++) {
|
|
2742
2778
|
var idx = dateIdx_1[_i];
|
|
2743
|
-
if (
|
|
2744
|
-
|
|
2779
|
+
if (values[idx]) {
|
|
2780
|
+
values[idx] = this.mapDate(values[idx], this._columns.get(idx).type);
|
|
2745
2781
|
}
|
|
2746
2782
|
}
|
|
2747
2783
|
}
|
|
2748
|
-
newRow = new DataRow(this._columns,
|
|
2784
|
+
newRow = new DataRow(this._columns, values);
|
|
2749
2785
|
}
|
|
2750
2786
|
else {
|
|
2751
|
-
newRow = this.createRow(
|
|
2752
|
-
}
|
|
2753
|
-
var lastChunk = this.getLastChunk();
|
|
2754
|
-
if (!lastChunk || lastChunk.rows.length >= this._chunkSize) {
|
|
2755
|
-
lastChunk = this.createChunk();
|
|
2787
|
+
newRow = this.createRow(rowOrValues);
|
|
2756
2788
|
}
|
|
2757
|
-
|
|
2789
|
+
this.cachedRows.push(newRow);
|
|
2758
2790
|
var cachedTotal = this.getCachedCount();
|
|
2759
2791
|
if (cachedTotal > this.total) {
|
|
2760
2792
|
this.total = cachedTotal;
|
|
2761
2793
|
}
|
|
2762
2794
|
return newRow;
|
|
2763
2795
|
};
|
|
2764
|
-
EasyDataTable.prototype.createChunk = function (index) {
|
|
2765
|
-
if (typeof index == 'undefined') {
|
|
2766
|
-
index = this.getLastChunkIndex() + 1;
|
|
2767
|
-
}
|
|
2768
|
-
var chunk = { offset: index * this._chunkSize, rows: [] };
|
|
2769
|
-
this.chunkMap[index] = chunk;
|
|
2770
|
-
return chunk;
|
|
2771
|
-
};
|
|
2772
|
-
EasyDataTable.prototype.getLastChunkIndex = function () {
|
|
2773
|
-
var keys = Object.keys(this.chunkMap);
|
|
2774
|
-
return keys.length > 0
|
|
2775
|
-
? parseInt(keys[keys.length - 1])
|
|
2776
|
-
: -1;
|
|
2777
|
-
};
|
|
2778
|
-
EasyDataTable.prototype.getLastChunk = function () {
|
|
2779
|
-
var index = this.getLastChunkIndex();
|
|
2780
|
-
return index > -1
|
|
2781
|
-
? this.chunkMap[index]
|
|
2782
|
-
: null;
|
|
2783
|
-
};
|
|
2784
2796
|
EasyDataTable.prototype.getCachedRows = function () {
|
|
2785
|
-
return this.
|
|
2786
|
-
.reduce(function (acc, v) { return acc.concat(v.rows); }, []);
|
|
2787
|
-
};
|
|
2788
|
-
EasyDataTable.prototype.getCachedChunks = function () {
|
|
2789
|
-
return Object.values(this.chunkMap);
|
|
2797
|
+
return this.cachedRows;
|
|
2790
2798
|
};
|
|
2791
2799
|
EasyDataTable.prototype.totalIsKnown = function () {
|
|
2792
2800
|
if (this.elasticChunks) {
|
|
@@ -2795,6 +2803,11 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2795
2803
|
}
|
|
2796
2804
|
return !this.needTotal;
|
|
2797
2805
|
};
|
|
2806
|
+
EasyDataTable.prototype.fireUpdated = function () {
|
|
2807
|
+
if (this.onUpdate) {
|
|
2808
|
+
this.onUpdate(this);
|
|
2809
|
+
}
|
|
2810
|
+
};
|
|
2798
2811
|
return EasyDataTable;
|
|
2799
2812
|
}());
|
|
2800
2813
|
|
|
@@ -2979,7 +2992,6 @@ i18n_i18n.resetLocales();
|
|
|
2979
2992
|
|
|
2980
2993
|
|
|
2981
2994
|
|
|
2982
|
-
//data
|
|
2983
2995
|
|
|
2984
2996
|
|
|
2985
2997
|
|
|
@@ -3025,11 +3037,11 @@ var text_data_filter_assign = (undefined && undefined.__assign) || function () {
|
|
|
3025
3037
|
};
|
|
3026
3038
|
|
|
3027
3039
|
var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
3028
|
-
function TextDataFilter(loader, sourceTable,
|
|
3040
|
+
function TextDataFilter(loader, sourceTable, sourceId, isLookup) {
|
|
3029
3041
|
if (isLookup === void 0) { isLookup = false; }
|
|
3030
3042
|
this.loader = loader;
|
|
3031
3043
|
this.sourceTable = sourceTable;
|
|
3032
|
-
this.
|
|
3044
|
+
this.sourceId = sourceId;
|
|
3033
3045
|
this.isLookup = isLookup;
|
|
3034
3046
|
this.filterValue = '';
|
|
3035
3047
|
//turns off client-side search
|
|
@@ -3066,7 +3078,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3066
3078
|
limit: this.sourceTable.chunkSize,
|
|
3067
3079
|
needTotal: true,
|
|
3068
3080
|
filters: filters_1,
|
|
3069
|
-
|
|
3081
|
+
sourceId: this.sourceId,
|
|
3070
3082
|
lookup: this.isLookup
|
|
3071
3083
|
})
|
|
3072
3084
|
.then(function (data) {
|
|
@@ -3074,7 +3086,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3074
3086
|
chunkSize: _this.sourceTable.chunkSize,
|
|
3075
3087
|
loader: {
|
|
3076
3088
|
loadChunk: function (params) { return _this.loader
|
|
3077
|
-
.loadChunk(text_data_filter_assign({}, params, { filters: filters_1,
|
|
3089
|
+
.loadChunk(text_data_filter_assign(text_data_filter_assign({}, params), { filters: filters_1, sourceId: _this.sourceId, lookup: _this.isLookup })); }
|
|
3078
3090
|
}
|
|
3079
3091
|
});
|
|
3080
3092
|
for (var _i = 0, _a = _this.sourceTable.columns.getItems(); _i < _a.length; _i++) {
|
|
@@ -3095,26 +3107,26 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3095
3107
|
return new Promise(function (resolve, reject) {
|
|
3096
3108
|
var filteredTable = new easy_data_table_EasyDataTable({
|
|
3097
3109
|
chunkSize: _this.sourceTable.chunkSize,
|
|
3110
|
+
inMemory: true
|
|
3098
3111
|
});
|
|
3099
3112
|
for (var _i = 0, _a = _this.sourceTable.columns.getItems(); _i < _a.length; _i++) {
|
|
3100
3113
|
var col = _a[_i];
|
|
3101
3114
|
filteredTable.columns.add(col);
|
|
3102
3115
|
}
|
|
3103
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; });
|
|
3104
3120
|
var hasEnterance = function (row) {
|
|
3105
|
-
for (var _i = 0,
|
|
3106
|
-
var col =
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
var
|
|
3110
|
-
|
|
3111
|
-
var
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
var word = words_1[_b];
|
|
3115
|
-
if (normalized.indexOf(word) >= 0) {
|
|
3116
|
-
return true;
|
|
3117
|
-
}
|
|
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;
|
|
3118
3130
|
}
|
|
3119
3131
|
}
|
|
3120
3132
|
}
|
|
@@ -3127,8 +3139,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3127
3139
|
filteredTable.addRow(row);
|
|
3128
3140
|
}
|
|
3129
3141
|
}
|
|
3130
|
-
|
|
3131
|
-
filteredTable.setTotal(0);
|
|
3142
|
+
filteredTable.setTotal(filteredTable.getCachedCount());
|
|
3132
3143
|
resolve(filteredTable);
|
|
3133
3144
|
});
|
|
3134
3145
|
};
|
|
@@ -3478,6 +3489,13 @@ var dom_elem_builder_extends = (undefined && undefined.__extends) || (function (
|
|
|
3478
3489
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3479
3490
|
};
|
|
3480
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
|
+
};
|
|
3481
3499
|
|
|
3482
3500
|
var DomElementBuilder = /** @class */ (function () {
|
|
3483
3501
|
function DomElementBuilder(tag, parent) {
|
|
@@ -3548,7 +3566,7 @@ var DomElementBuilder = /** @class */ (function () {
|
|
|
3548
3566
|
classNames[_i - 1] = arguments[_i];
|
|
3549
3567
|
}
|
|
3550
3568
|
if (className) {
|
|
3551
|
-
var fullList = className.trim().split(" ")
|
|
3569
|
+
var fullList = __spreadArrays(className.trim().split(" "), classNames);
|
|
3552
3570
|
for (var i = 0; i < fullList.length; i++)
|
|
3553
3571
|
this.element.classList.add(fullList[i]);
|
|
3554
3572
|
}
|
|
@@ -3560,7 +3578,7 @@ var DomElementBuilder = /** @class */ (function () {
|
|
|
3560
3578
|
classNames[_i - 1] = arguments[_i];
|
|
3561
3579
|
}
|
|
3562
3580
|
if (className) {
|
|
3563
|
-
var fullList = className.trim().split(" ")
|
|
3581
|
+
var fullList = __spreadArrays(className.trim().split(" "), classNames);
|
|
3564
3582
|
for (var i = 0; i < fullList.length; i++)
|
|
3565
3583
|
this.element.classList.remove(fullList[i]);
|
|
3566
3584
|
}
|
|
@@ -4127,6 +4145,14 @@ var drag_manager_DragManager = /** @class */ (function () {
|
|
|
4127
4145
|
//global variable
|
|
4128
4146
|
var eqDragManager = new drag_manager_DragManager();
|
|
4129
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
|
|
4130
4156
|
// CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/grid/easy_grid_cell_renderer.js
|
|
4131
4157
|
|
|
4132
4158
|
|
|
@@ -4278,13 +4304,7 @@ var easy_grid_cell_renderer_GridCellRendererStore = /** @class */ (function () {
|
|
|
4278
4304
|
// CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/grid/easy_grid_columns.js
|
|
4279
4305
|
|
|
4280
4306
|
|
|
4281
|
-
var DEFAULT_WIDTH = 150;
|
|
4282
|
-
var DEFAULT_WIDTH_NUMBER = 120;
|
|
4283
|
-
var DEFAULT_WIDTH_DATE = 200;
|
|
4284
|
-
var DEFAULT_WIDTH_BOOL = 80;
|
|
4285
4307
|
var DEFAULT_WIDTH_STRING = 250;
|
|
4286
|
-
var MIN_WIDTH_STRING = 100;
|
|
4287
|
-
var MAX_WIDTH_STRING = 500;
|
|
4288
4308
|
var ROW_NUM_WIDTH = 60;
|
|
4289
4309
|
var GridColumnAlign;
|
|
4290
4310
|
(function (GridColumnAlign) {
|
|
@@ -4309,36 +4329,25 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
|
|
|
4309
4329
|
function GridColumn(column, grid, isRowNum) {
|
|
4310
4330
|
if (isRowNum === void 0) { isRowNum = false; }
|
|
4311
4331
|
this._label = null;
|
|
4332
|
+
this._description = null;
|
|
4312
4333
|
//public left: number;
|
|
4313
4334
|
this.align = GridColumnAlign.NONE;
|
|
4314
4335
|
this.isVisible = true;
|
|
4315
4336
|
this.isRowNum = false;
|
|
4316
4337
|
this.dataColumn = column;
|
|
4317
4338
|
this.grid = grid;
|
|
4339
|
+
var widthOptions = grid.options.columnWidths || {};
|
|
4318
4340
|
if (column) {
|
|
4319
4341
|
if (column.style.alignment) {
|
|
4320
4342
|
this.align = MapAlignment(column.style.alignment);
|
|
4321
4343
|
}
|
|
4322
|
-
|
|
4323
|
-
var cellType = this.grid.cellRendererStore.getCellType(coltype);
|
|
4324
|
-
switch (cellType) {
|
|
4325
|
-
case CellRendererType.NUMBER:
|
|
4326
|
-
this.width = DEFAULT_WIDTH_NUMBER;
|
|
4327
|
-
break;
|
|
4328
|
-
case CellRendererType.DATETIME:
|
|
4329
|
-
this.width = DEFAULT_WIDTH_DATE;
|
|
4330
|
-
break;
|
|
4331
|
-
case CellRendererType.BOOL:
|
|
4332
|
-
this.width = DEFAULT_WIDTH_BOOL;
|
|
4333
|
-
break;
|
|
4334
|
-
default:
|
|
4335
|
-
this.width = DEFAULT_WIDTH_STRING;
|
|
4336
|
-
}
|
|
4344
|
+
this.width = (widthOptions && widthOptions[this.type]) ? widthOptions[this.type].default : DEFAULT_WIDTH_STRING;
|
|
4337
4345
|
this.cellRenderer = this.grid.cellRendererStore.getDefaultRenderer(column.type);
|
|
4346
|
+
this._description = column.description;
|
|
4338
4347
|
}
|
|
4339
4348
|
else if (isRowNum) {
|
|
4340
4349
|
this.isRowNum = true;
|
|
4341
|
-
this.width = ROW_NUM_WIDTH;
|
|
4350
|
+
this.width = (widthOptions && widthOptions.rowNumColumn) ? widthOptions.rowNumColumn.default : ROW_NUM_WIDTH;
|
|
4342
4351
|
this._label = '';
|
|
4343
4352
|
this.cellRenderer = this.grid.cellRendererStore.getDefaultRendererByType(CellRendererType.NUMBER);
|
|
4344
4353
|
}
|
|
@@ -4357,6 +4366,14 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
|
|
|
4357
4366
|
configurable: true
|
|
4358
4367
|
});
|
|
4359
4368
|
;
|
|
4369
|
+
Object.defineProperty(GridColumn.prototype, "description", {
|
|
4370
|
+
/** Get column description. */
|
|
4371
|
+
get: function () {
|
|
4372
|
+
return this._description;
|
|
4373
|
+
},
|
|
4374
|
+
enumerable: true,
|
|
4375
|
+
configurable: true
|
|
4376
|
+
});
|
|
4360
4377
|
Object.defineProperty(GridColumn.prototype, "type", {
|
|
4361
4378
|
get: function () {
|
|
4362
4379
|
return this.dataColumn ? this.dataColumn.type : null;
|
|
@@ -4376,9 +4393,10 @@ var easy_grid_columns_GridColumnList = /** @class */ (function () {
|
|
|
4376
4393
|
GridColumnList.prototype.sync = function (columnList, hasRowNumCol) {
|
|
4377
4394
|
if (hasRowNumCol === void 0) { hasRowNumCol = true; }
|
|
4378
4395
|
this.clear();
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4396
|
+
var rowNumCol = new easy_grid_columns_GridColumn(null, this.grid, true);
|
|
4397
|
+
this.add(rowNumCol);
|
|
4398
|
+
if (!hasRowNumCol) {
|
|
4399
|
+
rowNumCol.isVisible = false;
|
|
4382
4400
|
}
|
|
4383
4401
|
if (columnList) {
|
|
4384
4402
|
for (var _i = 0, _a = columnList.getItems(); _i < _a.length; _i++) {
|
|
@@ -4452,6 +4470,14 @@ var easy_grid_assign = (undefined && undefined.__assign) || function () {
|
|
|
4452
4470
|
};
|
|
4453
4471
|
return easy_grid_assign.apply(this, arguments);
|
|
4454
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
|
+
|
|
4455
4481
|
|
|
4456
4482
|
|
|
4457
4483
|
|
|
@@ -4484,14 +4510,42 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4484
4510
|
pageSize: 30,
|
|
4485
4511
|
pageSizeItems: [20, 30, 50, 100, 200]
|
|
4486
4512
|
},
|
|
4487
|
-
|
|
4513
|
+
columnWidths: {
|
|
4514
|
+
autoResize: AutoResizeColumns.Always,
|
|
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
|
+
},
|
|
4542
|
+
showPlusButton: false,
|
|
4488
4543
|
viewportRowsCount: null,
|
|
4489
4544
|
showActiveRow: true
|
|
4490
4545
|
};
|
|
4491
4546
|
this.rowsOnPagePromise = null;
|
|
4492
4547
|
this.containerInitialHeight = 0;
|
|
4493
4548
|
this.firstRender = true;
|
|
4494
|
-
this.compareValues = this.strictCompare;
|
|
4495
4549
|
this.prevRowTotals = null;
|
|
4496
4550
|
this.landingIndex = -1;
|
|
4497
4551
|
this.landingSlot = domel('div')
|
|
@@ -4503,7 +4557,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4503
4557
|
if (options && options.paging) {
|
|
4504
4558
|
options.paging = utils_utils.assign(this.defaultDataGridOptions.paging, options.paging);
|
|
4505
4559
|
}
|
|
4506
|
-
this.options =
|
|
4560
|
+
this.options = this.mergeOptions(options);
|
|
4561
|
+
this.processColumnWidthsOptions();
|
|
4507
4562
|
if (!this.options.slot)
|
|
4508
4563
|
throw Error('"slot" parameter is required to initialize EasyDataGrid');
|
|
4509
4564
|
if (!this.options.dataTable)
|
|
@@ -4515,6 +4570,42 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4515
4570
|
this.setSlot(this.options.slot);
|
|
4516
4571
|
this.init(this.options);
|
|
4517
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
|
+
};
|
|
4518
4609
|
EasyGrid.prototype.setSlot = function (slot) {
|
|
4519
4610
|
if (typeof slot === 'string') {
|
|
4520
4611
|
if (slot.length) {
|
|
@@ -4547,8 +4638,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4547
4638
|
if (options.onRowDbClick) {
|
|
4548
4639
|
this.addEventListener('rowDbClick', options.onRowDbClick);
|
|
4549
4640
|
}
|
|
4550
|
-
if (options.
|
|
4551
|
-
this.addEventListener('
|
|
4641
|
+
if (options.onPlusButtonClick) {
|
|
4642
|
+
this.addEventListener('plusButtonClick', options.onPlusButtonClick);
|
|
4552
4643
|
}
|
|
4553
4644
|
if (options.onColumnChanged) {
|
|
4554
4645
|
this.addEventListener('columnChanged', options.onColumnChanged);
|
|
@@ -4634,7 +4725,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4634
4725
|
};
|
|
4635
4726
|
EasyGrid.prototype.render = function () {
|
|
4636
4727
|
var _this = this;
|
|
4637
|
-
if (!this.hasData() && !this.options.
|
|
4728
|
+
if (!this.hasData() && !this.options.showPlusButton)
|
|
4638
4729
|
return;
|
|
4639
4730
|
this.containerInitialHeight = this.slot.clientHeight;
|
|
4640
4731
|
this.rootDiv = document.createElement('div');
|
|
@@ -4651,6 +4742,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4651
4742
|
gridContainer.classList.add(this.cssPrefix + "-container");
|
|
4652
4743
|
gridContainer.appendChild(this.rootDiv);
|
|
4653
4744
|
this.slot.appendChild(gridContainer);
|
|
4745
|
+
var needAutoResize = this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
|
|
4654
4746
|
if (this.rowsOnPagePromise) {
|
|
4655
4747
|
this.rowsOnPagePromise
|
|
4656
4748
|
.then(function () { return _this.updateHeight(); })
|
|
@@ -4661,8 +4753,13 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4661
4753
|
}
|
|
4662
4754
|
else {
|
|
4663
4755
|
setTimeout(function () {
|
|
4664
|
-
_this.updateHeight()
|
|
4665
|
-
|
|
4756
|
+
_this.updateHeight()
|
|
4757
|
+
.then(function () {
|
|
4758
|
+
_this.firstRender = false;
|
|
4759
|
+
if (needAutoResize) {
|
|
4760
|
+
_this.resizeColumns();
|
|
4761
|
+
}
|
|
4762
|
+
});
|
|
4666
4763
|
}, 100);
|
|
4667
4764
|
}
|
|
4668
4765
|
};
|
|
@@ -4673,14 +4770,14 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4673
4770
|
var firstRow = _this.bodyCellContainerDiv.firstElementChild;
|
|
4674
4771
|
var rowHeight = firstRow ? firstRow.offsetHeight : DEFAULT_ROW_HEIGHT;
|
|
4675
4772
|
var rowCount = _this.options.viewportRowsCount; // || DEFAULT_ROW_COUNT;
|
|
4676
|
-
var
|
|
4677
|
-
domel(_this.
|
|
4678
|
-
.setStyle('height',
|
|
4773
|
+
var viewportHeight_1 = rowHeight * rowCount;
|
|
4774
|
+
domel(_this.bodyViewportDiv)
|
|
4775
|
+
.setStyle('height', viewportHeight_1 + "px");
|
|
4679
4776
|
setTimeout(function () {
|
|
4680
4777
|
var sbHeight = _this.bodyViewportDiv.offsetHeight - _this.bodyViewportDiv.clientHeight;
|
|
4681
|
-
|
|
4682
|
-
domel(_this.
|
|
4683
|
-
.setStyle('height',
|
|
4778
|
+
viewportHeight_1 = viewportHeight_1 + sbHeight;
|
|
4779
|
+
domel(_this.bodyViewportDiv)
|
|
4780
|
+
.setStyle('height', viewportHeight_1 + "px");
|
|
4684
4781
|
resolve();
|
|
4685
4782
|
}, 100);
|
|
4686
4783
|
return;
|
|
@@ -4699,6 +4796,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4699
4796
|
}
|
|
4700
4797
|
});
|
|
4701
4798
|
};
|
|
4799
|
+
EasyGrid.prototype.getContainerWidth = function () {
|
|
4800
|
+
return this.columns.getItems()
|
|
4801
|
+
.filter(function (col) { return col.isVisible; })
|
|
4802
|
+
.map(function (col) { return col.width; })
|
|
4803
|
+
.reduce(function (sum, current) { return sum + current; });
|
|
4804
|
+
};
|
|
4702
4805
|
EasyGrid.prototype.renderHeader = function () {
|
|
4703
4806
|
var _this = this;
|
|
4704
4807
|
this.headerDiv = domel('div')
|
|
@@ -4721,10 +4824,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4721
4824
|
_this.headerRowDiv.appendChild(hd);
|
|
4722
4825
|
if (column.isRowNum) {
|
|
4723
4826
|
domel(hd)
|
|
4724
|
-
.addChildElement(_this.
|
|
4827
|
+
.addChildElement(_this.renderHeaderButtons());
|
|
4725
4828
|
}
|
|
4726
4829
|
});
|
|
4727
|
-
var containerWidth = this.
|
|
4830
|
+
var containerWidth = this.getContainerWidth();
|
|
4728
4831
|
domel(this.headerCellContainerDiv)
|
|
4729
4832
|
.setStyle('width', containerWidth + "px");
|
|
4730
4833
|
};
|
|
@@ -4735,7 +4838,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4735
4838
|
var _this = this;
|
|
4736
4839
|
var colBuilder = domel('div')
|
|
4737
4840
|
.addClass(this.cssPrefix + "-header-cell")
|
|
4738
|
-
.data('col-idx', "" +
|
|
4841
|
+
.data('col-idx', "" + index)
|
|
4739
4842
|
.setStyle('width', column.width + "px");
|
|
4740
4843
|
if (column.dataColumn) {
|
|
4741
4844
|
colBuilder
|
|
@@ -4749,6 +4852,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4749
4852
|
.addClass(this.cssPrefix + "-header-cell-label")
|
|
4750
4853
|
.text(column.label);
|
|
4751
4854
|
}
|
|
4855
|
+
if (column.description) {
|
|
4856
|
+
domel('div', colDiv)
|
|
4857
|
+
.addClass('question-mark')
|
|
4858
|
+
.title(column.description);
|
|
4859
|
+
}
|
|
4752
4860
|
if (this.options.allowDragDrop) {
|
|
4753
4861
|
eqDragManager.registerDraggableItem({
|
|
4754
4862
|
element: colDiv,
|
|
@@ -4768,14 +4876,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4768
4876
|
}
|
|
4769
4877
|
return colDiv;
|
|
4770
4878
|
};
|
|
4771
|
-
EasyGrid.prototype.strictCompare = function (value1, value2) {
|
|
4772
|
-
return value1 !== value2;
|
|
4773
|
-
};
|
|
4774
|
-
EasyGrid.prototype.caseInsensitiveCompare = function (value1, value2) {
|
|
4775
|
-
var val1 = (typeof value1 === 'string') ? value1.toLowerCase() : value1;
|
|
4776
|
-
var val2 = (typeof value2 === 'string') ? value2.toLowerCase() : value2;
|
|
4777
|
-
return val1 !== val2;
|
|
4778
|
-
};
|
|
4779
4879
|
EasyGrid.prototype.renderBody = function () {
|
|
4780
4880
|
var _this = this;
|
|
4781
4881
|
this.bodyDiv = domel('div')
|
|
@@ -4789,10 +4889,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4789
4889
|
.addClass(this.cssPrefix + "-cell-container")
|
|
4790
4890
|
.toDOM();
|
|
4791
4891
|
var showAggrs = this.canShowAggregates();
|
|
4792
|
-
this.compareValues = this.caseInsensitiveCompare;
|
|
4793
|
-
if (showAggrs && this.options.aggregates.settings.caseSensitiveGroups) {
|
|
4794
|
-
this.compareValues = this.strictCompare;
|
|
4795
|
-
}
|
|
4796
4892
|
if (this.dataTable) {
|
|
4797
4893
|
this.showProgress();
|
|
4798
4894
|
this.rowsOnPagePromise = this.getRowsToRender()
|
|
@@ -4802,15 +4898,22 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4802
4898
|
//prevent double rendering (bad solution, we have to figure out how to avoid this behavior properly)
|
|
4803
4899
|
_this.bodyCellContainerDiv.innerHTML = '';
|
|
4804
4900
|
_this.prevRowTotals = null;
|
|
4901
|
+
var rowsToRender = 0;
|
|
4805
4902
|
if (rows.length) {
|
|
4806
4903
|
var groups_1 = showAggrs
|
|
4807
4904
|
? _this.options.aggregates.settings.getGroups()
|
|
4808
4905
|
: [];
|
|
4906
|
+
rowsToRender = (rows.length < _this.pagination.pageSize)
|
|
4907
|
+
? rows.length
|
|
4908
|
+
: _this.pagination.pageSize;
|
|
4809
4909
|
rows.forEach(function (row, index) {
|
|
4810
4910
|
if (showAggrs)
|
|
4811
4911
|
_this.updateTotalsState(groups_1, row);
|
|
4812
|
-
|
|
4813
|
-
|
|
4912
|
+
//we don't actually render the last row
|
|
4913
|
+
if (index < rowsToRender) {
|
|
4914
|
+
var tr = _this.renderRow(row, index);
|
|
4915
|
+
_this.bodyCellContainerDiv.appendChild(tr);
|
|
4916
|
+
}
|
|
4814
4917
|
});
|
|
4815
4918
|
var showGrandTotalsOnEachPage = _this.options.aggregates && _this.options.aggregates.showGrandTotalsOnEachPage;
|
|
4816
4919
|
if (showAggrs && (_this.isLastPage() || showGrandTotalsOnEachPage)) {
|
|
@@ -4818,11 +4921,16 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4818
4921
|
_this.updateTotalsState(groups_1, row, true);
|
|
4819
4922
|
}
|
|
4820
4923
|
}
|
|
4821
|
-
var
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4924
|
+
var needAutoResize = _this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
|
|
4925
|
+
if (needAutoResize) {
|
|
4926
|
+
_this.resizeColumns();
|
|
4927
|
+
}
|
|
4928
|
+
else {
|
|
4929
|
+
var containerWidth = _this.getContainerWidth();
|
|
4930
|
+
domel(_this.bodyCellContainerDiv)
|
|
4931
|
+
.setStyle('width', containerWidth + "px");
|
|
4932
|
+
}
|
|
4933
|
+
return rowsToRender;
|
|
4826
4934
|
})
|
|
4827
4935
|
.catch(function (error) { console.error(error); return 0; });
|
|
4828
4936
|
}
|
|
@@ -4830,7 +4938,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4830
4938
|
domel(_this.headerViewportDiv)
|
|
4831
4939
|
.setStyle('margin-left', "-" + _this.bodyViewportDiv.scrollLeft + "px");
|
|
4832
4940
|
});
|
|
4833
|
-
this.bodyViewportDiv.addEventListener('keydown', this.
|
|
4941
|
+
this.bodyViewportDiv.addEventListener('keydown', this.onViewportKeydown.bind(this));
|
|
4834
4942
|
};
|
|
4835
4943
|
EasyGrid.prototype.isLastPage = function () {
|
|
4836
4944
|
if (this.dataTable.elasticChunks) {
|
|
@@ -4856,7 +4964,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4856
4964
|
var group = groups[level - 1];
|
|
4857
4965
|
for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
|
|
4858
4966
|
var col = _a[_i];
|
|
4859
|
-
if (
|
|
4967
|
+
if (!aggrSettings.compareValues(this.prevRowTotals.getValue(col), newRow.getValue(col))) {
|
|
4860
4968
|
changeLevel = level;
|
|
4861
4969
|
break;
|
|
4862
4970
|
}
|
|
@@ -4917,8 +5025,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4917
5025
|
});
|
|
4918
5026
|
var aggrContainer = this.options.aggregates.calculator.getAggrContainer();
|
|
4919
5027
|
var aggrCols = aggrSettings.getAggregates().map(function (c) { return c.colId; });
|
|
4920
|
-
var key =
|
|
4921
|
-
aggrContainer.
|
|
5028
|
+
var key = aggrSettings.buildGroupKey(group, row);
|
|
5029
|
+
aggrContainer.getAggregateData(level, key)
|
|
4922
5030
|
.then(function (values) {
|
|
4923
5031
|
for (var _i = 0, aggrCols_1 = aggrCols; _i < aggrCols_1.length; _i++) {
|
|
4924
5032
|
var aggrColId = aggrCols_1[_i];
|
|
@@ -4959,34 +5067,20 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4959
5067
|
}
|
|
4960
5068
|
}
|
|
4961
5069
|
if (groupFooterTemplate) {
|
|
4962
|
-
var cellDiv_1 = _this.renderCell(column,
|
|
5070
|
+
var cellDiv_1 = _this.renderCell(column, index, val, rowElement);
|
|
4963
5071
|
var innerCell = cellDiv_1.firstChild;
|
|
4964
5072
|
val = innerCell.innerHTML;
|
|
4965
5073
|
val = _this.applyGroupColumnTemplate(groupFooterTemplate, val, values[aggrSettings.COUNT_FIELD_NAME]);
|
|
4966
5074
|
}
|
|
4967
5075
|
}
|
|
4968
|
-
var cellDiv = _this.renderCell(column,
|
|
5076
|
+
var cellDiv = _this.renderCell(column, index, val, rowElement);
|
|
4969
5077
|
rowElement.appendChild(cellDiv);
|
|
4970
5078
|
});
|
|
4971
5079
|
})
|
|
4972
5080
|
.catch(function (error) { return console.error(error); });
|
|
4973
5081
|
return rowElement;
|
|
4974
5082
|
};
|
|
4975
|
-
EasyGrid.prototype.
|
|
4976
|
-
var aggrSettings = this.options.aggregates.settings;
|
|
4977
|
-
var caseInsensitive = aggrSettings && !aggrSettings.caseSensitiveGroups;
|
|
4978
|
-
var result = {};
|
|
4979
|
-
for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
|
|
4980
|
-
var colId = _a[_i];
|
|
4981
|
-
var keyVal = row.getValue(colId);
|
|
4982
|
-
if (caseInsensitive && typeof (keyVal) === 'string') {
|
|
4983
|
-
keyVal = keyVal.toLowerCase();
|
|
4984
|
-
}
|
|
4985
|
-
result[colId] = keyVal;
|
|
4986
|
-
}
|
|
4987
|
-
return result;
|
|
4988
|
-
};
|
|
4989
|
-
EasyGrid.prototype.onVieportKeydown = function (ev) {
|
|
5083
|
+
EasyGrid.prototype.onViewportKeydown = function (ev) {
|
|
4990
5084
|
if (this.options.showActiveRow) {
|
|
4991
5085
|
var rowCount = this.bodyCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-row").length;
|
|
4992
5086
|
var newValue = void 0;
|
|
@@ -5040,13 +5134,17 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5040
5134
|
}
|
|
5041
5135
|
}
|
|
5042
5136
|
};
|
|
5137
|
+
/** Returns a promise with the list of the rows to render on one page.
|
|
5138
|
+
* The list contains pageSize+1 row to make it possible
|
|
5139
|
+
* to render the totals row (if it appears to be on the edge between pages)
|
|
5140
|
+
*/
|
|
5043
5141
|
EasyGrid.prototype.getRowsToRender = function () {
|
|
5044
5142
|
if (this.options.paging.enabled === false) {
|
|
5045
5143
|
return Promise.resolve(this.dataTable.getCachedRows());
|
|
5046
5144
|
}
|
|
5047
5145
|
return this.dataTable.getRows({
|
|
5048
|
-
|
|
5049
|
-
|
|
5146
|
+
offset: (this.pagination.page - 1) * this.pagination.pageSize,
|
|
5147
|
+
limit: this.pagination.pageSize + 1
|
|
5050
5148
|
})
|
|
5051
5149
|
.catch(function (error) {
|
|
5052
5150
|
console.error(error);
|
|
@@ -5071,23 +5169,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5071
5169
|
var pageInfoDiv = domel('div')
|
|
5072
5170
|
.addClass(this.cssPrefix + "-page-info")
|
|
5073
5171
|
.toDOM();
|
|
5074
|
-
var
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
var
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
.
|
|
5090
|
-
|
|
5172
|
+
var rowCount = this.dataTable.getTotal();
|
|
5173
|
+
if (rowCount > 0) {
|
|
5174
|
+
var fistPageRecordNum = count
|
|
5175
|
+
? (this.pagination.page - 1) * this.pagination.pageSize + 1
|
|
5176
|
+
: 0;
|
|
5177
|
+
var lastPageRecordNum = count
|
|
5178
|
+
? fistPageRecordNum + count - 1
|
|
5179
|
+
: 0;
|
|
5180
|
+
var totalStr = this.dataTable.getTotal().toString();
|
|
5181
|
+
if (this.dataTable.elasticChunks) {
|
|
5182
|
+
var count_1 = this.dataTable.getCachedCount();
|
|
5183
|
+
var total = this.dataTable.getTotal();
|
|
5184
|
+
if (count_1 !== total)
|
|
5185
|
+
totalStr = '?';
|
|
5186
|
+
}
|
|
5187
|
+
pageInfoDiv.innerHTML = i18n_i18n.getText('GridPageInfo')
|
|
5188
|
+
.replace('{FirstPageRecordNum}', "<span>" + fistPageRecordNum.toString() + "</span>")
|
|
5189
|
+
.replace('{LastPageRecordNum}', "<span>" + lastPageRecordNum.toString() + "</span>")
|
|
5190
|
+
.replace('{Total}', "<span>" + totalStr + "</span>");
|
|
5191
|
+
}
|
|
5091
5192
|
return pageInfoDiv;
|
|
5092
5193
|
};
|
|
5093
5194
|
EasyGrid.prototype.showProgress = function () {
|
|
@@ -5142,13 +5243,13 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5142
5243
|
if (this.options.showActiveRow && index == this.activeRowIndex) {
|
|
5143
5244
|
rowBuilder.addClass(this.cssPrefix + "-row-active");
|
|
5144
5245
|
}
|
|
5145
|
-
this.columns.getItems().forEach(function (column) {
|
|
5246
|
+
this.columns.getItems().forEach(function (column, index) {
|
|
5146
5247
|
if (!column.isVisible) {
|
|
5147
5248
|
return;
|
|
5148
5249
|
}
|
|
5149
5250
|
var colindex = column.isRowNum ? -1 : _this.dataTable.columns.getIndex(column.dataColumn.id);
|
|
5150
5251
|
var val = column.isRowNum ? indexGlobal + 1 : row.getValue(colindex);
|
|
5151
|
-
rowElement.appendChild(_this.renderCell(column,
|
|
5252
|
+
rowElement.appendChild(_this.renderCell(column, index, val, rowElement));
|
|
5152
5253
|
});
|
|
5153
5254
|
return rowElement;
|
|
5154
5255
|
};
|
|
@@ -5182,7 +5283,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5182
5283
|
var _this = this;
|
|
5183
5284
|
var paginateDiv = document.createElement('div');
|
|
5184
5285
|
paginateDiv.className = this.cssPrefix + "-pagination-wrapper";
|
|
5185
|
-
|
|
5286
|
+
var rowCount = this.dataTable.getTotal();
|
|
5287
|
+
if (this.options.paging && this.options.paging.enabled && rowCount > 0) {
|
|
5186
5288
|
var prefix_1 = this.paginationOptions.useBootstrap ? '' : this.cssPrefix + "-";
|
|
5187
5289
|
var buttonClickHandler_1 = function (ev) {
|
|
5188
5290
|
var element = ev.target;
|
|
@@ -5308,18 +5410,18 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5308
5410
|
EasyGrid.prototype.removeEventListener = function (eventType, handlerId) {
|
|
5309
5411
|
this.eventEmitter.unsubscribe(eventType, handlerId);
|
|
5310
5412
|
};
|
|
5311
|
-
EasyGrid.prototype.
|
|
5413
|
+
EasyGrid.prototype.renderHeaderButtons = function () {
|
|
5312
5414
|
var _this = this;
|
|
5313
|
-
if (this.options.
|
|
5415
|
+
if (this.options.showPlusButton) {
|
|
5314
5416
|
return domel('div')
|
|
5315
|
-
.addClass(this.cssPrefix + "-
|
|
5316
|
-
.title(this.options.
|
|
5417
|
+
.addClass(this.cssPrefix + "-header-btn-plus")
|
|
5418
|
+
.title(this.options.plusButtonTitle || 'Add')
|
|
5317
5419
|
.addChild('a', function (builder) { return builder
|
|
5318
5420
|
.attr('href', 'javascript:void(0)')
|
|
5319
5421
|
.on('click', function (e) {
|
|
5320
5422
|
e.preventDefault();
|
|
5321
5423
|
_this.fireEvent({
|
|
5322
|
-
type: '
|
|
5424
|
+
type: 'plusButtonClick',
|
|
5323
5425
|
sourceEvent: e
|
|
5324
5426
|
});
|
|
5325
5427
|
}); })
|
|
@@ -5420,6 +5522,97 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5420
5522
|
EasyGrid.prototype.focus = function () {
|
|
5421
5523
|
this.bodyViewportDiv.focus();
|
|
5422
5524
|
};
|
|
5525
|
+
EasyGrid.prototype.resizeColumns = function () {
|
|
5526
|
+
if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
|
|
5527
|
+
return;
|
|
5528
|
+
var containerWidth = this.bodyCellContainerDiv.style.width;
|
|
5529
|
+
this.bodyCellContainerDiv.style.visibility = 'hidden';
|
|
5530
|
+
this.bodyCellContainerDiv.style.width = '1px';
|
|
5531
|
+
//this.headerRowDiv.style.visibility = 'hidden';
|
|
5532
|
+
this.headerRowDiv.style.width = '1px';
|
|
5533
|
+
var sumWidth = 0;
|
|
5534
|
+
var columns = this.columns.getItems();
|
|
5535
|
+
var headerCells = this.headerCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-header-cell");
|
|
5536
|
+
var headerIdx = 0;
|
|
5537
|
+
var _loop_1 = function (idx) {
|
|
5538
|
+
var column = columns[idx];
|
|
5539
|
+
if (!column.isVisible)
|
|
5540
|
+
return "continue";
|
|
5541
|
+
var calculatedWidth = this_1.options.columnWidths.autoResize !== AutoResizeColumns.Always && column.dataColumn
|
|
5542
|
+
? column.dataColumn.calculatedWidth
|
|
5543
|
+
: 0;
|
|
5544
|
+
var cellValues = this_1.bodyCellContainerDiv.querySelectorAll("." + this_1.cssPrefix + "-cell[data-col-idx=\"" + idx + "\"] > ." + this_1.cssPrefix + "-cell-value");
|
|
5545
|
+
var maxWidth = 0;
|
|
5546
|
+
if (calculatedWidth > 0) {
|
|
5547
|
+
sumWidth += calculatedWidth;
|
|
5548
|
+
column.width = calculatedWidth;
|
|
5549
|
+
cellValues.forEach(function (value) {
|
|
5550
|
+
value.parentElement.style.width = calculatedWidth + "px";
|
|
5551
|
+
});
|
|
5552
|
+
headerCells[headerIdx].style.width = calculatedWidth + "px";
|
|
5553
|
+
}
|
|
5554
|
+
else {
|
|
5555
|
+
if (cellValues.length == 0) {
|
|
5556
|
+
headerCells[headerIdx].style.width = null;
|
|
5557
|
+
headerCells[headerIdx].style.whiteSpace = 'nowrap';
|
|
5558
|
+
}
|
|
5559
|
+
maxWidth = headerCells[headerIdx].offsetWidth;
|
|
5560
|
+
if (cellValues.length > 0) {
|
|
5561
|
+
cellValues.forEach(function (value) {
|
|
5562
|
+
value.parentElement.style.width = null;
|
|
5563
|
+
var width = value.parentElement.offsetWidth;
|
|
5564
|
+
if (width > maxWidth) {
|
|
5565
|
+
maxWidth = width;
|
|
5566
|
+
}
|
|
5567
|
+
});
|
|
5568
|
+
maxWidth += 3;
|
|
5569
|
+
var maxOption = column.isRowNum
|
|
5570
|
+
? this_1.options.columnWidths.rowNumColumn.max || 500
|
|
5571
|
+
: this_1.options.columnWidths[column.dataColumn.type].max || 2000;
|
|
5572
|
+
var minOption = column.isRowNum
|
|
5573
|
+
? this_1.options.columnWidths.rowNumColumn.min || 0
|
|
5574
|
+
: this_1.options.columnWidths[column.dataColumn.type].min || 20;
|
|
5575
|
+
if (maxWidth > maxOption) {
|
|
5576
|
+
maxWidth = maxOption;
|
|
5577
|
+
}
|
|
5578
|
+
if (maxWidth < minOption) {
|
|
5579
|
+
maxWidth = minOption;
|
|
5580
|
+
}
|
|
5581
|
+
if (utils_utils.isNumericType(column.type)) {
|
|
5582
|
+
//increase the calculated width in 1.3 times for numeric columns
|
|
5583
|
+
maxWidth = Math.round(maxWidth * 1.3);
|
|
5584
|
+
}
|
|
5585
|
+
sumWidth += maxWidth;
|
|
5586
|
+
column.width = maxWidth;
|
|
5587
|
+
cellValues.forEach(function (value) {
|
|
5588
|
+
value.parentElement.style.width = maxWidth + "px";
|
|
5589
|
+
});
|
|
5590
|
+
headerCells[headerIdx].style.width = maxWidth + "px";
|
|
5591
|
+
if (column.dataColumn) {
|
|
5592
|
+
column.dataColumn.calculatedWidth = maxWidth;
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
else {
|
|
5596
|
+
sumWidth += maxWidth;
|
|
5597
|
+
}
|
|
5598
|
+
}
|
|
5599
|
+
headerIdx++;
|
|
5600
|
+
};
|
|
5601
|
+
var this_1 = this;
|
|
5602
|
+
for (var idx = 0; idx < this.columns.count; idx++) {
|
|
5603
|
+
_loop_1(idx);
|
|
5604
|
+
}
|
|
5605
|
+
if (sumWidth > 0) {
|
|
5606
|
+
this.bodyCellContainerDiv.style.width = sumWidth + "px";
|
|
5607
|
+
this.headerCellContainerDiv.style.width = sumWidth + "px";
|
|
5608
|
+
}
|
|
5609
|
+
else {
|
|
5610
|
+
this.bodyCellContainerDiv.style.width = containerWidth;
|
|
5611
|
+
this.headerCellContainerDiv.style.width = containerWidth;
|
|
5612
|
+
}
|
|
5613
|
+
this.bodyCellContainerDiv.style.visibility = null;
|
|
5614
|
+
this.headerRowDiv.removeAttribute('style');
|
|
5615
|
+
};
|
|
5423
5616
|
return EasyGrid;
|
|
5424
5617
|
}());
|
|
5425
5618
|
|
|
@@ -6606,6 +6799,7 @@ addEasyDataUITexts();
|
|
|
6606
6799
|
|
|
6607
6800
|
|
|
6608
6801
|
|
|
6802
|
+
|
|
6609
6803
|
//datetimepicker
|
|
6610
6804
|
|
|
6611
6805
|
|
|
@@ -7111,12 +7305,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7111
7305
|
var lookupTable = new easy_data_table_EasyDataTable({
|
|
7112
7306
|
loader: {
|
|
7113
7307
|
loadChunk: function (chunkParams) { return _this.context.getDataLoader()
|
|
7114
|
-
.loadChunk(entity_form_builder_assign({}, chunkParams, { id: lookupEntity.id })); }
|
|
7308
|
+
.loadChunk(entity_form_builder_assign(entity_form_builder_assign({}, chunkParams), { id: lookupEntity.id })); }
|
|
7115
7309
|
}
|
|
7116
7310
|
});
|
|
7117
7311
|
_this.context.getDataLoader()
|
|
7118
|
-
.loadChunk({ offset: 0, limit: 1000, needTotal: true,
|
|
7312
|
+
.loadChunk({ offset: 0, limit: 1000, needTotal: true, sourceId: lookupEntity.id })
|
|
7119
7313
|
.then(function (data) {
|
|
7314
|
+
var _a;
|
|
7120
7315
|
var _loop_1 = function (col) {
|
|
7121
7316
|
var attrs = lookupEntity.attributes.filter(function (attr) {
|
|
7122
7317
|
return attr.id == col.id && (attr.isPrimaryKey || attr.showInLookup);
|
|
@@ -7125,13 +7320,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7125
7320
|
lookupTable.columns.add(col);
|
|
7126
7321
|
}
|
|
7127
7322
|
};
|
|
7128
|
-
for (var _i = 0,
|
|
7129
|
-
var col =
|
|
7323
|
+
for (var _i = 0, _b = data.table.columns.getItems(); _i < _b.length; _i++) {
|
|
7324
|
+
var col = _b[_i];
|
|
7130
7325
|
_loop_1(col);
|
|
7131
7326
|
}
|
|
7132
7327
|
lookupTable.setTotal(data.total);
|
|
7133
|
-
for (var
|
|
7134
|
-
var row = _c
|
|
7328
|
+
for (var _c = 0, _d = data.table.getCachedRows(); _c < _d.length; _c++) {
|
|
7329
|
+
var row = _d[_c];
|
|
7135
7330
|
lookupTable.addRow(row);
|
|
7136
7331
|
}
|
|
7137
7332
|
var ds = new DefaultDialogService();
|
|
@@ -7170,7 +7365,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7170
7365
|
.join(', ');
|
|
7171
7366
|
};
|
|
7172
7367
|
if (selectedValue) {
|
|
7173
|
-
|
|
7368
|
+
var attr_1 = lookupEntity.getFirstPrimaryAttr();
|
|
7369
|
+
var key = attr_1.id.substring(attr_1.id.lastIndexOf('.') + 1);
|
|
7370
|
+
_this.context.fetchRecord((_a = {}, _a[key] = selectedValue, _a), lookupEntity.id)
|
|
7174
7371
|
.then(function (data) {
|
|
7175
7372
|
if (data.entity) {
|
|
7176
7373
|
updateSelectedValue(data.entity);
|
|
@@ -7218,7 +7415,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7218
7415
|
}); });
|
|
7219
7416
|
});
|
|
7220
7417
|
};
|
|
7221
|
-
EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, readOnly,
|
|
7418
|
+
EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, value, readOnly, hidden) {
|
|
7222
7419
|
var _this = this;
|
|
7223
7420
|
var horizClass = isIE
|
|
7224
7421
|
? 'kfrm-fields-ie is-horizontal'
|
|
@@ -7239,6 +7436,8 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7239
7436
|
.addClass(horizClass)
|
|
7240
7437
|
.addChild('input', function (b) {
|
|
7241
7438
|
inputEl = b.toDOM();
|
|
7439
|
+
b.name(attr.id);
|
|
7440
|
+
b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
|
|
7242
7441
|
if (readOnly) {
|
|
7243
7442
|
b.attr('readonly', '');
|
|
7244
7443
|
}
|
|
@@ -7262,8 +7461,6 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7262
7461
|
}
|
|
7263
7462
|
});
|
|
7264
7463
|
}
|
|
7265
|
-
b.name(attr.id);
|
|
7266
|
-
b.type(_this.resolveInputType(attr.dataType));
|
|
7267
7464
|
b.value((utils_utils.IsDefinedAndNotNull(value)
|
|
7268
7465
|
? utils_utils.dateTimeToStr(value, editFormat)
|
|
7269
7466
|
: ''));
|
|
@@ -7305,7 +7502,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7305
7502
|
}).toDOM(); });
|
|
7306
7503
|
});
|
|
7307
7504
|
};
|
|
7308
|
-
EntityEditFormBuilder.prototype.setupListField = function (parent, attr,
|
|
7505
|
+
EntityEditFormBuilder.prototype.setupListField = function (parent, attr, value, values, readOnly) {
|
|
7309
7506
|
var _this = this;
|
|
7310
7507
|
domel(parent)
|
|
7311
7508
|
.addChild('div', function (b) { return b
|
|
@@ -7338,12 +7535,14 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7338
7535
|
b.attr('accept', accept);
|
|
7339
7536
|
});
|
|
7340
7537
|
};
|
|
7341
|
-
EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, readOnly,
|
|
7538
|
+
EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, value, readOnly, hidden) {
|
|
7342
7539
|
var _this = this;
|
|
7343
7540
|
domel(parent)
|
|
7344
7541
|
.addChild('input', function (b) {
|
|
7345
|
-
if (readOnly)
|
|
7542
|
+
if (readOnly) {
|
|
7346
7543
|
b.attr('readonly', '');
|
|
7544
|
+
}
|
|
7545
|
+
b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
|
|
7347
7546
|
b.name(attr.id)
|
|
7348
7547
|
.type(_this.resolveInputType(attr.dataType));
|
|
7349
7548
|
if (attr.dataType == DataType.Bool) {
|
|
@@ -7358,7 +7557,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7358
7557
|
}
|
|
7359
7558
|
});
|
|
7360
7559
|
};
|
|
7361
|
-
EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr,
|
|
7560
|
+
EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr, value, readOnly) {
|
|
7362
7561
|
// feature: modify size in value editor ??
|
|
7363
7562
|
domel(parent)
|
|
7364
7563
|
.addChild('textarea', function (b) {
|
|
@@ -7366,6 +7565,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7366
7565
|
b.attr('readonly', '');
|
|
7367
7566
|
b.attr('name', attr.id);
|
|
7368
7567
|
b.setStyle('height', "120px");
|
|
7568
|
+
b.value(utils_utils.IsDefinedAndNotNull(value)
|
|
7569
|
+
? value.toString()
|
|
7570
|
+
: '');
|
|
7369
7571
|
});
|
|
7370
7572
|
};
|
|
7371
7573
|
EntityEditFormBuilder.prototype.addFormField = function (parent, attr) {
|
|
@@ -7381,19 +7583,28 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7381
7583
|
.toDOM();
|
|
7382
7584
|
}
|
|
7383
7585
|
domel(parent)
|
|
7384
|
-
.addChild('label', function (b) {
|
|
7385
|
-
.attr('for', attr.id)
|
|
7386
|
-
.addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": ");
|
|
7586
|
+
.addChild('label', function (b) {
|
|
7587
|
+
b.attr('for', attr.id);
|
|
7588
|
+
b.addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": ");
|
|
7589
|
+
if (attr.description) {
|
|
7590
|
+
b.addChild('div', function (b) { return b
|
|
7591
|
+
.attr('title', attr.description)
|
|
7592
|
+
.addClass('question-mark')
|
|
7593
|
+
.setStyle('vertical-align', 'middle')
|
|
7594
|
+
.setStyle('display', 'inline-block'); });
|
|
7595
|
+
}
|
|
7596
|
+
});
|
|
7597
|
+
var hidden = attr.isPrimaryKey;
|
|
7387
7598
|
if (attr.kind === EntityAttrKind.Lookup) {
|
|
7388
7599
|
this.setupLookupField(parent, attr, readOnly, value);
|
|
7389
7600
|
return;
|
|
7390
7601
|
}
|
|
7391
7602
|
switch (editor.tag) {
|
|
7392
7603
|
case EditorTag.DateTime:
|
|
7393
|
-
this.setupDateTimeField(parent, attr, readOnly,
|
|
7604
|
+
this.setupDateTimeField(parent, attr, value, readOnly, hidden);
|
|
7394
7605
|
break;
|
|
7395
7606
|
case EditorTag.List:
|
|
7396
|
-
this.setupListField(parent, attr,
|
|
7607
|
+
this.setupListField(parent, attr, value, editor.values, readOnly);
|
|
7397
7608
|
break;
|
|
7398
7609
|
case EditorTag.File:
|
|
7399
7610
|
this.setupFileField(parent, attr, readOnly, editor.accept);
|
|
@@ -7401,10 +7612,10 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7401
7612
|
case EditorTag.Edit:
|
|
7402
7613
|
default:
|
|
7403
7614
|
if (editor.multiline) {
|
|
7404
|
-
this.setupTextArea(parent, attr,
|
|
7615
|
+
this.setupTextArea(parent, attr, value, readOnly);
|
|
7405
7616
|
}
|
|
7406
7617
|
else {
|
|
7407
|
-
this.setupTextField(parent, attr, readOnly,
|
|
7618
|
+
this.setupTextField(parent, attr, value, readOnly, hidden);
|
|
7408
7619
|
}
|
|
7409
7620
|
break;
|
|
7410
7621
|
}
|
|
@@ -7456,13 +7667,15 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7456
7667
|
this.form['setHtmlInt'](formHtml);
|
|
7457
7668
|
for (var _i = 0, _a = this.context.getActiveEntity().attributes; _i < _a.length; _i++) {
|
|
7458
7669
|
var attr = _a[_i];
|
|
7459
|
-
if (
|
|
7460
|
-
if (
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7670
|
+
if (!attr.isPrimaryKey) {
|
|
7671
|
+
if (this.params.isEditForm) {
|
|
7672
|
+
if (!attr.showOnEdit)
|
|
7673
|
+
continue;
|
|
7674
|
+
}
|
|
7675
|
+
else {
|
|
7676
|
+
if (!attr.showOnCreate)
|
|
7677
|
+
continue;
|
|
7678
|
+
}
|
|
7466
7679
|
}
|
|
7467
7680
|
this.addFormField(fb.toDOM(), attr);
|
|
7468
7681
|
}
|
|
@@ -7497,8 +7710,8 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
|
|
|
7497
7710
|
}
|
|
7498
7711
|
EasyDataServerLoader.prototype.loadChunk = function (params) {
|
|
7499
7712
|
var _this = this;
|
|
7500
|
-
var url = this.context.resolveEndpoint('
|
|
7501
|
-
delete params.
|
|
7713
|
+
var url = this.context.resolveEndpoint('FetchDataset', { sourceId: params.sourceId || this.context.getActiveEntity().id });
|
|
7714
|
+
delete params.sourceId;
|
|
7502
7715
|
this.context.startProcess();
|
|
7503
7716
|
var http = this.context.getHttpClient();
|
|
7504
7717
|
return http.post(url, params)
|
|
@@ -7535,6 +7748,17 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
|
|
|
7535
7748
|
|
|
7536
7749
|
|
|
7537
7750
|
// CONCATENATED MODULE: ./src/main/data_context.ts
|
|
7751
|
+
var data_context_assign = (undefined && undefined.__assign) || function () {
|
|
7752
|
+
data_context_assign = Object.assign || function(t) {
|
|
7753
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7754
|
+
s = arguments[i];
|
|
7755
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7756
|
+
t[p] = s[p];
|
|
7757
|
+
}
|
|
7758
|
+
return t;
|
|
7759
|
+
};
|
|
7760
|
+
return data_context_assign.apply(this, arguments);
|
|
7761
|
+
};
|
|
7538
7762
|
|
|
7539
7763
|
|
|
7540
7764
|
|
|
@@ -7547,9 +7771,8 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7547
7771
|
this.model = new meta_data_MetaData();
|
|
7548
7772
|
this.model.id = options.metaDataId || '__default';
|
|
7549
7773
|
this.dataLoader = new easy_data_server_loader_EasyDataServerLoader(this);
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
});
|
|
7774
|
+
var dataTableOptions = data_context_assign({ loader: this.dataLoader }, options.dataTable);
|
|
7775
|
+
this.data = new easy_data_table_EasyDataTable(dataTableOptions);
|
|
7553
7776
|
this.setDefaultEndpoints(this.options.endpoint || '/api/easydata');
|
|
7554
7777
|
}
|
|
7555
7778
|
DataContext.prototype.getActiveEntity = function () {
|
|
@@ -7568,8 +7791,8 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7568
7791
|
DataContext.prototype.getDataLoader = function () {
|
|
7569
7792
|
return this.dataLoader;
|
|
7570
7793
|
};
|
|
7571
|
-
DataContext.prototype.createFilter = function (
|
|
7572
|
-
return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(),
|
|
7794
|
+
DataContext.prototype.createFilter = function (sourceId, data, isLookup) {
|
|
7795
|
+
return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(), sourceId || this.activeEntity.id, isLookup);
|
|
7573
7796
|
};
|
|
7574
7797
|
DataContext.prototype.loadMetaData = function () {
|
|
7575
7798
|
var _this = this;
|
|
@@ -7593,7 +7816,7 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7593
7816
|
DataContext.prototype.getHttpClient = function () {
|
|
7594
7817
|
return this.http;
|
|
7595
7818
|
};
|
|
7596
|
-
DataContext.prototype.
|
|
7819
|
+
DataContext.prototype.fetchDataset = function () {
|
|
7597
7820
|
var _this = this;
|
|
7598
7821
|
this.data.clear();
|
|
7599
7822
|
return this.dataLoader.loadChunk({ offset: 0, limit: this.data.chunkSize, needTotal: true })
|
|
@@ -7610,33 +7833,33 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7610
7833
|
return _this.data;
|
|
7611
7834
|
});
|
|
7612
7835
|
};
|
|
7613
|
-
DataContext.prototype.
|
|
7836
|
+
DataContext.prototype.fetchRecord = function (keys, sourceId) {
|
|
7614
7837
|
var _this = this;
|
|
7615
|
-
var url = this.resolveEndpoint('
|
|
7616
|
-
entityId: entityId || this.activeEntity.id });
|
|
7838
|
+
var url = this.resolveEndpoint('FetchRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7617
7839
|
this.startProcess();
|
|
7618
|
-
return this.http.get(url)
|
|
7840
|
+
return this.http.get(url, { queryParams: keys })
|
|
7619
7841
|
.finally(function () { return _this.endProcess(); });
|
|
7620
7842
|
};
|
|
7621
|
-
DataContext.prototype.
|
|
7843
|
+
DataContext.prototype.createRecord = function (obj, sourceId) {
|
|
7622
7844
|
var _this = this;
|
|
7623
|
-
var url = this.resolveEndpoint('
|
|
7845
|
+
var url = this.resolveEndpoint('CreateRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7624
7846
|
this.startProcess();
|
|
7625
|
-
return this.http.post(url, obj, { dataType: 'json' })
|
|
7847
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7848
|
+
.finally(function () { return _this.endProcess(); });
|
|
7626
7849
|
};
|
|
7627
|
-
DataContext.prototype.
|
|
7850
|
+
DataContext.prototype.updateRecord = function (obj, sourceId) {
|
|
7628
7851
|
var _this = this;
|
|
7629
|
-
var url = this.resolveEndpoint('
|
|
7630
|
-
entityId: entityId || this.activeEntity.id });
|
|
7852
|
+
var url = this.resolveEndpoint('UpdateRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7631
7853
|
this.startProcess();
|
|
7632
|
-
return this.http.post(url, obj, { dataType: 'json' })
|
|
7854
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7855
|
+
.finally(function () { return _this.endProcess(); });
|
|
7633
7856
|
};
|
|
7634
|
-
DataContext.prototype.
|
|
7857
|
+
DataContext.prototype.deleteRecord = function (obj, sourceId) {
|
|
7635
7858
|
var _this = this;
|
|
7636
|
-
var url = this.resolveEndpoint('
|
|
7637
|
-
entityId: entityId || this.activeEntity.id });
|
|
7859
|
+
var url = this.resolveEndpoint('DeleteRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7638
7860
|
this.startProcess();
|
|
7639
|
-
return this.http.post(url,
|
|
7861
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7862
|
+
.finally(function () { return _this.endProcess(); });
|
|
7640
7863
|
};
|
|
7641
7864
|
DataContext.prototype.setEndpoint = function (key, value) {
|
|
7642
7865
|
this.endpoints.set(key, value);
|
|
@@ -7661,7 +7884,7 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7661
7884
|
if (opt == 'modelId') {
|
|
7662
7885
|
optVal = this.model.getId();
|
|
7663
7886
|
}
|
|
7664
|
-
else if (opt == '
|
|
7887
|
+
else if (opt == 'sourceId') {
|
|
7665
7888
|
optVal = this.activeEntity.id;
|
|
7666
7889
|
}
|
|
7667
7890
|
else {
|
|
@@ -7683,11 +7906,11 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7683
7906
|
};
|
|
7684
7907
|
DataContext.prototype.setDefaultEndpoints = function (endpointBase) {
|
|
7685
7908
|
this.setEnpointIfNotExist('GetMetaData', combinePath(endpointBase, 'models/{modelId}'));
|
|
7686
|
-
this.setEnpointIfNotExist('
|
|
7687
|
-
this.setEnpointIfNotExist('
|
|
7688
|
-
this.setEnpointIfNotExist('
|
|
7689
|
-
this.setEnpointIfNotExist('
|
|
7690
|
-
this.setEnpointIfNotExist('
|
|
7909
|
+
this.setEnpointIfNotExist('FetchDataset', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
|
|
7910
|
+
this.setEnpointIfNotExist('FetchRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
|
|
7911
|
+
this.setEnpointIfNotExist('CreateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/create'));
|
|
7912
|
+
this.setEnpointIfNotExist('UpdateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/update'));
|
|
7913
|
+
this.setEnpointIfNotExist('DeleteRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/delete'));
|
|
7691
7914
|
};
|
|
7692
7915
|
return DataContext;
|
|
7693
7916
|
}());
|
|
@@ -7820,7 +8043,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7820
8043
|
};
|
|
7821
8044
|
EntityDataView.prototype.renderGrid = function () {
|
|
7822
8045
|
var _this = this;
|
|
7823
|
-
this.context.
|
|
8046
|
+
this.context.fetchDataset()
|
|
7824
8047
|
.then(function (result) {
|
|
7825
8048
|
var gridSlot = document.createElement('div');
|
|
7826
8049
|
_this.slot.appendChild(gridSlot);
|
|
@@ -7833,10 +8056,10 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7833
8056
|
allowPageSizeChange: true,
|
|
7834
8057
|
pageSizeItems: [15, 30, 50, 100, 200]
|
|
7835
8058
|
},
|
|
7836
|
-
|
|
7837
|
-
|
|
8059
|
+
showPlusButton: _this.context.getActiveEntity().isEditable,
|
|
8060
|
+
plusButtonTitle: i18n_i18n.getText('AddRecordBtnTitle'),
|
|
7838
8061
|
showActiveRow: false,
|
|
7839
|
-
|
|
8062
|
+
onPlusButtonClick: _this.addClickHandler.bind(_this),
|
|
7840
8063
|
onGetCellRenderer: _this.manageCellRenderer.bind(_this),
|
|
7841
8064
|
onRowDbClick: _this.rowDbClickHandler.bind(_this),
|
|
7842
8065
|
onSyncGridColumn: _this.syncGridColumnHandler.bind(_this)
|
|
@@ -7891,7 +8114,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7891
8114
|
if (!form.validate())
|
|
7892
8115
|
return false;
|
|
7893
8116
|
form.getData()
|
|
7894
|
-
.then(function (obj) { return _this.context.
|
|
8117
|
+
.then(function (obj) { return _this.context.createRecord(obj); })
|
|
7895
8118
|
.then(function () {
|
|
7896
8119
|
return _this.refreshData();
|
|
7897
8120
|
})
|
|
@@ -7922,12 +8145,10 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7922
8145
|
.replace('{entity}', activeEntity.caption),
|
|
7923
8146
|
body: form.getHtml(),
|
|
7924
8147
|
onSubmit: function () {
|
|
7925
|
-
var keyAttrs = activeEntity.attributes.filter(function (attr) { return attr.isPrimaryKey; });
|
|
7926
|
-
var keys = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
7927
8148
|
if (!form.validate())
|
|
7928
8149
|
return false;
|
|
7929
8150
|
form.getData()
|
|
7930
|
-
.then(function (obj) { return _this.context.
|
|
8151
|
+
.then(function (obj) { return _this.context.updateRecord(obj); })
|
|
7931
8152
|
.then(function () {
|
|
7932
8153
|
return _this.refreshData();
|
|
7933
8154
|
})
|
|
@@ -7948,16 +8169,20 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7948
8169
|
.then(function (row) {
|
|
7949
8170
|
if (row) {
|
|
7950
8171
|
var activeEntity = _this.context.getActiveEntity();
|
|
7951
|
-
var keyAttrs = activeEntity.
|
|
7952
|
-
var
|
|
7953
|
-
var
|
|
8172
|
+
var keyAttrs = activeEntity.getPrimaryAttrs();
|
|
8173
|
+
var keyVals_1 = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
8174
|
+
var keys_1 = keyAttrs.reduce(function (val, attr, index) {
|
|
8175
|
+
var property = attr.id.substring(attr.id.lastIndexOf('.') + 1);
|
|
8176
|
+
val[property] = keyVals_1[index];
|
|
8177
|
+
return val;
|
|
8178
|
+
}, {});
|
|
7954
8179
|
_this.dlg.openConfirm(i18n_i18n.getText('DeleteDlgCaption')
|
|
7955
8180
|
.replace('{entity}', activeEntity.caption), i18n_i18n.getText('DeleteDlgMessage')
|
|
7956
|
-
.replace('{
|
|
8181
|
+
.replace('{recordId}', Object.keys(keys_1)
|
|
8182
|
+
.map(function (key) { return key + ":" + keys_1[key]; }).join(';')))
|
|
7957
8183
|
.then(function (result) {
|
|
7958
8184
|
if (result) {
|
|
7959
|
-
|
|
7960
|
-
_this.context.deleteEntity(keys_1.join(':'))
|
|
8185
|
+
_this.context.deleteRecord(keys_1)
|
|
7961
8186
|
.then(function () {
|
|
7962
8187
|
return _this.refreshData();
|
|
7963
8188
|
})
|
|
@@ -7979,7 +8204,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7979
8204
|
};
|
|
7980
8205
|
EntityDataView.prototype.refreshData = function () {
|
|
7981
8206
|
var _this = this;
|
|
7982
|
-
return this.context.
|
|
8207
|
+
return this.context.fetchDataset()
|
|
7983
8208
|
.then(function () {
|
|
7984
8209
|
_this.grid.refresh();
|
|
7985
8210
|
});
|
|
@@ -8065,6 +8290,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
|
|
|
8065
8290
|
parent.insertBefore(progressBarSlot, parent.firstElementChild);
|
|
8066
8291
|
this.context = new data_context_DataContext({
|
|
8067
8292
|
endpoint: options.endpoint,
|
|
8293
|
+
dataTable: options.dataTable,
|
|
8068
8294
|
onProcessStart: function () { return bar.show(); },
|
|
8069
8295
|
onProcessEnd: function () { return bar.hide(); }
|
|
8070
8296
|
});
|
|
@@ -8159,13 +8385,14 @@ function addEasyDataCRUDTexts() {
|
|
|
8159
8385
|
CalendarBtnTitle: 'Open calendar',
|
|
8160
8386
|
TimerBtnTitle: 'Open timer',
|
|
8161
8387
|
AddBtnTitle: 'Add',
|
|
8388
|
+
AddRecordBtnTitle: 'Add record',
|
|
8162
8389
|
EditBtn: 'Edit',
|
|
8163
8390
|
DeleteBtn: 'Delete',
|
|
8164
8391
|
SelectLink: '[ select ]',
|
|
8165
8392
|
AddDlgCaption: 'Create {entity}',
|
|
8166
8393
|
EditDlgCaption: 'Edit {entity}',
|
|
8167
8394
|
DeleteDlgCaption: 'Delete {entity}',
|
|
8168
|
-
DeleteDlgMessage: 'Are you
|
|
8395
|
+
DeleteDlgMessage: 'Are you sure you want to remove this record: {{recordId}}?',
|
|
8169
8396
|
EntityMenuDesc: 'Click on an entity to view/edit its content',
|
|
8170
8397
|
BackToEntities: 'Back to entities',
|
|
8171
8398
|
SearchBtn: 'Search',
|