{"_id":"cloudpivot-file-preview","_rev":"48-ee8c553d1ffb5ae5054392f4c25a07a8","name":"cloudpivot-file-preview","dist-tags":{"latest":"1.0.24"},"versions":{"1.0.23":{"name":"cloudpivot-file-preview","version":"1.0.23","keywords":[],"author":"","license":"UNLICENSED","_id":"cloudpivot-file-preview@1.0.23","maintainers":[{"name":"gtmc_wshengji","email":"sd133cn@gmail.com"}],"dist":{"shasum":"ebfd741285acc9ce12c13375d0418351d43b1bca","tarball":"https://registry.npmjs.org/cloudpivot-file-preview/-/cloudpivot-file-preview-1.0.23.tgz","fileCount":5,"integrity":"sha512-XLxud2K+RoY43D1aC04wgMQ+y2+dxYGeM4illMm0UZMaYdYzFQeCT2z9NSCKzXhLvzqzNAPsTJQfjeBErCh1kg==","signatures":[{"sig":"MEUCIQC07Dic2g+VDqEPUHEltO2A50GtjMHvnvMiR+aarT3AIAIgL774CgFNqqNXcB2qYwdVk3FuMybWl67fg0OgLaD17Ww=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":296960},"main":"dist/cloudpivot-preview-obfuscated.min.js","type":"commonjs","types":"dist/cloudpivot-preview.d.ts","module":"dist/cloudpivot-preview.esm.obfuscated.min.js","exports":{".":{"import":"./dist/cloudpivot-preview.esm.obfuscated.min.js","require":"./dist/cloudpivot-preview-obfuscated.min.js"}},"gitHead":"70a15bcdb34a0ff8d8743bf2d35494b48f3be10d","scripts":{"build":"node esbuild.config.js","obfuscate":"javascript-obfuscator dist/cloudpivot-preview.min.js --compact --rename-variables --rename-globals false && javascript-obfuscator dist/cloudpivot-preview.esm.min.js --compact --rename-variables --rename-globals false --output dist/cloudpivot-preview.esm.obfuscated.min.js","prepublishOnly":"npm run build && npm run obfuscate"},"_npmUser":{"name":"gtmc_wshengji","email":"sd133cn@gmail.com"},"_npmVersion":"11.4.2","description":"奥哲云枢的附件预览库，支持PDF、Excel和Docx文件的预览","directories":{},"_nodeVersion":"22.20.0","dependencies":{"adm-zip":"^0.5.16","exceljs":"^4.4.0","@univerjs/ui":"0.18.0","@univerjs/core":"0.18.0","@univerjs/docs":"0.18.0","@univerjs/design":"0.18.0","@univerjs/sheets":"0.18.0","@univerjs/docs-ui":"0.18.0","@univerjs/presets":"0.18.0","@univerjs/sheets-ui":"0.18.0","@univerjs/engine-render":"0.18.0","@univerjs/sheets-numfmt":"0.18.0","@univerjs/engine-formula":"0.18.0","@univerjs/sheets-formula":"0.18.0","@univerjs/sheets-numfmt-ui":"0.18.0","@univerjs/sheets-formula-ui":"0.18.0","@univerjs/preset-sheets-core":"0.18.0"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.27.3","clean-css":"^5.3.3","fast-xml-parser":"^5.5.9","javascript-obfuscator":"^5.3.0"},"_npmOperationalInternal":{"tmp":"tmp/cloudpivot-file-preview_1.0.23_1776220295198_0.7002935030389701","host":"s3://npm-registry-packages-npm-production"}},"1.0.24":{"_id":"cloudpivot-file-preview@1.0.24","dist":{"shasum":"38dad2b514050fc7115963641b205a6e8e6dab40","tarball":"https://registry.npmjs.org/cloudpivot-file-preview/-/cloudpivot-file-preview-1.0.24.tgz","fileCount":5,"integrity":"sha512-keSF6cDY9LxXWefdu0IDqi2q5mG7aSjMPlDov/jd6E13dLFuU16tPZM970kgcv7XxpSoV7++3SCGZGWh1GDv7A==","signatures":[{"sig":"MEQCIHphsla2FXrjAP7zfw7HTRNiUruc62uCW5JyOTyfMDX3AiBKTjEODNOLX6sSNuV5vHtldzCfR9DpUVNbzmgAGx3Ezg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIExVtjsjOJ2y64HqLmaoboY+ZdABRpAju3XdHkIYImHwAiEA9Q9HbOntEeQb+b30kGgRmnzWQcB6zInTATM6fFWLByY="}],"unpackedSize":372818},"main":"dist/cloudpivot-preview-obfuscated.min.js","name":"cloudpivot-file-preview","type":"commonjs","types":"dist/cloudpivot-preview.d.ts","author":"","module":"dist/cloudpivot-preview.esm.obfuscated.min.js","exports":{".":{"import":"./dist/cloudpivot-preview.esm.obfuscated.min.js","require":"./dist/cloudpivot-preview-obfuscated.min.js"}},"gitHead":"29df7ae6d1d4406b2092a25949661c9ea8e68c15","license":"UNLICENSED","scripts":{"build":"node esbuild.config.js","obfuscate":"javascript-obfuscator dist/cloudpivot-preview.min.js --compact --rename-variables --rename-globals false && javascript-obfuscator dist/cloudpivot-preview.esm.min.js --compact --rename-variables --rename-globals false --output dist/cloudpivot-preview.esm.obfuscated.min.js","prepublishOnly":"npm run build && npm run obfuscate"},"version":"1.0.24","_npmUser":{"name":"gtmc_wshengji","email":"sd133cn@gmail.com"},"keywords":[],"_npmVersion":"11.4.2","description":"奥哲云枢的附件预览库，支持PDF、Excel和Docx文件的预览","directories":{},"maintainers":[{"name":"gtmc_wshengji","email":"sd133cn@gmail.com"}],"_nodeVersion":"22.20.0","dependencies":{"adm-zip":"^0.5.16","exceljs":"^4.4.0","iconv-lite":"^0.7.3","@univerjs/ui":"0.18.0","@univerjs/core":"0.18.0","@univerjs/docs":"0.18.0","@univerjs/design":"0.18.0","@univerjs/sheets":"0.18.0","@univerjs/docs-ui":"0.18.0","@univerjs/presets":"0.18.0","@univerjs/sheets-ui":"0.18.0","@univerjs/engine-render":"0.18.0","@univerjs/sheets-numfmt":"0.18.0","@univerjs/engine-formula":"0.18.0","@univerjs/sheets-formula":"0.18.0","@univerjs/sheets-numfmt-ui":"0.18.0","@univerjs/sheets-formula-ui":"0.18.0","@univerjs/preset-sheets-core":"0.18.0"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.27.3","clean-css":"^5.3.3","fast-xml-parser":"^5.5.9","javascript-obfuscator":"^5.3.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cloudpivot-file-preview_1.0.24_1790040604510_0.7201575616741136"}}},"time":{"created":"2026-02-16T03:33:59.118Z","modified":"2026-09-22T01:30:04.773Z","1.0.0":"2026-02-16T03:33:59.265Z","1.0.1":"2026-02-16T05:37:43.569Z","1.0.2":"2026-02-16T06:35:31.593Z","1.0.3":"2026-02-16T06:59:23.979Z","1.0.4":"2026-02-16T07:10:53.009Z","1.0.5":"2026-03-24T09:12:06.615Z","1.0.6":"2026-03-24T09:25:01.090Z","1.0.7":"2026-03-25T01:48:37.405Z","1.0.8":"2026-03-28T11:21:48.354Z","1.0.9":"2026-03-31T03:12:43.458Z","1.0.10":"2026-03-31T03:32:09.394Z","1.0.11":"2026-03-31T03:41:38.138Z","1.0.12":"2026-04-01T06:23:06.751Z","1.0.13":"2026-04-01T06:49:53.758Z","1.0.14":"2026-04-01T06:57:49.561Z","1.0.15":"2026-04-01T09:25:12.579Z","1.0.16":"2026-04-02T01:30:58.327Z","1.0.17":"2026-04-02T03:42:38.747Z","1.0.18":"2026-04-02T06:21:37.518Z","1.0.19":"2026-04-02T09:39:11.277Z","1.0.20":"2026-04-03T01:15:08.121Z","1.0.21":"2026-04-15T02:04:21.003Z","1.0.22":"2026-04-15T02:13:24.631Z","1.0.23":"2026-04-15T02:31:35.343Z","1.0.24":"2026-09-22T01:30:04.624Z"},"license":"UNLICENSED","keywords":[],"description":"奥哲云枢的附件预览库，支持PDF、Excel和Docx文件的预览","maintainers":[{"name":"gtmc_wshengji","email":"sd133cn@gmail.com"}],"readme":"# 云枢文件预览库\r\n\r\n## 简介\r\n\r\n云枢文件预览库是一个专为奥哲云枢平台设计的附件预览工具，支持 PDF、Excel、Word（docx/doc）、PPT（pptx）、纯文本（txt）和压缩包（zip/7z/rar/tar）文件的在线预览。\r\n\r\n## 功能特性\r\n\r\n- 支持 PDF 文件预览（基于 EmbedPDF）\r\n- 支持 Excel 文件预览（基于 Univer Sheets）\r\n- 支持 Word（docx/doc）、PPT（pptx）、纯文本（txt）和压缩包（zip/7z/rar/tar）文件预览（基于 @file-viewer/web-full CDN 包）\r\n- 响应式设计，适配 PC 和移动端\r\n- 内置业务规则校验（白名单验证 + 表单存在性验证）\r\n- 校验通过后自动注入预览功能\r\n\r\n## 内部使用说明\r\n\r\n本库仅供内部业务系统使用，底层会向白名单表单发起请求进行校验。校验逻辑封装在 AutoPreview 类内部，外部无法访问或绕过。\r\n\r\n## CDN 引入\r\n\r\n### ES 模块\r\n\r\n```javascript\r\nimport('https://cdn.jsdelivr.net/npm/cloudpivot-file-preview@latest/+esm')\r\n```\r\n\r\n### 全局变量\r\n\r\n```html\r\n<script src=\"https://cdn.jsdelivr.net/npm/cloudpivot-file-preview@latest/dist/cloudpivot-preview-obfuscated.min.js\"></script>\r\n```\r\n\r\n### CSS 样式\r\n\r\n```javascript\r\nconst link = document.createElement('link');\r\nlink.rel = 'stylesheet';\r\nlink.href = 'https://cdn.jsdelivr.net/npm/cloudpivot-file-preview@latest/dist/cloudpivot-preview.min.css';\r\ndocument.head.appendChild(link);\r\n```\r\n\r\n## 使用方法\r\n\r\n### ES 模块方式\r\n\r\n```javascript\r\nform.on('onRendered', function (data) {\r\n    import('https://cdn.jsdelivr.net/npm/cloudpivot-file-preview@latest/+esm')\r\n        .then(module => {\r\n            const { AutoPreview } = module;\r\n\r\n            const link = document.createElement('link');\r\n            link.rel = 'stylesheet';\r\n            link.href = 'https://cdn.jsdelivr.net/npm/cloudpivot-file-preview@latest/dist/cloudpivot-preview.min.css';\r\n            document.head.appendChild(link);\r\n\r\n            if (!this.formInEdit) {\r\n                new AutoPreview(this, data, {\r\n                    attachmentFields: {\r\n                        root: ['附件字段编码'],\r\n                        sheets: {\r\n                            '子表编码': ['附件字段编码']\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n        });\r\n});\r\n```\r\n\r\n### 全局变量方式\r\n\r\n```html\r\n<script src=\"https://cdn.jsdelivr.net/npm/cloudpivot-file-preview@latest/dist/cloudpivot-preview-obfuscated.min.js\"></script>\r\n<script>\r\nform.on('onRendered', function (data) {\r\n    const { AutoPreview } = cloudpivotPreview;\r\n\r\n    const link = document.createElement('link');\r\n    link.rel = 'stylesheet';\r\n    link.href = 'https://cdn.jsdelivr.net/npm/cloudpivot-file-preview@latest/dist/cloudpivot-preview.min.css';\r\n    document.head.appendChild(link);\r\n\r\n    if (!this.formInEdit) {\r\n        new AutoPreview(this, data, {\r\n            attachmentFields: {\r\n                root: ['附件字段编码'],\r\n                sheets: {\r\n                    '子表编码': ['附件字段编码']\r\n                }\r\n            }\r\n        });\r\n    }\r\n});\r\n</script>\r\n```\r\n\r\n## API 文档\r\n\r\n### AutoPreview 类\r\n\r\n```javascript\r\nnew AutoPreview(thisObject, data, options);\r\n```\r\n\r\n#### 参数说明\r\n\r\n- `thisObject` (Object, 必填) - 低代码平台的 this 对象\r\n- `data` (Object, 必填) - 表单数据对象（form.on 回调的 data 参数）\r\n- `options` (Object, 可选) - 配置选项\r\n\r\n#### options 配置项\r\n\r\n- `attachmentFields` (Object, 手机端必填) - 附件字段配置\r\n- `onCheckFail` (Function, 可选) - 校验失败回调\r\n- `onCheckSuccess` (Function, 可选) - 校验成功回调\r\n\r\n#### attachmentFields 配置\r\n\r\n```javascript\r\n// 仅根目录附件\r\n{\r\n    root: ['Attachment1', 'Attachment2']\r\n}\r\n\r\n// 仅子表附件\r\n{\r\n    sheets: {\r\n        'Sheet1': ['Attachment3'],\r\n        'Sheet2': ['Attachment4', 'Attachment5']\r\n    }\r\n}\r\n\r\n// 根目录和子表都有\r\n{\r\n    root: ['Attachment1', 'Attachment2'],\r\n    sheets: {\r\n        'Sheet1': ['Attachment3'],\r\n        'Sheet2': ['Attachment4', 'Attachment5']\r\n    }\r\n}\r\n```\r\n\r\n#### 方法\r\n\r\n- `stop()` - 停止循环注入\r\n- `destroy()` - 销毁实例\r\n","readmeFilename":"README.md"}