Skip to content

Commit

Permalink
fix(abc:st): fix invalid title in export (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Aug 30, 2019
1 parent b6c1fc6 commit 48ca08f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/abc/table/demo/render.md
Expand Up @@ -25,11 +25,11 @@ import { STColumn } from '@delon/abc';
selector: 'app-demo',
template: `
<div class="mb-md">
<nz-checkbox-group [(ngModel)]="customColumns" (ngModelChange)="st.resetColumns({ emitReload: false })"></nz-checkbox-group>
<nz-checkbox-group [(ngModel)]="customColumns" (ngModelChange)="st.resetColumns({ emitReload: true })"></nz-checkbox-group>
</div>
<st #st [data]="users" [columns]="columns">
<ng-template st-row="customTitle" type="title" let-c>
{{ c.title }}
{{ c.title.text }}
<span nz-dropdown [nzDropdownMenu]="menuTpl" nzTrigger="click" [nzClickHide]="false" nzPlacement="bottomRight">
<i nz-icon nzType="down"></i>
</span>
Expand Down
4 changes: 2 additions & 2 deletions packages/abc/table/table-export.ts
@@ -1,7 +1,6 @@
import { Injectable, Optional } from '@angular/core';
import { XlsxService } from '@delon/abc/xlsx';
import { deepGet } from '@delon/util';

import { STColumn, STExportOptions } from './table.interfaces';

@Injectable()
Expand Down Expand Up @@ -41,9 +40,10 @@ export class STExport {

// column
for (let i = 0; i < cc; i++) {
const tit = colData[i].title;
sheet[`${String.fromCharCode(i + 65)}1`] = {
t: 's',
v: colData[i].title,
v: typeof tit === 'object' ? tit.text : tit,
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/abc/table/test/table-export.spec.ts
Expand Up @@ -11,7 +11,7 @@ class MockXlsxService {
}
const columns: STColumn[] = [
{ title: 'id', index: ['id'], type: 'checkbox' },
{ title: 'name', index: ['name'] },
{ title: { text: 'name' }, index: ['name'] },
{ title: 'img', index: ['img'], type: 'img', exported: false },
{ title: 'currency', index: ['currency'], type: 'currency' },
{ title: 'date', index: ['date'], type: 'date' },
Expand Down

0 comments on commit 48ca08f

Please sign in to comment.