tnx-shared 5.3.185 → 5.3.186
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 +52 -10
- 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 -0
- package/classes/form-schema.d.ts.map +1 -1
- package/components/common-search-form/common-search-form.component.d.ts +3 -0
- package/components/common-search-form/common-search-form.component.d.ts.map +1 -1
- package/esm2015/classes/form-schema.js +3 -1
- package/esm2015/components/common-search-form/common-search-form.component.js +42 -11
- package/esm2015/components/dropdown/dropdown.component.js +2 -2
- package/fesm2015/tnx-shared.js +43 -11
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -674,6 +674,7 @@ class CrudListSetting {
|
|
|
674
674
|
this.disableViewWorkflowAttach = false;
|
|
675
675
|
this.hiddenWorkflowCoreStatus = true;
|
|
676
676
|
this.requiredVanBanDiAfterTrinhKy = false;
|
|
677
|
+
this.disableLazyLoadCommonSearch = false;
|
|
677
678
|
this.showExportAll = false;
|
|
678
679
|
this.showExportSelectedItems = true;
|
|
679
680
|
this.showExportWordSelectedItems = false;
|
|
@@ -966,6 +967,7 @@ class FormControlBase extends FormSchemaBase {
|
|
|
966
967
|
this.enableCaching = false;
|
|
967
968
|
this.hasOperatorCanBo = false;
|
|
968
969
|
this.addToGridInfo = false;
|
|
970
|
+
this.isLazyLoad = false;
|
|
969
971
|
for (const key in init) {
|
|
970
972
|
this[key] = init[key];
|
|
971
973
|
}
|
|
@@ -21576,6 +21578,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21576
21578
|
this.lstBoolControl = [];
|
|
21577
21579
|
this.lstControlNotIn = [];
|
|
21578
21580
|
this.lstControlAddToGridInfo = [];
|
|
21581
|
+
this.lstControlLazyLoad = [];
|
|
21579
21582
|
this.defaultValues = {};
|
|
21580
21583
|
this.isAddDefaultValues = false;
|
|
21581
21584
|
this.mapControlBindingFilter = new Map();
|
|
@@ -21583,6 +21586,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21583
21586
|
this.isOpenFull = false;
|
|
21584
21587
|
this.isCustomGenerateSearch = false;
|
|
21585
21588
|
this.isDisableOpenFull = false;
|
|
21589
|
+
this._index = 1;
|
|
21586
21590
|
}
|
|
21587
21591
|
ngOnInit() {
|
|
21588
21592
|
this.mdWidth = this.parentSetting.mdWidthCommonSearch;
|
|
@@ -21601,9 +21605,10 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21601
21605
|
const lstTextSearchControl = columnFilters.filter(p => p.fullTextSearch);
|
|
21602
21606
|
this.lstTextControl = lstTextSearchControl.map(p => p.field);
|
|
21603
21607
|
this.searchBoxTooltip += `${(lstTextSearchControl.map(x => x.label)).join(', ')}`;
|
|
21608
|
+
this._index = 2;
|
|
21604
21609
|
}
|
|
21610
|
+
const totalControlPerRow = 12 / this.mdWidth;
|
|
21605
21611
|
if (this.isCustomGenerateSearch) {
|
|
21606
|
-
this.lstControlAddToGridInfo = this.parentSetting.commonSchemas.filter(p => p.addToGridInfo).map(p => p.field);
|
|
21607
21612
|
this.parentSetting.commonSchemas.forEach(column => {
|
|
21608
21613
|
column.showLabel = false;
|
|
21609
21614
|
column.mdWidth = this.mdWidth;
|
|
@@ -21616,25 +21621,33 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21616
21621
|
if (column instanceof NumberRangeControlSchema) {
|
|
21617
21622
|
this.lstNumberRangeControl.push(column.field);
|
|
21618
21623
|
}
|
|
21624
|
+
if (column.hasOwnProperty('defaultValue') && (column instanceof DropdownControlSchema || column instanceof DateTimeControlSchema)) {
|
|
21625
|
+
this.defaultValues[column.field] = column.defaultValue;
|
|
21626
|
+
}
|
|
21627
|
+
if (column.addToGridInfo) {
|
|
21628
|
+
this.lstControlAddToGridInfo.push(column.field);
|
|
21629
|
+
}
|
|
21630
|
+
column.isLazyLoad = !this.parentSetting.disableLazyLoadCommonSearch && this._index > totalControlPerRow
|
|
21631
|
+
&& column instanceof DropdownControlSchema && !!column.baseService && !(column.baseService instanceof MasterDataService);
|
|
21632
|
+
if (column.isLazyLoad) {
|
|
21633
|
+
this.lstControlLazyLoad.push(column.field);
|
|
21634
|
+
}
|
|
21635
|
+
this._index++;
|
|
21619
21636
|
});
|
|
21620
21637
|
this.setting.schema = this.addSearchBox(this.parentSetting.commonSchemas.sort((prev, next) => prev.order - next.order));
|
|
21621
|
-
this.genFormSchema(this.parentSetting.commonSchemas);
|
|
21622
21638
|
}
|
|
21623
21639
|
else {
|
|
21624
21640
|
this.setting.schema = this.genFormSchema(columnFilters);
|
|
21625
21641
|
}
|
|
21626
21642
|
this.isDisableOpenFull = this.setting.schema.length <= 4 && !this._commonService.isMobile();
|
|
21627
21643
|
super.ngOnInit();
|
|
21628
|
-
|
|
21629
|
-
if (controlSetDefaultValue.length) {
|
|
21630
|
-
controlSetDefaultValue.forEach(item => {
|
|
21631
|
-
this.defaultValues[item.field] = item.defaultValue;
|
|
21632
|
-
});
|
|
21644
|
+
if (Object.keys(this.defaultValues).length) {
|
|
21633
21645
|
this.handleSearch();
|
|
21634
21646
|
}
|
|
21635
21647
|
}
|
|
21636
21648
|
genFormSchema(columns) {
|
|
21637
21649
|
const result = [];
|
|
21650
|
+
const totalControlPerRow = 12 / this.mdWidth;
|
|
21638
21651
|
columns.forEach(column => {
|
|
21639
21652
|
var _a;
|
|
21640
21653
|
if (!column.isInTable || !column.includeSelect) {
|
|
@@ -21654,7 +21667,12 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21654
21667
|
});
|
|
21655
21668
|
}
|
|
21656
21669
|
if (column.baseService || (dataSource && dataSource.length > 0)) {
|
|
21657
|
-
|
|
21670
|
+
const isLazyLoad = !this.parentSetting.disableLazyLoadCommonSearch && this._index > totalControlPerRow
|
|
21671
|
+
&& !!column.baseService && !(column.baseService instanceof MasterDataService);
|
|
21672
|
+
if (isLazyLoad) {
|
|
21673
|
+
this.lstControlLazyLoad.push(column.field);
|
|
21674
|
+
}
|
|
21675
|
+
result.push(new DropdownControlSchema(Object.assign(Object.assign({}, column), { placeholder: (_a = column.placeholder) !== null && _a !== void 0 ? _a : `Chọn ${column.label}`, multiple: !column.single, dataSource: dataSource, mdWidth: this.mdWidth, isLazyLoad: isLazyLoad, showLabel: false, showClear: true, onChanged: (evt) => {
|
|
21658
21676
|
var _a;
|
|
21659
21677
|
if (column.dataType == DataType.boolean) {
|
|
21660
21678
|
evt.parentModel[column.field] = column.single ? (_a = evt.value.id) !== null && _a !== void 0 ? _a : evt.value : evt.value.map(p => p.id);
|
|
@@ -21671,6 +21689,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21671
21689
|
}
|
|
21672
21690
|
this.handleSearch();
|
|
21673
21691
|
} })));
|
|
21692
|
+
this._index++;
|
|
21674
21693
|
}
|
|
21675
21694
|
}
|
|
21676
21695
|
else {
|
|
@@ -21686,6 +21705,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21686
21705
|
addColumn.showTime = column.dataType == DataType.datetime;
|
|
21687
21706
|
result.push(new DateTimeRangeControlSchema(addColumn));
|
|
21688
21707
|
this.lstDatetimeControl.push(column.field);
|
|
21708
|
+
this._index++;
|
|
21689
21709
|
break;
|
|
21690
21710
|
case DataType.int:
|
|
21691
21711
|
case DataType.intWithoutMask:
|
|
@@ -21698,6 +21718,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21698
21718
|
};
|
|
21699
21719
|
result.push(new NumberRangeControlSchema(addColumn));
|
|
21700
21720
|
this.lstNumberRangeControl.push(addColumn.field);
|
|
21721
|
+
this._index++;
|
|
21701
21722
|
break;
|
|
21702
21723
|
default:
|
|
21703
21724
|
break;
|
|
@@ -21715,7 +21736,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21715
21736
|
label: 'Từ khóa',
|
|
21716
21737
|
fullLabel: 'Từ khóa',
|
|
21717
21738
|
showLabel: false,
|
|
21718
|
-
mdWidth: this.mdWidth
|
|
21739
|
+
mdWidth: this.mdWidth,
|
|
21719
21740
|
});
|
|
21720
21741
|
const index = Number(12 / this.mdWidth) - 1;
|
|
21721
21742
|
if (this._commonService.isMobile()) {
|
|
@@ -21744,7 +21765,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21744
21765
|
data = Object.assign(data, this.defaultValues);
|
|
21745
21766
|
this.isAddDefaultValues = true;
|
|
21746
21767
|
}
|
|
21747
|
-
|
|
21768
|
+
const lstFilters = this._crudService.getFilterFromTemplate(this.templateFilter, data);
|
|
21748
21769
|
const lstFilterAddCustom = lstFilters.filter(p => this.lstControlAddToGridInfo.includes(p.field));
|
|
21749
21770
|
if (this.isCustomGenerateSearch) {
|
|
21750
21771
|
const rs = {
|
|
@@ -21814,8 +21835,19 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21814
21835
|
}
|
|
21815
21836
|
toggleMenuSearch() {
|
|
21816
21837
|
this.isOpenFull = !this.isOpenFull;
|
|
21838
|
+
if (this.lstControlLazyLoad.length) {
|
|
21839
|
+
this.triggerLazyLoadDropdown();
|
|
21840
|
+
}
|
|
21817
21841
|
this.onAfterToggleMenuSearch.emit(true);
|
|
21818
21842
|
}
|
|
21843
|
+
triggerLazyLoadDropdown() {
|
|
21844
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21845
|
+
const promises = [];
|
|
21846
|
+
this.lstControlLazyLoad.forEach(control => promises.push(this.formControls[control]._component._getDataSource()));
|
|
21847
|
+
yield Promise.all(promises);
|
|
21848
|
+
this.lstControlLazyLoad = [];
|
|
21849
|
+
});
|
|
21850
|
+
}
|
|
21819
21851
|
onFormInitialized(formEvent) {
|
|
21820
21852
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21821
21853
|
// tiền xử lý dữ liệu (ví dụ tổng hợp datasource), trước khi gọi api get detail
|
|
@@ -27609,7 +27641,7 @@ class DropdownComponent extends ComponentBase {
|
|
|
27609
27641
|
this.createFilterFunction();
|
|
27610
27642
|
this.createSearchSubscription();
|
|
27611
27643
|
}
|
|
27612
|
-
if (this.control.loadOnInit) {
|
|
27644
|
+
if (this.control.loadOnInit && !this.control.isLazyLoad) {
|
|
27613
27645
|
this._getData();
|
|
27614
27646
|
}
|
|
27615
27647
|
}
|