@labelbee/lb-annotation 1.18.2 → 1.19.0-alpha.2

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.
@@ -1 +1 @@
1
- import{isObject as h}from"lodash";import{EStepType as u,ESortDirection as c}from"../../constant/annotation.js";var v=Object.defineProperty,y=Object.defineProperties,_=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,p=(o,t,e)=>t in o?v(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,g=(o,t)=>{for(var e in t||(t={}))O.call(t,e)&&p(o,e,t[e]);if(d)for(var e of d(t))P.call(t,e)&&p(o,e,t[e]);return o},E=(o,t)=>y(o,_(t));class S{static getStepInfo(t,e){return e==null?void 0:e.filter(r=>r.step===t)[0]}static getCurrentStepInfo(t,e){const r=this.getStepInfo(t,e);return r&&(r.type===u.QUALITY_INSPECTION||r.type===u.MANUAL_CORRECTION)?this.getCurrentStepInfo(r.dataSourceStep,e):r}static getMaxOrder(t){let e=0;return t.forEach(r=>{r.order&&r.order>e&&(e=r.order)}),e}static hotkeyFilter(t){const e=t.target||t.srcElement;if(!e)return!0;const{tagName:r,type:i}=e;if(!r||!i)return!0;let n=!0;return(e.isContentEditable||r==="TEXTAREA"||(r==="INPUT"&&i!=="radio"||r==="TEXTAREA")&&!e.readOnly)&&(n=!1),n}static getNextSelectedRectID(t,e=c.ascend,r){let i=1;e===c.descend&&(i=-1);const n=t.sort((s,f)=>s.x-f.x==0?s.y-f.y:i*(s.x-f.x)),a=n.findIndex(s=>s.id===r),l=n.length;return n[(a+1)%l]}static getNextSelectedRectIDByEvent(t,e,r){const i=e.shiftKey?c.descend:c.ascend;return this.getNextSelectedRectID(t,i,r)}static getRenderResultList(t,e,r=[],i){const n=[];return[t.filter(l=>i&&i.includes(l.id)?(n.push(l),!1):!(r.length>0&&!r.includes(l==null?void 0:l.attribute)||this.isDifferSourceID(l==null?void 0:l.sourceID,e))),n]}static getSourceID(t){var e;const r="";return t&&(e=t==null?void 0:t.id)!=null?e:r}static findAllLine(t,e=!0){const r=[],i=[...t];i.length>=3&&e===!0&&i.push(g({},i[0]));for(let n=0;n<i.length;n++)i[n+1]&&r.push({point1:i[n],point2:i[n+1],pointIndex:n});return r}static translateSourceID(t){return(t===void 0||t===0||t==="0")&&(t=""),t}static isDifferSourceID(t,e){return t=this.translateSourceID(t),e=this.translateSourceID(e),`${t}`!=`${e}`}static isSameSourceID(t,e){return t=this.translateSourceID(t),e=this.translateSourceID(e),`${t}`==`${e}`}static getNextMarker(t,e=[],r){if((e==null?void 0:e.length)===0)return;let i=e.map((n,a)=>E(g({},n),{index:a}));if(typeof r=="number"&&r>0){const n=e[r];if(n&&t.every(a=>a.label!==n.value))return{label:n.value,index:r};i=[...i.slice(r,e.length),...i.slice(0,r)]}for(let n=0;n<i.length;n++)if(!t.some(a=>a.label===i[n].value))return{label:i[n].value,index:i[n].index}}static getCurrentMarkerIndex(t,e=[]){return e.findIndex(r=>t===r.value)}}S.jsonParser=(o,t={})=>{try{return typeof o=="string"?JSON.parse(o):h(o)?o:t}catch(e){return t}};export{S as default};
1
+ import{isObject as y}from"lodash";import{EStepType as p,ESortDirection as c}from"../../constant/annotation.js";import f from"../../constant/keyCode.js";var _=Object.defineProperty,O=Object.defineProperties,I=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,S=(o,t,e)=>t in o?_(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,d=(o,t)=>{for(var e in t||(t={}))P.call(t,e)&&S(o,e,t[e]);if(g)for(var e of g(t))E.call(t,e)&&S(o,e,t[e]);return o},h=(o,t)=>O(o,I(t));class v{static getStepInfo(t,e){return e==null?void 0:e.filter(r=>r.step===t)[0]}static getCurrentStepInfo(t,e){const r=this.getStepInfo(t,e);return r&&(r.type===p.QUALITY_INSPECTION||r.type===p.MANUAL_CORRECTION)?this.getCurrentStepInfo(r.dataSourceStep,e):r}static getCurrentStepToolAndConfig(t,e){const r=this.getStepInfo(t,e);if(r){const n=this.getCurrentStepInfo(t,e);return h(d({},r),{tool:n.tool,config:n.config})}return!1}static getMaxOrder(t){let e=0;return t.forEach(r=>{r.order&&r.order>e&&(e=r.order)}),e}static hotkeyFilter(t){const e=t.target||t.srcElement;if(!e)return!0;const{tagName:r,type:n}=e;if(!r||!n)return!0;let i=!0;return(e.isContentEditable||r==="TEXTAREA"||(r==="INPUT"&&n!=="radio"||r==="TEXTAREA")&&!e.readOnly)&&(i=!1),i}static isMoveKey(t){return[f.Left,f.Right,f.Down,f.Up,f.Space].includes(t)}static getNextSelectedRectID(t,e=c.ascend,r){let n=1;e===c.descend&&(n=-1);const i=t.sort((l,u)=>l.x-u.x==0?l.y-u.y:n*(l.x-u.x)),a=i.findIndex(l=>l.id===r),s=i.length;return i[(a+1)%s]}static getNextSelectedRectIDByEvent(t,e,r){const n=e.shiftKey?c.descend:c.ascend;return this.getNextSelectedRectID(t,n,r)}static getRenderResultList(t,e,r=[],n){const i=[];return[t.filter(s=>n&&n.includes(s.id)?(i.push(s),!1):!(r.length>0&&!r.includes(s==null?void 0:s.attribute)||this.isDifferSourceID(s==null?void 0:s.sourceID,e))),i]}static getSourceID(t){var e;const r="";return t&&(e=t==null?void 0:t.id)!=null?e:r}static findAllLine(t,e=!0){const r=[],n=[...t];n.length>=3&&e===!0&&n.push(d({},n[0]));for(let i=0;i<n.length;i++)n[i+1]&&r.push({point1:n[i],point2:n[i+1],pointIndex:i});return r}static translateSourceID(t){return(t===void 0||t===0||t==="0")&&(t=""),t}static isDifferSourceID(t,e){return t=this.translateSourceID(t),e=this.translateSourceID(e),`${t}`!=`${e}`}static isSameSourceID(t,e){return t=this.translateSourceID(t),e=this.translateSourceID(e),`${t}`==`${e}`}static getNextMarker(t,e=[],r){if((e==null?void 0:e.length)===0)return;let n=e.map((i,a)=>h(d({},i),{index:a}));if(typeof r=="number"&&r>0){const i=e[r];if(i&&t.every(a=>a.label!==i.value))return{label:i.value,index:r};n=[...n.slice(r,e.length),...n.slice(0,r)]}for(let i=0;i<n.length;i++)if(!t.some(a=>a.label===n[i].value))return{label:n[i].value,index:n[i].index}}static getCurrentMarkerIndex(t,e=[]){return e.findIndex(r=>t===r.value)}}v.jsonParser=(o,t={})=>{try{return typeof o=="string"?JSON.parse(o):y(o)?o:t}catch(e){return t}};export{v as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-annotation",
3
- "version": "1.18.2",
3
+ "version": "1.19.0-alpha.2",
4
4
  "description": "Annotation tool collection",
5
5
  "keywords": [
6
6
  "annotation",
@@ -94,7 +94,7 @@
94
94
  "typescript": "^4.2.3"
95
95
  },
96
96
  "dependencies": {
97
- "@labelbee/lb-utils": "1.11.1",
97
+ "@labelbee/lb-utils": "1.12.0-alpha.2",
98
98
  "@turf/turf": "5.1.6",
99
99
  "color-rgba": "^2.3.0",
100
100
  "lodash": "^4.17.20",