Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Sep 17, 2023
1 parent 2baa9b8 commit 13632e8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
19 changes: 10 additions & 9 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import jsPDF from 'jspdf'
let vxetable: VXETableCore

declare module 'vxe-table' {
namespace VxeTablePropTypes {
interface ExportConfig {
export namespace VxeTablePropTypes {
export interface ExportConfig {
fontName?: string;
}
}
Expand Down Expand Up @@ -174,23 +174,24 @@ function pluginSetup (options: VXETablePluginExportPDFOptions) {
}

/**
* 基于 vxe-table 表格的增强插件,支持导出 pdf 格式
* 基于 vxe-table 表格的扩展插件,支持导出 pdf 格式
*/
export const VXETablePluginExportPDF = {
setup: pluginSetup,
install (vxetablecore: VXETableCore, options?: VXETablePluginExportPDFOptions) {
const { setup, interceptor } = vxetablecore

vxetable = vxetablecore
install (vxetable: VXETableCore, options?: VXETablePluginExportPDFOptions) {
// 检查版本
if (!/^(4)\./.test(vxetable.version)) {
console.error('[vxe-table-plugin-export-pdf] Version vxe-table 4.x is required')
}

setup({
vxetable.setup({
export: {
types: {
pdf: 1
}
}
})
interceptor.mixin({
vxetable.interceptor.mixin({
'event.export': handleExportEvent
})
if (options) {
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "vxe-table-plugin-export-pdf",
"version": "3.0.6",
"description": "基于 vxe-table 的表格插件,支持导出 pdf 格式",
"version": "3.1.0",
"description": "基于 vxe-table 表格的扩展插件,支持导出 pdf 格式",
"scripts": {
"lib": "gulp build"
},
"files": [
"types",
"fonts/source-han-sans-bold.js",
"fonts/source-han-sans-normal.js",
"dist",
Expand All @@ -16,7 +17,7 @@
"unpkg": "dist/index.umd.js",
"jsdelivr": "dist/index.umd.js",
"style": "dist/style.css",
"typings": "index.ts",
"typings": "types/index.d.ts",
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/plugin-transform-runtime": "^7.12.1",
Expand Down Expand Up @@ -52,11 +53,11 @@
"sass": "^1.55.0",
"typescript": "^4.6.4",
"vue": "^3.3.4",
"vxe-table": "^4.4.6",
"xe-utils": "^3.5.11"
"vxe-table": "^4.5.10",
"xe-utils": "^3.5.13"
},
"peerDependencies": {
"vxe-table": "^4.0.27"
"vxe-table": "^4.5.0"
},
"repository": {
"type": "git",
Expand Down
22 changes: 22 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { VXETableCore } from 'vxe-table'

interface VXETablePluginExportPDFFonts {
fontName: string;
fontStyle?: 'normal';
fontUrl: string;
}

interface VXETablePluginExportPDFOptions {
fontName?: string;
fonts?: VXETablePluginExportPDFFonts[];
beforeMethod?: Function;
}

/**
* 基于 vxe-table 表格的扩展插件,支持导出 pdf 格式
*/
export declare const VXETablePluginExportPDF: {
install (vxetable: VXETableCore, options?: VXETablePluginExportPDFOptions): void
}

export default VXETablePluginExportPDF

0 comments on commit 13632e8

Please sign in to comment.