@easydata/crud 1.3.6-rc03 → 1.4.0-rc02
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 +861 -602
- 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 +571 -324
- 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(
|
|
2787
|
+
newRow = this.createRow(rowOrValues);
|
|
2752
2788
|
}
|
|
2753
|
-
|
|
2754
|
-
if (!lastChunk || lastChunk.rows.length >= this._chunkSize) {
|
|
2755
|
-
lastChunk = this.createChunk();
|
|
2756
|
-
}
|
|
2757
|
-
lastChunk.rows.push(newRow);
|
|
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
|
|
|
@@ -2946,6 +2959,22 @@ var event_emitter_EventEmitter = /** @class */ (function () {
|
|
|
2946
2959
|
}());
|
|
2947
2960
|
|
|
2948
2961
|
//# sourceMappingURL=event_emitter.js.map
|
|
2962
|
+
// CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/core/dist/lib/utils/liquid.js
|
|
2963
|
+
var liquid;
|
|
2964
|
+
(function (liquid) {
|
|
2965
|
+
function renderLiquidTemplate(template, vars) {
|
|
2966
|
+
var result = template;
|
|
2967
|
+
if (vars) {
|
|
2968
|
+
for (var v in vars) {
|
|
2969
|
+
var liquidVarRegexp = new RegExp('\{\{' + v + '\}\}', 'g');
|
|
2970
|
+
result = result.replace(liquidVarRegexp, vars[v]);
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
return result;
|
|
2974
|
+
}
|
|
2975
|
+
liquid.renderLiquidTemplate = renderLiquidTemplate;
|
|
2976
|
+
})(liquid || (liquid = {}));
|
|
2977
|
+
//# sourceMappingURL=liquid.js.map
|
|
2949
2978
|
// CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/core/dist/lib/i18n/load_default_locale_settings.js
|
|
2950
2979
|
|
|
2951
2980
|
i18n_i18n.resetLocales();
|
|
@@ -2963,7 +2992,6 @@ i18n_i18n.resetLocales();
|
|
|
2963
2992
|
|
|
2964
2993
|
|
|
2965
2994
|
|
|
2966
|
-
//data
|
|
2967
2995
|
|
|
2968
2996
|
|
|
2969
2997
|
|
|
@@ -2977,6 +3005,7 @@ i18n_i18n.resetLocales();
|
|
|
2977
3005
|
|
|
2978
3006
|
|
|
2979
3007
|
|
|
3008
|
+
|
|
2980
3009
|
if (typeof Object.values !== 'function') {
|
|
2981
3010
|
Object.values = function (obj) {
|
|
2982
3011
|
return Object.keys(obj).map(function (key) { return obj[key]; });
|
|
@@ -3008,11 +3037,11 @@ var text_data_filter_assign = (undefined && undefined.__assign) || function () {
|
|
|
3008
3037
|
};
|
|
3009
3038
|
|
|
3010
3039
|
var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
3011
|
-
function TextDataFilter(loader, sourceTable,
|
|
3040
|
+
function TextDataFilter(loader, sourceTable, sourceId, isLookup) {
|
|
3012
3041
|
if (isLookup === void 0) { isLookup = false; }
|
|
3013
3042
|
this.loader = loader;
|
|
3014
3043
|
this.sourceTable = sourceTable;
|
|
3015
|
-
this.
|
|
3044
|
+
this.sourceId = sourceId;
|
|
3016
3045
|
this.isLookup = isLookup;
|
|
3017
3046
|
this.filterValue = '';
|
|
3018
3047
|
//turns off client-side search
|
|
@@ -3049,7 +3078,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3049
3078
|
limit: this.sourceTable.chunkSize,
|
|
3050
3079
|
needTotal: true,
|
|
3051
3080
|
filters: filters_1,
|
|
3052
|
-
|
|
3081
|
+
sourceId: this.sourceId,
|
|
3053
3082
|
lookup: this.isLookup
|
|
3054
3083
|
})
|
|
3055
3084
|
.then(function (data) {
|
|
@@ -3057,7 +3086,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3057
3086
|
chunkSize: _this.sourceTable.chunkSize,
|
|
3058
3087
|
loader: {
|
|
3059
3088
|
loadChunk: function (params) { return _this.loader
|
|
3060
|
-
.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 })); }
|
|
3061
3090
|
}
|
|
3062
3091
|
});
|
|
3063
3092
|
for (var _i = 0, _a = _this.sourceTable.columns.getItems(); _i < _a.length; _i++) {
|
|
@@ -3078,26 +3107,26 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3078
3107
|
return new Promise(function (resolve, reject) {
|
|
3079
3108
|
var filteredTable = new easy_data_table_EasyDataTable({
|
|
3080
3109
|
chunkSize: _this.sourceTable.chunkSize,
|
|
3110
|
+
inMemory: true
|
|
3081
3111
|
});
|
|
3082
3112
|
for (var _i = 0, _a = _this.sourceTable.columns.getItems(); _i < _a.length; _i++) {
|
|
3083
3113
|
var col = _a[_i];
|
|
3084
3114
|
filteredTable.columns.add(col);
|
|
3085
3115
|
}
|
|
3086
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; });
|
|
3087
3120
|
var hasEnterance = function (row) {
|
|
3088
|
-
for (var _i = 0,
|
|
3089
|
-
var col =
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
var
|
|
3093
|
-
|
|
3094
|
-
var
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
var word = words_1[_b];
|
|
3098
|
-
if (normalized.indexOf(word) >= 0) {
|
|
3099
|
-
return true;
|
|
3100
|
-
}
|
|
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;
|
|
3101
3130
|
}
|
|
3102
3131
|
}
|
|
3103
3132
|
}
|
|
@@ -3110,8 +3139,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
|
|
|
3110
3139
|
filteredTable.addRow(row);
|
|
3111
3140
|
}
|
|
3112
3141
|
}
|
|
3113
|
-
|
|
3114
|
-
filteredTable.setTotal(0);
|
|
3142
|
+
filteredTable.setTotal(filteredTable.getCachedCount());
|
|
3115
3143
|
resolve(filteredTable);
|
|
3116
3144
|
});
|
|
3117
3145
|
};
|
|
@@ -3461,6 +3489,13 @@ var dom_elem_builder_extends = (undefined && undefined.__extends) || (function (
|
|
|
3461
3489
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3462
3490
|
};
|
|
3463
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
|
+
};
|
|
3464
3499
|
|
|
3465
3500
|
var DomElementBuilder = /** @class */ (function () {
|
|
3466
3501
|
function DomElementBuilder(tag, parent) {
|
|
@@ -3531,7 +3566,7 @@ var DomElementBuilder = /** @class */ (function () {
|
|
|
3531
3566
|
classNames[_i - 1] = arguments[_i];
|
|
3532
3567
|
}
|
|
3533
3568
|
if (className) {
|
|
3534
|
-
var fullList = className.trim().split(" ")
|
|
3569
|
+
var fullList = __spreadArrays(className.trim().split(" "), classNames);
|
|
3535
3570
|
for (var i = 0; i < fullList.length; i++)
|
|
3536
3571
|
this.element.classList.add(fullList[i]);
|
|
3537
3572
|
}
|
|
@@ -3543,7 +3578,7 @@ var DomElementBuilder = /** @class */ (function () {
|
|
|
3543
3578
|
classNames[_i - 1] = arguments[_i];
|
|
3544
3579
|
}
|
|
3545
3580
|
if (className) {
|
|
3546
|
-
var fullList = className.trim().split(" ")
|
|
3581
|
+
var fullList = __spreadArrays(className.trim().split(" "), classNames);
|
|
3547
3582
|
for (var i = 0; i < fullList.length; i++)
|
|
3548
3583
|
this.element.classList.remove(fullList[i]);
|
|
3549
3584
|
}
|
|
@@ -4110,6 +4145,14 @@ var drag_manager_DragManager = /** @class */ (function () {
|
|
|
4110
4145
|
//global variable
|
|
4111
4146
|
var eqDragManager = new drag_manager_DragManager();
|
|
4112
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
|
|
4113
4156
|
// CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/grid/easy_grid_cell_renderer.js
|
|
4114
4157
|
|
|
4115
4158
|
|
|
@@ -4261,13 +4304,7 @@ var easy_grid_cell_renderer_GridCellRendererStore = /** @class */ (function () {
|
|
|
4261
4304
|
// CONCATENATED MODULE: d:/a/easydata/easydata/easydata.js/packs/ui/dist/lib/grid/easy_grid_columns.js
|
|
4262
4305
|
|
|
4263
4306
|
|
|
4264
|
-
var DEFAULT_WIDTH = 150;
|
|
4265
|
-
var DEFAULT_WIDTH_NUMBER = 120;
|
|
4266
|
-
var DEFAULT_WIDTH_DATE = 200;
|
|
4267
|
-
var DEFAULT_WIDTH_BOOL = 80;
|
|
4268
4307
|
var DEFAULT_WIDTH_STRING = 250;
|
|
4269
|
-
var MIN_WIDTH_STRING = 100;
|
|
4270
|
-
var MAX_WIDTH_STRING = 500;
|
|
4271
4308
|
var ROW_NUM_WIDTH = 60;
|
|
4272
4309
|
var GridColumnAlign;
|
|
4273
4310
|
(function (GridColumnAlign) {
|
|
@@ -4292,36 +4329,25 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
|
|
|
4292
4329
|
function GridColumn(column, grid, isRowNum) {
|
|
4293
4330
|
if (isRowNum === void 0) { isRowNum = false; }
|
|
4294
4331
|
this._label = null;
|
|
4332
|
+
this._description = null;
|
|
4295
4333
|
//public left: number;
|
|
4296
4334
|
this.align = GridColumnAlign.NONE;
|
|
4297
4335
|
this.isVisible = true;
|
|
4298
4336
|
this.isRowNum = false;
|
|
4299
4337
|
this.dataColumn = column;
|
|
4300
4338
|
this.grid = grid;
|
|
4339
|
+
var widthOptions = grid.options.columnWidths || {};
|
|
4301
4340
|
if (column) {
|
|
4302
4341
|
if (column.style.alignment) {
|
|
4303
4342
|
this.align = MapAlignment(column.style.alignment);
|
|
4304
4343
|
}
|
|
4305
|
-
|
|
4306
|
-
var cellType = this.grid.cellRendererStore.getCellType(coltype);
|
|
4307
|
-
switch (cellType) {
|
|
4308
|
-
case CellRendererType.NUMBER:
|
|
4309
|
-
this.width = DEFAULT_WIDTH_NUMBER;
|
|
4310
|
-
break;
|
|
4311
|
-
case CellRendererType.DATETIME:
|
|
4312
|
-
this.width = DEFAULT_WIDTH_DATE;
|
|
4313
|
-
break;
|
|
4314
|
-
case CellRendererType.BOOL:
|
|
4315
|
-
this.width = DEFAULT_WIDTH_BOOL;
|
|
4316
|
-
break;
|
|
4317
|
-
default:
|
|
4318
|
-
this.width = DEFAULT_WIDTH_STRING;
|
|
4319
|
-
}
|
|
4344
|
+
this.width = (widthOptions && widthOptions[this.type]) ? widthOptions[this.type].default : DEFAULT_WIDTH_STRING;
|
|
4320
4345
|
this.cellRenderer = this.grid.cellRendererStore.getDefaultRenderer(column.type);
|
|
4346
|
+
this._description = column.description;
|
|
4321
4347
|
}
|
|
4322
4348
|
else if (isRowNum) {
|
|
4323
4349
|
this.isRowNum = true;
|
|
4324
|
-
this.width = ROW_NUM_WIDTH;
|
|
4350
|
+
this.width = (widthOptions && widthOptions.rowNumColumn) ? widthOptions.rowNumColumn.default : ROW_NUM_WIDTH;
|
|
4325
4351
|
this._label = '';
|
|
4326
4352
|
this.cellRenderer = this.grid.cellRendererStore.getDefaultRendererByType(CellRendererType.NUMBER);
|
|
4327
4353
|
}
|
|
@@ -4340,6 +4366,14 @@ var easy_grid_columns_GridColumn = /** @class */ (function () {
|
|
|
4340
4366
|
configurable: true
|
|
4341
4367
|
});
|
|
4342
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
|
+
});
|
|
4343
4377
|
Object.defineProperty(GridColumn.prototype, "type", {
|
|
4344
4378
|
get: function () {
|
|
4345
4379
|
return this.dataColumn ? this.dataColumn.type : null;
|
|
@@ -4359,9 +4393,10 @@ var easy_grid_columns_GridColumnList = /** @class */ (function () {
|
|
|
4359
4393
|
GridColumnList.prototype.sync = function (columnList, hasRowNumCol) {
|
|
4360
4394
|
if (hasRowNumCol === void 0) { hasRowNumCol = true; }
|
|
4361
4395
|
this.clear();
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4396
|
+
var rowNumCol = new easy_grid_columns_GridColumn(null, this.grid, true);
|
|
4397
|
+
this.add(rowNumCol);
|
|
4398
|
+
if (!hasRowNumCol) {
|
|
4399
|
+
rowNumCol.isVisible = false;
|
|
4365
4400
|
}
|
|
4366
4401
|
if (columnList) {
|
|
4367
4402
|
for (var _i = 0, _a = columnList.getItems(); _i < _a.length; _i++) {
|
|
@@ -4435,6 +4470,14 @@ var easy_grid_assign = (undefined && undefined.__assign) || function () {
|
|
|
4435
4470
|
};
|
|
4436
4471
|
return easy_grid_assign.apply(this, arguments);
|
|
4437
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
|
+
|
|
4438
4481
|
|
|
4439
4482
|
|
|
4440
4483
|
|
|
@@ -4467,14 +4510,42 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4467
4510
|
pageSize: 30,
|
|
4468
4511
|
pageSizeItems: [20, 30, 50, 100, 200]
|
|
4469
4512
|
},
|
|
4470
|
-
|
|
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
|
+
},
|
|
4542
|
+
showPlusButton: false,
|
|
4471
4543
|
viewportRowsCount: null,
|
|
4472
4544
|
showActiveRow: true
|
|
4473
4545
|
};
|
|
4474
4546
|
this.rowsOnPagePromise = null;
|
|
4475
4547
|
this.containerInitialHeight = 0;
|
|
4476
4548
|
this.firstRender = true;
|
|
4477
|
-
this.compareValues = this.strictCompare;
|
|
4478
4549
|
this.prevRowTotals = null;
|
|
4479
4550
|
this.landingIndex = -1;
|
|
4480
4551
|
this.landingSlot = domel('div')
|
|
@@ -4486,7 +4557,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4486
4557
|
if (options && options.paging) {
|
|
4487
4558
|
options.paging = utils_utils.assign(this.defaultDataGridOptions.paging, options.paging);
|
|
4488
4559
|
}
|
|
4489
|
-
this.options =
|
|
4560
|
+
this.options = this.mergeOptions(options);
|
|
4561
|
+
this.processColumnWidthsOptions();
|
|
4490
4562
|
if (!this.options.slot)
|
|
4491
4563
|
throw Error('"slot" parameter is required to initialize EasyDataGrid');
|
|
4492
4564
|
if (!this.options.dataTable)
|
|
@@ -4498,6 +4570,42 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4498
4570
|
this.setSlot(this.options.slot);
|
|
4499
4571
|
this.init(this.options);
|
|
4500
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
|
+
};
|
|
4501
4609
|
EasyGrid.prototype.setSlot = function (slot) {
|
|
4502
4610
|
if (typeof slot === 'string') {
|
|
4503
4611
|
if (slot.length) {
|
|
@@ -4530,8 +4638,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4530
4638
|
if (options.onRowDbClick) {
|
|
4531
4639
|
this.addEventListener('rowDbClick', options.onRowDbClick);
|
|
4532
4640
|
}
|
|
4533
|
-
if (options.
|
|
4534
|
-
this.addEventListener('
|
|
4641
|
+
if (options.onPlusButtonClick) {
|
|
4642
|
+
this.addEventListener('plusButtonClick', options.onPlusButtonClick);
|
|
4535
4643
|
}
|
|
4536
4644
|
if (options.onColumnChanged) {
|
|
4537
4645
|
this.addEventListener('columnChanged', options.onColumnChanged);
|
|
@@ -4617,7 +4725,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4617
4725
|
};
|
|
4618
4726
|
EasyGrid.prototype.render = function () {
|
|
4619
4727
|
var _this = this;
|
|
4620
|
-
if (!this.hasData() && !this.options.
|
|
4728
|
+
if (!this.hasData() && !this.options.showPlusButton)
|
|
4621
4729
|
return;
|
|
4622
4730
|
this.containerInitialHeight = this.slot.clientHeight;
|
|
4623
4731
|
this.rootDiv = document.createElement('div');
|
|
@@ -4634,18 +4742,27 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4634
4742
|
gridContainer.classList.add(this.cssPrefix + "-container");
|
|
4635
4743
|
gridContainer.appendChild(this.rootDiv);
|
|
4636
4744
|
this.slot.appendChild(gridContainer);
|
|
4745
|
+
var needAutoResize = this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
|
|
4637
4746
|
if (this.rowsOnPagePromise) {
|
|
4638
4747
|
this.rowsOnPagePromise
|
|
4639
4748
|
.then(function () { return _this.updateHeight(); })
|
|
4640
4749
|
.then(function () {
|
|
4641
4750
|
_this.firstRender = false;
|
|
4642
4751
|
_this.rowsOnPagePromise = null;
|
|
4752
|
+
if (needAutoResize) {
|
|
4753
|
+
_this.resizeColumns();
|
|
4754
|
+
}
|
|
4643
4755
|
});
|
|
4644
4756
|
}
|
|
4645
4757
|
else {
|
|
4646
4758
|
setTimeout(function () {
|
|
4647
|
-
_this.updateHeight()
|
|
4648
|
-
|
|
4759
|
+
_this.updateHeight()
|
|
4760
|
+
.then(function () {
|
|
4761
|
+
_this.firstRender = false;
|
|
4762
|
+
if (needAutoResize) {
|
|
4763
|
+
_this.resizeColumns();
|
|
4764
|
+
}
|
|
4765
|
+
});
|
|
4649
4766
|
}, 100);
|
|
4650
4767
|
}
|
|
4651
4768
|
};
|
|
@@ -4656,14 +4773,14 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4656
4773
|
var firstRow = _this.bodyCellContainerDiv.firstElementChild;
|
|
4657
4774
|
var rowHeight = firstRow ? firstRow.offsetHeight : DEFAULT_ROW_HEIGHT;
|
|
4658
4775
|
var rowCount = _this.options.viewportRowsCount; // || DEFAULT_ROW_COUNT;
|
|
4659
|
-
var
|
|
4660
|
-
domel(_this.
|
|
4661
|
-
.setStyle('height',
|
|
4776
|
+
var viewportHeight_1 = rowHeight * rowCount;
|
|
4777
|
+
domel(_this.bodyViewportDiv)
|
|
4778
|
+
.setStyle('height', viewportHeight_1 + "px");
|
|
4662
4779
|
setTimeout(function () {
|
|
4663
4780
|
var sbHeight = _this.bodyViewportDiv.offsetHeight - _this.bodyViewportDiv.clientHeight;
|
|
4664
|
-
|
|
4665
|
-
domel(_this.
|
|
4666
|
-
.setStyle('height',
|
|
4781
|
+
viewportHeight_1 = viewportHeight_1 + sbHeight;
|
|
4782
|
+
domel(_this.bodyViewportDiv)
|
|
4783
|
+
.setStyle('height', viewportHeight_1 + "px");
|
|
4667
4784
|
resolve();
|
|
4668
4785
|
}, 100);
|
|
4669
4786
|
return;
|
|
@@ -4682,6 +4799,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4682
4799
|
}
|
|
4683
4800
|
});
|
|
4684
4801
|
};
|
|
4802
|
+
EasyGrid.prototype.getContainerWidth = function () {
|
|
4803
|
+
return this.columns.getItems()
|
|
4804
|
+
.filter(function (col) { return col.isVisible; })
|
|
4805
|
+
.map(function (col) { return col.width; })
|
|
4806
|
+
.reduce(function (sum, current) { return sum + current; });
|
|
4807
|
+
};
|
|
4685
4808
|
EasyGrid.prototype.renderHeader = function () {
|
|
4686
4809
|
var _this = this;
|
|
4687
4810
|
this.headerDiv = domel('div')
|
|
@@ -4704,10 +4827,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4704
4827
|
_this.headerRowDiv.appendChild(hd);
|
|
4705
4828
|
if (column.isRowNum) {
|
|
4706
4829
|
domel(hd)
|
|
4707
|
-
.addChildElement(_this.
|
|
4830
|
+
.addChildElement(_this.renderHeaderButtons());
|
|
4708
4831
|
}
|
|
4709
4832
|
});
|
|
4710
|
-
var containerWidth = this.
|
|
4833
|
+
var containerWidth = this.getContainerWidth();
|
|
4711
4834
|
domel(this.headerCellContainerDiv)
|
|
4712
4835
|
.setStyle('width', containerWidth + "px");
|
|
4713
4836
|
};
|
|
@@ -4718,7 +4841,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4718
4841
|
var _this = this;
|
|
4719
4842
|
var colBuilder = domel('div')
|
|
4720
4843
|
.addClass(this.cssPrefix + "-header-cell")
|
|
4721
|
-
.data('col-idx', "" +
|
|
4844
|
+
.data('col-idx', "" + index)
|
|
4722
4845
|
.setStyle('width', column.width + "px");
|
|
4723
4846
|
if (column.dataColumn) {
|
|
4724
4847
|
colBuilder
|
|
@@ -4732,6 +4855,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4732
4855
|
.addClass(this.cssPrefix + "-header-cell-label")
|
|
4733
4856
|
.text(column.label);
|
|
4734
4857
|
}
|
|
4858
|
+
if (column.description) {
|
|
4859
|
+
domel('div', colDiv)
|
|
4860
|
+
.addClass('question-mark')
|
|
4861
|
+
.title(column.description);
|
|
4862
|
+
}
|
|
4735
4863
|
if (this.options.allowDragDrop) {
|
|
4736
4864
|
eqDragManager.registerDraggableItem({
|
|
4737
4865
|
element: colDiv,
|
|
@@ -4751,14 +4879,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4751
4879
|
}
|
|
4752
4880
|
return colDiv;
|
|
4753
4881
|
};
|
|
4754
|
-
EasyGrid.prototype.strictCompare = function (value1, value2) {
|
|
4755
|
-
return value1 !== value2;
|
|
4756
|
-
};
|
|
4757
|
-
EasyGrid.prototype.caseInsensitiveCompare = function (value1, value2) {
|
|
4758
|
-
var val1 = (typeof value1 === 'string') ? value1.toLowerCase() : value1;
|
|
4759
|
-
var val2 = (typeof value2 === 'string') ? value2.toLowerCase() : value2;
|
|
4760
|
-
return val1 !== val2;
|
|
4761
|
-
};
|
|
4762
4882
|
EasyGrid.prototype.renderBody = function () {
|
|
4763
4883
|
var _this = this;
|
|
4764
4884
|
this.bodyDiv = domel('div')
|
|
@@ -4772,10 +4892,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4772
4892
|
.addClass(this.cssPrefix + "-cell-container")
|
|
4773
4893
|
.toDOM();
|
|
4774
4894
|
var showAggrs = this.canShowAggregates();
|
|
4775
|
-
this.compareValues = this.caseInsensitiveCompare;
|
|
4776
|
-
if (showAggrs && this.options.aggregates.settings.caseSensitiveGroups) {
|
|
4777
|
-
this.compareValues = this.strictCompare;
|
|
4778
|
-
}
|
|
4779
4895
|
if (this.dataTable) {
|
|
4780
4896
|
this.showProgress();
|
|
4781
4897
|
this.rowsOnPagePromise = this.getRowsToRender()
|
|
@@ -4785,15 +4901,22 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4785
4901
|
//prevent double rendering (bad solution, we have to figure out how to avoid this behavior properly)
|
|
4786
4902
|
_this.bodyCellContainerDiv.innerHTML = '';
|
|
4787
4903
|
_this.prevRowTotals = null;
|
|
4904
|
+
var rowsToRender = 0;
|
|
4788
4905
|
if (rows.length) {
|
|
4789
4906
|
var groups_1 = showAggrs
|
|
4790
4907
|
? _this.options.aggregates.settings.getGroups()
|
|
4791
4908
|
: [];
|
|
4909
|
+
rowsToRender = (rows.length < _this.pagination.pageSize)
|
|
4910
|
+
? rows.length
|
|
4911
|
+
: _this.pagination.pageSize;
|
|
4792
4912
|
rows.forEach(function (row, index) {
|
|
4793
4913
|
if (showAggrs)
|
|
4794
4914
|
_this.updateTotalsState(groups_1, row);
|
|
4795
|
-
|
|
4796
|
-
|
|
4915
|
+
//we don't actually render the last row
|
|
4916
|
+
if (index < rowsToRender) {
|
|
4917
|
+
var tr = _this.renderRow(row, index);
|
|
4918
|
+
_this.bodyCellContainerDiv.appendChild(tr);
|
|
4919
|
+
}
|
|
4797
4920
|
});
|
|
4798
4921
|
var showGrandTotalsOnEachPage = _this.options.aggregates && _this.options.aggregates.showGrandTotalsOnEachPage;
|
|
4799
4922
|
if (showAggrs && (_this.isLastPage() || showGrandTotalsOnEachPage)) {
|
|
@@ -4801,11 +4924,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4801
4924
|
_this.updateTotalsState(groups_1, row, true);
|
|
4802
4925
|
}
|
|
4803
4926
|
}
|
|
4804
|
-
var containerWidth = _this.
|
|
4805
|
-
.map(function (column) { return column.width; }).reduce(function (sum, current) { return sum + current; });
|
|
4927
|
+
var containerWidth = _this.getContainerWidth();
|
|
4806
4928
|
domel(_this.bodyCellContainerDiv)
|
|
4807
4929
|
.setStyle('width', containerWidth + "px");
|
|
4808
|
-
return
|
|
4930
|
+
return rowsToRender;
|
|
4809
4931
|
})
|
|
4810
4932
|
.catch(function (error) { console.error(error); return 0; });
|
|
4811
4933
|
}
|
|
@@ -4813,7 +4935,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4813
4935
|
domel(_this.headerViewportDiv)
|
|
4814
4936
|
.setStyle('margin-left', "-" + _this.bodyViewportDiv.scrollLeft + "px");
|
|
4815
4937
|
});
|
|
4816
|
-
this.bodyViewportDiv.addEventListener('keydown', this.
|
|
4938
|
+
this.bodyViewportDiv.addEventListener('keydown', this.onViewportKeydown.bind(this));
|
|
4817
4939
|
};
|
|
4818
4940
|
EasyGrid.prototype.isLastPage = function () {
|
|
4819
4941
|
if (this.dataTable.elasticChunks) {
|
|
@@ -4839,7 +4961,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4839
4961
|
var group = groups[level - 1];
|
|
4840
4962
|
for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
|
|
4841
4963
|
var col = _a[_i];
|
|
4842
|
-
if (
|
|
4964
|
+
if (!aggrSettings.compareValues(this.prevRowTotals.getValue(col), newRow.getValue(col))) {
|
|
4843
4965
|
changeLevel = level;
|
|
4844
4966
|
break;
|
|
4845
4967
|
}
|
|
@@ -4900,8 +5022,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4900
5022
|
});
|
|
4901
5023
|
var aggrContainer = this.options.aggregates.calculator.getAggrContainer();
|
|
4902
5024
|
var aggrCols = aggrSettings.getAggregates().map(function (c) { return c.colId; });
|
|
4903
|
-
var key =
|
|
4904
|
-
aggrContainer.
|
|
5025
|
+
var key = aggrSettings.buildGroupKey(group, row);
|
|
5026
|
+
aggrContainer.getAggregateData(level, key)
|
|
4905
5027
|
.then(function (values) {
|
|
4906
5028
|
for (var _i = 0, aggrCols_1 = aggrCols; _i < aggrCols_1.length; _i++) {
|
|
4907
5029
|
var aggrColId = aggrCols_1[_i];
|
|
@@ -4942,34 +5064,20 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4942
5064
|
}
|
|
4943
5065
|
}
|
|
4944
5066
|
if (groupFooterTemplate) {
|
|
4945
|
-
var cellDiv_1 = _this.renderCell(column,
|
|
5067
|
+
var cellDiv_1 = _this.renderCell(column, index, val, rowElement);
|
|
4946
5068
|
var innerCell = cellDiv_1.firstChild;
|
|
4947
5069
|
val = innerCell.innerHTML;
|
|
4948
5070
|
val = _this.applyGroupColumnTemplate(groupFooterTemplate, val, values[aggrSettings.COUNT_FIELD_NAME]);
|
|
4949
5071
|
}
|
|
4950
5072
|
}
|
|
4951
|
-
var cellDiv = _this.renderCell(column,
|
|
5073
|
+
var cellDiv = _this.renderCell(column, index, val, rowElement);
|
|
4952
5074
|
rowElement.appendChild(cellDiv);
|
|
4953
5075
|
});
|
|
4954
5076
|
})
|
|
4955
5077
|
.catch(function (error) { return console.error(error); });
|
|
4956
5078
|
return rowElement;
|
|
4957
5079
|
};
|
|
4958
|
-
EasyGrid.prototype.
|
|
4959
|
-
var aggrSettings = this.options.aggregates.settings;
|
|
4960
|
-
var caseInsensitive = aggrSettings && !aggrSettings.caseSensitiveGroups;
|
|
4961
|
-
var result = {};
|
|
4962
|
-
for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
|
|
4963
|
-
var colId = _a[_i];
|
|
4964
|
-
var keyVal = row.getValue(colId);
|
|
4965
|
-
if (caseInsensitive && typeof (keyVal) === 'string') {
|
|
4966
|
-
keyVal = keyVal.toLowerCase();
|
|
4967
|
-
}
|
|
4968
|
-
result[colId] = keyVal;
|
|
4969
|
-
}
|
|
4970
|
-
return result;
|
|
4971
|
-
};
|
|
4972
|
-
EasyGrid.prototype.onVieportKeydown = function (ev) {
|
|
5080
|
+
EasyGrid.prototype.onViewportKeydown = function (ev) {
|
|
4973
5081
|
if (this.options.showActiveRow) {
|
|
4974
5082
|
var rowCount = this.bodyCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-row").length;
|
|
4975
5083
|
var newValue = void 0;
|
|
@@ -5023,13 +5131,17 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5023
5131
|
}
|
|
5024
5132
|
}
|
|
5025
5133
|
};
|
|
5134
|
+
/** Returns a promise with the list of the rows to render on one page.
|
|
5135
|
+
* The list contains pageSize+1 row to make it possible
|
|
5136
|
+
* to render the totals row (if it appears to be on the edge between pages)
|
|
5137
|
+
*/
|
|
5026
5138
|
EasyGrid.prototype.getRowsToRender = function () {
|
|
5027
5139
|
if (this.options.paging.enabled === false) {
|
|
5028
5140
|
return Promise.resolve(this.dataTable.getCachedRows());
|
|
5029
5141
|
}
|
|
5030
5142
|
return this.dataTable.getRows({
|
|
5031
|
-
|
|
5032
|
-
|
|
5143
|
+
offset: (this.pagination.page - 1) * this.pagination.pageSize,
|
|
5144
|
+
limit: this.pagination.pageSize + 1
|
|
5033
5145
|
})
|
|
5034
5146
|
.catch(function (error) {
|
|
5035
5147
|
console.error(error);
|
|
@@ -5054,23 +5166,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5054
5166
|
var pageInfoDiv = domel('div')
|
|
5055
5167
|
.addClass(this.cssPrefix + "-page-info")
|
|
5056
5168
|
.toDOM();
|
|
5057
|
-
var
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
var
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
.
|
|
5073
|
-
|
|
5169
|
+
var rowCount = this.dataTable.getTotal();
|
|
5170
|
+
if (rowCount > 0) {
|
|
5171
|
+
var fistPageRecordNum = count
|
|
5172
|
+
? (this.pagination.page - 1) * this.pagination.pageSize + 1
|
|
5173
|
+
: 0;
|
|
5174
|
+
var lastPageRecordNum = count
|
|
5175
|
+
? fistPageRecordNum + count - 1
|
|
5176
|
+
: 0;
|
|
5177
|
+
var totalStr = this.dataTable.getTotal().toString();
|
|
5178
|
+
if (this.dataTable.elasticChunks) {
|
|
5179
|
+
var count_1 = this.dataTable.getCachedCount();
|
|
5180
|
+
var total = this.dataTable.getTotal();
|
|
5181
|
+
if (count_1 !== total)
|
|
5182
|
+
totalStr = '?';
|
|
5183
|
+
}
|
|
5184
|
+
pageInfoDiv.innerHTML = i18n_i18n.getText('GridPageInfo')
|
|
5185
|
+
.replace('{FirstPageRecordNum}', "<span>" + fistPageRecordNum.toString() + "</span>")
|
|
5186
|
+
.replace('{LastPageRecordNum}', "<span>" + lastPageRecordNum.toString() + "</span>")
|
|
5187
|
+
.replace('{Total}', "<span>" + totalStr + "</span>");
|
|
5188
|
+
}
|
|
5074
5189
|
return pageInfoDiv;
|
|
5075
5190
|
};
|
|
5076
5191
|
EasyGrid.prototype.showProgress = function () {
|
|
@@ -5125,13 +5240,13 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5125
5240
|
if (this.options.showActiveRow && index == this.activeRowIndex) {
|
|
5126
5241
|
rowBuilder.addClass(this.cssPrefix + "-row-active");
|
|
5127
5242
|
}
|
|
5128
|
-
this.columns.getItems().forEach(function (column) {
|
|
5243
|
+
this.columns.getItems().forEach(function (column, index) {
|
|
5129
5244
|
if (!column.isVisible) {
|
|
5130
5245
|
return;
|
|
5131
5246
|
}
|
|
5132
5247
|
var colindex = column.isRowNum ? -1 : _this.dataTable.columns.getIndex(column.dataColumn.id);
|
|
5133
5248
|
var val = column.isRowNum ? indexGlobal + 1 : row.getValue(colindex);
|
|
5134
|
-
rowElement.appendChild(_this.renderCell(column,
|
|
5249
|
+
rowElement.appendChild(_this.renderCell(column, index, val, rowElement));
|
|
5135
5250
|
});
|
|
5136
5251
|
return rowElement;
|
|
5137
5252
|
};
|
|
@@ -5165,7 +5280,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5165
5280
|
var _this = this;
|
|
5166
5281
|
var paginateDiv = document.createElement('div');
|
|
5167
5282
|
paginateDiv.className = this.cssPrefix + "-pagination-wrapper";
|
|
5168
|
-
|
|
5283
|
+
var rowCount = this.dataTable.getTotal();
|
|
5284
|
+
if (this.options.paging && this.options.paging.enabled && rowCount > 0) {
|
|
5169
5285
|
var prefix_1 = this.paginationOptions.useBootstrap ? '' : this.cssPrefix + "-";
|
|
5170
5286
|
var buttonClickHandler_1 = function (ev) {
|
|
5171
5287
|
var element = ev.target;
|
|
@@ -5291,18 +5407,18 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5291
5407
|
EasyGrid.prototype.removeEventListener = function (eventType, handlerId) {
|
|
5292
5408
|
this.eventEmitter.unsubscribe(eventType, handlerId);
|
|
5293
5409
|
};
|
|
5294
|
-
EasyGrid.prototype.
|
|
5410
|
+
EasyGrid.prototype.renderHeaderButtons = function () {
|
|
5295
5411
|
var _this = this;
|
|
5296
|
-
if (this.options.
|
|
5412
|
+
if (this.options.showPlusButton) {
|
|
5297
5413
|
return domel('div')
|
|
5298
|
-
.addClass(this.cssPrefix + "-
|
|
5299
|
-
.title(this.options.
|
|
5414
|
+
.addClass(this.cssPrefix + "-header-btn-plus")
|
|
5415
|
+
.title(this.options.plusButtonTitle || 'Add')
|
|
5300
5416
|
.addChild('a', function (builder) { return builder
|
|
5301
5417
|
.attr('href', 'javascript:void(0)')
|
|
5302
5418
|
.on('click', function (e) {
|
|
5303
5419
|
e.preventDefault();
|
|
5304
5420
|
_this.fireEvent({
|
|
5305
|
-
type: '
|
|
5421
|
+
type: 'plusButtonClick',
|
|
5306
5422
|
sourceEvent: e
|
|
5307
5423
|
});
|
|
5308
5424
|
}); })
|
|
@@ -5403,6 +5519,97 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5403
5519
|
EasyGrid.prototype.focus = function () {
|
|
5404
5520
|
this.bodyViewportDiv.focus();
|
|
5405
5521
|
};
|
|
5522
|
+
EasyGrid.prototype.resizeColumns = function () {
|
|
5523
|
+
if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
|
|
5524
|
+
return;
|
|
5525
|
+
var containerWidth = this.bodyCellContainerDiv.style.width;
|
|
5526
|
+
this.bodyCellContainerDiv.style.visibility = 'hidden';
|
|
5527
|
+
this.bodyCellContainerDiv.style.width = '1px';
|
|
5528
|
+
//this.headerRowDiv.style.visibility = 'hidden';
|
|
5529
|
+
this.headerRowDiv.style.width = '1px';
|
|
5530
|
+
var sumWidth = 0;
|
|
5531
|
+
var columns = this.columns.getItems();
|
|
5532
|
+
var headerCells = this.headerCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-header-cell");
|
|
5533
|
+
var headerIdx = 0;
|
|
5534
|
+
var _loop_1 = function (idx) {
|
|
5535
|
+
var column = columns[idx];
|
|
5536
|
+
if (!column.isVisible)
|
|
5537
|
+
return "continue";
|
|
5538
|
+
var calculatedWidth = this_1.options.columnWidths.autoResize !== AutoResizeColumns.Always && column.dataColumn
|
|
5539
|
+
? column.dataColumn.calculatedWidth
|
|
5540
|
+
: 0;
|
|
5541
|
+
var cellValues = this_1.bodyCellContainerDiv.querySelectorAll("." + this_1.cssPrefix + "-cell[data-col-idx=\"" + idx + "\"] > ." + this_1.cssPrefix + "-cell-value");
|
|
5542
|
+
var maxWidth = 0;
|
|
5543
|
+
if (calculatedWidth > 0) {
|
|
5544
|
+
sumWidth += calculatedWidth;
|
|
5545
|
+
column.width = calculatedWidth;
|
|
5546
|
+
cellValues.forEach(function (value) {
|
|
5547
|
+
value.parentElement.style.width = calculatedWidth + "px";
|
|
5548
|
+
});
|
|
5549
|
+
headerCells[headerIdx].style.width = calculatedWidth + "px";
|
|
5550
|
+
}
|
|
5551
|
+
else {
|
|
5552
|
+
if (cellValues.length == 0) {
|
|
5553
|
+
headerCells[headerIdx].style.width = null;
|
|
5554
|
+
headerCells[headerIdx].style.whiteSpace = 'nowrap';
|
|
5555
|
+
}
|
|
5556
|
+
maxWidth = headerCells[headerIdx].offsetWidth;
|
|
5557
|
+
if (cellValues.length > 0) {
|
|
5558
|
+
cellValues.forEach(function (value) {
|
|
5559
|
+
value.parentElement.style.width = null;
|
|
5560
|
+
var width = value.parentElement.offsetWidth;
|
|
5561
|
+
if (width > maxWidth) {
|
|
5562
|
+
maxWidth = width;
|
|
5563
|
+
}
|
|
5564
|
+
});
|
|
5565
|
+
maxWidth += 3;
|
|
5566
|
+
var maxOption = column.isRowNum
|
|
5567
|
+
? this_1.options.columnWidths.rowNumColumn.max || 500
|
|
5568
|
+
: this_1.options.columnWidths[column.dataColumn.type].max || 2000;
|
|
5569
|
+
var minOption = column.isRowNum
|
|
5570
|
+
? this_1.options.columnWidths.rowNumColumn.min || 0
|
|
5571
|
+
: this_1.options.columnWidths[column.dataColumn.type].min || 20;
|
|
5572
|
+
if (maxWidth > maxOption) {
|
|
5573
|
+
maxWidth = maxOption;
|
|
5574
|
+
}
|
|
5575
|
+
if (maxWidth < minOption) {
|
|
5576
|
+
maxWidth = minOption;
|
|
5577
|
+
}
|
|
5578
|
+
if (utils_utils.isNumericType(column.type)) {
|
|
5579
|
+
//increase the calculated width in 1.3 times for numeric columns
|
|
5580
|
+
maxWidth = Math.round(maxWidth * 1.3);
|
|
5581
|
+
}
|
|
5582
|
+
sumWidth += maxWidth;
|
|
5583
|
+
column.width = maxWidth;
|
|
5584
|
+
cellValues.forEach(function (value) {
|
|
5585
|
+
value.parentElement.style.width = maxWidth + "px";
|
|
5586
|
+
});
|
|
5587
|
+
headerCells[headerIdx].style.width = maxWidth + "px";
|
|
5588
|
+
if (column.dataColumn) {
|
|
5589
|
+
column.dataColumn.calculatedWidth = maxWidth;
|
|
5590
|
+
}
|
|
5591
|
+
}
|
|
5592
|
+
else {
|
|
5593
|
+
sumWidth += maxWidth;
|
|
5594
|
+
}
|
|
5595
|
+
}
|
|
5596
|
+
headerIdx++;
|
|
5597
|
+
};
|
|
5598
|
+
var this_1 = this;
|
|
5599
|
+
for (var idx = 0; idx < this.columns.count; idx++) {
|
|
5600
|
+
_loop_1(idx);
|
|
5601
|
+
}
|
|
5602
|
+
if (sumWidth > 0) {
|
|
5603
|
+
this.bodyCellContainerDiv.style.width = sumWidth + "px";
|
|
5604
|
+
this.headerCellContainerDiv.style.width = sumWidth + "px";
|
|
5605
|
+
}
|
|
5606
|
+
else {
|
|
5607
|
+
this.bodyCellContainerDiv.style.width = containerWidth;
|
|
5608
|
+
this.headerCellContainerDiv.style.width = containerWidth;
|
|
5609
|
+
}
|
|
5610
|
+
this.bodyCellContainerDiv.style.visibility = null;
|
|
5611
|
+
this.headerRowDiv.removeAttribute('style');
|
|
5612
|
+
};
|
|
5406
5613
|
return EasyGrid;
|
|
5407
5614
|
}());
|
|
5408
5615
|
|
|
@@ -6156,9 +6363,9 @@ var DefaultDialogService = /** @class */ (function () {
|
|
|
6156
6363
|
_this.open(options);
|
|
6157
6364
|
});
|
|
6158
6365
|
};
|
|
6159
|
-
DefaultDialogService.prototype.open = function (options) {
|
|
6366
|
+
DefaultDialogService.prototype.open = function (options, data) {
|
|
6160
6367
|
var _this = this;
|
|
6161
|
-
var dialog = new default_dialog_service_DefaultDialog(options);
|
|
6368
|
+
var dialog = new default_dialog_service_DefaultDialog(options, data);
|
|
6162
6369
|
var onDestroy = options.onDestroy;
|
|
6163
6370
|
options.onDestroy = function (dlg) {
|
|
6164
6371
|
_this.untrack(dlg);
|
|
@@ -6206,7 +6413,7 @@ var DefaultDialogService = /** @class */ (function () {
|
|
|
6206
6413
|
}());
|
|
6207
6414
|
|
|
6208
6415
|
var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
6209
|
-
function DefaultDialog(options) {
|
|
6416
|
+
function DefaultDialog(options, data) {
|
|
6210
6417
|
var _this = this;
|
|
6211
6418
|
this.options = options;
|
|
6212
6419
|
this.submitHandler = function (token) {
|
|
@@ -6234,6 +6441,7 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6234
6441
|
return true;
|
|
6235
6442
|
};
|
|
6236
6443
|
this.dialogId = utils_utils.generateId('dlg');
|
|
6444
|
+
this.data = data;
|
|
6237
6445
|
this.slot =
|
|
6238
6446
|
domel('div', document.body)
|
|
6239
6447
|
.attr('tab-index', '-1')
|
|
@@ -6268,7 +6476,8 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6268
6476
|
.addClass(default_dialog_service_cssPrefix + "-body")
|
|
6269
6477
|
.toDOM();
|
|
6270
6478
|
if (typeof options.body === 'string') {
|
|
6271
|
-
|
|
6479
|
+
var html = liquid.renderLiquidTemplate(options.body, data);
|
|
6480
|
+
b.addHtml(html);
|
|
6272
6481
|
}
|
|
6273
6482
|
else {
|
|
6274
6483
|
b.addChildElement(options.body);
|
|
@@ -6328,6 +6537,9 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6328
6537
|
.toDOM(); })
|
|
6329
6538
|
.toDOM();
|
|
6330
6539
|
}
|
|
6540
|
+
DefaultDialog.prototype.getData = function () {
|
|
6541
|
+
return this.data;
|
|
6542
|
+
};
|
|
6331
6543
|
DefaultDialog.prototype.getRootElement = function () {
|
|
6332
6544
|
return this.slot;
|
|
6333
6545
|
};
|
|
@@ -6452,7 +6664,7 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6452
6664
|
|
|
6453
6665
|
var default_dialog_service_DefaultProgressDialog = /** @class */ (function (_super) {
|
|
6454
6666
|
default_dialog_service_extends(DefaultProgressDialog, _super);
|
|
6455
|
-
function DefaultProgressDialog(options) {
|
|
6667
|
+
function DefaultProgressDialog(options, data) {
|
|
6456
6668
|
var _this = this;
|
|
6457
6669
|
var contentElement;
|
|
6458
6670
|
var progressElement;
|
|
@@ -6487,7 +6699,7 @@ var default_dialog_service_DefaultProgressDialog = /** @class */ (function (_sup
|
|
|
6487
6699
|
cancelable: false,
|
|
6488
6700
|
closable: false,
|
|
6489
6701
|
onDestroy: options.onDestroy
|
|
6490
|
-
}) || this;
|
|
6702
|
+
}, data) || this;
|
|
6491
6703
|
_this.contentElement = contentElement;
|
|
6492
6704
|
_this.progressElement = progressElement;
|
|
6493
6705
|
return _this;
|
|
@@ -6528,13 +6740,13 @@ var DefaultDialogSet = /** @class */ (function () {
|
|
|
6528
6740
|
DefaultDialogSet.prototype.getCurrent = function () {
|
|
6529
6741
|
return this.currentDialog;
|
|
6530
6742
|
};
|
|
6531
|
-
DefaultDialogSet.prototype.openNext = function () {
|
|
6532
|
-
return this.open(this.currentIndex + 1);
|
|
6743
|
+
DefaultDialogSet.prototype.openNext = function (data) {
|
|
6744
|
+
return this.open(this.currentIndex + 1, data);
|
|
6533
6745
|
};
|
|
6534
|
-
DefaultDialogSet.prototype.openPrev = function () {
|
|
6535
|
-
return this.open(this.currentIndex - 1);
|
|
6746
|
+
DefaultDialogSet.prototype.openPrev = function (data) {
|
|
6747
|
+
return this.open(this.currentIndex - 1, data);
|
|
6536
6748
|
};
|
|
6537
|
-
DefaultDialogSet.prototype.open = function (page) {
|
|
6749
|
+
DefaultDialogSet.prototype.open = function (page, data) {
|
|
6538
6750
|
if (page < 0) {
|
|
6539
6751
|
this.currentIndex = 0;
|
|
6540
6752
|
}
|
|
@@ -6550,7 +6762,8 @@ var DefaultDialogSet = /** @class */ (function () {
|
|
|
6550
6762
|
}
|
|
6551
6763
|
catch (e) { }
|
|
6552
6764
|
}
|
|
6553
|
-
|
|
6765
|
+
var dlgOptions = this.options[this.currentIndex];
|
|
6766
|
+
this.currentDialog = this.dialogService.open(dlgOptions, data);
|
|
6554
6767
|
return this.currentDialog;
|
|
6555
6768
|
};
|
|
6556
6769
|
DefaultDialogSet.prototype.close = function () {
|
|
@@ -6583,6 +6796,7 @@ addEasyDataUITexts();
|
|
|
6583
6796
|
|
|
6584
6797
|
|
|
6585
6798
|
|
|
6799
|
+
|
|
6586
6800
|
//datetimepicker
|
|
6587
6801
|
|
|
6588
6802
|
|
|
@@ -7088,12 +7302,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7088
7302
|
var lookupTable = new easy_data_table_EasyDataTable({
|
|
7089
7303
|
loader: {
|
|
7090
7304
|
loadChunk: function (chunkParams) { return _this.context.getDataLoader()
|
|
7091
|
-
.loadChunk(entity_form_builder_assign({}, chunkParams, { id: lookupEntity.id })); }
|
|
7305
|
+
.loadChunk(entity_form_builder_assign(entity_form_builder_assign({}, chunkParams), { id: lookupEntity.id })); }
|
|
7092
7306
|
}
|
|
7093
7307
|
});
|
|
7094
7308
|
_this.context.getDataLoader()
|
|
7095
|
-
.loadChunk({ offset: 0, limit: 1000, needTotal: true,
|
|
7309
|
+
.loadChunk({ offset: 0, limit: 1000, needTotal: true, sourceId: lookupEntity.id })
|
|
7096
7310
|
.then(function (data) {
|
|
7311
|
+
var _a;
|
|
7097
7312
|
var _loop_1 = function (col) {
|
|
7098
7313
|
var attrs = lookupEntity.attributes.filter(function (attr) {
|
|
7099
7314
|
return attr.id == col.id && (attr.isPrimaryKey || attr.showInLookup);
|
|
@@ -7102,13 +7317,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7102
7317
|
lookupTable.columns.add(col);
|
|
7103
7318
|
}
|
|
7104
7319
|
};
|
|
7105
|
-
for (var _i = 0,
|
|
7106
|
-
var col =
|
|
7320
|
+
for (var _i = 0, _b = data.table.columns.getItems(); _i < _b.length; _i++) {
|
|
7321
|
+
var col = _b[_i];
|
|
7107
7322
|
_loop_1(col);
|
|
7108
7323
|
}
|
|
7109
7324
|
lookupTable.setTotal(data.total);
|
|
7110
|
-
for (var
|
|
7111
|
-
var row = _c
|
|
7325
|
+
for (var _c = 0, _d = data.table.getCachedRows(); _c < _d.length; _c++) {
|
|
7326
|
+
var row = _d[_c];
|
|
7112
7327
|
lookupTable.addRow(row);
|
|
7113
7328
|
}
|
|
7114
7329
|
var ds = new DefaultDialogService();
|
|
@@ -7147,7 +7362,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7147
7362
|
.join(', ');
|
|
7148
7363
|
};
|
|
7149
7364
|
if (selectedValue) {
|
|
7150
|
-
|
|
7365
|
+
var attr_1 = lookupEntity.getFirstPrimaryAttr();
|
|
7366
|
+
var key = attr_1.id.substring(attr_1.id.lastIndexOf('.') + 1);
|
|
7367
|
+
_this.context.fetchRecord((_a = {}, _a[key] = selectedValue, _a), lookupEntity.id)
|
|
7151
7368
|
.then(function (data) {
|
|
7152
7369
|
if (data.entity) {
|
|
7153
7370
|
updateSelectedValue(data.entity);
|
|
@@ -7195,7 +7412,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7195
7412
|
}); });
|
|
7196
7413
|
});
|
|
7197
7414
|
};
|
|
7198
|
-
EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, readOnly,
|
|
7415
|
+
EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, value, readOnly, hidden) {
|
|
7199
7416
|
var _this = this;
|
|
7200
7417
|
var horizClass = isIE
|
|
7201
7418
|
? 'kfrm-fields-ie is-horizontal'
|
|
@@ -7216,6 +7433,8 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7216
7433
|
.addClass(horizClass)
|
|
7217
7434
|
.addChild('input', function (b) {
|
|
7218
7435
|
inputEl = b.toDOM();
|
|
7436
|
+
b.name(attr.id);
|
|
7437
|
+
b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
|
|
7219
7438
|
if (readOnly) {
|
|
7220
7439
|
b.attr('readonly', '');
|
|
7221
7440
|
}
|
|
@@ -7239,8 +7458,6 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7239
7458
|
}
|
|
7240
7459
|
});
|
|
7241
7460
|
}
|
|
7242
|
-
b.name(attr.id);
|
|
7243
|
-
b.type(_this.resolveInputType(attr.dataType));
|
|
7244
7461
|
b.value((utils_utils.IsDefinedAndNotNull(value)
|
|
7245
7462
|
? utils_utils.dateTimeToStr(value, editFormat)
|
|
7246
7463
|
: ''));
|
|
@@ -7282,7 +7499,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7282
7499
|
}).toDOM(); });
|
|
7283
7500
|
});
|
|
7284
7501
|
};
|
|
7285
|
-
EntityEditFormBuilder.prototype.setupListField = function (parent, attr,
|
|
7502
|
+
EntityEditFormBuilder.prototype.setupListField = function (parent, attr, value, values, readOnly) {
|
|
7286
7503
|
var _this = this;
|
|
7287
7504
|
domel(parent)
|
|
7288
7505
|
.addChild('div', function (b) { return b
|
|
@@ -7315,12 +7532,14 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7315
7532
|
b.attr('accept', accept);
|
|
7316
7533
|
});
|
|
7317
7534
|
};
|
|
7318
|
-
EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, readOnly,
|
|
7535
|
+
EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, value, readOnly, hidden) {
|
|
7319
7536
|
var _this = this;
|
|
7320
7537
|
domel(parent)
|
|
7321
7538
|
.addChild('input', function (b) {
|
|
7322
|
-
if (readOnly)
|
|
7539
|
+
if (readOnly) {
|
|
7323
7540
|
b.attr('readonly', '');
|
|
7541
|
+
}
|
|
7542
|
+
b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
|
|
7324
7543
|
b.name(attr.id)
|
|
7325
7544
|
.type(_this.resolveInputType(attr.dataType));
|
|
7326
7545
|
if (attr.dataType == DataType.Bool) {
|
|
@@ -7335,7 +7554,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7335
7554
|
}
|
|
7336
7555
|
});
|
|
7337
7556
|
};
|
|
7338
|
-
EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr,
|
|
7557
|
+
EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr, value, readOnly) {
|
|
7339
7558
|
// feature: modify size in value editor ??
|
|
7340
7559
|
domel(parent)
|
|
7341
7560
|
.addChild('textarea', function (b) {
|
|
@@ -7343,6 +7562,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7343
7562
|
b.attr('readonly', '');
|
|
7344
7563
|
b.attr('name', attr.id);
|
|
7345
7564
|
b.setStyle('height', "120px");
|
|
7565
|
+
b.value(utils_utils.IsDefinedAndNotNull(value)
|
|
7566
|
+
? value.toString()
|
|
7567
|
+
: '');
|
|
7346
7568
|
});
|
|
7347
7569
|
};
|
|
7348
7570
|
EntityEditFormBuilder.prototype.addFormField = function (parent, attr) {
|
|
@@ -7358,19 +7580,28 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7358
7580
|
.toDOM();
|
|
7359
7581
|
}
|
|
7360
7582
|
domel(parent)
|
|
7361
|
-
.addChild('label', function (b) {
|
|
7362
|
-
.attr('for', attr.id)
|
|
7363
|
-
.addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": ");
|
|
7583
|
+
.addChild('label', function (b) {
|
|
7584
|
+
b.attr('for', attr.id);
|
|
7585
|
+
b.addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": ");
|
|
7586
|
+
if (attr.description) {
|
|
7587
|
+
b.addChild('div', function (b) { return b
|
|
7588
|
+
.attr('title', attr.description)
|
|
7589
|
+
.addClass('question-mark')
|
|
7590
|
+
.setStyle('vertical-align', 'middle')
|
|
7591
|
+
.setStyle('display', 'inline-block'); });
|
|
7592
|
+
}
|
|
7593
|
+
});
|
|
7594
|
+
var hidden = attr.isPrimaryKey;
|
|
7364
7595
|
if (attr.kind === EntityAttrKind.Lookup) {
|
|
7365
7596
|
this.setupLookupField(parent, attr, readOnly, value);
|
|
7366
7597
|
return;
|
|
7367
7598
|
}
|
|
7368
7599
|
switch (editor.tag) {
|
|
7369
7600
|
case EditorTag.DateTime:
|
|
7370
|
-
this.setupDateTimeField(parent, attr, readOnly,
|
|
7601
|
+
this.setupDateTimeField(parent, attr, value, readOnly, hidden);
|
|
7371
7602
|
break;
|
|
7372
7603
|
case EditorTag.List:
|
|
7373
|
-
this.setupListField(parent, attr,
|
|
7604
|
+
this.setupListField(parent, attr, value, editor.values, readOnly);
|
|
7374
7605
|
break;
|
|
7375
7606
|
case EditorTag.File:
|
|
7376
7607
|
this.setupFileField(parent, attr, readOnly, editor.accept);
|
|
@@ -7378,10 +7609,10 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7378
7609
|
case EditorTag.Edit:
|
|
7379
7610
|
default:
|
|
7380
7611
|
if (editor.multiline) {
|
|
7381
|
-
this.setupTextArea(parent, attr,
|
|
7612
|
+
this.setupTextArea(parent, attr, value, readOnly);
|
|
7382
7613
|
}
|
|
7383
7614
|
else {
|
|
7384
|
-
this.setupTextField(parent, attr, readOnly,
|
|
7615
|
+
this.setupTextField(parent, attr, value, readOnly, hidden);
|
|
7385
7616
|
}
|
|
7386
7617
|
break;
|
|
7387
7618
|
}
|
|
@@ -7433,13 +7664,15 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7433
7664
|
this.form['setHtmlInt'](formHtml);
|
|
7434
7665
|
for (var _i = 0, _a = this.context.getActiveEntity().attributes; _i < _a.length; _i++) {
|
|
7435
7666
|
var attr = _a[_i];
|
|
7436
|
-
if (
|
|
7437
|
-
if (
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7667
|
+
if (!attr.isPrimaryKey) {
|
|
7668
|
+
if (this.params.isEditForm) {
|
|
7669
|
+
if (!attr.showOnEdit)
|
|
7670
|
+
continue;
|
|
7671
|
+
}
|
|
7672
|
+
else {
|
|
7673
|
+
if (!attr.showOnCreate)
|
|
7674
|
+
continue;
|
|
7675
|
+
}
|
|
7443
7676
|
}
|
|
7444
7677
|
this.addFormField(fb.toDOM(), attr);
|
|
7445
7678
|
}
|
|
@@ -7474,8 +7707,8 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
|
|
|
7474
7707
|
}
|
|
7475
7708
|
EasyDataServerLoader.prototype.loadChunk = function (params) {
|
|
7476
7709
|
var _this = this;
|
|
7477
|
-
var url = this.context.resolveEndpoint('
|
|
7478
|
-
delete params.
|
|
7710
|
+
var url = this.context.resolveEndpoint('FetchDataset', { sourceId: params.sourceId || this.context.getActiveEntity().id });
|
|
7711
|
+
delete params.sourceId;
|
|
7479
7712
|
this.context.startProcess();
|
|
7480
7713
|
var http = this.context.getHttpClient();
|
|
7481
7714
|
return http.post(url, params)
|
|
@@ -7512,6 +7745,17 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
|
|
|
7512
7745
|
|
|
7513
7746
|
|
|
7514
7747
|
// CONCATENATED MODULE: ./src/main/data_context.ts
|
|
7748
|
+
var data_context_assign = (undefined && undefined.__assign) || function () {
|
|
7749
|
+
data_context_assign = Object.assign || function(t) {
|
|
7750
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7751
|
+
s = arguments[i];
|
|
7752
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7753
|
+
t[p] = s[p];
|
|
7754
|
+
}
|
|
7755
|
+
return t;
|
|
7756
|
+
};
|
|
7757
|
+
return data_context_assign.apply(this, arguments);
|
|
7758
|
+
};
|
|
7515
7759
|
|
|
7516
7760
|
|
|
7517
7761
|
|
|
@@ -7524,9 +7768,8 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7524
7768
|
this.model = new meta_data_MetaData();
|
|
7525
7769
|
this.model.id = options.metaDataId || '__default';
|
|
7526
7770
|
this.dataLoader = new easy_data_server_loader_EasyDataServerLoader(this);
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
});
|
|
7771
|
+
var dataTableOptions = data_context_assign({ loader: this.dataLoader }, options.dataTable);
|
|
7772
|
+
this.data = new easy_data_table_EasyDataTable(dataTableOptions);
|
|
7530
7773
|
this.setDefaultEndpoints(this.options.endpoint || '/api/easydata');
|
|
7531
7774
|
}
|
|
7532
7775
|
DataContext.prototype.getActiveEntity = function () {
|
|
@@ -7545,8 +7788,8 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7545
7788
|
DataContext.prototype.getDataLoader = function () {
|
|
7546
7789
|
return this.dataLoader;
|
|
7547
7790
|
};
|
|
7548
|
-
DataContext.prototype.createFilter = function (
|
|
7549
|
-
return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(),
|
|
7791
|
+
DataContext.prototype.createFilter = function (sourceId, data, isLookup) {
|
|
7792
|
+
return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(), sourceId || this.activeEntity.id, isLookup);
|
|
7550
7793
|
};
|
|
7551
7794
|
DataContext.prototype.loadMetaData = function () {
|
|
7552
7795
|
var _this = this;
|
|
@@ -7570,7 +7813,7 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7570
7813
|
DataContext.prototype.getHttpClient = function () {
|
|
7571
7814
|
return this.http;
|
|
7572
7815
|
};
|
|
7573
|
-
DataContext.prototype.
|
|
7816
|
+
DataContext.prototype.fetchDataset = function () {
|
|
7574
7817
|
var _this = this;
|
|
7575
7818
|
this.data.clear();
|
|
7576
7819
|
return this.dataLoader.loadChunk({ offset: 0, limit: this.data.chunkSize, needTotal: true })
|
|
@@ -7587,33 +7830,33 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7587
7830
|
return _this.data;
|
|
7588
7831
|
});
|
|
7589
7832
|
};
|
|
7590
|
-
DataContext.prototype.
|
|
7833
|
+
DataContext.prototype.fetchRecord = function (keys, sourceId) {
|
|
7591
7834
|
var _this = this;
|
|
7592
|
-
var url = this.resolveEndpoint('
|
|
7593
|
-
entityId: entityId || this.activeEntity.id });
|
|
7835
|
+
var url = this.resolveEndpoint('FetchRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7594
7836
|
this.startProcess();
|
|
7595
|
-
return this.http.get(url)
|
|
7837
|
+
return this.http.get(url, { queryParams: keys })
|
|
7596
7838
|
.finally(function () { return _this.endProcess(); });
|
|
7597
7839
|
};
|
|
7598
|
-
DataContext.prototype.
|
|
7840
|
+
DataContext.prototype.createRecord = function (obj, sourceId) {
|
|
7599
7841
|
var _this = this;
|
|
7600
|
-
var url = this.resolveEndpoint('
|
|
7842
|
+
var url = this.resolveEndpoint('CreateRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7601
7843
|
this.startProcess();
|
|
7602
|
-
return this.http.post(url, obj, { dataType: 'json' })
|
|
7844
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7845
|
+
.finally(function () { return _this.endProcess(); });
|
|
7603
7846
|
};
|
|
7604
|
-
DataContext.prototype.
|
|
7847
|
+
DataContext.prototype.updateRecord = function (obj, sourceId) {
|
|
7605
7848
|
var _this = this;
|
|
7606
|
-
var url = this.resolveEndpoint('
|
|
7607
|
-
entityId: entityId || this.activeEntity.id });
|
|
7849
|
+
var url = this.resolveEndpoint('UpdateRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7608
7850
|
this.startProcess();
|
|
7609
|
-
return this.http.post(url, obj, { dataType: 'json' })
|
|
7851
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7852
|
+
.finally(function () { return _this.endProcess(); });
|
|
7610
7853
|
};
|
|
7611
|
-
DataContext.prototype.
|
|
7854
|
+
DataContext.prototype.deleteRecord = function (obj, sourceId) {
|
|
7612
7855
|
var _this = this;
|
|
7613
|
-
var url = this.resolveEndpoint('
|
|
7614
|
-
entityId: entityId || this.activeEntity.id });
|
|
7856
|
+
var url = this.resolveEndpoint('DeleteRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7615
7857
|
this.startProcess();
|
|
7616
|
-
return this.http.post(url,
|
|
7858
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7859
|
+
.finally(function () { return _this.endProcess(); });
|
|
7617
7860
|
};
|
|
7618
7861
|
DataContext.prototype.setEndpoint = function (key, value) {
|
|
7619
7862
|
this.endpoints.set(key, value);
|
|
@@ -7638,7 +7881,7 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7638
7881
|
if (opt == 'modelId') {
|
|
7639
7882
|
optVal = this.model.getId();
|
|
7640
7883
|
}
|
|
7641
|
-
else if (opt == '
|
|
7884
|
+
else if (opt == 'sourceId') {
|
|
7642
7885
|
optVal = this.activeEntity.id;
|
|
7643
7886
|
}
|
|
7644
7887
|
else {
|
|
@@ -7660,11 +7903,11 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7660
7903
|
};
|
|
7661
7904
|
DataContext.prototype.setDefaultEndpoints = function (endpointBase) {
|
|
7662
7905
|
this.setEnpointIfNotExist('GetMetaData', combinePath(endpointBase, 'models/{modelId}'));
|
|
7663
|
-
this.setEnpointIfNotExist('
|
|
7664
|
-
this.setEnpointIfNotExist('
|
|
7665
|
-
this.setEnpointIfNotExist('
|
|
7666
|
-
this.setEnpointIfNotExist('
|
|
7667
|
-
this.setEnpointIfNotExist('
|
|
7906
|
+
this.setEnpointIfNotExist('FetchDataset', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
|
|
7907
|
+
this.setEnpointIfNotExist('FetchRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
|
|
7908
|
+
this.setEnpointIfNotExist('CreateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/create'));
|
|
7909
|
+
this.setEnpointIfNotExist('UpdateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/update'));
|
|
7910
|
+
this.setEnpointIfNotExist('DeleteRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/delete'));
|
|
7668
7911
|
};
|
|
7669
7912
|
return DataContext;
|
|
7670
7913
|
}());
|
|
@@ -7797,7 +8040,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7797
8040
|
};
|
|
7798
8041
|
EntityDataView.prototype.renderGrid = function () {
|
|
7799
8042
|
var _this = this;
|
|
7800
|
-
this.context.
|
|
8043
|
+
this.context.fetchDataset()
|
|
7801
8044
|
.then(function (result) {
|
|
7802
8045
|
var gridSlot = document.createElement('div');
|
|
7803
8046
|
_this.slot.appendChild(gridSlot);
|
|
@@ -7810,10 +8053,10 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7810
8053
|
allowPageSizeChange: true,
|
|
7811
8054
|
pageSizeItems: [15, 30, 50, 100, 200]
|
|
7812
8055
|
},
|
|
7813
|
-
|
|
7814
|
-
|
|
8056
|
+
showPlusButton: _this.context.getActiveEntity().isEditable,
|
|
8057
|
+
plusButtonTitle: i18n_i18n.getText('AddRecordBtnTitle'),
|
|
7815
8058
|
showActiveRow: false,
|
|
7816
|
-
|
|
8059
|
+
onPlusButtonClick: _this.addClickHandler.bind(_this),
|
|
7817
8060
|
onGetCellRenderer: _this.manageCellRenderer.bind(_this),
|
|
7818
8061
|
onRowDbClick: _this.rowDbClickHandler.bind(_this),
|
|
7819
8062
|
onSyncGridColumn: _this.syncGridColumnHandler.bind(_this)
|
|
@@ -7868,7 +8111,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7868
8111
|
if (!form.validate())
|
|
7869
8112
|
return false;
|
|
7870
8113
|
form.getData()
|
|
7871
|
-
.then(function (obj) { return _this.context.
|
|
8114
|
+
.then(function (obj) { return _this.context.createRecord(obj); })
|
|
7872
8115
|
.then(function () {
|
|
7873
8116
|
return _this.refreshData();
|
|
7874
8117
|
})
|
|
@@ -7899,12 +8142,10 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7899
8142
|
.replace('{entity}', activeEntity.caption),
|
|
7900
8143
|
body: form.getHtml(),
|
|
7901
8144
|
onSubmit: function () {
|
|
7902
|
-
var keyAttrs = activeEntity.attributes.filter(function (attr) { return attr.isPrimaryKey; });
|
|
7903
|
-
var keys = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
7904
8145
|
if (!form.validate())
|
|
7905
8146
|
return false;
|
|
7906
8147
|
form.getData()
|
|
7907
|
-
.then(function (obj) { return _this.context.
|
|
8148
|
+
.then(function (obj) { return _this.context.updateRecord(obj); })
|
|
7908
8149
|
.then(function () {
|
|
7909
8150
|
return _this.refreshData();
|
|
7910
8151
|
})
|
|
@@ -7925,16 +8166,20 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7925
8166
|
.then(function (row) {
|
|
7926
8167
|
if (row) {
|
|
7927
8168
|
var activeEntity = _this.context.getActiveEntity();
|
|
7928
|
-
var keyAttrs = activeEntity.
|
|
7929
|
-
var
|
|
7930
|
-
var
|
|
8169
|
+
var keyAttrs = activeEntity.getPrimaryAttrs();
|
|
8170
|
+
var keyVals_1 = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
8171
|
+
var keys_1 = keyAttrs.reduce(function (val, attr, index) {
|
|
8172
|
+
var property = attr.id.substring(attr.id.lastIndexOf('.') + 1);
|
|
8173
|
+
val[property] = keyVals_1[index];
|
|
8174
|
+
return val;
|
|
8175
|
+
}, {});
|
|
7931
8176
|
_this.dlg.openConfirm(i18n_i18n.getText('DeleteDlgCaption')
|
|
7932
8177
|
.replace('{entity}', activeEntity.caption), i18n_i18n.getText('DeleteDlgMessage')
|
|
7933
|
-
.replace('{
|
|
8178
|
+
.replace('{recordId}', Object.keys(keys_1)
|
|
8179
|
+
.map(function (key) { return key + ":" + keys_1[key]; }).join(';')))
|
|
7934
8180
|
.then(function (result) {
|
|
7935
8181
|
if (result) {
|
|
7936
|
-
|
|
7937
|
-
_this.context.deleteEntity(keys_1.join(':'))
|
|
8182
|
+
_this.context.deleteRecord(keys_1)
|
|
7938
8183
|
.then(function () {
|
|
7939
8184
|
return _this.refreshData();
|
|
7940
8185
|
})
|
|
@@ -7956,7 +8201,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7956
8201
|
};
|
|
7957
8202
|
EntityDataView.prototype.refreshData = function () {
|
|
7958
8203
|
var _this = this;
|
|
7959
|
-
return this.context.
|
|
8204
|
+
return this.context.fetchDataset()
|
|
7960
8205
|
.then(function () {
|
|
7961
8206
|
_this.grid.refresh();
|
|
7962
8207
|
});
|
|
@@ -8042,6 +8287,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
|
|
|
8042
8287
|
parent.insertBefore(progressBarSlot, parent.firstElementChild);
|
|
8043
8288
|
this.context = new data_context_DataContext({
|
|
8044
8289
|
endpoint: options.endpoint,
|
|
8290
|
+
dataTable: options.dataTable,
|
|
8045
8291
|
onProcessStart: function () { return bar.show(); },
|
|
8046
8292
|
onProcessEnd: function () { return bar.hide(); }
|
|
8047
8293
|
});
|
|
@@ -8136,13 +8382,14 @@ function addEasyDataCRUDTexts() {
|
|
|
8136
8382
|
CalendarBtnTitle: 'Open calendar',
|
|
8137
8383
|
TimerBtnTitle: 'Open timer',
|
|
8138
8384
|
AddBtnTitle: 'Add',
|
|
8385
|
+
AddRecordBtnTitle: 'Add record',
|
|
8139
8386
|
EditBtn: 'Edit',
|
|
8140
8387
|
DeleteBtn: 'Delete',
|
|
8141
8388
|
SelectLink: '[ select ]',
|
|
8142
8389
|
AddDlgCaption: 'Create {entity}',
|
|
8143
8390
|
EditDlgCaption: 'Edit {entity}',
|
|
8144
8391
|
DeleteDlgCaption: 'Delete {entity}',
|
|
8145
|
-
DeleteDlgMessage: 'Are you
|
|
8392
|
+
DeleteDlgMessage: 'Are you sure you want to remove this record: {{recordId}}?',
|
|
8146
8393
|
EntityMenuDesc: 'Click on an entity to view/edit its content',
|
|
8147
8394
|
BackToEntities: 'Back to entities',
|
|
8148
8395
|
SearchBtn: 'Search',
|