he-tree-react
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -1,2 +0,2 @@ | ||
var HeTreeReact=function(R,re,M,be){"use strict";/*! | ||
var HeTreeReact=function(O,de,A,be){"use strict";/*! | ||
* he-tree-react | ||
@@ -10,3 +10,3 @@ * Author: phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/function ke(n,e){return n<e?e:n}function Te(n,e){return n<e?n:e}function me(n,e,o){return Te(ke(n,e),o)}function Ee(n){return n[0]}function Pe(n){return n[n.length-1]}function Ce(n,e){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},t=o&&o.withSelf?n:n.parentElement;for(;t;){const c=o.until&&t===o.until;if(c&&!o.withUntil)return;const f=e(t);if(f==="break")return;if(f)return t;if(c)return;t=t.parentElement}}function Oe(n,e){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};o={start:0,end:n.length-1,maxTimes:1e3,...o};let{start:t,end:c}=o;const{returnNearestIfNoHit:f,maxTimes:D}=o;let l,d;t==null&&(t=0,c=n.length-1);let a=0,h;for(;t>=0&&t<=c;){if(a>=D)throw Error("binarySearch: loop times is over ".concat(D,", you can increase the limit."));l=Math.floor((c-t)/2+t),d=n[l];const w=a+1;if(h=e(d,l,w),h>0)c=l-1;else if(h<0)t=l+1;else return{index:l,value:d,count:w,hit:!0};a++}return f?{index:l,value:d,count:a+1,hit:!1,greater:h>0}:null}const ne={id:null,x:0,y:0,time:0},he={idKey:"id",parentIdKey:"parent_id",childrenKey:"children",indent:20,dragOpen:!1,dragOpenDelay:600,placeholderId:"__DRAG_PLACEHOLDER__",dataType:"flat",direction:"ltr",rootId:null,virtual:!1};function Re(n){const e={...he,...n},{idKey:o,parentIdKey:t,childrenKey:c,placeholderId:f,isFunctionReactive:D}=e,l={idKey:o,parentIdKey:t};if(!e.renderNode&&!e.renderNodeBox)throw new Error("Either renderNodeBox or renderNode is required.");const d=e.direction==="rtl",a=M.useMemo(()=>e.openIds?[...e.openIds].sort().toString():void 0,[e.openIds]),h=M.useMemo(()=>new Set(e.openIds),[a]),w=M.useMemo(()=>e.checkedIds?[...e.checkedIds].sort().toString():"",[e.checkedIds]),O=M.useMemo(()=>new Set(e.checkedIds),[w]),P=M.useMemo(()=>{var ae,r;const E={},V={},_=[],j=[],q=[],ee=[];function*le(){if(e.dataType==="flat")for(const i of e.data)yield[i];else for(const i of W(e.data,c))yield i}let $=0;for(const[i,s]of le()){const p=i[o]??$;ee.push(p);let C=i[t];e.dataType==="tree"&&(C=((ae=s.parent)==null?void 0:ae[o])??null);let A=V[C]||null;const y=E[C]||null,I=[],v=[],m=[];let x,b,F;y?(x=y.childIds,b=y.children,F=y.childStats):(x=_,b=j,F=q);const B=x.length,z=(y==null?void 0:y.level)+1||1,ue={_isStat:!0,id:p,pid:C,childIds:I,siblingIds:x,node:i,parent:A,parentStat:y,children:v,childStats:m,siblings:b,siblingStats:F,index:B,level:z,open:e.openIds?h.has(p):!0,checked:O.has(p),draggable:!1};E[p]=ue,V[p]=i,x.push(p),b.push(i),F.push(ue),$++}for(const[i]of W(q,"childStats")){let s=((r=e.canDrag)==null?void 0:r.call(e,i))??null;s===null&&(s=i.parentStat?i.parentStat.draggable:!0),i.draggable=s}return{rootIds:_,rootNodes:j,rootStats:q,allIds:ee,getStat:i=>{let s;return typeof i=="object"?s=i._isStat?i.id:i[o]:s=i,E[s]}}},[e.data,e.dataType,o,t,h,O,D&&e.canDrag]),{rootIds:L,rootStats:K,getStat:u}=P,S=e.indent,[g,k]=M.useState(),[H,N]=M.useState(),Y=M.useRef(null),U=M.useRef(null),[T,oe]=M.useState(),ie=!g,We=M.useMemo(()=>{const E=[],V=[];for(const[r,{skipChildren:i}]of W(K,"childStats")){const s=_(r);r===g&&(Object.assign(s.style,{position:"fixed",top:0,left:0,pointerEvents:"none",zIndex:"-999999999",visibility:"hidden"}),s["data-dragging"]=!0),V.push(s),E.push(r.id),(!r.open||r===g)&&i()}if(T){const i=((p,C)=>{let A=((p==null?void 0:p.childStats)||K)[C],y;if(A)y=E.indexOf(A.id);else{const I=m=>m.siblingStats[m.siblingStats.indexOf(m)+1];let v;if(p){for(const m of ce(p,"parentStat",{withSelf:!0}))if(v=I(m),v)break}v?y=E.indexOf(v.id):y=E.length}return y})(T.parentStat,T.index);E.splice(i,0,f);const s=_({id:f,level:T.level},!0);s["data-drag-placeholder"]=!0,V.splice(i,0,s)}function _(r,i=!1){return{key:r.id,draggable:r.draggable,style:{[`padding${d?"Right":"Left"}`]:(r.level-1)*S+"px"},"data-key":r.id+"","data-level":r.level+"","data-node-box":!0,onDragStart(s){var y;if(i){s.preventDefault();return}let p;const C=Ce(s.target,I=>(!p&&I.hasAttribute("draggable")&&(p=I),I.hasAttribute("data-node-box")),{withSelf:!0});if(C.querySelector("[draggable]")&&p===C){s.preventDefault();return}if(s.dataTransfer.setData("text/plain","he-tree he-tree-react"),s.dataTransfer.dropEffect="move",e.customDragImage)e.customDragImage(s,r);else{const I=C.children[0];s.dataTransfer.setDragImage(I,d?I.offsetWidth:0,0)}setTimeout(()=>{var I;k(r),oe({...T,parentStat:r.parentStat,level:r.level,index:(((I=r.parentStat)==null?void 0:I.childIds)||L).indexOf(r.id)})},0),(y=e.onDragStart)==null||y.call(e,s,r)},onDragLeave(s){}}}const j=r=>{var C,A,y;if(ie&&!((C=e.onExternalDragOver)!=null&&C.call(e,r)))return;const i=s();if(i){const I=u(i.getAttribute("data-key")),v=!!i.getAttribute("data-drag-placeholder");p(I,v)&&e.onDragOpen(I);let m=ye(I,v);const{closest:x,next:b}=m;let{atTop:F}=m;const B=U.current,z=i;let Se=(()=>{let J=z.getBoundingClientRect(),G;return d?G=Math.ceil((J.right-r.pageX)/S):G=Math.ceil((r.pageX-J.x)/S),me(G,0,((x==null?void 0:x.level)||0)+1)})();if(!F&&!v&&x.id===L[0]){const J=B.querySelector(`[data-key="${x.id}"]`);if(J){const G=J.getBoundingClientRect();F=G.y+G.height/2>r.pageY}}F&&(Se=0);let de;if(F)$(null,0)&&(de={...T,parentStat:null,level:1,index:0});else{const J=b?b.level-1:0,G=[],ve=[];let X=x;const xe=()=>X?X.level:0;for(;xe()>=J;){const we=ae(X,b);if($(X,we)&&(Se>xe()?G:ve).unshift({parentStat:X,index:we}),!X)break;X=X.parentStat}let te=Pe(G);te||(te=Ee(ve)),te&&(de={...T,parentStat:te.parentStat,level:(((A=te.parentStat)==null?void 0:A.level)??0)+1,index:te.index})}oe(de),de&&r.preventDefault(),N(v?void 0:I),(y=e.onDragOver)==null||y.call(e,r,I,ie)}else $(null,0)&&(oe({...T,parentStat:null,level:1,index:0}),r.preventDefault());function s(){const v=U.current.querySelectorAll("[data-node-box]:not([data-dragging])"),m=Oe(v,b=>b.getBoundingClientRect().top-r.pageY,{returnNearestIfNoHit:!0});let x;return m.hit||m.greater&&(x=m.index-1,x<0&&(x=0)),x==null&&(x=m.index),v[x]}function p(I,v){if(!e.dragOpen||v||I.open)return!1;const m=()=>Object.assign(ne,{id:I.id,x:r.pageX,y:r.pageY,time:Date.now()});if(ne.id!==I.id||ze(r.pageX,r.pageY,ne.x,ne.y)>10)return m(),!1;if(Date.now()-ne.time>=e.dragOpenDelay)return!0}},q=r=>{var i,s;if(!(ie&&!((i=e.onExternalDragOver)!=null&&i.call(e,r)))&&T&&(r.preventDefault(),ie)){const{index:p}=T;(s=e.onExternalDrop)==null||s.call(e,r,T.parentStat,p),le()}};function ee(r){var p,C;if(!g)return;const i=!T;if(!(((p=e.onDragEnd)==null?void 0:p.call(e,r,g,i))===!1)&&!i){let A=T.index;T.parentStat===g.parentStat&&g.index<A&&A--;const y=[...e.data];if(e.dataType==="flat"){const I=((C=T.parentStat)==null?void 0:C.id)??e.rootId,v=ge(y,g.id,l),m={...g.node,[t]:I};v[0]=m;const x=fe(y,I,A,l);y.splice(x,0,...v)}else{const I=new Map,v=b=>{if(!b)return y;const F=v(b.parentStat);let B=[...b.children];const z=I.get(b.node)||{...b.node,[c]:B};return I.set(b.node,z),B=z[c],F[b.index]=z,B},m=v(g.parentStat),x=T.parentStat===g.parentStat?m:v(T.parentStat);m.splice(g.index,1),x.splice(A,0,g.node)}e.onChange(y)}le()}function le(){N(void 0),k(void 0),oe(void 0)}function $(r,i){var p,C;if(!r)return((p=e.canDropToRoot)==null?void 0:p.call(e,i))??!0;if(!r.open)return!1;let s=(C=e.canDrop)==null?void 0:C.call(e,r,i);return s==null&&(s=$(r.parentStat)),s}function ye(r,i){let s=r,p=E.indexOf(i?e.placeholderId:r.id),C=!1;const A=b=>b===f||u(b)===g,y=(b,F)=>{let B=b,z;do B+=F,z=E[B];while(z&&A(z));return{id:z,i:B}},I=(b,F)=>{const B=y(b,F);s=u(B.id),p=B.i},v=1;i&&(I(p,-1),s||(C=!0,I(-1,v)));const x=u(y(p,v).id);return{closest:s,atTop:C,next:x}}function ae(r,i){const s=r?r.childStats:K;let p=s.length;return i&&i.siblingStats===s&&(p=s.indexOf(i)),p}return{visibleIds:E,attrsList:V,onDragOverRoot:j,onDropToRoot:q,onDragEndOnRoot:ee}},[P,S,g,T==null?void 0:T.parentStat,T==null?void 0:T.index,S,f,d,e.rootId,...[e.canDrop,e.canDropToRoot,e.customDragImage,e.onDragStart,e.onDragOver,e.onExternalDragOver,e.onExternalDrop,e.onDragEnd,e.onChange,e.onDragOpen].map(E=>D&&E)]),Ie=M.useMemo(()=>({getEl:()=>window,onDragOverWindow:E=>{V()||(N(void 0),e.keepPlaceholder||oe(void 0));function V(){let _=!1,j=E.target;if(j){for(const q of ce(j,"parentElement",{withSelf:!0}))if(q===U.current){_=!0;break}}return _}}}),[e.keepPlaceholder]);je(Ie.getEl,"dragover",Ie.onDragOverWindow);const{visibleIds:se,attrsList:De,onDragOverRoot:qe,onDropToRoot:Ge,onDragEndOnRoot:Xe}=We,Ye=M.useMemo(()=>g?[se.indexOf(g.id)]:[],[g,se]);return{...P,visibleIds:se,attrsList:De,virtualListRef:Y,draggingStat:g,dragOverStat:H,placeholder:T,renderHeTree:E=>{let V=e.renderNodeBox;if(!V){const _=re.jsx("div",{className:"he-tree-drag-placeholder",style:{minHeight:"20px",border:"1px dashed blue"}});V=({stat:j,attrs:q,isPlaceholder:ee})=>re.jsx("div",{...q,children:ee?_:e.renderNode(j)})}return re.jsx("div",{className:`he-tree ${(E==null?void 0:E.className)||""}`,style:E==null?void 0:E.style,ref:U,onDragOver:qe,onDrop:Ge,onDragEnd:Xe,children:re.jsx(be.VirtualList,{ref:Y,items:se,virtual:e.virtual,persistentIndices:Ye,style:{height:"100%"},renderItem:(_,j)=>V({stat:u(_),attrs:De[j],isPlaceholder:_===f})})})}}}function Ke(n,e,o="children"){for(const t of W(n,o))e(...t)}function*W(n,e="children"){let o=!1,t=!1;const c=()=>{o=!0},f=()=>{t=!0};yield*D(n,null,[]);function*D(l,d,a){let h=0;for(const w of l){if(yield[w,{parent:d,parents:a,siblings:l,index:h,skipChildren:c,exitWalk:f}],t)return;if(h++,o)o=!1;else{const P=w[e];if(P&&(yield*D(P,w,[...a,w]),t))return}}}}function Le(n,e,o="children"){for(const t of W(n,o))if(e(...t))return t[0]}function Ne(n,e,o="children"){const t=[];for(const c of W(n,o))e(...c)&&t.push(c[0]);return t}function*ce(n,e,o={withSelf:!1}){let t=n;for(;t;)(t!==n||o.withSelf)&&(yield t),t=typeof e=="function"?e(t):t[e]}function Ae(n,e){const o={...Q,...e},{idKey:t,parentIdKey:c}=o,f=new Map;f.set(null,[]);const D=f.get(null);for(const d of n){const a=d[t];f.set(a,[])}for(const d of n){const a=d[c];(f.get(a)||D).push(d)}function*l(d){for(const a of d){yield a;const h=a[t];yield*l(f.get(h))}}return[...l(D)]}const Q={idKey:"id",parentIdKey:"parent_id"};function*Z(n,e){const o={...Q,...e},{idKey:t,parentIdKey:c}=o;let f=!1,D=!1;const l=()=>{f=!0},d=()=>{D=!0},a={},h={},w={},O=[];let P,L=0;for(const K of n){const u=K[t],S=K[c]??null;a[u]=K;const g=a[S]||null;w[u]=[];const k=g?w[S]:O,H=k.length;k.push(u);const N={parent:g,parents:g?[...h[S].parents,g]:[],index:H,id:u,pid:S,treeIndex:L,skipChildren:l,exitWalk:d};h[u]=N;let Y=!1;if(f&&P&&(P.has(S)?(P.add(u),Y=!0):(f=!1,P=void 0)),!Y){if(yield[K,N],D)break;f&&(P=new Set([u]))}L++}}function Fe(n,e,o){for(const t of Z(n,o))e(...t)}function fe(n,e,o,t){const c={...Q,...t},{idKey:f,parentIdKey:D}=c;let l=!1,d=-1;for(const[a,{treeIndex:h,skipChildren:w,index:O}]of Z(n,c))if(e!=null&&!l)a[f]===e&&(l=!0);else if(e==null||a[D]===e)if(o!=null&&o===O){d=h;break}else w();else{d=h;break}return d===-1&&(d=n.length),d}function Me(n,e,o,t){const c={...Q,...t},{idKey:f,parentIdKey:D}=c,l=e[D]??null,d=fe(n,l,o,c);n.splice(d,0,e)}function ge(n,e,o){if(e==null)return n.splice(0,n.length);const t={...Q,...o},{idKey:c,parentIdKey:f}=t;let D=-1,l=-1;for(const[d,{treeIndex:a,skipChildren:h}]of Z(n,t))if(D===-1)d[c]===e&&(D=a,h());else{l=a;break}return l===-1&&(l=n.length),D===-1?[]:n.splice(D,l-D)}function Be(n,e,o,t){const c={...Q,...t},{idKey:f,parentIdKey:D}=c,l=new Set(e),d=Array.isArray(o)?o:[o],a=new Set(d);if(a.size>0)for(const[h,{parents:w}]of Z(n,c)){const O=h[f];if(a.has(O)){for(const P of w)l.add(P[f]);if(a.delete(O),a.size===0)break}}return Array.from(l).sort()}const pe={idKey:"id",childrenKey:"children"};function _e(n,e,o,t){const c={...pe,...t},{idKey:f,childrenKey:D}=c,l=new Set(e),d=Array.isArray(o)?o:[o],a=new Set(d);if(a.size>0)for(const[h,{parents:w}]of W(n,c.childrenKey)){const O=h[f];if(a.has(O)){for(const P of w)l.add(P[f]);if(a.delete(O),a.size===0)break}}return Array.from(l).sort()}function He(n,e,o,t,c){const f=new Set(e),D=Array.isArray(o)?o:[o],l=new Map,d=new Set(D),a=new Map,h=[];a.set(null,h);for(const[L,{parents:K,id:u,pid:S}]of Z(n,c))a.get(S).push(u),a.set(u,[]),l.set(u,f.has(u)),(d.has(u)||S&&d.has(S))&&(l.set(u,t),d.add(u));const w=L=>{const K=a.get(L);if(!K||K.length===0)return l.get(L);let u=!1,S=!1,g=!1;for(const H of K){let N=w(H);N===!1?S=!0:N===null?g=!0:u=!0}let k;return g||S&&u?k=null:S?k=!1:k=!0,l.set(L,k),k};for(const L of h)w(L);const O=[],P=[];return l.forEach((L,K)=>{L===!0?O.push(K):L===null&&P.push(K)}),[O.sort(),P.sort()]}function Ve(n,e,o,t,c){const f={...pe,...c},{idKey:D,childrenKey:l}=f,d=new Set(e),a=Array.isArray(o)?o:[o],h=new Map,w=new Set(a),O=new Map;O.set(null,[]);for(const[u,{parents:S,parent:g}]of W(n,l)){const k=u[D],H=(g==null?void 0:g[D])??null;O.get(H).push(k),O.set(k,[]),h.set(k,d.has(k)),(w.has(k)||H&&w.has(H))&&(h.set(k,t),w.add(k))}const P=u=>{const S=O.get(u);if(!S||S.length===0)return h.get(u);let g=!1,k=!1,H=!1;for(const Y of S){let U=P(Y);U===!1?k=!0:U===null?H=!0:g=!0}let N;return H||k&&g?N=null:k?N=!1:N=!0,h.set(u,N),N};for(const u of n)P(u[D]);const L=[],K=[];return h.forEach((u,S)=>{u===!0?L.push(S):u===null&&K.push(S)}),[L.sort(),K.sort()]}function ze(n,e,o,t){return Math.sqrt(Math.pow(o-n,2)+Math.pow(t-e,2))}function je(n,e,o){M.useLayoutEffect(()=>{const t=n();return t==null||t.addEventListener(e,o),()=>{t==null||t.removeEventListener(e,o)}},[n,e,o])}return R.addToFlatData=Me,R.convertIndexToTreeIndexInFlatData=fe,R.defaultProps=he,R.filterTreeData=Ne,R.findTreeData=Le,R.openParentsInFlatData=Be,R.openParentsInTreeData=_e,R.removeByIdInFlatData=ge,R.sortFlatData=Ae,R.updateCheckedInFlatData=He,R.updateCheckedInTreeData=Ve,R.useHeTree=Re,R.walkFlatData=Fe,R.walkFlatDataGenerator=Z,R.walkParentsGenerator=ce,R.walkTreeData=Ke,R.walkTreeDataGenerator=W,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R}({},jsxRuntime,React,reactBaseVirtualList); | ||
*/function ke(n,e){return n<e?e:n}function Te(n,e){return n<e?n:e}function me(n,e,o){return Te(ke(n,e),o)}function Ee(n){return n[0]}function Pe(n){return n[n.length-1]}function Ce(n,e){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},t=o&&o.withSelf?n:n.parentElement;for(;t;){const c=o.until&&t===o.until;if(c&&!o.withUntil)return;const f=e(t);if(f==="break")return;if(f)return t;if(c)return;t=t.parentElement}}function Re(n,e){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};o={start:0,end:n.length-1,maxTimes:1e3,...o};let{start:t,end:c}=o;const{returnNearestIfNoHit:f,maxTimes:D}=o;let l,d;t==null&&(t=0,c=n.length-1);let a=0,h;for(;t>=0&&t<=c;){if(a>=D)throw Error("binarySearch: loop times is over ".concat(D,", you can increase the limit."));l=Math.floor((c-t)/2+t),d=n[l];const w=a+1;if(h=e(d,l,w),h>0)c=l-1;else if(h<0)t=l+1;else return{index:l,value:d,count:w,hit:!0};a++}return f?{index:l,value:d,count:a+1,hit:!1,greater:h>0}:null}const ne={id:null,x:0,y:0,time:0},he={idKey:"id",parentIdKey:"parent_id",childrenKey:"children",indent:20,dragOpen:!1,dragOpenDelay:600,placeholderId:"__DRAG_PLACEHOLDER__",dataType:"flat",direction:"ltr",rootId:null,virtual:!1};function Oe(n){const e={...he,...n},{idKey:o,parentIdKey:t,childrenKey:c,placeholderId:f,isFunctionReactive:D}=e,l={idKey:o,parentIdKey:t};if(!e.renderNode&&!e.renderNodeBox)throw new Error("Either renderNodeBox or renderNode is required.");const d=e.direction==="rtl",a=A.useMemo(()=>e.openIds?[...e.openIds].sort().toString():void 0,[e.openIds]),h=A.useMemo(()=>new Set(e.openIds),[a]),w=A.useMemo(()=>e.checkedIds?[...e.checkedIds].sort().toString():"",[e.checkedIds]),R=A.useMemo(()=>new Set(e.checkedIds),[w]),P=A.useMemo(()=>{var le,r;const E={},V={},_=[],j=[],W=[],ee=[];function*se(){if(e.dataType==="flat")for(const i of e.data)yield[i];else for(const i of q(e.data,c))yield i}let $=0;for(const[i,s]of se()){const p=i[o]??$;ee.push(p);let C=i[t];e.dataType==="tree"&&(C=((le=s.parent)==null?void 0:le[o])??null);let F=V[C]||null;const y=E[C]||null,I=[],v=[],m=[];let x,b,M;y?(x=y.childIds,b=y.children,M=y.childStats):(x=_,b=j,M=W);const B=x.length,z=(y==null?void 0:y.level)+1||1,ue={_isStat:!0,id:p,pid:C,childIds:I,siblingIds:x,node:i,parent:F,parentStat:y,children:v,childStats:m,siblings:b,siblingStats:M,index:B,level:z,open:e.openIds?h.has(p):!0,checked:R.has(p),draggable:!1};E[p]=ue,V[p]=i,x.push(p),b.push(i),M.push(ue),$++}for(const[i]of q(W,"childStats")){let s=((r=e.canDrag)==null?void 0:r.call(e,i))??null;s===null&&(s=i.parentStat?i.parentStat.draggable:!0),i.draggable=s}return{rootIds:_,rootNodes:j,rootStats:W,allIds:ee,getStat:i=>{let s;return typeof i=="object"?s=i._isStat?i.id:i[o]:s=i,E[s]}}},[e.data,e.dataType,o,t,h,R,D&&e.canDrag]),{rootIds:L,rootStats:K,getStat:u}=P,S=e.indent,[g,k]=A.useState(),[H,N]=A.useState(),Y=A.useRef(null),U=A.useRef(null),[T,oe]=A.useState(),re=!g,We=A.useMemo(()=>{const E=[],V=[];for(const[r,{skipChildren:i}]of q(K,"childStats")){const s=_(r);r===g&&(Object.assign(s.style,{position:"fixed",top:0,left:0,pointerEvents:"none",zIndex:"-999999999",visibility:"hidden"}),s["data-dragging"]=!0),V.push(s),E.push(r.id),(!r.open||r===g)&&i()}if(T){const i=((p,C)=>{let F=((p==null?void 0:p.childStats)||K)[C],y;if(F)y=E.indexOf(F.id);else{const I=m=>m.siblingStats[m.siblingStats.indexOf(m)+1];let v;if(p){for(const m of ce(p,"parentStat",{withSelf:!0}))if(v=I(m),v)break}v?y=E.indexOf(v.id):y=E.length}return y})(T.parentStat,T.index);E.splice(i,0,f);const s=_({id:f,level:T.level},!0);s["data-drag-placeholder"]=!0,V.splice(i,0,s)}function _(r,i=!1){return{key:r.id,draggable:r.draggable,style:{[`padding${d?"Right":"Left"}`]:(r.level-1)*S+"px"},"data-key":r.id+"","data-level":r.level+"","data-node-box":!0,onDragStart(s){var y;if(i){s.preventDefault();return}let p;const C=Ce(s.target,I=>(!p&&I.hasAttribute("draggable")&&(p=I),I.hasAttribute("data-node-box")),{withSelf:!0});if(C.querySelector("[draggable]")&&p===C){s.preventDefault();return}if(s.dataTransfer.setData("text/plain","he-tree he-tree-react"),s.dataTransfer.dropEffect="move",e.customDragImage)e.customDragImage(s,r);else{const I=C.children[0];s.dataTransfer.setDragImage(I,d?I.offsetWidth:0,0)}setTimeout(()=>{var I;k(r),oe({...T,parentStat:r.parentStat,level:r.level,index:(((I=r.parentStat)==null?void 0:I.childIds)||L).indexOf(r.id)})},0),(y=e.onDragStart)==null||y.call(e,s,r)},onDragLeave(s){}}}const j=r=>{var C,F,y;if(re&&!((C=e.onExternalDragOver)!=null&&C.call(e,r)))return;const i=s();if(i){const I=u(i.getAttribute("data-key")),v=!!i.getAttribute("data-drag-placeholder");p(I,v)&&e.onDragOpen(I);let m=ye(I,v);const{closest:x,next:b}=m;let{atTop:M}=m;const B=U.current,z=i;let Se=(()=>{let J=z.getBoundingClientRect(),G;return d?G=Math.ceil((J.right-r.pageX)/S):G=Math.ceil((r.pageX-J.x)/S),me(G,0,((x==null?void 0:x.level)||0)+1)})();if(!M&&!v&&x.id===L[0]){const J=B.querySelector(`[data-key="${x.id}"]`);if(J){const G=J.getBoundingClientRect();M=G.y+G.height/2>r.pageY}}M&&(Se=0);let ae;if(M)$(null,0)&&(ae={...T,parentStat:null,level:1,index:0});else{const J=b?b.level-1:0,G=[],ve=[];let X=x;const xe=()=>X?X.level:0;for(;xe()>=J;){const we=le(X,b);if($(X,we)&&(Se>xe()?G:ve).unshift({parentStat:X,index:we}),!X)break;X=X.parentStat}let te=Pe(G);te||(te=Ee(ve)),te&&(ae={...T,parentStat:te.parentStat,level:(((F=te.parentStat)==null?void 0:F.level)??0)+1,index:te.index})}oe(ae),ae&&r.preventDefault(),N(v?void 0:I),(y=e.onDragOver)==null||y.call(e,r,I,re)}else $(null,0)&&(oe({...T,parentStat:null,level:1,index:0}),r.preventDefault());function s(){const v=U.current.querySelectorAll("[data-node-box]:not([data-dragging])"),m=Re(v,b=>b.getBoundingClientRect().top-r.pageY,{returnNearestIfNoHit:!0});let x;return m.hit||m.greater&&(x=m.index-1,x<0&&(x=0)),x==null&&(x=m.index),v[x]}function p(I,v){if(!e.dragOpen||v||I.open)return!1;const m=()=>Object.assign(ne,{id:I.id,x:r.pageX,y:r.pageY,time:Date.now()});if(ne.id!==I.id||ze(r.pageX,r.pageY,ne.x,ne.y)>10)return m(),!1;if(Date.now()-ne.time>=e.dragOpenDelay)return!0}},W=r=>{var i,s;if(!(re&&!((i=e.onExternalDragOver)!=null&&i.call(e,r)))&&T&&(r.preventDefault(),re)){const{index:p}=T;(s=e.onExternalDrop)==null||s.call(e,r,T.parentStat,p),se()}};function ee(r){var p,C;if(!g)return;const i=!T;if(!(((p=e.onDragEnd)==null?void 0:p.call(e,r,g,i))===!1)&&!i){let F=T.index;T.parentStat===g.parentStat&&g.index<F&&F--;const y=[...e.data];if(e.dataType==="flat"){const I=((C=T.parentStat)==null?void 0:C.id)??e.rootId,v=ge(y,g.id,l),m={...g.node,[t]:I};v[0]=m;const x=fe(y,I,F,l);y.splice(x,0,...v)}else{const I=new Map,v=b=>{if(!b)return y;const M=v(b.parentStat);let B=[...b.children];const z=I.get(b.node)||{...b.node,[c]:B};return I.set(b.node,z),B=z[c],M[b.index]=z,B},m=v(g.parentStat),x=T.parentStat===g.parentStat?m:v(T.parentStat);m.splice(g.index,1),x.splice(F,0,g.node)}e.onChange(y)}se()}function se(){N(void 0),k(void 0),oe(void 0)}function $(r,i){var p,C;if(!r)return((p=e.canDropToRoot)==null?void 0:p.call(e,i))??!0;if(!r.open)return!1;let s=(C=e.canDrop)==null?void 0:C.call(e,r,i);return s==null&&(s=$(r.parentStat)),s}function ye(r,i){let s=r,p=E.indexOf(i?e.placeholderId:r.id),C=!1;const F=b=>b===f||u(b)===g,y=(b,M)=>{let B=b,z;do B+=M,z=E[B];while(z&&F(z));return{id:z,i:B}},I=(b,M)=>{const B=y(b,M);s=u(B.id),p=B.i},v=1;i&&(I(p,-1),s||(C=!0,I(-1,v)));const x=u(y(p,v).id);return{closest:s,atTop:C,next:x}}function le(r,i){const s=r?r.childStats:K;let p=s.length;return i&&i.siblingStats===s&&(p=s.indexOf(i)),p}return{visibleIds:E,attrsList:V,onDragOverRoot:j,onDropToRoot:W,onDragEndOnRoot:ee}},[P,S,g,T==null?void 0:T.parentStat,T==null?void 0:T.index,S,f,d,e.rootId,...[e.canDrop,e.canDropToRoot,e.customDragImage,e.onDragStart,e.onDragOver,e.onExternalDragOver,e.onExternalDrop,e.onDragEnd,e.onChange,e.onDragOpen].map(E=>D&&E)]),Ie=A.useMemo(()=>({getEl:()=>window,onDragOverWindow:E=>{V()||(N(void 0),e.keepPlaceholder||oe(void 0));function V(){let _=!1,j=E.target;if(j){for(const W of ce(j,"parentElement",{withSelf:!0}))if(W===U.current){_=!0;break}}return _}}}),[e.keepPlaceholder]);je(Ie.getEl,"dragover",Ie.onDragOverWindow);const{visibleIds:ie,attrsList:De,onDragOverRoot:qe,onDropToRoot:Ge,onDragEndOnRoot:Xe}=We,Ye=A.useMemo(()=>g?[ie.indexOf(g.id)]:[],[g,ie]);return{...P,visibleIds:ie,attrsList:De,virtualListRef:Y,draggingStat:g,dragOverStat:H,placeholder:T,renderHeTree:E=>{let V=e.renderNodeBox;if(!V){const _=de.jsx("div",{className:"he-tree-drag-placeholder",style:{minHeight:"20px",border:"1px dashed blue"}});V=({stat:j,attrs:W,isPlaceholder:ee})=>A.createElement("div",{...W,key:W.key},ee?_:e.renderNode(j))}return de.jsx("div",{className:`he-tree ${(E==null?void 0:E.className)||""}`,style:E==null?void 0:E.style,ref:U,onDragOver:qe,onDrop:Ge,onDragEnd:Xe,children:de.jsx(be.VirtualList,{ref:Y,items:ie,virtual:e.virtual,persistentIndices:Ye,style:{height:"100%"},renderItem:(_,j)=>V({stat:u(_),attrs:De[j],isPlaceholder:_===f})})})}}}function Ke(n,e,o="children"){for(const t of q(n,o))e(...t)}function*q(n,e="children"){let o=!1,t=!1;const c=()=>{o=!0},f=()=>{t=!0};yield*D(n,null,[]);function*D(l,d,a){let h=0;for(const w of l){if(yield[w,{parent:d,parents:a,siblings:l,index:h,skipChildren:c,exitWalk:f}],t)return;if(h++,o)o=!1;else{const P=w[e];if(P&&(yield*D(P,w,[...a,w]),t))return}}}}function Le(n,e,o="children"){for(const t of q(n,o))if(e(...t))return t[0]}function Ne(n,e,o="children"){const t=[];for(const c of q(n,o))e(...c)&&t.push(c[0]);return t}function*ce(n,e,o={withSelf:!1}){let t=n;for(;t;)(t!==n||o.withSelf)&&(yield t),t=typeof e=="function"?e(t):t[e]}function Ae(n,e){const o={...Q,...e},{idKey:t,parentIdKey:c}=o,f=new Map;f.set(null,[]);const D=f.get(null);for(const d of n){const a=d[t];f.set(a,[])}for(const d of n){const a=d[c];(f.get(a)||D).push(d)}function*l(d){for(const a of d){yield a;const h=a[t];yield*l(f.get(h))}}return[...l(D)]}const Q={idKey:"id",parentIdKey:"parent_id"};function*Z(n,e){const o={...Q,...e},{idKey:t,parentIdKey:c}=o;let f=!1,D=!1;const l=()=>{f=!0},d=()=>{D=!0},a={},h={},w={},R=[];let P,L=0;for(const K of n){const u=K[t],S=K[c]??null;a[u]=K;const g=a[S]||null;w[u]=[];const k=g?w[S]:R,H=k.length;k.push(u);const N={parent:g,parents:g?[...h[S].parents,g]:[],index:H,id:u,pid:S,treeIndex:L,skipChildren:l,exitWalk:d};h[u]=N;let Y=!1;if(f&&P&&(P.has(S)?(P.add(u),Y=!0):(f=!1,P=void 0)),!Y){if(yield[K,N],D)break;f&&(P=new Set([u]))}L++}}function Fe(n,e,o){for(const t of Z(n,o))e(...t)}function fe(n,e,o,t){const c={...Q,...t},{idKey:f,parentIdKey:D}=c;let l=!1,d=-1;for(const[a,{treeIndex:h,skipChildren:w,index:R}]of Z(n,c))if(e!=null&&!l)a[f]===e&&(l=!0);else if(e==null||a[D]===e)if(o!=null&&o===R){d=h;break}else w();else{d=h;break}return d===-1&&(d=n.length),d}function Me(n,e,o,t){const c={...Q,...t},{idKey:f,parentIdKey:D}=c,l=e[D]??null,d=fe(n,l,o,c);n.splice(d,0,e)}function ge(n,e,o){if(e==null)return n.splice(0,n.length);const t={...Q,...o},{idKey:c,parentIdKey:f}=t;let D=-1,l=-1;for(const[d,{treeIndex:a,skipChildren:h}]of Z(n,t))if(D===-1)d[c]===e&&(D=a,h());else{l=a;break}return l===-1&&(l=n.length),D===-1?[]:n.splice(D,l-D)}function Be(n,e,o,t){const c={...Q,...t},{idKey:f,parentIdKey:D}=c,l=new Set(e),d=Array.isArray(o)?o:[o],a=new Set(d);if(a.size>0)for(const[h,{parents:w}]of Z(n,c)){const R=h[f];if(a.has(R)){for(const P of w)l.add(P[f]);if(a.delete(R),a.size===0)break}}return Array.from(l).sort()}const pe={idKey:"id",childrenKey:"children"};function _e(n,e,o,t){const c={...pe,...t},{idKey:f,childrenKey:D}=c,l=new Set(e),d=Array.isArray(o)?o:[o],a=new Set(d);if(a.size>0)for(const[h,{parents:w}]of q(n,c.childrenKey)){const R=h[f];if(a.has(R)){for(const P of w)l.add(P[f]);if(a.delete(R),a.size===0)break}}return Array.from(l).sort()}function He(n,e,o,t,c){const f=new Set(e),D=Array.isArray(o)?o:[o],l=new Map,d=new Set(D),a=new Map,h=[];a.set(null,h);for(const[L,{parents:K,id:u,pid:S}]of Z(n,c))a.get(S).push(u),a.set(u,[]),l.set(u,f.has(u)),(d.has(u)||S&&d.has(S))&&(l.set(u,t),d.add(u));const w=L=>{const K=a.get(L);if(!K||K.length===0)return l.get(L);let u=!1,S=!1,g=!1;for(const H of K){let N=w(H);N===!1?S=!0:N===null?g=!0:u=!0}let k;return g||S&&u?k=null:S?k=!1:k=!0,l.set(L,k),k};for(const L of h)w(L);const R=[],P=[];return l.forEach((L,K)=>{L===!0?R.push(K):L===null&&P.push(K)}),[R.sort(),P.sort()]}function Ve(n,e,o,t,c){const f={...pe,...c},{idKey:D,childrenKey:l}=f,d=new Set(e),a=Array.isArray(o)?o:[o],h=new Map,w=new Set(a),R=new Map;R.set(null,[]);for(const[u,{parents:S,parent:g}]of q(n,l)){const k=u[D],H=(g==null?void 0:g[D])??null;R.get(H).push(k),R.set(k,[]),h.set(k,d.has(k)),(w.has(k)||H&&w.has(H))&&(h.set(k,t),w.add(k))}const P=u=>{const S=R.get(u);if(!S||S.length===0)return h.get(u);let g=!1,k=!1,H=!1;for(const Y of S){let U=P(Y);U===!1?k=!0:U===null?H=!0:g=!0}let N;return H||k&&g?N=null:k?N=!1:N=!0,h.set(u,N),N};for(const u of n)P(u[D]);const L=[],K=[];return h.forEach((u,S)=>{u===!0?L.push(S):u===null&&K.push(S)}),[L.sort(),K.sort()]}function ze(n,e,o,t){return Math.sqrt(Math.pow(o-n,2)+Math.pow(t-e,2))}function je(n,e,o){A.useLayoutEffect(()=>{const t=n();return t==null||t.addEventListener(e,o),()=>{t==null||t.removeEventListener(e,o)}},[n,e,o])}return O.addToFlatData=Me,O.convertIndexToTreeIndexInFlatData=fe,O.defaultProps=he,O.filterTreeData=Ne,O.findTreeData=Le,O.openParentsInFlatData=Be,O.openParentsInTreeData=_e,O.removeByIdInFlatData=ge,O.sortFlatData=Ae,O.updateCheckedInFlatData=He,O.updateCheckedInTreeData=Ve,O.useHeTree=Oe,O.walkFlatData=Fe,O.walkFlatDataGenerator=Z,O.walkParentsGenerator=ce,O.walkTreeData=Ke,O.walkTreeDataGenerator=q,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"}),O}({},jsxRuntime,React,reactBaseVirtualList); | ||
//# sourceMappingURL=index.iife.js.map |
@@ -1,5 +0,5 @@ | ||
import { jsx as de } from "react/jsx-runtime"; | ||
import { useMemo as X, useState as fe, useRef as xe, useLayoutEffect as Ce } from "react"; | ||
import { jsx as ce } from "react/jsx-runtime"; | ||
import { useMemo as X, useState as fe, useRef as xe, useLayoutEffect as Ce, createElement as Pe } from "react"; | ||
import * as te from "helper-js"; | ||
import { VirtualList as Pe } from "react-base-virtual-list"; | ||
import { VirtualList as Ke } from "react-base-virtual-list"; | ||
/*! | ||
@@ -15,3 +15,3 @@ * he-tree-react | ||
time: 0 | ||
}, Ke = { | ||
}, Oe = { | ||
/** | ||
@@ -32,4 +32,4 @@ * | ||
}; | ||
function Me(s) { | ||
const e = { ...Ke, ...s }, { idKey: n, parentIdKey: t, childrenKey: p, placeholderId: h, isFunctionReactive: I } = e, c = { idKey: n, parentIdKey: t }; | ||
function _e(s) { | ||
const e = { ...Oe, ...s }, { idKey: n, parentIdKey: t, childrenKey: p, placeholderId: h, isFunctionReactive: I } = e, c = { idKey: n, parentIdKey: t }; | ||
if (!e.renderNode && !e.renderNodeBox) | ||
@@ -59,3 +59,3 @@ throw new Error("Either renderNodeBox or renderNode is required."); | ||
y ? (v = y.childIds, b = y.children, N = y.childStats) : (v = F, b = z, N = V); | ||
const B = v.length, H = (y == null ? void 0 : y.level) + 1 || 1, ce = { | ||
const B = v.length, H = (y == null ? void 0 : y.level) + 1 || 1, de = { | ||
_isStat: !0, | ||
@@ -79,3 +79,3 @@ id: u, | ||
}; | ||
E[u] = ce, _[u] = r, v.push(u), b.push(r), N.push(ce), U++; | ||
E[u] = de, _[u] = r, v.push(u), b.push(r), N.push(de), U++; | ||
} | ||
@@ -262,3 +262,3 @@ for (const [r] of j(V, "childStats")) { | ||
const T = () => Object.assign(ne, { id: g.id, x: o.pageX, y: o.pageY, time: Date.now() }); | ||
if (ne.id !== g.id || Re(o.pageX, o.pageY, ne.x, ne.y) > 10) | ||
if (ne.id !== g.id || Ae(o.pageX, o.pageY, ne.x, ne.y) > 10) | ||
return T(), !1; | ||
@@ -285,3 +285,3 @@ if (Date.now() - ne.time >= e.dragOpenDelay) | ||
if (e.dataType === "flat") { | ||
const g = ((P = k.parentStat) == null ? void 0 : P.id) ?? e.rootId, S = Oe(y, f.id, c), T = { ...f.node, [t]: g }; | ||
const g = ((P = k.parentStat) == null ? void 0 : P.id) ?? e.rootId, S = Re(y, f.id, c), T = { ...f.node, [t]: g }; | ||
S[0] = T; | ||
@@ -372,3 +372,3 @@ const v = ve(y, g, L, c); | ||
}), [e.keepPlaceholder]); | ||
Ae(ue.getEl, "dragover", ue.onDragOverWindow); | ||
Le(ue.getEl, "dragover", ue.onDragOverWindow); | ||
const { visibleIds: se, attrsList: ge, onDragOverRoot: ke, onDropToRoot: Te, onDragEndOnRoot: Ee } = we, me = X(() => f ? [se.indexOf(f.id)] : [], [f, se]); | ||
@@ -390,7 +390,7 @@ return { | ||
if (!_) { | ||
const F = /* @__PURE__ */ de("div", { className: "he-tree-drag-placeholder", style: { minHeight: "20px", border: "1px dashed blue" } }); | ||
_ = ({ stat: z, attrs: V, isPlaceholder: J }) => /* @__PURE__ */ de("div", { ...V, children: J ? F : e.renderNode(z) }); | ||
const F = /* @__PURE__ */ ce("div", { className: "he-tree-drag-placeholder", style: { minHeight: "20px", border: "1px dashed blue" } }); | ||
_ = ({ stat: z, attrs: V, isPlaceholder: J }) => /* @__PURE__ */ Pe("div", { ...V, key: V.key }, J ? F : e.renderNode(z)); | ||
} | ||
return /* @__PURE__ */ de("div", { className: `he-tree ${(E == null ? void 0 : E.className) || ""}`, style: E == null ? void 0 : E.style, ref: $, onDragOver: ke, onDrop: Te, onDragEnd: Ee, children: /* @__PURE__ */ de( | ||
Pe, | ||
return /* @__PURE__ */ ce("div", { className: `he-tree ${(E == null ? void 0 : E.className) || ""}`, style: E == null ? void 0 : E.style, ref: $, onDragOver: ke, onDrop: Te, onDragEnd: Ee, children: /* @__PURE__ */ ce( | ||
Ke, | ||
{ | ||
@@ -412,3 +412,3 @@ ref: Y, | ||
} | ||
function _e(s, e, n = "children") { | ||
function He(s, e, n = "children") { | ||
for (const t of j(s, n)) | ||
@@ -440,3 +440,3 @@ e(...t); | ||
} | ||
function He(s, e, n = "children") { | ||
function ze(s, e, n = "children") { | ||
for (const t of j(s, n)) | ||
@@ -446,3 +446,3 @@ if (e(...t)) | ||
} | ||
function ze(s, e, n = "children") { | ||
function Ve(s, e, n = "children") { | ||
const t = []; | ||
@@ -458,3 +458,3 @@ for (const p of j(s, n)) | ||
} | ||
function Ve(s, e) { | ||
function We(s, e) { | ||
const n = { ...Z, ...e }, { idKey: t, parentIdKey: p } = n, h = /* @__PURE__ */ new Map(); | ||
@@ -520,3 +520,3 @@ h.set(null, []); | ||
} | ||
function We(s, e, n) { | ||
function qe(s, e, n) { | ||
for (const t of oe(s, n)) | ||
@@ -543,7 +543,7 @@ e(...t); | ||
} | ||
function qe(s, e, n, t) { | ||
function Xe(s, e, n, t) { | ||
const p = { ...Z, ...t }, { idKey: h, parentIdKey: I } = p, c = e[I] ?? null, a = ve(s, c, n, p); | ||
s.splice(a, 0, e); | ||
} | ||
function Oe(s, e, n) { | ||
function Re(s, e, n) { | ||
if (e == null) | ||
@@ -562,3 +562,3 @@ return s.splice(0, s.length); | ||
} | ||
function Xe(s, e, n, t) { | ||
function je(s, e, n, t) { | ||
const p = { ...Z, ...t }, { idKey: h, parentIdKey: I } = p, c = new Set(e), a = Array.isArray(n) ? n : [n], l = new Set(a); | ||
@@ -581,3 +581,3 @@ if (l.size > 0) | ||
}; | ||
function je(s, e, n, t) { | ||
function Ye(s, e, n, t) { | ||
const p = { ...be, ...t }, { idKey: h, childrenKey: I } = p, c = new Set(e), a = Array.isArray(n) ? n : [n], l = new Set(a); | ||
@@ -596,3 +596,3 @@ if (l.size > 0) | ||
} | ||
function Ye(s, e, n, t, p) { | ||
function $e(s, e, n, t, p) { | ||
const h = new Set(e), I = Array.isArray(n) ? n : [n], c = /* @__PURE__ */ new Map(), a = new Set(I), l = /* @__PURE__ */ new Map(), D = []; | ||
@@ -621,3 +621,3 @@ l.set(null, D); | ||
} | ||
function $e(s, e, n, t, p) { | ||
function Ue(s, e, n, t, p) { | ||
const h = { ...be, ...p }, { idKey: I, childrenKey: c } = h, a = new Set(e), l = Array.isArray(n) ? n : [n], D = /* @__PURE__ */ new Map(), m = new Set(l), K = /* @__PURE__ */ new Map(); | ||
@@ -648,6 +648,6 @@ K.set(null, []); | ||
} | ||
function Re(s, e, n, t) { | ||
function Ae(s, e, n, t) { | ||
return Math.sqrt(Math.pow(n - s, 2) + Math.pow(t - e, 2)); | ||
} | ||
function Ae(s, e, n) { | ||
function Le(s, e, n) { | ||
Ce(() => { | ||
@@ -661,19 +661,19 @@ const t = s(); | ||
export { | ||
qe as addToFlatData, | ||
Xe as addToFlatData, | ||
ve as convertIndexToTreeIndexInFlatData, | ||
Ke as defaultProps, | ||
ze as filterTreeData, | ||
He as findTreeData, | ||
Xe as openParentsInFlatData, | ||
je as openParentsInTreeData, | ||
Oe as removeByIdInFlatData, | ||
Ve as sortFlatData, | ||
Ye as updateCheckedInFlatData, | ||
$e as updateCheckedInTreeData, | ||
Me as useHeTree, | ||
We as walkFlatData, | ||
Oe as defaultProps, | ||
Ve as filterTreeData, | ||
ze as findTreeData, | ||
je as openParentsInFlatData, | ||
Ye as openParentsInTreeData, | ||
Re as removeByIdInFlatData, | ||
We as sortFlatData, | ||
$e as updateCheckedInFlatData, | ||
Ue as updateCheckedInTreeData, | ||
_e as useHeTree, | ||
qe as walkFlatData, | ||
oe as walkFlatDataGenerator, | ||
Se as walkParentsGenerator, | ||
_e as walkTreeData, | ||
He as walkTreeData, | ||
j as walkTreeDataGenerator | ||
}; |
{ | ||
"name": "he-tree-react", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "phphe <phphe@outlook.com> (https://github.com/phphe)", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
211876
0