@dtducas/wh-forge-viewer 1.0.1
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/LICENSE +21 -0
- package/README.md +103 -0
- package/dist/index.esm.js +646 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +648 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Duong Tran Quang (DTDucas)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# wh-forge-viewer
|
|
2
|
+
|
|
3
|
+
A customized Autodesk Forge Viewer component for React with enhanced PDF support and custom toolbar.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✅ **Custom Toolbar** - Pre-configured toolbar with Pan, Document Browser, Download, and Pagination controls
|
|
8
|
+
- ✅ **PDF Support** - Optimized for viewing PDF documents with page navigation
|
|
9
|
+
- ✅ **Self-Healing** - Automatic toolbar recovery mechanism ensures UI persistence
|
|
10
|
+
- ✅ **3D/2D Models** - Full support for Autodesk Forge 3D and 2D models
|
|
11
|
+
- ✅ **React Integration** - Easy-to-use React component with hooks support
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install wh-forge-viewer
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
import { ViewerForgePDF } from 'wh-forge-viewer';
|
|
23
|
+
|
|
24
|
+
function MyApp() {
|
|
25
|
+
const [viewer, setViewer] = useState(null);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<ViewerForgePDF
|
|
29
|
+
filePath='https://example.com/document.pdf'
|
|
30
|
+
fileExt='pdf'
|
|
31
|
+
setViewer={setViewer}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Props
|
|
38
|
+
|
|
39
|
+
| Prop | Type | Required | Description |
|
|
40
|
+
| ----------- | -------- | -------- | ------------------------------------- |
|
|
41
|
+
| `filePath` | string | Yes | URL to the document to load |
|
|
42
|
+
| `fileExt` | string | Yes | File extension (pdf, dwf, dwfx, etc.) |
|
|
43
|
+
| `setViewer` | function | No | Callback to receive viewer instance |
|
|
44
|
+
|
|
45
|
+
## Custom Toolbar
|
|
46
|
+
|
|
47
|
+
The viewer includes a custom toolbar with:
|
|
48
|
+
|
|
49
|
+
### Tools Group
|
|
50
|
+
|
|
51
|
+
- **Pan** - Enable pan navigation
|
|
52
|
+
- **Document Browser** - Toggle document tree view
|
|
53
|
+
- **Download** - Download the current document
|
|
54
|
+
|
|
55
|
+
### Pagination Group
|
|
56
|
+
|
|
57
|
+
- **Previous Page** - Navigate to previous page
|
|
58
|
+
- **Page Counter** - Display current page / total pages
|
|
59
|
+
- **Next Page** - Navigate to next page
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
|
|
63
|
+
- React ^17.0.0 || ^18.0.0
|
|
64
|
+
- Ant Design ^5.0.0
|
|
65
|
+
- Autodesk Forge Viewer v7
|
|
66
|
+
|
|
67
|
+
## Development
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Install dependencies
|
|
71
|
+
npm install
|
|
72
|
+
|
|
73
|
+
# Build package
|
|
74
|
+
npm run build
|
|
75
|
+
|
|
76
|
+
# Watch mode
|
|
77
|
+
npm run dev
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Publishing
|
|
81
|
+
|
|
82
|
+
The package is automatically published to NPM when you push a version tag:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git tag v1.0.0
|
|
86
|
+
git push origin v1.0.0
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
|
92
|
+
|
|
93
|
+
## Author
|
|
94
|
+
|
|
95
|
+
**Duong Tran Quang**
|
|
96
|
+
|
|
97
|
+
- Email: <baymax.contact@gmail.com>
|
|
98
|
+
- GitHub: [@DTDucas](https://github.com/DTDucas)
|
|
99
|
+
- LinkedIn: [dtducas](https://www.linkedin.com/in/dtducas)
|
|
100
|
+
|
|
101
|
+
## Issues
|
|
102
|
+
|
|
103
|
+
Report bugs and feature requests at [GitHub Issues](https://github.com/DTDucas/wh-forge-viewer/issues)
|