tnx-shared 5.1.204 → 5.1.205
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/bundles/tnx-shared.umd.js +50 -22
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/components/crud/crud-form/crud-form.component.d.ts +1 -1
- package/components/dropdown/dropdown.component.d.ts +1 -0
- package/components/dropdown/dropdown.component.d.ts.map +1 -1
- package/esm2015/components/dropdown/dropdown.component.js +27 -10
- package/fesm2015/tnx-shared.js +26 -9
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +3 -3
- package/tnx-shared.metadata.json +1 -1
- package/tnx-shared.module.d.ts +2 -2
- package/tnx-shared.module.d.ts.map +1 -1
|
@@ -34013,6 +34013,7 @@
|
|
|
34013
34013
|
_this.filterFromParents = [];
|
|
34014
34014
|
_this.dropdownOptions = [];
|
|
34015
34015
|
_this.delayFilter = 100;
|
|
34016
|
+
_this.firstScroll = true;
|
|
34016
34017
|
_this.loading = false;
|
|
34017
34018
|
_this.page = 1;
|
|
34018
34019
|
_this.totalPage = 2;
|
|
@@ -34026,13 +34027,18 @@
|
|
|
34026
34027
|
};
|
|
34027
34028
|
_this.handleScroll = function (evt) {
|
|
34028
34029
|
if (evt.srcElement.scrollTop > 0
|
|
34030
|
+
&& !_this.firstScroll
|
|
34029
34031
|
&& evt.srcElement.offsetHeight + evt.srcElement.scrollTop == evt.srcElement.scrollHeight) {
|
|
34032
|
+
_this.firstScroll = true;
|
|
34030
34033
|
if (_this.timeoutScroll)
|
|
34031
34034
|
clearTimeout(_this.timeoutScroll);
|
|
34032
34035
|
_this.timeoutScroll = setTimeout(function (f) {
|
|
34033
34036
|
_this.getDataNextPage();
|
|
34034
34037
|
}, 150);
|
|
34035
34038
|
}
|
|
34039
|
+
else {
|
|
34040
|
+
_this.firstScroll = false;
|
|
34041
|
+
}
|
|
34036
34042
|
};
|
|
34037
34043
|
return _this;
|
|
34038
34044
|
}
|
|
@@ -34056,7 +34062,24 @@
|
|
|
34056
34062
|
});
|
|
34057
34063
|
Object.defineProperty(DropdownComponent.prototype, "dataSource", {
|
|
34058
34064
|
set: function (value) {
|
|
34059
|
-
|
|
34065
|
+
var e_1, _a;
|
|
34066
|
+
var dataSource = [];
|
|
34067
|
+
if (value) {
|
|
34068
|
+
try {
|
|
34069
|
+
for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
|
|
34070
|
+
var item = value_1_1.value;
|
|
34071
|
+
dataSource.push(this.reStructureItemObject(item));
|
|
34072
|
+
}
|
|
34073
|
+
}
|
|
34074
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
34075
|
+
finally {
|
|
34076
|
+
try {
|
|
34077
|
+
if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
|
|
34078
|
+
}
|
|
34079
|
+
finally { if (e_1) throw e_1.error; }
|
|
34080
|
+
}
|
|
34081
|
+
}
|
|
34082
|
+
this.combineDataSource(dataSource, 1);
|
|
34060
34083
|
this.checkAndFireEvent();
|
|
34061
34084
|
},
|
|
34062
34085
|
enumerable: false,
|
|
@@ -34107,7 +34130,8 @@
|
|
|
34107
34130
|
this.setDefaultSetting();
|
|
34108
34131
|
if (this.control.baseService) {
|
|
34109
34132
|
if (this.control.isServerLoad) {
|
|
34110
|
-
this.virtualScroll = false;
|
|
34133
|
+
// this.virtualScroll = false;
|
|
34134
|
+
this.control.maxItemDisplay = 9999;
|
|
34111
34135
|
this.createFilterFunction();
|
|
34112
34136
|
this.subscription = this.keyUp.pipe(operators.map(function (event) { return event.target.value; }), operators.debounceTime(500), operators.distinctUntilChanged()).subscribe(function (value) {
|
|
34113
34137
|
_this._getData();
|
|
@@ -34228,7 +34252,7 @@
|
|
|
34228
34252
|
}
|
|
34229
34253
|
else {
|
|
34230
34254
|
this.getFilterOnServerSearch = function (value) {
|
|
34231
|
-
var
|
|
34255
|
+
var e_2, _a;
|
|
34232
34256
|
var result = new Filter({
|
|
34233
34257
|
logic: 'or',
|
|
34234
34258
|
filters: []
|
|
@@ -34240,12 +34264,12 @@
|
|
|
34240
34264
|
result.filters.push({ field: fieldSearch, operator: exports.Operator.contain, value: tmpValue });
|
|
34241
34265
|
}
|
|
34242
34266
|
}
|
|
34243
|
-
catch (
|
|
34267
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
34244
34268
|
finally {
|
|
34245
34269
|
try {
|
|
34246
34270
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
34247
34271
|
}
|
|
34248
|
-
finally { if (
|
|
34272
|
+
finally { if (e_2) throw e_2.error; }
|
|
34249
34273
|
}
|
|
34250
34274
|
return result;
|
|
34251
34275
|
};
|
|
@@ -34298,12 +34322,12 @@
|
|
|
34298
34322
|
dataSource.forEach(function (source) {
|
|
34299
34323
|
var index = destSource.findIndex(function (q) { return q.value[_this.control.fieldMaPhanCap] > source.value[_this.control.fieldMaPhanCap]; });
|
|
34300
34324
|
if (index == -1) {
|
|
34301
|
-
|
|
34302
|
-
|
|
34303
|
-
|
|
34304
|
-
|
|
34305
|
-
destSource.push(source);
|
|
34325
|
+
// Kiểm tra bản ghi cuối cùng là nó thì k insert
|
|
34326
|
+
if (destSource.length > 0
|
|
34327
|
+
&& destSource[destSource.length - 1].value[_this.control.valueField] == source.value[_this.control.valueField]) {
|
|
34328
|
+
return;
|
|
34306
34329
|
}
|
|
34330
|
+
destSource.push(source);
|
|
34307
34331
|
}
|
|
34308
34332
|
else if (index == 0) {
|
|
34309
34333
|
destSource.unshift(source);
|
|
@@ -34419,13 +34443,13 @@
|
|
|
34419
34443
|
return newValue;
|
|
34420
34444
|
};
|
|
34421
34445
|
DropdownComponent.prototype.appendValueFromDataSource = function (newValue, currentValue, dataSource) {
|
|
34422
|
-
var
|
|
34446
|
+
var e_3, _a;
|
|
34423
34447
|
if (!dataSource || !dataSource.length)
|
|
34424
34448
|
return;
|
|
34425
34449
|
for (var i = 0; i < currentValue.length; i++) {
|
|
34426
34450
|
var selectedItem = currentValue[i];
|
|
34427
34451
|
try {
|
|
34428
|
-
for (var dataSource_1 = (
|
|
34452
|
+
for (var dataSource_1 = (e_3 = void 0, __values(dataSource)), dataSource_1_1 = dataSource_1.next(); !dataSource_1_1.done; dataSource_1_1 = dataSource_1.next()) {
|
|
34429
34453
|
var item = dataSource_1_1.value;
|
|
34430
34454
|
if (this.control.funcCompare(item.value, selectedItem)
|
|
34431
34455
|
|| this.control.funcCompare(item.value, selectedItem[this.control.valueField])) {
|
|
@@ -34436,12 +34460,12 @@
|
|
|
34436
34460
|
}
|
|
34437
34461
|
}
|
|
34438
34462
|
}
|
|
34439
|
-
catch (
|
|
34463
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
34440
34464
|
finally {
|
|
34441
34465
|
try {
|
|
34442
34466
|
if (dataSource_1_1 && !dataSource_1_1.done && (_a = dataSource_1.return)) _a.call(dataSource_1);
|
|
34443
34467
|
}
|
|
34444
|
-
finally { if (
|
|
34468
|
+
finally { if (e_3) throw e_3.error; }
|
|
34445
34469
|
}
|
|
34446
34470
|
}
|
|
34447
34471
|
};
|
|
@@ -34454,7 +34478,7 @@
|
|
|
34454
34478
|
this.findItemFromDataSource(oldValue, this.dataSourceSelected);
|
|
34455
34479
|
};
|
|
34456
34480
|
DropdownComponent.prototype.findItemFromDataSource = function (oldValue, dataSource) {
|
|
34457
|
-
var
|
|
34481
|
+
var e_4, _a;
|
|
34458
34482
|
if (!dataSource || !dataSource.length)
|
|
34459
34483
|
return;
|
|
34460
34484
|
try {
|
|
@@ -34467,12 +34491,12 @@
|
|
|
34467
34491
|
}
|
|
34468
34492
|
}
|
|
34469
34493
|
}
|
|
34470
|
-
catch (
|
|
34494
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
34471
34495
|
finally {
|
|
34472
34496
|
try {
|
|
34473
34497
|
if (dataSource_2_1 && !dataSource_2_1.done && (_a = dataSource_2.return)) _a.call(dataSource_2);
|
|
34474
34498
|
}
|
|
34475
|
-
finally { if (
|
|
34499
|
+
finally { if (e_4) throw e_4.error; }
|
|
34476
34500
|
}
|
|
34477
34501
|
};
|
|
34478
34502
|
DropdownComponent.prototype.checkReady = function () {
|
|
@@ -34575,7 +34599,7 @@
|
|
|
34575
34599
|
if (pageSize === void 0) { pageSize = null; }
|
|
34576
34600
|
return __awaiter(this, void 0, void 0, function () {
|
|
34577
34601
|
var dataSource, totalPage, dropdownOptions, response, result, dataSource_3, dataSource_3_1, item;
|
|
34578
|
-
var
|
|
34602
|
+
var e_5, _a;
|
|
34579
34603
|
return __generator(this, function (_b) {
|
|
34580
34604
|
switch (_b.label) {
|
|
34581
34605
|
case 0:
|
|
@@ -34618,12 +34642,12 @@
|
|
|
34618
34642
|
result.push(this.reStructureItemObject(item));
|
|
34619
34643
|
}
|
|
34620
34644
|
}
|
|
34621
|
-
catch (
|
|
34645
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
34622
34646
|
finally {
|
|
34623
34647
|
try {
|
|
34624
34648
|
if (dataSource_3_1 && !dataSource_3_1.done && (_a = dataSource_3.return)) _a.call(dataSource_3);
|
|
34625
34649
|
}
|
|
34626
|
-
finally { if (
|
|
34650
|
+
finally { if (e_5) throw e_5.error; }
|
|
34627
34651
|
}
|
|
34628
34652
|
return [2 /*return*/, { dataSource: result, totalPage: totalPage }];
|
|
34629
34653
|
}
|
|
@@ -34798,8 +34822,12 @@
|
|
|
34798
34822
|
if (!this.control.isServerLoad) {
|
|
34799
34823
|
return;
|
|
34800
34824
|
}
|
|
34801
|
-
|
|
34802
|
-
|
|
34825
|
+
if (this.virtualScroll) {
|
|
34826
|
+
this.scrollContainer = this.dropdown.overlay.querySelector('.cdk-virtual-scroll-viewport');
|
|
34827
|
+
}
|
|
34828
|
+
else {
|
|
34829
|
+
this.scrollContainer = this.dropdown.overlay.querySelector('.p-dropdown-items-wrapper');
|
|
34830
|
+
}
|
|
34803
34831
|
this.scrollContainer.addEventListener('scroll', this.handleScroll);
|
|
34804
34832
|
var defaultInput = this.dropdown.filterViewChild.nativeElement;
|
|
34805
34833
|
this._insertTextboxAndFocus(defaultInput);
|