tnx-shared 5.3.182 → 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 +48 -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/base/data-form-base.d.ts.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/base/data-form-base.js +6 -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 +39 -13
- 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;
|
|
@@ -892,6 +893,7 @@ class FormSchemaBase extends SchemaBase {
|
|
|
892
893
|
this.isHtmlLabel = false;
|
|
893
894
|
this.isHorizontallyLabel = false;
|
|
894
895
|
this.order = 0;
|
|
896
|
+
this.isLazyLoad = false;
|
|
895
897
|
for (const key in init) {
|
|
896
898
|
this[key] = init[key];
|
|
897
899
|
}
|
|
@@ -1464,7 +1466,6 @@ class DropdownControlSchema extends DataSourceControlSchema {
|
|
|
1464
1466
|
this.searchMultiple = true;
|
|
1465
1467
|
this.disableDisplayFieldServerSearch = false;
|
|
1466
1468
|
this.loadOnInit = false;
|
|
1467
|
-
this.isLazyLoad = false;
|
|
1468
1469
|
this.allowLoadDataWhenParentNull = false;
|
|
1469
1470
|
this.disabledParentItem = true;
|
|
1470
1471
|
for (const key in init) {
|
|
@@ -15956,6 +15957,9 @@ class DataFormBase extends ComponentBaseWithButton {
|
|
|
15956
15957
|
}
|
|
15957
15958
|
showMessageAfterInsert(isSuccess = false, error) {
|
|
15958
15959
|
if (isSuccess) {
|
|
15960
|
+
if (!this.messageInsertSuccess) {
|
|
15961
|
+
this.messageInsertSuccess = this._translateService.instant('MESSAGE.INSERT_DATA_SUCCESS');
|
|
15962
|
+
}
|
|
15959
15963
|
if (this.messageInsertSuccess) {
|
|
15960
15964
|
this._notifierService.showSuccess(this.messageInsertSuccess);
|
|
15961
15965
|
}
|
|
@@ -15966,6 +15970,8 @@ class DataFormBase extends ComponentBaseWithButton {
|
|
|
15966
15970
|
}
|
|
15967
15971
|
showMessageAfterUpdate(isSuccess = false, error) {
|
|
15968
15972
|
if (isSuccess) {
|
|
15973
|
+
if (!this.messageUpdateSuccess)
|
|
15974
|
+
this.messageUpdateSuccess = this._translateService.instant('MESSAGE.UPDATE_DATA_SUCCESS');
|
|
15969
15975
|
if (this.messageUpdateSuccess) {
|
|
15970
15976
|
this._notifierService.showSuccess(this.messageUpdateSuccess);
|
|
15971
15977
|
}
|
|
@@ -21571,6 +21577,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21571
21577
|
this.lstBoolControl = [];
|
|
21572
21578
|
this.lstControlNotIn = [];
|
|
21573
21579
|
this.lstControlAddToGridInfo = [];
|
|
21580
|
+
this.lstControlLazyLoad = [];
|
|
21574
21581
|
this.defaultValues = {};
|
|
21575
21582
|
this.isAddDefaultValues = false;
|
|
21576
21583
|
this.mapControlBindingFilter = new Map();
|
|
@@ -21598,7 +21605,6 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21598
21605
|
this.searchBoxTooltip += `${(lstTextSearchControl.map(x => x.label)).join(', ')}`;
|
|
21599
21606
|
}
|
|
21600
21607
|
if (this.isCustomGenerateSearch) {
|
|
21601
|
-
this.lstControlAddToGridInfo = this.parentSetting.commonSchemas.filter(p => p.addToGridInfo).map(p => p.field);
|
|
21602
21608
|
this.parentSetting.commonSchemas.forEach(column => {
|
|
21603
21609
|
column.showLabel = false;
|
|
21604
21610
|
column.mdWidth = this.mdWidth;
|
|
@@ -21611,27 +21617,35 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21611
21617
|
if (column instanceof NumberRangeControlSchema) {
|
|
21612
21618
|
this.lstNumberRangeControl.push(column.field);
|
|
21613
21619
|
}
|
|
21620
|
+
if (column.hasOwnProperty('defaultValue') && (column instanceof DropdownControlSchema || column instanceof DateTimeControlSchema)) {
|
|
21621
|
+
this.defaultValues[column.field] = column.defaultValue;
|
|
21622
|
+
}
|
|
21623
|
+
if (column.addToGridInfo) {
|
|
21624
|
+
this.lstControlAddToGridInfo.push(column.field);
|
|
21625
|
+
}
|
|
21614
21626
|
});
|
|
21615
|
-
this.setting.schema = this.
|
|
21616
|
-
this.genFormSchema(this.parentSetting.commonSchemas);
|
|
21627
|
+
this.setting.schema = this.genFormSchema(this.parentSetting.commonSchemas);
|
|
21617
21628
|
}
|
|
21618
21629
|
else {
|
|
21619
21630
|
this.setting.schema = this.genFormSchema(columnFilters);
|
|
21620
21631
|
}
|
|
21621
21632
|
this.isDisableOpenFull = this.setting.schema.length <= 4 && !this._commonService.isMobile();
|
|
21622
21633
|
super.ngOnInit();
|
|
21623
|
-
|
|
21624
|
-
if (controlSetDefaultValue.length) {
|
|
21625
|
-
controlSetDefaultValue.forEach(item => {
|
|
21626
|
-
this.defaultValues[item.field] = item.defaultValue;
|
|
21627
|
-
});
|
|
21634
|
+
if (Object.keys(this.defaultValues).length) {
|
|
21628
21635
|
this.handleSearch();
|
|
21629
21636
|
}
|
|
21630
21637
|
}
|
|
21631
21638
|
genFormSchema(columns) {
|
|
21632
21639
|
const result = [];
|
|
21640
|
+
const totalControlPerRow = 12 / this.mdWidth;
|
|
21641
|
+
let i = 1;
|
|
21633
21642
|
columns.forEach(column => {
|
|
21634
21643
|
var _a;
|
|
21644
|
+
const isLazyLoad = !this.parentSetting.disableLazyLoadCommonSearch && i > totalControlPerRow
|
|
21645
|
+
&& column instanceof DropdownControlSchema && !!column.baseService && column.baseService instanceof BaseService;
|
|
21646
|
+
if (isLazyLoad) {
|
|
21647
|
+
this.lstControlLazyLoad.push(column.field);
|
|
21648
|
+
}
|
|
21635
21649
|
if (!column.isInTable || !column.includeSelect) {
|
|
21636
21650
|
this.lstControlNotIn.push(column.field);
|
|
21637
21651
|
}
|
|
@@ -21649,7 +21663,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21649
21663
|
});
|
|
21650
21664
|
}
|
|
21651
21665
|
if (column.baseService || (dataSource && dataSource.length > 0)) {
|
|
21652
|
-
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, showLabel: false,
|
|
21666
|
+
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, showLabel: false, isLazyLoad: isLazyLoad, showClear: true, onChanged: (evt) => {
|
|
21653
21667
|
var _a;
|
|
21654
21668
|
if (column.dataType == DataType.boolean) {
|
|
21655
21669
|
evt.parentModel[column.field] = column.single ? (_a = evt.value.id) !== null && _a !== void 0 ? _a : evt.value : evt.value.map(p => p.id);
|
|
@@ -21698,6 +21712,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21698
21712
|
break;
|
|
21699
21713
|
}
|
|
21700
21714
|
}
|
|
21715
|
+
i++;
|
|
21701
21716
|
});
|
|
21702
21717
|
return this.addSearchBox(result.sort((prev, next) => prev.order - next.order));
|
|
21703
21718
|
}
|
|
@@ -21710,7 +21725,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21710
21725
|
label: 'Từ khóa',
|
|
21711
21726
|
fullLabel: 'Từ khóa',
|
|
21712
21727
|
showLabel: false,
|
|
21713
|
-
mdWidth: this.mdWidth
|
|
21728
|
+
mdWidth: this.mdWidth,
|
|
21714
21729
|
});
|
|
21715
21730
|
const index = Number(12 / this.mdWidth) - 1;
|
|
21716
21731
|
if (this._commonService.isMobile()) {
|
|
@@ -21739,7 +21754,7 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21739
21754
|
data = Object.assign(data, this.defaultValues);
|
|
21740
21755
|
this.isAddDefaultValues = true;
|
|
21741
21756
|
}
|
|
21742
|
-
|
|
21757
|
+
const lstFilters = this._crudService.getFilterFromTemplate(this.templateFilter, data);
|
|
21743
21758
|
const lstFilterAddCustom = lstFilters.filter(p => this.lstControlAddToGridInfo.includes(p.field));
|
|
21744
21759
|
if (this.isCustomGenerateSearch) {
|
|
21745
21760
|
const rs = {
|
|
@@ -21809,8 +21824,19 @@ class CommonSearchFormComponent extends DataFormBase {
|
|
|
21809
21824
|
}
|
|
21810
21825
|
toggleMenuSearch() {
|
|
21811
21826
|
this.isOpenFull = !this.isOpenFull;
|
|
21827
|
+
if (this.lstControlLazyLoad.length) {
|
|
21828
|
+
this.triggerLazyLoadDropdown();
|
|
21829
|
+
}
|
|
21812
21830
|
this.onAfterToggleMenuSearch.emit(true);
|
|
21813
21831
|
}
|
|
21832
|
+
triggerLazyLoadDropdown() {
|
|
21833
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21834
|
+
const promises = [];
|
|
21835
|
+
this.lstControlLazyLoad.forEach(control => promises.push(this.formControls[control]._component._getDataSource()));
|
|
21836
|
+
yield Promise.all(promises);
|
|
21837
|
+
this.lstControlLazyLoad = [];
|
|
21838
|
+
});
|
|
21839
|
+
}
|
|
21814
21840
|
onFormInitialized(formEvent) {
|
|
21815
21841
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21816
21842
|
// tiền xử lý dữ liệu (ví dụ tổng hợp datasource), trước khi gọi api get detail
|
|
@@ -27604,7 +27630,7 @@ class DropdownComponent extends ComponentBase {
|
|
|
27604
27630
|
this.createFilterFunction();
|
|
27605
27631
|
this.createSearchSubscription();
|
|
27606
27632
|
}
|
|
27607
|
-
if (this.control.loadOnInit) {
|
|
27633
|
+
if (this.control.loadOnInit && !this.control.isLazyLoad) {
|
|
27608
27634
|
this._getData();
|
|
27609
27635
|
}
|
|
27610
27636
|
}
|