bimplus-webclient 0.1.67 → 0.1.69
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/.github/documentation.instructions.md +49 -0
- package/JSDOC_MIGRATION_PLAN.md +200 -0
- package/README.md +4 -6
- package/dist/bimplus-webclient.js +1 -1
- package/eslint.config.mjs +6 -1
- package/package.json +12 -22
- package/vitest.config.mjs +16 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "src/**/*.js, doc_config.yml, documentation/**"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Generating API Documentation
|
|
6
|
+
|
|
7
|
+
This project uses the [`documentation`](https://github.com/documentationjs/documentation) npm package (JSDoc-based) to generate API docs from the JSDoc comments in `src/*.js`. Output is written to `./documentation`.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
- Node dependencies installed (`npm install`) — `documentation` is a devDependency.
|
|
11
|
+
- Python 3 available on PATH (only required for the Confluence conversion step, which runs `documentation/convert_to_confluence_md.py`).
|
|
12
|
+
- All exported functions/classes in `src/*.js` should have valid JSDoc comments; `lint-doc` will fail the build on invalid JSDoc.
|
|
13
|
+
|
|
14
|
+
## Available Scripts
|
|
15
|
+
|
|
16
|
+
| Script | Purpose |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `npm run lint-doc` | Runs `documentation lint ./src/*.js` to validate JSDoc comments before generating docs. |
|
|
19
|
+
| `npm run build-doc` | Lints, then builds **HTML** docs into `./documentation` using `doc_config.yml` (defines the table of contents). |
|
|
20
|
+
| `npm run build-docMd` | Lints, then builds a single **Markdown** file at `./documentation/Bimplus_WebClient_doc.md`. |
|
|
21
|
+
| `npm run build-docConf` | Runs `build-docMd`, then runs `documentation/convert_to_confluence_md.py` to produce `Bimplus_WebClient_doc_confluence.md`, a Confluence-friendly variant with fixed anchor links and an injected version header. |
|
|
22
|
+
| `npm run build-docAll` | Runs `build-doc`, `build-docConf`, `build-docMd`, `build-doc` in sequence — regenerates HTML, Markdown, and Confluence docs together. |
|
|
23
|
+
|
|
24
|
+
## Typical Workflow
|
|
25
|
+
|
|
26
|
+
1. Add/update JSDoc comments on any public API in `src/*.js` (classes, methods, params, returns, examples).
|
|
27
|
+
2. Run `npm run lint-doc` and fix any reported JSDoc issues.
|
|
28
|
+
3. Run `npm run build-docAll` to regenerate all doc formats at once (recommended before a release/publish).
|
|
29
|
+
- Or run an individual script (`build-doc`, `build-docMd`, `build-docConf`) if you only need one output format.
|
|
30
|
+
4. Review generated output:
|
|
31
|
+
- `./documentation/index.html` (and per-file `.html` pages) for the HTML site.
|
|
32
|
+
- `./documentation/Bimplus_WebClient_doc.md` for the raw Markdown API doc.
|
|
33
|
+
- `./documentation/Bimplus_WebClient_doc_confluence.md` for the Confluence-paste-ready version.
|
|
34
|
+
5. Commit the regenerated files under `./documentation` along with your source changes.
|
|
35
|
+
|
|
36
|
+
## Notes on `doc_config.yml`
|
|
37
|
+
- Controls the HTML build's table of contents (`toc:` entries map to sections/pages).
|
|
38
|
+
- Add a new `toc` entry here when introducing a new top-level `src/*.js` module you want listed separately in the HTML docs.
|
|
39
|
+
|
|
40
|
+
## Notes on the Confluence conversion (`convert_to_confluence_md.py`)
|
|
41
|
+
- Reads `./Bimplus_WebClient_doc.md` (must be generated first via `build-docMd`) and writes `./Bimplus_WebClient_doc_confluence.md`.
|
|
42
|
+
- Rewrites Markdown anchor links (`[name](#name)`) to Confluence's anchor format (prefixed with `WebClientApidescription-`) since Confluence generates anchors differently than GitHub-flavored Markdown.
|
|
43
|
+
- Reads the version from `../package.json` and injects a `#Bimplus WebClient version : x.y.z` heading.
|
|
44
|
+
- Must be run from inside the `./documentation` directory (the `build-docConf` script already `cd`s there).
|
|
45
|
+
|
|
46
|
+
## Troubleshooting
|
|
47
|
+
- **`lint-doc` fails**: fix the JSDoc syntax/tag errors it reports; the `build-*` scripts depend on it succeeding first.
|
|
48
|
+
- **Confluence conversion fails with "file not found"**: run `npm run build-docMd` first, or use `npm run build-docConf` which does it automatically.
|
|
49
|
+
- **Python not found**: only `build-docConf`/`build-docAll` need Python; ensure `python` resolves on PATH (or update the script invocation to `python3` if needed on your OS).
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# JSDoc Migration Plan
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Replace the `documentation` package with JSDoc tooling while preserving the existing documentation workflows:
|
|
6
|
+
|
|
7
|
+
- HTML documentation in `./documentation`
|
|
8
|
+
- Markdown API documentation in `./documentation/Bimplus_WebClient_doc.md`
|
|
9
|
+
- Confluence-compatible Markdown in `./documentation/Bimplus_WebClient_doc_confluence.md`
|
|
10
|
+
- The existing `build-doc*` npm script interface
|
|
11
|
+
|
|
12
|
+
The migration should also remove the vulnerable transitive `vue-template-compiler` dependency.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
|
|
16
|
+
Files expected to change:
|
|
17
|
+
|
|
18
|
+
- `package.json`
|
|
19
|
+
- `package-lock.json`
|
|
20
|
+
- New root-level `jsdoc.json` configuration
|
|
21
|
+
- `.github/documentation.instructions.md`
|
|
22
|
+
- Generated files under `documentation/`
|
|
23
|
+
|
|
24
|
+
The following should remain functionally unchanged:
|
|
25
|
+
|
|
26
|
+
- JSDoc comments in `src/*.js`
|
|
27
|
+
- `documentation/convert_to_confluence_md.py`
|
|
28
|
+
- Application source, build, and test configuration
|
|
29
|
+
|
|
30
|
+
## Implementation Steps
|
|
31
|
+
|
|
32
|
+
### 1. Replace development dependencies
|
|
33
|
+
|
|
34
|
+
Remove `documentation` from `devDependencies` and add:
|
|
35
|
+
|
|
36
|
+
- `jsdoc` for parsing source comments and generating HTML
|
|
37
|
+
- `jsdoc-to-markdown` for Markdown API output
|
|
38
|
+
|
|
39
|
+
Install the dependencies with:
|
|
40
|
+
|
|
41
|
+
```powershell
|
|
42
|
+
npm install --save-dev jsdoc jsdoc-to-markdown
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Do not run `npm audit fix --force`; it may apply a breaking downgrade and does not provide a patched version of the vulnerable Vue 2 package.
|
|
46
|
+
|
|
47
|
+
### 2. Add `jsdoc.json`
|
|
48
|
+
|
|
49
|
+
Create a root-level JSDoc configuration with these requirements:
|
|
50
|
+
|
|
51
|
+
- Include JavaScript files under `src/`
|
|
52
|
+
- Recurse through the source directory
|
|
53
|
+
- Parse ES module syntax
|
|
54
|
+
- Write HTML output to `./documentation`
|
|
55
|
+
- Use `README.md` as the documentation landing-page content when supported
|
|
56
|
+
- Enable Markdown processing and recursive source discovery
|
|
57
|
+
|
|
58
|
+
Proposed configuration:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"source": {
|
|
63
|
+
"include": ["src"],
|
|
64
|
+
"includePattern": ".*\\.js$",
|
|
65
|
+
"excludePattern": "(^|[\\\\/])node_modules[\\\\/]"
|
|
66
|
+
},
|
|
67
|
+
"opts": {
|
|
68
|
+
"destination": "./documentation",
|
|
69
|
+
"recurse": true,
|
|
70
|
+
"readme": "./README.md"
|
|
71
|
+
},
|
|
72
|
+
"templates": {
|
|
73
|
+
"cleverLinks": false,
|
|
74
|
+
"monospaceLinks": true
|
|
75
|
+
},
|
|
76
|
+
"plugins": [
|
|
77
|
+
"plugins/markdown",
|
|
78
|
+
"plugins/recurse"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Validate the exact configuration against the installed JSDoc version before committing it.
|
|
84
|
+
|
|
85
|
+
### 3. Update npm scripts
|
|
86
|
+
|
|
87
|
+
Replace the current `documentation` commands with JSDoc equivalents while retaining the existing script names:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"lint-doc": "jsdoc --pedantic --configure jsdoc.json --explain",
|
|
92
|
+
"build-doc": "npm run lint-doc && jsdoc --configure jsdoc.json",
|
|
93
|
+
"build-docMd": "npm run lint-doc && jsdoc2md --files \"src/*.js\" > documentation/Bimplus_WebClient_doc.md",
|
|
94
|
+
"build-docConf": "npm run build-docMd && cd ./documentation && python convert_to_confluence_md.py",
|
|
95
|
+
"build-docAll": "npm run build-doc && npm run build-docMd && npm run build-docConf"
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The `lint-doc` command should be tested with the installed JSDoc CLI. If JSDoc does not support the selected validation flags, replace it with the supported parse-only validation command while keeping the script name.
|
|
100
|
+
|
|
101
|
+
### 4. Regenerate documentation
|
|
102
|
+
|
|
103
|
+
Run the formats individually first:
|
|
104
|
+
|
|
105
|
+
```powershell
|
|
106
|
+
npm run lint-doc
|
|
107
|
+
npm run build-doc
|
|
108
|
+
npm run build-docMd
|
|
109
|
+
npm run build-docConf
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Then run the complete workflow:
|
|
113
|
+
|
|
114
|
+
```powershell
|
|
115
|
+
npm run build-docAll
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The Confluence converter should continue reading the generated Markdown from its current location. No Python changes are expected unless the new Markdown headings or anchors expose a compatibility issue.
|
|
119
|
+
|
|
120
|
+
### 5. Review generated output
|
|
121
|
+
|
|
122
|
+
Check the following:
|
|
123
|
+
|
|
124
|
+
- `documentation/index.html` opens successfully
|
|
125
|
+
- HTML assets load without missing-file errors
|
|
126
|
+
- All public classes, methods, namespaces, callbacks, parameters, and return values are represented
|
|
127
|
+
- Markdown headings and links are readable
|
|
128
|
+
- Confluence anchors contain the expected `WebClientApidescription-` prefix
|
|
129
|
+
- No stale files from the previous generator remain in the generated output
|
|
130
|
+
|
|
131
|
+
JSDoc will produce a different HTML structure and may use different anchor names than documentation.js. This is expected, but no public API should disappear.
|
|
132
|
+
|
|
133
|
+
### 6. Update repository guidance
|
|
134
|
+
|
|
135
|
+
Update `.github/documentation.instructions.md` to describe:
|
|
136
|
+
|
|
137
|
+
- `jsdoc.json`
|
|
138
|
+
- `jsdoc` and `jsdoc-to-markdown`
|
|
139
|
+
- The revised npm scripts
|
|
140
|
+
- The new HTML output structure
|
|
141
|
+
- The continued Markdown-to-Confluence conversion
|
|
142
|
+
- The fact that generated output must be regenerated after source JSDoc changes
|
|
143
|
+
|
|
144
|
+
### 7. Remove obsolete dependency output
|
|
145
|
+
|
|
146
|
+
After a successful install, verify that the old packages are gone:
|
|
147
|
+
|
|
148
|
+
```powershell
|
|
149
|
+
npm ls documentation vue-template-compiler
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The command should report that neither package is installed, or that they are not found in the dependency tree.
|
|
153
|
+
|
|
154
|
+
Review `package-lock.json` for removal of the obsolete dependency chain. Do not remove unrelated lockfile changes produced by the package manager.
|
|
155
|
+
|
|
156
|
+
## Verification Checklist
|
|
157
|
+
|
|
158
|
+
Run the documentation workflow and existing project checks:
|
|
159
|
+
|
|
160
|
+
```powershell
|
|
161
|
+
npm install
|
|
162
|
+
npm run lint-doc
|
|
163
|
+
npm run build-docAll
|
|
164
|
+
npm run build
|
|
165
|
+
npm test
|
|
166
|
+
npm audit
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Expected results:
|
|
170
|
+
|
|
171
|
+
- Documentation commands complete successfully
|
|
172
|
+
- Generated HTML, Markdown, and Confluence files exist
|
|
173
|
+
- The application build remains successful
|
|
174
|
+
- Existing tests remain successful
|
|
175
|
+
- The `vue-template-compiler` audit finding is no longer introduced by this documentation toolchain
|
|
176
|
+
|
|
177
|
+
`npm audit` may still report unrelated vulnerabilities. Record those separately instead of applying a forced dependency downgrade.
|
|
178
|
+
|
|
179
|
+
## Rollback
|
|
180
|
+
|
|
181
|
+
If the generated output loses API content or the Confluence conversion cannot be adapted safely:
|
|
182
|
+
|
|
183
|
+
1. Restore the previous `package.json` and `package-lock.json` documentation dependencies.
|
|
184
|
+
2. Remove `jsdoc.json`.
|
|
185
|
+
3. Restore the previous generated `documentation/` output.
|
|
186
|
+
4. Reassess the JSDoc configuration and Markdown template before retrying.
|
|
187
|
+
|
|
188
|
+
Do not modify application source code as part of rollback.
|
|
189
|
+
|
|
190
|
+
## Acceptance Criteria
|
|
191
|
+
|
|
192
|
+
The migration is complete when:
|
|
193
|
+
|
|
194
|
+
- `documentation` is no longer a development dependency
|
|
195
|
+
- JSDoc generates readable HTML from `src/*.js`
|
|
196
|
+
- `jsdoc-to-markdown` generates the API Markdown file
|
|
197
|
+
- The existing Confluence conversion succeeds
|
|
198
|
+
- `build-doc`, `build-docMd`, `build-docConf`, and `build-docAll` all work
|
|
199
|
+
- Generated documentation is reviewed and committed
|
|
200
|
+
- Application build and tests remain unaffected
|
package/README.md
CHANGED
|
@@ -74,15 +74,13 @@ goto your application folder which uses the webclient
|
|
|
74
74
|
npm install
|
|
75
75
|
|
|
76
76
|
### Unit testing
|
|
77
|
-
|
|
77
|
+
The unit tests run with Vitest and jsdom. Run them with coverage using:
|
|
78
78
|
|
|
79
|
-
npm
|
|
80
|
-
|
|
81
|
-
Run test in headleass mode
|
|
79
|
+
npm test
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
Run Vitest in watch mode during development with:
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
npm run test-watch
|
|
86
84
|
|
|
87
85
|
### Documentation
|
|
88
86
|
Bimplus webclient uses npm documentation plugin for easy documentation generation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.add=t():e.add=t()}(self,(()=>(()=>{"use strict";const e={d:(t,s)=>{if(Array.isArray(s))for(var i=0;i<s.length;){var n=s[i++],l=s[i++];e.o(t,n)?0===l&&i++:0===l?Object.defineProperty(t,n,{enumerable:!0,value:s[i++]}):Object.defineProperty(t,n,{enumerable:!0,get:l})}else for(var n in s)e.o(s,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:s[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{BimExplorer:()=>d,BimFilesIFCSelect:()=>_,BimFilesIsoSelect:()=>m,BimFilesOverlaySelect:()=>u,BimFilesSelect:()=>h,BimModelsIsoSelect:()=>S,BimModelsSelect:()=>g,BimObjectProperties:()=>c,BimPortal:()=>l,BimTaskList:()=>a,BimTaskProperties:()=>o,ExportManager:()=>r,ExternalClient:()=>s,ModelViewer:()=>M,getUrlParameter:()=>p});class s{constructor(e){this._messageHandlers={},this._errorHandler=null,this._clientName=e}initialize(){let e=this;console.log("ExternalClient initialized"),window.addEventListener("message",(function(t){let s=t.data;if(""===s)e.errorReceived({error:"External client got an empty message !"});else{let t;try{t=JSON.parse(s)}catch(t){return void e.errorReceived({error:"External client got an invalid message json payload !"})}e.messageReceived(t)}}))}addMessageHandler(e,t){this._messageHandlers[e]=t}removeMessageHandler(e){delete this._messageHandlers[e]}messageReceived(e){let t=this._messageHandlers[e.message];t&&t(e.data)}addErrorHandler(e){this._errorHandler=e}removeErrorHandler(){this._errorHandler=null}errorReceived(e){let t=this._errorHandler;t&&t(e)}sendMessage(e,t,s){let i=document.getElementById(e);return!!i?.contentWindow&&(i.contentWindow.postMessage(JSON.stringify({messageType:"bimplusMessageIn",message:t,data:s}),"*"),!0)}getClientName(){return this._clientName}}class i{static embedded="?embedded=1";static url=function(e,t){let s;return"string"==typeof t?.baseUrl?(s=t.baseUrl,s.endsWith("/")||(s+="/")):(s="https://portal",e&&("dev"===e?s+="-dev":"stage"===e?s+="-stage":"fea"===e&&(s+="-fea")),s+=".bimplus.net/"),s};static token=function(e){return"&token="+e};static client=function(e){return e?"&external_client=PostMessage:"+e.getClientName():""};static source=function(e){return e&&"string"==typeof e?"&source="+e:""};static teamId=function(e){return e?"&team_id="+e:""};static projectId=function(e){return e?"&project_id="+e:""};static addParameter=function(e,t,s){return t&&s?e?e+`&${t}=${s}`:`?${t}=${s}`:e};static addParameters=function(e,t){let s=e;for(const e in t)s=i.addParameter(s,e,t[e]);return s}}class n{constructor(e,t,s,i,n){this._client=t,this._domId=e,this._env=s,this._token=i,this._options=n}sendMessage(e,t){if(!this._client){const e="Error for SendMessage. Client not defined.";throw console.error(e),ReferenceError(e)}this._client.sendMessage(this._domId,e,t)}getDOMElementId(){return this._domId}initMessageHandlers(){}loadIFrame(e){let t=document.getElementById(this._domId);if(!t){const e="DOM element not found: "+this._domId;throw console.error(e),ReferenceError(e)}t.src=e}loadIFrameShadowRoot(e,t){let s=e.getElementById(this._domId);if(!s){const e="DOM element not found: "+this._domId;throw console.error(e),ReferenceError(e)}s.src=t}}class l extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onTeamChanged=null,this.onProjectSelected=null,this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(){return i.url(this._env,this._options)+i.embedded+i.token(this._token)+i.client(this._client)}load(){let e=this.getUrl();this.loadIFrame(e),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("TeamChanged",(e=>{this.onTeamChanged&&this.onTeamChanged(e.id)})),this._client.addMessageHandler("ProjectSelected",(e=>{this.onProjectSelected&&this.onProjectSelected(e.id)})),this._client.addMessageHandler("AttachmentSelected",(e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)})),this._client.addMessageHandler("AttachmentSelectedDetails",(e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)}))}}class d extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onObjectSelected=null,this.onObjectsSelected=null,this.onIssueSelected=null,this.onPinSelected=null,this.onCheckAlive=null,this.onDataLoaded=null,this.onClickedHyperlink=null}getUrl(e,t){return(this._env&&"localhost"===this._env?"http://127.0.0.1:4200/":i.url(this._env,this._options))+"#/viewer"+i.embedded+i.token(this._token)+i.client(this._client)+"&project_id="+t+"&team_id="+e}load(e,t){let s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("PinSelected",(e=>{this.onPinSelected&&this.onPinSelected(e.id)})),this._client.addMessageHandler("ObjectSelected",(e=>{this.onObjectSelected&&this.onObjectSelected(e.Id,e.multiSelect,e.selected)})),this._client.addMessageHandler("ObjectsSelected",(e=>{this.onObjectsSelected&&this.onObjectsSelected(e.ids,e.multiSelect,e.selected)})),this._client.addMessageHandler("IssueSelected",(e=>{this.onIssueSelected&&this.onIssueSelected(e.id)})),this._client.addMessageHandler("CheckAlive",(e=>{this.onCheckAlive&&this.onCheckAlive(e.client)})),this._client.addMessageHandler("DataLoaded",(()=>{this.onDataLoaded&&this.onDataLoaded()})),this._client.addMessageHandler("ClickedHyperlink",(e=>{this.onClickedHyperlink&&this.onClickedHyperlink(e.url)}))}resetView(){this.sendMessage("ResetView")}centerObject(e,t){this.sendMessage("CenterObject",{id:e,flyTo:t})}selectPin(e){this.sendMessage("PinSelected",{id:e})}selectObjects(e,t,s,i){this.sendMessage("ObjectsSelected",{ids:e,multiSelect:t,isolate:s,blockProperties:i})}isolateObjects(e){this.sendMessage("ObjectsIsolated",{ids:e})}checkAlive(){this.sendMessage("CheckAlive",{})}selectStructure(e,t,s,i,n,l){this.sendMessage("StructureSelected",{id:e,visibleNodes:t,showAll:s,expandAll:i,hideUnreferencedTopology:n,isolate:l})}selectIssue(e){this.sendMessage("IssueSelected",{id:e})}colorizeObjects(e,t){this.sendMessage("ColorizeObjects",{ids:e,color:t})}}class a extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onObjectSelected=null,this.onObjectsSelected=null,this.onIssueSelected=null,this.onCheckAlive=null,this.onDataLoaded=null}getUrl(e,t,s){return i.url(this._env,this._options)+"viewer/"+i.embedded+"&destination=EMBEDDED_ISSUE_LIST"+i.source(s)+i.token(this._token)+i.client(this._client)+"/#/embeddedissuelist?project_id="+t+"&team_id="+e}load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ObjectSelected",(e=>{this.onObjectSelected&&this.onObjectSelected(e.Id,e.multiSelect,e.selected)})),this._client.addMessageHandler("ObjectsSelected",(e=>{this.onObjectsSelected&&this.onObjectsSelected(e.ids,e.multiSelect,e.selected)})),this._client.addMessageHandler("IssueSelected",(e=>{this.onIssueSelected&&this.onIssueSelected(e.id)})),this._client.addMessageHandler("CheckAlive",(e=>{this.onCheckAlive&&this.onCheckAlive(e.client)})),this._client.addMessageHandler("DataLoaded",(()=>{this.onDataLoaded&&this.onDataLoaded()}))}selectObjects(e,t,s,i){this.sendMessage("ObjectsSelected",{ids:e,multiSelect:t,isolate:s,blockProperties:i})}checkAlive(){this.sendMessage("CheckAlive",{})}selectIssue(e){this.sendMessage("IssueSelected",{id:e})}}class o extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onObjectSelected=null,this.onObjectsSelected=null,this.onIssueSelected=null,this.onPinSelected=null,this.onCheckAlive=null,this.onDataLoaded=null,this.onClickedHyperlink=null}getUrl(e,t,s,n){return i.url(this._env,this._options)+"viewer/"+i.embedded+"&destination=EMBEDDED_ISSUE"+i.source(n)+i.token(this._token)+i.client(this._client)+"/#/embeddedissue?project_id="+t+"&issue_id="+s+"&team_id="+e}load(e,t,s,i){const n=this.getUrl(e,t,s,i);this.loadIFrame(n),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("PinSelected",(e=>{this.onPinSelected&&this.onPinSelected(e.id)})),this._client.addMessageHandler("ObjectSelected",(e=>{this.onObjectSelected&&this.onObjectSelected(e.Id,e.multiSelect,e.selected)})),this._client.addMessageHandler("ObjectsSelected",(e=>{this.onObjectsSelected&&this.onObjectsSelected(e.ids,e.multiSelect,e.selected)})),this._client.addMessageHandler("IssueSelected",(e=>{this.onIssueSelected&&this.onIssueSelected(e.id)})),this._client.addMessageHandler("CheckAlive",(e=>{this.onCheckAlive&&this.onCheckAlive(e.client)})),this._client.addMessageHandler("DataLoaded",(()=>{this.onDataLoaded&&this.onDataLoaded()})),this._client.addMessageHandler("ClickedHyperlink",(e=>{this.onClickedHyperlink&&this.onClickedHyperlink(e.url)}))}selectPin(e){this.sendMessage("PinSelected",{id:e})}selectObjects(e,t,s,i){this.sendMessage("ObjectsSelected",{ids:e,multiSelect:t,isolate:s,blockProperties:i})}checkAlive(){this.sendMessage("CheckAlive",{})}selectIssue(e){this.sendMessage("IssueSelected",{id:e})}}class c extends n{constructor(e,t,s,i,n){super(e,s,i,t,n)}getUrl=function(e,t,s){let n=i.url(this._env,this._options);return n+="viewer/#/objproperties"+i.embedded+i.token(this._token)+i.client(this._client)+"&project_id="+t+"&team_id="+e+"&object_id="+s,n};load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers()}}class r extends d{constructor(e,t,s,i,n){super(e,t,s,i,n),this.onExportStarted=null}getUrl(e,t){let s=this._env&&"localhost"===this._env?"http://127.0.0.1:4200/":i.url(this._env,this._options)+"export-manager/";return s+="#/viewer"+i.embedded+i.token(this._token)+i.client(this._client)+"&project_id="+t+"&team_id="+e,s}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ExportStarted",(e=>{this.onExportStarted&&this.onExportStarted(e.id)}))}}class h extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/select",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}loadShadowRoot(e,t,s){const i=this.getUrl(t,s);this.loadIFrameShadowRoot(e,i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",(e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)})),this._client.addMessageHandler("AttachmentSelectedDetails",(e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)}))}}class u extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/overlayselect",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",(e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)})),this._client.addMessageHandler("AttachmentSelectedDetails",(e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)}))}}class g extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onModelSelected=null,this.onModelSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/models/select",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ModelSelected",(e=>{this.onModelSelected&&this.onModelSelected(e?.id?e.id:e)})),this._client.addMessageHandler("ModelSelectedDetails",(e=>{this.onModelSelectedDetails&&this.onModelSelectedDetails(e?.id?e.id:e)}))}}class m extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t,s){let n=s||i.url(this._env,this._options);return n+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/isoselect",n}load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",(e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)})),this._client.addMessageHandler("AttachmentSelectedDetails",(e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)}))}}class S extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onModelSelected=null,this.onModelSelectedDetails=null}getUrl(e,t,s){let n=s||i.url(this._env,this._options);return n+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/models/isoselect",n}load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ModelSelected",(e=>{this.onModelSelected&&this.onModelSelected(e?.id?e.id:e)})),this._client.addMessageHandler("ModelSelectedDetails",(e=>{this.onModelSelectedDetails&&this.onModelSelectedDetails(e?.id?e.id:e)}))}}class _ extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/ifcselect",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",(e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)})),this._client.addMessageHandler("AttachmentSelectedDetails",(e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)}))}}class M{constructor(e,t){this.viewerUri=e&&"dev"!==e&&"stage"!==e&&"prod"!==e&&"fea"!==e?e:i.url(e,t)+"/viewer/#/modelviewer"}openFileUriWindow(e,t,s,n,l){let d="";d=i.addParameters(d,{fileUri:encodeURIComponent(e),team_id:s,project_id:n}),l&&(d=i.addParameters(d,{fileExt:encodeURIComponent(l)}));const a=this.viewerUri+d;return window.open(a,t)}openBufferDataWindow(e,t,s,n){let l="";l=i.addParameters(l,{awaitDataMessage:"true",team_id:s,project_id:n});const d=this.viewerUri+l,a=window.open(d,t);if(!a)return void alert("Could not open preview window. Please enable popups in your browser to use this feature");const o=function(t){"WatingForData"===t.data&&a&&window&&(a.postMessage(e,"*",[e]),window.removeEventListener("message",o))};return window.addEventListener("message",o,!1),a}}const p=function(e){let t,s,i=decodeURIComponent(window.location.search.substring(1)).split("&");for(s=0;s<i.length;s++)if(t=i[s].split("="),t[0]===e)return void 0===t[1]||t[1]};return t})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.add=t():e.add=t()}(self,()=>(()=>{"use strict";const e={d:(t,s)=>{for(var i in s)e.o(s,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:s[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{BimExplorer:()=>d,BimFilesIFCSelect:()=>_,BimFilesIsoSelect:()=>m,BimFilesOverlaySelect:()=>u,BimFilesSelect:()=>h,BimModelsIsoSelect:()=>S,BimModelsSelect:()=>g,BimObjectProperties:()=>c,BimPortal:()=>l,BimTaskList:()=>a,BimTaskProperties:()=>o,ExportManager:()=>r,ExternalClient:()=>s,ModelViewer:()=>M,getUrlParameter:()=>p});class s{constructor(e){this._messageHandlers={},this._errorHandler=null,this._clientName=e}initialize(){let e=this;console.log("ExternalClient initialized"),window.addEventListener("message",function(t){let s=t.data;if(""===s)e.errorReceived({error:"External client got an empty message !"});else{let t;try{t=JSON.parse(s)}catch(t){return void e.errorReceived({error:"External client got an invalid message json payload !"})}e.messageReceived(t)}})}addMessageHandler(e,t){this._messageHandlers[e]=t}removeMessageHandler(e){delete this._messageHandlers[e]}messageReceived(e){let t=this._messageHandlers[e.message];t&&t(e.data)}addErrorHandler(e){this._errorHandler=e}removeErrorHandler(){this._errorHandler=null}errorReceived(e){let t=this._errorHandler;t&&t(e)}sendMessage(e,t,s){let i=document.getElementById(e);return!!i?.contentWindow&&(i.contentWindow.postMessage(JSON.stringify({messageType:"bimplusMessageIn",message:t,data:s}),"*"),!0)}getClientName(){return this._clientName}}class i{static embedded="?embedded=1";static url=function(e,t){let s;return"string"==typeof t?.baseUrl?(s=t.baseUrl,s.endsWith("/")||(s+="/")):(s="https://portal",e&&("dev"===e?s+="-dev":"stage"===e?s+="-stage":"fea"===e&&(s+="-fea")),s+=".bimplus.net/"),s};static token=function(e){return"&token="+e};static client=function(e){return e?"&external_client=PostMessage:"+e.getClientName():""};static source=function(e){return e&&"string"==typeof e?"&source="+e:""};static teamId=function(e){return e?"&team_id="+e:""};static projectId=function(e){return e?"&project_id="+e:""};static addParameter=function(e,t,s){return t&&s?e?e+`&${t}=${s}`:`?${t}=${s}`:e};static addParameters=function(e,t){let s=e;for(const e in t)s=i.addParameter(s,e,t[e]);return s}}class n{constructor(e,t,s,i,n){this._client=t,this._domId=e,this._env=s,this._token=i,this._options=n}sendMessage(e,t){if(!this._client){const e="Error for SendMessage. Client not defined.";throw console.error(e),ReferenceError(e)}this._client.sendMessage(this._domId,e,t)}getDOMElementId(){return this._domId}initMessageHandlers(){}loadIFrame(e){let t=document.getElementById(this._domId);if(!t){const e="DOM element not found: "+this._domId;throw console.error(e),ReferenceError(e)}t.src=e}loadIFrameShadowRoot(e,t){let s=e.getElementById(this._domId);if(!s){const e="DOM element not found: "+this._domId;throw console.error(e),ReferenceError(e)}s.src=t}}class l extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onTeamChanged=null,this.onProjectSelected=null,this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(){return i.url(this._env,this._options)+i.embedded+i.token(this._token)+i.client(this._client)}load(){let e=this.getUrl();this.loadIFrame(e),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("TeamChanged",e=>{this.onTeamChanged&&this.onTeamChanged(e.id)}),this._client.addMessageHandler("ProjectSelected",e=>{this.onProjectSelected&&this.onProjectSelected(e.id)}),this._client.addMessageHandler("AttachmentSelected",e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)}),this._client.addMessageHandler("AttachmentSelectedDetails",e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)})}}class d extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onObjectSelected=null,this.onObjectsSelected=null,this.onIssueSelected=null,this.onPinSelected=null,this.onCheckAlive=null,this.onDataLoaded=null,this.onClickedHyperlink=null}getUrl(e,t){return(this._env&&"localhost"===this._env?"http://127.0.0.1:4200/":i.url(this._env,this._options))+"#/viewer"+i.embedded+i.token(this._token)+i.client(this._client)+"&project_id="+t+"&team_id="+e}load(e,t){let s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("PinSelected",e=>{this.onPinSelected&&this.onPinSelected(e.id)}),this._client.addMessageHandler("ObjectSelected",e=>{this.onObjectSelected&&this.onObjectSelected(e.Id,e.multiSelect,e.selected)}),this._client.addMessageHandler("ObjectsSelected",e=>{this.onObjectsSelected&&this.onObjectsSelected(e.ids,e.multiSelect,e.selected)}),this._client.addMessageHandler("IssueSelected",e=>{this.onIssueSelected&&this.onIssueSelected(e.id)}),this._client.addMessageHandler("CheckAlive",e=>{this.onCheckAlive&&this.onCheckAlive(e.client)}),this._client.addMessageHandler("DataLoaded",()=>{this.onDataLoaded&&this.onDataLoaded()}),this._client.addMessageHandler("ClickedHyperlink",e=>{this.onClickedHyperlink&&this.onClickedHyperlink(e.url)})}resetView(){this.sendMessage("ResetView")}centerObject(e,t){this.sendMessage("CenterObject",{id:e,flyTo:t})}selectPin(e){this.sendMessage("PinSelected",{id:e})}selectObjects(e,t,s,i){this.sendMessage("ObjectsSelected",{ids:e,multiSelect:t,isolate:s,blockProperties:i})}isolateObjects(e){this.sendMessage("ObjectsIsolated",{ids:e})}checkAlive(){this.sendMessage("CheckAlive",{})}selectStructure(e,t,s,i,n,l){this.sendMessage("StructureSelected",{id:e,visibleNodes:t,showAll:s,expandAll:i,hideUnreferencedTopology:n,isolate:l})}selectIssue(e){this.sendMessage("IssueSelected",{id:e})}colorizeObjects(e,t){this.sendMessage("ColorizeObjects",{ids:e,color:t})}}class a extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onObjectSelected=null,this.onObjectsSelected=null,this.onIssueSelected=null,this.onCheckAlive=null,this.onDataLoaded=null}getUrl(e,t,s){return i.url(this._env,this._options)+"viewer/"+i.embedded+"&destination=EMBEDDED_ISSUE_LIST"+i.source(s)+i.token(this._token)+i.client(this._client)+"/#/embeddedissuelist?project_id="+t+"&team_id="+e}load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ObjectSelected",e=>{this.onObjectSelected&&this.onObjectSelected(e.Id,e.multiSelect,e.selected)}),this._client.addMessageHandler("ObjectsSelected",e=>{this.onObjectsSelected&&this.onObjectsSelected(e.ids,e.multiSelect,e.selected)}),this._client.addMessageHandler("IssueSelected",e=>{this.onIssueSelected&&this.onIssueSelected(e.id)}),this._client.addMessageHandler("CheckAlive",e=>{this.onCheckAlive&&this.onCheckAlive(e.client)}),this._client.addMessageHandler("DataLoaded",()=>{this.onDataLoaded&&this.onDataLoaded()})}selectObjects(e,t,s,i){this.sendMessage("ObjectsSelected",{ids:e,multiSelect:t,isolate:s,blockProperties:i})}checkAlive(){this.sendMessage("CheckAlive",{})}selectIssue(e){this.sendMessage("IssueSelected",{id:e})}}class o extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onObjectSelected=null,this.onObjectsSelected=null,this.onIssueSelected=null,this.onPinSelected=null,this.onCheckAlive=null,this.onDataLoaded=null,this.onClickedHyperlink=null}getUrl(e,t,s,n){return i.url(this._env,this._options)+"viewer/"+i.embedded+"&destination=EMBEDDED_ISSUE"+i.source(n)+i.token(this._token)+i.client(this._client)+"/#/embeddedissue?project_id="+t+"&issue_id="+s+"&team_id="+e}load(e,t,s,i){const n=this.getUrl(e,t,s,i);this.loadIFrame(n),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("PinSelected",e=>{this.onPinSelected&&this.onPinSelected(e.id)}),this._client.addMessageHandler("ObjectSelected",e=>{this.onObjectSelected&&this.onObjectSelected(e.Id,e.multiSelect,e.selected)}),this._client.addMessageHandler("ObjectsSelected",e=>{this.onObjectsSelected&&this.onObjectsSelected(e.ids,e.multiSelect,e.selected)}),this._client.addMessageHandler("IssueSelected",e=>{this.onIssueSelected&&this.onIssueSelected(e.id)}),this._client.addMessageHandler("CheckAlive",e=>{this.onCheckAlive&&this.onCheckAlive(e.client)}),this._client.addMessageHandler("DataLoaded",()=>{this.onDataLoaded&&this.onDataLoaded()}),this._client.addMessageHandler("ClickedHyperlink",e=>{this.onClickedHyperlink&&this.onClickedHyperlink(e.url)})}selectPin(e){this.sendMessage("PinSelected",{id:e})}selectObjects(e,t,s,i){this.sendMessage("ObjectsSelected",{ids:e,multiSelect:t,isolate:s,blockProperties:i})}checkAlive(){this.sendMessage("CheckAlive",{})}selectIssue(e){this.sendMessage("IssueSelected",{id:e})}}class c extends n{constructor(e,t,s,i,n){super(e,s,i,t,n)}getUrl=function(e,t,s){let n=i.url(this._env,this._options);return n+="viewer/#/objproperties"+i.embedded+i.token(this._token)+i.client(this._client)+"&project_id="+t+"&team_id="+e+"&object_id="+s,n};load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers()}}class r extends d{constructor(e,t,s,i,n){super(e,t,s,i,n),this.onExportStarted=null}getUrl(e,t){let s=this._env&&"localhost"===this._env?"http://127.0.0.1:4200/":i.url(this._env,this._options)+"export-manager/";return s+="#/viewer"+i.embedded+i.token(this._token)+i.client(this._client)+"&project_id="+t+"&team_id="+e,s}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ExportStarted",e=>{this.onExportStarted&&this.onExportStarted(e.id)})}}class h extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/select",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}loadShadowRoot(e,t,s){const i=this.getUrl(t,s);this.loadIFrameShadowRoot(e,i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)}),this._client.addMessageHandler("AttachmentSelectedDetails",e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)})}}class u extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/overlayselect",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)}),this._client.addMessageHandler("AttachmentSelectedDetails",e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)})}}class g extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onModelSelected=null,this.onModelSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/models/select",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ModelSelected",e=>{this.onModelSelected&&this.onModelSelected(e?.id?e.id:e)}),this._client.addMessageHandler("ModelSelectedDetails",e=>{this.onModelSelectedDetails&&this.onModelSelectedDetails(e?.id?e.id:e)})}}class m extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t,s){let n=s||i.url(this._env,this._options);return n+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/isoselect",n}load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)}),this._client.addMessageHandler("AttachmentSelectedDetails",e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)})}}class S extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onModelSelected=null,this.onModelSelectedDetails=null}getUrl(e,t,s){let n=s||i.url(this._env,this._options);return n+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/models/isoselect",n}load(e,t,s){const i=this.getUrl(e,t,s);this.loadIFrame(i),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("ModelSelected",e=>{this.onModelSelected&&this.onModelSelected(e?.id?e.id:e)}),this._client.addMessageHandler("ModelSelectedDetails",e=>{this.onModelSelectedDetails&&this.onModelSelectedDetails(e?.id?e.id:e)})}}class _ extends n{constructor(e,t,s,i,n){super(e,s,i,t,n),this.onAttachmentSelected=null,this.onAttachmentSelectedDetails=null}getUrl(e,t){let s=i.url(this._env,this._options);return s+=i.embedded+i.token(this._token)+i.client(this._client)+"/#/project/"+e+"/"+t+"/files/ifcselect",s}load(e,t){const s=this.getUrl(e,t);this.loadIFrame(s),this.initMessageHandlers()}initMessageHandlers(){super.initMessageHandlers(),this._client.addMessageHandler("AttachmentSelected",e=>{this.onAttachmentSelected&&this.onAttachmentSelected(e?.id?e.id:e)}),this._client.addMessageHandler("AttachmentSelectedDetails",e=>{this.onAttachmentSelectedDetails&&this.onAttachmentSelectedDetails(e?.id?e.id:e)})}}class M{constructor(e,t){this.viewerUri=e&&"dev"!==e&&"stage"!==e&&"prod"!==e&&"fea"!==e?e:i.url(e,t)+"/viewer/#/modelviewer"}openFileUriWindow(e,t,s,n,l){let d="";d=i.addParameters(d,{fileUri:encodeURIComponent(e),team_id:s,project_id:n}),l&&(d=i.addParameters(d,{fileExt:encodeURIComponent(l)}));const a=this.viewerUri+d;return window.open(a,t)}openBufferDataWindow(e,t,s,n){let l="";l=i.addParameters(l,{awaitDataMessage:"true",team_id:s,project_id:n});const d=this.viewerUri+l,a=window.open(d,t);if(!a)return void alert("Could not open preview window. Please enable popups in your browser to use this feature");const o=function(t){"WatingForData"===t.data&&a&&window&&(a.postMessage(e,"*",[e]),window.removeEventListener("message",o))};return window.addEventListener("message",o,!1),a}}const p=function(e){let t,s,i=decodeURIComponent(window.location.search.substring(1)).split("&");for(s=0;s<i.length;s++)if(t=i[s].split("="),t[0]===e)return void 0===t[1]||t[1]};return t})());
|
package/eslint.config.mjs
CHANGED
|
@@ -16,7 +16,6 @@ export default [
|
|
|
16
16
|
sourceType: "module",
|
|
17
17
|
globals: {
|
|
18
18
|
...globals.browser,
|
|
19
|
-
QUnit: true,
|
|
20
19
|
// needed for webpack files
|
|
21
20
|
define: true,
|
|
22
21
|
require: true,
|
|
@@ -27,4 +26,10 @@ export default [
|
|
|
27
26
|
plugins: {},
|
|
28
27
|
rules: {},
|
|
29
28
|
},
|
|
29
|
+
{
|
|
30
|
+
files: ["test/**/*"],
|
|
31
|
+
languageOptions: {
|
|
32
|
+
globals: globals.vitest,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
30
35
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bimplus-webclient",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.69",
|
|
4
4
|
"description": "bim+ web client",
|
|
5
5
|
"types": "types/bimplus-webclient.d.ts",
|
|
6
6
|
"keywords": [
|
|
@@ -29,33 +29,23 @@
|
|
|
29
29
|
"build-docMd": "npm run lint-doc && documentation build ./src/*.js -f md -o ./documentation/Bimplus_WebClient_doc.md",
|
|
30
30
|
"build-docConf": "npm run build-docMd && cd ./documentation && python convert_to_confluence_md.py",
|
|
31
31
|
"build-docAll": "npm run build-doc && npm run build-docConf && npm run build-docMd && npm run build-doc",
|
|
32
|
-
"test": "
|
|
33
|
-
"test-
|
|
34
|
-
"test-chrome-headless": "npm run test -- --single-run=true --browsers ChromeHeadless karma.conf.js",
|
|
35
|
-
"test-firefox": "npm run test -- --single-run=true --browsers Firefox karma.conf.js",
|
|
36
|
-
"test-firefox-headless": "npm run test -- --single-run=true --browsers FirefoxHeadless karma.conf.js",
|
|
37
|
-
"test-watch": "npm run test -- --browsers=ChromeExt --single-run=false --auto-watch"
|
|
32
|
+
"test": "vitest run --coverage",
|
|
33
|
+
"test-watch": "vitest"
|
|
38
34
|
},
|
|
39
35
|
"devDependencies": {
|
|
40
|
-
"@babel/core": "^8.0.
|
|
41
|
-
"@babel/preset-env": "^8.0.
|
|
36
|
+
"@babel/core": "^8.0.6",
|
|
37
|
+
"@babel/preset-env": "^8.0.6",
|
|
42
38
|
"@eslint/js": "^10.0.1",
|
|
39
|
+
"@vitest/coverage-v8": "^5.0.3",
|
|
43
40
|
"babel-loader": "^10.1.1",
|
|
44
|
-
"clean-webpack-plugin": "^4.0.0",
|
|
45
|
-
"coverage-istanbul-loader": "^3.0.5",
|
|
46
41
|
"documentation": "^14.0.3",
|
|
47
|
-
"eslint": "^10.
|
|
48
|
-
"globals": "17.
|
|
49
|
-
"
|
|
50
|
-
"karma-chrome-launcher": "^3.2.0",
|
|
51
|
-
"karma-coverage-istanbul-reporter": "^3.0.2",
|
|
52
|
-
"karma-firefox-launcher": "^2.1.3",
|
|
53
|
-
"karma-qunit": "^4.2.1",
|
|
54
|
-
"karma-webpack": "5.0.1",
|
|
55
|
-
"qunit": "^2.26.0",
|
|
42
|
+
"eslint": "^10.12.0",
|
|
43
|
+
"globals": "17.13.0",
|
|
44
|
+
"jsdom": "^30.1.2",
|
|
56
45
|
"terser-webpack-plugin": "^5.6.1",
|
|
57
|
-
"
|
|
58
|
-
"webpack
|
|
46
|
+
"vitest": "^5.0.3",
|
|
47
|
+
"webpack": "^5.111.1",
|
|
48
|
+
"webpack-cli": "^7.2.3",
|
|
59
49
|
"webpack-merge": "^6.0.1"
|
|
60
50
|
},
|
|
61
51
|
"dependencies": {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
include: ['test/**/*Tests.js'],
|
|
6
|
+
environment: 'jsdom',
|
|
7
|
+
globals: true,
|
|
8
|
+
silent: 'passed-only',
|
|
9
|
+
restoreMocks: true,
|
|
10
|
+
setupFiles: ['./test/vitest.setup.js'],
|
|
11
|
+
coverage: {
|
|
12
|
+
reporter: ['html', 'lcovonly', 'text-summary'],
|
|
13
|
+
reportsDirectory: 'coverage',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|