@easydata/crud 1.3.6-rc02 → 1.4.0-rc01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/easydata.css +55 -49
- package/dist/browser/easydata.css.map +1 -1
- package/dist/browser/easydata.js +811 -565
- 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 +522 -288
- 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 +1 -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 +15 -13
- 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,6 +4510,35 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4467
4510
|
pageSize: 30,
|
|
4468
4511
|
pageSizeItems: [20, 30, 50, 100, 200]
|
|
4469
4512
|
},
|
|
4513
|
+
columnWidths: {
|
|
4514
|
+
autoResize: AutoResizeColumns.Once,
|
|
4515
|
+
stringColumns: {
|
|
4516
|
+
min: 100,
|
|
4517
|
+
max: 500,
|
|
4518
|
+
default: 250
|
|
4519
|
+
},
|
|
4520
|
+
numberColumns: {
|
|
4521
|
+
min: 60,
|
|
4522
|
+
default: 120
|
|
4523
|
+
},
|
|
4524
|
+
boolColumns: {
|
|
4525
|
+
min: 50,
|
|
4526
|
+
default: 80
|
|
4527
|
+
},
|
|
4528
|
+
dateColumns: {
|
|
4529
|
+
min: 80,
|
|
4530
|
+
default: 200
|
|
4531
|
+
},
|
|
4532
|
+
otherColumns: {
|
|
4533
|
+
min: 100,
|
|
4534
|
+
max: 500,
|
|
4535
|
+
default: 250
|
|
4536
|
+
},
|
|
4537
|
+
rowNumColumn: {
|
|
4538
|
+
min: 40,
|
|
4539
|
+
default: 60
|
|
4540
|
+
}
|
|
4541
|
+
},
|
|
4470
4542
|
addColumns: false,
|
|
4471
4543
|
viewportRowsCount: null,
|
|
4472
4544
|
showActiveRow: true
|
|
@@ -4474,7 +4546,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
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) {
|
|
@@ -4644,10 +4752,20 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4644
4752
|
}
|
|
4645
4753
|
else {
|
|
4646
4754
|
setTimeout(function () {
|
|
4647
|
-
_this.updateHeight()
|
|
4648
|
-
|
|
4755
|
+
_this.updateHeight()
|
|
4756
|
+
.then(function () {
|
|
4757
|
+
_this.firstRender = false;
|
|
4758
|
+
});
|
|
4649
4759
|
}, 100);
|
|
4650
4760
|
}
|
|
4761
|
+
var needAutoResize = this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
|
|
4762
|
+
if (needAutoResize) {
|
|
4763
|
+
this.bodyCellContainerDiv.style.visibility = 'hidden';
|
|
4764
|
+
setTimeout(function () {
|
|
4765
|
+
_this.resizeColumns();
|
|
4766
|
+
_this.bodyCellContainerDiv.style.visibility = null;
|
|
4767
|
+
}, 20);
|
|
4768
|
+
}
|
|
4651
4769
|
};
|
|
4652
4770
|
EasyGrid.prototype.updateHeight = function () {
|
|
4653
4771
|
var _this = this;
|
|
@@ -4682,6 +4800,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4682
4800
|
}
|
|
4683
4801
|
});
|
|
4684
4802
|
};
|
|
4803
|
+
EasyGrid.prototype.getContainerWidth = function () {
|
|
4804
|
+
return this.columns.getItems()
|
|
4805
|
+
.filter(function (col) { return col.isVisible; })
|
|
4806
|
+
.map(function (col) { return col.width; })
|
|
4807
|
+
.reduce(function (sum, current) { return sum + current; });
|
|
4808
|
+
};
|
|
4685
4809
|
EasyGrid.prototype.renderHeader = function () {
|
|
4686
4810
|
var _this = this;
|
|
4687
4811
|
this.headerDiv = domel('div')
|
|
@@ -4707,7 +4831,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4707
4831
|
.addChildElement(_this.renderAddColumnButton());
|
|
4708
4832
|
}
|
|
4709
4833
|
});
|
|
4710
|
-
var containerWidth = this.
|
|
4834
|
+
var containerWidth = this.getContainerWidth();
|
|
4711
4835
|
domel(this.headerCellContainerDiv)
|
|
4712
4836
|
.setStyle('width', containerWidth + "px");
|
|
4713
4837
|
};
|
|
@@ -4718,7 +4842,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4718
4842
|
var _this = this;
|
|
4719
4843
|
var colBuilder = domel('div')
|
|
4720
4844
|
.addClass(this.cssPrefix + "-header-cell")
|
|
4721
|
-
.data('col-idx', "" +
|
|
4845
|
+
.data('col-idx', "" + index)
|
|
4722
4846
|
.setStyle('width', column.width + "px");
|
|
4723
4847
|
if (column.dataColumn) {
|
|
4724
4848
|
colBuilder
|
|
@@ -4732,6 +4856,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4732
4856
|
.addClass(this.cssPrefix + "-header-cell-label")
|
|
4733
4857
|
.text(column.label);
|
|
4734
4858
|
}
|
|
4859
|
+
if (column.description) {
|
|
4860
|
+
domel('div', colDiv)
|
|
4861
|
+
.addClass('question-mark')
|
|
4862
|
+
.title(column.description);
|
|
4863
|
+
}
|
|
4735
4864
|
if (this.options.allowDragDrop) {
|
|
4736
4865
|
eqDragManager.registerDraggableItem({
|
|
4737
4866
|
element: colDiv,
|
|
@@ -4751,14 +4880,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4751
4880
|
}
|
|
4752
4881
|
return colDiv;
|
|
4753
4882
|
};
|
|
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
4883
|
EasyGrid.prototype.renderBody = function () {
|
|
4763
4884
|
var _this = this;
|
|
4764
4885
|
this.bodyDiv = domel('div')
|
|
@@ -4772,10 +4893,6 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4772
4893
|
.addClass(this.cssPrefix + "-cell-container")
|
|
4773
4894
|
.toDOM();
|
|
4774
4895
|
var showAggrs = this.canShowAggregates();
|
|
4775
|
-
this.compareValues = this.caseInsensitiveCompare;
|
|
4776
|
-
if (showAggrs && this.options.aggregates.settings.caseSensitiveGroups) {
|
|
4777
|
-
this.compareValues = this.strictCompare;
|
|
4778
|
-
}
|
|
4779
4896
|
if (this.dataTable) {
|
|
4780
4897
|
this.showProgress();
|
|
4781
4898
|
this.rowsOnPagePromise = this.getRowsToRender()
|
|
@@ -4785,15 +4902,22 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4785
4902
|
//prevent double rendering (bad solution, we have to figure out how to avoid this behavior properly)
|
|
4786
4903
|
_this.bodyCellContainerDiv.innerHTML = '';
|
|
4787
4904
|
_this.prevRowTotals = null;
|
|
4905
|
+
var rowsToRender = 0;
|
|
4788
4906
|
if (rows.length) {
|
|
4789
4907
|
var groups_1 = showAggrs
|
|
4790
4908
|
? _this.options.aggregates.settings.getGroups()
|
|
4791
4909
|
: [];
|
|
4910
|
+
rowsToRender = (rows.length < _this.pagination.pageSize)
|
|
4911
|
+
? rows.length
|
|
4912
|
+
: _this.pagination.pageSize;
|
|
4792
4913
|
rows.forEach(function (row, index) {
|
|
4793
4914
|
if (showAggrs)
|
|
4794
4915
|
_this.updateTotalsState(groups_1, row);
|
|
4795
|
-
|
|
4796
|
-
|
|
4916
|
+
//we don't actually render the last row
|
|
4917
|
+
if (index < rowsToRender) {
|
|
4918
|
+
var tr = _this.renderRow(row, index);
|
|
4919
|
+
_this.bodyCellContainerDiv.appendChild(tr);
|
|
4920
|
+
}
|
|
4797
4921
|
});
|
|
4798
4922
|
var showGrandTotalsOnEachPage = _this.options.aggregates && _this.options.aggregates.showGrandTotalsOnEachPage;
|
|
4799
4923
|
if (showAggrs && (_this.isLastPage() || showGrandTotalsOnEachPage)) {
|
|
@@ -4801,11 +4925,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4801
4925
|
_this.updateTotalsState(groups_1, row, true);
|
|
4802
4926
|
}
|
|
4803
4927
|
}
|
|
4804
|
-
var containerWidth = _this.
|
|
4805
|
-
.map(function (column) { return column.width; }).reduce(function (sum, current) { return sum + current; });
|
|
4928
|
+
var containerWidth = _this.getContainerWidth();
|
|
4806
4929
|
domel(_this.bodyCellContainerDiv)
|
|
4807
4930
|
.setStyle('width', containerWidth + "px");
|
|
4808
|
-
return
|
|
4931
|
+
return rowsToRender;
|
|
4809
4932
|
})
|
|
4810
4933
|
.catch(function (error) { console.error(error); return 0; });
|
|
4811
4934
|
}
|
|
@@ -4813,7 +4936,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4813
4936
|
domel(_this.headerViewportDiv)
|
|
4814
4937
|
.setStyle('margin-left', "-" + _this.bodyViewportDiv.scrollLeft + "px");
|
|
4815
4938
|
});
|
|
4816
|
-
this.bodyViewportDiv.addEventListener('keydown', this.
|
|
4939
|
+
this.bodyViewportDiv.addEventListener('keydown', this.onViewportKeydown.bind(this));
|
|
4817
4940
|
};
|
|
4818
4941
|
EasyGrid.prototype.isLastPage = function () {
|
|
4819
4942
|
if (this.dataTable.elasticChunks) {
|
|
@@ -4839,7 +4962,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4839
4962
|
var group = groups[level - 1];
|
|
4840
4963
|
for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
|
|
4841
4964
|
var col = _a[_i];
|
|
4842
|
-
if (
|
|
4965
|
+
if (!aggrSettings.compareValues(this.prevRowTotals.getValue(col), newRow.getValue(col))) {
|
|
4843
4966
|
changeLevel = level;
|
|
4844
4967
|
break;
|
|
4845
4968
|
}
|
|
@@ -4900,8 +5023,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4900
5023
|
});
|
|
4901
5024
|
var aggrContainer = this.options.aggregates.calculator.getAggrContainer();
|
|
4902
5025
|
var aggrCols = aggrSettings.getAggregates().map(function (c) { return c.colId; });
|
|
4903
|
-
var key =
|
|
4904
|
-
aggrContainer.
|
|
5026
|
+
var key = aggrSettings.buildGroupKey(group, row);
|
|
5027
|
+
aggrContainer.getAggregateData(level, key)
|
|
4905
5028
|
.then(function (values) {
|
|
4906
5029
|
for (var _i = 0, aggrCols_1 = aggrCols; _i < aggrCols_1.length; _i++) {
|
|
4907
5030
|
var aggrColId = aggrCols_1[_i];
|
|
@@ -4942,34 +5065,20 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4942
5065
|
}
|
|
4943
5066
|
}
|
|
4944
5067
|
if (groupFooterTemplate) {
|
|
4945
|
-
var cellDiv_1 = _this.renderCell(column,
|
|
5068
|
+
var cellDiv_1 = _this.renderCell(column, index, val, rowElement);
|
|
4946
5069
|
var innerCell = cellDiv_1.firstChild;
|
|
4947
5070
|
val = innerCell.innerHTML;
|
|
4948
5071
|
val = _this.applyGroupColumnTemplate(groupFooterTemplate, val, values[aggrSettings.COUNT_FIELD_NAME]);
|
|
4949
5072
|
}
|
|
4950
5073
|
}
|
|
4951
|
-
var cellDiv = _this.renderCell(column,
|
|
5074
|
+
var cellDiv = _this.renderCell(column, index, val, rowElement);
|
|
4952
5075
|
rowElement.appendChild(cellDiv);
|
|
4953
5076
|
});
|
|
4954
5077
|
})
|
|
4955
5078
|
.catch(function (error) { return console.error(error); });
|
|
4956
5079
|
return rowElement;
|
|
4957
5080
|
};
|
|
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) {
|
|
4966
|
-
keyVal = keyVal.toLowerCase();
|
|
4967
|
-
}
|
|
4968
|
-
result[colId] = keyVal;
|
|
4969
|
-
}
|
|
4970
|
-
return result;
|
|
4971
|
-
};
|
|
4972
|
-
EasyGrid.prototype.onVieportKeydown = function (ev) {
|
|
5081
|
+
EasyGrid.prototype.onViewportKeydown = function (ev) {
|
|
4973
5082
|
if (this.options.showActiveRow) {
|
|
4974
5083
|
var rowCount = this.bodyCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-row").length;
|
|
4975
5084
|
var newValue = void 0;
|
|
@@ -5023,13 +5132,17 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5023
5132
|
}
|
|
5024
5133
|
}
|
|
5025
5134
|
};
|
|
5135
|
+
/** Returns a promise with the list of the rows to render on one page.
|
|
5136
|
+
* The list contains pageSize+1 row to make it possible
|
|
5137
|
+
* to render the totals row (if it appears to be on the edge between pages)
|
|
5138
|
+
*/
|
|
5026
5139
|
EasyGrid.prototype.getRowsToRender = function () {
|
|
5027
5140
|
if (this.options.paging.enabled === false) {
|
|
5028
5141
|
return Promise.resolve(this.dataTable.getCachedRows());
|
|
5029
5142
|
}
|
|
5030
5143
|
return this.dataTable.getRows({
|
|
5031
|
-
|
|
5032
|
-
|
|
5144
|
+
offset: (this.pagination.page - 1) * this.pagination.pageSize,
|
|
5145
|
+
limit: this.pagination.pageSize + 1
|
|
5033
5146
|
})
|
|
5034
5147
|
.catch(function (error) {
|
|
5035
5148
|
console.error(error);
|
|
@@ -5125,13 +5238,13 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5125
5238
|
if (this.options.showActiveRow && index == this.activeRowIndex) {
|
|
5126
5239
|
rowBuilder.addClass(this.cssPrefix + "-row-active");
|
|
5127
5240
|
}
|
|
5128
|
-
this.columns.getItems().forEach(function (column) {
|
|
5241
|
+
this.columns.getItems().forEach(function (column, index) {
|
|
5129
5242
|
if (!column.isVisible) {
|
|
5130
5243
|
return;
|
|
5131
5244
|
}
|
|
5132
5245
|
var colindex = column.isRowNum ? -1 : _this.dataTable.columns.getIndex(column.dataColumn.id);
|
|
5133
5246
|
var val = column.isRowNum ? indexGlobal + 1 : row.getValue(colindex);
|
|
5134
|
-
rowElement.appendChild(_this.renderCell(column,
|
|
5247
|
+
rowElement.appendChild(_this.renderCell(column, index, val, rowElement));
|
|
5135
5248
|
});
|
|
5136
5249
|
return rowElement;
|
|
5137
5250
|
};
|
|
@@ -5403,6 +5516,85 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5403
5516
|
EasyGrid.prototype.focus = function () {
|
|
5404
5517
|
this.bodyViewportDiv.focus();
|
|
5405
5518
|
};
|
|
5519
|
+
EasyGrid.prototype.resizeColumns = function () {
|
|
5520
|
+
if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
|
|
5521
|
+
return;
|
|
5522
|
+
var containerWidth = this.bodyCellContainerDiv.style.width;
|
|
5523
|
+
this.bodyCellContainerDiv.style.visibility = 'hidden';
|
|
5524
|
+
this.bodyCellContainerDiv.style.width = '1px';
|
|
5525
|
+
var sumWidth = 0;
|
|
5526
|
+
var columns = this.columns.getItems();
|
|
5527
|
+
var headerCells = this.headerCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-header-cell");
|
|
5528
|
+
var headerIdx = 0;
|
|
5529
|
+
var _loop_1 = function (idx) {
|
|
5530
|
+
var column = columns[idx];
|
|
5531
|
+
if (!column.isVisible)
|
|
5532
|
+
return "continue";
|
|
5533
|
+
var calculatedWidth = this_1.options.columnWidths.autoResize !== AutoResizeColumns.Always && column.dataColumn
|
|
5534
|
+
? column.dataColumn.calculatedWidth
|
|
5535
|
+
: 0;
|
|
5536
|
+
var cellValues = this_1.bodyCellContainerDiv.querySelectorAll("." + this_1.cssPrefix + "-cell[data-col-idx=\"" + idx + "\"] > ." + this_1.cssPrefix + "-cell-value");
|
|
5537
|
+
var maxWidth = 0;
|
|
5538
|
+
if (calculatedWidth > 0) {
|
|
5539
|
+
sumWidth += calculatedWidth;
|
|
5540
|
+
column.width = calculatedWidth;
|
|
5541
|
+
cellValues.forEach(function (value) {
|
|
5542
|
+
value.parentElement.style.width = calculatedWidth + "px";
|
|
5543
|
+
});
|
|
5544
|
+
headerCells[headerIdx].style.width = calculatedWidth + "px";
|
|
5545
|
+
headerIdx++;
|
|
5546
|
+
}
|
|
5547
|
+
else if (cellValues.length > 0) {
|
|
5548
|
+
cellValues.forEach(function (value) {
|
|
5549
|
+
value.parentElement.style.width = null;
|
|
5550
|
+
var width = value.parentElement.offsetWidth;
|
|
5551
|
+
if (width > maxWidth) {
|
|
5552
|
+
maxWidth = width;
|
|
5553
|
+
}
|
|
5554
|
+
});
|
|
5555
|
+
maxWidth += 3;
|
|
5556
|
+
var maxOption = column.isRowNum
|
|
5557
|
+
? this_1.options.columnWidths.rowNumColumn.max || 500
|
|
5558
|
+
: this_1.options.columnWidths[column.dataColumn.type].max || 2000;
|
|
5559
|
+
var minOption = column.isRowNum
|
|
5560
|
+
? this_1.options.columnWidths.rowNumColumn.min || 0
|
|
5561
|
+
: this_1.options.columnWidths[column.dataColumn.type].min || 20;
|
|
5562
|
+
if (maxWidth > maxOption) {
|
|
5563
|
+
maxWidth = maxOption;
|
|
5564
|
+
}
|
|
5565
|
+
if (maxWidth < minOption) {
|
|
5566
|
+
maxWidth = minOption;
|
|
5567
|
+
}
|
|
5568
|
+
if (utils_utils.isNumericType(column.type)) {
|
|
5569
|
+
//increase the calculated width in 1.3 times for numeric columns
|
|
5570
|
+
maxWidth = Math.round(maxWidth * 1.3);
|
|
5571
|
+
}
|
|
5572
|
+
sumWidth += maxWidth;
|
|
5573
|
+
column.width = maxWidth;
|
|
5574
|
+
cellValues.forEach(function (value) {
|
|
5575
|
+
value.parentElement.style.width = maxWidth + "px";
|
|
5576
|
+
});
|
|
5577
|
+
headerCells[headerIdx].style.width = maxWidth + "px";
|
|
5578
|
+
headerIdx++;
|
|
5579
|
+
if (column.dataColumn) {
|
|
5580
|
+
column.dataColumn.calculatedWidth = maxWidth;
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5583
|
+
};
|
|
5584
|
+
var this_1 = this;
|
|
5585
|
+
for (var idx = 0; idx < this.columns.count; idx++) {
|
|
5586
|
+
_loop_1(idx);
|
|
5587
|
+
}
|
|
5588
|
+
if (sumWidth > 0) {
|
|
5589
|
+
this.bodyCellContainerDiv.style.width = sumWidth + "px";
|
|
5590
|
+
this.headerCellContainerDiv.style.width = sumWidth + "px";
|
|
5591
|
+
}
|
|
5592
|
+
else {
|
|
5593
|
+
this.bodyCellContainerDiv.style.width = containerWidth;
|
|
5594
|
+
this.headerCellContainerDiv.style.width = containerWidth;
|
|
5595
|
+
}
|
|
5596
|
+
this.bodyCellContainerDiv.style.visibility = null;
|
|
5597
|
+
};
|
|
5406
5598
|
return EasyGrid;
|
|
5407
5599
|
}());
|
|
5408
5600
|
|
|
@@ -6156,9 +6348,9 @@ var DefaultDialogService = /** @class */ (function () {
|
|
|
6156
6348
|
_this.open(options);
|
|
6157
6349
|
});
|
|
6158
6350
|
};
|
|
6159
|
-
DefaultDialogService.prototype.open = function (options) {
|
|
6351
|
+
DefaultDialogService.prototype.open = function (options, data) {
|
|
6160
6352
|
var _this = this;
|
|
6161
|
-
var dialog = new default_dialog_service_DefaultDialog(options);
|
|
6353
|
+
var dialog = new default_dialog_service_DefaultDialog(options, data);
|
|
6162
6354
|
var onDestroy = options.onDestroy;
|
|
6163
6355
|
options.onDestroy = function (dlg) {
|
|
6164
6356
|
_this.untrack(dlg);
|
|
@@ -6206,7 +6398,7 @@ var DefaultDialogService = /** @class */ (function () {
|
|
|
6206
6398
|
}());
|
|
6207
6399
|
|
|
6208
6400
|
var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
6209
|
-
function DefaultDialog(options) {
|
|
6401
|
+
function DefaultDialog(options, data) {
|
|
6210
6402
|
var _this = this;
|
|
6211
6403
|
this.options = options;
|
|
6212
6404
|
this.submitHandler = function (token) {
|
|
@@ -6234,6 +6426,7 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6234
6426
|
return true;
|
|
6235
6427
|
};
|
|
6236
6428
|
this.dialogId = utils_utils.generateId('dlg');
|
|
6429
|
+
this.data = data;
|
|
6237
6430
|
this.slot =
|
|
6238
6431
|
domel('div', document.body)
|
|
6239
6432
|
.attr('tab-index', '-1')
|
|
@@ -6268,7 +6461,8 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6268
6461
|
.addClass(default_dialog_service_cssPrefix + "-body")
|
|
6269
6462
|
.toDOM();
|
|
6270
6463
|
if (typeof options.body === 'string') {
|
|
6271
|
-
|
|
6464
|
+
var html = liquid.renderLiquidTemplate(options.body, data);
|
|
6465
|
+
b.addHtml(html);
|
|
6272
6466
|
}
|
|
6273
6467
|
else {
|
|
6274
6468
|
b.addChildElement(options.body);
|
|
@@ -6328,6 +6522,9 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6328
6522
|
.toDOM(); })
|
|
6329
6523
|
.toDOM();
|
|
6330
6524
|
}
|
|
6525
|
+
DefaultDialog.prototype.getData = function () {
|
|
6526
|
+
return this.data;
|
|
6527
|
+
};
|
|
6331
6528
|
DefaultDialog.prototype.getRootElement = function () {
|
|
6332
6529
|
return this.slot;
|
|
6333
6530
|
};
|
|
@@ -6366,6 +6563,9 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6366
6563
|
.forEach(function (element) {
|
|
6367
6564
|
return element.addEventListener('input', function () {
|
|
6368
6565
|
_this.clearAlert();
|
|
6566
|
+
if (_this.options.onInput) {
|
|
6567
|
+
_this.options.onInput(_this);
|
|
6568
|
+
}
|
|
6369
6569
|
});
|
|
6370
6570
|
});
|
|
6371
6571
|
if (this.options.onShow) {
|
|
@@ -6449,7 +6649,7 @@ var default_dialog_service_DefaultDialog = /** @class */ (function () {
|
|
|
6449
6649
|
|
|
6450
6650
|
var default_dialog_service_DefaultProgressDialog = /** @class */ (function (_super) {
|
|
6451
6651
|
default_dialog_service_extends(DefaultProgressDialog, _super);
|
|
6452
|
-
function DefaultProgressDialog(options) {
|
|
6652
|
+
function DefaultProgressDialog(options, data) {
|
|
6453
6653
|
var _this = this;
|
|
6454
6654
|
var contentElement;
|
|
6455
6655
|
var progressElement;
|
|
@@ -6484,7 +6684,7 @@ var default_dialog_service_DefaultProgressDialog = /** @class */ (function (_sup
|
|
|
6484
6684
|
cancelable: false,
|
|
6485
6685
|
closable: false,
|
|
6486
6686
|
onDestroy: options.onDestroy
|
|
6487
|
-
}) || this;
|
|
6687
|
+
}, data) || this;
|
|
6488
6688
|
_this.contentElement = contentElement;
|
|
6489
6689
|
_this.progressElement = progressElement;
|
|
6490
6690
|
return _this;
|
|
@@ -6525,13 +6725,13 @@ var DefaultDialogSet = /** @class */ (function () {
|
|
|
6525
6725
|
DefaultDialogSet.prototype.getCurrent = function () {
|
|
6526
6726
|
return this.currentDialog;
|
|
6527
6727
|
};
|
|
6528
|
-
DefaultDialogSet.prototype.openNext = function () {
|
|
6529
|
-
return this.open(this.currentIndex + 1);
|
|
6728
|
+
DefaultDialogSet.prototype.openNext = function (data) {
|
|
6729
|
+
return this.open(this.currentIndex + 1, data);
|
|
6530
6730
|
};
|
|
6531
|
-
DefaultDialogSet.prototype.openPrev = function () {
|
|
6532
|
-
return this.open(this.currentIndex - 1);
|
|
6731
|
+
DefaultDialogSet.prototype.openPrev = function (data) {
|
|
6732
|
+
return this.open(this.currentIndex - 1, data);
|
|
6533
6733
|
};
|
|
6534
|
-
DefaultDialogSet.prototype.open = function (page) {
|
|
6734
|
+
DefaultDialogSet.prototype.open = function (page, data) {
|
|
6535
6735
|
if (page < 0) {
|
|
6536
6736
|
this.currentIndex = 0;
|
|
6537
6737
|
}
|
|
@@ -6547,7 +6747,8 @@ var DefaultDialogSet = /** @class */ (function () {
|
|
|
6547
6747
|
}
|
|
6548
6748
|
catch (e) { }
|
|
6549
6749
|
}
|
|
6550
|
-
|
|
6750
|
+
var dlgOptions = this.options[this.currentIndex];
|
|
6751
|
+
this.currentDialog = this.dialogService.open(dlgOptions, data);
|
|
6551
6752
|
return this.currentDialog;
|
|
6552
6753
|
};
|
|
6553
6754
|
DefaultDialogSet.prototype.close = function () {
|
|
@@ -6580,6 +6781,7 @@ addEasyDataUITexts();
|
|
|
6580
6781
|
|
|
6581
6782
|
|
|
6582
6783
|
|
|
6784
|
+
|
|
6583
6785
|
//datetimepicker
|
|
6584
6786
|
|
|
6585
6787
|
|
|
@@ -7085,12 +7287,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7085
7287
|
var lookupTable = new easy_data_table_EasyDataTable({
|
|
7086
7288
|
loader: {
|
|
7087
7289
|
loadChunk: function (chunkParams) { return _this.context.getDataLoader()
|
|
7088
|
-
.loadChunk(entity_form_builder_assign({}, chunkParams, { id: lookupEntity.id })); }
|
|
7290
|
+
.loadChunk(entity_form_builder_assign(entity_form_builder_assign({}, chunkParams), { id: lookupEntity.id })); }
|
|
7089
7291
|
}
|
|
7090
7292
|
});
|
|
7091
7293
|
_this.context.getDataLoader()
|
|
7092
|
-
.loadChunk({ offset: 0, limit: 1000, needTotal: true,
|
|
7294
|
+
.loadChunk({ offset: 0, limit: 1000, needTotal: true, sourceId: lookupEntity.id })
|
|
7093
7295
|
.then(function (data) {
|
|
7296
|
+
var _a;
|
|
7094
7297
|
var _loop_1 = function (col) {
|
|
7095
7298
|
var attrs = lookupEntity.attributes.filter(function (attr) {
|
|
7096
7299
|
return attr.id == col.id && (attr.isPrimaryKey || attr.showInLookup);
|
|
@@ -7099,13 +7302,13 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7099
7302
|
lookupTable.columns.add(col);
|
|
7100
7303
|
}
|
|
7101
7304
|
};
|
|
7102
|
-
for (var _i = 0,
|
|
7103
|
-
var col =
|
|
7305
|
+
for (var _i = 0, _b = data.table.columns.getItems(); _i < _b.length; _i++) {
|
|
7306
|
+
var col = _b[_i];
|
|
7104
7307
|
_loop_1(col);
|
|
7105
7308
|
}
|
|
7106
7309
|
lookupTable.setTotal(data.total);
|
|
7107
|
-
for (var
|
|
7108
|
-
var row = _c
|
|
7310
|
+
for (var _c = 0, _d = data.table.getCachedRows(); _c < _d.length; _c++) {
|
|
7311
|
+
var row = _d[_c];
|
|
7109
7312
|
lookupTable.addRow(row);
|
|
7110
7313
|
}
|
|
7111
7314
|
var ds = new DefaultDialogService();
|
|
@@ -7144,7 +7347,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7144
7347
|
.join(', ');
|
|
7145
7348
|
};
|
|
7146
7349
|
if (selectedValue) {
|
|
7147
|
-
|
|
7350
|
+
var attr_1 = lookupEntity.getFirstPrimaryAttr();
|
|
7351
|
+
var key = attr_1.id.substring(attr_1.id.lastIndexOf('.') + 1);
|
|
7352
|
+
_this.context.fetchRecord((_a = {}, _a[key] = selectedValue, _a), lookupEntity.id)
|
|
7148
7353
|
.then(function (data) {
|
|
7149
7354
|
if (data.entity) {
|
|
7150
7355
|
updateSelectedValue(data.entity);
|
|
@@ -7192,7 +7397,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7192
7397
|
}); });
|
|
7193
7398
|
});
|
|
7194
7399
|
};
|
|
7195
|
-
EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, readOnly,
|
|
7400
|
+
EntityEditFormBuilder.prototype.setupDateTimeField = function (parent, attr, value, readOnly, hidden) {
|
|
7196
7401
|
var _this = this;
|
|
7197
7402
|
var horizClass = isIE
|
|
7198
7403
|
? 'kfrm-fields-ie is-horizontal'
|
|
@@ -7213,6 +7418,8 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7213
7418
|
.addClass(horizClass)
|
|
7214
7419
|
.addChild('input', function (b) {
|
|
7215
7420
|
inputEl = b.toDOM();
|
|
7421
|
+
b.name(attr.id);
|
|
7422
|
+
b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
|
|
7216
7423
|
if (readOnly) {
|
|
7217
7424
|
b.attr('readonly', '');
|
|
7218
7425
|
}
|
|
@@ -7236,8 +7443,6 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7236
7443
|
}
|
|
7237
7444
|
});
|
|
7238
7445
|
}
|
|
7239
|
-
b.name(attr.id);
|
|
7240
|
-
b.type(_this.resolveInputType(attr.dataType));
|
|
7241
7446
|
b.value((utils_utils.IsDefinedAndNotNull(value)
|
|
7242
7447
|
? utils_utils.dateTimeToStr(value, editFormat)
|
|
7243
7448
|
: ''));
|
|
@@ -7279,7 +7484,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7279
7484
|
}).toDOM(); });
|
|
7280
7485
|
});
|
|
7281
7486
|
};
|
|
7282
|
-
EntityEditFormBuilder.prototype.setupListField = function (parent, attr,
|
|
7487
|
+
EntityEditFormBuilder.prototype.setupListField = function (parent, attr, value, values, readOnly) {
|
|
7283
7488
|
var _this = this;
|
|
7284
7489
|
domel(parent)
|
|
7285
7490
|
.addChild('div', function (b) { return b
|
|
@@ -7312,12 +7517,14 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7312
7517
|
b.attr('accept', accept);
|
|
7313
7518
|
});
|
|
7314
7519
|
};
|
|
7315
|
-
EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, readOnly,
|
|
7520
|
+
EntityEditFormBuilder.prototype.setupTextField = function (parent, attr, value, readOnly, hidden) {
|
|
7316
7521
|
var _this = this;
|
|
7317
7522
|
domel(parent)
|
|
7318
7523
|
.addChild('input', function (b) {
|
|
7319
|
-
if (readOnly)
|
|
7524
|
+
if (readOnly) {
|
|
7320
7525
|
b.attr('readonly', '');
|
|
7526
|
+
}
|
|
7527
|
+
b.type(hidden ? 'hidden' : _this.resolveInputType(attr.dataType));
|
|
7321
7528
|
b.name(attr.id)
|
|
7322
7529
|
.type(_this.resolveInputType(attr.dataType));
|
|
7323
7530
|
if (attr.dataType == DataType.Bool) {
|
|
@@ -7332,7 +7539,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7332
7539
|
}
|
|
7333
7540
|
});
|
|
7334
7541
|
};
|
|
7335
|
-
EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr,
|
|
7542
|
+
EntityEditFormBuilder.prototype.setupTextArea = function (parent, attr, value, readOnly) {
|
|
7336
7543
|
// feature: modify size in value editor ??
|
|
7337
7544
|
domel(parent)
|
|
7338
7545
|
.addChild('textarea', function (b) {
|
|
@@ -7340,6 +7547,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7340
7547
|
b.attr('readonly', '');
|
|
7341
7548
|
b.attr('name', attr.id);
|
|
7342
7549
|
b.setStyle('height', "120px");
|
|
7550
|
+
b.value(utils_utils.IsDefinedAndNotNull(value)
|
|
7551
|
+
? value.toString()
|
|
7552
|
+
: '');
|
|
7343
7553
|
});
|
|
7344
7554
|
};
|
|
7345
7555
|
EntityEditFormBuilder.prototype.addFormField = function (parent, attr) {
|
|
@@ -7355,19 +7565,28 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7355
7565
|
.toDOM();
|
|
7356
7566
|
}
|
|
7357
7567
|
domel(parent)
|
|
7358
|
-
.addChild('label', function (b) {
|
|
7359
|
-
.attr('for', attr.id)
|
|
7360
|
-
.addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": ");
|
|
7568
|
+
.addChild('label', function (b) {
|
|
7569
|
+
b.attr('for', attr.id);
|
|
7570
|
+
b.addHtml(attr.caption + " " + (required ? '<sup style="color: red">*</sup>' : '') + ": ");
|
|
7571
|
+
if (attr.description) {
|
|
7572
|
+
b.addChild('div', function (b) { return b
|
|
7573
|
+
.attr('title', attr.description)
|
|
7574
|
+
.addClass('question-mark')
|
|
7575
|
+
.setStyle('vertical-align', 'middle')
|
|
7576
|
+
.setStyle('display', 'inline-block'); });
|
|
7577
|
+
}
|
|
7578
|
+
});
|
|
7579
|
+
var hidden = attr.isPrimaryKey;
|
|
7361
7580
|
if (attr.kind === EntityAttrKind.Lookup) {
|
|
7362
7581
|
this.setupLookupField(parent, attr, readOnly, value);
|
|
7363
7582
|
return;
|
|
7364
7583
|
}
|
|
7365
7584
|
switch (editor.tag) {
|
|
7366
7585
|
case EditorTag.DateTime:
|
|
7367
|
-
this.setupDateTimeField(parent, attr, readOnly,
|
|
7586
|
+
this.setupDateTimeField(parent, attr, value, readOnly, hidden);
|
|
7368
7587
|
break;
|
|
7369
7588
|
case EditorTag.List:
|
|
7370
|
-
this.setupListField(parent, attr,
|
|
7589
|
+
this.setupListField(parent, attr, value, editor.values, readOnly);
|
|
7371
7590
|
break;
|
|
7372
7591
|
case EditorTag.File:
|
|
7373
7592
|
this.setupFileField(parent, attr, readOnly, editor.accept);
|
|
@@ -7375,10 +7594,10 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7375
7594
|
case EditorTag.Edit:
|
|
7376
7595
|
default:
|
|
7377
7596
|
if (editor.multiline) {
|
|
7378
|
-
this.setupTextArea(parent, attr,
|
|
7597
|
+
this.setupTextArea(parent, attr, value, readOnly);
|
|
7379
7598
|
}
|
|
7380
7599
|
else {
|
|
7381
|
-
this.setupTextField(parent, attr, readOnly,
|
|
7600
|
+
this.setupTextField(parent, attr, value, readOnly, hidden);
|
|
7382
7601
|
}
|
|
7383
7602
|
break;
|
|
7384
7603
|
}
|
|
@@ -7430,13 +7649,15 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7430
7649
|
this.form['setHtmlInt'](formHtml);
|
|
7431
7650
|
for (var _i = 0, _a = this.context.getActiveEntity().attributes; _i < _a.length; _i++) {
|
|
7432
7651
|
var attr = _a[_i];
|
|
7433
|
-
if (
|
|
7434
|
-
if (
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7652
|
+
if (!attr.isPrimaryKey) {
|
|
7653
|
+
if (this.params.isEditForm) {
|
|
7654
|
+
if (!attr.showOnEdit)
|
|
7655
|
+
continue;
|
|
7656
|
+
}
|
|
7657
|
+
else {
|
|
7658
|
+
if (!attr.showOnCreate)
|
|
7659
|
+
continue;
|
|
7660
|
+
}
|
|
7440
7661
|
}
|
|
7441
7662
|
this.addFormField(fb.toDOM(), attr);
|
|
7442
7663
|
}
|
|
@@ -7471,8 +7692,8 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
|
|
|
7471
7692
|
}
|
|
7472
7693
|
EasyDataServerLoader.prototype.loadChunk = function (params) {
|
|
7473
7694
|
var _this = this;
|
|
7474
|
-
var url = this.context.resolveEndpoint('
|
|
7475
|
-
delete params.
|
|
7695
|
+
var url = this.context.resolveEndpoint('FetchDataset', { sourceId: params.sourceId || this.context.getActiveEntity().id });
|
|
7696
|
+
delete params.sourceId;
|
|
7476
7697
|
this.context.startProcess();
|
|
7477
7698
|
var http = this.context.getHttpClient();
|
|
7478
7699
|
return http.post(url, params)
|
|
@@ -7509,6 +7730,17 @@ var easy_data_server_loader_EasyDataServerLoader = /** @class */ (function () {
|
|
|
7509
7730
|
|
|
7510
7731
|
|
|
7511
7732
|
// CONCATENATED MODULE: ./src/main/data_context.ts
|
|
7733
|
+
var data_context_assign = (undefined && undefined.__assign) || function () {
|
|
7734
|
+
data_context_assign = Object.assign || function(t) {
|
|
7735
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7736
|
+
s = arguments[i];
|
|
7737
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7738
|
+
t[p] = s[p];
|
|
7739
|
+
}
|
|
7740
|
+
return t;
|
|
7741
|
+
};
|
|
7742
|
+
return data_context_assign.apply(this, arguments);
|
|
7743
|
+
};
|
|
7512
7744
|
|
|
7513
7745
|
|
|
7514
7746
|
|
|
@@ -7521,9 +7753,8 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7521
7753
|
this.model = new meta_data_MetaData();
|
|
7522
7754
|
this.model.id = options.metaDataId || '__default';
|
|
7523
7755
|
this.dataLoader = new easy_data_server_loader_EasyDataServerLoader(this);
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
});
|
|
7756
|
+
var dataTableOptions = data_context_assign({ loader: this.dataLoader }, options.dataTable);
|
|
7757
|
+
this.data = new easy_data_table_EasyDataTable(dataTableOptions);
|
|
7527
7758
|
this.setDefaultEndpoints(this.options.endpoint || '/api/easydata');
|
|
7528
7759
|
}
|
|
7529
7760
|
DataContext.prototype.getActiveEntity = function () {
|
|
@@ -7542,8 +7773,8 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7542
7773
|
DataContext.prototype.getDataLoader = function () {
|
|
7543
7774
|
return this.dataLoader;
|
|
7544
7775
|
};
|
|
7545
|
-
DataContext.prototype.createFilter = function (
|
|
7546
|
-
return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(),
|
|
7776
|
+
DataContext.prototype.createFilter = function (sourceId, data, isLookup) {
|
|
7777
|
+
return new text_data_filter_TextDataFilter(this.dataLoader, data || this.getData(), sourceId || this.activeEntity.id, isLookup);
|
|
7547
7778
|
};
|
|
7548
7779
|
DataContext.prototype.loadMetaData = function () {
|
|
7549
7780
|
var _this = this;
|
|
@@ -7567,7 +7798,7 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7567
7798
|
DataContext.prototype.getHttpClient = function () {
|
|
7568
7799
|
return this.http;
|
|
7569
7800
|
};
|
|
7570
|
-
DataContext.prototype.
|
|
7801
|
+
DataContext.prototype.fetchDataset = function () {
|
|
7571
7802
|
var _this = this;
|
|
7572
7803
|
this.data.clear();
|
|
7573
7804
|
return this.dataLoader.loadChunk({ offset: 0, limit: this.data.chunkSize, needTotal: true })
|
|
@@ -7584,33 +7815,33 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7584
7815
|
return _this.data;
|
|
7585
7816
|
});
|
|
7586
7817
|
};
|
|
7587
|
-
DataContext.prototype.
|
|
7818
|
+
DataContext.prototype.fetchRecord = function (keys, sourceId) {
|
|
7588
7819
|
var _this = this;
|
|
7589
|
-
var url = this.resolveEndpoint('
|
|
7590
|
-
entityId: entityId || this.activeEntity.id });
|
|
7820
|
+
var url = this.resolveEndpoint('FetchRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7591
7821
|
this.startProcess();
|
|
7592
|
-
return this.http.get(url)
|
|
7822
|
+
return this.http.get(url, { queryParams: keys })
|
|
7593
7823
|
.finally(function () { return _this.endProcess(); });
|
|
7594
7824
|
};
|
|
7595
|
-
DataContext.prototype.
|
|
7825
|
+
DataContext.prototype.createRecord = function (obj, sourceId) {
|
|
7596
7826
|
var _this = this;
|
|
7597
|
-
var url = this.resolveEndpoint('
|
|
7827
|
+
var url = this.resolveEndpoint('CreateRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7598
7828
|
this.startProcess();
|
|
7599
|
-
return this.http.post(url, obj, { dataType: 'json' })
|
|
7829
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7830
|
+
.finally(function () { return _this.endProcess(); });
|
|
7600
7831
|
};
|
|
7601
|
-
DataContext.prototype.
|
|
7832
|
+
DataContext.prototype.updateRecord = function (obj, sourceId) {
|
|
7602
7833
|
var _this = this;
|
|
7603
|
-
var url = this.resolveEndpoint('
|
|
7604
|
-
entityId: entityId || this.activeEntity.id });
|
|
7834
|
+
var url = this.resolveEndpoint('UpdateRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7605
7835
|
this.startProcess();
|
|
7606
|
-
return this.http.post(url, obj, { dataType: 'json' })
|
|
7836
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7837
|
+
.finally(function () { return _this.endProcess(); });
|
|
7607
7838
|
};
|
|
7608
|
-
DataContext.prototype.
|
|
7839
|
+
DataContext.prototype.deleteRecord = function (obj, sourceId) {
|
|
7609
7840
|
var _this = this;
|
|
7610
|
-
var url = this.resolveEndpoint('
|
|
7611
|
-
entityId: entityId || this.activeEntity.id });
|
|
7841
|
+
var url = this.resolveEndpoint('DeleteRecord', { sourceId: sourceId || this.activeEntity.id });
|
|
7612
7842
|
this.startProcess();
|
|
7613
|
-
return this.http.post(url,
|
|
7843
|
+
return this.http.post(url, obj, { dataType: 'json' })
|
|
7844
|
+
.finally(function () { return _this.endProcess(); });
|
|
7614
7845
|
};
|
|
7615
7846
|
DataContext.prototype.setEndpoint = function (key, value) {
|
|
7616
7847
|
this.endpoints.set(key, value);
|
|
@@ -7635,7 +7866,7 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7635
7866
|
if (opt == 'modelId') {
|
|
7636
7867
|
optVal = this.model.getId();
|
|
7637
7868
|
}
|
|
7638
|
-
else if (opt == '
|
|
7869
|
+
else if (opt == 'sourceId') {
|
|
7639
7870
|
optVal = this.activeEntity.id;
|
|
7640
7871
|
}
|
|
7641
7872
|
else {
|
|
@@ -7657,11 +7888,11 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7657
7888
|
};
|
|
7658
7889
|
DataContext.prototype.setDefaultEndpoints = function (endpointBase) {
|
|
7659
7890
|
this.setEnpointIfNotExist('GetMetaData', combinePath(endpointBase, 'models/{modelId}'));
|
|
7660
|
-
this.setEnpointIfNotExist('
|
|
7661
|
-
this.setEnpointIfNotExist('
|
|
7662
|
-
this.setEnpointIfNotExist('
|
|
7663
|
-
this.setEnpointIfNotExist('
|
|
7664
|
-
this.setEnpointIfNotExist('
|
|
7891
|
+
this.setEnpointIfNotExist('FetchDataset', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
|
|
7892
|
+
this.setEnpointIfNotExist('FetchRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/fetch'));
|
|
7893
|
+
this.setEnpointIfNotExist('CreateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/create'));
|
|
7894
|
+
this.setEnpointIfNotExist('UpdateRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/update'));
|
|
7895
|
+
this.setEnpointIfNotExist('DeleteRecord', combinePath(endpointBase, 'models/{modelId}/sources/{sourceId}/delete'));
|
|
7665
7896
|
};
|
|
7666
7897
|
return DataContext;
|
|
7667
7898
|
}());
|
|
@@ -7794,7 +8025,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7794
8025
|
};
|
|
7795
8026
|
EntityDataView.prototype.renderGrid = function () {
|
|
7796
8027
|
var _this = this;
|
|
7797
|
-
this.context.
|
|
8028
|
+
this.context.fetchDataset()
|
|
7798
8029
|
.then(function (result) {
|
|
7799
8030
|
var gridSlot = document.createElement('div');
|
|
7800
8031
|
_this.slot.appendChild(gridSlot);
|
|
@@ -7807,7 +8038,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7807
8038
|
allowPageSizeChange: true,
|
|
7808
8039
|
pageSizeItems: [15, 30, 50, 100, 200]
|
|
7809
8040
|
},
|
|
7810
|
-
addColumns:
|
|
8041
|
+
addColumns: _this.context.getActiveEntity().isEditable,
|
|
7811
8042
|
addColumnsTitle: i18n_i18n.getText('AddBtnTitle'),
|
|
7812
8043
|
showActiveRow: false,
|
|
7813
8044
|
onAddColumnClick: _this.addClickHandler.bind(_this),
|
|
@@ -7865,7 +8096,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7865
8096
|
if (!form.validate())
|
|
7866
8097
|
return false;
|
|
7867
8098
|
form.getData()
|
|
7868
|
-
.then(function (obj) { return _this.context.
|
|
8099
|
+
.then(function (obj) { return _this.context.createRecord(obj); })
|
|
7869
8100
|
.then(function () {
|
|
7870
8101
|
return _this.refreshData();
|
|
7871
8102
|
})
|
|
@@ -7896,12 +8127,10 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7896
8127
|
.replace('{entity}', activeEntity.caption),
|
|
7897
8128
|
body: form.getHtml(),
|
|
7898
8129
|
onSubmit: function () {
|
|
7899
|
-
var keyAttrs = activeEntity.attributes.filter(function (attr) { return attr.isPrimaryKey; });
|
|
7900
|
-
var keys = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
7901
8130
|
if (!form.validate())
|
|
7902
8131
|
return false;
|
|
7903
8132
|
form.getData()
|
|
7904
|
-
.then(function (obj) { return _this.context.
|
|
8133
|
+
.then(function (obj) { return _this.context.updateRecord(obj); })
|
|
7905
8134
|
.then(function () {
|
|
7906
8135
|
return _this.refreshData();
|
|
7907
8136
|
})
|
|
@@ -7922,16 +8151,20 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7922
8151
|
.then(function (row) {
|
|
7923
8152
|
if (row) {
|
|
7924
8153
|
var activeEntity = _this.context.getActiveEntity();
|
|
7925
|
-
var keyAttrs = activeEntity.
|
|
7926
|
-
var
|
|
7927
|
-
var
|
|
8154
|
+
var keyAttrs = activeEntity.getPrimaryAttrs();
|
|
8155
|
+
var keyVals_1 = keyAttrs.map(function (attr) { return row.getValue(attr.id); });
|
|
8156
|
+
var keys_1 = keyAttrs.reduce(function (val, attr, index) {
|
|
8157
|
+
var property = attr.id.substring(attr.id.lastIndexOf('.') + 1);
|
|
8158
|
+
val[property] = keyVals_1[index];
|
|
8159
|
+
return val;
|
|
8160
|
+
}, {});
|
|
7928
8161
|
_this.dlg.openConfirm(i18n_i18n.getText('DeleteDlgCaption')
|
|
7929
8162
|
.replace('{entity}', activeEntity.caption), i18n_i18n.getText('DeleteDlgMessage')
|
|
7930
|
-
.replace('{
|
|
8163
|
+
.replace('{recordId}', Object.keys(keys_1)
|
|
8164
|
+
.map(function (key) { return key + ":" + keys_1[key]; }).join(';')))
|
|
7931
8165
|
.then(function (result) {
|
|
7932
8166
|
if (result) {
|
|
7933
|
-
|
|
7934
|
-
_this.context.deleteEntity(keys_1.join(':'))
|
|
8167
|
+
_this.context.deleteRecord(keys_1)
|
|
7935
8168
|
.then(function () {
|
|
7936
8169
|
return _this.refreshData();
|
|
7937
8170
|
})
|
|
@@ -7953,7 +8186,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7953
8186
|
};
|
|
7954
8187
|
EntityDataView.prototype.refreshData = function () {
|
|
7955
8188
|
var _this = this;
|
|
7956
|
-
return this.context.
|
|
8189
|
+
return this.context.fetchDataset()
|
|
7957
8190
|
.then(function () {
|
|
7958
8191
|
_this.grid.refresh();
|
|
7959
8192
|
});
|
|
@@ -8039,6 +8272,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
|
|
|
8039
8272
|
parent.insertBefore(progressBarSlot, parent.firstElementChild);
|
|
8040
8273
|
this.context = new data_context_DataContext({
|
|
8041
8274
|
endpoint: options.endpoint,
|
|
8275
|
+
dataTable: options.dataTable,
|
|
8042
8276
|
onProcessStart: function () { return bar.show(); },
|
|
8043
8277
|
onProcessEnd: function () { return bar.hide(); }
|
|
8044
8278
|
});
|
|
@@ -8139,7 +8373,7 @@ function addEasyDataCRUDTexts() {
|
|
|
8139
8373
|
AddDlgCaption: 'Create {entity}',
|
|
8140
8374
|
EditDlgCaption: 'Edit {entity}',
|
|
8141
8375
|
DeleteDlgCaption: 'Delete {entity}',
|
|
8142
|
-
DeleteDlgMessage: 'Are you
|
|
8376
|
+
DeleteDlgMessage: 'Are you sure you want to remove this record: {{recordId}}?',
|
|
8143
8377
|
EntityMenuDesc: 'Click on an entity to view/edit its content',
|
|
8144
8378
|
BackToEntities: 'Back to entities',
|
|
8145
8379
|
SearchBtn: 'Search',
|