tnx-shared 5.3.183 → 5.3.184
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 +43 -12
- 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/classes/form-schema.d.ts +2 -1
- package/classes/form-schema.d.ts.map +1 -1
- package/components/common-search-form/common-search-form.component.d.ts +2 -0
- package/components/common-search-form/common-search-form.component.d.ts.map +1 -1
- package/esm2015/classes/form-schema.js +3 -2
- package/esm2015/components/common-search-form/common-search-form.component.js +33 -12
- package/esm2015/components/dropdown/dropdown.component.js +2 -2
- package/fesm2015/tnx-shared.js +34 -13
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
|
@@ -1116,6 +1116,7 @@
|
|
|
1116
1116
|
this.disableViewWorkflowAttach = false;
|
|
1117
1117
|
this.hiddenWorkflowCoreStatus = true;
|
|
1118
1118
|
this.requiredVanBanDiAfterTrinhKy = false;
|
|
1119
|
+
this.disableLazyLoadCommonSearch = false;
|
|
1119
1120
|
this.showExportAll = false;
|
|
1120
1121
|
this.showExportSelectedItems = true;
|
|
1121
1122
|
this.showExportWordSelectedItems = false;
|
|
@@ -1364,6 +1365,7 @@
|
|
|
1364
1365
|
_this.isHtmlLabel = false;
|
|
1365
1366
|
_this.isHorizontallyLabel = false;
|
|
1366
1367
|
_this.order = 0;
|
|
1368
|
+
_this.isLazyLoad = false;
|
|
1367
1369
|
for (var key in init) {
|
|
1368
1370
|
_this[key] = init[key];
|
|
1369
1371
|
}
|
|
@@ -2047,7 +2049,6 @@
|
|
|
2047
2049
|
_this.searchMultiple = true;
|
|
2048
2050
|
_this.disableDisplayFieldServerSearch = false;
|
|
2049
2051
|
_this.loadOnInit = false;
|
|
2050
|
-
_this.isLazyLoad = false;
|
|
2051
2052
|
_this.allowLoadDataWhenParentNull = false;
|
|
2052
2053
|
_this.disabledParentItem = true;
|
|
2053
2054
|
for (var key in init) {
|
|
@@ -31645,6 +31646,7 @@
|
|
|
31645
31646
|
_this.lstBoolControl = [];
|
|
31646
31647
|
_this.lstControlNotIn = [];
|
|
31647
31648
|
_this.lstControlAddToGridInfo = [];
|
|
31649
|
+
_this.lstControlLazyLoad = [];
|
|
31648
31650
|
_this.defaultValues = {};
|
|
31649
31651
|
_this.isAddDefaultValues = false;
|
|
31650
31652
|
_this.mapControlBindingFilter = new Map();
|
|
@@ -31674,7 +31676,6 @@
|
|
|
31674
31676
|
this.searchBoxTooltip += "" + (lstTextSearchControl.map(function (x) { return x.label; })).join(', ');
|
|
31675
31677
|
}
|
|
31676
31678
|
if (this.isCustomGenerateSearch) {
|
|
31677
|
-
this.lstControlAddToGridInfo = this.parentSetting.commonSchemas.filter(function (p) { return p.addToGridInfo; }).map(function (p) { return p.field; });
|
|
31678
31679
|
this.parentSetting.commonSchemas.forEach(function (column) {
|
|
31679
31680
|
column.showLabel = false;
|
|
31680
31681
|
column.mdWidth = _this.mdWidth;
|
|
@@ -31687,28 +31688,36 @@
|
|
|
31687
31688
|
if (column instanceof NumberRangeControlSchema) {
|
|
31688
31689
|
_this.lstNumberRangeControl.push(column.field);
|
|
31689
31690
|
}
|
|
31691
|
+
if (column.hasOwnProperty('defaultValue') && (column instanceof DropdownControlSchema || column instanceof DateTimeControlSchema)) {
|
|
31692
|
+
_this.defaultValues[column.field] = column.defaultValue;
|
|
31693
|
+
}
|
|
31694
|
+
if (column.addToGridInfo) {
|
|
31695
|
+
_this.lstControlAddToGridInfo.push(column.field);
|
|
31696
|
+
}
|
|
31690
31697
|
});
|
|
31691
|
-
this.setting.schema = this.
|
|
31692
|
-
this.genFormSchema(this.parentSetting.commonSchemas);
|
|
31698
|
+
this.setting.schema = this.genFormSchema(this.parentSetting.commonSchemas);
|
|
31693
31699
|
}
|
|
31694
31700
|
else {
|
|
31695
31701
|
this.setting.schema = this.genFormSchema(columnFilters);
|
|
31696
31702
|
}
|
|
31697
31703
|
this.isDisableOpenFull = this.setting.schema.length <= 4 && !this._commonService.isMobile();
|
|
31698
31704
|
_super.prototype.ngOnInit.call(this);
|
|
31699
|
-
|
|
31700
|
-
if (controlSetDefaultValue.length) {
|
|
31701
|
-
controlSetDefaultValue.forEach(function (item) {
|
|
31702
|
-
_this.defaultValues[item.field] = item.defaultValue;
|
|
31703
|
-
});
|
|
31705
|
+
if (Object.keys(this.defaultValues).length) {
|
|
31704
31706
|
this.handleSearch();
|
|
31705
31707
|
}
|
|
31706
31708
|
};
|
|
31707
31709
|
CommonSearchFormComponent.prototype.genFormSchema = function (columns) {
|
|
31708
31710
|
var _this = this;
|
|
31709
31711
|
var result = [];
|
|
31712
|
+
var totalControlPerRow = 12 / this.mdWidth;
|
|
31713
|
+
var i = 1;
|
|
31710
31714
|
columns.forEach(function (column) {
|
|
31711
31715
|
var _a;
|
|
31716
|
+
var isLazyLoad = !_this.parentSetting.disableLazyLoadCommonSearch && i > totalControlPerRow
|
|
31717
|
+
&& column instanceof DropdownControlSchema && !!column.baseService && column.baseService instanceof BaseService;
|
|
31718
|
+
if (isLazyLoad) {
|
|
31719
|
+
_this.lstControlLazyLoad.push(column.field);
|
|
31720
|
+
}
|
|
31712
31721
|
if (!column.isInTable || !column.includeSelect) {
|
|
31713
31722
|
_this.lstControlNotIn.push(column.field);
|
|
31714
31723
|
}
|
|
@@ -31726,7 +31735,7 @@
|
|
|
31726
31735
|
});
|
|
31727
31736
|
}
|
|
31728
31737
|
if (column.baseService || (dataSource && dataSource.length > 0)) {
|
|
31729
|
-
result.push(new DropdownControlSchema(Object.assign(Object.assign({}, column), { placeholder: (_a = column.placeholder) !== null && _a !== void 0 ? _a : "Ch\u1ECDn " + column.label, multiple: !column.single, dataSource: dataSource, mdWidth: _this.mdWidth, showLabel: false,
|
|
31738
|
+
result.push(new DropdownControlSchema(Object.assign(Object.assign({}, column), { placeholder: (_a = column.placeholder) !== null && _a !== void 0 ? _a : "Ch\u1ECDn " + column.label, multiple: !column.single, dataSource: dataSource, mdWidth: _this.mdWidth, showLabel: false, isLazyLoad: isLazyLoad, showClear: true, onChanged: function (evt) {
|
|
31730
31739
|
var _a;
|
|
31731
31740
|
if (column.dataType == exports.DataType.boolean) {
|
|
31732
31741
|
evt.parentModel[column.field] = column.single ? (_a = evt.value.id) !== null && _a !== void 0 ? _a : evt.value : evt.value.map(function (p) { return p.id; });
|
|
@@ -31775,6 +31784,7 @@
|
|
|
31775
31784
|
break;
|
|
31776
31785
|
}
|
|
31777
31786
|
}
|
|
31787
|
+
i++;
|
|
31778
31788
|
});
|
|
31779
31789
|
return this.addSearchBox(result.sort(function (prev, next) { return prev.order - next.order; }));
|
|
31780
31790
|
};
|
|
@@ -31787,7 +31797,7 @@
|
|
|
31787
31797
|
label: 'Từ khóa',
|
|
31788
31798
|
fullLabel: 'Từ khóa',
|
|
31789
31799
|
showLabel: false,
|
|
31790
|
-
mdWidth: this.mdWidth
|
|
31800
|
+
mdWidth: this.mdWidth,
|
|
31791
31801
|
});
|
|
31792
31802
|
var index = Number(12 / this.mdWidth) - 1;
|
|
31793
31803
|
if (this._commonService.isMobile()) {
|
|
@@ -31884,8 +31894,29 @@
|
|
|
31884
31894
|
};
|
|
31885
31895
|
CommonSearchFormComponent.prototype.toggleMenuSearch = function () {
|
|
31886
31896
|
this.isOpenFull = !this.isOpenFull;
|
|
31897
|
+
if (this.lstControlLazyLoad.length) {
|
|
31898
|
+
this.triggerLazyLoadDropdown();
|
|
31899
|
+
}
|
|
31887
31900
|
this.onAfterToggleMenuSearch.emit(true);
|
|
31888
31901
|
};
|
|
31902
|
+
CommonSearchFormComponent.prototype.triggerLazyLoadDropdown = function () {
|
|
31903
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31904
|
+
var promises;
|
|
31905
|
+
var _this = this;
|
|
31906
|
+
return __generator(this, function (_b) {
|
|
31907
|
+
switch (_b.label) {
|
|
31908
|
+
case 0:
|
|
31909
|
+
promises = [];
|
|
31910
|
+
this.lstControlLazyLoad.forEach(function (control) { return promises.push(_this.formControls[control]._component._getDataSource()); });
|
|
31911
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
31912
|
+
case 1:
|
|
31913
|
+
_b.sent();
|
|
31914
|
+
this.lstControlLazyLoad = [];
|
|
31915
|
+
return [2 /*return*/];
|
|
31916
|
+
}
|
|
31917
|
+
});
|
|
31918
|
+
});
|
|
31919
|
+
};
|
|
31889
31920
|
CommonSearchFormComponent.prototype.onFormInitialized = function (formEvent) {
|
|
31890
31921
|
return __awaiter(this, void 0, void 0, function () {
|
|
31891
31922
|
return __generator(this, function (_b) {
|
|
@@ -32139,7 +32170,7 @@
|
|
|
32139
32170
|
this.createFilterFunction();
|
|
32140
32171
|
this.createSearchSubscription();
|
|
32141
32172
|
}
|
|
32142
|
-
if (this.control.loadOnInit) {
|
|
32173
|
+
if (this.control.loadOnInit && !this.control.isLazyLoad) {
|
|
32143
32174
|
this._getData();
|
|
32144
32175
|
}
|
|
32145
32176
|
}
|