@labelbee/lb-components 1.21.0-alpha.12 → 1.21.0-alpha.13
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/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/dist/components/videoAnnotate/videoTextTool/index.js +1 -1
- package/dist/types/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.d.ts +0 -3
- package/dist/types/components/videoAnnotate/videoTextTool/index.d.ts +0 -3
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -1
- package/es/components/videoAnnotate/videoTextTool/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),VideoTagLayer=require("../../videoPlayer/VideoTagLayer.js"),_=require("lodash"),utils=require("../../videoPlayer/utils.js");function _interopDefaultLegacy(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const l=e?this.state.tagResult.map(i=>((i==null?void 0:i.result[e])&&delete i.result[e],i)):[];this.setState({tagResult:l},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e;const l=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[this.state.tagResult,{valid:this.state.valid,duration:l}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var l,i;const{isMulti:n}=t,{key:r,value:a}=t.value;if(n){let o=(i=(l=e[r])==null?void 0:l.split(";"))!=null?i:[];o.includes(a)?o=o.filter(h=>h!==a):o.push(a);const u=new Set(o);return e[r]=Array.from(u).join(";"),___default.default.pickBy(e,h=>h)}return e[r]=e[r]===a?void 0:a,___default.default.pickBy(e,o=>o)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,e)=>{this.setLabelBySelectedList(t,e)},this.keydown=t=>{var e;const l=utils.getKeyCodeNumber(t.keyCode);if(l){const i=l-1;if(((e=this.config.inputList)==null?void 0:e.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:e,imgIndex:l,stepInfo:i}=t;if(!e[l])return;const n=index.jsonParser(e[l].result),r=n[`step_${i.step}`],a=this.getInitResultList();this.setState({tagResult:r?r==null?void 0:r.result:a,valid:(n==null?void 0:n.valid)===void 0?!0:n.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return lbAnnotation.TagUtils.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return index.jsonParser((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,t){this.fns[s]=t}on(s,t){this.singleOn(s,t)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,t){var e,l,i;try{const n=(l=(e=this.config)==null?void 0:e.inputList)!=null?l:[],r=(n==null?void 0:n.length)>1,a=t!==void 0?s:0,o=t!==void 0?t:s,u=r?n[a]:n[0],h=((i=u.subSelected)!=null?i:[])[o];if(u&&h)return{value:{key:u.value,value:h.value},isMulti:u.isMulti}}catch(n){return}}setLabelBySelectedList(s,t){var e,l,i,n;const r=this.getTagResultByCode(s,t);if(r){const a=this.combineResult(r,(l=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?l:{}),o=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(n=(i=this.currentTagResult)==null?void 0:i.id)!=null?n:lbAnnotation.uuid(8,62),result:a}];this.setState({tagResult:o},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:t,imgList:e,pageForward:l,pageJump:i,pageBackward:n}=this.props,{tagResult:r,valid:a}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:t,imgList:e,pageBackward:n,pageForward:l,pageJump:i,valid:a,setVideoRef:o=>{this.videoPlayer=o},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:r,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),_=require("lodash"),VideoTextLayer=require("../../videoPlayer/VideoTextLayer.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index=require("../../../utils/index.js"),index$1=require("../../videoPlayer/index.js"),_=require("lodash"),VideoTextLayer=require("../../videoPlayer/VideoTextLayer.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class VideoTextTool extends React__default.default.Component{constructor(s){super(s);this.fns={},this.clearResult=(t=!0)=>{this.setState({result:{}},()=>this.updateSidebar())},this.exportData=()=>{var t,e;const i=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[[this.state.result],{valid:this.state.valid,duration:i}]},this.toggleShowText=t=>{this.setState({showText:t})},this.singleOn=(t,e)=>{this.fns[t]=e},this.on=(t,e)=>{this.singleOn(t,e)},this.unbindAll=t=>{delete this.fns[t]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.updateSidebar=()=>{this.emitEvent("valueUpdated")},this.updateTextValue=(t,e,i,r)=>{var o;const l=___default.default.cloneDeep(r!=null?r:{});l.value=Object.assign((o=l.value)!=null?o:{},{[t]:e}),this.setState({result:l},()=>i&&this.updateSidebar())},this.setResult=t=>{this.setState({result:t}),this.fns.render&&this.fns.render()},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({result:{}}),this.emitEvent("render")},this.setResultFromImgList=t=>{var e,i;const{imgList:r,imgIndex:o,stepInfo:l}=t;if(!r[o])return;const a=index.jsonParser(r[o].result),u=a[`step_${l.step}`],d={value:this.getInitTextValue()};this.setState({result:u?(i=(e=u==null?void 0:u.result)==null?void 0:e[0])!=null?i:{}:d,valid:(a==null?void 0:a.valid)===void 0?!0:a.valid},()=>this.updateSidebar())},this.getInitTextValue=()=>{let t={};return this.config.configList.forEach(e=>{var i;t[e.key]=(i=e.default)!=null?i:""}),t},this.state={result:{},valid:!0,showText:!0}}get config(){var s;return index.jsonParser((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get valid(){return this.state.valid}get needConfirm(){var s;const{result:t}=this.state;return(s=this.config.configList)==null?void 0:s.some(e=>{var i;return e.required&&!((i=t==null?void 0:t.value)==null?void 0:i[e.key])})}get textList(){return[this.state.result]}getColor(s=this.config,t=""){return lbUtils.toolStyleConverter.getColorByConfig({attribute:t,config:s})}componentDidMount(){this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s,t;const{imgIndex:e,imgList:i,pageForward:r,pageJump:o,pageBackward:l}=this.props,{result:a,valid:u,showText:d}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},d&&a.value&&React__default.default.createElement(VideoTextLayer.VideoTextLayer,{value:a.value,toolColor:(t=(s=this.getColor(this.config))==null?void 0:s.valid)==null?void 0:t.fill,configList:this.config.configList,hasPromptLayer:!!this.props.drawLayerSlot}),React__default.default.createElement(index$1.VideoPlayer,{imgIndex:e,imgList:i,pageBackward:l,pageForward:r,pageJump:o,valid:u,setVideoRef:h=>{this.videoPlayer=h},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded}))}}exports.VideoTextTool=VideoTextTool;
|
|
@@ -40,9 +40,6 @@ export declare class TagToolInstanceAdaptor extends React.Component<IVideoTagIns
|
|
|
40
40
|
exportData: () => (any[] | {
|
|
41
41
|
valid: boolean;
|
|
42
42
|
duration: number;
|
|
43
|
-
frames: number | undefined;
|
|
44
|
-
videoWidth: number;
|
|
45
|
-
videoHeight: number;
|
|
46
43
|
})[];
|
|
47
44
|
singleOn(event: string, func: () => void): void;
|
|
48
45
|
on(event: string, func: () => void): void;
|
|
@@ -33,9 +33,6 @@ export declare class VideoTextTool extends React.Component<IVideoTextInstanceAda
|
|
|
33
33
|
exportData: () => (any[] | {
|
|
34
34
|
valid: boolean;
|
|
35
35
|
duration: number;
|
|
36
|
-
frames: number | undefined;
|
|
37
|
-
videoWidth: number;
|
|
38
|
-
videoHeight: number;
|
|
39
36
|
})[];
|
|
40
37
|
toggleShowText: (v: boolean) => void;
|
|
41
38
|
singleOn: (event: string, func: () => void) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import h from"react";import{TagUtils as
|
|
1
|
+
import h from"react";import{TagUtils as p,CommonToolUtils as m,uuid as v}from"@labelbee/lb-annotation";import{jsonParser as c}from"../../../utils/index.js";import{VideoPlayer as f}from"../../videoPlayer/index.js";import{VideoTagLayer as y}from"../../videoPlayer/VideoTagLayer.js";import g from"lodash";import{getKeyCodeNumber as L}from"../../videoPlayer/utils.js";class R extends h.Component{constructor(s){super(s);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const l=e?this.state.tagResult.map(i=>((i==null?void 0:i.result[e])&&delete i.result[e],i)):[];this.setState({tagResult:l},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e;const l=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[this.state.tagResult,{valid:this.state.valid,duration:l}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var l,i;const{isMulti:n}=t,{key:o,value:r}=t.value;if(n){let a=(i=(l=e[o])==null?void 0:l.split(";"))!=null?i:[];a.includes(r)?a=a.filter(u=>u!==r):a.push(r);const d=new Set(a);return e[o]=Array.from(d).join(";"),g.pickBy(e,u=>u)}return e[o]=e[o]===r?void 0:r,g.pickBy(e,a=>a)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,e)=>{this.setLabelBySelectedList(t,e)},this.keydown=t=>{var e;const l=L(t.keyCode);if(l){const i=l-1;if(((e=this.config.inputList)==null?void 0:e.length)===1){this.labelSelectedList=[0,i],this.setLabel(0,i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],i],this.setLabel(this.labelSelectedList[0],i),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[i],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{const{imgList:e,imgIndex:l,stepInfo:i}=t;if(!e[l])return;const n=c(e[l].result),o=n[`step_${i.step}`],r=this.getInitResultList();this.setState({tagResult:o?o==null?void 0:o.result:r,valid:(n==null?void 0:n.valid)===void 0?!0:n.valid},()=>this.emitEvent("render"))},this.getInitResultList=()=>{var t;return p.getDefaultTagResult((t=this.config.inputList)!=null?t:[],[])},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){var s;return c((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var s;return(s=this.state.tagResult[0])!=null?s:{}}get valid(){return this.state.valid}singleOn(s,t){this.fns[s]=t}on(s,t){this.singleOn(s,t)}unbindAll(s){delete this.fns[s]}getTagResultByCode(s,t){var e,l,i;try{const n=(l=(e=this.config)==null?void 0:e.inputList)!=null?l:[],o=(n==null?void 0:n.length)>1,r=t!==void 0?s:0,a=t!==void 0?t:s,d=o?n[r]:n[0],u=((i=d.subSelected)!=null?i:[])[a];if(d&&u)return{value:{key:d.value,value:u.value},isMulti:d.isMulti}}catch(n){return}}setLabelBySelectedList(s,t){var e,l,i,n;const o=this.getTagResultByCode(s,t);if(o){const r=this.combineResult(o,(l=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?l:{}),a=[{sourceID:m.getSourceID(),id:(n=(i=this.currentTagResult)==null?void 0:i.id)!=null?n:v(8,62),result:r}];this.setState({tagResult:a},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s;const{imgIndex:t,imgList:e,pageForward:l,pageJump:i,pageBackward:n}=this.props,{tagResult:o,valid:r}=this.state;return h.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},h.createElement(f,{imgIndex:t,imgList:e,pageBackward:n,pageForward:l,pageJump:i,valid:r,setVideoRef:a=>{this.videoPlayer=a},dataLoaded:this.props.onVideoLoaded,drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer}),h.createElement(y,{result:o,inputList:(s=this.config)==null?void 0:s.inputList,hasPromptLayer:!!this.props.drawLayerSlot}))}}export{R as TagToolInstanceAdaptor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import u from"react";import{jsonParser as
|
|
1
|
+
import u from"react";import{jsonParser as h}from"../../../utils/index.js";import{VideoPlayer as v}from"../../videoPlayer/index.js";import f from"lodash";import{VideoTextLayer as g}from"../../videoPlayer/VideoTextLayer.js";import{toolStyleConverter as m}from"@labelbee/lb-utils";class c extends u.Component{constructor(s){super(s);this.fns={},this.clearResult=(t=!0)=>{this.setState({result:{}},()=>this.updateSidebar())},this.exportData=()=>{var t,e;const i=(e=(t=this.videoPlayer)==null?void 0:t.duration)!=null?e:0;return[[this.state.result],{valid:this.state.valid,duration:i}]},this.toggleShowText=t=>{this.setState({showText:t})},this.singleOn=(t,e)=>{this.fns[t]=e},this.on=(t,e)=>{this.singleOn(t,e)},this.unbindAll=t=>{delete this.fns[t]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.updateSidebar=()=>{this.emitEvent("valueUpdated")},this.updateTextValue=(t,e,i,o)=>{var r;const l=f.cloneDeep(o!=null?o:{});l.value=Object.assign((r=l.value)!=null?r:{},{[t]:e}),this.setState({result:l},()=>i&&this.updateSidebar())},this.setResult=t=>{this.setState({result:t}),this.fns.render&&this.fns.render()},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({result:{}}),this.emitEvent("render")},this.setResultFromImgList=t=>{var e,i;const{imgList:o,imgIndex:r,stepInfo:l}=t;if(!o[r])return;const n=h(o[r].result),a=n[`step_${l.step}`],d={value:this.getInitTextValue()};this.setState({result:a?(i=(e=a==null?void 0:a.result)==null?void 0:e[0])!=null?i:{}:d,valid:(n==null?void 0:n.valid)===void 0?!0:n.valid},()=>this.updateSidebar())},this.getInitTextValue=()=>{let t={};return this.config.configList.forEach(e=>{var i;t[e.key]=(i=e.default)!=null?i:""}),t},this.state={result:{},valid:!0,showText:!0}}get config(){var s;return h((s=this.props.stepInfo)==null?void 0:s.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get valid(){return this.state.valid}get needConfirm(){var s;const{result:t}=this.state;return(s=this.config.configList)==null?void 0:s.some(e=>{var i;return e.required&&!((i=t==null?void 0:t.value)==null?void 0:i[e.key])})}get textList(){return[this.state.result]}getColor(s=this.config,t=""){return m.getColorByConfig({attribute:t,config:s})}componentDidMount(){this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){this.props.onUnmounted()}shouldComponentUpdate(s){return s.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(s),!0}render(){var s,t;const{imgIndex:e,imgList:i,pageForward:o,pageJump:r,pageBackward:l}=this.props,{result:n,valid:a,showText:d}=this.state;return u.createElement("div",{style:{height:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column"}},d&&n.value&&u.createElement(g,{value:n.value,toolColor:(t=(s=this.getColor(this.config))==null?void 0:s.valid)==null?void 0:t.fill,configList:this.config.configList,hasPromptLayer:!!this.props.drawLayerSlot}),u.createElement(v,{imgIndex:e,imgList:i,pageBackward:l,pageForward:o,pageJump:r,valid:a,setVideoRef:p=>{this.videoPlayer=p},drawLayerSlot:this.props.drawLayerSlot,footer:this.props.footer,dataLoaded:this.props.onVideoLoaded}))}}export{c as VideoTextTool};
|