tinybase 4.2.1 → 4.2.3
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/lib/cjs/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/ui-react-dom.js +15 -6
- package/lib/debug/ui-react.js +37 -0
- package/lib/es6/ui-react-dom-debug.js +1 -1
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/types/store.d.ts +6 -0
- package/lib/types/ui-react.d.ts +175 -0
- package/lib/types/with-schemas/store.d.ts +6 -0
- package/lib/types/with-schemas/ui-react.d.ts +205 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -1
- package/lib/umd/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -1
- package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +18 -18
- package/readme.md +1 -1
package/lib/debug/ui-react.js
CHANGED
|
@@ -72,6 +72,11 @@ const useCheckpoints = (id) => useThing(id, 10);
|
|
|
72
72
|
const useCheckpointsOrCheckpointsById = (checkpointsOrCheckpointsId) =>
|
|
73
73
|
useThingOrThingById(checkpointsOrCheckpointsId, 10);
|
|
74
74
|
|
|
75
|
+
const lower = (str) => str.toLowerCase();
|
|
76
|
+
lower(LISTENER);
|
|
77
|
+
const TRANSACTION = 'Transaction';
|
|
78
|
+
lower(TRANSACTION);
|
|
79
|
+
|
|
75
80
|
const {
|
|
76
81
|
useCallback: useCallback$1,
|
|
77
82
|
useEffect,
|
|
@@ -604,6 +609,35 @@ const useValueListener = (
|
|
|
604
609
|
[valueId],
|
|
605
610
|
mutator,
|
|
606
611
|
);
|
|
612
|
+
const useStartTransactionListener = (listener, listenerDeps, storeOrStoreId) =>
|
|
613
|
+
useListener(
|
|
614
|
+
'Start' + TRANSACTION,
|
|
615
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
616
|
+
listener,
|
|
617
|
+
listenerDeps,
|
|
618
|
+
);
|
|
619
|
+
const useWillFinishTransactionListener = (
|
|
620
|
+
listener,
|
|
621
|
+
listenerDeps,
|
|
622
|
+
storeOrStoreId,
|
|
623
|
+
) =>
|
|
624
|
+
useListener(
|
|
625
|
+
'WillFinish' + TRANSACTION,
|
|
626
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
627
|
+
listener,
|
|
628
|
+
listenerDeps,
|
|
629
|
+
);
|
|
630
|
+
const useDidFinishTransactionListener = (
|
|
631
|
+
listener,
|
|
632
|
+
listenerDeps,
|
|
633
|
+
storeOrStoreId,
|
|
634
|
+
) =>
|
|
635
|
+
useListener(
|
|
636
|
+
'DidFinish' + TRANSACTION,
|
|
637
|
+
useStoreOrStoreById(storeOrStoreId),
|
|
638
|
+
listener,
|
|
639
|
+
listenerDeps,
|
|
640
|
+
);
|
|
607
641
|
const useCreateMetrics = (store, create, createDeps) =>
|
|
608
642
|
useCreate(store, create, createDeps);
|
|
609
643
|
const useMetricsIds = () => useThingIds(3);
|
|
@@ -1582,6 +1616,7 @@ export {
|
|
|
1582
1616
|
useDelTablesCallback,
|
|
1583
1617
|
useDelValueCallback,
|
|
1584
1618
|
useDelValuesCallback,
|
|
1619
|
+
useDidFinishTransactionListener,
|
|
1585
1620
|
useGoBackwardCallback,
|
|
1586
1621
|
useGoForwardCallback,
|
|
1587
1622
|
useGoToCallback,
|
|
@@ -1647,6 +1682,7 @@ export {
|
|
|
1647
1682
|
useSliceRowIdsListener,
|
|
1648
1683
|
useSortedRowIds,
|
|
1649
1684
|
useSortedRowIdsListener,
|
|
1685
|
+
useStartTransactionListener,
|
|
1650
1686
|
useStore,
|
|
1651
1687
|
useStoreIds,
|
|
1652
1688
|
useStoreOrStoreById,
|
|
@@ -1665,4 +1701,5 @@ export {
|
|
|
1665
1701
|
useValueListener,
|
|
1666
1702
|
useValues,
|
|
1667
1703
|
useValuesListener,
|
|
1704
|
+
useWillFinishTransactionListener,
|
|
1668
1705
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as b,useResultRowCount as v,useResultSortedRowIds as g,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as V,useRelationships as N,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,be=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),ve=e=>e==W||e==H,ge=e=>D(e)==G,fe=e=>Array.isArray(e),{PureComponent:ye,Fragment:Ie,createElement:we,useCallback:Ce,useLayoutEffect:ke,useRef:xe,useState:Te}=e,Se=(e,...t)=>pe(e)?{}:e(...t),Oe=(e,t)=>e.forEach(t),qe=(e,t)=>e.map(t),Ve=e=>e.length,Ne=e=>0==Ve(e),Pe=(e,t,l)=>e.slice(t,l),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>be(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>qe(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ve(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>qe(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),Ce((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",dt=qe([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))gt.call(t,l)&&yt(e,l,t[l]);if(vt)for(var l of vt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,bt(t));const Ct="*::-webkit-scrollbar",kt=`#${Qe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+it},Ae(qe(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Ae(qe(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":it,"header>img:nth-of-type(6)":ut}),Ae(qe(dt,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":ct,"details[open]>summary img.done":ht,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`& ${t}{${e}}`:"")))}`,xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:we("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return we("details",{open:i,onToggle:d},we("summary",null,l,o?we("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return ve(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Vt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Nt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>qe(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),b=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:we(b,{offset:u,limit:r,total:o,onChange:p})),[s,b,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(qe(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>we("table",{className:e},i?we("caption",null,i):null,!1===t?null:we("thead",null,we("tr",null,!1===l?null:we(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>we(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),we("tbody",null,qe(o,(e=>we("tr",{key:e},!1===l?null:we("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>we("td",{key:n},we(t,$t(zt(zt({},Se(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>we("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return we("tr",null,!1===l?null:we(e.Fragment,null,we("th",null,t),we("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:we("td",{key:n},we(e,$t(zt({},Se(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n})=>{const[r,o]=Dt(),[s,a]=Dt(),[i,d]=Dt(),[u,c]=Dt(),[h,m]=Dt();s!==e&&(o(St(e)),a(e),d(e+""),c(Number(e)||0),m(!!e));const p=Ft(((e,l)=>{l(e),a(e),t(e)}),[t]);return we("div",{className:l},we("button",{className:r,onClick:Ft((()=>{if(!(null==n?void 0:n())){const e=Vt(r,Q,H,W),l=Vt(e,i,u,h);o(e),a(l),t(l)}}),[n,t,i,u,h,r])},r),Vt(r,we("input",{key:r,value:i,onChange:Ft((e=>p(e[ie][de]+"",d)),[p])}),we("input",{key:r,type:"number",value:u,onChange:Ft((e=>p(Number(e[ie][de]||0),c)),[p])}),we("input",{key:r,type:"checkbox",checked:h,onChange:Ft((e=>p(!!e[ie].checked,m)),[p])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:b}=t,v=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return we(Yt,$t(zt({},v),{params:Qt(Xt(s(l,u),b,c?il:I),Gt(u,l),i(l,...g,d,u),g,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>we("table",{className:r},!1===o?null:we("thead",null,we("tr",null,!1===s?null:we("th",null,"Id"),we("th",null,oe))),we("tbody",null,qe(d(e),(t=>we("tr",{key:t},!1===s?null:we("th",null,t),we("td",null,we(l,$t(zt({},Se(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),b=Qt(i,p,c,h,t,d,u);return we("table",{className:s},!1===a?null:we("thead",null,we("tr",null,!1===i?null:we(e.Fragment,null,we("th",null,c,".Id"),we("th",null,h,".Id")),De(p,(({label:e},t)=>we("th",{key:t},e))))),we("tbody",null,qe(o(c,u),(e=>we(_t,{key:e,localRowId:e,params:b})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return we(Yt,$t(zt({},o),{params:Qt(Xt(b(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,v(l,a),d,c);return we(Yt,$t(zt({},h),{params:Qt(Xt(b(l,a),u,w),Kt(a,l),g(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s})=>{var a;return we(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,hasSchema:null==(a=f(o))?void 0:a.hasTablesSchema})},dl=({valueId:e,store:t,className:r})=>{var o;return we(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,hasSchema:null==(o=f(t))?void 0:o.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return we(e.Fragment,null,l>r&&we(e.Fragment,null,we("button",{className:"previous",disabled:0==n,onClick:a},"←"),we("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>we(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},qe(x(l,e),(r=>we(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return we(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},we(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:we(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Ne(n)?"No indexes defined":lt(n,(n=>we(cl,{indexes:l,indexesId:e,indexId:n,s:t}))))},pl=({metrics:e,metricId:t})=>we("tr",null,we("th",null,t),we("td",null,null==e?void 0:e.getTableId(t)),we("td",null,O(t,e))),bl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:we(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Ne(n)?"No metrics defined":we("table",null,we("thead",null,we("th",null,"Metric Id"),we("th",null,"Table Id"),we("th",null,"Metric")),we("tbody",null,qe(n,(e=>we(pl,{metrics:l,metricId:e}))))))},vl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return we(Tt,{uniqueId:a,summary:"Query: "+n,s:o},we(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},gl=({queriesId:e,s:t})=>{const l=q(e),n=V(l);return pe(l)?null:we(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Ne(n)?"No queries defined":lt(n,(n=>we(vl,{queries:l,queriesId:e,queryId:n,s:t}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return we(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},we(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=N(e),n=P(l);return pe(l)?null:we(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Ne(n)?"No relationships defined":lt(n,(n=>we(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return we(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},we(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Ne(d(e))?null:we(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},we(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:we(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},we(wl,{storeId:e,store:l,s:t}),lt(n,(n=>we(Il,{store:l,storeId:e,tableId:n,s:t}))))},kl=({s:e})=>{const t=xe(null),l=xe(0),[n,r]=Te(!1),{scrollLeft:o,scrollTop:s}=E(e);ke((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=Ce((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=N(),b=$(),v=q(),g=A();return pe(i)&&Ne(d)&&pe(u)&&Ne(c)&&pe(h)&&Ne(m)&&pe(p)&&Ne(b)&&pe(v)&&Ne(g)?we("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):we("article",{ref:t,onScroll:a},we(Cl,{s:e}),qe(d,(t=>we(Cl,{storeId:t,key:t,s:e}))),we(bl,{s:e}),qe(c,(t=>we(bl,{metricsId:t,key:t,s:e}))),we(ml,{s:e}),qe(m,(t=>we(ml,{indexesId:t,key:t,s:e}))),we(yl,{s:e}),qe(b,(t=>we(yl,{relationshipsId:t,key:t,s:e}))),we(gl,{s:e}),qe(g,(t=>we(gl,{queriesId:t,key:t,s:e}))))};var xl=Object.defineProperty,Tl=(e,t,l)=>(((e,t,l)=>{t in e?xl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l})(e,"symbol"!=typeof t?t+"":t,l),l);class Sl extends ye{constructor(e){super(e),Tl(this,"componentDidCatch",((e,t)=>console.error(e,t.componentStack))),this.state={e:0}}render(){return this.state.e?we("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}Tl(Sl,"getDerivedStateFromError",(()=>({e:1})));const Ol=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return we("header",null,we("img",{title:Ge}),we("span",null,Ge),qe(Ke,((e,t)=>t==r?null:we("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),we("img",{onClick:o,title:"Close"}))},ql=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?we("main",{"data-position":n},we(Ol,{s:e}),we(Sl,null,we(kl,{s:e}))):null},Vl=e=>t=>{return l=(t,l)=>t+e(l),Ml(t).reduce(l,0);var l},Nl=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Pl=Vl(Nl),Ll=Vl(Pl),Rl=Vl(Ll),El=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},jl=e=>pe(e)||0==Nl(e),Ml=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},zl=e=>e.clear(),$l=(e,t)=>null==e?void 0:e.forEach(t),Al=(e,t)=>null==e?void 0:e.delete(t),Fl=e=>new Map(e),Jl=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Dl=(e,t)=>null==e?void 0:e.get(t),Bl=(e,t)=>$l(e,((e,l)=>t(l,e))),Wl=(e,t,l)=>pe(l)?(Al(e,t),e):null==e?void 0:e.set(t,l),Hl=(e,t,l)=>(El(e,t)||Wl(e,t,l()),Dl(e,t)),Ql=(e,t,l,n=Wl)=>(De(t,((t,n)=>l(e,n,t))),Bl(e,(l=>Fe(t,l)?0:n(e,l))),e),Gl=(e,t,l)=>{const n={};return $l(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Kl=(e,t,l)=>Gl(e,(e=>Gl(e,t,l)),Be),Ul=(e,t,l)=>Gl(e,(e=>Kl(e,t,l)),Be),Xl=(e,t)=>{const l=Fl();return $l(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Yl=e=>Xl(e,Xl),Zl=e=>Xl(e,Yl),_l=(e,t,l,n,r=0)=>be((l?Hl:Dl)(e,t[r],r>Ve(t)-2?l:Fl),(o=>{if(r>Ve(t)-2)return(null==n?void 0:n(o))&&Wl(e,t[r]),o;const s=_l(o,t,l,n,r+1);return jl(o)&&Wl(e,t[r]),s}));var en=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const tn=Fl(),ln=Fl();var nn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const rn="storage",on=globalThis.window,sn=e=>new Set(fe(e)||pe(e)?e:[e]),an=(e,t)=>null==e?void 0:e.add(t),dn=/^\d+$/,un=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{dn.test(t)&&Ve(e)<1e3&&Le(e,t)}]},cn=e=>[e,e],hn=(e,t=Pl)=>t(e[0])+t(e[1]),mn=()=>[Fl(),Fl()],pn=e=>[...e],bn=([e,t])=>e===t,vn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),gn=(e,t,l)=>Wl(e,t,Dl(e,t)==-l?void 0:l),fn=()=>{let e,t,l=!1,n=!1,r=0;const o=Fl(),s=Fl(),a=Fl(),i=Fl(),d=Fl(),u=Fl(),c=Fl(),h=Fl(),m=Fl(),p=Fl(),b=Fl(),v=Fl(),g=Fl(),f=Fl(),y=sn(),I=Fl(),w=Fl(),C=Fl(),k=Fl(),x=mn(),T=mn(),S=mn(),O=mn(),q=mn(),V=mn(),N=mn(),P=mn(),L=mn(),R=mn(),E=mn(),j=mn(),M=mn(),z=mn(),$=mn(),A=Fl(),F=mn(),[J,D,W,H]=(e=>{let t;const[l,n]=un(),r=Fl();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Wl(r,i,[e,n,o,s,a]),an(_l(n,null!=o?o:[B],sn),i),i},(e,l,...n)=>Oe(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ve(t)?Le(l,e):null===t[r]?$l(e,(e=>n(e,r+1))):Oe([t[r],null],(t=>n(Dl(e,t),r+1)));return n(e,0),l})(e,l),(e=>$l(e,(e=>Dl(r,e)[0](t,...null!=l?l:[],...n))))),e=>be(Dl(r,e),(([,t,l])=>(_l(t,null!=l?l:[B],void 0,(t=>(Al(t,e),jl(t)?1:0))),Wl(r,e),n(e),l))),e=>be(Dl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ve(s);d==Ve(l)?e(t,...s,...r(s)):pe(l[d])?Oe(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!vn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!ve(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||El(b,l)||et(l))&&vn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>vn(n?l:me(l,e,t),((n,r)=>be(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?be(Dl(Dl(b,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>vn(t?e:fe(e),((t,l)=>be(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?be(Dl(g,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(be(Dl(v,t),(([n,r])=>{$l(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&($l(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(y,(t=>{Fe(e,t)||tt(t)}))),e),ye=e=>Ql(b,e,((e,t,l)=>{const n=Fl(),r=sn();Ql(Hl(b,t,Fl),l,((e,t,l)=>{Wl(e,t,l),be(l[U],(e=>Wl(n,t,e)),(()=>an(r,t)))})),Wl(v,t,[n,r])}),((e,t)=>{Wl(b,t),Wl(v,t)})),Ie=e=>Ql(g,e,((e,t,l)=>{Wl(g,t,l),be(l[U],(e=>Wl(f,t,e)),(()=>an(y,t)))}),((e,t)=>{Wl(g,t),Wl(f,t),Al(y,t)})),we=e=>Be(e)?Nt():Ct(e),Ce=e=>Ql(C,e,((e,t,l)=>ke(t,l)),((e,t)=>$e(t))),ke=(e,t)=>Ql(Hl(C,e,(()=>(Ke(e,1),Wl(I,e,un()),Wl(w,e,Fl()),Fl()))),t,((t,l,n)=>xe(e,t,l,n)),((t,l)=>Ae(e,t,l))),xe=(e,t,l,n,r)=>Ql(Hl(t,l,(()=>(Ue(e,l,1),Fl()))),n,((t,n,r)=>Te(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Te=(e,t,l,n,r)=>{El(l,n)||Xe(e,t,n,1);const o=Dl(l,n);r!==o&&(Ye(e,t,n,o,r),Wl(l,n,r))},Se=(e,t,l,n,r)=>be(Dl(t,l),(t=>Te(e,l,t,n,r)),(()=>xe(e,t,l,me({[n]:r},e,l)))),Ne=e=>Be(e)?Rt():kt(e),Re=e=>Ql(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{El(k,e)||Ze(e,1);const l=Dl(k,e);t!==l&&(_e(e,l,t),Wl(k,e,t))},je=(e,t)=>{const[l]=Dl(I,e),n=l(t);return El(Dl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Dl(C,e))?t:ke(e,{})},$e=e=>ke(e,{}),Ae=(e,t,l)=>{const[,n]=Dl(I,e);n(l),xe(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Dl(null==(s=Dl(v,e))?void 0:s[0],r);if(!pe(a)&&!o)return Te(e,l,n,r,a);const i=t=>{Ye(e,l,t,Dl(n,t)),Xe(e,l,t,-1),Wl(n,t)};pe(a)?i(r):Bl(n,i),jl(n)&&(Ue(e,l,-1),jl(Wl(t,l))&&(Ke(e,-1),Wl(C,e),Wl(I,e),Wl(w,e)))},Ge=e=>{const t=Dl(f,e);if(!pe(t))return Ee(e,t);_e(e,Dl(k,e)),Ze(e,-1),Wl(k,e)},Ke=(e,t)=>gn(o,e,t),Ue=(e,t,l)=>gn(Hl(i,e,Fl),t,l)&&Wl(a,e,Hl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Dl(w,e),a=null!=(r=Dl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&gn(Hl(s,e,Fl),l,n),Wl(o,l,a!=-n?a+n:null),gn(Hl(Hl(d,e,Fl),t,Fl),l,n)},Ye=(e,t,l,n,r)=>Hl(Hl(Hl(u,e,Fl),t,Fl),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>gn(c,e,t),_e=(e,t,l)=>Hl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Hl(Hl(Hl(m,e,Fl),t,Fl),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Hl(p,e,(()=>[])),t),l),lt=(e,t,l)=>be(Dl(Dl(Dl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(ft(e,t,l))])),nt=e=>be(Dl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(wt(e))])),rt=e=>jl(m)||jl(E[e])?0:$l(e?Zl(m):m,((t,l)=>$l(t,((t,n)=>$l(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>jl(p)||jl(j[e])?0:$l(e?Xl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!jl(t))return D(e,l,(()=>Gl(t))),1},at=e=>{const t=jl(N[e]),l=jl(L[e])&&jl(O[e])&&jl(q[e])&&jl(V[e])&&t&&jl(T[e]),n=jl(R[e])&&jl(P[e])&&jl(S[e])&&jl(x[e]);if(!l||!n){const r=e?[Xl(o),Yl(s),Xl(a),Yl(i),Zl(d),Zl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),$l(r[1],((t,l)=>st(O[e],t,[l]))),$l(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=sn();$l(r[3],((n,r)=>{st(V[e],n,[r])&&!t&&(D(N[e],[r,null]),an(l,r))})),t||$l(r[5],((t,n)=>{if(!El(l,n)){const l=sn();$l(t,(e=>$l(e,(([t,n],r)=>n!==t?an(l,r):Al(e,r))))),$l(l,(t=>D(N[e],[n,t])))}})),$l(r[4],((t,l)=>$l(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;$l(r[5],((l,n)=>{let r;$l(l,((l,o)=>{let s;$l(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=jl(z[e]),l=jl($[e])&&jl(M[e]);if(!t||!l){const n=e?[Xl(c),Xl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;$l(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...qe(t,ue)))),At),ut=()=>[Gl(u,((e,t)=>-1===Dl(o,t)?null:Gl(e,((e,l)=>-1===Dl(Dl(i,t),l)?null:Gl(e,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))),Be)),Be),Gl(h,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Ul(u,pn,bn),invalidCells:Ul(m),changedValues:Gl(h,pn,bn),invalidValues:Gl(p),changedTableIds:Gl(o),changedRowIds:Kl(i),changedCellIds:Ul(d),changedValueIds:Gl(c)}),ht=()=>Ul(C),mt=()=>Jl(C),pt=e=>Nl(Dl(C,ue(e))),bt=e=>Jl(Dl(C,ue(e))),vt=(e,t,l,n=0,r)=>{return qe(Pe((s=Dl(C,ue(e)),a=(e,l)=>[pe(t)?l:Dl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},qe([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},gt=(e,t)=>Jl(Dl(Dl(C,ue(e)),ue(t))),ft=(e,t,l)=>Dl(Dl(Dl(C,ue(e)),ue(t)),ue(l)),yt=()=>Gl(k),It=()=>Jl(k),wt=e=>Dl(k,ue(e)),Ct=e=>dt((()=>(e=>vn(e,X,et))(e)?Ce(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{we(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=vn(t,(e=>vn(e,G))))&&(ye(t),!jl(C))){const e=ht();Nt(),Ct(e)}})),Vt=e=>dt((()=>{if(t=(e=>vn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ie(e),kt(l)}})),Nt=()=>dt((()=>Ce({}))),Pt=e=>dt((e=>El(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>be(Dl(C,e),(l=>El(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{ye({}),e=!1})),jt=()=>dt((()=>{Ie({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!jl(u),n=!jl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&($l(u,((e,t)=>$l(e,((e,l)=>$l(e,(([e],n)=>Ot(At,t,l,n,e))))))),$l(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Oe([o,s,a,i,d,u,m,c,h,p],zl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Kl(Dl(C,ue(e))),getTableCellIds:e=>Jl(Dl(w,ue(e))),getRowCount:pt,getRowIds:bt,getSortedRowIds:vt,getRow:(e,t)=>Gl(Dl(Dl(C,ue(e)),ue(t))),getCellIds:gt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!jl(C),hasTable:e=>El(C,ue(e)),hasTableCell:(e,t)=>El(Dl(w,ue(e)),ue(t)),hasRow:(e,t)=>El(Dl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>El(Dl(Dl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!jl(k),hasValue:e=>El(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(b),getValuesSchemaJson:()=>We(g),getSchemaJson:()=>We([b,g]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Nt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?ke(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?xe(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),xe(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>Se(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>be(de(e,t,l,ge(n)?n(ft(e,t,l)):n),(n=>Se(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>be(he(e,ge(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Ne(He(e))}catch(e){}return At},setJson:e=>dt((()=>{try{const[t,l]=He(e);we(t),Ne(l)}catch(t){xt(e)}})),setTablesSchema:Tt,setValuesSchema:Vt,setSchema:(e,t)=>dt((()=>{Tt(e),Vt(t)})),delTables:Nt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>be(Dl(C,e),(r=>be(Dl(r,t),(o=>El(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>El(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>$l(C,((t,l)=>e(l,(e=>$l(t,((t,l)=>e(l,(e=>Bl(t,e))))))))),forEachTableCell:(e,t)=>Bl(Dl(w,ue(e)),t),forEachRow:(e,t)=>$l(Dl(C,ue(e)),((e,l)=>t(l,(t=>Bl(e,t))))),forEachCell:(e,t,l)=>Bl(Dl(Dl(C,ue(e)),ue(t)),l),forEachValue:e=>Bl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=vt(e,t,l,n,r);return J((()=>{const s=vt(e,t,l,n,r);var i,d,u;d=a,Ve(i=s)===Ve(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),N[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:hn(x),tableIds:hn(T),tableCellIds:hn(O),table:hn(S),rowCount:hn(q),rowIds:hn(V),sortedRowIds:hn(N),row:hn(P,Ll),cellIds:hn(L,Ll),cell:hn(R,Rl),invalidCell:hn(E,Rl),values:hn(M),valueIds:hn(z),value:hn($),invalidValue:hn(j),transaction:Pl(A)+hn(F)}),createStore:fn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,V,[mt]],[ee]:[2,P,[mt,bt]],[re]:[2,L,[mt,bt]],[ne]:[3,R,[mt,bt,gt],e=>cn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>cn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?Pe(r,0,e):void 0,l,n)})),ze(At)},yn=({position:e="right",open:t=!1})=>{const l=F(fn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,s=[])=>{let a,i,d,u=0,c=0,h=0,m=0;Hl(tn,s,(()=>0)),Hl(ln,s,(()=>[]));const p=e=>en(void 0,null,(function*(){return 2!=u&&(u=1,c++,yield b.schedule((()=>en(void 0,null,(function*(){yield e(),u=0}))))),b})),b={load:(l,n)=>en(void 0,null,(function*(){return yield p((()=>en(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>en(void 0,[...l],(function*(l={},r={}){return b.stopAutoLoad(),yield b.load(l,r),m=1,d=n(((l,n)=>en(void 0,null,(function*(){if(n){const t=n();yield p((()=>en(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield p((()=>en(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),b})),stopAutoLoad:()=>(m&&(r(d),d=void 0,m=0),b),save:t=>en(void 0,null,(function*(){return 1!=u&&(u=2,h++,yield b.schedule((()=>en(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}u=0}))))),b})),startAutoSave:()=>en(void 0,null,(function*(){return yield b.stopAutoSave().save(),a=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||b.save((()=>[l,n]))})),b})),stopAutoSave:()=>(be(a,e.delListener),b),schedule:(...e)=>en(void 0,null,(function*(){return Le(Dl(ln,s),...e),yield en(void 0,null,(function*(){if(!Dl(tn,s)){for(Wl(tn,s,1);!pe(i=Re(Dl(ln,s)));)try{yield i()}catch(e){null==o||o(e)}Wl(tn,s,0)}})),b})),getStore:()=>e,destroy:()=>b.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return ze(b)})(e,(()=>nn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>nn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return on.addEventListener(rn,n),n}),(e=>on.removeEventListener(rn,e)),n))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),we(Ie,null,we("aside",{id:Qe},we(xt,{s:l}),we(ql,{s:l})),we("style",null,kt))};var In=Object.defineProperty,wn=Object.getOwnPropertySymbols,Cn=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,xn=(e,t,l)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const Tn=e=>we(yn,((e,t)=>{for(var l in t||(t={}))Cn.call(t,l)&&xn(e,l,t[l]);if(wn)for(var l of wn(t))kn.call(t,l)&&xn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,Tn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
|
|
1
|
+
import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as b,useResultRowCount as v,useResultSortedRowIds as g,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as V,useRelationships as N,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,be=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),ve=e=>e==W||e==H,ge=e=>D(e)==G,fe=e=>Array.isArray(e),{PureComponent:ye,Fragment:Ie,createElement:we,useCallback:Ce,useLayoutEffect:ke,useRef:xe,useState:Te}=e,Se=(e,...t)=>pe(e)?{}:e(...t),Oe=(e,t)=>e.forEach(t),qe=(e,t)=>e.map(t),Ve=e=>e.length,Ne=e=>0==Ve(e),Pe=(e,t,l)=>e.slice(t,l),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>be(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>qe(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ve(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>qe(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),Ce((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",dt=qe([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))gt.call(t,l)&&yt(e,l,t[l]);if(vt)for(var l of vt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,bt(t));const Ct="*::-webkit-scrollbar",kt=`#${Qe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+it},Ae(qe(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Ae(qe(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":it,"header>img:nth-of-type(6)":ut}),Ae(qe(dt,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":ct,"details[open]>summary img.done":ht,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`& ${t}{${e}}`:"")))}`,xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:we("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return we("details",{open:i,onToggle:d},we("summary",null,l,o?we("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return ve(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Vt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Nt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>qe(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),b=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:we(b,{offset:u,limit:r,total:o,onChange:p})),[s,b,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(qe(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>we("table",{className:e},i?we("caption",null,i):null,!1===t?null:we("thead",null,we("tr",null,!1===l?null:we(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>we(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),we("tbody",null,qe(o,(e=>we("tr",{key:e},!1===l?null:we("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>we("td",{key:n},we(t,$t(zt(zt({},Se(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>we("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return we("tr",null,!1===l?null:we(e.Fragment,null,we("th",null,t),we("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:we("td",{key:n},we(e,$t(zt({},Se(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n})=>{const[r,o]=Dt(),[s,a]=Dt(),[i,d]=Dt(),[u,c]=Dt(),[h,m]=Dt();s!==e&&(o(St(e)),a(e),d(e+""),c(Number(e)||0),m(!!e));const p=Ft(((e,l)=>{l(e),a(e),t(e)}),[t]);return we("div",{className:l},we("button",{className:r,onClick:Ft((()=>{if(!(null==n?void 0:n())){const e=Vt(r,Q,H,W),l=Vt(e,i,u,h);o(e),a(l),t(l)}}),[n,t,i,u,h,r])},r),Vt(r,we("input",{key:r,value:i,onChange:Ft((e=>p(e[ie][de]+"",d)),[p])}),we("input",{key:r,type:"number",value:u,onChange:Ft((e=>p(Number(e[ie][de]||0),c)),[p])}),we("input",{key:r,type:"checkbox",checked:h,onChange:Ft((e=>p(!!e[ie].checked,m)),[p])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:b}=t,v=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return we(Yt,$t(zt({},v),{params:Qt(Xt(s(l,u),b,c?il:I),Gt(u,l),i(l,...g,d,u),g,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>we("table",{className:r},!1===o?null:we("thead",null,we("tr",null,!1===s?null:we("th",null,"Id"),we("th",null,oe))),we("tbody",null,qe(d(e),(t=>we("tr",{key:t},!1===s?null:we("th",null,t),we("td",null,we(l,$t(zt({},Se(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),b=Qt(i,p,c,h,t,d,u);return we("table",{className:s},!1===a?null:we("thead",null,we("tr",null,!1===i?null:we(e.Fragment,null,we("th",null,c,".Id"),we("th",null,h,".Id")),De(p,(({label:e},t)=>we("th",{key:t},e))))),we("tbody",null,qe(o(c,u),(e=>we(_t,{key:e,localRowId:e,params:b})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return we(Yt,$t(zt({},o),{params:Qt(Xt(b(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,v(l,a),d,c);return we(Yt,$t(zt({},h),{params:Qt(Xt(b(l,a),u,w),Kt(a,l),g(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s})=>{var a;return we(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,hasSchema:null==(a=f(o))?void 0:a.hasTablesSchema})},dl=({valueId:e,store:t,className:r})=>{var o;return we(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,hasSchema:null==(o=f(t))?void 0:o.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return we(e.Fragment,null,l>r&&we(e.Fragment,null,we("button",{className:"previous",disabled:0==n,onClick:a},"←"),we("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>we(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},qe(x(l,e),(r=>we(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n,key:r})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return we(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},we(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:we(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Ne(n)?"No indexes defined":lt(n,(n=>we(cl,{indexes:l,indexesId:e,indexId:n,s:t,key:n}))))},pl=({metrics:e,metricId:t})=>we("tr",null,we("th",null,t),we("td",null,null==e?void 0:e.getTableId(t)),we("td",null,O(t,e))),bl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:we(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Ne(n)?"No metrics defined":we("table",null,we("thead",null,we("th",null,"Metric Id"),we("th",null,"Table Id"),we("th",null,"Metric")),we("tbody",null,qe(n,(e=>we(pl,{metrics:l,metricId:e,key:e}))))))},vl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return we(Tt,{uniqueId:a,summary:"Query: "+n,s:o},we(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},gl=({queriesId:e,s:t})=>{const l=q(e),n=V(l);return pe(l)?null:we(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Ne(n)?"No queries defined":lt(n,(n=>we(vl,{queries:l,queriesId:e,queryId:n,s:t,key:n}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return we(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},we(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=N(e),n=P(l);return pe(l)?null:we(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Ne(n)?"No relationships defined":lt(n,(n=>we(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t,key:n}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return we(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},we(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Ne(d(e))?null:we(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},we(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:we(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},we(wl,{storeId:e,store:l,s:t}),lt(n,(n=>we(Il,{store:l,storeId:e,tableId:n,s:t,key:n}))))},kl=({s:e})=>{const t=xe(null),l=xe(0),[n,r]=Te(!1),{scrollLeft:o,scrollTop:s}=E(e);ke((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=Ce((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=N(),b=$(),v=q(),g=A();return pe(i)&&Ne(d)&&pe(u)&&Ne(c)&&pe(h)&&Ne(m)&&pe(p)&&Ne(b)&&pe(v)&&Ne(g)?we("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):we("article",{ref:t,onScroll:a},we(Cl,{s:e}),qe(d,(t=>we(Cl,{storeId:t,s:e,key:t}))),we(bl,{s:e}),qe(c,(t=>we(bl,{metricsId:t,s:e,key:t}))),we(ml,{s:e}),qe(m,(t=>we(ml,{indexesId:t,s:e,key:t}))),we(yl,{s:e}),qe(b,(t=>we(yl,{relationshipsId:t,s:e,key:t}))),we(gl,{s:e}),qe(g,(t=>we(gl,{queriesId:t,s:e,key:t}))))};var xl=Object.defineProperty,Tl=(e,t,l)=>(((e,t,l)=>{t in e?xl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l})(e,"symbol"!=typeof t?t+"":t,l),l);class Sl extends ye{constructor(e){super(e),Tl(this,"componentDidCatch",((e,t)=>console.error(e,t.componentStack))),this.state={e:0}}render(){return this.state.e?we("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}Tl(Sl,"getDerivedStateFromError",(()=>({e:1})));const Ol=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return we("header",null,we("img",{title:Ge}),we("span",null,Ge),qe(Ke,((e,t)=>t==r?null:we("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),we("img",{onClick:o,title:"Close"}))},ql=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?we("main",{"data-position":n},we(Ol,{s:e}),we(Sl,null,we(kl,{s:e}))):null},Vl=e=>t=>{return l=(t,l)=>t+e(l),Ml(t).reduce(l,0);var l},Nl=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Pl=Vl(Nl),Ll=Vl(Pl),Rl=Vl(Ll),El=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},jl=e=>pe(e)||0==Nl(e),Ml=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},zl=e=>e.clear(),$l=(e,t)=>null==e?void 0:e.forEach(t),Al=(e,t)=>null==e?void 0:e.delete(t),Fl=e=>new Map(e),Jl=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Dl=(e,t)=>null==e?void 0:e.get(t),Bl=(e,t)=>$l(e,((e,l)=>t(l,e))),Wl=(e,t,l)=>pe(l)?(Al(e,t),e):null==e?void 0:e.set(t,l),Hl=(e,t,l)=>(El(e,t)||Wl(e,t,l()),Dl(e,t)),Ql=(e,t,l,n=Wl)=>(De(t,((t,n)=>l(e,n,t))),Bl(e,(l=>Fe(t,l)?0:n(e,l))),e),Gl=(e,t,l)=>{const n={};return $l(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Kl=(e,t,l)=>Gl(e,(e=>Gl(e,t,l)),Be),Ul=(e,t,l)=>Gl(e,(e=>Kl(e,t,l)),Be),Xl=(e,t)=>{const l=Fl();return $l(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Yl=e=>Xl(e,Xl),Zl=e=>Xl(e,Yl),_l=(e,t,l,n,r=0)=>be((l?Hl:Dl)(e,t[r],r>Ve(t)-2?l:Fl),(o=>{if(r>Ve(t)-2)return(null==n?void 0:n(o))&&Wl(e,t[r]),o;const s=_l(o,t,l,n,r+1);return jl(o)&&Wl(e,t[r]),s}));var en=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const tn=Fl(),ln=Fl();var nn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const rn="storage",on=globalThis.window,sn=e=>new Set(fe(e)||pe(e)?e:[e]),an=(e,t)=>null==e?void 0:e.add(t),dn=/^\d+$/,un=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{dn.test(t)&&Ve(e)<1e3&&Le(e,t)}]},cn=e=>[e,e],hn=(e,t=Pl)=>t(e[0])+t(e[1]),mn=()=>[Fl(),Fl()],pn=e=>[...e],bn=([e,t])=>e===t,vn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),gn=(e,t,l)=>Wl(e,t,Dl(e,t)==-l?void 0:l),fn=()=>{let e,t,l=!1,n=!1,r=0;const o=Fl(),s=Fl(),a=Fl(),i=Fl(),d=Fl(),u=Fl(),c=Fl(),h=Fl(),m=Fl(),p=Fl(),b=Fl(),v=Fl(),g=Fl(),f=Fl(),y=sn(),I=Fl(),w=Fl(),C=Fl(),k=Fl(),x=mn(),T=mn(),S=mn(),O=mn(),q=mn(),V=mn(),N=mn(),P=mn(),L=mn(),R=mn(),E=mn(),j=mn(),M=mn(),z=mn(),$=mn(),A=Fl(),F=mn(),[J,D,W,H]=(e=>{let t;const[l,n]=un(),r=Fl();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Wl(r,i,[e,n,o,s,a]),an(_l(n,null!=o?o:[B],sn),i),i},(e,l,...n)=>Oe(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ve(t)?Le(l,e):null===t[r]?$l(e,(e=>n(e,r+1))):Oe([t[r],null],(t=>n(Dl(e,t),r+1)));return n(e,0),l})(e,l),(e=>$l(e,(e=>Dl(r,e)[0](t,...null!=l?l:[],...n))))),e=>be(Dl(r,e),(([,t,l])=>(_l(t,null!=l?l:[B],void 0,(t=>(Al(t,e),jl(t)?1:0))),Wl(r,e),n(e),l))),e=>be(Dl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ve(s);d==Ve(l)?e(t,...s,...r(s)):pe(l[d])?Oe(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!vn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!ve(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||El(b,l)||et(l))&&vn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>vn(n?l:me(l,e,t),((n,r)=>be(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?be(Dl(Dl(b,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>vn(t?e:fe(e),((t,l)=>be(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?be(Dl(g,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(be(Dl(v,t),(([n,r])=>{$l(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&($l(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(y,(t=>{Fe(e,t)||tt(t)}))),e),ye=e=>Ql(b,e,((e,t,l)=>{const n=Fl(),r=sn();Ql(Hl(b,t,Fl),l,((e,t,l)=>{Wl(e,t,l),be(l[U],(e=>Wl(n,t,e)),(()=>an(r,t)))})),Wl(v,t,[n,r])}),((e,t)=>{Wl(b,t),Wl(v,t)})),Ie=e=>Ql(g,e,((e,t,l)=>{Wl(g,t,l),be(l[U],(e=>Wl(f,t,e)),(()=>an(y,t)))}),((e,t)=>{Wl(g,t),Wl(f,t),Al(y,t)})),we=e=>Be(e)?Nt():Ct(e),Ce=e=>Ql(C,e,((e,t,l)=>ke(t,l)),((e,t)=>$e(t))),ke=(e,t)=>Ql(Hl(C,e,(()=>(Ke(e,1),Wl(I,e,un()),Wl(w,e,Fl()),Fl()))),t,((t,l,n)=>xe(e,t,l,n)),((t,l)=>Ae(e,t,l))),xe=(e,t,l,n,r)=>Ql(Hl(t,l,(()=>(Ue(e,l,1),Fl()))),n,((t,n,r)=>Te(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Te=(e,t,l,n,r)=>{El(l,n)||Xe(e,t,n,1);const o=Dl(l,n);r!==o&&(Ye(e,t,n,o,r),Wl(l,n,r))},Se=(e,t,l,n,r)=>be(Dl(t,l),(t=>Te(e,l,t,n,r)),(()=>xe(e,t,l,me({[n]:r},e,l)))),Ne=e=>Be(e)?Rt():kt(e),Re=e=>Ql(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{El(k,e)||Ze(e,1);const l=Dl(k,e);t!==l&&(_e(e,l,t),Wl(k,e,t))},je=(e,t)=>{const[l]=Dl(I,e),n=l(t);return El(Dl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Dl(C,e))?t:ke(e,{})},$e=e=>ke(e,{}),Ae=(e,t,l)=>{const[,n]=Dl(I,e);n(l),xe(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Dl(null==(s=Dl(v,e))?void 0:s[0],r);if(!pe(a)&&!o)return Te(e,l,n,r,a);const i=t=>{Ye(e,l,t,Dl(n,t)),Xe(e,l,t,-1),Wl(n,t)};pe(a)?i(r):Bl(n,i),jl(n)&&(Ue(e,l,-1),jl(Wl(t,l))&&(Ke(e,-1),Wl(C,e),Wl(I,e),Wl(w,e)))},Ge=e=>{const t=Dl(f,e);if(!pe(t))return Ee(e,t);_e(e,Dl(k,e)),Ze(e,-1),Wl(k,e)},Ke=(e,t)=>gn(o,e,t),Ue=(e,t,l)=>gn(Hl(i,e,Fl),t,l)&&Wl(a,e,Hl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Dl(w,e),a=null!=(r=Dl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&gn(Hl(s,e,Fl),l,n),Wl(o,l,a!=-n?a+n:null),gn(Hl(Hl(d,e,Fl),t,Fl),l,n)},Ye=(e,t,l,n,r)=>Hl(Hl(Hl(u,e,Fl),t,Fl),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>gn(c,e,t),_e=(e,t,l)=>Hl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Hl(Hl(Hl(m,e,Fl),t,Fl),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Hl(p,e,(()=>[])),t),l),lt=(e,t,l)=>be(Dl(Dl(Dl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(ft(e,t,l))])),nt=e=>be(Dl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(wt(e))])),rt=e=>jl(m)||jl(E[e])?0:$l(e?Zl(m):m,((t,l)=>$l(t,((t,n)=>$l(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>jl(p)||jl(j[e])?0:$l(e?Xl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!jl(t))return D(e,l,(()=>Gl(t))),1},at=e=>{const t=jl(N[e]),l=jl(L[e])&&jl(O[e])&&jl(q[e])&&jl(V[e])&&t&&jl(T[e]),n=jl(R[e])&&jl(P[e])&&jl(S[e])&&jl(x[e]);if(!l||!n){const r=e?[Xl(o),Yl(s),Xl(a),Yl(i),Zl(d),Zl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),$l(r[1],((t,l)=>st(O[e],t,[l]))),$l(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=sn();$l(r[3],((n,r)=>{st(V[e],n,[r])&&!t&&(D(N[e],[r,null]),an(l,r))})),t||$l(r[5],((t,n)=>{if(!El(l,n)){const l=sn();$l(t,(e=>$l(e,(([t,n],r)=>n!==t?an(l,r):Al(e,r))))),$l(l,(t=>D(N[e],[n,t])))}})),$l(r[4],((t,l)=>$l(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;$l(r[5],((l,n)=>{let r;$l(l,((l,o)=>{let s;$l(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=jl(z[e]),l=jl($[e])&&jl(M[e]);if(!t||!l){const n=e?[Xl(c),Xl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;$l(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...qe(t,ue)))),At),ut=()=>[Gl(u,((e,t)=>-1===Dl(o,t)?null:Gl(e,((e,l)=>-1===Dl(Dl(i,t),l)?null:Gl(e,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))),Be)),Be),Gl(h,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Ul(u,pn,bn),invalidCells:Ul(m),changedValues:Gl(h,pn,bn),invalidValues:Gl(p),changedTableIds:Gl(o),changedRowIds:Kl(i),changedCellIds:Ul(d),changedValueIds:Gl(c)}),ht=()=>Ul(C),mt=()=>Jl(C),pt=e=>Nl(Dl(C,ue(e))),bt=e=>Jl(Dl(C,ue(e))),vt=(e,t,l,n=0,r)=>{return qe(Pe((s=Dl(C,ue(e)),a=(e,l)=>[pe(t)?l:Dl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},qe([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},gt=(e,t)=>Jl(Dl(Dl(C,ue(e)),ue(t))),ft=(e,t,l)=>Dl(Dl(Dl(C,ue(e)),ue(t)),ue(l)),yt=()=>Gl(k),It=()=>Jl(k),wt=e=>Dl(k,ue(e)),Ct=e=>dt((()=>(e=>vn(e,X,et))(e)?Ce(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{we(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=vn(t,(e=>vn(e,G))))&&(ye(t),!jl(C))){const e=ht();Nt(),Ct(e)}})),Vt=e=>dt((()=>{if(t=(e=>vn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ie(e),kt(l)}})),Nt=()=>dt((()=>Ce({}))),Pt=e=>dt((e=>El(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>be(Dl(C,e),(l=>El(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{ye({}),e=!1})),jt=()=>dt((()=>{Ie({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!jl(u),n=!jl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&($l(u,((e,t)=>$l(e,((e,l)=>$l(e,(([e],n)=>Ot(At,t,l,n,e))))))),$l(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Oe([o,s,a,i,d,u,m,c,h,p],zl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Kl(Dl(C,ue(e))),getTableCellIds:e=>Jl(Dl(w,ue(e))),getRowCount:pt,getRowIds:bt,getSortedRowIds:vt,getRow:(e,t)=>Gl(Dl(Dl(C,ue(e)),ue(t))),getCellIds:gt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!jl(C),hasTable:e=>El(C,ue(e)),hasTableCell:(e,t)=>El(Dl(w,ue(e)),ue(t)),hasRow:(e,t)=>El(Dl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>El(Dl(Dl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!jl(k),hasValue:e=>El(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(b),getValuesSchemaJson:()=>We(g),getSchemaJson:()=>We([b,g]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Nt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?ke(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?xe(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),xe(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>Se(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>be(de(e,t,l,ge(n)?n(ft(e,t,l)):n),(n=>Se(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>be(he(e,ge(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Ne(He(e))}catch(e){}return At},setJson:e=>dt((()=>{try{const[t,l]=He(e);we(t),Ne(l)}catch(t){xt(e)}})),setTablesSchema:Tt,setValuesSchema:Vt,setSchema:(e,t)=>dt((()=>{Tt(e),Vt(t)})),delTables:Nt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>be(Dl(C,e),(r=>be(Dl(r,t),(o=>El(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>El(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>$l(C,((t,l)=>e(l,(e=>$l(t,((t,l)=>e(l,(e=>Bl(t,e))))))))),forEachTableCell:(e,t)=>Bl(Dl(w,ue(e)),t),forEachRow:(e,t)=>$l(Dl(C,ue(e)),((e,l)=>t(l,(t=>Bl(e,t))))),forEachCell:(e,t,l)=>Bl(Dl(Dl(C,ue(e)),ue(t)),l),forEachValue:e=>Bl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=vt(e,t,l,n,r);return J((()=>{const s=vt(e,t,l,n,r);var i,d,u;d=a,Ve(i=s)===Ve(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),N[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:hn(x),tableIds:hn(T),tableCellIds:hn(O),table:hn(S),rowCount:hn(q),rowIds:hn(V),sortedRowIds:hn(N),row:hn(P,Ll),cellIds:hn(L,Ll),cell:hn(R,Rl),invalidCell:hn(E,Rl),values:hn(M),valueIds:hn(z),value:hn($),invalidValue:hn(j),transaction:Pl(A)+hn(F)}),createStore:fn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,V,[mt]],[ee]:[2,P,[mt,bt]],[re]:[2,L,[mt,bt]],[ne]:[3,R,[mt,bt,gt],e=>cn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>cn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?Pe(r,0,e):void 0,l,n)})),ze(At)},yn=({position:e="right",open:t=!1})=>{const l=F(fn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,s=[])=>{let a,i,d,u=0,c=0,h=0,m=0;Hl(tn,s,(()=>0)),Hl(ln,s,(()=>[]));const p=e=>en(void 0,null,(function*(){return 2!=u&&(u=1,c++,yield b.schedule((()=>en(void 0,null,(function*(){yield e(),u=0}))))),b})),b={load:(l,n)=>en(void 0,null,(function*(){return yield p((()=>en(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>en(void 0,[...l],(function*(l={},r={}){return b.stopAutoLoad(),yield b.load(l,r),m=1,d=n(((l,n)=>en(void 0,null,(function*(){if(n){const t=n();yield p((()=>en(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield p((()=>en(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),b})),stopAutoLoad:()=>(m&&(r(d),d=void 0,m=0),b),save:t=>en(void 0,null,(function*(){return 1!=u&&(u=2,h++,yield b.schedule((()=>en(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}u=0}))))),b})),startAutoSave:()=>en(void 0,null,(function*(){return yield b.stopAutoSave().save(),a=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||b.save((()=>[l,n]))})),b})),stopAutoSave:()=>(be(a,e.delListener),b),schedule:(...e)=>en(void 0,null,(function*(){return Le(Dl(ln,s),...e),yield en(void 0,null,(function*(){if(!Dl(tn,s)){for(Wl(tn,s,1);!pe(i=Re(Dl(ln,s)));)try{yield i()}catch(e){null==o||o(e)}Wl(tn,s,0)}})),b})),getStore:()=>e,destroy:()=>b.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return ze(b)})(e,(()=>nn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>nn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return on.addEventListener(rn,n),n}),(e=>on.removeEventListener(rn,e)),n))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),we(Ie,null,we("aside",{id:Qe},we(xt,{s:l}),we(ql,{s:l})),we("style",null,kt))};var In=Object.defineProperty,wn=Object.getOwnPropertySymbols,Cn=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,xn=(e,t,l)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const Tn=e=>we(yn,((e,t)=>{for(var l in t||(t={}))Cn.call(t,l)&&xn(e,l,t[l]);if(wn)for(var l of wn(t))kn.call(t,l)&&xn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,Tn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
|
|
Binary file
|
package/lib/es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as t}from"react";const o=e=>typeof e,r="",n=o(r),d="Result",l="Ids",s="Table",u=s+"s",i=s+l,a="Row",c=a+"Count",I=a+l,p="Sorted"+a+l,v="Cell",b=v+l,g="Value",m=g+"s",y=g+l,C=e=>null==e,w=(e,t,o)=>C(e)?null==o?void 0:o():t(e),k=e=>o(e)==n,f=()=>{},h=(e,t)=>e.map(t),R=Object.keys,{createContext:P,useContext:x}=e,q=P([]),O=(e,t)=>{var o;const r=x(q);return C(e)?r[t]:k(e)?((e,t)=>w(e,(e=>e[t])))(null!=(o=r[t+1])?o:{},e):e},S=(e,t)=>{const o=O(e,t);return C(e)||k(e)?o:e},L=e=>{var t;return R(null!=(t=x(q)[e])?t:{})},j=e=>O(e,0),B=e=>S(e,0),T=e=>O(e,2),M=e=>S(e,2),E=e=>O(e,4),V=e=>S(e,4),A=e=>O(e,6),F=e=>S(e,6),D=e=>O(e,8),Q=e=>S(e,8),z=e=>O(e,10),G=e=>S(e,10),{useCallback:H,useEffect:J,useMemo:K,useRef:N,useState:U}=e,W=(e,t,o=[])=>{const r=K((()=>t(e)),[e,...o]);return J((()=>()=>r.destroy()),[r]),r},X=(e,t,o,r=[],n)=>{const[,d]=U(),l=H((()=>{var n,d;return null!=(d=null==(n=null==t?void 0:t["get"+e])?void 0:n.call(t,...r))?d:o}),[t,...r]),[s]=U(l),u=N(s);return K((()=>u.current=l()),[l]),Y(e,t,((...e)=>{u.current=C(n)?l():e[n],d([])}),[],r),u.current},Y=(e,t,o,r=[],n=[],...d)=>J((()=>{var r;const l=null==(r=null==t?void 0:t["add"+e+"Listener"])?void 0:r.call(t,...n,o,...d);return()=>null==t?void 0:t.delListener(l)}),[t,...n,...r,...d]),Z=(e,t,o,r=[],n=f,d=[],...l)=>{const s=B(e);return H((e=>w(s,(r=>w(o(e,r),(e=>n(r["set"+t](...l,e),e)))))),[s,t,...r,...d,...l])},$=(e,t,o=f,r=[],...n)=>{const d=B(e);return H((()=>o(null==d?void 0:d["del"+t](...n))),[d,t,...r,...n])},_=(e,t,o)=>{const r=G(e);return H((()=>null==r?void 0:r[t](o)),[r,t,o])},ee=(e,t=[])=>K(e,t),te=()=>L(1),oe=e=>X(u,B(e),{}),re=e=>X(i,B(e),[],[]),ne=(e,t)=>X(s,B(t),{},[e]),de=(e,t)=>X(s+b,B(t),[],[e]),le=(e,t)=>X(c,B(t),[],[e]),se=(e,t)=>X(I,B(t),[],[e]),ue=(e,t,o,r=0,n,d)=>X(p,B(d),[],[e,t,o,r,n],6),ie=(e,t,o)=>X(a,B(o),{},[e,t]),ae=(e,t,o)=>X(b,B(o),[],[e,t]),ce=(e,t,o,r)=>X(v,B(r),void 0,[e,t,o],4),Ie=e=>X(m,B(e),{}),pe=e=>X(y,B(e),[],[]),ve=(e,t)=>X(g,B(t),void 0,[e]),be=(e,t,o,r,n)=>Z(o,u,e,t,r,n),ge=(e,t,o,r,n,d)=>Z(r,s,t,o,n,d,e),me=(e,t,o,r,n,d,l)=>Z(n,a,o,r,d,l,e,t),ye=(e,t,o=[],r,n=f,d=[],l=!0)=>{const s=B(r);return H((o=>w(s,(r=>w(t(o,r),(t=>n(r.addRow(e,t,l),r,t)))))),[s,e,...o,...d,l])},Ce=(e,t,o,r,n,d,l)=>Z(n,"PartialRow",o,r,d,l,e,t),we=(e,t,o,r,n,d,l,s)=>Z(d,v,r,n,l,s,e,t,o),ke=(e,t,o,r,n)=>Z(o,m,e,t,r,n),fe=(e,t,o,r,n)=>Z(o,"PartialValues",e,t,r,n),he=(e,t,o,r,n,d)=>Z(r,g,t,o,n,d,e),Re=(e,t,o)=>$(e,u,t,o),Pe=(e,t,o,r)=>$(t,s,o,r,e),xe=(e,t,o,r,n)=>$(o,a,r,n,e,t),qe=(e,t,o,r,n,d,l)=>$(n,v,d,l,e,t,o,r),Oe=(e,t,o)=>$(e,m,t,o),Se=(e,t,o,r)=>$(t,g,o,r,e),Le=(e,t,o,r)=>Y(u,B(r),e,t,[],o),je=(e,t,o,r)=>Y(i,B(r),e,t,[],o),Be=(e,t,o,r,n)=>Y(s,B(n),t,o,[e],r),Te=(e,t,o,r,n)=>Y(s+b,B(n),t,o,[e],r),Me=(e,t,o,r,n)=>Y(c,B(n),t,o,[e],r),Ee=(e,t,o,r,n)=>Y(I,B(n),t,o,[e],r),Ve=(e,t,o,r,n,d,l,s,u)=>Y(p,B(u),d,l,[e,t,o,r,n],s),Ae=(e,t,o,r,n,d)=>Y(a,B(d),o,r,[e,t],n),Fe=(e,t,o,r,n,d)=>Y(b,B(d),o,r,[e,t],n),De=(e,t,o,r,n,d,l)=>Y(v,B(l),r,n,[e,t,o],d),Qe=(e,t,o,r)=>Y(m,B(r),e,t,[],o),ze=(e,t,o,r)=>Y(y,B(r),e,t,[],o),Ge=(e,t,o,r,n)=>Y(g,B(n),t,o,[e],r),He=(e,t,o)=>W(e,t,o),Je=()=>L(3),Ke=e=>X("MetricIds",M(e),[]),Ne=(e,t)=>X("Metric",M(t),void 0,[e]),Ue=(e,t,o,r)=>Y("Metric",M(r),t,o,[e]),We=(e,t,o)=>W(e,t,o),Xe=()=>L(5),Ye=(e,t)=>X("SliceIds",V(t),[],[e]),Ze=e=>X("IndexIds",V(e),[]),$e=(e,t,o)=>X("Slice"+I,V(o),[],[e,t]),_e=(e,t,o,r)=>Y("SliceIds",V(r),t,o,[e]),et=(e,t,o,r,n)=>Y("Slice"+I,V(n),o,r,[e,t]),tt=(e,t,o)=>W(e,t,o),ot=()=>L(7),rt=e=>X("RelationshipIds",F(e),[]),nt=(e,t,o)=>X("RemoteRowId",F(o),void 0,[e,t]),dt=(e,t,o)=>X("Local"+I,F(o),[],[e,t]),lt=(e,t,o)=>X("Linked"+I,F(o),[],[e,t]),st=(e,t,o,r,n)=>Y("RemoteRowId",F(n),o,r,[e,t]),ut=(e,t,o,r,n)=>Y("Local"+I,F(n),o,r,[e,t]),it=(e,t,o,r,n)=>Y("Linked"+I,F(n),o,r,[e,t]),at=(e,t,o)=>W(e,t,o),ct=()=>L(9),It=e=>X("QueryIds",Q(e),[]),pt=(e,t)=>X(d+s,Q(t),{},[e]),vt=(e,t)=>X(d+s+b,Q(t),[],[e]),bt=(e,t)=>X(d+c,Q(t),[],[e]),gt=(e,t)=>X(d+I,Q(t),[],[e]),mt=(e,t,o,r=0,n,l)=>X(d+p,Q(l),[],[e,t,o,r,n],6),yt=(e,t,o)=>X(d+a,Q(o),{},[e,t]),Ct=(e,t,o)=>X(d+b,Q(o),[],[e,t]),wt=(e,t,o,r)=>X(d+v,Q(r),void 0,[e,t,o]),kt=(e,t,o,r)=>Y(d+s,Q(r),t,o,[e]),ft=(e,t,o,r)=>Y(d+s+b,Q(r),t,o,[e]),ht=(e,t,o,r)=>Y(d+c,Q(r),t,o,[e]),Rt=(e,t,o,r)=>Y(d+I,Q(r),t,o,[e]),Pt=(e,t,o,r,n,l,s,u)=>Y(d+p,Q(u),l,s,[e,t,o,r,n]),xt=(e,t,o,r,n)=>Y(d+a,Q(n),o,r,[e,t]),qt=(e,t,o,r,n)=>Y(d+b,Q(n),o,r,[e,t]),Ot=(e,t,o,r,n,l)=>Y(d+v,Q(l),r,n,[e,t,o]),St=(e,t,o)=>W(e,t,o),Lt=()=>L(11),jt=e=>X("CheckpointIds",G(e),[[],void 0,[]]),Bt=(e,t)=>X("Checkpoint",G(t),void 0,[e]),Tt=(e=f,t=[],o,r=f,n=[])=>{const d=G(o);return H((t=>w(d,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[d,...t,...n])},Mt=e=>_(e,"goBackward"),Et=e=>_(e,"goForward"),Vt=(e,t=[],o,r=f,n=[])=>{const d=G(o);return H((t=>w(d,(o=>w(e(t),(e=>r(o.goTo(e),e)))))),[d,...t,...n])},At=e=>{var t;const o=G(e),[n,d]=jt(o);return[(l=n,!(0==(e=>e.length)(l))),Mt(o),d,null!=(t=w(d,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r];var l},Ft=e=>{var t;const o=G(e),[,,[n]]=jt(o);return[!C(n),Et(o),n,null!=(t=w(n,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r]},Dt=(e,t,o)=>Y("CheckpointIds",G(o),e,t),Qt=(e,t,o,r)=>Y("Checkpoint",G(r),t,o,[e]),zt=(e,t,o=[],r,n=[])=>{const[,d]=U(),l=K((()=>t(e)),[e,...o]);return J((()=>{var e;return e=function*(){yield null==r?void 0:r(l),d(1)},new Promise(((t,o)=>{var r=t=>{try{d(e.next(t))}catch(e){o(e)}},n=t=>{try{d(e.throw(t))}catch(e){o(e)}},d=e=>e.done?t(e.value):Promise.resolve(e.value).then(r,n);d((e=e.apply(void 0,null)).next())})),()=>{l.destroy()}}),[l,...n]),l},{PureComponent:Gt,Fragment:Ht,createElement:Jt,useCallback:Kt,useLayoutEffect:Nt,useRef:Ut,useState:Wt}=e,Xt=(e,...t)=>C(e)?{}:e(...t),Yt=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var Zt=Object.defineProperty,$t=Object.defineProperties,_t=Object.getOwnPropertyDescriptors,eo=Object.getOwnPropertySymbols,to=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable,ro=(e,t,o)=>t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,no=(e,t)=>{for(var o in t||(t={}))to.call(t,o)&&ro(e,o,t[o]);if(eo)for(var o of eo(t))oo.call(t,o)&&ro(e,o,t[o]);return e},lo=(e,t)=>$t(e,_t(t)),so=(e,t)=>{var o={};for(var r in e)to.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&eo)for(var r of eo(e))t.indexOf(r)<0&&oo.call(e,r)&&(o[r]=e[r]);return o};const{useMemo:uo}=e,io=({tableId:e,store:t,rowComponent:o=go,getRowComponentProps:r,customCellIds:n,separator:d,debugIds:l},s)=>vo(h(s,(d=>Jt(o,lo(no({},Xt(r,d)),{key:d,tableId:e,rowId:d,customCellIds:n,store:t,debugIds:l})))),d,l,e),ao=({queryId:e,queries:t,resultRowComponent:o=So,getResultRowComponentProps:r,separator:n,debugIds:d},l)=>vo(h(l,(n=>Jt(o,lo(no({},Xt(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:d})))),n,d,e),co=({relationshipId:e,relationships:t,rowComponent:o=go,getRowComponentProps:r,separator:n,debugIds:d},l,s)=>{const[u,i,a]=Yt(F(t),e),c=l(e,s,u);return vo(h(c,(e=>Jt(o,lo(no({},Xt(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:d})))),n,d,s)},Io=e=>({checkpoints:t,checkpointComponent:o=Bo,getCheckpointComponentProps:r,separator:n,debugIds:d})=>{const l=G(t);return vo(h(e(jt(l)),(e=>Jt(o,lo(no({},Xt(r,e)),{key:e,checkpoints:l,checkpointId:e,debugIds:d})))),n)},po=({store:e,storesById:o,metrics:r,metricsById:n,indexes:d,indexesById:l,relationships:s,relationshipsById:u,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const v=t(q);return Jt(q.Provider,{value:uo((()=>[null!=e?e:v[0],no(no({},v[1]),o),null!=r?r:v[2],no(no({},v[3]),n),null!=d?d:v[4],no(no({},v[5]),l),null!=s?s:v[6],no(no({},v[7]),u),null!=i?i:v[8],no(no({},v[9]),a),null!=c?c:v[10],no(no({},v[11]),I)]),[e,o,r,n,d,l,s,u,i,a,c,I,v])},p)},vo=(e,t,o,r)=>{const n=C(t)||!Array.isArray(e)?e:h(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},bo=({tableId:e,rowId:t,cellId:o,store:n,debugIds:d})=>{var l;return vo(r+(null!=(l=ce(e,t,o,n))?l:r),void 0,d,o)},go=({tableId:e,rowId:t,store:o,cellComponent:r=bo,getCellComponentProps:n,customCellIds:d,separator:l,debugIds:s})=>vo(h(((e,t,o,r)=>{const n=ae(t,o,r);return null!=e?e:n})(d,e,t,o),(d=>Jt(r,lo(no({},Xt(n,d)),{key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:s})))),l,s,t),mo=e=>io(e,se(e.tableId,e.store)),yo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=so(t,["cellId","descending","offset","limit"]);return io(l,ue(l.tableId,o,r,n,d,l.store))},Co=({store:e,tableComponent:t=mo,getTableComponentProps:o,separator:r,debugIds:n})=>vo(h(re(e),(r=>Jt(t,lo(no({},Xt(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),wo=({valueId:e,store:t,debugIds:o})=>{var n;return vo(r+(null!=(n=ve(e,t))?n:r),void 0,o,e)},ko=({store:e,valueComponent:t=wo,getValueComponentProps:o,separator:r,debugIds:n})=>vo(h(pe(e),(r=>Jt(t,lo(no({},Xt(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),fo=({metricId:e,metrics:t,debugIds:o})=>{var n;return vo(null!=(n=Ne(e,t))?n:r,void 0,o,e)},ho=({indexId:e,sliceId:t,indexes:o,rowComponent:r=go,getRowComponentProps:n,separator:d,debugIds:l})=>{const[s,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(V(o),e),a=$e(e,t,s);return vo(h(a,(e=>Jt(r,lo(no({},Xt(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:l})))),d,l,t)},Ro=({indexId:e,indexes:t,sliceComponent:o=ho,getSliceComponentProps:r,separator:n,debugIds:d})=>vo(h(Ye(e,t),(n=>Jt(o,lo(no({},Xt(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:d})))),n,d,e),Po=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=go,getRowComponentProps:n,debugIds:d})=>{const[l,s,,u]=Yt(F(o),e),i=nt(e,t,l);return vo(C(u)||C(i)?null:Jt(r,lo(no({},Xt(n,i)),{key:i,tableId:u,rowId:i,store:s,debugIds:d})),void 0,d,t)},xo=e=>co(e,dt,e.remoteRowId),qo=e=>co(e,lt,e.firstRowId),Oo=({queryId:e,rowId:t,cellId:o,queries:n,debugIds:d})=>{var l;return vo(r+(null!=(l=wt(e,t,o,n))?l:r),void 0,d,o)},So=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Oo,getResultCellComponentProps:n,separator:d,debugIds:l})=>vo(h(Ct(e,t,o),(d=>Jt(r,lo(no({},Xt(n,d)),{key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:l})))),d,l,t),Lo=e=>ao(e,gt(e.queryId,e.queries)),jo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=so(t,["cellId","descending","offset","limit"]);return ao(l,mt(l.queryId,o,r,n,d,l.queries))},Bo=({checkpoints:e,checkpointId:t,debugIds:o})=>{var n;return vo(null!=(n=Bt(t,e))?n:r,void 0,o,t)},To=Io((e=>e[0])),Mo=Io((e=>C(e[1])?[]:[e[1]])),Eo=Io((e=>e[2]));export{To as BackwardCheckpointsView,bo as CellView,Bo as CheckpointView,Mo as CurrentCheckpointView,Eo as ForwardCheckpointsView,Ro as IndexView,qo as LinkedRowsView,xo as LocalRowsView,fo as MetricView,po as Provider,Po as RemoteRowView,Oo as ResultCellView,So as ResultRowView,jo as ResultSortedTableView,Lo as ResultTableView,go as RowView,ho as SliceView,yo as SortedTableView,mo as TableView,Co as TablesView,wo as ValueView,ko as ValuesView,ye as useAddRowCallback,ce as useCell,ae as useCellIds,Fe as useCellIdsListener,De as useCellListener,Bt as useCheckpoint,jt as useCheckpointIds,Dt as useCheckpointIdsListener,Qt as useCheckpointListener,z as useCheckpoints,Lt as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,St as useCreateCheckpoints,We as useCreateIndexes,He as useCreateMetrics,zt as useCreatePersister,at as useCreateQueries,tt as useCreateRelationships,ee as useCreateStore,qe as useDelCellCallback,xe as useDelRowCallback,Pe as useDelTableCallback,Re as useDelTablesCallback,Se as useDelValueCallback,Oe as useDelValuesCallback,Mt as useGoBackwardCallback,Et as useGoForwardCallback,Vt as useGoToCallback,Ze as useIndexIds,E as useIndexes,Xe as useIndexesIds,V as useIndexesOrIndexesById,lt as useLinkedRowIds,it as useLinkedRowIdsListener,dt as useLocalRowIds,ut as useLocalRowIdsListener,Ne as useMetric,Ke as useMetricIds,Ue as useMetricListener,T as useMetrics,Je as useMetricsIds,M as useMetricsOrMetricsById,D as useQueries,ct as useQueriesIds,Q as useQueriesOrQueriesById,It as useQueryIds,Ft as useRedoInformation,rt as useRelationshipIds,A as useRelationships,ot as useRelationshipsIds,F as useRelationshipsOrRelationshipsById,nt as useRemoteRowId,st as useRemoteRowIdListener,wt as useResultCell,Ct as useResultCellIds,qt as useResultCellIdsListener,Ot as useResultCellListener,yt as useResultRow,bt as useResultRowCount,ht as useResultRowCountListener,gt as useResultRowIds,Rt as useResultRowIdsListener,xt as useResultRowListener,mt as useResultSortedRowIds,Pt as useResultSortedRowIdsListener,pt as useResultTable,vt as useResultTableCellIds,ft as useResultTableCellIdsListener,kt as useResultTableListener,ie as useRow,le as useRowCount,Me as useRowCountListener,se as useRowIds,Ee as useRowIdsListener,Ae as useRowListener,we as useSetCellCallback,Tt as useSetCheckpointCallback,Ce as useSetPartialRowCallback,fe as useSetPartialValuesCallback,me as useSetRowCallback,ge as useSetTableCallback,be as useSetTablesCallback,he as useSetValueCallback,ke as useSetValuesCallback,Ye as useSliceIds,_e as useSliceIdsListener,$e as useSliceRowIds,et as useSliceRowIdsListener,ue as useSortedRowIds,Ve as useSortedRowIdsListener,j as useStore,te as useStoreIds,B as useStoreOrStoreById,ne as useTable,de as useTableCellIds,Te as useTableCellIdsListener,re as useTableIds,je as useTableIdsListener,Be as useTableListener,oe as useTables,Le as useTablesListener,At as useUndoInformation,ve as useValue,pe as useValueIds,ze as useValueIdsListener,Ge as useValueListener,Ie as useValues,Qe as useValuesListener};
|
|
1
|
+
import e,{useContext as t}from"react";const o=e=>typeof e,r="",n=o(r),d="Listener",l="Result",s="Ids",u="Table",i=u+"s",a=u+s,c="Row",I=c+"Count",p=c+s,v="Sorted"+c+s,b="Cell",g=b+s,m="Value",C=m+"s",y=m+s,w=e=>null==e,k=(e,t,o)=>w(e)?null==o?void 0:o():t(e),h=e=>o(e)==n,f=()=>{},R=(e,t)=>e.map(t),P=Object.keys,{createContext:x,useContext:q}=e,O=x([]),S=(e,t)=>{var o;const r=q(O);return w(e)?r[t]:h(e)?((e,t)=>k(e,(e=>e[t])))(null!=(o=r[t+1])?o:{},e):e},L=(e,t)=>{const o=S(e,t);return w(e)||h(e)?o:e},j=e=>{var t;return P(null!=(t=q(O)[e])?t:{})},B=e=>S(e,0),T=e=>L(e,0),M=e=>S(e,2),E=e=>L(e,2),F=e=>S(e,4),V=e=>L(e,4),A=e=>S(e,6),D=e=>L(e,6),Q=e=>S(e,8),W=e=>L(e,8),z=e=>S(e,10),G=e=>L(e,10),H=e=>e.toLowerCase();H(d);const J="Transaction";H(J);const{useCallback:K,useEffect:N,useMemo:U,useRef:X,useState:Y}=e,Z=(e,t,o=[])=>{const r=U((()=>t(e)),[e,...o]);return N((()=>()=>r.destroy()),[r]),r},$=(e,t,o,r=[],n)=>{const[,d]=Y(),l=K((()=>{var n,d;return null!=(d=null==(n=null==t?void 0:t["get"+e])?void 0:n.call(t,...r))?d:o}),[t,...r]),[s]=Y(l),u=X(s);return U((()=>u.current=l()),[l]),_(e,t,((...e)=>{u.current=w(n)?l():e[n],d([])}),[],r),u.current},_=(e,t,o,r=[],n=[],...l)=>N((()=>{var r;const s=null==(r=null==t?void 0:t["add"+e+d])?void 0:r.call(t,...n,o,...l);return()=>null==t?void 0:t.delListener(s)}),[t,...n,...r,...l]),ee=(e,t,o,r=[],n=f,d=[],...l)=>{const s=T(e);return K((e=>k(s,(r=>k(o(e,r),(e=>n(r["set"+t](...l,e),e)))))),[s,t,...r,...d,...l])},te=(e,t,o=f,r=[],...n)=>{const d=T(e);return K((()=>o(null==d?void 0:d["del"+t](...n))),[d,t,...r,...n])},oe=(e,t,o)=>{const r=G(e);return K((()=>null==r?void 0:r[t](o)),[r,t,o])},re=(e,t=[])=>U(e,t),ne=()=>j(1),de=e=>$(i,T(e),{}),le=e=>$(a,T(e),[],[]),se=(e,t)=>$(u,T(t),{},[e]),ue=(e,t)=>$(u+g,T(t),[],[e]),ie=(e,t)=>$(I,T(t),[],[e]),ae=(e,t)=>$(p,T(t),[],[e]),ce=(e,t,o,r=0,n,d)=>$(v,T(d),[],[e,t,o,r,n],6),Ie=(e,t,o)=>$(c,T(o),{},[e,t]),pe=(e,t,o)=>$(g,T(o),[],[e,t]),ve=(e,t,o,r)=>$(b,T(r),void 0,[e,t,o],4),be=e=>$(C,T(e),{}),ge=e=>$(y,T(e),[],[]),me=(e,t)=>$(m,T(t),void 0,[e]),Ce=(e,t,o,r,n)=>ee(o,i,e,t,r,n),ye=(e,t,o,r,n,d)=>ee(r,u,t,o,n,d,e),we=(e,t,o,r,n,d,l)=>ee(n,c,o,r,d,l,e,t),ke=(e,t,o=[],r,n=f,d=[],l=!0)=>{const s=T(r);return K((o=>k(s,(r=>k(t(o,r),(t=>n(r.addRow(e,t,l),r,t)))))),[s,e,...o,...d,l])},he=(e,t,o,r,n,d,l)=>ee(n,"PartialRow",o,r,d,l,e,t),fe=(e,t,o,r,n,d,l,s)=>ee(d,b,r,n,l,s,e,t,o),Re=(e,t,o,r,n)=>ee(o,C,e,t,r,n),Pe=(e,t,o,r,n)=>ee(o,"PartialValues",e,t,r,n),xe=(e,t,o,r,n,d)=>ee(r,m,t,o,n,d,e),qe=(e,t,o)=>te(e,i,t,o),Oe=(e,t,o,r)=>te(t,u,o,r,e),Se=(e,t,o,r,n)=>te(o,c,r,n,e,t),Le=(e,t,o,r,n,d,l)=>te(n,b,d,l,e,t,o,r),je=(e,t,o)=>te(e,C,t,o),Be=(e,t,o,r)=>te(t,m,o,r,e),Te=(e,t,o,r)=>_(i,T(r),e,t,[],o),Me=(e,t,o,r)=>_(a,T(r),e,t,[],o),Ee=(e,t,o,r,n)=>_(u,T(n),t,o,[e],r),Fe=(e,t,o,r,n)=>_(u+g,T(n),t,o,[e],r),Ve=(e,t,o,r,n)=>_(I,T(n),t,o,[e],r),Ae=(e,t,o,r,n)=>_(p,T(n),t,o,[e],r),De=(e,t,o,r,n,d,l,s,u)=>_(v,T(u),d,l,[e,t,o,r,n],s),Qe=(e,t,o,r,n,d)=>_(c,T(d),o,r,[e,t],n),We=(e,t,o,r,n,d)=>_(g,T(d),o,r,[e,t],n),ze=(e,t,o,r,n,d,l)=>_(b,T(l),r,n,[e,t,o],d),Ge=(e,t,o,r)=>_(C,T(r),e,t,[],o),He=(e,t,o,r)=>_(y,T(r),e,t,[],o),Je=(e,t,o,r,n)=>_(m,T(n),t,o,[e],r),Ke=(e,t,o)=>_("Start"+J,T(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,T(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,T(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>j(3),Ze=e=>$("MetricIds",E(e),[]),$e=(e,t)=>$("Metric",E(t),void 0,[e]),_e=(e,t,o,r)=>_("Metric",E(r),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>j(5),ot=(e,t)=>$("SliceIds",V(t),[],[e]),rt=e=>$("IndexIds",V(e),[]),nt=(e,t,o)=>$("Slice"+p,V(o),[],[e,t]),dt=(e,t,o,r)=>_("SliceIds",V(r),t,o,[e]),lt=(e,t,o,r,n)=>_("Slice"+p,V(n),o,r,[e,t]),st=(e,t,o)=>Z(e,t,o),ut=()=>j(7),it=e=>$("RelationshipIds",D(e),[]),at=(e,t,o)=>$("RemoteRowId",D(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,D(o),[],[e,t]),It=(e,t,o)=>$("Linked"+p,D(o),[],[e,t]),pt=(e,t,o,r,n)=>_("RemoteRowId",D(n),o,r,[e,t]),vt=(e,t,o,r,n)=>_("Local"+p,D(n),o,r,[e,t]),bt=(e,t,o,r,n)=>_("Linked"+p,D(n),o,r,[e,t]),gt=(e,t,o)=>Z(e,t,o),mt=()=>j(9),Ct=e=>$("QueryIds",W(e),[]),yt=(e,t)=>$(l+u,W(t),{},[e]),wt=(e,t)=>$(l+u+g,W(t),[],[e]),kt=(e,t)=>$(l+I,W(t),[],[e]),ht=(e,t)=>$(l+p,W(t),[],[e]),ft=(e,t,o,r=0,n,d)=>$(l+v,W(d),[],[e,t,o,r,n],6),Rt=(e,t,o)=>$(l+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(l+g,W(o),[],[e,t]),xt=(e,t,o,r)=>$(l+b,W(r),void 0,[e,t,o]),qt=(e,t,o,r)=>_(l+u,W(r),t,o,[e]),Ot=(e,t,o,r)=>_(l+u+g,W(r),t,o,[e]),St=(e,t,o,r)=>_(l+I,W(r),t,o,[e]),Lt=(e,t,o,r)=>_(l+p,W(r),t,o,[e]),jt=(e,t,o,r,n,d,s,u)=>_(l+v,W(u),d,s,[e,t,o,r,n]),Bt=(e,t,o,r,n)=>_(l+c,W(n),o,r,[e,t]),Tt=(e,t,o,r,n)=>_(l+g,W(n),o,r,[e,t]),Mt=(e,t,o,r,n,d)=>_(l+b,W(d),r,n,[e,t,o]),Et=(e,t,o)=>Z(e,t,o),Ft=()=>j(11),Vt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),At=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Dt=(e=f,t=[],o,r=f,n=[])=>{const d=G(o);return K((t=>k(d,(o=>{const n=e(t);r(o.addCheckpoint(n),o,n)}))),[d,...t,...n])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,r=f,n=[])=>{const d=G(o);return K((t=>k(d,(o=>k(e(t),(e=>r(o.goTo(e),e)))))),[d,...t,...n])},Gt=e=>{var t;const o=G(e),[n,d]=Vt(o);return[(l=n,!(0==(e=>e.length)(l))),Qt(o),d,null!=(t=k(d,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r];var l},Ht=e=>{var t;const o=G(e),[,,[n]]=Vt(o);return[!w(n),Wt(o),n,null!=(t=k(n,(e=>null==o?void 0:o.getCheckpoint(e))))?t:r]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,r)=>_("Checkpoint",G(r),t,o,[e]),Nt=(e,t,o=[],r,n=[])=>{const[,d]=Y(),l=U((()=>t(e)),[e,...o]);return N((()=>{var e;return e=function*(){yield null==r?void 0:r(l),d(1)},new Promise(((t,o)=>{var r=t=>{try{d(e.next(t))}catch(e){o(e)}},n=t=>{try{d(e.throw(t))}catch(e){o(e)}},d=e=>e.done?t(e.value):Promise.resolve(e.value).then(r,n);d((e=e.apply(void 0,null)).next())})),()=>{l.destroy()}}),[l,...n]),l},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>w(e)?{}:e(...t),oo=(e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)];var ro=Object.defineProperty,no=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,so=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable,ao=(e,t,o)=>t in e?ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,co=(e,t)=>{for(var o in t||(t={}))uo.call(t,o)&&ao(e,o,t[o]);if(so)for(var o of so(t))io.call(t,o)&&ao(e,o,t[o]);return e},Io=(e,t)=>no(e,lo(t)),po=(e,t)=>{var o={};for(var r in e)uo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&so)for(var r of so(e))t.indexOf(r)<0&&io.call(e,r)&&(o[r]=e[r]);return o};const{useMemo:vo}=e,bo=({tableId:e,store:t,rowComponent:o=ho,getRowComponentProps:r,customCellIds:n,separator:d,debugIds:l},s)=>wo(R(s,(d=>Yt(o,Io(co({},to(r,d)),{key:d,tableId:e,rowId:d,customCellIds:n,store:t,debugIds:l})))),d,l,e),go=({queryId:e,queries:t,resultRowComponent:o=Eo,getResultRowComponentProps:r,separator:n,debugIds:d},l)=>wo(R(l,(n=>Yt(o,Io(co({},to(r,n)),{key:n,queryId:e,rowId:n,queries:t,debugIds:d})))),n,d,e),mo=({relationshipId:e,relationships:t,rowComponent:o=ho,getRowComponentProps:r,separator:n,debugIds:d},l,s)=>{const[u,i,a]=oo(D(t),e),c=l(e,s,u);return wo(R(c,(e=>Yt(o,Io(co({},to(r,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:d})))),n,d,s)},Co=e=>({checkpoints:t,checkpointComponent:o=Ao,getCheckpointComponentProps:r,separator:n,debugIds:d})=>{const l=G(t);return wo(R(e(Vt(l)),(e=>Yt(o,Io(co({},to(r,e)),{key:e,checkpoints:l,checkpointId:e,debugIds:d})))),n)},yo=({store:e,storesById:o,metrics:r,metricsById:n,indexes:d,indexesById:l,relationships:s,relationshipsById:u,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const v=t(O);return Yt(O.Provider,{value:vo((()=>[null!=e?e:v[0],co(co({},v[1]),o),null!=r?r:v[2],co(co({},v[3]),n),null!=d?d:v[4],co(co({},v[5]),l),null!=s?s:v[6],co(co({},v[7]),u),null!=i?i:v[8],co(co({},v[9]),a),null!=c?c:v[10],co(co({},v[11]),I)]),[e,o,r,n,d,l,s,u,i,a,c,I,v])},p)},wo=(e,t,o,r)=>{const n=w(t)||!Array.isArray(e)?e:R(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",n,"}"]:n},ko=({tableId:e,rowId:t,cellId:o,store:n,debugIds:d})=>{var l;return wo(r+(null!=(l=ve(e,t,o,n))?l:r),void 0,d,o)},ho=({tableId:e,rowId:t,store:o,cellComponent:r=ko,getCellComponentProps:n,customCellIds:d,separator:l,debugIds:s})=>wo(R(((e,t,o,r)=>{const n=pe(t,o,r);return null!=e?e:n})(d,e,t,o),(d=>Yt(r,Io(co({},to(n,d)),{key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:s})))),l,s,t),fo=e=>bo(e,ae(e.tableId,e.store)),Ro=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=po(t,["cellId","descending","offset","limit"]);return bo(l,ce(l.tableId,o,r,n,d,l.store))},Po=({store:e,tableComponent:t=fo,getTableComponentProps:o,separator:r,debugIds:n})=>wo(R(le(e),(r=>Yt(t,Io(co({},to(o,r)),{key:r,tableId:r,store:e,debugIds:n})))),r),xo=({valueId:e,store:t,debugIds:o})=>{var n;return wo(r+(null!=(n=me(e,t))?n:r),void 0,o,e)},qo=({store:e,valueComponent:t=xo,getValueComponentProps:o,separator:r,debugIds:n})=>wo(R(ge(e),(r=>Yt(t,Io(co({},to(o,r)),{key:r,valueId:r,store:e,debugIds:n})))),r),Oo=({metricId:e,metrics:t,debugIds:o})=>{var n;return wo(null!=(n=$e(e,t))?n:r,void 0,o,e)},So=({indexId:e,sliceId:t,indexes:o,rowComponent:r=ho,getRowComponentProps:n,separator:d,debugIds:l})=>{const[s,u,i]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(V(o),e),a=nt(e,t,s);return wo(R(a,(e=>Yt(r,Io(co({},to(n,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:l})))),d,l,t)},Lo=({indexId:e,indexes:t,sliceComponent:o=So,getSliceComponentProps:r,separator:n,debugIds:d})=>wo(R(ot(e,t),(n=>Yt(o,Io(co({},to(r,n)),{key:n,indexId:e,sliceId:n,indexes:t,debugIds:d})))),n,d,e),jo=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=ho,getRowComponentProps:n,debugIds:d})=>{const[l,s,,u]=oo(D(o),e),i=at(e,t,l);return wo(w(u)||w(i)?null:Yt(r,Io(co({},to(n,i)),{key:i,tableId:u,rowId:i,store:s,debugIds:d})),void 0,d,t)},Bo=e=>mo(e,ct,e.remoteRowId),To=e=>mo(e,It,e.firstRowId),Mo=({queryId:e,rowId:t,cellId:o,queries:n,debugIds:d})=>{var l;return wo(r+(null!=(l=xt(e,t,o,n))?l:r),void 0,d,o)},Eo=({queryId:e,rowId:t,queries:o,resultCellComponent:r=Mo,getResultCellComponentProps:n,separator:d,debugIds:l})=>wo(R(Pt(e,t,o),(d=>Yt(r,Io(co({},to(n,d)),{key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:l})))),d,l,t),Fo=e=>go(e,ht(e.queryId,e.queries)),Vo=e=>{var t=e,{cellId:o,descending:r,offset:n,limit:d}=t,l=po(t,["cellId","descending","offset","limit"]);return go(l,ft(l.queryId,o,r,n,d,l.queries))},Ao=({checkpoints:e,checkpointId:t,debugIds:o})=>{var n;return wo(null!=(n=At(t,e))?n:r,void 0,o,t)},Do=Co((e=>e[0])),Qo=Co((e=>w(e[1])?[]:[e[1]])),Wo=Co((e=>e[2]));export{Do as BackwardCheckpointsView,ko as CellView,Ao as CheckpointView,Qo as CurrentCheckpointView,Wo as ForwardCheckpointsView,Lo as IndexView,To as LinkedRowsView,Bo as LocalRowsView,Oo as MetricView,yo as Provider,jo as RemoteRowView,Mo as ResultCellView,Eo as ResultRowView,Vo as ResultSortedTableView,Fo as ResultTableView,ho as RowView,So as SliceView,Ro as SortedTableView,fo as TableView,Po as TablesView,xo as ValueView,qo as ValuesView,ke as useAddRowCallback,ve as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,At as useCheckpoint,Vt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,Ft as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Et as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,gt as useCreateQueries,st as useCreateRelationships,re as useCreateStore,Le as useDelCellCallback,Se as useDelRowCallback,Oe as useDelTableCallback,qe as useDelTablesCallback,Be as useDelValueCallback,je as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,rt as useIndexIds,F as useIndexes,tt as useIndexesIds,V as useIndexesOrIndexesById,It as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,vt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,M as useMetrics,Ye as useMetricsIds,E as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,Ct as useQueryIds,Ht as useRedoInformation,it as useRelationshipIds,A as useRelationships,ut as useRelationshipsIds,D as useRelationshipsOrRelationshipsById,at as useRemoteRowId,pt as useRemoteRowIdListener,xt as useResultCell,Pt as useResultCellIds,Tt as useResultCellIdsListener,Mt as useResultCellListener,Rt as useResultRow,kt as useResultRowCount,St as useResultRowCountListener,ht as useResultRowIds,Lt as useResultRowIdsListener,Bt as useResultRowListener,ft as useResultSortedRowIds,jt as useResultSortedRowIdsListener,yt as useResultTable,wt as useResultTableCellIds,Ot as useResultTableCellIdsListener,qt as useResultTableListener,Ie as useRow,ie as useRowCount,Ve as useRowCountListener,ae as useRowIds,Ae as useRowIdsListener,Qe as useRowListener,fe as useSetCellCallback,Dt as useSetCheckpointCallback,he as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,we as useSetRowCallback,ye as useSetTableCallback,Ce as useSetTablesCallback,xe as useSetValueCallback,Re as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,nt as useSliceRowIds,lt as useSliceRowIdsListener,ce as useSortedRowIds,De as useSortedRowIdsListener,Ke as useStartTransactionListener,B as useStore,ne as useStoreIds,T as useStoreOrStoreById,se as useTable,ue as useTableCellIds,Fe as useTableCellIdsListener,le as useTableIds,Me as useTableIdsListener,Ee as useTableListener,de as useTables,Te as useTablesListener,Gt as useUndoInformation,me as useValue,ge as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
|
package/lib/es6/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/types/store.d.ts
CHANGED
|
@@ -5619,6 +5619,8 @@ export interface Store {
|
|
|
5619
5619
|
* Note that a TransactionListener added to the Store with this method can
|
|
5620
5620
|
* mutate the Store, and its changes will be treated as part of the
|
|
5621
5621
|
* transaction that is starting.
|
|
5622
|
+
* @param listener The function that will be called at the start of a
|
|
5623
|
+
* transaction.
|
|
5622
5624
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
5623
5625
|
* @example
|
|
5624
5626
|
* This example registers a listener that is called at start end of the
|
|
@@ -5675,6 +5677,8 @@ export interface Store {
|
|
|
5675
5677
|
* mutate the Store itself, and its changes will be treated as part of the
|
|
5676
5678
|
* transaction that is starting (and may fire non-mutating listeners after
|
|
5677
5679
|
* this).
|
|
5680
|
+
* @param listener The function that will be called before the end of a
|
|
5681
|
+
* transaction.
|
|
5678
5682
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
5679
5683
|
* @example
|
|
5680
5684
|
* This example registers a listener that is called at the end of the
|
|
@@ -5771,6 +5775,8 @@ export interface Store {
|
|
|
5771
5775
|
*
|
|
5772
5776
|
* Note that a TransactionListener added to the Store with this method
|
|
5773
5777
|
* _cannot_ mutate the Store itself, and attempts to do so will fail silently.
|
|
5778
|
+
* @param listener The function that will be called after the end of a
|
|
5779
|
+
* transaction.
|
|
5774
5780
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
5775
5781
|
* @example
|
|
5776
5782
|
* This example registers a listener that is called at the end of the
|
package/lib/types/ui-react.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
TableListener,
|
|
43
43
|
Tables,
|
|
44
44
|
TablesListener,
|
|
45
|
+
TransactionListener,
|
|
45
46
|
Value,
|
|
46
47
|
ValueIdsListener,
|
|
47
48
|
ValueListener,
|
|
@@ -3621,6 +3622,180 @@ export function useValueListener(
|
|
|
3621
3622
|
storeOrStoreId?: StoreOrStoreId,
|
|
3622
3623
|
): void;
|
|
3623
3624
|
|
|
3625
|
+
/**
|
|
3626
|
+
* The useStartTransactionListener hook registers a listener function with the
|
|
3627
|
+
* Store that will be called at the start of a transaction.
|
|
3628
|
+
*
|
|
3629
|
+
* Unlike the addStartTransactionListener method, which returns a listener Id
|
|
3630
|
+
* and requires you to remove it manually, the useStartTransactionListener hook
|
|
3631
|
+
* manages this lifecycle for you: when the listener changes (per its
|
|
3632
|
+
* `listenerDeps` dependencies) or the component unmounts, the listener on the
|
|
3633
|
+
* underlying Store will be deleted.
|
|
3634
|
+
* @param listener The function that will be called at the start of a
|
|
3635
|
+
* transaction.
|
|
3636
|
+
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
3637
|
+
* function, which, if any change, result in the re-registration of the
|
|
3638
|
+
* listener. This parameter defaults to an empty array.
|
|
3639
|
+
* @param storeOrStoreId The Store to register the listener with: omit for the
|
|
3640
|
+
* default context Store, provide an Id for a named context Store, or provide an
|
|
3641
|
+
* explicit reference.
|
|
3642
|
+
* @example
|
|
3643
|
+
* This example uses the useStartTransactionListener hook to create a listener
|
|
3644
|
+
* that is scoped to a single component. When the component is unmounted, the
|
|
3645
|
+
* listener is removed from the Store.
|
|
3646
|
+
*
|
|
3647
|
+
* ```jsx
|
|
3648
|
+
* const App = ({store}) => (
|
|
3649
|
+
* <Provider store={store}>
|
|
3650
|
+
* <Pane />
|
|
3651
|
+
* </Provider>
|
|
3652
|
+
* );
|
|
3653
|
+
* const Pane = () => {
|
|
3654
|
+
* useStartTransactionListener(() => console.log('Start transaction'));
|
|
3655
|
+
* return <span>App</span>;
|
|
3656
|
+
* };
|
|
3657
|
+
*
|
|
3658
|
+
* const store = createStore();
|
|
3659
|
+
* const app = document.createElement('div');
|
|
3660
|
+
* const root = ReactDOMClient.createRoot(app);
|
|
3661
|
+
* root.render(<App store={store} />); // !act
|
|
3662
|
+
* console.log(store.getListenerStats().transaction);
|
|
3663
|
+
* // -> 1
|
|
3664
|
+
*
|
|
3665
|
+
* store.setValue('open', false); // !act
|
|
3666
|
+
* // -> 'Start transaction'
|
|
3667
|
+
*
|
|
3668
|
+
* root.unmount(); // !act
|
|
3669
|
+
* console.log(store.getListenerStats().transaction);
|
|
3670
|
+
* // -> 0
|
|
3671
|
+
* ```
|
|
3672
|
+
* @category Store hooks
|
|
3673
|
+
* @since v4.2.2
|
|
3674
|
+
*/
|
|
3675
|
+
export function useStartTransactionListener(
|
|
3676
|
+
listener: TransactionListener,
|
|
3677
|
+
listenerDeps?: React.DependencyList,
|
|
3678
|
+
storeOrStoreId?: StoreOrStoreId,
|
|
3679
|
+
): void;
|
|
3680
|
+
|
|
3681
|
+
/**
|
|
3682
|
+
* The useWillFinishTransactionListener hook registers a listener function with
|
|
3683
|
+
* a Store that will be called just before other non-mutating listeners are
|
|
3684
|
+
* called at the end of the transaction.
|
|
3685
|
+
*
|
|
3686
|
+
* Unlike the addWillFinisTransactionListener method, which returns a listener
|
|
3687
|
+
* Id and requires you to remove it manually, the
|
|
3688
|
+
* useWillFinishTransactionListener hook manages this lifecycle for you: when
|
|
3689
|
+
* the listener changes (per its `listenerDeps` dependencies) or the component
|
|
3690
|
+
* unmounts, the listener on the underlying Store will be deleted.
|
|
3691
|
+
* @param listener The function that will be called before the end of a
|
|
3692
|
+
* transaction.
|
|
3693
|
+
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
3694
|
+
* function, which, if any change, result in the re-registration of the
|
|
3695
|
+
* listener. This parameter defaults to an empty array.
|
|
3696
|
+
* @param storeOrStoreId The Store to register the listener with: omit for the
|
|
3697
|
+
* default context Store, provide an Id for a named context Store, or provide an
|
|
3698
|
+
* explicit reference.
|
|
3699
|
+
* @example
|
|
3700
|
+
* This example uses the useWillFinishTransactionListener hook to create a
|
|
3701
|
+
* listener that is scoped to a single component. When the component is
|
|
3702
|
+
* unmounted, the listener is removed from the Store.
|
|
3703
|
+
*
|
|
3704
|
+
* ```jsx
|
|
3705
|
+
* const App = ({store}) => (
|
|
3706
|
+
* <Provider store={store}>
|
|
3707
|
+
* <Pane />
|
|
3708
|
+
* </Provider>
|
|
3709
|
+
* );
|
|
3710
|
+
* const Pane = () => {
|
|
3711
|
+
* useWillFinishTransactionListener(
|
|
3712
|
+
* () => console.log('Will finish transaction'),
|
|
3713
|
+
* );
|
|
3714
|
+
* return <span>App</span>;
|
|
3715
|
+
* };
|
|
3716
|
+
*
|
|
3717
|
+
* const store = createStore();
|
|
3718
|
+
* const app = document.createElement('div');
|
|
3719
|
+
* const root = ReactDOMClient.createRoot(app);
|
|
3720
|
+
* root.render(<App store={store} />); // !act
|
|
3721
|
+
* console.log(store.getListenerStats().transaction);
|
|
3722
|
+
* // -> 1
|
|
3723
|
+
*
|
|
3724
|
+
* store.setValue('open', false); // !act
|
|
3725
|
+
* // -> 'Will finish transaction'
|
|
3726
|
+
*
|
|
3727
|
+
* root.unmount(); // !act
|
|
3728
|
+
* console.log(store.getListenerStats().transaction);
|
|
3729
|
+
* // -> 0
|
|
3730
|
+
* ```
|
|
3731
|
+
* @category Store hooks
|
|
3732
|
+
* @since v4.2.2
|
|
3733
|
+
*/
|
|
3734
|
+
export function useWillFinishTransactionListener(
|
|
3735
|
+
listener: TransactionListener,
|
|
3736
|
+
listenerDeps?: React.DependencyList,
|
|
3737
|
+
storeOrStoreId?: StoreOrStoreId,
|
|
3738
|
+
): void;
|
|
3739
|
+
|
|
3740
|
+
/**
|
|
3741
|
+
* The useDidFinishTransactionListener hook registers a listener function with a
|
|
3742
|
+
* Store that will be called just after other non-mutating listeners are called
|
|
3743
|
+
* at the end of the transaction.
|
|
3744
|
+
*
|
|
3745
|
+
* Unlike the addDidFinishTransactionListener method, which returns a listener
|
|
3746
|
+
* Id and requires you to remove it manually, the
|
|
3747
|
+
* useDidFinishTransactionListener hook manages this lifecycle for you: when the
|
|
3748
|
+
* listener changes (per its `listenerDeps` dependencies) or the component
|
|
3749
|
+
* unmounts, the listener on the underlying Store will be deleted.
|
|
3750
|
+
* @param listener The function that will be called after the end of a
|
|
3751
|
+
* transaction.
|
|
3752
|
+
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
3753
|
+
* function, which, if any change, result in the re-registration of the
|
|
3754
|
+
* listener. This parameter defaults to an empty array.
|
|
3755
|
+
* @param storeOrStoreId The Store to register the listener with: omit for the
|
|
3756
|
+
* default context Store, provide an Id for a named context Store, or provide an
|
|
3757
|
+
* explicit reference.
|
|
3758
|
+
* @example
|
|
3759
|
+
* This example uses the useDidFinishTransactionListener hook to create a
|
|
3760
|
+
* listener that is scoped to a single component. When the component is
|
|
3761
|
+
* unmounted, the listener is removed from the Store.
|
|
3762
|
+
*
|
|
3763
|
+
* ```jsx
|
|
3764
|
+
* const App = ({store}) => (
|
|
3765
|
+
* <Provider store={store}>
|
|
3766
|
+
* <Pane />
|
|
3767
|
+
* </Provider>
|
|
3768
|
+
* );
|
|
3769
|
+
* const Pane = () => {
|
|
3770
|
+
* useDidFinishTransactionListener(
|
|
3771
|
+
* () => console.log('Did finish transaction'),
|
|
3772
|
+
* );
|
|
3773
|
+
* return <span>App</span>;
|
|
3774
|
+
* };
|
|
3775
|
+
*
|
|
3776
|
+
* const store = createStore();
|
|
3777
|
+
* const app = document.createElement('div');
|
|
3778
|
+
* const root = ReactDOMClient.createRoot(app);
|
|
3779
|
+
* root.render(<App store={store} />); // !act
|
|
3780
|
+
* console.log(store.getListenerStats().transaction);
|
|
3781
|
+
* // -> 1
|
|
3782
|
+
*
|
|
3783
|
+
* store.setValue('open', false); // !act
|
|
3784
|
+
* // -> 'Did finish transaction'
|
|
3785
|
+
*
|
|
3786
|
+
* root.unmount(); // !act
|
|
3787
|
+
* console.log(store.getListenerStats().transaction);
|
|
3788
|
+
* // -> 0
|
|
3789
|
+
* ```
|
|
3790
|
+
* @category Store hooks
|
|
3791
|
+
* @since v4.2.2
|
|
3792
|
+
*/
|
|
3793
|
+
export function useDidFinishTransactionListener(
|
|
3794
|
+
listener: TransactionListener,
|
|
3795
|
+
listenerDeps?: React.DependencyList,
|
|
3796
|
+
storeOrStoreId?: StoreOrStoreId,
|
|
3797
|
+
): void;
|
|
3798
|
+
|
|
3624
3799
|
/**
|
|
3625
3800
|
* The useCreateMetrics hook is used to create a Metrics object within a React
|
|
3626
3801
|
* application with convenient memoization.
|
|
@@ -6949,6 +6949,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6949
6949
|
* Note that a TransactionListener added to the Store with this method can
|
|
6950
6950
|
* mutate the Store, and its changes will be treated as part of the
|
|
6951
6951
|
* transaction that is starting.
|
|
6952
|
+
* @param listener The function that will be called at the start of a
|
|
6953
|
+
* transaction.
|
|
6952
6954
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
6953
6955
|
* @example
|
|
6954
6956
|
* This example registers a listener that is called at start end of the
|
|
@@ -7011,6 +7013,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7011
7013
|
* mutate the Store itself, and its changes will be treated as part of the
|
|
7012
7014
|
* transaction that is starting (and may fire non-mutating listeners after
|
|
7013
7015
|
* this).
|
|
7016
|
+
* @param listener The function that will be called before the end of a
|
|
7017
|
+
* transaction.
|
|
7014
7018
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
7015
7019
|
* @example
|
|
7016
7020
|
* This example registers a listener that is called at the end of the
|
|
@@ -7113,6 +7117,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7113
7117
|
*
|
|
7114
7118
|
* Note that a TransactionListener added to the Store with this method
|
|
7115
7119
|
* _cannot_ mutate the Store itself, and attempts to do so will fail silently.
|
|
7120
|
+
* @param listener The function that will be called after the end of a
|
|
7121
|
+
* transaction.
|
|
7116
7122
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
7117
7123
|
* @example
|
|
7118
7124
|
* This example registers a listener that is called at the end of the
|