@soonspacejs/plugin-poi-renderer 2.13.10 → 2.13.12

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/dist/index.d.ts CHANGED
@@ -1,56 +1,56 @@
1
- import SoonSpace from 'soonspacejs';
2
- import type { PoiNode, PoiNodeInfo } from 'soonspacejs';
3
- import * as CSS from 'csstype';
4
- export type PoiNodeBaseOption = Omit<PoiNodeInfo, 'element'>;
5
- export interface PoiNodeCustomOptions extends PoiNodeBaseOption {
6
- tagName: keyof HTMLElementTagNameMap;
7
- style?: CSS.Properties;
8
- innerHTML?: string;
9
- }
10
- export interface PoiNodeVideoOptions extends PoiNodeBaseOption {
11
- src?: string;
12
- style?: CSS.Properties;
13
- isLoop?: boolean;
14
- autoPlay?: boolean;
15
- }
16
- export interface PoiNodePanelDataSource {
17
- label: string;
18
- value: string;
19
- }
20
- export interface PoiNodePanelOptions extends PoiNodeBaseOption {
21
- dataSource: PoiNodePanelDataSource[];
22
- style?: CSS.Properties;
23
- rowStyle?: CSS.Properties;
24
- labelStyle?: CSS.Properties;
25
- valueStyle?: CSS.Properties;
26
- }
27
- export type PoiImageOptions = PoiNodeVideoOptions;
28
- export declare const DefaultStyle: CSS.Properties;
29
- export declare enum PoiContentTypeEnum {
30
- PANEL = "PANEL",
31
- VIDEO = "VIDEO",
32
- VIDEO_STREAM = "VIDEO_STREAM"
33
- }
34
- export interface PoiNodeData extends PoiNodeBaseOption {
35
- pid?: string;
36
- width: number;
37
- height: number;
38
- dataSource: PoiNodePanelDataSource[];
39
- fileUrl?: string;
40
- contentType: PoiContentTypeEnum;
41
- style: string;
42
- }
43
- export interface PoiNodeBatchOptions {
44
- dataSource: PoiNodeData[];
45
- }
46
- export default class PatrolControlsPlugin {
47
- readonly ssp: SoonSpace;
48
- poiIdSet: Set<string>;
49
- constructor(ssp: SoonSpace);
50
- private resetStyleName;
51
- private mergeElementStyle;
52
- renderCustom(options: PoiNodeCustomOptions): PoiNode;
53
- renderVideo(options: PoiNodeVideoOptions): PoiNode;
54
- renderPanel(options: PoiNodePanelOptions): PoiNode;
55
- batchRender(batchOptions: PoiNodeBatchOptions): void;
56
- }
1
+ import SoonSpace from 'soonspacejs';
2
+ import type { PoiNode, PoiNodeInfo } from 'soonspacejs';
3
+ import * as CSS from 'csstype';
4
+ export type PoiNodeBaseOption = Omit<PoiNodeInfo, 'element'>;
5
+ export interface PoiNodeCustomOptions extends PoiNodeBaseOption {
6
+ tagName: keyof HTMLElementTagNameMap;
7
+ style?: CSS.Properties;
8
+ innerHTML?: string;
9
+ }
10
+ export interface PoiNodeVideoOptions extends PoiNodeBaseOption {
11
+ src?: string;
12
+ style?: CSS.Properties;
13
+ isLoop?: boolean;
14
+ autoPlay?: boolean;
15
+ }
16
+ export interface PoiNodePanelDataSource {
17
+ label: string;
18
+ value: string;
19
+ }
20
+ export interface PoiNodePanelOptions extends PoiNodeBaseOption {
21
+ dataSource: PoiNodePanelDataSource[];
22
+ style?: CSS.Properties;
23
+ rowStyle?: CSS.Properties;
24
+ labelStyle?: CSS.Properties;
25
+ valueStyle?: CSS.Properties;
26
+ }
27
+ export type PoiImageOptions = PoiNodeVideoOptions;
28
+ export declare const DefaultStyle: CSS.Properties;
29
+ export declare enum PoiContentTypeEnum {
30
+ PANEL = "PANEL",
31
+ VIDEO = "VIDEO",
32
+ VIDEO_STREAM = "VIDEO_STREAM"
33
+ }
34
+ export interface PoiNodeData extends PoiNodeBaseOption {
35
+ pid?: string;
36
+ width: number;
37
+ height: number;
38
+ dataSource: PoiNodePanelDataSource[];
39
+ fileUrl?: string;
40
+ contentType: PoiContentTypeEnum;
41
+ style: string;
42
+ }
43
+ export interface PoiNodeBatchOptions {
44
+ dataSource: PoiNodeData[];
45
+ }
46
+ export default class PatrolControlsPlugin {
47
+ readonly ssp: SoonSpace;
48
+ poiIdSet: Set<string>;
49
+ constructor(ssp: SoonSpace);
50
+ private resetStyleName;
51
+ private mergeElementStyle;
52
+ renderCustom(options: PoiNodeCustomOptions): PoiNode;
53
+ renderVideo(options: PoiNodeVideoOptions): PoiNode;
54
+ renderPanel(options: PoiNodePanelOptions): PoiNode;
55
+ batchRender(batchOptions: PoiNodeBatchOptions): void;
56
+ }
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- const e={width:"400px",height:"300px",backgroundColor:"black"};var t;!function(e){e.PANEL="PANEL",e.VIDEO="VIDEO",e.VIDEO_STREAM="VIDEO_STREAM"}(t||(t={}));class s{constructor(e){this.ssp=e,this.poiIdSet=new Set}resetStyleName(e){const t=[...e];for(const e in t)t[e]!==t[e].toLowerCase()&&(t[e]=`-${t[e].toLowerCase()}`);return t.join("")}mergeElementStyle(e){let t="";for(const s in e)t+=`${this.resetStyleName(s)}: ${e[s]};`;return t}renderCustom(t){const{tagName:s,style:n=e,innerHTML:i}=t,a=document.createElement(s);return a.style.cssText=this.mergeElementStyle(n),i&&(a.innerHTML=i),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:a}))}renderVideo(t){const{src:s,style:n=e,isLoop:i=!0,autoPlay:a=!0}=t,l=document.createElement("video");return l.style.cssText=this.mergeElementStyle(n),l.controls=!0,l.muted=!0,l.loop=i,l.autoplay=a,s&&(l.src=s),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:l}))}renderPanel(e){const{dataSource:t,rowStyle:s,labelStyle:n,valueStyle:i}=e,a=t.map((e=>`<div style="${this.mergeElementStyle(s||{})}">\n<span style="${this.mergeElementStyle(n||{})}">${e.label}</span>\n<span style="${this.mergeElementStyle(i||{})}">${e.value}</span>\n</div>`)).join("");return this.renderCustom(Object.assign(Object.assign({tagName:"div"},e),{innerHTML:a}))}batchRender(e){const{dataSource:s}=e;this.poiIdSet.forEach((e=>{this.ssp.removeObjectById(e)})),this.poiIdSet.clear();s.forEach((e=>{const{id:s,pid:n,width:i,height:a,dataSource:l,fileUrl:o,style:r,visible:c}=e;let d=this.ssp.getObjectById(s);const g=c;if(this.poiIdSet.add(s),e.contentType===t.VIDEO)d=this.renderVideo(Object.assign(Object.assign({},e),{src:o,visible:g,style:{width:i+"px",height:a+"px"}}));else if(e.contentType===t.PANEL){const{panel:{bodyStyle:t,rowStyle:s,labelStyle:n,valueStyle:c}}=JSON.parse(r);d=this.renderPanel(Object.assign(Object.assign({},e),{visible:g,style:Object.assign(Object.assign({width:i+"px",height:a+"px",backgroundImage:`url(${o})`,overflow:"auto"},t),{padding:t.padding+"px"}),rowStyle:Object.assign(Object.assign({},s),{gap:s.gap+"px"}),labelStyle:Object.assign(Object.assign({},n),{fontSize:n.fontSize+"px"}),valueStyle:Object.assign(Object.assign({},c),{fontSize:c.fontSize+"px"}),dataSource:l}))}if(d&&n){const e=this.ssp.getObjectById(n);e&&this.ssp.addObject(d,e)}}))}}export{e as DefaultStyle,t as PoiContentTypeEnum,s as default};
1
+ const e={width:"400px",height:"300px",backgroundColor:"black"};var t;!function(e){e.PANEL="PANEL",e.VIDEO="VIDEO",e.VIDEO_STREAM="VIDEO_STREAM"}(t||(t={}));class s{constructor(e){this.ssp=e,this.poiIdSet=new Set}resetStyleName(e){const t=[...e];for(const e in t)t[e]!==t[e].toLowerCase()&&(t[e]=`-${t[e].toLowerCase()}`);return t.join("")}mergeElementStyle(e){let t="";for(const s in e)t+=`${this.resetStyleName(s)}: ${e[s]};`;return t}renderCustom(t){const{tagName:s,style:n=e,innerHTML:i}=t,a=document.createElement(s);return a.style.cssText=this.mergeElementStyle(n),i&&(a.innerHTML=i),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:a}))}renderVideo(t){const{src:s,style:n=e,isLoop:i=!0,autoPlay:a=!0}=t,l=document.createElement("video");return l.style.cssText=this.mergeElementStyle(n),l.controls=!0,l.muted=!0,l.loop=i,l.autoplay=a,s&&(l.src=s),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:l}))}renderPanel(e){const{dataSource:t,rowStyle:s,labelStyle:n,valueStyle:i}=e,a=t.map(e=>`<div style="${this.mergeElementStyle(s||{})}">\n<span style="${this.mergeElementStyle(n||{})}">${e.label}</span>\n<span style="${this.mergeElementStyle(i||{})}">${e.value}</span>\n</div>`).join("");return this.renderCustom(Object.assign(Object.assign({tagName:"div"},e),{innerHTML:a}))}batchRender(e){const{dataSource:s}=e;this.poiIdSet.forEach(e=>{this.ssp.removeObjectById(e)}),this.poiIdSet.clear();s.forEach(e=>{const{id:s,pid:n,width:i,height:a,dataSource:l,fileUrl:o,style:r,visible:c}=e;let d=this.ssp.getObjectById(s);const g=c;if(this.poiIdSet.add(s),e.contentType===t.VIDEO)d=this.renderVideo(Object.assign(Object.assign({},e),{src:o,visible:g,style:{width:i+"px",height:a+"px"}}));else if(e.contentType===t.PANEL){const{panel:{bodyStyle:t,rowStyle:s,labelStyle:n,valueStyle:c}}=JSON.parse(r);d=this.renderPanel(Object.assign(Object.assign({},e),{visible:g,style:Object.assign(Object.assign({width:i+"px",height:a+"px",backgroundImage:`url(${o})`,overflow:"auto"},t),{padding:t.padding+"px"}),rowStyle:Object.assign(Object.assign({},s),{gap:s.gap+"px"}),labelStyle:Object.assign(Object.assign({},n),{fontSize:n.fontSize+"px"}),valueStyle:Object.assign(Object.assign({},c),{fontSize:c.fontSize+"px"}),dataSource:l}))}if(d&&n){const e=this.ssp.getObjectById(n);e&&this.ssp.addObject(d,e)}})}}export{e as DefaultStyle,t as PoiContentTypeEnum,s as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-poi-renderer",
3
3
  "pluginName": "PoiRendererPlugin",
4
- "version": "2.13.10",
4
+ "version": "2.13.12",
5
5
  "description": "Poi-renderer plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -13,9 +13,9 @@
13
13
  ],
14
14
  "author": "xunwei",
15
15
  "license": "UNLICENSED",
16
- "gitHead": "6bca3b98477ef9c2fa0ba5f67d461561896bb0ff",
16
+ "gitHead": "aa34f472ae1520b537b0a5a1d67f4a746f41236a",
17
17
  "peerDependencies": {
18
- "soonspacejs": "2.13.10"
18
+ "soonspacejs": "2.13.12"
19
19
  },
20
20
  "dependencies": {
21
21
  "csstype": "^3.1.2"