tnx-shared 5.3.216 → 5.3.217
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 +264 -72
- 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-component-base.d.ts +6 -0
- package/classes/base/list-component-base.d.ts.map +1 -1
- package/esm2015/classes/base/list-component-base.js +184 -20
- package/esm2015/services/export.service.js +3 -3
- package/fesm2015/tnx-shared.js +185 -21
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/services/export.service.d.ts +1 -1
- package/services/export.service.d.ts.map +1 -1
- package/tnx-shared.metadata.json +1 -1
|
@@ -19,9 +19,9 @@ export class ExportService {
|
|
|
19
19
|
this.environment = this._moduleConfig.environment;
|
|
20
20
|
this.serviceUri = `${this._moduleConfig.environment.apiDomain.templateEndpoint}/Export`;
|
|
21
21
|
}
|
|
22
|
-
objectToExcel(data, fileName) {
|
|
22
|
+
objectToExcel(data, fileName, numOfHeaderRow) {
|
|
23
23
|
return this._http
|
|
24
|
-
.post(`${this.serviceUri}/ObjectToExcel`, data, { responseType: 'blob' })
|
|
24
|
+
.post(`${this.serviceUri}/ObjectToExcel?numOfHeaderRow=${numOfHeaderRow}`, data, { responseType: 'blob' })
|
|
25
25
|
.pipe(catchError((err) => this._commonService.handleError(err, this._injector)))
|
|
26
26
|
.subscribe(res => {
|
|
27
27
|
this.saveAsExcelFile(res, fileName);
|
|
@@ -52,4 +52,4 @@ ExportService.ctorParameters = () => [
|
|
|
52
52
|
{ type: CommonService },
|
|
53
53
|
{ type: ModuleConfigService }
|
|
54
54
|
];
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
55
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhwb3J0LnNlcnZpY2UuanMiLC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ogSHR0cEVycm9yUmVzcG9uc2UpID0+IHRoaXMuX2NvbW1vblNlcnZpY2UuaGFuZGxlRXJyb3IoZXJyLCB0aGlzLl9pbmplY3RvcikpKVxuICAgICAgICAgICAgLnN1YnNjcmliZShyZXMgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMuc2F2ZUFzRXhjZWxGaWxlKHJlcywgZmlsZU5hbWUpO1xuICAgICAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgc2F2ZUFzRXhjZWxGaWxlKGJ1ZmZlcjogYW55LCBmaWxlTmFtZTogc3RyaW5nKTogdm9pZCB7XG4gICAgICAgIGNvbnN0IGRhdGE6IEJsb2IgPSBuZXcgQmxvYihbYnVmZmVyXSwge1xuICAgICAgICAgICAgdHlwZTogRVhDRUxfVFlQRVxuICAgICAgICB9KTtcbiAgICAgICAgRmlsZVNhdmVyLnNhdmVBcyhkYXRhLCBmaWxlTmFtZSArICdfJyArIG5ldyBEYXRlKCkuZ2V0VGltZSgpICsgRVhDRUxfRVhURU5TSU9OKTtcbiAgICB9XG5cbiAgICBzYXZlU3ByZWFkU2hlZXQoYnVmZmVyOiBhbnksIGZpbGVOYW1lOiBzdHJpbmcpOiB2b2lkIHtcbiAgICAgICAgY29uc3QgZGF0YTogQmxvYiA9IG5ldyBCbG9iKFtidWZmZXJdLCB7XG4gICAgICAgICAgICB0eXBlOiBFWENFTF9UWVBFXG4gICAgICAgIH0pO1xuICAgICAgICBGaWxlU2F2ZXIuc2F2ZUFzKGRhdGEsIG5ldyBEYXRlKCkuZ2V0VGltZSgpICsgJ18nICsgZmlsZU5hbWUpO1xuICAgIH1cbn1cbiJdfQ==
|
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -16412,9 +16412,9 @@ class ExportService {
|
|
|
16412
16412
|
this.environment = this._moduleConfig.environment;
|
|
16413
16413
|
this.serviceUri = `${this._moduleConfig.environment.apiDomain.templateEndpoint}/Export`;
|
|
16414
16414
|
}
|
|
16415
|
-
objectToExcel(data, fileName) {
|
|
16415
|
+
objectToExcel(data, fileName, numOfHeaderRow) {
|
|
16416
16416
|
return this._http
|
|
16417
|
-
.post(`${this.serviceUri}/ObjectToExcel`, data, { responseType: 'blob' })
|
|
16417
|
+
.post(`${this.serviceUri}/ObjectToExcel?numOfHeaderRow=${numOfHeaderRow}`, data, { responseType: 'blob' })
|
|
16418
16418
|
.pipe(catchError((err) => this._commonService.handleError(err, this._injector)))
|
|
16419
16419
|
.subscribe(res => {
|
|
16420
16420
|
this.saveAsExcelFile(res, fileName);
|
|
@@ -19492,9 +19492,12 @@ class ListComponentBase extends ComponentBase {
|
|
|
19492
19492
|
const tableEle = element.querySelector('table');
|
|
19493
19493
|
const headEle = tableEle.querySelector('thead');
|
|
19494
19494
|
const bodyEle = tableEle.querySelector('tbody');
|
|
19495
|
-
const arrHeadEle = this.getArrHeadByHtml(headEle);
|
|
19496
|
-
const
|
|
19497
|
-
const
|
|
19495
|
+
// const arrHeadEle = this.getArrHeadByHtml(headEle);
|
|
19496
|
+
const arrHeadEle = this.getArrHeadByHtmlForPrint(headEle);
|
|
19497
|
+
const firstHead = arrHeadEle.allCol;
|
|
19498
|
+
const arrRowData = this.getArrRowDataByHtml(bodyEle, firstHead);
|
|
19499
|
+
// const strHeadEle = this.headHtmlToString(arrHeadEle);
|
|
19500
|
+
const strHeadEle = this.headHtmlToStringNew(arrHeadEle.header);
|
|
19498
19501
|
const strBodyEle = this.rowDataHtmlToString(arrRowData);
|
|
19499
19502
|
const css = '<style type="text/css">table th, table td {border:1px solid #000;} table th {text-align: center;} table {width: 100%;border-collapse: collapse;} table td:first-child {text-align: center;}</style>';
|
|
19500
19503
|
const table = `${css}<table>${strHeadEle}${strBodyEle}</table>`;
|
|
@@ -19507,9 +19510,12 @@ class ListComponentBase extends ComponentBase {
|
|
|
19507
19510
|
const tableEle = element.querySelector('table');
|
|
19508
19511
|
const headEle = tableEle.querySelector('thead');
|
|
19509
19512
|
const bodyEle = tableEle.querySelector('tbody');
|
|
19510
|
-
const arrHeadEle = this.getArrHeadByHtml(headEle);
|
|
19511
|
-
const
|
|
19512
|
-
const
|
|
19513
|
+
// const arrHeadEle = this.getArrHeadByHtml(headEle);
|
|
19514
|
+
const arrHeadEle = this.getArrHeadByHtmlForPrint(headEle);
|
|
19515
|
+
const firstHead = arrHeadEle.allCol;
|
|
19516
|
+
const arrRowData = this.getArrRowDataHasRowSpanByHtml(bodyEle, firstHead);
|
|
19517
|
+
// const strHeadEle = this.headHtmlToString(arrHeadEle);
|
|
19518
|
+
const strHeadEle = this.headHtmlToStringNew(arrHeadEle);
|
|
19513
19519
|
const strBodyEle = this.rowDataHtmlHasRowSpanToString(arrRowData);
|
|
19514
19520
|
const css = '<style type="text/css">table th, table td {border:1px solid #000;} table th {text-align: center;} table {width: 100%;border-collapse: collapse;} table td:first-child {text-align: center;}</style>';
|
|
19515
19521
|
const table = `${css}<table>${strHeadEle}${strBodyEle}</table>`;
|
|
@@ -19519,6 +19525,7 @@ class ListComponentBase extends ComponentBase {
|
|
|
19519
19525
|
this.exportByReadingHtml(true, isTree);
|
|
19520
19526
|
}
|
|
19521
19527
|
exportByReadingHtml(exportAll = false, isTree = false) {
|
|
19528
|
+
var _a;
|
|
19522
19529
|
if (this._groupField) {
|
|
19523
19530
|
this._notifierService.showWarning('Chưa hỗ trợ xuất có nhóm dữ liệu!');
|
|
19524
19531
|
return;
|
|
@@ -19528,16 +19535,21 @@ class ListComponentBase extends ComponentBase {
|
|
|
19528
19535
|
const headEle = tableEle.querySelector('thead');
|
|
19529
19536
|
const bodyEle = tableEle.querySelector('tbody');
|
|
19530
19537
|
// header.
|
|
19531
|
-
const arrHead = this.getArrHeadByHtml(headEle);
|
|
19532
|
-
|
|
19538
|
+
// const arrHead = this.getArrHeadByHtml(headEle);
|
|
19539
|
+
let arrHead = this.getArrHeadByHtmlNew(headEle);
|
|
19540
|
+
if (!(arrHead === null || arrHead === void 0 ? void 0 : arrHead.length)) {
|
|
19533
19541
|
return;
|
|
19534
19542
|
}
|
|
19535
19543
|
// body.
|
|
19536
|
-
const
|
|
19544
|
+
const firstHead = arrHead[0];
|
|
19545
|
+
// const arrRowData = this.getArrRowDataByHtml(bodyEle, arrHead, exportAll);
|
|
19546
|
+
const arrRowData = this.getArrRowDataByHtml(bodyEle, firstHead, exportAll);
|
|
19537
19547
|
// export.
|
|
19538
|
-
|
|
19548
|
+
arrHead = arrHead.map(x => x.map(z => z.value));
|
|
19549
|
+
// const dataExport = [arrHead.map(i => i.value), ...arrRowData];
|
|
19550
|
+
const dataExport = [...arrHead, ...arrRowData];
|
|
19539
19551
|
const fileName = `Danh sách ${this.setting.objectName}`;
|
|
19540
|
-
this._exportService.objectToExcel(dataExport, fileName);
|
|
19552
|
+
this._exportService.objectToExcel(dataExport, fileName, (_a = arrHead === null || arrHead === void 0 ? void 0 : arrHead.length) !== null && _a !== void 0 ? _a : 1);
|
|
19541
19553
|
}
|
|
19542
19554
|
headHtmlToString(arrHeadEle) {
|
|
19543
19555
|
let result = '';
|
|
@@ -19546,12 +19558,28 @@ class ListComponentBase extends ComponentBase {
|
|
|
19546
19558
|
});
|
|
19547
19559
|
return result;
|
|
19548
19560
|
}
|
|
19561
|
+
headHtmlToStringNew(arrHeadEle) {
|
|
19562
|
+
let result = '';
|
|
19563
|
+
for (const itemHeader of arrHeadEle) {
|
|
19564
|
+
result += '<tr>';
|
|
19565
|
+
for (const itemTh of itemHeader) {
|
|
19566
|
+
result += `<th colSpan="${itemTh.colSpan}" rowSpan="${itemTh.rowSpan}">${itemTh.value}</th>`;
|
|
19567
|
+
}
|
|
19568
|
+
result += '</tr>';
|
|
19569
|
+
}
|
|
19570
|
+
return result;
|
|
19571
|
+
}
|
|
19549
19572
|
rowDataHtmlToString(rowDatas) {
|
|
19550
19573
|
const arrRowData = [];
|
|
19551
|
-
rowDatas.forEach(arrRowDataChild => {
|
|
19574
|
+
rowDatas.forEach((arrRowDataChild, indexChild) => {
|
|
19552
19575
|
let rowData = '<tr>';
|
|
19553
|
-
arrRowDataChild.forEach(element => {
|
|
19554
|
-
|
|
19576
|
+
arrRowDataChild.forEach((element, index) => {
|
|
19577
|
+
if (index == 0 && !this.setting.hiddenOrderColumn) {
|
|
19578
|
+
rowData += `<td>${indexChild + 1}</td>`;
|
|
19579
|
+
}
|
|
19580
|
+
else {
|
|
19581
|
+
rowData += `<td>${element}</td>`;
|
|
19582
|
+
}
|
|
19555
19583
|
});
|
|
19556
19584
|
rowData += '</tr>';
|
|
19557
19585
|
arrRowData.push(rowData);
|
|
@@ -19580,6 +19608,136 @@ class ListComponentBase extends ComponentBase {
|
|
|
19580
19608
|
}
|
|
19581
19609
|
return arrHeader;
|
|
19582
19610
|
}
|
|
19611
|
+
getArrHeadByHtmlNew(header) {
|
|
19612
|
+
var _a, _b, _c;
|
|
19613
|
+
const filter = Array.prototype.filter;
|
|
19614
|
+
const allRow = header.querySelectorAll('tr');
|
|
19615
|
+
const lstRow = filter.call(allRow, function (node) {
|
|
19616
|
+
return !node.className.includes('filter-row');
|
|
19617
|
+
});
|
|
19618
|
+
const result = [];
|
|
19619
|
+
const allTh = [];
|
|
19620
|
+
for (const item of lstRow) {
|
|
19621
|
+
allTh.push(item.querySelectorAll('th'));
|
|
19622
|
+
}
|
|
19623
|
+
const maxColSize = allTh.reduce((a, b) => {
|
|
19624
|
+
const newArr = [...b];
|
|
19625
|
+
const result = newArr.reduce((x, y) => y.colSpan + x, 0);
|
|
19626
|
+
return result > a ? result : a;
|
|
19627
|
+
}, 0);
|
|
19628
|
+
const startIndex = this.setting.hiddenCheckbox ? 0 : 1;
|
|
19629
|
+
const endIndex = maxColSize - (this.setting.hiddenFunctionColumn ? 1 : 2);
|
|
19630
|
+
for (let ind = 0; ind < lstRow.length; ind++) {
|
|
19631
|
+
const arrTh = [...allTh[ind]];
|
|
19632
|
+
if (startIndex > endIndex) {
|
|
19633
|
+
return null;
|
|
19634
|
+
}
|
|
19635
|
+
result[ind] = (_a = result[ind]) !== null && _a !== void 0 ? _a : [];
|
|
19636
|
+
let colIndex = 0;
|
|
19637
|
+
const numOfColSpan = arrTh.reduce((x, y) => x + y.colSpan - 1, 0);
|
|
19638
|
+
for (let i = startIndex; i <= endIndex - numOfColSpan; i++) {
|
|
19639
|
+
if (arrTh[i]) {
|
|
19640
|
+
if (arrTh[i].rowSpan && arrTh[i].rowSpan > 1) {
|
|
19641
|
+
for (let j = 1; j < arrTh[i].rowSpan; j++) {
|
|
19642
|
+
result[ind + j] = (_b = result[ind + j]) !== null && _b !== void 0 ? _b : [];
|
|
19643
|
+
if (result[ind + j][colIndex] == null || result[ind + j][colIndex] == undefined) {
|
|
19644
|
+
result[ind + j][colIndex] = {
|
|
19645
|
+
index: i,
|
|
19646
|
+
value: ''
|
|
19647
|
+
};
|
|
19648
|
+
}
|
|
19649
|
+
}
|
|
19650
|
+
}
|
|
19651
|
+
if (arrTh[i].colSpan && arrTh[i].colSpan > 1) {
|
|
19652
|
+
for (let j = 0; j < arrTh[i].colSpan; j++) {
|
|
19653
|
+
if (result[ind][colIndex] == null || result[ind][colIndex] == undefined) {
|
|
19654
|
+
result[ind][colIndex] = {
|
|
19655
|
+
index: colIndex + startIndex,
|
|
19656
|
+
value: j == 0 ? arrTh[i].innerText : ''
|
|
19657
|
+
};
|
|
19658
|
+
}
|
|
19659
|
+
for (let k = ind + 1; k < lstRow.length; k++) {
|
|
19660
|
+
const otherRow = [...allTh[k]];
|
|
19661
|
+
result[ind + k] = (_c = result[ind + k]) !== null && _c !== void 0 ? _c : [];
|
|
19662
|
+
if (!result[ind + k][colIndex]) {
|
|
19663
|
+
result[ind + k][colIndex] = {
|
|
19664
|
+
index: colIndex + startIndex,
|
|
19665
|
+
value: otherRow[j].innerText
|
|
19666
|
+
};
|
|
19667
|
+
}
|
|
19668
|
+
}
|
|
19669
|
+
colIndex++;
|
|
19670
|
+
}
|
|
19671
|
+
}
|
|
19672
|
+
else {
|
|
19673
|
+
if (result[ind][colIndex] == null || result[ind][colIndex] == undefined) {
|
|
19674
|
+
result[ind][colIndex] = {
|
|
19675
|
+
index: colIndex + startIndex,
|
|
19676
|
+
value: arrTh[i].innerText
|
|
19677
|
+
};
|
|
19678
|
+
}
|
|
19679
|
+
colIndex++;
|
|
19680
|
+
}
|
|
19681
|
+
}
|
|
19682
|
+
else {
|
|
19683
|
+
if (result[ind][colIndex] == null || result[ind][colIndex] == undefined) {
|
|
19684
|
+
result[ind][colIndex] = {
|
|
19685
|
+
index: colIndex + startIndex,
|
|
19686
|
+
value: ''
|
|
19687
|
+
};
|
|
19688
|
+
}
|
|
19689
|
+
colIndex++;
|
|
19690
|
+
}
|
|
19691
|
+
}
|
|
19692
|
+
}
|
|
19693
|
+
return result;
|
|
19694
|
+
}
|
|
19695
|
+
getArrHeadByHtmlForPrint(header) {
|
|
19696
|
+
const filter = Array.prototype.filter;
|
|
19697
|
+
const allRow = header.querySelectorAll('tr');
|
|
19698
|
+
const lstRow = [...filter.call(allRow, function (node) {
|
|
19699
|
+
return !node.className.includes('filter-row');
|
|
19700
|
+
})];
|
|
19701
|
+
const result = {
|
|
19702
|
+
allCol: [],
|
|
19703
|
+
header: []
|
|
19704
|
+
};
|
|
19705
|
+
for (let ind = 0; ind < lstRow.length; ind++) {
|
|
19706
|
+
const lstCell = [...lstRow[ind].querySelectorAll('th')];
|
|
19707
|
+
const startIndex = this.setting.hiddenCheckbox || ind != 0 ? 0 : 1;
|
|
19708
|
+
let colIndex = startIndex;
|
|
19709
|
+
const itemHeader = [];
|
|
19710
|
+
const endIndex = lstCell.length - (this.setting.hiddenFunctionColumn || ind != 0 ? 1 : 2);
|
|
19711
|
+
for (let i = startIndex; i <= endIndex; i++) {
|
|
19712
|
+
if (ind == 0) {
|
|
19713
|
+
if (lstCell[i].colSpan && lstCell[i].colSpan > 1) {
|
|
19714
|
+
for (let j = 0; j < lstCell[i].colSpan; j++) {
|
|
19715
|
+
result.allCol.push({
|
|
19716
|
+
index: colIndex,
|
|
19717
|
+
value: ''
|
|
19718
|
+
});
|
|
19719
|
+
colIndex++;
|
|
19720
|
+
}
|
|
19721
|
+
}
|
|
19722
|
+
else {
|
|
19723
|
+
result.allCol.push({
|
|
19724
|
+
index: colIndex,
|
|
19725
|
+
value: ''
|
|
19726
|
+
});
|
|
19727
|
+
colIndex++;
|
|
19728
|
+
}
|
|
19729
|
+
}
|
|
19730
|
+
itemHeader.push({
|
|
19731
|
+
index: i,
|
|
19732
|
+
value: lstCell[i].innerText,
|
|
19733
|
+
colSpan: lstCell[i].colSpan,
|
|
19734
|
+
rowSpan: lstCell[i].rowSpan
|
|
19735
|
+
});
|
|
19736
|
+
}
|
|
19737
|
+
result.header.push(itemHeader);
|
|
19738
|
+
}
|
|
19739
|
+
return result;
|
|
19740
|
+
}
|
|
19583
19741
|
getArrRowDataHasRowSpanByHtml(bodyEle, arrHead, exportAll = false) {
|
|
19584
19742
|
const arrRow = exportAll ? bodyEle.querySelectorAll('tr') : bodyEle.querySelectorAll('tr.ui-state-highlight');
|
|
19585
19743
|
if (!arrRow.length) {
|
|
@@ -19611,22 +19769,28 @@ class ListComponentBase extends ComponentBase {
|
|
|
19611
19769
|
return [];
|
|
19612
19770
|
}
|
|
19613
19771
|
const arrRowData = [];
|
|
19614
|
-
for (
|
|
19615
|
-
|
|
19772
|
+
// for (const element of arrRow) {
|
|
19773
|
+
arrRow.forEach((rowElement, indexRow) => {
|
|
19774
|
+
const row = rowElement;
|
|
19616
19775
|
const arrTd = row.querySelectorAll('td');
|
|
19617
19776
|
let currentTd;
|
|
19618
19777
|
const rowData = [];
|
|
19619
|
-
arrHead.forEach(head => {
|
|
19778
|
+
arrHead.forEach((head, index) => {
|
|
19620
19779
|
currentTd = arrTd[head.index];
|
|
19621
19780
|
if (currentTd.innerText === '') {
|
|
19622
19781
|
rowData.push(this.getValueCheckboxFormat(currentTd));
|
|
19623
19782
|
}
|
|
19624
19783
|
else {
|
|
19625
|
-
|
|
19784
|
+
if (index == 0 && !this.setting.hiddenOrderColumn) {
|
|
19785
|
+
rowData.push(indexRow + 1);
|
|
19786
|
+
}
|
|
19787
|
+
else {
|
|
19788
|
+
rowData.push(currentTd.innerText);
|
|
19789
|
+
}
|
|
19626
19790
|
}
|
|
19627
19791
|
});
|
|
19628
19792
|
arrRowData.push(rowData);
|
|
19629
|
-
}
|
|
19793
|
+
});
|
|
19630
19794
|
return arrRowData;
|
|
19631
19795
|
}
|
|
19632
19796
|
getValueCheckboxFormat(data) {
|