tnx-shared 5.3.289 → 5.3.291
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 +93 -60
- 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/list-base.d.ts +5 -4
- package/classes/base/list-base.d.ts.map +1 -1
- package/esm2015/classes/base/list-base.js +67 -52
- package/fesm2015/tnx-shared.js +66 -51
- 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
|
@@ -23649,7 +23649,7 @@ class ListBase extends ComponentBaseWithButton {
|
|
|
23649
23649
|
}
|
|
23650
23650
|
_edit(rowData, scopeDataEdit = {}) {
|
|
23651
23651
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23652
|
-
const resultValidate = yield this.validateEdit();
|
|
23652
|
+
const resultValidate = yield this.validateEdit(rowData);
|
|
23653
23653
|
if (!resultValidate) {
|
|
23654
23654
|
return;
|
|
23655
23655
|
}
|
|
@@ -23666,7 +23666,7 @@ class ListBase extends ComponentBaseWithButton {
|
|
|
23666
23666
|
this.showDetailForm = true;
|
|
23667
23667
|
});
|
|
23668
23668
|
}
|
|
23669
|
-
validateEdit() {
|
|
23669
|
+
validateEdit(rowData) {
|
|
23670
23670
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23671
23671
|
return true;
|
|
23672
23672
|
});
|
|
@@ -23690,34 +23690,45 @@ class ListBase extends ComponentBaseWithButton {
|
|
|
23690
23690
|
getPromiseDeleteItem(rowData) {
|
|
23691
23691
|
return this.setting.baseService.delete(rowData.id, this.deletePlusUrl);
|
|
23692
23692
|
}
|
|
23693
|
+
validateDelete(items) {
|
|
23694
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23695
|
+
return true;
|
|
23696
|
+
});
|
|
23697
|
+
}
|
|
23693
23698
|
_delete(rowData) {
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
}
|
|
23697
|
-
this._notifierService.showDeleteConfirm().then(rs => {
|
|
23698
|
-
if (!rs) {
|
|
23699
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23700
|
+
if (rowData.__disableDelete) {
|
|
23699
23701
|
return;
|
|
23700
23702
|
}
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23703
|
+
const resultValidate = yield this.validateDelete([rowData]);
|
|
23704
|
+
if (!resultValidate) {
|
|
23705
|
+
return;
|
|
23706
|
+
}
|
|
23707
|
+
this._notifierService.showDeleteConfirm().then(rs => {
|
|
23708
|
+
if (!rs) {
|
|
23709
|
+
return;
|
|
23710
|
+
}
|
|
23711
|
+
if (this.setting.baseService) {
|
|
23712
|
+
this.getPromiseDeleteItem(rowData)
|
|
23713
|
+
.then(response => {
|
|
23714
|
+
if (response.success) {
|
|
23715
|
+
this.beforeReloadAfterDelete([rowData.id]);
|
|
23716
|
+
if (this.setting.showVersionButton) {
|
|
23717
|
+
this.context.fireEvent(ComCtxConstants.COMMON.RELOAD_DATA_VERSION, {}, true);
|
|
23718
|
+
}
|
|
23719
|
+
else {
|
|
23720
|
+
this._triggerProcessData();
|
|
23721
|
+
}
|
|
23722
|
+
this._notifierService.showDeleteDataSuccess();
|
|
23708
23723
|
}
|
|
23709
23724
|
else {
|
|
23710
|
-
this.
|
|
23725
|
+
this._notifierService.showWarningByResponse(response);
|
|
23711
23726
|
}
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
}, error => {
|
|
23718
|
-
this._notifierService.showDeleteDataError();
|
|
23719
|
-
});
|
|
23720
|
-
}
|
|
23727
|
+
}, error => {
|
|
23728
|
+
this._notifierService.showDeleteDataError();
|
|
23729
|
+
});
|
|
23730
|
+
}
|
|
23731
|
+
});
|
|
23721
23732
|
});
|
|
23722
23733
|
}
|
|
23723
23734
|
getPromiseDeleteItems(items) {
|
|
@@ -23725,22 +23736,28 @@ class ListBase extends ComponentBaseWithButton {
|
|
|
23725
23736
|
return this.setting.baseService.deleteMany(ids, this.deleteManyPlusUrl);
|
|
23726
23737
|
}
|
|
23727
23738
|
_deleteMultiple(items) {
|
|
23728
|
-
this
|
|
23729
|
-
|
|
23739
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23740
|
+
const resultValidate = yield this.validateDelete(items);
|
|
23741
|
+
if (!resultValidate) {
|
|
23730
23742
|
return;
|
|
23731
23743
|
}
|
|
23732
|
-
|
|
23733
|
-
|
|
23734
|
-
|
|
23735
|
-
|
|
23736
|
-
|
|
23737
|
-
|
|
23738
|
-
|
|
23739
|
-
|
|
23740
|
-
|
|
23741
|
-
|
|
23742
|
-
|
|
23743
|
-
|
|
23744
|
+
this._notifierService.showDeleteConfirm('Bạn có chắc chắn muốn xóa bản ghi đã chọn (Và các bản ghi con tương ứng)?').then(rs => {
|
|
23745
|
+
if (!rs) {
|
|
23746
|
+
return;
|
|
23747
|
+
}
|
|
23748
|
+
if (this.setting.baseService) {
|
|
23749
|
+
this.getPromiseDeleteItems(items).then(response => {
|
|
23750
|
+
if (response.success) {
|
|
23751
|
+
this.beforeReloadAfterDelete(items.map(q => q.id));
|
|
23752
|
+
this._triggerProcessData();
|
|
23753
|
+
this._notifierService.showDeleteDataSuccess();
|
|
23754
|
+
}
|
|
23755
|
+
else {
|
|
23756
|
+
this._notifierService.showWarningByResponse(response);
|
|
23757
|
+
}
|
|
23758
|
+
});
|
|
23759
|
+
}
|
|
23760
|
+
});
|
|
23744
23761
|
});
|
|
23745
23762
|
}
|
|
23746
23763
|
beforeReloadAfterDelete(ids) {
|
|
@@ -23765,25 +23782,23 @@ class ListBase extends ComponentBaseWithButton {
|
|
|
23765
23782
|
var _a;
|
|
23766
23783
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23767
23784
|
const lstData = (_a = (yield this.setting.baseService.getDataCustomRoute(this.plusUrl, this.currentGridInfo.filters, this.currentGridInfo.fields, this.currentGridInfo.sorts, -1, 1)).data) !== null && _a !== void 0 ? _a : [];
|
|
23768
|
-
|
|
23785
|
+
const lstVisibleField = this.setting.cols
|
|
23786
|
+
.filter(item => item.visible && item.dataType !== 'trangThaiV5')
|
|
23787
|
+
.map(item => item.field);
|
|
23788
|
+
yield this.beforeExportAllData(lstData, lstVisibleField);
|
|
23769
23789
|
yield this._crudService.getRefDataInDatasource(lstData, this.setting.fieldNeedGetRef);
|
|
23770
|
-
const lstVisibleField = this.setting.cols.filter(item => item.visible && item.dataType != 'trangThaiV5').map(item => {
|
|
23771
|
-
if (item.controlType == 'dropdown' && item.field.startsWith('str')) {
|
|
23772
|
-
return item.field.slice(3);
|
|
23773
|
-
}
|
|
23774
|
-
return item.field;
|
|
23775
|
-
});
|
|
23776
23790
|
const lstHeader = ['TT'];
|
|
23777
|
-
|
|
23778
|
-
|
|
23779
|
-
|
|
23791
|
+
const fieldSchemaMap = new Map(this.setting.modelSchemas.map(schema => [schema.field, schema.name]));
|
|
23792
|
+
lstVisibleField.forEach(field => {
|
|
23793
|
+
const schemaName = fieldSchemaMap.get(field) || fieldSchemaMap.get(field.slice(3)) || "";
|
|
23794
|
+
lstHeader.push(schemaName);
|
|
23780
23795
|
});
|
|
23781
23796
|
const printData = [
|
|
23782
23797
|
lstHeader,
|
|
23783
23798
|
...lstData.map((item, index) => {
|
|
23784
23799
|
const row = [index + 1];
|
|
23785
|
-
|
|
23786
|
-
row.push(item[
|
|
23800
|
+
lstVisibleField.forEach(field => {
|
|
23801
|
+
row.push(item[field]);
|
|
23787
23802
|
});
|
|
23788
23803
|
return row;
|
|
23789
23804
|
})
|
|
@@ -23791,7 +23806,7 @@ class ListBase extends ComponentBaseWithButton {
|
|
|
23791
23806
|
this._exportService.objectToExcel(printData, 'Danh sách ' + this.setting.objectName, 1);
|
|
23792
23807
|
});
|
|
23793
23808
|
}
|
|
23794
|
-
beforeExportAllData(dataSource) {
|
|
23809
|
+
beforeExportAllData(dataSource, lstVisibleField) {
|
|
23795
23810
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23796
23811
|
});
|
|
23797
23812
|
}
|