tinybase 4.2.1 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.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.js +37 -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.js +1 -1
- package/lib/umd/ui-react.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 +7 -7
- package/readme.md +1 -1
package/lib/cjs/ui-react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Result",u="Ids",d="Table",l=d+"s",p=d+u,n="Row",i=n+"Count",a=n+u,I="Sorted"+n+u,x="Cell",c=x+u,C="Value",w=C+"s",b=C+u,R=e=>null==e,k=(e,s,t)=>R(e)?t?.():s(e),g=e=>s(e)==o,m=()=>{},h=(e,s)=>e.map(s),L=Object.keys,{createContext:y,useContext:V}=e,S=y([]),T=(e,s)=>{const t=V(S);return R(e)?t[s]:g(e)?((e,s)=>k(e,(e=>e[s])))(t[s+1]??{},e):e},v=(e,s)=>{const t=T(e,s);return R(e)||g(e)?t:e},P=e=>L(V(S)[e]??{}),q=e=>v(e,0),B=e=>v(e,2),f=e=>v(e,4),M=e=>v(e,6),O=e=>v(e,8),Q=e=>v(e,10),{useCallback:D,useEffect:F,useMemo:A,useRef:E,useState:G}=e,j=(e,s,t=[])=>{const o=A((()=>s(e)),[e,...t]);return F((()=>()=>o.destroy()),[o]),o},U=(e,s,t,o=[],r)=>{const[,u]=G(),d=D((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=G(d),p=E(l);return A((()=>p.current=d()),[d]),z(e,s,((...e)=>{p.current=R(r)?d():e[r],u([])}),[],o),p.current},z=(e,s,t,o=[],r=[],...u)=>F((()=>{const o=s?.["add"+e+"Listener"]?.(...r,t,...u);return()=>s?.delListener(o)}),[s,...r,...o,...u]),H=(e,s,t,o=[],r=m,u=[],...d)=>{const l=q(e);return D((e=>k(l,(o=>k(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},J=(e,s,t=m,o=[],...r)=>{const u=q(e);return D((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},K=(e,s,t)=>{const o=Q(e);return D((()=>o?.[s](t)),[o,s,t])},N=e=>U(p,q(e),[],[]),W=(e,s)=>U(a,q(s),[],[e]),X=(e,s,t,o=0,r,u)=>U(I,q(u),[],[e,s,t,o,r],6),Y=(e,s,t)=>U(c,q(t),[],[e,s]),Z=(e,s,t,o)=>U(x,q(o),void 0,[e,s,t],4),$=e=>U(b,q(e),[],[]),_=(e,s)=>U(C,q(s),void 0,[e]),ee=(e,s)=>U("Metric",B(s),void 0,[e]),se=(e,s)=>U("SliceIds",f(s),[],[e]),te=(e,s,t)=>U("Slice"+a,f(t),[],[e,s]),oe=(e,s,t)=>U("RemoteRowId",M(t),void 0,[e,s]),re=(e,s,t)=>U("Local"+a,M(t),[],[e,s]),ue=(e,s,t)=>U("Linked"+a,M(t),[],[e,s]),de=(e,s)=>U(r+a,O(s),[],[e]),le=(e,s,t,o=0,u,d)=>U(r+I,O(d),[],[e,s,t,o,u],6),pe=(e,s,t)=>U(r+c,O(t),[],[e,s]),ne=(e,s,t,o)=>U(r+x,O(o),void 0,[e,s,t]),ie=e=>U("CheckpointIds",Q(e),[[],void 0,[]]),ae=(e,s)=>U("Checkpoint",Q(s),void 0,[e]),Ie=e=>K(e,"goBackward"),xe=e=>K(e,"goForward"),{PureComponent:ce,Fragment:Ce,createElement:we,useCallback:be,useLayoutEffect:Re,useRef:ke,useState:ge}=e,me=(e,...s)=>R(e)?{}:e(...s),he=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Le}=e,ye=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>ve(h(l,(u=>we(t,{...me(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),Ve=({queryId:e,queries:s,resultRowComponent:t=Qe,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>ve(h(d,(r=>we(t,{...me(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Se=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[p,n,i]=he(M(s),e),a=d(e,l,p);return ve(h(a,(e=>we(t,{...me(o,e),key:e,tableId:i,rowId:e,store:n,debugIds:u}))),r,u,l)},Te=e=>({checkpoints:s,checkpointComponent:t=De,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return ve(h(e(ie(d)),(e=>we(t,{...me(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},ve=(e,s,t,o)=>{const r=R(s)||!Array.isArray(e)?e:h(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Pe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>ve(t+(Z(e,s,o,r)??t),void 0,u,o),qe=({tableId:e,rowId:s,store:t,cellComponent:o=Pe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>ve(h(((e,s,t,o)=>{const r=Y(s,t,o);return e??r})(u,e,s,t),(u=>we(o,{...me(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Be=e=>ye(e,W(e.tableId,e.store)),fe=({valueId:e,store:s,debugIds:o})=>ve(t+(_(e,s)??t),void 0,o,e),Me=({indexId:e,sliceId:s,indexes:t,rowComponent:o=qe,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,p,n]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(f(t),e),i=te(e,s,l);return ve(h(i,(e=>we(o,{...me(r,e),key:e,tableId:n,rowId:e,store:p,debugIds:d}))),u,d,s)},Oe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>ve(t+(ne(e,s,o,r)??t),void 0,u,o),Qe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Oe,getResultCellComponentProps:r,separator:u,debugIds:d})=>ve(h(pe(e,s,t),(u=>we(o,{...me(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),De=({checkpoints:e,checkpointId:s,debugIds:o})=>ve(ae(s,e)??t,void 0,o,s),Fe=Te((e=>e[0])),Ae=Te((e=>R(e[1])?[]:[e[1]])),Ee=Te((e=>e[2]));exports.BackwardCheckpointsView=Fe,exports.CellView=Pe,exports.CheckpointView=De,exports.CurrentCheckpointView=Ae,exports.ForwardCheckpointsView=Ee,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Me,getSliceComponentProps:o,separator:r,debugIds:u})=>ve(h(se(e,s),(r=>we(t,{...me(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Se(e,ue,e.firstRowId),exports.LocalRowsView=e=>Se(e,re,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>ve(ee(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:p,queries:n,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(S);return we(S.Provider,{value:Le((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...p},n??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,p,n,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=qe,getRowComponentProps:r,debugIds:u})=>{const[d,l,,p]=he(M(t),e),n=oe(e,s,d);return ve(R(p)||R(n)?null:we(o,{...me(r,n),key:n,tableId:p,rowId:n,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Oe,exports.ResultRowView=Qe,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Ve(r,le(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>Ve(e,de(e.queryId,e.queries)),exports.RowView=qe,exports.SliceView=Me,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ye(r,X(r.tableId,e,s,t,o,r.store)),exports.TableView=Be,exports.TablesView=({store:e,tableComponent:s=Be,getTableComponentProps:t,separator:o,debugIds:r})=>ve(h(N(e),(o=>we(s,{...me(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=fe,exports.ValuesView=({store:e,valueComponent:s=fe,getValueComponentProps:t,separator:o,debugIds:r})=>ve(h($(e),(o=>we(s,{...me(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=m,u=[],d=!0)=>{const l=q(o);return D((t=>k(l,(o=>k(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=Z,exports.useCellIds=Y,exports.useCellIdsListener=(e,s,t,o,r,u)=>z(c,q(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>z(x,q(d),o,r,[e,s,t],u),exports.useCheckpoint=ae,exports.useCheckpointIds=ie,exports.useCheckpointIdsListener=(e,s,t)=>z("CheckpointIds",Q(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>z("Checkpoint",Q(o),s,t,[e]),exports.useCheckpoints=e=>T(e,10),exports.useCheckpointsIds=()=>P(11),exports.useCheckpointsOrCheckpointsById=Q,exports.useCreateCheckpoints=(e,s,t)=>j(e,s,t),exports.useCreateIndexes=(e,s,t)=>j(e,s,t),exports.useCreateMetrics=(e,s,t)=>j(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=G(),d=A((()=>s(e)),[e,...t]);return F((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d.destroy()})),[d,...r]),d},exports.useCreateQueries=(e,s,t)=>j(e,s,t),exports.useCreateRelationships=(e,s,t)=>j(e,s,t),exports.useCreateStore=(e,s=[])=>A(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>J(r,x,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>J(t,n,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>J(s,d,t,o,e),exports.useDelTablesCallback=(e,s,t)=>J(e,l,s,t),exports.useDelValueCallback=(e,s,t,o)=>J(s,C,t,o,e),exports.useDelValuesCallback=(e,s,t)=>J(e,w,s,t),exports.useGoBackwardCallback=Ie,exports.useGoForwardCallback=xe,exports.useGoToCallback=(e,s=[],t,o=m,r=[])=>{const u=Q(t);return D((s=>k(u,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>U("IndexIds",f(e),[]),exports.useIndexes=e=>T(e,4),exports.useIndexesIds=()=>P(5),exports.useIndexesOrIndexesById=f,exports.useLinkedRowIds=ue,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>z("Linked"+a,M(r),t,o,[e,s]),exports.useLocalRowIds=re,exports.useLocalRowIdsListener=(e,s,t,o,r)=>z("Local"+a,M(r),t,o,[e,s]),exports.useMetric=ee,exports.useMetricIds=e=>U("MetricIds",B(e),[]),exports.useMetricListener=(e,s,t,o)=>z("Metric",B(o),s,t,[e]),exports.useMetrics=e=>T(e,2),exports.useMetricsIds=()=>P(3),exports.useMetricsOrMetricsById=B,exports.useQueries=e=>T(e,8),exports.useQueriesIds=()=>P(9),exports.useQueriesOrQueriesById=O,exports.useQueryIds=e=>U("QueryIds",O(e),[]),exports.useRedoInformation=e=>{const s=Q(e),[,,[o]]=ie(s);return[!R(o),xe(s),o,k(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>U("RelationshipIds",M(e),[]),exports.useRelationships=e=>T(e,6),exports.useRelationshipsIds=()=>P(7),exports.useRelationshipsOrRelationshipsById=M,exports.useRemoteRowId=oe,exports.useRemoteRowIdListener=(e,s,t,o,r)=>z("RemoteRowId",M(r),t,o,[e,s]),exports.useResultCell=ne,exports.useResultCellIds=pe,exports.useResultCellIdsListener=(e,s,t,o,u)=>z(r+c,O(u),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,u,d)=>z(r+x,O(d),o,u,[e,s,t]),exports.useResultRow=(e,s,t)=>U(r+n,O(t),{},[e,s]),exports.useResultRowCount=(e,s)=>U(r+i,O(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>z(r+i,O(o),s,t,[e]),exports.useResultRowIds=de,exports.useResultRowIdsListener=(e,s,t,o)=>z(r+a,O(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,u)=>z(r+n,O(u),t,o,[e,s]),exports.useResultSortedRowIds=le,exports.useResultSortedRowIdsListener=(e,s,t,o,u,d,l,p)=>z(r+I,O(p),d,l,[e,s,t,o,u]),exports.useResultTable=(e,s)=>U(r+d,O(s),{},[e]),exports.useResultTableCellIds=(e,s)=>U(r+d+c,O(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>z(r+d+c,O(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>z(r+d,O(o),s,t,[e]),exports.useRow=(e,s,t)=>U(n,q(t),{},[e,s]),exports.useRowCount=(e,s)=>U(i,q(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>z(i,q(r),s,t,[e],o),exports.useRowIds=W,exports.useRowIdsListener=(e,s,t,o,r)=>z(a,q(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>z(n,q(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>H(u,x,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=m,s=[],t,o=m,r=[])=>{const u=Q(t);return D((s=>k(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>H(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>H(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>H(r,n,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>H(o,d,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>H(t,l,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>H(o,C,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>H(t,w,e,s,o,r),exports.useSliceIds=se,exports.useSliceIdsListener=(e,s,t,o)=>z("SliceIds",f(o),s,t,[e]),exports.useSliceRowIds=te,exports.useSliceRowIdsListener=(e,s,t,o,r)=>z("Slice"+a,f(r),t,o,[e,s]),exports.useSortedRowIds=X,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,p)=>z(I,q(p),u,d,[e,s,t,o,r],l),exports.useStore=e=>T(e,0),exports.useStoreIds=()=>P(1),exports.useStoreOrStoreById=q,exports.useTable=(e,s)=>U(d,q(s),{},[e]),exports.useTableCellIds=(e,s)=>U(d+c,q(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>z(d+c,q(r),s,t,[e],o),exports.useTableIds=N,exports.useTableIdsListener=(e,s,t,o)=>z(p,q(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>z(d,q(r),s,t,[e],o),exports.useTables=e=>U(l,q(e),{}),exports.useTablesListener=(e,s,t,o)=>z(l,q(o),e,s,[],t),exports.useUndoInformation=e=>{const s=Q(e),[o,r]=ie(s);return[(u=o,!(0==(e=>e.length)(u))),Ie(s),r,k(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=_,exports.useValueIds=$,exports.useValueIdsListener=(e,s,t,o)=>z(b,q(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>z(C,q(r),s,t,[e],o),exports.useValues=e=>U(w,q(e),{}),exports.useValuesListener=(e,s,t,o)=>z(w,q(o),e,s,[],t);
|
|
1
|
+
"use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Listener",u="Result",d="Ids",l="Table",n=l+"s",p=l+d,i="Row",a=i+"Count",I=i+d,x="Sorted"+i+d,c="Cell",C=c+d,w="Value",b=w+"s",R=w+d,k=e=>null==e,g=(e,s,t)=>k(e)?t?.():s(e),h=e=>s(e)==o,L=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:S,useContext:V}=e,T=S([]),v=(e,s)=>{const t=V(T);return k(e)?t[s]:h(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return k(e)||h(e)?t:e},q=e=>y(V(T)[e]??{}),B=e=>P(e,0),f=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),F=e=>P(e,8),O=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const A="Transaction";Q(A);const{useCallback:E,useEffect:G,useMemo:W,useRef:j,useState:U}=e,z=(e,s,t=[])=>{const o=W((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,u]=U(),d=E((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=U(d),n=j(l);return W((()=>n.current=d()),[d]),J(e,s,((...e)=>{n.current=k(r)?d():e[r],u([])}),[],o),n.current},J=(e,s,t,o=[],u=[],...d)=>G((()=>{const o=s?.["add"+e+r]?.(...u,t,...d);return()=>s?.delListener(o)}),[s,...u,...o,...d]),K=(e,s,t,o=[],r=L,u=[],...d)=>{const l=B(e);return E((e=>g(l,(o=>g(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},N=(e,s,t=L,o=[],...r)=>{const u=B(e);return E((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},X=(e,s,t)=>{const o=O(e);return E((()=>o?.[s](t)),[o,s,t])},Y=e=>H(p,B(e),[],[]),Z=(e,s)=>H(I,B(s),[],[e]),$=(e,s,t,o=0,r,u)=>H(x,B(u),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,B(t),[],[e,s]),ee=(e,s,t,o)=>H(c,B(o),void 0,[e,s,t],4),se=e=>H(R,B(e),[],[]),te=(e,s)=>H(w,B(s),void 0,[e]),oe=(e,s)=>H("Metric",f(s),void 0,[e]),re=(e,s)=>H("SliceIds",M(s),[],[e]),ue=(e,s,t)=>H("Slice"+I,M(t),[],[e,s]),de=(e,s,t)=>H("RemoteRowId",D(t),void 0,[e,s]),le=(e,s,t)=>H("Local"+I,D(t),[],[e,s]),ne=(e,s,t)=>H("Linked"+I,D(t),[],[e,s]),pe=(e,s)=>H(u+I,F(s),[],[e]),ie=(e,s,t,o=0,r,d)=>H(u+x,F(d),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(u+C,F(t),[],[e,s]),Ie=(e,s,t,o)=>H(u+c,F(o),void 0,[e,s,t]),xe=e=>H("CheckpointIds",O(e),[[],void 0,[]]),ce=(e,s)=>H("Checkpoint",O(s),void 0,[e]),Ce=e=>X(e,"goBackward"),we=e=>X(e,"goForward"),{PureComponent:be,Fragment:Re,createElement:ke,useCallback:ge,useLayoutEffect:he,useRef:Le,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Se=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Ve}=e,Te=({tableId:e,store:s,rowComponent:t=Me,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(m(l,(u=>ke(t,{...ye(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ae,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(m(d,(r=>ke(t,{...ye(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=Me,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,p,i]=Se(D(s),e),a=d(e,l,n);return Be(m(a,(e=>ke(t,{...ye(o,e),key:e,tableId:i,rowId:e,store:p,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ee,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=O(s);return Be(m(e(xe(d)),(e=>ke(t,{...ye(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},fe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:u})=>Be(t+(ee(e,s,o,r)??t),void 0,u,o),Me=({tableId:e,rowId:s,store:t,cellComponent:o=fe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(m(((e,s,t,o)=>{const r=_(s,t,o);return e??r})(u,e,s,t),(u=>ke(o,{...ye(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),De=e=>Te(e,Z(e.tableId,e.store)),Fe=({valueId:e,store:s,debugIds:o})=>Be(t+(te(e,s)??t),void 0,o,e),Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Me,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,p]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(M(t),e),i=ue(e,s,l);return Be(m(i,(e=>ke(o,{...ye(r,e),key:e,tableId:p,rowId:e,store:n,debugIds:d}))),u,d,s)},Qe=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:u})=>Be(t+(Ie(e,s,o,r)??t),void 0,u,o),Ae=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Qe,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(m(ae(e,s,t),(u=>ke(o,{...ye(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ee=({checkpoints:e,checkpointId:s,debugIds:o})=>Be(ce(s,e)??t,void 0,o,s),Ge=qe((e=>e[0])),We=qe((e=>k(e[1])?[]:[e[1]])),je=qe((e=>e[2]));exports.BackwardCheckpointsView=Ge,exports.CellView=fe,exports.CheckpointView=Ee,exports.CurrentCheckpointView=We,exports.ForwardCheckpointsView=je,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(m(re(e,s),(r=>ke(t,{...ye(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),exports.LinkedRowsView=e=>Pe(e,ne,e.firstRowId),exports.LocalRowsView=e=>Pe(e,le,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>Be(oe(e,s)??t,void 0,o,e),exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:p,queriesById:i,checkpoints:a,checkpointsById:I,children:x})=>{const c=e.useContext(T);return ke(T.Provider,{value:Ve((()=>[s??c[0],{...c[1],...t},o??c[2],{...c[3],...r},u??c[4],{...c[5],...d},l??c[6],{...c[7],...n},p??c[8],{...c[9],...i},a??c[10],{...c[11],...I}]),[s,t,o,r,u,d,l,n,p,i,a,I,c])},x)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Me,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Se(D(t),e),p=de(e,s,d);return Be(k(n)||k(p)?null:ke(o,{...ye(r,p),key:p,tableId:n,rowId:p,store:l,debugIds:u}),void 0,u,s)},exports.ResultCellView=Qe,exports.ResultRowView=Ae,exports.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,ie(r.queryId,e,s,t,o,r.queries)),exports.ResultTableView=e=>ve(e,pe(e.queryId,e.queries)),exports.RowView=Me,exports.SliceView=Oe,exports.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Te(r,$(r.tableId,e,s,t,o,r.store)),exports.TableView=De,exports.TablesView=({store:e,tableComponent:s=De,getTableComponentProps:t,separator:o,debugIds:r})=>Be(m(Y(e),(o=>ke(s,{...ye(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),exports.ValueView=Fe,exports.ValuesView=({store:e,valueComponent:s=Fe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(m(se(e),(o=>ke(s,{...ye(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),exports.useAddRowCallback=(e,s,t=[],o,r=L,u=[],d=!0)=>{const l=B(o);return E((t=>g(l,(o=>g(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,u)=>J(C,B(u),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,u,d)=>J(c,B(d),o,r,[e,s,t],u),exports.useCheckpoint=ce,exports.useCheckpointIds=xe,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",O(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",O(o),s,t,[e]),exports.useCheckpoints=e=>v(e,10),exports.useCheckpointsIds=()=>q(11),exports.useCheckpointsOrCheckpointsById=O,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=U(),d=W((()=>s(e)),[e,...t]);return G((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d.destroy()})),[d,...r]),d},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>W(e,s),exports.useDelCellCallback=(e,s,t,o,r,u,d)=>N(r,c,u,d,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,i,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,l,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,n,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,w,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,b,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+A,B(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=we,exports.useGoToCallback=(e,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},exports.useIndexIds=e=>H("IndexIds",M(e),[]),exports.useIndexes=e=>v(e,4),exports.useIndexesIds=()=>q(5),exports.useIndexesOrIndexesById=M,exports.useLinkedRowIds=ne,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+I,D(r),t,o,[e,s]),exports.useLocalRowIds=le,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+I,D(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",f(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",f(o),s,t,[e]),exports.useMetrics=e=>v(e,2),exports.useMetricsIds=()=>q(3),exports.useMetricsOrMetricsById=f,exports.useQueries=e=>v(e,8),exports.useQueriesIds=()=>q(9),exports.useQueriesOrQueriesById=F,exports.useQueryIds=e=>H("QueryIds",F(e),[]),exports.useRedoInformation=e=>{const s=O(e),[,,[o]]=xe(s);return[!k(o),we(s),o,g(o,(e=>s?.getCheckpoint(e)))??t]},exports.useRelationshipIds=e=>H("RelationshipIds",D(e),[]),exports.useRelationships=e=>v(e,6),exports.useRelationshipsIds=()=>q(7),exports.useRelationshipsOrRelationshipsById=D,exports.useRemoteRowId=de,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",D(r),t,o,[e,s]),exports.useResultCell=Ie,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(u+C,F(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,d)=>J(u+c,F(d),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(u+i,F(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(u+a,F(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(u+a,F(o),s,t,[e]),exports.useResultRowIds=pe,exports.useResultRowIdsListener=(e,s,t,o)=>J(u+I,F(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(u+i,F(r),t,o,[e,s]),exports.useResultSortedRowIds=ie,exports.useResultSortedRowIdsListener=(e,s,t,o,r,d,l,n)=>J(u+x,F(n),d,l,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(u+l,F(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(u+l+C,F(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(u+l+C,F(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(u+l,F(o),s,t,[e]),exports.useRow=(e,s,t)=>H(i,B(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,B(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,B(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(I,B(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,u)=>J(i,B(u),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,u,d,l)=>K(u,c,o,r,d,l,e,s,t),exports.useSetCheckpointCallback=(e=L,s=[],t,o=L,r=[])=>{const u=O(t);return E((s=>g(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>K(r,"PartialRow",t,o,u,d,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,u,d)=>K(r,i,t,o,u,d,e,s),exports.useSetTableCallback=(e,s,t,o,r,u)=>K(o,l,s,t,r,u,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,n,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,u)=>K(o,w,s,t,r,u,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,b,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",M(o),s,t,[e]),exports.useSliceRowIds=ue,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+I,M(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>J(x,B(n),u,d,[e,s,t,o,r],l),exports.useStartTransactionListener=(e,s,t)=>J("Start"+A,B(t),e,s),exports.useStore=e=>v(e,0),exports.useStoreIds=()=>q(1),exports.useStoreOrStoreById=B,exports.useTable=(e,s)=>H(l,B(s),{},[e]),exports.useTableCellIds=(e,s)=>H(l+C,B(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(l+C,B(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(p,B(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(l,B(r),s,t,[e],o),exports.useTables=e=>H(n,B(e),{}),exports.useTablesListener=(e,s,t,o)=>J(n,B(o),e,s,[],t),exports.useUndoInformation=e=>{const s=O(e),[o,r]=xe(s);return[(u=o,!(0==(e=>e.length)(u))),Ce(s),r,g(r,(e=>s?.getCheckpoint(e)))??t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,B(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(w,B(r),s,t,[e],o),exports.useValues=e=>H(b,B(e),{}),exports.useValuesListener=(e,s,t,o)=>J(b,B(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+A,B(t),e,s);
|
package/lib/cjs/ui-react.cjs.gz
CHANGED
|
Binary file
|
package/lib/cjs-es6/ui-react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Result",l="Ids",u="Table",n=u+"s",d=u+l,i="Row",p=i+"Count",a=i+l,c="Sorted"+i+l,I="Cell",x=I+l,C="Value",b=C+"s",w=C+l,R=e=>null==e,k=(e,s,t)=>R(e)?null==t?void 0:t():s(e),v=e=>s(e)==o,g=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:h,useContext:L}=e,V=h([]),S=(e,s)=>{var t;const o=L(V);return R(e)?o[s]:v(e)?((e,s)=>k(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},f=(e,s)=>{const t=S(e,s);return R(e)||v(e)?t:e},T=e=>{var s;return y(null!=(s=L(V)[e])?s:{})},P=e=>f(e,0),O=e=>f(e,2),q=e=>f(e,4),B=e=>f(e,6),M=e=>f(e,8),j=e=>f(e,10),{useCallback:D,useEffect:Q,useMemo:E,useRef:F,useState:A}=e,G=(e,s,t=[])=>{const o=E((()=>s(e)),[e,...t]);return Q((()=>()=>o.destroy()),[o]),o},U=(e,s,t,o=[],r)=>{const[,l]=A(),u=D((()=>{var r,l;return null!=(l=null==(r=null==s?void 0:s["get"+e])?void 0:r.call(s,...o))?l:t}),[s,...o]),[n]=A(u),d=F(n);return E((()=>d.current=u()),[u]),z(e,s,((...e)=>{d.current=R(r)?u():e[r],l([])}),[],o),d.current},z=(e,s,t,o=[],r=[],...l)=>Q((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...r,t,...l);return()=>null==s?void 0:s.delListener(u)}),[s,...r,...o,...l]),H=(e,s,t,o=[],r=g,l=[],...u)=>{const n=P(e);return D((e=>k(n,(o=>k(t(e,o),(e=>r(o["set"+s](...u,e),e)))))),[n,s,...o,...l,...u])},J=(e,s,t=g,o=[],...r)=>{const l=P(e);return D((()=>t(null==l?void 0:l["del"+s](...r))),[l,s,...o,...r])},K=(e,s,t)=>{const o=j(e);return D((()=>null==o?void 0:o[s](t)),[o,s,t])},N=e=>U(d,P(e),[],[]),W=(e,s)=>U(a,P(s),[],[e]),X=(e,s,t,o=0,r,l)=>U(c,P(l),[],[e,s,t,o,r],6),Y=(e,s,t)=>U(x,P(t),[],[e,s]),Z=(e,s,t,o)=>U(I,P(o),void 0,[e,s,t],4),$=e=>U(w,P(e),[],[]),_=(e,s)=>U(C,P(s),void 0,[e]),ee=(e,s)=>U("Metric",O(s),void 0,[e]),se=(e,s)=>U("SliceIds",q(s),[],[e]),te=(e,s,t)=>U("Slice"+a,q(t),[],[e,s]),oe=(e,s,t)=>U("RemoteRowId",B(t),void 0,[e,s]),re=(e,s,t)=>U("Local"+a,B(t),[],[e,s]),le=(e,s,t)=>U("Linked"+a,B(t),[],[e,s]),ue=(e,s)=>U(r+a,M(s),[],[e]),ne=(e,s,t,o=0,l,u)=>U(r+c,M(u),[],[e,s,t,o,l],6),de=(e,s,t)=>U(r+x,M(t),[],[e,s]),ie=(e,s,t,o)=>U(r+I,M(o),void 0,[e,s,t]),pe=e=>U("CheckpointIds",j(e),[[],void 0,[]]),ae=(e,s)=>U("Checkpoint",j(s),void 0,[e]),ce=e=>K(e,"goBackward"),Ie=e=>K(e,"goForward"),{PureComponent:xe,Fragment:Ce,createElement:be,useCallback:we,useLayoutEffect:Re,useRef:ke,useState:ve}=e,ge=(e,...s)=>R(e)?{}:e(...s),me=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var ye=Object.defineProperty,he=Object.defineProperties,Le=Object.getOwnPropertyDescriptors,Ve=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable,Te=(e,s,t)=>s in e?ye(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Pe=(e,s)=>{for(var t in s||(s={}))Se.call(s,t)&&Te(e,t,s[t]);if(Ve)for(var t of Ve(s))fe.call(s,t)&&Te(e,t,s[t]);return e},Oe=(e,s)=>he(e,Le(s)),qe=(e,s)=>{var t={};for(var o in e)Se.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Ve)for(var o of Ve(e))s.indexOf(o)<0&&fe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Be}=e,Me=({tableId:e,store:s,rowComponent:t=Ae,getRowComponentProps:o,customCellIds:r,separator:l,debugIds:u},n)=>Ee(m(n,(l=>be(t,Oe(Pe({},ge(o,l)),{key:l,tableId:e,rowId:l,customCellIds:r,store:s,debugIds:u})))),l,u,e),je=({queryId:e,queries:s,resultRowComponent:t=Je,getResultRowComponentProps:o,separator:r,debugIds:l},u)=>Ee(m(u,(r=>be(t,Oe(Pe({},ge(o,r)),{key:r,queryId:e,rowId:r,queries:s,debugIds:l})))),r,l,e),De=({relationshipId:e,relationships:s,rowComponent:t=Ae,getRowComponentProps:o,separator:r,debugIds:l},u,n)=>{const[d,i,p]=me(B(s),e),a=u(e,n,d);return Ee(m(a,(e=>be(t,Oe(Pe({},ge(o,e)),{key:e,tableId:p,rowId:e,store:i,debugIds:l})))),r,l,n)},Qe=e=>({checkpoints:s,checkpointComponent:t=Ke,getCheckpointComponentProps:o,separator:r,debugIds:l})=>{const u=j(s);return Ee(m(e(pe(u)),(e=>be(t,Oe(Pe({},ge(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),r)},Ee=(e,s,t,o)=>{const r=R(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Fe=({tableId:e,rowId:s,cellId:o,store:r,debugIds:l})=>{var u;return Ee(t+(null!=(u=Z(e,s,o,r))?u:t),void 0,l,o)},Ae=({tableId:e,rowId:s,store:t,cellComponent:o=Fe,getCellComponentProps:r,customCellIds:l,separator:u,debugIds:n})=>Ee(m(((e,s,t,o)=>{const r=Y(s,t,o);return null!=e?e:r})(l,e,s,t),(l=>be(o,Oe(Pe({},ge(r,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),Ge=e=>Me(e,W(e.tableId,e.store)),Ue=({valueId:e,store:s,debugIds:o})=>{var r;return Ee(t+(null!=(r=_(e,s))?r:t),void 0,o,e)},ze=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ae,getRowComponentProps:r,separator:l,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(q(t),e),p=te(e,s,n);return Ee(m(p,(e=>be(o,Oe(Pe({},ge(r,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),l,u,s)},He=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:l})=>{var u;return Ee(t+(null!=(u=ie(e,s,o,r))?u:t),void 0,l,o)},Je=({queryId:e,rowId:s,queries:t,resultCellComponent:o=He,getResultCellComponentProps:r,separator:l,debugIds:u})=>Ee(m(de(e,s,t),(l=>be(o,Oe(Pe({},ge(r,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),Ke=({checkpoints:e,checkpointId:s,debugIds:o})=>{var r;return Ee(null!=(r=ae(s,e))?r:t,void 0,o,s)},Ne=Qe((e=>e[0])),We=Qe((e=>R(e[1])?[]:[e[1]])),Xe=Qe((e=>e[2]));exports.BackwardCheckpointsView=Ne,exports.CellView=Fe,exports.CheckpointView=Ke,exports.CurrentCheckpointView=We,exports.ForwardCheckpointsView=Xe,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=ze,getSliceComponentProps:o,separator:r,debugIds:l})=>Ee(m(se(e,s),(r=>be(t,Oe(Pe({},ge(o,r)),{key:r,indexId:e,sliceId:r,indexes:s,debugIds:l})))),r,l,e),exports.LinkedRowsView=e=>De(e,le,e.firstRowId),exports.LocalRowsView=e=>De(e,re,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>{var r;return Ee(null!=(r=ee(e,s))?r:t,void 0,o,e)},exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:l,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:p,checkpoints:a,checkpointsById:c,children:I})=>{const x=e.useContext(V);return be(V.Provider,{value:Be((()=>[null!=s?s:x[0],Pe(Pe({},x[1]),t),null!=o?o:x[2],Pe(Pe({},x[3]),r),null!=l?l:x[4],Pe(Pe({},x[5]),u),null!=n?n:x[6],Pe(Pe({},x[7]),d),null!=i?i:x[8],Pe(Pe({},x[9]),p),null!=a?a:x[10],Pe(Pe({},x[11]),c)]),[s,t,o,r,l,u,n,d,i,p,a,c,x])},I)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ae,getRowComponentProps:r,debugIds:l})=>{const[u,n,,d]=me(B(t),e),i=oe(e,s,u);return Ee(R(d)||R(i)?null:be(o,Oe(Pe({},ge(r,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=He,exports.ResultRowView=Je,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=qe(s,["cellId","descending","offset","limit"]);return je(u,ne(u.queryId,t,o,r,l,u.queries))},exports.ResultTableView=e=>je(e,ue(e.queryId,e.queries)),exports.RowView=Ae,exports.SliceView=ze,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=qe(s,["cellId","descending","offset","limit"]);return Me(u,X(u.tableId,t,o,r,l,u.store))},exports.TableView=Ge,exports.TablesView=({store:e,tableComponent:s=Ge,getTableComponentProps:t,separator:o,debugIds:r})=>Ee(m(N(e),(o=>be(s,Oe(Pe({},ge(t,o)),{key:o,tableId:o,store:e,debugIds:r})))),o),exports.ValueView=Ue,exports.ValuesView=({store:e,valueComponent:s=Ue,getValueComponentProps:t,separator:o,debugIds:r})=>Ee(m($(e),(o=>be(s,Oe(Pe({},ge(t,o)),{key:o,valueId:o,store:e,debugIds:r})))),o),exports.useAddRowCallback=(e,s,t=[],o,r=g,l=[],u=!0)=>{const n=P(o);return D((t=>k(n,(o=>k(s(t,o),(s=>r(o.addRow(e,s,u),o,s)))))),[n,e,...t,...l,u])},exports.useCell=Z,exports.useCellIds=Y,exports.useCellIdsListener=(e,s,t,o,r,l)=>z(x,P(l),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,l,u)=>z(I,P(u),o,r,[e,s,t],l),exports.useCheckpoint=ae,exports.useCheckpointIds=pe,exports.useCheckpointIdsListener=(e,s,t)=>z("CheckpointIds",j(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>z("Checkpoint",j(o),s,t,[e]),exports.useCheckpoints=e=>S(e,10),exports.useCheckpointsIds=()=>T(11),exports.useCheckpointsOrCheckpointsById=j,exports.useCreateCheckpoints=(e,s,t)=>G(e,s,t),exports.useCreateIndexes=(e,s,t)=>G(e,s,t),exports.useCreateMetrics=(e,s,t)=>G(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,l]=A(),u=E((()=>s(e)),[e,...t]);return Q((()=>{var e;return e=function*(){yield null==o?void 0:o(u),l(1)},new Promise(((s,t)=>{var o=s=>{try{l(e.next(s))}catch(e){t(e)}},r=s=>{try{l(e.throw(s))}catch(e){t(e)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,r);l((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...r]),u},exports.useCreateQueries=(e,s,t)=>G(e,s,t),exports.useCreateRelationships=(e,s,t)=>G(e,s,t),exports.useCreateStore=(e,s=[])=>E(e,s),exports.useDelCellCallback=(e,s,t,o,r,l,u)=>J(r,I,l,u,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>J(t,i,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>J(s,u,t,o,e),exports.useDelTablesCallback=(e,s,t)=>J(e,n,s,t),exports.useDelValueCallback=(e,s,t,o)=>J(s,C,t,o,e),exports.useDelValuesCallback=(e,s,t)=>J(e,b,s,t),exports.useGoBackwardCallback=ce,exports.useGoForwardCallback=Ie,exports.useGoToCallback=(e,s=[],t,o=g,r=[])=>{const l=j(t);return D((s=>k(l,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[l,...s,...r])},exports.useIndexIds=e=>U("IndexIds",q(e),[]),exports.useIndexes=e=>S(e,4),exports.useIndexesIds=()=>T(5),exports.useIndexesOrIndexesById=q,exports.useLinkedRowIds=le,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>z("Linked"+a,B(r),t,o,[e,s]),exports.useLocalRowIds=re,exports.useLocalRowIdsListener=(e,s,t,o,r)=>z("Local"+a,B(r),t,o,[e,s]),exports.useMetric=ee,exports.useMetricIds=e=>U("MetricIds",O(e),[]),exports.useMetricListener=(e,s,t,o)=>z("Metric",O(o),s,t,[e]),exports.useMetrics=e=>S(e,2),exports.useMetricsIds=()=>T(3),exports.useMetricsOrMetricsById=O,exports.useQueries=e=>S(e,8),exports.useQueriesIds=()=>T(9),exports.useQueriesOrQueriesById=M,exports.useQueryIds=e=>U("QueryIds",M(e),[]),exports.useRedoInformation=e=>{var s;const o=j(e),[,,[r]]=pe(o);return[!R(r),Ie(o),r,null!=(s=k(r,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>U("RelationshipIds",B(e),[]),exports.useRelationships=e=>S(e,6),exports.useRelationshipsIds=()=>T(7),exports.useRelationshipsOrRelationshipsById=B,exports.useRemoteRowId=oe,exports.useRemoteRowIdListener=(e,s,t,o,r)=>z("RemoteRowId",B(r),t,o,[e,s]),exports.useResultCell=ie,exports.useResultCellIds=de,exports.useResultCellIdsListener=(e,s,t,o,l)=>z(r+x,M(l),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,l,u)=>z(r+I,M(u),o,l,[e,s,t]),exports.useResultRow=(e,s,t)=>U(r+i,M(t),{},[e,s]),exports.useResultRowCount=(e,s)=>U(r+p,M(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>z(r+p,M(o),s,t,[e]),exports.useResultRowIds=ue,exports.useResultRowIdsListener=(e,s,t,o)=>z(r+a,M(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,l)=>z(r+i,M(l),t,o,[e,s]),exports.useResultSortedRowIds=ne,exports.useResultSortedRowIdsListener=(e,s,t,o,l,u,n,d)=>z(r+c,M(d),u,n,[e,s,t,o,l]),exports.useResultTable=(e,s)=>U(r+u,M(s),{},[e]),exports.useResultTableCellIds=(e,s)=>U(r+u+x,M(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>z(r+u+x,M(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>z(r+u,M(o),s,t,[e]),exports.useRow=(e,s,t)=>U(i,P(t),{},[e,s]),exports.useRowCount=(e,s)=>U(p,P(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>z(p,P(r),s,t,[e],o),exports.useRowIds=W,exports.useRowIdsListener=(e,s,t,o,r)=>z(a,P(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,l)=>z(i,P(l),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,l,u,n)=>H(l,I,o,r,u,n,e,s,t),exports.useSetCheckpointCallback=(e=g,s=[],t,o=g,r=[])=>{const l=j(t);return D((s=>k(l,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[l,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,l,u)=>H(r,"PartialRow",t,o,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>H(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,l,u)=>H(r,i,t,o,l,u,e,s),exports.useSetTableCallback=(e,s,t,o,r,l)=>H(o,u,s,t,r,l,e),exports.useSetTablesCallback=(e,s,t,o,r)=>H(t,n,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,l)=>H(o,C,s,t,r,l,e),exports.useSetValuesCallback=(e,s,t,o,r)=>H(t,b,e,s,o,r),exports.useSliceIds=se,exports.useSliceIdsListener=(e,s,t,o)=>z("SliceIds",q(o),s,t,[e]),exports.useSliceRowIds=te,exports.useSliceRowIdsListener=(e,s,t,o,r)=>z("Slice"+a,q(r),t,o,[e,s]),exports.useSortedRowIds=X,exports.useSortedRowIdsListener=(e,s,t,o,r,l,u,n,d)=>z(c,P(d),l,u,[e,s,t,o,r],n),exports.useStore=e=>S(e,0),exports.useStoreIds=()=>T(1),exports.useStoreOrStoreById=P,exports.useTable=(e,s)=>U(u,P(s),{},[e]),exports.useTableCellIds=(e,s)=>U(u+x,P(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>z(u+x,P(r),s,t,[e],o),exports.useTableIds=N,exports.useTableIdsListener=(e,s,t,o)=>z(d,P(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>z(u,P(r),s,t,[e],o),exports.useTables=e=>U(n,P(e),{}),exports.useTablesListener=(e,s,t,o)=>z(n,P(o),e,s,[],t),exports.useUndoInformation=e=>{var s;const o=j(e),[r,l]=pe(o);return[(u=r,!(0==(e=>e.length)(u))),ce(o),l,null!=(s=k(l,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t];var u},exports.useValue=_,exports.useValueIds=$,exports.useValueIdsListener=(e,s,t,o)=>z(w,P(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>z(C,P(r),s,t,[e],o),exports.useValues=e=>U(b,P(e),{}),exports.useValuesListener=(e,s,t,o)=>z(b,P(o),e,s,[],t);
|
|
1
|
+
"use strict";var e=require("react");const s=e=>typeof e,t="",o=s(t),r="Listener",l="Result",u="Ids",n="Table",d=n+"s",i=n+u,p="Row",a=p+"Count",c=p+u,I="Sorted"+p+u,x="Cell",C=x+u,b="Value",w=b+"s",R=b+u,k=e=>null==e,v=(e,s,t)=>k(e)?null==t?void 0:t():s(e),g=e=>s(e)==o,h=()=>{},m=(e,s)=>e.map(s),y=Object.keys,{createContext:L,useContext:S}=e,V=L([]),f=(e,s)=>{var t;const o=S(V);return k(e)?o[s]:g(e)?((e,s)=>v(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},T=(e,s)=>{const t=f(e,s);return k(e)||g(e)?t:e},P=e=>{var s;return y(null!=(s=S(V)[e])?s:{})},O=e=>T(e,0),q=e=>T(e,2),B=e=>T(e,4),M=e=>T(e,6),D=e=>T(e,8),F=e=>T(e,10),j=e=>e.toLowerCase();j(r);const Q="Transaction";j(Q);const{useCallback:E,useEffect:A,useMemo:G,useRef:W,useState:U}=e,z=(e,s,t=[])=>{const o=G((()=>s(e)),[e,...t]);return A((()=>()=>o.destroy()),[o]),o},H=(e,s,t,o=[],r)=>{const[,l]=U(),u=E((()=>{var r,l;return null!=(l=null==(r=null==s?void 0:s["get"+e])?void 0:r.call(s,...o))?l:t}),[s,...o]),[n]=U(u),d=W(n);return G((()=>d.current=u()),[u]),J(e,s,((...e)=>{d.current=k(r)?u():e[r],l([])}),[],o),d.current},J=(e,s,t,o=[],l=[],...u)=>A((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),K=(e,s,t,o=[],r=h,l=[],...u)=>{const n=O(e);return E((e=>v(n,(o=>v(t(e,o),(e=>r(o["set"+s](...u,e),e)))))),[n,s,...o,...l,...u])},N=(e,s,t=h,o=[],...r)=>{const l=O(e);return E((()=>t(null==l?void 0:l["del"+s](...r))),[l,s,...o,...r])},X=(e,s,t)=>{const o=F(e);return E((()=>null==o?void 0:o[s](t)),[o,s,t])},Y=e=>H(i,O(e),[],[]),Z=(e,s)=>H(c,O(s),[],[e]),$=(e,s,t,o=0,r,l)=>H(I,O(l),[],[e,s,t,o,r],6),_=(e,s,t)=>H(C,O(t),[],[e,s]),ee=(e,s,t,o)=>H(x,O(o),void 0,[e,s,t],4),se=e=>H(R,O(e),[],[]),te=(e,s)=>H(b,O(s),void 0,[e]),oe=(e,s)=>H("Metric",q(s),void 0,[e]),re=(e,s)=>H("SliceIds",B(s),[],[e]),le=(e,s,t)=>H("Slice"+c,B(t),[],[e,s]),ue=(e,s,t)=>H("RemoteRowId",M(t),void 0,[e,s]),ne=(e,s,t)=>H("Local"+c,M(t),[],[e,s]),de=(e,s,t)=>H("Linked"+c,M(t),[],[e,s]),ie=(e,s)=>H(l+c,D(s),[],[e]),pe=(e,s,t,o=0,r,u)=>H(l+I,D(u),[],[e,s,t,o,r],6),ae=(e,s,t)=>H(l+C,D(t),[],[e,s]),ce=(e,s,t,o)=>H(l+x,D(o),void 0,[e,s,t]),Ie=e=>H("CheckpointIds",F(e),[[],void 0,[]]),xe=(e,s)=>H("Checkpoint",F(s),void 0,[e]),Ce=e=>X(e,"goBackward"),be=e=>X(e,"goForward"),{PureComponent:we,Fragment:Re,createElement:ke,useCallback:ve,useLayoutEffect:ge,useRef:he,useState:me}=e,ye=(e,...s)=>k(e)?{}:e(...s),Le=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Se=Object.defineProperty,Ve=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,qe=(e,s,t)=>s in e?Se(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Be=(e,s)=>{for(var t in s||(s={}))Pe.call(s,t)&&qe(e,t,s[t]);if(Te)for(var t of Te(s))Oe.call(s,t)&&qe(e,t,s[t]);return e},Me=(e,s)=>Ve(e,fe(s)),De=(e,s)=>{var t={};for(var o in e)Pe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Te)for(var o of Te(e))s.indexOf(o)<0&&Oe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=e,je=({tableId:e,store:s,rowComponent:t=Ue,getRowComponentProps:o,customCellIds:r,separator:l,debugIds:u},n)=>Ge(m(n,(l=>ke(t,Me(Be({},ye(o,l)),{key:l,tableId:e,rowId:l,customCellIds:r,store:s,debugIds:u})))),l,u,e),Qe=({queryId:e,queries:s,resultRowComponent:t=Ne,getResultRowComponentProps:o,separator:r,debugIds:l},u)=>Ge(m(u,(r=>ke(t,Me(Be({},ye(o,r)),{key:r,queryId:e,rowId:r,queries:s,debugIds:l})))),r,l,e),Ee=({relationshipId:e,relationships:s,rowComponent:t=Ue,getRowComponentProps:o,separator:r,debugIds:l},u,n)=>{const[d,i,p]=Le(M(s),e),a=u(e,n,d);return Ge(m(a,(e=>ke(t,Me(Be({},ye(o,e)),{key:e,tableId:p,rowId:e,store:i,debugIds:l})))),r,l,n)},Ae=e=>({checkpoints:s,checkpointComponent:t=Xe,getCheckpointComponentProps:o,separator:r,debugIds:l})=>{const u=F(s);return Ge(m(e(Ie(u)),(e=>ke(t,Me(Be({},ye(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:l})))),r)},Ge=(e,s,t,o)=>{const r=k(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},We=({tableId:e,rowId:s,cellId:o,store:r,debugIds:l})=>{var u;return Ge(t+(null!=(u=ee(e,s,o,r))?u:t),void 0,l,o)},Ue=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:r,customCellIds:l,separator:u,debugIds:n})=>Ge(m(((e,s,t,o)=>{const r=_(s,t,o);return null!=e?e:r})(l,e,s,t),(l=>ke(o,Me(Be({},ye(r,l)),{key:l,tableId:e,rowId:s,cellId:l,store:t,debugIds:n})))),u,n,s),ze=e=>je(e,Z(e.tableId,e.store)),He=({valueId:e,store:s,debugIds:o})=>{var r;return Ge(t+(null!=(r=te(e,s))?r:t),void 0,o,e)},Je=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ue,getRowComponentProps:r,separator:l,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(B(t),e),p=le(e,s,n);return Ge(m(p,(e=>ke(o,Me(Be({},ye(r,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),l,u,s)},Ke=({queryId:e,rowId:s,cellId:o,queries:r,debugIds:l})=>{var u;return Ge(t+(null!=(u=ce(e,s,o,r))?u:t),void 0,l,o)},Ne=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ke,getResultCellComponentProps:r,separator:l,debugIds:u})=>Ge(m(ae(e,s,t),(l=>ke(o,Me(Be({},ye(r,l)),{key:l,queryId:e,rowId:s,cellId:l,queries:t,debugIds:u})))),l,u,s),Xe=({checkpoints:e,checkpointId:s,debugIds:o})=>{var r;return Ge(null!=(r=xe(s,e))?r:t,void 0,o,s)},Ye=Ae((e=>e[0])),Ze=Ae((e=>k(e[1])?[]:[e[1]])),$e=Ae((e=>e[2]));exports.BackwardCheckpointsView=Ye,exports.CellView=We,exports.CheckpointView=Xe,exports.CurrentCheckpointView=Ze,exports.ForwardCheckpointsView=$e,exports.IndexView=({indexId:e,indexes:s,sliceComponent:t=Je,getSliceComponentProps:o,separator:r,debugIds:l})=>Ge(m(re(e,s),(r=>ke(t,Me(Be({},ye(o,r)),{key:r,indexId:e,sliceId:r,indexes:s,debugIds:l})))),r,l,e),exports.LinkedRowsView=e=>Ee(e,de,e.firstRowId),exports.LocalRowsView=e=>Ee(e,ne,e.remoteRowId),exports.MetricView=({metricId:e,metrics:s,debugIds:o})=>{var r;return Ge(null!=(r=oe(e,s))?r:t,void 0,o,e)},exports.Provider=({store:s,storesById:t,metrics:o,metricsById:r,indexes:l,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:p,checkpoints:a,checkpointsById:c,children:I})=>{const x=e.useContext(V);return ke(V.Provider,{value:Fe((()=>[null!=s?s:x[0],Be(Be({},x[1]),t),null!=o?o:x[2],Be(Be({},x[3]),r),null!=l?l:x[4],Be(Be({},x[5]),u),null!=n?n:x[6],Be(Be({},x[7]),d),null!=i?i:x[8],Be(Be({},x[9]),p),null!=a?a:x[10],Be(Be({},x[11]),c)]),[s,t,o,r,l,u,n,d,i,p,a,c,x])},I)},exports.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ue,getRowComponentProps:r,debugIds:l})=>{const[u,n,,d]=Le(M(t),e),i=ue(e,s,u);return Ge(k(d)||k(i)?null:ke(o,Me(Be({},ye(r,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:l})),void 0,l,s)},exports.ResultCellView=Ke,exports.ResultRowView=Ne,exports.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=De(s,["cellId","descending","offset","limit"]);return Qe(u,pe(u.queryId,t,o,r,l,u.queries))},exports.ResultTableView=e=>Qe(e,ie(e.queryId,e.queries)),exports.RowView=Ue,exports.SliceView=Je,exports.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:r,limit:l}=s,u=De(s,["cellId","descending","offset","limit"]);return je(u,$(u.tableId,t,o,r,l,u.store))},exports.TableView=ze,exports.TablesView=({store:e,tableComponent:s=ze,getTableComponentProps:t,separator:o,debugIds:r})=>Ge(m(Y(e),(o=>ke(s,Me(Be({},ye(t,o)),{key:o,tableId:o,store:e,debugIds:r})))),o),exports.ValueView=He,exports.ValuesView=({store:e,valueComponent:s=He,getValueComponentProps:t,separator:o,debugIds:r})=>Ge(m(se(e),(o=>ke(s,Me(Be({},ye(t,o)),{key:o,valueId:o,store:e,debugIds:r})))),o),exports.useAddRowCallback=(e,s,t=[],o,r=h,l=[],u=!0)=>{const n=O(o);return E((t=>v(n,(o=>v(s(t,o),(s=>r(o.addRow(e,s,u),o,s)))))),[n,e,...t,...l,u])},exports.useCell=ee,exports.useCellIds=_,exports.useCellIdsListener=(e,s,t,o,r,l)=>J(C,O(l),t,o,[e,s],r),exports.useCellListener=(e,s,t,o,r,l,u)=>J(x,O(u),o,r,[e,s,t],l),exports.useCheckpoint=xe,exports.useCheckpointIds=Ie,exports.useCheckpointIdsListener=(e,s,t)=>J("CheckpointIds",F(t),e,s),exports.useCheckpointListener=(e,s,t,o)=>J("Checkpoint",F(o),s,t,[e]),exports.useCheckpoints=e=>f(e,10),exports.useCheckpointsIds=()=>P(11),exports.useCheckpointsOrCheckpointsById=F,exports.useCreateCheckpoints=(e,s,t)=>z(e,s,t),exports.useCreateIndexes=(e,s,t)=>z(e,s,t),exports.useCreateMetrics=(e,s,t)=>z(e,s,t),exports.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,l]=U(),u=G((()=>s(e)),[e,...t]);return A((()=>{var e;return e=function*(){yield null==o?void 0:o(u),l(1)},new Promise(((s,t)=>{var o=s=>{try{l(e.next(s))}catch(e){t(e)}},r=s=>{try{l(e.throw(s))}catch(e){t(e)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,r);l((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...r]),u},exports.useCreateQueries=(e,s,t)=>z(e,s,t),exports.useCreateRelationships=(e,s,t)=>z(e,s,t),exports.useCreateStore=(e,s=[])=>G(e,s),exports.useDelCellCallback=(e,s,t,o,r,l,u)=>N(r,x,l,u,e,s,t,o),exports.useDelRowCallback=(e,s,t,o,r)=>N(t,p,o,r,e,s),exports.useDelTableCallback=(e,s,t,o)=>N(s,n,t,o,e),exports.useDelTablesCallback=(e,s,t)=>N(e,d,s,t),exports.useDelValueCallback=(e,s,t,o)=>N(s,b,t,o,e),exports.useDelValuesCallback=(e,s,t)=>N(e,w,s,t),exports.useDidFinishTransactionListener=(e,s,t)=>J("DidFinish"+Q,O(t),e,s),exports.useGoBackwardCallback=Ce,exports.useGoForwardCallback=be,exports.useGoToCallback=(e,s=[],t,o=h,r=[])=>{const l=F(t);return E((s=>v(l,(t=>v(e(s),(e=>o(t.goTo(e),e)))))),[l,...s,...r])},exports.useIndexIds=e=>H("IndexIds",B(e),[]),exports.useIndexes=e=>f(e,4),exports.useIndexesIds=()=>P(5),exports.useIndexesOrIndexesById=B,exports.useLinkedRowIds=de,exports.useLinkedRowIdsListener=(e,s,t,o,r)=>J("Linked"+c,M(r),t,o,[e,s]),exports.useLocalRowIds=ne,exports.useLocalRowIdsListener=(e,s,t,o,r)=>J("Local"+c,M(r),t,o,[e,s]),exports.useMetric=oe,exports.useMetricIds=e=>H("MetricIds",q(e),[]),exports.useMetricListener=(e,s,t,o)=>J("Metric",q(o),s,t,[e]),exports.useMetrics=e=>f(e,2),exports.useMetricsIds=()=>P(3),exports.useMetricsOrMetricsById=q,exports.useQueries=e=>f(e,8),exports.useQueriesIds=()=>P(9),exports.useQueriesOrQueriesById=D,exports.useQueryIds=e=>H("QueryIds",D(e),[]),exports.useRedoInformation=e=>{var s;const o=F(e),[,,[r]]=Ie(o);return[!k(r),be(o),r,null!=(s=v(r,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t]},exports.useRelationshipIds=e=>H("RelationshipIds",M(e),[]),exports.useRelationships=e=>f(e,6),exports.useRelationshipsIds=()=>P(7),exports.useRelationshipsOrRelationshipsById=M,exports.useRemoteRowId=ue,exports.useRemoteRowIdListener=(e,s,t,o,r)=>J("RemoteRowId",M(r),t,o,[e,s]),exports.useResultCell=ce,exports.useResultCellIds=ae,exports.useResultCellIdsListener=(e,s,t,o,r)=>J(l+C,D(r),t,o,[e,s]),exports.useResultCellListener=(e,s,t,o,r,u)=>J(l+x,D(u),o,r,[e,s,t]),exports.useResultRow=(e,s,t)=>H(l+p,D(t),{},[e,s]),exports.useResultRowCount=(e,s)=>H(l+a,D(s),[],[e]),exports.useResultRowCountListener=(e,s,t,o)=>J(l+a,D(o),s,t,[e]),exports.useResultRowIds=ie,exports.useResultRowIdsListener=(e,s,t,o)=>J(l+c,D(o),s,t,[e]),exports.useResultRowListener=(e,s,t,o,r)=>J(l+p,D(r),t,o,[e,s]),exports.useResultSortedRowIds=pe,exports.useResultSortedRowIdsListener=(e,s,t,o,r,u,n,d)=>J(l+I,D(d),u,n,[e,s,t,o,r]),exports.useResultTable=(e,s)=>H(l+n,D(s),{},[e]),exports.useResultTableCellIds=(e,s)=>H(l+n+C,D(s),[],[e]),exports.useResultTableCellIdsListener=(e,s,t,o)=>J(l+n+C,D(o),s,t,[e]),exports.useResultTableListener=(e,s,t,o)=>J(l+n,D(o),s,t,[e]),exports.useRow=(e,s,t)=>H(p,O(t),{},[e,s]),exports.useRowCount=(e,s)=>H(a,O(s),[],[e]),exports.useRowCountListener=(e,s,t,o,r)=>J(a,O(r),s,t,[e],o),exports.useRowIds=Z,exports.useRowIdsListener=(e,s,t,o,r)=>J(c,O(r),s,t,[e],o),exports.useRowListener=(e,s,t,o,r,l)=>J(p,O(l),t,o,[e,s],r),exports.useSetCellCallback=(e,s,t,o,r,l,u,n)=>K(l,x,o,r,u,n,e,s,t),exports.useSetCheckpointCallback=(e=h,s=[],t,o=h,r=[])=>{const l=F(t);return E((s=>v(l,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[l,...s,...r])},exports.useSetPartialRowCallback=(e,s,t,o,r,l,u)=>K(r,"PartialRow",t,o,l,u,e,s),exports.useSetPartialValuesCallback=(e,s,t,o,r)=>K(t,"PartialValues",e,s,o,r),exports.useSetRowCallback=(e,s,t,o,r,l,u)=>K(r,p,t,o,l,u,e,s),exports.useSetTableCallback=(e,s,t,o,r,l)=>K(o,n,s,t,r,l,e),exports.useSetTablesCallback=(e,s,t,o,r)=>K(t,d,e,s,o,r),exports.useSetValueCallback=(e,s,t,o,r,l)=>K(o,b,s,t,r,l,e),exports.useSetValuesCallback=(e,s,t,o,r)=>K(t,w,e,s,o,r),exports.useSliceIds=re,exports.useSliceIdsListener=(e,s,t,o)=>J("SliceIds",B(o),s,t,[e]),exports.useSliceRowIds=le,exports.useSliceRowIdsListener=(e,s,t,o,r)=>J("Slice"+c,B(r),t,o,[e,s]),exports.useSortedRowIds=$,exports.useSortedRowIdsListener=(e,s,t,o,r,l,u,n,d)=>J(I,O(d),l,u,[e,s,t,o,r],n),exports.useStartTransactionListener=(e,s,t)=>J("Start"+Q,O(t),e,s),exports.useStore=e=>f(e,0),exports.useStoreIds=()=>P(1),exports.useStoreOrStoreById=O,exports.useTable=(e,s)=>H(n,O(s),{},[e]),exports.useTableCellIds=(e,s)=>H(n+C,O(s),[],[e]),exports.useTableCellIdsListener=(e,s,t,o,r)=>J(n+C,O(r),s,t,[e],o),exports.useTableIds=Y,exports.useTableIdsListener=(e,s,t,o)=>J(i,O(o),e,s,[],t),exports.useTableListener=(e,s,t,o,r)=>J(n,O(r),s,t,[e],o),exports.useTables=e=>H(d,O(e),{}),exports.useTablesListener=(e,s,t,o)=>J(d,O(o),e,s,[],t),exports.useUndoInformation=e=>{var s;const o=F(e),[r,l]=Ie(o);return[(u=r,!(0==(e=>e.length)(u))),Ce(o),l,null!=(s=v(l,(e=>null==o?void 0:o.getCheckpoint(e))))?s:t];var u},exports.useValue=te,exports.useValueIds=se,exports.useValueIdsListener=(e,s,t,o)=>J(R,O(o),e,s,[],t),exports.useValueListener=(e,s,t,o,r)=>J(b,O(r),s,t,[e],o),exports.useValues=e=>H(w,O(e),{}),exports.useValuesListener=(e,s,t,o)=>J(w,O(o),e,s,[],t),exports.useWillFinishTransactionListener=(e,s,t)=>J("WillFinish"+Q,O(t),e,s);
|
|
Binary file
|
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
|
};
|
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
|
|
@@ -84,6 +84,7 @@ import {
|
|
|
84
84
|
TableListener,
|
|
85
85
|
Tables,
|
|
86
86
|
TablesListener,
|
|
87
|
+
TransactionListener,
|
|
87
88
|
Value,
|
|
88
89
|
ValueIdsListener,
|
|
89
90
|
ValueListener,
|
|
@@ -4286,6 +4287,210 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4286
4287
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4287
4288
|
) => void;
|
|
4288
4289
|
|
|
4290
|
+
/**
|
|
4291
|
+
* The useStartTransactionListener hook registers a listener function with the
|
|
4292
|
+
* Store that will be called at the start of a transaction.
|
|
4293
|
+
*
|
|
4294
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
4295
|
+
*
|
|
4296
|
+
* ```ts override
|
|
4297
|
+
* useStartTransactionListener(
|
|
4298
|
+
* listener: TransactionListener,
|
|
4299
|
+
* listenerDeps?: React.DependencyList,
|
|
4300
|
+
* storeOrStoreId?: StoreOrStoreId,
|
|
4301
|
+
* ): void;
|
|
4302
|
+
* ```
|
|
4303
|
+
*
|
|
4304
|
+
* Unlike the addStartTransactionListener method, which returns a listener Id
|
|
4305
|
+
* and requires you to remove it manually, the useStartTransactionListener hook
|
|
4306
|
+
* manages this lifecycle for you: when the listener changes (per its
|
|
4307
|
+
* `listenerDeps` dependencies) or the component unmounts, the listener on the
|
|
4308
|
+
* underlying Store will be deleted.
|
|
4309
|
+
* @param listener The function that will be called at the start of a
|
|
4310
|
+
* transaction.
|
|
4311
|
+
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
4312
|
+
* function, which, if any change, result in the re-registration of the
|
|
4313
|
+
* listener. This parameter defaults to an empty array.
|
|
4314
|
+
* @param storeOrStoreId The Store to register the listener with: omit for the
|
|
4315
|
+
* default context Store, provide an Id for a named context Store, or provide an
|
|
4316
|
+
* explicit reference.
|
|
4317
|
+
* @example
|
|
4318
|
+
* This example uses the useStartTransactionListener hook to create a listener
|
|
4319
|
+
* that is scoped to a single component. When the component is unmounted, the
|
|
4320
|
+
* listener is removed from the Store.
|
|
4321
|
+
*
|
|
4322
|
+
* ```jsx
|
|
4323
|
+
* const App = ({store}) => (
|
|
4324
|
+
* <Provider store={store}>
|
|
4325
|
+
* <Pane />
|
|
4326
|
+
* </Provider>
|
|
4327
|
+
* );
|
|
4328
|
+
* const Pane = () => {
|
|
4329
|
+
* useStartTransactionListener(() => console.log('Start transaction'));
|
|
4330
|
+
* return <span>App</span>;
|
|
4331
|
+
* };
|
|
4332
|
+
*
|
|
4333
|
+
* const store = createStore();
|
|
4334
|
+
* const app = document.createElement('div');
|
|
4335
|
+
* const root = ReactDOMClient.createRoot(app);
|
|
4336
|
+
* root.render(<App store={store} />); // !act
|
|
4337
|
+
* console.log(store.getListenerStats().transaction);
|
|
4338
|
+
* // -> 1
|
|
4339
|
+
*
|
|
4340
|
+
* store.setValue('open', false); // !act
|
|
4341
|
+
* // -> 'Start transaction'
|
|
4342
|
+
*
|
|
4343
|
+
* root.unmount(); // !act
|
|
4344
|
+
* console.log(store.getListenerStats().transaction);
|
|
4345
|
+
* // -> 0
|
|
4346
|
+
* ```
|
|
4347
|
+
* @category Store hooks
|
|
4348
|
+
* @since v4.2.2
|
|
4349
|
+
*/
|
|
4350
|
+
useStartTransactionListener: (
|
|
4351
|
+
listener: TransactionListener<Schemas>,
|
|
4352
|
+
listenerDeps?: React.DependencyList,
|
|
4353
|
+
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4354
|
+
) => void;
|
|
4355
|
+
|
|
4356
|
+
/**
|
|
4357
|
+
* The useWillFinishTransactionListener hook registers a listener function with
|
|
4358
|
+
* a Store that will be called just before other non-mutating listeners are
|
|
4359
|
+
* called at the end of the transaction.
|
|
4360
|
+
*
|
|
4361
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
4362
|
+
*
|
|
4363
|
+
* ```ts override
|
|
4364
|
+
* useWillFinishTransactionListener(
|
|
4365
|
+
* listener: TransactionListener,
|
|
4366
|
+
* listenerDeps?: React.DependencyList,
|
|
4367
|
+
* storeOrStoreId?: StoreOrStoreId,
|
|
4368
|
+
* ): void;
|
|
4369
|
+
* ```
|
|
4370
|
+
*
|
|
4371
|
+
* Unlike the addWillFinisTransactionListener method, which returns a listener
|
|
4372
|
+
* Id and requires you to remove it manually, the
|
|
4373
|
+
* useWillFinishTransactionListener hook manages this lifecycle for you: when
|
|
4374
|
+
* the listener changes (per its `listenerDeps` dependencies) or the component
|
|
4375
|
+
* unmounts, the listener on the underlying Store will be deleted.
|
|
4376
|
+
* @param listener The function that will be called before the end of a
|
|
4377
|
+
* transaction.
|
|
4378
|
+
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
4379
|
+
* function, which, if any change, result in the re-registration of the
|
|
4380
|
+
* listener. This parameter defaults to an empty array.
|
|
4381
|
+
* @param storeOrStoreId The Store to register the listener with: omit for the
|
|
4382
|
+
* default context Store, provide an Id for a named context Store, or provide an
|
|
4383
|
+
* explicit reference.
|
|
4384
|
+
* @example
|
|
4385
|
+
* This example uses the useWillFinishTransactionListener hook to create a
|
|
4386
|
+
* listener that is scoped to a single component. When the component is
|
|
4387
|
+
* unmounted, the listener is removed from the Store.
|
|
4388
|
+
*
|
|
4389
|
+
* ```jsx
|
|
4390
|
+
* const App = ({store}) => (
|
|
4391
|
+
* <Provider store={store}>
|
|
4392
|
+
* <Pane />
|
|
4393
|
+
* </Provider>
|
|
4394
|
+
* );
|
|
4395
|
+
* const Pane = () => {
|
|
4396
|
+
* useWillFinishTransactionListener(
|
|
4397
|
+
* () => console.log('Will finish transaction'),
|
|
4398
|
+
* );
|
|
4399
|
+
* return <span>App</span>;
|
|
4400
|
+
* };
|
|
4401
|
+
*
|
|
4402
|
+
* const store = createStore();
|
|
4403
|
+
* const app = document.createElement('div');
|
|
4404
|
+
* const root = ReactDOMClient.createRoot(app);
|
|
4405
|
+
* root.render(<App store={store} />); // !act
|
|
4406
|
+
* console.log(store.getListenerStats().transaction);
|
|
4407
|
+
* // -> 1
|
|
4408
|
+
*
|
|
4409
|
+
* store.setValue('open', false); // !act
|
|
4410
|
+
* // -> 'Will finish transaction'
|
|
4411
|
+
*
|
|
4412
|
+
* root.unmount(); // !act
|
|
4413
|
+
* console.log(store.getListenerStats().transaction);
|
|
4414
|
+
* // -> 0
|
|
4415
|
+
* ```
|
|
4416
|
+
* @category Store hooks
|
|
4417
|
+
* @since v4.2.2
|
|
4418
|
+
*/
|
|
4419
|
+
useWillFinishTransactionListener: (
|
|
4420
|
+
listener: TransactionListener<Schemas>,
|
|
4421
|
+
listenerDeps?: React.DependencyList,
|
|
4422
|
+
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4423
|
+
) => void;
|
|
4424
|
+
|
|
4425
|
+
/**
|
|
4426
|
+
* The useDidFinishTransactionListener hook registers a listener function with a
|
|
4427
|
+
* Store that will be called just after other non-mutating listeners are called
|
|
4428
|
+
* at the end of the transaction.
|
|
4429
|
+
*
|
|
4430
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
4431
|
+
*
|
|
4432
|
+
* ```ts override
|
|
4433
|
+
* useDidFinishTransactionListener(
|
|
4434
|
+
* listener: TransactionListener,
|
|
4435
|
+
* listenerDeps?: React.DependencyList,
|
|
4436
|
+
* storeOrStoreId?: StoreOrStoreId,
|
|
4437
|
+
* ): void;
|
|
4438
|
+
* ```
|
|
4439
|
+
*
|
|
4440
|
+
* Unlike the addDidFinishTransactionListener method, which returns a listener
|
|
4441
|
+
* Id and requires you to remove it manually, the
|
|
4442
|
+
* useDidFinishTransactionListener hook manages this lifecycle for you: when the
|
|
4443
|
+
* listener changes (per its `listenerDeps` dependencies) or the component
|
|
4444
|
+
* unmounts, the listener on the underlying Store will be deleted.
|
|
4445
|
+
* @param listener The function that will be called after the end of a
|
|
4446
|
+
* transaction.
|
|
4447
|
+
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
4448
|
+
* function, which, if any change, result in the re-registration of the
|
|
4449
|
+
* listener. This parameter defaults to an empty array.
|
|
4450
|
+
* @param storeOrStoreId The Store to register the listener with: omit for the
|
|
4451
|
+
* default context Store, provide an Id for a named context Store, or provide an
|
|
4452
|
+
* explicit reference.
|
|
4453
|
+
* @example
|
|
4454
|
+
* This example uses the useDidFinishTransactionListener hook to create a
|
|
4455
|
+
* listener that is scoped to a single component. When the component is
|
|
4456
|
+
* unmounted, the listener is removed from the Store.
|
|
4457
|
+
*
|
|
4458
|
+
* ```jsx
|
|
4459
|
+
* const App = ({store}) => (
|
|
4460
|
+
* <Provider store={store}>
|
|
4461
|
+
* <Pane />
|
|
4462
|
+
* </Provider>
|
|
4463
|
+
* );
|
|
4464
|
+
* const Pane = () => {
|
|
4465
|
+
* useDidFinishTransactionListener(
|
|
4466
|
+
* () => console.log('Did finish transaction'),
|
|
4467
|
+
* );
|
|
4468
|
+
* return <span>App</span>;
|
|
4469
|
+
* };
|
|
4470
|
+
*
|
|
4471
|
+
* const store = createStore();
|
|
4472
|
+
* const app = document.createElement('div');
|
|
4473
|
+
* const root = ReactDOMClient.createRoot(app);
|
|
4474
|
+
* root.render(<App store={store} />); // !act
|
|
4475
|
+
* console.log(store.getListenerStats().transaction);
|
|
4476
|
+
* // -> 1
|
|
4477
|
+
*
|
|
4478
|
+
* store.setValue('open', false); // !act
|
|
4479
|
+
* // -> 'Did finish transaction'
|
|
4480
|
+
*
|
|
4481
|
+
* root.unmount(); // !act
|
|
4482
|
+
* console.log(store.getListenerStats().transaction);
|
|
4483
|
+
* // -> 0
|
|
4484
|
+
* ```
|
|
4485
|
+
* @category Store hooks
|
|
4486
|
+
* @since v4.2.2
|
|
4487
|
+
*/
|
|
4488
|
+
useDidFinishTransactionListener: (
|
|
4489
|
+
listener: TransactionListener<Schemas>,
|
|
4490
|
+
listenerDeps?: React.DependencyList,
|
|
4491
|
+
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4492
|
+
) => void;
|
|
4493
|
+
|
|
4289
4494
|
/**
|
|
4290
4495
|
* The useCreateMetrics hook is used to create a Metrics object within a React
|
|
4291
4496
|
* application with convenient memoization.
|
package/lib/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as t}from"react";const o=e=>typeof e,s="",r=o(s),d="Result",n="Ids",I="Table",u=I+"s",l=I+n,i="Row",c=i+"Count",a=i+n,p="Sorted"+i+n,g="Cell",b=g+n,C="Value",m=C+"s",k=C+n,y=e=>null==e,w=(e,t,o)=>y(e)?o?.():t(e),h=e=>o(e)==r,R=()=>{},v=(e,t)=>e.map(t),q=Object.keys,{createContext:P,useContext:f}=e,x=P([]),S=(e,t)=>{const o=f(x);return y(e)?o[t]:h(e)?((e,t)=>w(e,(e=>e[t])))(o[t+1]??{},e):e},L=(e,t)=>{const o=S(e,t);return y(e)||h(e)?o:e},B=e=>q(f(x)[e]??{}),T=e=>S(e,0),M=e=>L(e,0),E=e=>S(e,2),V=e=>L(e,2),A=e=>S(e,4),F=e=>L(e,4),j=e=>S(e,6),O=e=>L(e,6),Q=e=>S(e,8),z=e=>L(e,8),D=e=>S(e,10),G=e=>L(e,10),{useCallback:H,useEffect:J,useMemo:K,useRef:N,useState:U}=e,W=(e,t,o=[])=>{const s=K((()=>t(e)),[e,...o]);return J((()=>()=>s.destroy()),[s]),s},X=(e,t,o,s=[],r)=>{const[,d]=U(),n=H((()=>t?.["get"+e]?.(...s)??o),[t,...s]),[I]=U(n),u=N(I);return K((()=>u.current=n()),[n]),Y(e,t,((...e)=>{u.current=y(r)?n():e[r],d([])}),[],s),u.current},Y=(e,t,o,s=[],r=[],...d)=>J((()=>{const s=t?.["add"+e+"Listener"]?.(...r,o,...d);return()=>t?.delListener(s)}),[t,...r,...s,...d]),Z=(e,t,o,s=[],r=R,d=[],...n)=>{const I=M(e);return H((e=>w(I,(s=>w(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[I,t,...s,...d,...n])},$=(e,t,o=R,s=[],...r)=>{const d=M(e);return H((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},_=(e,t,o)=>{const s=G(e);return H((()=>s?.[t](o)),[s,t,o])},ee=(e,t=[])=>K(e,t),te=()=>B(1),oe=e=>X(u,M(e),{}),se=e=>X(l,M(e),[],[]),re=(e,t)=>X(I,M(t),{},[e]),de=(e,t)=>X(I+b,M(t),[],[e]),ne=(e,t)=>X(c,M(t),[],[e]),Ie=(e,t)=>X(a,M(t),[],[e]),ue=(e,t,o,s=0,r,d)=>X(p,M(d),[],[e,t,o,s,r],6),le=(e,t,o)=>X(i,M(o),{},[e,t]),ie=(e,t,o)=>X(b,M(o),[],[e,t]),ce=(e,t,o,s)=>X(g,M(s),void 0,[e,t,o],4),ae=e=>X(m,M(e),{}),pe=e=>X(k,M(e),[],[]),ge=(e,t)=>X(C,M(t),void 0,[e]),be=(e,t,o,s,r)=>Z(o,u,e,t,s,r),Ce=(e,t,o,s,r,d)=>Z(s,I,t,o,r,d,e),me=(e,t,o,s,r,d,n)=>Z(r,i,o,s,d,n,e,t),ke=(e,t,o=[],s,r=R,d=[],n=!0)=>{const I=M(s);return H((o=>w(I,(s=>w(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[I,e,...o,...d,n])},ye=(e,t,o,s,r,d,n)=>Z(r,"PartialRow",o,s,d,n,e,t),we=(e,t,o,s,r,d,n,I)=>Z(d,g,s,r,n,I,e,t,o),he=(e,t,o,s,r)=>Z(o,m,e,t,s,r),Re=(e,t,o,s,r)=>Z(o,"PartialValues",e,t,s,r),ve=(e,t,o,s,r,d)=>Z(s,C,t,o,r,d,e),qe=(e,t,o)=>$(e,u,t,o),Pe=(e,t,o,s)=>$(t,I,o,s,e),fe=(e,t,o,s,r)=>$(o,i,s,r,e,t),xe=(e,t,o,s,r,d,n)=>$(r,g,d,n,e,t,o,s),Se=(e,t,o)=>$(e,m,t,o),Le=(e,t,o,s)=>$(t,C,o,s,e),Be=(e,t,o,s)=>Y(u,M(s),e,t,[],o),Te=(e,t,o,s)=>Y(l,M(s),e,t,[],o),Me=(e,t,o,s,r)=>Y(I,M(r),t,o,[e],s),Ee=(e,t,o,s,r)=>Y(I+b,M(r),t,o,[e],s),Ve=(e,t,o,s,r)=>Y(c,M(r),t,o,[e],s),Ae=(e,t,o,s,r)=>Y(a,M(r),t,o,[e],s),Fe=(e,t,o,s,r,d,n,I,u)=>Y(p,M(u),d,n,[e,t,o,s,r],I),je=(e,t,o,s,r,d)=>Y(i,M(d),o,s,[e,t],r),Oe=(e,t,o,s,r,d)=>Y(b,M(d),o,s,[e,t],r),Qe=(e,t,o,s,r,d,n)=>Y(g,M(n),s,r,[e,t,o],d),ze=(e,t,o,s)=>Y(m,M(s),e,t,[],o),De=(e,t,o,s)=>Y(k,M(s),e,t,[],o),Ge=(e,t,o,s,r)=>Y(C,M(r),t,o,[e],s),He=(e,t,o)=>W(e,t,o),Je=()=>B(3),Ke=e=>X("MetricIds",V(e),[]),Ne=(e,t)=>X("Metric",V(t),void 0,[e]),Ue=(e,t,o,s)=>Y("Metric",V(s),t,o,[e]),We=(e,t,o)=>W(e,t,o),Xe=()=>B(5),Ye=(e,t)=>X("SliceIds",F(t),[],[e]),Ze=e=>X("IndexIds",F(e),[]),$e=(e,t,o)=>X("Slice"+a,F(o),[],[e,t]),_e=(e,t,o,s)=>Y("SliceIds",F(s),t,o,[e]),et=(e,t,o,s,r)=>Y("Slice"+a,F(r),o,s,[e,t]),tt=(e,t,o)=>W(e,t,o),ot=()=>B(7),st=e=>X("RelationshipIds",O(e),[]),rt=(e,t,o)=>X("RemoteRowId",O(o),void 0,[e,t]),dt=(e,t,o)=>X("Local"+a,O(o),[],[e,t]),nt=(e,t,o)=>X("Linked"+a,O(o),[],[e,t]),It=(e,t,o,s,r)=>Y("RemoteRowId",O(r),o,s,[e,t]),ut=(e,t,o,s,r)=>Y("Local"+a,O(r),o,s,[e,t]),lt=(e,t,o,s,r)=>Y("Linked"+a,O(r),o,s,[e,t]),it=(e,t,o)=>W(e,t,o),ct=()=>B(9),at=e=>X("QueryIds",z(e),[]),pt=(e,t)=>X(d+I,z(t),{},[e]),gt=(e,t)=>X(d+I+b,z(t),[],[e]),bt=(e,t)=>X(d+c,z(t),[],[e]),Ct=(e,t)=>X(d+a,z(t),[],[e]),mt=(e,t,o,s=0,r,n)=>X(d+p,z(n),[],[e,t,o,s,r],6),kt=(e,t,o)=>X(d+i,z(o),{},[e,t]),yt=(e,t,o)=>X(d+b,z(o),[],[e,t]),wt=(e,t,o,s)=>X(d+g,z(s),void 0,[e,t,o]),ht=(e,t,o,s)=>Y(d+I,z(s),t,o,[e]),Rt=(e,t,o,s)=>Y(d+I+b,z(s),t,o,[e]),vt=(e,t,o,s)=>Y(d+c,z(s),t,o,[e]),qt=(e,t,o,s)=>Y(d+a,z(s),t,o,[e]),Pt=(e,t,o,s,r,n,I,u)=>Y(d+p,z(u),n,I,[e,t,o,s,r]),ft=(e,t,o,s,r)=>Y(d+i,z(r),o,s,[e,t]),xt=(e,t,o,s,r)=>Y(d+b,z(r),o,s,[e,t]),St=(e,t,o,s,r,n)=>Y(d+g,z(n),s,r,[e,t,o]),Lt=(e,t,o)=>W(e,t,o),Bt=()=>B(11),Tt=e=>X("CheckpointIds",G(e),[[],void 0,[]]),Mt=(e,t)=>X("Checkpoint",G(t),void 0,[e]),Et=(e=R,t=[],o,s=R,r=[])=>{const d=G(o);return H((t=>w(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Vt=e=>_(e,"goBackward"),At=e=>_(e,"goForward"),Ft=(e,t=[],o,s=R,r=[])=>{const d=G(o);return H((t=>w(d,(o=>w(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},jt=e=>{const t=G(e),[o,r]=Tt(t);return[(d=o,!(0==(e=>e.length)(d))),Vt(t),r,w(r,(e=>t?.getCheckpoint(e)))??s];var d},Ot=e=>{const t=G(e),[,,[o]]=Tt(t);return[!y(o),At(t),o,w(o,(e=>t?.getCheckpoint(e)))??s]},Qt=(e,t,o)=>Y("CheckpointIds",G(o),e,t),zt=(e,t,o,s)=>Y("Checkpoint",G(s),t,o,[e]),Dt=(e,t,o=[],s,r=[])=>{const[,d]=U(),n=K((()=>t(e)),[e,...o]);return J((()=>((async()=>{await(s?.(n)),d(1)})(),()=>{n.destroy()})),[n,...r]),n},{PureComponent:Gt,Fragment:Ht,createElement:Jt,useCallback:Kt,useLayoutEffect:Nt,useRef:Ut,useState:Wt}=e,Xt=(e,...t)=>y(e)?{}:e(...t),Yt=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useMemo:Zt}=e,$t=({tableId:e,store:t,rowComponent:o=no,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},I)=>so(v(I,(d=>Jt(o,{...Xt(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),_t=({queryId:e,queries:t,resultRowComponent:o=yo,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>so(v(n,(r=>Jt(o,{...Xt(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),eo=({relationshipId:e,relationships:t,rowComponent:o=no,getRowComponentProps:s,separator:r,debugIds:d},n,I)=>{const[u,l,i]=Yt(O(t),e),c=n(e,I,u);return so(v(c,(e=>Jt(o,{...Xt(s,e),key:e,tableId:i,rowId:e,store:l,debugIds:d}))),r,d,I)},to=e=>({checkpoints:t,checkpointComponent:o=Ro,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=G(t);return so(v(e(Tt(n)),(e=>Jt(o,{...Xt(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},oo=({store:e,storesById:o,metrics:s,metricsById:r,indexes:d,indexesById:n,relationships:I,relationshipsById:u,queries:l,queriesById:i,checkpoints:c,checkpointsById:a,children:p})=>{const g=t(x);return Jt(x.Provider,{value:Zt((()=>[e??g[0],{...g[1],...o},s??g[2],{...g[3],...r},d??g[4],{...g[5],...n},I??g[6],{...g[7],...u},l??g[8],{...g[9],...i},c??g[10],{...g[11],...a}]),[e,o,s,r,d,n,I,u,l,i,c,a,g])},p)},so=(e,t,o,s)=>{const r=y(t)||!Array.isArray(e)?e:v(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},ro=({tableId:e,rowId:t,cellId:o,store:r,debugIds:d})=>so(s+(ce(e,t,o,r)??s),void 0,d,o),no=({tableId:e,rowId:t,store:o,cellComponent:s=ro,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:I})=>so(v(((e,t,o,s)=>{const r=ie(t,o,s);return e??r})(d,e,t,o),(d=>Jt(s,{...Xt(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:I}))),n,I,t),Io=e=>$t(e,Ie(e.tableId,e.store)),uo=({cellId:e,descending:t,offset:o,limit:s,...r})=>$t(r,ue(r.tableId,e,t,o,s,r.store)),lo=({store:e,tableComponent:t=Io,getTableComponentProps:o,separator:s,debugIds:r})=>so(v(se(e),(s=>Jt(t,{...Xt(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),io=({valueId:e,store:t,debugIds:o})=>so(s+(ge(e,t)??s),void 0,o,e),co=({store:e,valueComponent:t=io,getValueComponentProps:o,separator:s,debugIds:r})=>so(v(pe(e),(s=>Jt(t,{...Xt(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ao=({metricId:e,metrics:t,debugIds:o})=>so(Ne(e,t)??s,void 0,o,e),po=({indexId:e,sliceId:t,indexes:o,rowComponent:s=no,getRowComponentProps:r,separator:d,debugIds:n})=>{const[I,u,l]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(F(o),e),i=$e(e,t,I);return so(v(i,(e=>Jt(s,{...Xt(r,e),key:e,tableId:l,rowId:e,store:u,debugIds:n}))),d,n,t)},go=({indexId:e,indexes:t,sliceComponent:o=po,getSliceComponentProps:s,separator:r,debugIds:d})=>so(v(Ye(e,t),(r=>Jt(o,{...Xt(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),bo=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=no,getRowComponentProps:r,debugIds:d})=>{const[n,I,,u]=Yt(O(o),e),l=rt(e,t,n);return so(y(u)||y(l)?null:Jt(s,{...Xt(r,l),key:l,tableId:u,rowId:l,store:I,debugIds:d}),void 0,d,t)},Co=e=>eo(e,dt,e.remoteRowId),mo=e=>eo(e,nt,e.firstRowId),ko=({queryId:e,rowId:t,cellId:o,queries:r,debugIds:d})=>so(s+(wt(e,t,o,r)??s),void 0,d,o),yo=({queryId:e,rowId:t,queries:o,resultCellComponent:s=ko,getResultCellComponentProps:r,separator:d,debugIds:n})=>so(v(yt(e,t,o),(d=>Jt(s,{...Xt(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),wo=e=>_t(e,Ct(e.queryId,e.queries)),ho=({cellId:e,descending:t,offset:o,limit:s,...r})=>_t(r,mt(r.queryId,e,t,o,s,r.queries)),Ro=({checkpoints:e,checkpointId:t,debugIds:o})=>so(Mt(t,e)??s,void 0,o,t),vo=to((e=>e[0])),qo=to((e=>y(e[1])?[]:[e[1]])),Po=to((e=>e[2]));export{vo as BackwardCheckpointsView,ro as CellView,Ro as CheckpointView,qo as CurrentCheckpointView,Po as ForwardCheckpointsView,go as IndexView,mo as LinkedRowsView,Co as LocalRowsView,ao as MetricView,oo as Provider,bo as RemoteRowView,ko as ResultCellView,yo as ResultRowView,ho as ResultSortedTableView,wo as ResultTableView,no as RowView,po as SliceView,uo as SortedTableView,Io as TableView,lo as TablesView,io as ValueView,co as ValuesView,ke as useAddRowCallback,ce as useCell,ie as useCellIds,Oe as useCellIdsListener,Qe as useCellListener,Mt as useCheckpoint,Tt as useCheckpointIds,Qt as useCheckpointIdsListener,zt as useCheckpointListener,D as useCheckpoints,Bt as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Lt as useCreateCheckpoints,We as useCreateIndexes,He as useCreateMetrics,Dt as useCreatePersister,it as useCreateQueries,tt as useCreateRelationships,ee as useCreateStore,xe as useDelCellCallback,fe as useDelRowCallback,Pe as useDelTableCallback,qe as useDelTablesCallback,Le as useDelValueCallback,Se as useDelValuesCallback,Vt as useGoBackwardCallback,At as useGoForwardCallback,Ft as useGoToCallback,Ze as useIndexIds,A as useIndexes,Xe as useIndexesIds,F as useIndexesOrIndexesById,nt as useLinkedRowIds,lt as useLinkedRowIdsListener,dt as useLocalRowIds,ut as useLocalRowIdsListener,Ne as useMetric,Ke as useMetricIds,Ue as useMetricListener,E as useMetrics,Je as useMetricsIds,V as useMetricsOrMetricsById,Q as useQueries,ct as useQueriesIds,z as useQueriesOrQueriesById,at as useQueryIds,Ot as useRedoInformation,st as useRelationshipIds,j as useRelationships,ot as useRelationshipsIds,O as useRelationshipsOrRelationshipsById,rt as useRemoteRowId,It as useRemoteRowIdListener,wt as useResultCell,yt as useResultCellIds,xt as useResultCellIdsListener,St as useResultCellListener,kt as useResultRow,bt as useResultRowCount,vt as useResultRowCountListener,Ct as useResultRowIds,qt as useResultRowIdsListener,ft as useResultRowListener,mt as useResultSortedRowIds,Pt as useResultSortedRowIdsListener,pt as useResultTable,gt as useResultTableCellIds,Rt as useResultTableCellIdsListener,ht as useResultTableListener,le as useRow,ne as useRowCount,Ve as useRowCountListener,Ie as useRowIds,Ae as useRowIdsListener,je as useRowListener,we as useSetCellCallback,Et as useSetCheckpointCallback,ye as useSetPartialRowCallback,Re as useSetPartialValuesCallback,me as useSetRowCallback,Ce as useSetTableCallback,be as useSetTablesCallback,ve as useSetValueCallback,he as useSetValuesCallback,Ye as useSliceIds,_e as useSliceIdsListener,$e as useSliceRowIds,et as useSliceRowIdsListener,ue as useSortedRowIds,Fe as useSortedRowIdsListener,T as useStore,te as useStoreIds,M as useStoreOrStoreById,re as useTable,de as useTableCellIds,Ee as useTableCellIdsListener,se as useTableIds,Te as useTableIdsListener,Me as useTableListener,oe as useTables,Be as useTablesListener,jt as useUndoInformation,ge as useValue,pe as useValueIds,De as useValueIdsListener,Ge as useValueListener,ae as useValues,ze as useValuesListener};
|
|
1
|
+
import e,{useContext as t}from"react";const o=e=>typeof e,s="",r=o(s),d="Listener",n="Result",I="Ids",i="Table",u=i+"s",l=i+I,c="Row",a=c+"Count",p=c+I,g="Sorted"+c+I,b="Cell",C=b+I,m="Value",k=m+"s",w=m+I,y=e=>null==e,h=(e,t,o)=>y(e)?o?.():t(e),R=e=>o(e)==r,v=()=>{},q=(e,t)=>e.map(t),P=Object.keys,{createContext:f,useContext:x}=e,S=f([]),L=(e,t)=>{const o=x(S);return y(e)?o[t]:R(e)?((e,t)=>h(e,(e=>e[t])))(o[t+1]??{},e):e},B=(e,t)=>{const o=L(e,t);return y(e)||R(e)?o:e},T=e=>P(x(S)[e]??{}),M=e=>L(e,0),F=e=>B(e,0),E=e=>L(e,2),V=e=>B(e,2),A=e=>L(e,4),j=e=>B(e,4),D=e=>L(e,6),O=e=>B(e,6),Q=e=>L(e,8),W=e=>B(e,8),z=e=>L(e,10),G=e=>B(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 s=U((()=>t(e)),[e,...o]);return N((()=>()=>s.destroy()),[s]),s},$=(e,t,o,s=[],r)=>{const[,d]=Y(),n=K((()=>t?.["get"+e]?.(...s)??o),[t,...s]),[I]=Y(n),i=X(I);return U((()=>i.current=n()),[n]),_(e,t,((...e)=>{i.current=y(r)?n():e[r],d([])}),[],s),i.current},_=(e,t,o,s=[],r=[],...n)=>N((()=>{const s=t?.["add"+e+d]?.(...r,o,...n);return()=>t?.delListener(s)}),[t,...r,...s,...n]),ee=(e,t,o,s=[],r=v,d=[],...n)=>{const I=F(e);return K((e=>h(I,(s=>h(o(e,s),(e=>r(s["set"+t](...n,e),e)))))),[I,t,...s,...d,...n])},te=(e,t,o=v,s=[],...r)=>{const d=F(e);return K((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},oe=(e,t,o)=>{const s=G(e);return K((()=>s?.[t](o)),[s,t,o])},se=(e,t=[])=>U(e,t),re=()=>T(1),de=e=>$(u,F(e),{}),ne=e=>$(l,F(e),[],[]),Ie=(e,t)=>$(i,F(t),{},[e]),ie=(e,t)=>$(i+C,F(t),[],[e]),ue=(e,t)=>$(a,F(t),[],[e]),le=(e,t)=>$(p,F(t),[],[e]),ce=(e,t,o,s=0,r,d)=>$(g,F(d),[],[e,t,o,s,r],6),ae=(e,t,o)=>$(c,F(o),{},[e,t]),pe=(e,t,o)=>$(C,F(o),[],[e,t]),ge=(e,t,o,s)=>$(b,F(s),void 0,[e,t,o],4),be=e=>$(k,F(e),{}),Ce=e=>$(w,F(e),[],[]),me=(e,t)=>$(m,F(t),void 0,[e]),ke=(e,t,o,s,r)=>ee(o,u,e,t,s,r),we=(e,t,o,s,r,d)=>ee(s,i,t,o,r,d,e),ye=(e,t,o,s,r,d,n)=>ee(r,c,o,s,d,n,e,t),he=(e,t,o=[],s,r=v,d=[],n=!0)=>{const I=F(s);return K((o=>h(I,(s=>h(t(o,s),(t=>r(s.addRow(e,t,n),s,t)))))),[I,e,...o,...d,n])},Re=(e,t,o,s,r,d,n)=>ee(r,"PartialRow",o,s,d,n,e,t),ve=(e,t,o,s,r,d,n,I)=>ee(d,b,s,r,n,I,e,t,o),qe=(e,t,o,s,r)=>ee(o,k,e,t,s,r),Pe=(e,t,o,s,r)=>ee(o,"PartialValues",e,t,s,r),fe=(e,t,o,s,r,d)=>ee(s,m,t,o,r,d,e),xe=(e,t,o)=>te(e,u,t,o),Se=(e,t,o,s)=>te(t,i,o,s,e),Le=(e,t,o,s,r)=>te(o,c,s,r,e,t),Be=(e,t,o,s,r,d,n)=>te(r,b,d,n,e,t,o,s),Te=(e,t,o)=>te(e,k,t,o),Me=(e,t,o,s)=>te(t,m,o,s,e),Fe=(e,t,o,s)=>_(u,F(s),e,t,[],o),Ee=(e,t,o,s)=>_(l,F(s),e,t,[],o),Ve=(e,t,o,s,r)=>_(i,F(r),t,o,[e],s),Ae=(e,t,o,s,r)=>_(i+C,F(r),t,o,[e],s),je=(e,t,o,s,r)=>_(a,F(r),t,o,[e],s),De=(e,t,o,s,r)=>_(p,F(r),t,o,[e],s),Oe=(e,t,o,s,r,d,n,I,i)=>_(g,F(i),d,n,[e,t,o,s,r],I),Qe=(e,t,o,s,r,d)=>_(c,F(d),o,s,[e,t],r),We=(e,t,o,s,r,d)=>_(C,F(d),o,s,[e,t],r),ze=(e,t,o,s,r,d,n)=>_(b,F(n),s,r,[e,t,o],d),Ge=(e,t,o,s)=>_(k,F(s),e,t,[],o),He=(e,t,o,s)=>_(w,F(s),e,t,[],o),Je=(e,t,o,s,r)=>_(m,F(r),t,o,[e],s),Ke=(e,t,o)=>_("Start"+J,F(o),e,t),Ne=(e,t,o)=>_("WillFinish"+J,F(o),e,t),Ue=(e,t,o)=>_("DidFinish"+J,F(o),e,t),Xe=(e,t,o)=>Z(e,t,o),Ye=()=>T(3),Ze=e=>$("MetricIds",V(e),[]),$e=(e,t)=>$("Metric",V(t),void 0,[e]),_e=(e,t,o,s)=>_("Metric",V(s),t,o,[e]),et=(e,t,o)=>Z(e,t,o),tt=()=>T(5),ot=(e,t)=>$("SliceIds",j(t),[],[e]),st=e=>$("IndexIds",j(e),[]),rt=(e,t,o)=>$("Slice"+p,j(o),[],[e,t]),dt=(e,t,o,s)=>_("SliceIds",j(s),t,o,[e]),nt=(e,t,o,s,r)=>_("Slice"+p,j(r),o,s,[e,t]),It=(e,t,o)=>Z(e,t,o),it=()=>T(7),ut=e=>$("RelationshipIds",O(e),[]),lt=(e,t,o)=>$("RemoteRowId",O(o),void 0,[e,t]),ct=(e,t,o)=>$("Local"+p,O(o),[],[e,t]),at=(e,t,o)=>$("Linked"+p,O(o),[],[e,t]),pt=(e,t,o,s,r)=>_("RemoteRowId",O(r),o,s,[e,t]),gt=(e,t,o,s,r)=>_("Local"+p,O(r),o,s,[e,t]),bt=(e,t,o,s,r)=>_("Linked"+p,O(r),o,s,[e,t]),Ct=(e,t,o)=>Z(e,t,o),mt=()=>T(9),kt=e=>$("QueryIds",W(e),[]),wt=(e,t)=>$(n+i,W(t),{},[e]),yt=(e,t)=>$(n+i+C,W(t),[],[e]),ht=(e,t)=>$(n+a,W(t),[],[e]),Rt=(e,t)=>$(n+p,W(t),[],[e]),vt=(e,t,o,s=0,r,d)=>$(n+g,W(d),[],[e,t,o,s,r],6),qt=(e,t,o)=>$(n+c,W(o),{},[e,t]),Pt=(e,t,o)=>$(n+C,W(o),[],[e,t]),ft=(e,t,o,s)=>$(n+b,W(s),void 0,[e,t,o]),xt=(e,t,o,s)=>_(n+i,W(s),t,o,[e]),St=(e,t,o,s)=>_(n+i+C,W(s),t,o,[e]),Lt=(e,t,o,s)=>_(n+a,W(s),t,o,[e]),Bt=(e,t,o,s)=>_(n+p,W(s),t,o,[e]),Tt=(e,t,o,s,r,d,I,i)=>_(n+g,W(i),d,I,[e,t,o,s,r]),Mt=(e,t,o,s,r)=>_(n+c,W(r),o,s,[e,t]),Ft=(e,t,o,s,r)=>_(n+C,W(r),o,s,[e,t]),Et=(e,t,o,s,r,d)=>_(n+b,W(d),s,r,[e,t,o]),Vt=(e,t,o)=>Z(e,t,o),At=()=>T(11),jt=e=>$("CheckpointIds",G(e),[[],void 0,[]]),Dt=(e,t)=>$("Checkpoint",G(t),void 0,[e]),Ot=(e=v,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},Qt=e=>oe(e,"goBackward"),Wt=e=>oe(e,"goForward"),zt=(e,t=[],o,s=v,r=[])=>{const d=G(o);return K((t=>h(d,(o=>h(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Gt=e=>{const t=G(e),[o,r]=jt(t);return[(d=o,!(0==(e=>e.length)(d))),Qt(t),r,h(r,(e=>t?.getCheckpoint(e)))??s];var d},Ht=e=>{const t=G(e),[,,[o]]=jt(t);return[!y(o),Wt(t),o,h(o,(e=>t?.getCheckpoint(e)))??s]},Jt=(e,t,o)=>_("CheckpointIds",G(o),e,t),Kt=(e,t,o,s)=>_("Checkpoint",G(s),t,o,[e]),Nt=(e,t,o=[],s,r=[])=>{const[,d]=Y(),n=U((()=>t(e)),[e,...o]);return N((()=>((async()=>{await(s?.(n)),d(1)})(),()=>{n.destroy()})),[n,...r]),n},{PureComponent:Ut,Fragment:Xt,createElement:Yt,useCallback:Zt,useLayoutEffect:$t,useRef:_t,useState:eo}=e,to=(e,...t)=>y(e)?{}:e(...t),oo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useMemo:so}=e,ro=({tableId:e,store:t,rowComponent:o=ao,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},I)=>lo(q(I,(d=>Yt(o,{...to(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),no=({queryId:e,queries:t,resultRowComponent:o=Po,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>lo(q(n,(r=>Yt(o,{...to(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Io=({relationshipId:e,relationships:t,rowComponent:o=ao,getRowComponentProps:s,separator:r,debugIds:d},n,I)=>{const[i,u,l]=oo(O(t),e),c=n(e,I,i);return lo(q(c,(e=>Yt(o,{...to(s,e),key:e,tableId:l,rowId:e,store:u,debugIds:d}))),r,d,I)},io=e=>({checkpoints:t,checkpointComponent:o=So,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=G(t);return lo(q(e(jt(n)),(e=>Yt(o,{...to(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},uo=({store:e,storesById:o,metrics:s,metricsById:r,indexes:d,indexesById:n,relationships:I,relationshipsById:i,queries:u,queriesById:l,checkpoints:c,checkpointsById:a,children:p})=>{const g=t(S);return Yt(S.Provider,{value:so((()=>[e??g[0],{...g[1],...o},s??g[2],{...g[3],...r},d??g[4],{...g[5],...n},I??g[6],{...g[7],...i},u??g[8],{...g[9],...l},c??g[10],{...g[11],...a}]),[e,o,s,r,d,n,I,i,u,l,c,a,g])},p)},lo=(e,t,o,s)=>{const r=y(t)||!Array.isArray(e)?e:q(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},co=({tableId:e,rowId:t,cellId:o,store:r,debugIds:d})=>lo(s+(ge(e,t,o,r)??s),void 0,d,o),ao=({tableId:e,rowId:t,store:o,cellComponent:s=co,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:I})=>lo(q(((e,t,o,s)=>{const r=pe(t,o,s);return e??r})(d,e,t,o),(d=>Yt(s,{...to(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:I}))),n,I,t),po=e=>ro(e,le(e.tableId,e.store)),go=({cellId:e,descending:t,offset:o,limit:s,...r})=>ro(r,ce(r.tableId,e,t,o,s,r.store)),bo=({store:e,tableComponent:t=po,getTableComponentProps:o,separator:s,debugIds:r})=>lo(q(ne(e),(s=>Yt(t,{...to(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Co=({valueId:e,store:t,debugIds:o})=>lo(s+(me(e,t)??s),void 0,o,e),mo=({store:e,valueComponent:t=Co,getValueComponentProps:o,separator:s,debugIds:r})=>lo(q(Ce(e),(s=>Yt(t,{...to(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ko=({metricId:e,metrics:t,debugIds:o})=>lo($e(e,t)??s,void 0,o,e),wo=({indexId:e,sliceId:t,indexes:o,rowComponent:s=ao,getRowComponentProps:r,separator:d,debugIds:n})=>{const[I,i,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(j(o),e),l=rt(e,t,I);return lo(q(l,(e=>Yt(s,{...to(r,e),key:e,tableId:u,rowId:e,store:i,debugIds:n}))),d,n,t)},yo=({indexId:e,indexes:t,sliceComponent:o=wo,getSliceComponentProps:s,separator:r,debugIds:d})=>lo(q(ot(e,t),(r=>Yt(o,{...to(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),ho=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=ao,getRowComponentProps:r,debugIds:d})=>{const[n,I,,i]=oo(O(o),e),u=lt(e,t,n);return lo(y(i)||y(u)?null:Yt(s,{...to(r,u),key:u,tableId:i,rowId:u,store:I,debugIds:d}),void 0,d,t)},Ro=e=>Io(e,ct,e.remoteRowId),vo=e=>Io(e,at,e.firstRowId),qo=({queryId:e,rowId:t,cellId:o,queries:r,debugIds:d})=>lo(s+(ft(e,t,o,r)??s),void 0,d,o),Po=({queryId:e,rowId:t,queries:o,resultCellComponent:s=qo,getResultCellComponentProps:r,separator:d,debugIds:n})=>lo(q(Pt(e,t,o),(d=>Yt(s,{...to(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),fo=e=>no(e,Rt(e.queryId,e.queries)),xo=({cellId:e,descending:t,offset:o,limit:s,...r})=>no(r,vt(r.queryId,e,t,o,s,r.queries)),So=({checkpoints:e,checkpointId:t,debugIds:o})=>lo(Dt(t,e)??s,void 0,o,t),Lo=io((e=>e[0])),Bo=io((e=>y(e[1])?[]:[e[1]])),To=io((e=>e[2]));export{Lo as BackwardCheckpointsView,co as CellView,So as CheckpointView,Bo as CurrentCheckpointView,To as ForwardCheckpointsView,yo as IndexView,vo as LinkedRowsView,Ro as LocalRowsView,ko as MetricView,uo as Provider,ho as RemoteRowView,qo as ResultCellView,Po as ResultRowView,xo as ResultSortedTableView,fo as ResultTableView,ao as RowView,wo as SliceView,go as SortedTableView,po as TableView,bo as TablesView,Co as ValueView,mo as ValuesView,he as useAddRowCallback,ge as useCell,pe as useCellIds,We as useCellIdsListener,ze as useCellListener,Dt as useCheckpoint,jt as useCheckpointIds,Jt as useCheckpointIdsListener,Kt as useCheckpointListener,z as useCheckpoints,At as useCheckpointsIds,G as useCheckpointsOrCheckpointsById,Vt as useCreateCheckpoints,et as useCreateIndexes,Xe as useCreateMetrics,Nt as useCreatePersister,Ct as useCreateQueries,It as useCreateRelationships,se as useCreateStore,Be as useDelCellCallback,Le as useDelRowCallback,Se as useDelTableCallback,xe as useDelTablesCallback,Me as useDelValueCallback,Te as useDelValuesCallback,Ue as useDidFinishTransactionListener,Qt as useGoBackwardCallback,Wt as useGoForwardCallback,zt as useGoToCallback,st as useIndexIds,A as useIndexes,tt as useIndexesIds,j as useIndexesOrIndexesById,at as useLinkedRowIds,bt as useLinkedRowIdsListener,ct as useLocalRowIds,gt as useLocalRowIdsListener,$e as useMetric,Ze as useMetricIds,_e as useMetricListener,E as useMetrics,Ye as useMetricsIds,V as useMetricsOrMetricsById,Q as useQueries,mt as useQueriesIds,W as useQueriesOrQueriesById,kt as useQueryIds,Ht as useRedoInformation,ut as useRelationshipIds,D as useRelationships,it as useRelationshipsIds,O as useRelationshipsOrRelationshipsById,lt as useRemoteRowId,pt as useRemoteRowIdListener,ft as useResultCell,Pt as useResultCellIds,Ft as useResultCellIdsListener,Et as useResultCellListener,qt as useResultRow,ht as useResultRowCount,Lt as useResultRowCountListener,Rt as useResultRowIds,Bt as useResultRowIdsListener,Mt as useResultRowListener,vt as useResultSortedRowIds,Tt as useResultSortedRowIdsListener,wt as useResultTable,yt as useResultTableCellIds,St as useResultTableCellIdsListener,xt as useResultTableListener,ae as useRow,ue as useRowCount,je as useRowCountListener,le as useRowIds,De as useRowIdsListener,Qe as useRowListener,ve as useSetCellCallback,Ot as useSetCheckpointCallback,Re as useSetPartialRowCallback,Pe as useSetPartialValuesCallback,ye as useSetRowCallback,we as useSetTableCallback,ke as useSetTablesCallback,fe as useSetValueCallback,qe as useSetValuesCallback,ot as useSliceIds,dt as useSliceIdsListener,rt as useSliceRowIds,nt as useSliceRowIdsListener,ce as useSortedRowIds,Oe as useSortedRowIdsListener,Ke as useStartTransactionListener,M as useStore,re as useStoreIds,F as useStoreOrStoreById,Ie as useTable,ie as useTableCellIds,Ae as useTableCellIdsListener,ne as useTableIds,Ee as useTableIdsListener,Ve as useTableListener,de as useTables,Fe as useTablesListener,Gt as useUndoInformation,me as useValue,Ce as useValueIds,He as useValueIdsListener,Je as useValueListener,be as useValues,Ge as useValuesListener,Ne as useWillFinishTransactionListener};
|
package/lib/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/umd/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u="Result",d="Ids",l="Table",n=l+"s",i=l+d,a="Row",I=a+"Count",c=a+d,C="Sorted"+a+d,p="Cell",b=p+d,w="Value",R=w+"s",k=w+d,g=e=>null==e,h=(e,s,t)=>g(e)?t?.():s(e),m=e=>t(e)==r,y=()=>{},L=(e,s)=>e.map(s),V=Object.keys,{createContext:S,useContext:T}=s,f=S([]),x=(e,s)=>{const t=T(f);return g(e)?t[s]:m(e)?((e,s)=>h(e,(e=>e[s])))(t[s+1]??{},e):e},v=(e,s)=>{const t=x(e,s);return g(e)||m(e)?t:e},P=e=>V(T(f)[e]??{}),q=e=>v(e,0),B=e=>v(e,2),M=e=>v(e,4),O=e=>v(e,6),Q=e=>v(e,8),D=e=>v(e,10),{useCallback:F,useEffect:A,useMemo:E,useRef:G,useState:j}=s,U=(e,s,t=[])=>{const o=E((()=>s(e)),[e,...t]);return A((()=>()=>o.destroy()),[o]),o},z=(e,s,t,o=[],r)=>{const[,u]=j(),d=F((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=j(d),n=G(l);return E((()=>n.current=d()),[d]),H(e,s,((...e)=>{n.current=g(r)?d():e[r],u([])}),[],o),n.current},H=(e,s,t,o=[],r=[],...u)=>A((()=>{const o=s?.["add"+e+"Listener"]?.(...r,t,...u);return()=>s?.delListener(o)}),[s,...r,...o,...u]),J=(e,s,t,o=[],r=y,u=[],...d)=>{const l=q(e);return F((e=>h(l,(o=>h(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},K=(e,s,t=y,o=[],...r)=>{const u=q(e);return F((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},N=(e,s,t)=>{const o=D(e);return F((()=>o?.[s](t)),[o,s,t])},W=e=>z(i,q(e),[],[]),X=(e,s)=>z(c,q(s),[],[e]),Y=(e,s,t,o=0,r,u)=>z(C,q(u),[],[e,s,t,o,r],6),Z=(e,s,t)=>z(b,q(t),[],[e,s]),$=(e,s,t,o)=>z(p,q(o),void 0,[e,s,t],4),_=e=>z(k,q(e),[],[]),ee=(e,s)=>z(w,q(s),void 0,[e]),se=(e,s)=>z("Metric",B(s),void 0,[e]),te=(e,s)=>z("SliceIds",M(s),[],[e]),oe=(e,s,t)=>z("Slice"+c,M(t),[],[e,s]),re=(e,s,t)=>z("RemoteRowId",O(t),void 0,[e,s]),ue=(e,s,t)=>z("Local"+c,O(t),[],[e,s]),de=(e,s,t)=>z("Linked"+c,O(t),[],[e,s]),le=(e,s)=>z(u+c,Q(s),[],[e]),ne=(e,s,t,o=0,r,d)=>z(u+C,Q(d),[],[e,s,t,o,r],6),ie=(e,s,t)=>z(u+b,Q(t),[],[e,s]),ae=(e,s,t,o)=>z(u+p,Q(o),void 0,[e,s,t]),Ie=e=>z("CheckpointIds",D(e),[[],void 0,[]]),ce=(e,s)=>z("Checkpoint",D(s),void 0,[e]),Ce=e=>N(e,"goBackward"),pe=e=>N(e,"goForward"),{PureComponent:be,Fragment:we,createElement:Re,useCallback:ke,useLayoutEffect:ge,useRef:he,useState:me}=s,ye=(e,...s)=>g(e)?{}:e(...s),Le=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:Ve}=s,Se=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>ve(L(l,(u=>Re(t,{...ye(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),Te=({queryId:e,queries:s,resultRowComponent:t=De,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>ve(L(d,(r=>Re(t,{...ye(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),fe=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,i,a]=Le(O(s),e),I=d(e,l,n);return ve(L(I,(e=>Re(t,{...ye(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,l)},xe=e=>({checkpoints:s,checkpointComponent:t=Fe,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=D(s);return ve(L(e(Ie(d)),(e=>Re(t,{...ye(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},ve=(e,s,t,o)=>{const r=g(s)||!Array.isArray(e)?e:L(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Pe=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>ve(o+($(e,s,t,r)??o),void 0,u,t),qe=({tableId:e,rowId:s,store:t,cellComponent:o=Pe,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>ve(L(((e,s,t,o)=>{const r=Z(s,t,o);return e??r})(u,e,s,t),(u=>Re(o,{...ye(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Be=e=>Se(e,X(e.tableId,e.store)),Me=({valueId:e,store:s,debugIds:t})=>ve(o+(ee(e,s)??o),void 0,t,e),Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=qe,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(M(t),e),a=oe(e,s,l);return ve(L(a,(e=>Re(o,{...ye(r,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),u,d,s)},Qe=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>ve(o+(ae(e,s,t,r)??o),void 0,u,t),De=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Qe,getResultCellComponentProps:r,separator:u,debugIds:d})=>ve(L(ie(e,s,t),(u=>Re(o,{...ye(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Fe=({checkpoints:e,checkpointId:s,debugIds:t})=>ve(ce(s,e)??o,void 0,t,s),Ae=xe((e=>e[0])),Ee=xe((e=>g(e[1])?[]:[e[1]])),Ge=xe((e=>e[2]));e.BackwardCheckpointsView=Ae,e.CellView=Pe,e.CheckpointView=Fe,e.CurrentCheckpointView=Ee,e.ForwardCheckpointsView=Ge,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:r,debugIds:u})=>ve(L(te(e,s),(r=>Re(t,{...ye(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>fe(e,de,e.firstRowId),e.LocalRowsView=e=>fe(e,ue,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>ve(se(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:C})=>{const p=s.useContext(f);return Re(f.Provider,{value:Ve((()=>[e??p[0],{...p[1],...t},o??p[2],{...p[3],...r},u??p[4],{...p[5],...d},l??p[6],{...p[7],...n},i??p[8],{...p[9],...a},I??p[10],{...p[11],...c}]),[e,t,o,r,u,d,l,n,i,a,I,c,p])},C)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=qe,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Le(O(t),e),i=re(e,s,d);return ve(g(n)||g(i)?null:Re(o,{...ye(r,i),key:i,tableId:n,rowId:i,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Qe,e.ResultRowView=De,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Te(r,ne(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>Te(e,le(e.queryId,e.queries)),e.RowView=qe,e.SliceView=Oe,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>Se(r,Y(r.tableId,e,s,t,o,r.store)),e.TableView=Be,e.TablesView=({store:e,tableComponent:s=Be,getTableComponentProps:t,separator:o,debugIds:r})=>ve(L(W(e),(o=>Re(s,{...ye(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=Me,e.ValuesView=({store:e,valueComponent:s=Me,getValueComponentProps:t,separator:o,debugIds:r})=>ve(L(_(e),(o=>Re(s,{...ye(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=[],o,r=y,u=[],d=!0)=>{const l=q(o);return F((t=>h(l,(o=>h(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},e.useCell=$,e.useCellIds=Z,e.useCellIdsListener=(e,s,t,o,r,u)=>H(b,q(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,d)=>H(p,q(d),o,r,[e,s,t],u),e.useCheckpoint=ce,e.useCheckpointIds=Ie,e.useCheckpointIdsListener=(e,s,t)=>H("CheckpointIds",D(t),e,s),e.useCheckpointListener=(e,s,t,o)=>H("Checkpoint",D(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>P(11),e.useCheckpointsOrCheckpointsById=D,e.useCreateCheckpoints=(e,s,t)=>U(e,s,t),e.useCreateIndexes=(e,s,t)=>U(e,s,t),e.useCreateMetrics=(e,s,t)=>U(e,s,t),e.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=j(),d=E((()=>s(e)),[e,...t]);return A((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d.destroy()})),[d,...r]),d},e.useCreateQueries=(e,s,t)=>U(e,s,t),e.useCreateRelationships=(e,s,t)=>U(e,s,t),e.useCreateStore=(e,s=[])=>E(e,s),e.useDelCellCallback=(e,s,t,o,r,u,d)=>K(r,p,u,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>K(t,a,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>K(s,l,t,o,e),e.useDelTablesCallback=(e,s,t)=>K(e,n,s,t),e.useDelValueCallback=(e,s,t,o)=>K(s,w,t,o,e),e.useDelValuesCallback=(e,s,t)=>K(e,R,s,t),e.useGoBackwardCallback=Ce,e.useGoForwardCallback=pe,e.useGoToCallback=(e,s=[],t,o=y,r=[])=>{const u=D(t);return F((s=>h(u,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useIndexIds=e=>z("IndexIds",M(e),[]),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>P(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=de,e.useLinkedRowIdsListener=(e,s,t,o,r)=>H("Linked"+c,O(r),t,o,[e,s]),e.useLocalRowIds=ue,e.useLocalRowIdsListener=(e,s,t,o,r)=>H("Local"+c,O(r),t,o,[e,s]),e.useMetric=se,e.useMetricIds=e=>z("MetricIds",B(e),[]),e.useMetricListener=(e,s,t,o)=>H("Metric",B(o),s,t,[e]),e.useMetrics=e=>x(e,2),e.useMetricsIds=()=>P(3),e.useMetricsOrMetricsById=B,e.useQueries=e=>x(e,8),e.useQueriesIds=()=>P(9),e.useQueriesOrQueriesById=Q,e.useQueryIds=e=>z("QueryIds",Q(e),[]),e.useRedoInformation=e=>{const s=D(e),[,,[t]]=Ie(s);return[!g(t),pe(s),t,h(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>z("RelationshipIds",O(e),[]),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>P(7),e.useRelationshipsOrRelationshipsById=O,e.useRemoteRowId=re,e.useRemoteRowIdListener=(e,s,t,o,r)=>H("RemoteRowId",O(r),t,o,[e,s]),e.useResultCell=ae,e.useResultCellIds=ie,e.useResultCellIdsListener=(e,s,t,o,r)=>H(u+b,Q(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,d)=>H(u+p,Q(d),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>z(u+a,Q(t),{},[e,s]),e.useResultRowCount=(e,s)=>z(u+I,Q(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>H(u+I,Q(o),s,t,[e]),e.useResultRowIds=le,e.useResultRowIdsListener=(e,s,t,o)=>H(u+c,Q(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>H(u+a,Q(r),t,o,[e,s]),e.useResultSortedRowIds=ne,e.useResultSortedRowIdsListener=(e,s,t,o,r,d,l,n)=>H(u+C,Q(n),d,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>z(u+l,Q(s),{},[e]),e.useResultTableCellIds=(e,s)=>z(u+l+b,Q(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>H(u+l+b,Q(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>H(u+l,Q(o),s,t,[e]),e.useRow=(e,s,t)=>z(a,q(t),{},[e,s]),e.useRowCount=(e,s)=>z(I,q(s),[],[e]),e.useRowCountListener=(e,s,t,o,r)=>H(I,q(r),s,t,[e],o),e.useRowIds=X,e.useRowIdsListener=(e,s,t,o,r)=>H(c,q(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>H(a,q(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,d,l)=>J(u,p,o,r,d,l,e,s,t),e.useSetCheckpointCallback=(e=y,s=[],t,o=y,r=[])=>{const u=D(t);return F((s=>h(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>J(r,"PartialRow",t,o,u,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>J(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,d)=>J(r,a,t,o,u,d,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>J(o,l,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>J(t,n,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>J(o,w,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>J(t,R,e,s,o,r),e.useSliceIds=te,e.useSliceIdsListener=(e,s,t,o)=>H("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=oe,e.useSliceRowIdsListener=(e,s,t,o,r)=>H("Slice"+c,M(r),t,o,[e,s]),e.useSortedRowIds=Y,e.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>H(C,q(n),u,d,[e,s,t,o,r],l),e.useStore=e=>x(e,0),e.useStoreIds=()=>P(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>z(l,q(s),{},[e]),e.useTableCellIds=(e,s)=>z(l+b,q(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>H(l+b,q(r),s,t,[e],o),e.useTableIds=W,e.useTableIdsListener=(e,s,t,o)=>H(i,q(o),e,s,[],t),e.useTableListener=(e,s,t,o,r)=>H(l,q(r),s,t,[e],o),e.useTables=e=>z(n,q(e),{}),e.useTablesListener=(e,s,t,o)=>H(n,q(o),e,s,[],t),e.useUndoInformation=e=>{const s=D(e),[t,r]=Ie(s);return[(u=t,!(0==(e=>e.length)(u))),Ce(s),r,h(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=ee,e.useValueIds=_,e.useValueIdsListener=(e,s,t,o)=>H(k,q(o),e,s,[],t),e.useValueListener=(e,s,t,o,r)=>H(w,q(r),s,t,[e],o),e.useValues=e=>z(R,q(e),{}),e.useValuesListener=(e,s,t,o)=>H(R,q(o),e,s,[],t)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u="Listener",d="Result",l="Ids",n="Table",i=n+"s",a=n+l,I="Row",c=I+"Count",C=I+l,p="Sorted"+I+l,w="Cell",b=w+l,R="Value",k=R+"s",g=R+l,h=e=>null==e,m=(e,s,t)=>h(e)?t?.():s(e),L=e=>t(e)==r,y=()=>{},S=(e,s)=>e.map(s),V=Object.keys,{createContext:T,useContext:f}=s,x=T([]),v=(e,s)=>{const t=f(x);return h(e)?t[s]:L(e)?((e,s)=>m(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return h(e)||L(e)?t:e},q=e=>V(f(x)[e]??{}),B=e=>P(e,0),M=e=>P(e,2),D=e=>P(e,4),F=e=>P(e,6),O=e=>P(e,8),Q=e=>P(e,10),A=e=>e.toLowerCase();A(u);const E="Transaction";A(E);const{useCallback:G,useEffect:j,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return j((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],r)=>{const[,u]=z(),d=G((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=z(d),n=W(l);return U((()=>n.current=d()),[d]),K(e,s,((...e)=>{n.current=h(r)?d():e[r],u([])}),[],o),n.current},K=(e,s,t,o=[],r=[],...d)=>j((()=>{const o=s?.["add"+e+u]?.(...r,t,...d);return()=>s?.delListener(o)}),[s,...r,...o,...d]),N=(e,s,t,o=[],r=y,u=[],...d)=>{const l=B(e);return G((e=>m(l,(o=>m(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},X=(e,s,t=y,o=[],...r)=>{const u=B(e);return G((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},Y=(e,s,t)=>{const o=Q(e);return G((()=>o?.[s](t)),[o,s,t])},Z=e=>J(a,B(e),[],[]),$=(e,s)=>J(C,B(s),[],[e]),_=(e,s,t,o=0,r,u)=>J(p,B(u),[],[e,s,t,o,r],6),ee=(e,s,t)=>J(b,B(t),[],[e,s]),se=(e,s,t,o)=>J(w,B(o),void 0,[e,s,t],4),te=e=>J(g,B(e),[],[]),oe=(e,s)=>J(R,B(s),void 0,[e]),re=(e,s)=>J("Metric",M(s),void 0,[e]),ue=(e,s)=>J("SliceIds",D(s),[],[e]),de=(e,s,t)=>J("Slice"+C,D(t),[],[e,s]),le=(e,s,t)=>J("RemoteRowId",F(t),void 0,[e,s]),ne=(e,s,t)=>J("Local"+C,F(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+C,F(t),[],[e,s]),ae=(e,s)=>J(d+C,O(s),[],[e]),Ie=(e,s,t,o=0,r,u)=>J(d+p,O(u),[],[e,s,t,o,r],6),ce=(e,s,t)=>J(d+b,O(t),[],[e,s]),Ce=(e,s,t,o)=>J(d+w,O(o),void 0,[e,s,t]),pe=e=>J("CheckpointIds",Q(e),[[],void 0,[]]),we=(e,s)=>J("Checkpoint",Q(s),void 0,[e]),be=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ge,createElement:he,useCallback:me,useLayoutEffect:Le,useRef:ye,useState:Se}=s,Ve=(e,...s)=>h(e)?{}:e(...s),Te=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:fe}=s,xe=({tableId:e,store:s,rowComponent:t=De,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(S(l,(u=>he(t,{...Ve(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ee,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(S(d,(r=>he(t,{...Ve(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=De,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,i,a]=Te(F(s),e),I=d(e,l,n);return Be(S(I,(e=>he(t,{...Ve(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ge,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return Be(S(e(pe(d)),(e=>he(t,{...Ve(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=h(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Me=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>Be(o+(se(e,s,t,r)??o),void 0,u,t),De=({tableId:e,rowId:s,store:t,cellComponent:o=Me,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(S(((e,s,t,o)=>{const r=ee(s,t,o);return e??r})(u,e,s,t),(u=>he(o,{...Ve(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Fe=e=>xe(e,$(e.tableId,e.store)),Oe=({valueId:e,store:s,debugIds:t})=>Be(o+(oe(e,s)??o),void 0,t,e),Qe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=De,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(D(t),e),a=de(e,s,l);return Be(S(a,(e=>he(o,{...Ve(r,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),u,d,s)},Ae=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>Be(o+(Ce(e,s,t,r)??o),void 0,u,t),Ee=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ae,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(S(ce(e,s,t),(u=>he(o,{...Ve(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ge=({checkpoints:e,checkpointId:s,debugIds:t})=>Be(we(s,e)??o,void 0,t,s),je=qe((e=>e[0])),Ue=qe((e=>h(e[1])?[]:[e[1]])),We=qe((e=>e[2]));e.BackwardCheckpointsView=je,e.CellView=Me,e.CheckpointView=Ge,e.CurrentCheckpointView=Ue,e.ForwardCheckpointsView=We,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Qe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(S(ue(e,s),(r=>he(t,{...Ve(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>Pe(e,ie,e.firstRowId),e.LocalRowsView=e=>Pe(e,ne,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>Be(re(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:C})=>{const p=s.useContext(x);return he(x.Provider,{value:fe((()=>[e??p[0],{...p[1],...t},o??p[2],{...p[3],...r},u??p[4],{...p[5],...d},l??p[6],{...p[7],...n},i??p[8],{...p[9],...a},I??p[10],{...p[11],...c}]),[e,t,o,r,u,d,l,n,i,a,I,c,p])},C)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=De,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Te(F(t),e),i=le(e,s,d);return Be(h(n)||h(i)?null:he(o,{...Ve(r,i),key:i,tableId:n,rowId:i,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Ae,e.ResultRowView=Ee,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,Ie(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ve(e,ae(e.queryId,e.queries)),e.RowView=De,e.SliceView=Qe,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>xe(r,_(r.tableId,e,s,t,o,r.store)),e.TableView=Fe,e.TablesView=({store:e,tableComponent:s=Fe,getTableComponentProps:t,separator:o,debugIds:r})=>Be(S(Z(e),(o=>he(s,{...Ve(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=Oe,e.ValuesView=({store:e,valueComponent:s=Oe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(S(te(e),(o=>he(s,{...Ve(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=[],o,r=y,u=[],d=!0)=>{const l=B(o);return G((t=>m(l,(o=>m(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,r,u)=>K(b,B(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,d)=>K(w,B(d),o,r,[e,s,t],u),e.useCheckpoint=we,e.useCheckpointIds=pe,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",Q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",Q(o),s,t,[e]),e.useCheckpoints=e=>v(e,10),e.useCheckpointsIds=()=>q(11),e.useCheckpointsOrCheckpointsById=Q,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=z(),d=U((()=>s(e)),[e,...t]);return j((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d.destroy()})),[d,...r]),d},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,r,u,d)=>X(r,w,u,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>X(t,I,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,B(t),e,s),e.useGoBackwardCallback=be,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useIndexIds=e=>J("IndexIds",D(e),[]),e.useIndexes=e=>v(e,4),e.useIndexesIds=()=>q(5),e.useIndexesOrIndexesById=D,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,r)=>K("Linked"+C,F(r),t,o,[e,s]),e.useLocalRowIds=ne,e.useLocalRowIdsListener=(e,s,t,o,r)=>K("Local"+C,F(r),t,o,[e,s]),e.useMetric=re,e.useMetricIds=e=>J("MetricIds",M(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",M(o),s,t,[e]),e.useMetrics=e=>v(e,2),e.useMetricsIds=()=>q(3),e.useMetricsOrMetricsById=M,e.useQueries=e=>v(e,8),e.useQueriesIds=()=>q(9),e.useQueriesOrQueriesById=O,e.useQueryIds=e=>J("QueryIds",O(e),[]),e.useRedoInformation=e=>{const s=Q(e),[,,[t]]=pe(s);return[!h(t),Re(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>J("RelationshipIds",F(e),[]),e.useRelationships=e=>v(e,6),e.useRelationshipsIds=()=>q(7),e.useRelationshipsOrRelationshipsById=F,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,r)=>K("RemoteRowId",F(r),t,o,[e,s]),e.useResultCell=Ce,e.useResultCellIds=ce,e.useResultCellIdsListener=(e,s,t,o,r)=>K(d+b,O(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>K(d+w,O(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>J(d+I,O(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(d+c,O(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(d+c,O(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(d+C,O(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>K(d+I,O(r),t,o,[e,s]),e.useResultSortedRowIds=Ie,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,n)=>K(d+p,O(n),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>J(d+n,O(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(d+n+b,O(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(d+n+b,O(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(d+n,O(o),s,t,[e]),e.useRow=(e,s,t)=>J(I,B(t),{},[e,s]),e.useRowCount=(e,s)=>J(c,B(s),[],[e]),e.useRowCountListener=(e,s,t,o,r)=>K(c,B(r),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,r)=>K(C,B(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>K(I,B(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,d,l)=>N(u,w,o,r,d,l,e,s,t),e.useSetCheckpointCallback=(e=y,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>N(r,"PartialRow",t,o,u,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>N(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,d)=>N(r,I,t,o,u,d,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>N(o,n,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>N(t,i,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>N(o,R,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>N(t,k,e,s,o,r),e.useSliceIds=ue,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",D(o),s,t,[e]),e.useSliceRowIds=de,e.useSliceRowIdsListener=(e,s,t,o,r)=>K("Slice"+C,D(r),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>K(p,B(n),u,d,[e,s,t,o,r],l),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,B(t),e,s),e.useStore=e=>v(e,0),e.useStoreIds=()=>q(1),e.useStoreOrStoreById=B,e.useTable=(e,s)=>J(n,B(s),{},[e]),e.useTableCellIds=(e,s)=>J(n+b,B(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>K(n+b,B(r),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,B(o),e,s,[],t),e.useTableListener=(e,s,t,o,r)=>K(n,B(r),s,t,[e],o),e.useTables=e=>J(i,B(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,B(o),e,s,[],t),e.useUndoInformation=e=>{const s=Q(e),[t,r]=pe(s);return[(u=t,!(0==(e=>e.length)(u))),be(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(g,B(o),e,s,[],t),e.useValueListener=(e,s,t,o,r)=>K(R,B(r),s,t,[e],o),e.useValues=e=>J(k,B(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,B(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,B(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
package/lib/umd/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/umd-es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Result",u="Ids",n="Table",d=n+"s",i=n+u,a="Row",c=a+"Count",I=a+u,p="Sorted"+a+u,C="Cell",b=C+u,w="Value",R=w+"s",k=w+u,v=e=>null==e,g=(e,s,t)=>v(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},h=(e,s)=>e.map(s),f=Object.keys,{createContext:L,useContext:V}=s,S=L([]),T=(e,s)=>{var t;const o=V(S);return v(e)?o[s]:y(e)?((e,s)=>g(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},x=(e,s)=>{const t=T(e,s);return v(e)||y(e)?t:e},P=e=>{var s;return f(null!=(s=V(S)[e])?s:{})},O=e=>x(e,0),q=e=>x(e,2),B=e=>x(e,4),M=e=>x(e,6),j=e=>x(e,8),D=e=>x(e,10),{useCallback:Q,useEffect:E,useMemo:F,useRef:A,useState:G}=s,U=(e,s,t=[])=>{const o=F((()=>s(e)),[e,...t]);return E((()=>()=>o.destroy()),[o]),o},z=(e,s,t,o=[],l)=>{const[,r]=G(),u=Q((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=G(u),d=A(n);return F((()=>d.current=u()),[u]),H(e,s,((...e)=>{d.current=v(l)?u():e[l],r([])}),[],o),d.current},H=(e,s,t,o=[],l=[],...r)=>E((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),J=(e,s,t,o=[],l=m,r=[],...u)=>{const n=O(e);return Q((e=>g(n,(o=>g(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},K=(e,s,t=m,o=[],...l)=>{const r=O(e);return Q((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},N=(e,s,t)=>{const o=D(e);return Q((()=>null==o?void 0:o[s](t)),[o,s,t])},W=e=>z(i,O(e),[],[]),X=(e,s)=>z(I,O(s),[],[e]),Y=(e,s,t,o=0,l,r)=>z(p,O(r),[],[e,s,t,o,l],6),Z=(e,s,t)=>z(b,O(t),[],[e,s]),$=(e,s,t,o)=>z(C,O(o),void 0,[e,s,t],4),_=e=>z(k,O(e),[],[]),ee=(e,s)=>z(w,O(s),void 0,[e]),se=(e,s)=>z("Metric",q(s),void 0,[e]),te=(e,s)=>z("SliceIds",B(s),[],[e]),oe=(e,s,t)=>z("Slice"+I,B(t),[],[e,s]),le=(e,s,t)=>z("RemoteRowId",M(t),void 0,[e,s]),re=(e,s,t)=>z("Local"+I,M(t),[],[e,s]),ue=(e,s,t)=>z("Linked"+I,M(t),[],[e,s]),ne=(e,s)=>z(r+I,j(s),[],[e]),de=(e,s,t,o=0,l,u)=>z(r+p,j(u),[],[e,s,t,o,l],6),ie=(e,s,t)=>z(r+b,j(t),[],[e,s]),ae=(e,s,t,o)=>z(r+C,j(o),void 0,[e,s,t]),ce=e=>z("CheckpointIds",D(e),[[],void 0,[]]),Ie=(e,s)=>z("Checkpoint",D(s),void 0,[e]),pe=e=>N(e,"goBackward"),Ce=e=>N(e,"goForward"),{PureComponent:be,Fragment:we,createElement:Re,useCallback:ke,useLayoutEffect:ve,useRef:ge,useState:ye}=s,me=(e,...s)=>v(e)?{}:e(...s),he=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var fe=Object.defineProperty,Le=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertySymbols,Te=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,Pe=(e,s,t)=>s in e?fe(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Oe=(e,s)=>{for(var t in s||(s={}))Te.call(s,t)&&Pe(e,t,s[t]);if(Se)for(var t of Se(s))xe.call(s,t)&&Pe(e,t,s[t]);return e},qe=(e,s)=>Le(e,Ve(s)),Be=(e,s)=>{var t={};for(var o in e)Te.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Se)for(var o of Se(e))s.indexOf(o)<0&&xe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Me}=s,je=({tableId:e,store:s,rowComponent:t=Ge,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Fe(h(n,(r=>Re(t,qe(Oe({},me(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),De=({queryId:e,queries:s,resultRowComponent:t=Ke,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Fe(h(u,(l=>Re(t,qe(Oe({},me(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Qe=({relationshipId:e,relationships:s,rowComponent:t=Ge,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=he(M(s),e),c=u(e,n,d);return Fe(h(c,(e=>Re(t,qe(Oe({},me(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ee=e=>({checkpoints:s,checkpointComponent:t=Ne,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=D(s);return Fe(h(e(ce(u)),(e=>Re(t,qe(Oe({},me(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Fe=(e,s,t,o)=>{const l=v(s)||!Array.isArray(e)?e:h(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},Ae=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Fe(o+(null!=(u=$(e,s,t,l))?u:o),void 0,r,t)},Ge=({tableId:e,rowId:s,store:t,cellComponent:o=Ae,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Fe(h(((e,s,t,o)=>{const l=Z(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>Re(o,qe(Oe({},me(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Ue=e=>je(e,X(e.tableId,e.store)),ze=({valueId:e,store:s,debugIds:t})=>{var l;return Fe(o+(null!=(l=ee(e,s))?l:o),void 0,t,e)},He=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Ge,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(B(t),e),a=oe(e,s,n);return Fe(h(a,(e=>Re(o,qe(Oe({},me(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Je=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Fe(o+(null!=(u=ae(e,s,t,l))?u:o),void 0,r,t)},Ke=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Je,getResultCellComponentProps:l,separator:r,debugIds:u})=>Fe(h(ie(e,s,t),(r=>Re(o,qe(Oe({},me(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ne=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Fe(null!=(l=Ie(s,e))?l:o,void 0,t,s)},We=Ee((e=>e[0])),Xe=Ee((e=>v(e[1])?[]:[e[1]])),Ye=Ee((e=>e[2]));e.BackwardCheckpointsView=We,e.CellView=Ae,e.CheckpointView=Ne,e.CurrentCheckpointView=Xe,e.ForwardCheckpointsView=Ye,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=He,getSliceComponentProps:o,separator:l,debugIds:r})=>Fe(h(te(e,s),(l=>Re(t,qe(Oe({},me(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Qe(e,ue,e.firstRowId),e.LocalRowsView=e=>Qe(e,re,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Fe(null!=(l=se(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(S);return Re(S.Provider,{value:Me((()=>[null!=e?e:C[0],Oe(Oe({},C[1]),t),null!=o?o:C[2],Oe(Oe({},C[3]),l),null!=r?r:C[4],Oe(Oe({},C[5]),u),null!=n?n:C[6],Oe(Oe({},C[7]),d),null!=i?i:C[8],Oe(Oe({},C[9]),a),null!=c?c:C[10],Oe(Oe({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Ge,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=he(M(t),e),i=le(e,s,u);return Fe(v(d)||v(i)?null:Re(o,qe(Oe({},me(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Je,e.ResultRowView=Ke,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Be(s,["cellId","descending","offset","limit"]);return De(u,de(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>De(e,ne(e.queryId,e.queries)),e.RowView=Ge,e.SliceView=He,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=Be(s,["cellId","descending","offset","limit"]);return je(u,Y(u.tableId,t,o,l,r,u.store))},e.TableView=Ue,e.TablesView=({store:e,tableComponent:s=Ue,getTableComponentProps:t,separator:o,debugIds:l})=>Fe(h(W(e),(o=>Re(s,qe(Oe({},me(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=ze,e.ValuesView=({store:e,valueComponent:s=ze,getValueComponentProps:t,separator:o,debugIds:l})=>Fe(h(_(e),(o=>Re(s,qe(Oe({},me(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=O(o);return Q((t=>g(n,(o=>g(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=$,e.useCellIds=Z,e.useCellIdsListener=(e,s,t,o,l,r)=>H(b,O(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>H(C,O(u),o,l,[e,s,t],r),e.useCheckpoint=Ie,e.useCheckpointIds=ce,e.useCheckpointIdsListener=(e,s,t)=>H("CheckpointIds",D(t),e,s),e.useCheckpointListener=(e,s,t,o)=>H("Checkpoint",D(o),s,t,[e]),e.useCheckpoints=e=>T(e,10),e.useCheckpointsIds=()=>P(11),e.useCheckpointsOrCheckpointsById=D,e.useCreateCheckpoints=(e,s,t)=>U(e,s,t),e.useCreateIndexes=(e,s,t)=>U(e,s,t),e.useCreateMetrics=(e,s,t)=>U(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=G(),u=F((()=>s(e)),[e,...t]);return E((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>U(e,s,t),e.useCreateRelationships=(e,s,t)=>U(e,s,t),e.useCreateStore=(e,s=[])=>F(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>K(l,C,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>K(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>K(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>K(e,d,s,t),e.useDelValueCallback=(e,s,t,o)=>K(s,w,t,o,e),e.useDelValuesCallback=(e,s,t)=>K(e,R,s,t),e.useGoBackwardCallback=pe,e.useGoForwardCallback=Ce,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>z("IndexIds",B(e),[]),e.useIndexes=e=>T(e,4),e.useIndexesIds=()=>P(5),e.useIndexesOrIndexesById=B,e.useLinkedRowIds=ue,e.useLinkedRowIdsListener=(e,s,t,o,l)=>H("Linked"+I,M(l),t,o,[e,s]),e.useLocalRowIds=re,e.useLocalRowIdsListener=(e,s,t,o,l)=>H("Local"+I,M(l),t,o,[e,s]),e.useMetric=se,e.useMetricIds=e=>z("MetricIds",q(e),[]),e.useMetricListener=(e,s,t,o)=>H("Metric",q(o),s,t,[e]),e.useMetrics=e=>T(e,2),e.useMetricsIds=()=>P(3),e.useMetricsOrMetricsById=q,e.useQueries=e=>T(e,8),e.useQueriesIds=()=>P(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>z("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=D(e),[,,[l]]=ce(t);return[!v(l),Ce(t),l,null!=(s=g(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>z("RelationshipIds",M(e),[]),e.useRelationships=e=>T(e,6),e.useRelationshipsIds=()=>P(7),e.useRelationshipsOrRelationshipsById=M,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,l)=>H("RemoteRowId",M(l),t,o,[e,s]),e.useResultCell=ae,e.useResultCellIds=ie,e.useResultCellIdsListener=(e,s,t,o,l)=>H(r+b,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,u)=>H(r+C,j(u),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>z(r+a,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>z(r+c,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>H(r+c,j(o),s,t,[e]),e.useResultRowIds=ne,e.useResultRowIdsListener=(e,s,t,o)=>H(r+I,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>H(r+a,j(l),t,o,[e,s]),e.useResultSortedRowIds=de,e.useResultSortedRowIdsListener=(e,s,t,o,l,u,n,d)=>H(r+p,j(d),u,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>z(r+n,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>z(r+n+b,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>H(r+n+b,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>H(r+n,j(o),s,t,[e]),e.useRow=(e,s,t)=>z(a,O(t),{},[e,s]),e.useRowCount=(e,s)=>z(c,O(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>H(c,O(l),s,t,[e],o),e.useRowIds=X,e.useRowIdsListener=(e,s,t,o,l)=>H(I,O(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>H(a,O(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>J(r,C,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=D(t);return Q((s=>g(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>J(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>J(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>J(l,a,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>J(o,n,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>J(t,d,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>J(o,w,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>J(t,R,e,s,o,l),e.useSliceIds=te,e.useSliceIdsListener=(e,s,t,o)=>H("SliceIds",B(o),s,t,[e]),e.useSliceRowIds=oe,e.useSliceRowIdsListener=(e,s,t,o,l)=>H("Slice"+I,B(l),t,o,[e,s]),e.useSortedRowIds=Y,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>H(p,O(d),r,u,[e,s,t,o,l],n),e.useStore=e=>T(e,0),e.useStoreIds=()=>P(1),e.useStoreOrStoreById=O,e.useTable=(e,s)=>z(n,O(s),{},[e]),e.useTableCellIds=(e,s)=>z(n+b,O(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>H(n+b,O(l),s,t,[e],o),e.useTableIds=W,e.useTableIdsListener=(e,s,t,o)=>H(i,O(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>H(n,O(l),s,t,[e],o),e.useTables=e=>z(d,O(e),{}),e.useTablesListener=(e,s,t,o)=>H(d,O(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=D(e),[l,r]=ce(t);return[(u=l,!(0==(e=>e.length)(u))),pe(t),r,null!=(s=g(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=ee,e.useValueIds=_,e.useValueIdsListener=(e,s,t,o)=>H(k,O(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>H(w,O(l),s,t,[e],o),e.useValues=e=>z(R,O(e),{}),e.useValuesListener=(e,s,t,o)=>H(R,O(o),e,s,[],t)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Listener",u="Result",n="Ids",d="Table",i=d+"s",a=d+n,c="Row",I=c+"Count",p=c+n,C="Sorted"+c+n,b="Cell",w=b+n,R="Value",k=R+"s",v=R+n,g=e=>null==e,h=(e,s,t)=>g(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},L=(e,s)=>e.map(s),f=Object.keys,{createContext:S,useContext:V}=s,T=S([]),x=(e,s)=>{var t;const o=V(T);return g(e)?o[s]:y(e)?((e,s)=>h(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},P=(e,s)=>{const t=x(e,s);return g(e)||y(e)?t:e},O=e=>{var s;return f(null!=(s=V(T)[e])?s:{})},q=e=>P(e,0),B=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),j=e=>P(e,8),F=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const E="Transaction";Q(E);const{useCallback:A,useEffect:G,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],l)=>{const[,r]=z(),u=A((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=z(u),d=W(n);return U((()=>d.current=u()),[u]),K(e,s,((...e)=>{d.current=g(l)?u():e[l],r([])}),[],o),d.current},K=(e,s,t,o=[],l=[],...u)=>G((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),N=(e,s,t,o=[],l=m,r=[],...u)=>{const n=q(e);return A((e=>h(n,(o=>h(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},X=(e,s,t=m,o=[],...l)=>{const r=q(e);return A((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Y=(e,s,t)=>{const o=F(e);return A((()=>null==o?void 0:o[s](t)),[o,s,t])},Z=e=>J(a,q(e),[],[]),$=(e,s)=>J(p,q(s),[],[e]),_=(e,s,t,o=0,l,r)=>J(C,q(r),[],[e,s,t,o,l],6),ee=(e,s,t)=>J(w,q(t),[],[e,s]),se=(e,s,t,o)=>J(b,q(o),void 0,[e,s,t],4),te=e=>J(v,q(e),[],[]),oe=(e,s)=>J(R,q(s),void 0,[e]),le=(e,s)=>J("Metric",B(s),void 0,[e]),re=(e,s)=>J("SliceIds",M(s),[],[e]),ue=(e,s,t)=>J("Slice"+p,M(t),[],[e,s]),ne=(e,s,t)=>J("RemoteRowId",D(t),void 0,[e,s]),de=(e,s,t)=>J("Local"+p,D(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+p,D(t),[],[e,s]),ae=(e,s)=>J(u+p,j(s),[],[e]),ce=(e,s,t,o=0,l,r)=>J(u+C,j(r),[],[e,s,t,o,l],6),Ie=(e,s,t)=>J(u+w,j(t),[],[e,s]),pe=(e,s,t,o)=>J(u+b,j(o),void 0,[e,s,t]),Ce=e=>J("CheckpointIds",F(e),[[],void 0,[]]),be=(e,s)=>J("Checkpoint",F(s),void 0,[e]),we=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ve,createElement:ge,useCallback:he,useLayoutEffect:ye,useRef:me,useState:Le}=s,fe=(e,...s)=>g(e)?{}:e(...s),Se=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ve=Object.defineProperty,Te=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,Be=(e,s,t)=>s in e?Ve(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Me=(e,s)=>{for(var t in s||(s={}))Oe.call(s,t)&&Be(e,t,s[t]);if(Pe)for(var t of Pe(s))qe.call(s,t)&&Be(e,t,s[t]);return e},De=(e,s)=>Te(e,xe(s)),je=(e,s)=>{var t={};for(var o in e)Oe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Pe)for(var o of Pe(e))s.indexOf(o)<0&&qe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=s,Qe=({tableId:e,store:s,rowComponent:t=ze,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Ue(L(n,(r=>ge(t,De(Me({},fe(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),Ee=({queryId:e,queries:s,resultRowComponent:t=Xe,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Ue(L(u,(l=>ge(t,De(Me({},fe(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Ae=({relationshipId:e,relationships:s,rowComponent:t=ze,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=Se(D(s),e),c=u(e,n,d);return Ue(L(c,(e=>ge(t,De(Me({},fe(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ge=e=>({checkpoints:s,checkpointComponent:t=Ye,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=F(s);return Ue(L(e(Ce(u)),(e=>ge(t,De(Me({},fe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Ue=(e,s,t,o)=>{const l=g(s)||!Array.isArray(e)?e:L(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},We=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=se(e,s,t,l))?u:o),void 0,r,t)},ze=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Ue(L(((e,s,t,o)=>{const l=ee(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),He=e=>Qe(e,$(e.tableId,e.store)),Je=({valueId:e,store:s,debugIds:t})=>{var l;return Ue(o+(null!=(l=oe(e,s))?l:o),void 0,t,e)},Ke=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ze,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(M(t),e),a=ue(e,s,n);return Ue(L(a,(e=>ge(o,De(Me({},fe(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ne=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=pe(e,s,t,l))?u:o),void 0,r,t)},Xe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ne,getResultCellComponentProps:l,separator:r,debugIds:u})=>Ue(L(Ie(e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ye=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Ue(null!=(l=be(s,e))?l:o,void 0,t,s)},Ze=Ge((e=>e[0])),$e=Ge((e=>g(e[1])?[]:[e[1]])),_e=Ge((e=>e[2]));e.BackwardCheckpointsView=Ze,e.CellView=We,e.CheckpointView=Ye,e.CurrentCheckpointView=$e,e.ForwardCheckpointsView=_e,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ke,getSliceComponentProps:o,separator:l,debugIds:r})=>Ue(L(re(e,s),(l=>ge(t,De(Me({},fe(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Ae(e,ie,e.firstRowId),e.LocalRowsView=e=>Ae(e,de,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Ue(null!=(l=le(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(T);return ge(T.Provider,{value:Fe((()=>[null!=e?e:C[0],Me(Me({},C[1]),t),null!=o?o:C[2],Me(Me({},C[3]),l),null!=r?r:C[4],Me(Me({},C[5]),u),null!=n?n:C[6],Me(Me({},C[7]),d),null!=i?i:C[8],Me(Me({},C[9]),a),null!=c?c:C[10],Me(Me({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ze,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=Se(D(t),e),i=ne(e,s,u);return Ue(g(d)||g(i)?null:ge(o,De(Me({},fe(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ne,e.ResultRowView=Xe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Ee(u,ce(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>Ee(e,ae(e.queryId,e.queries)),e.RowView=ze,e.SliceView=Ke,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Qe(u,_(u.tableId,t,o,l,r,u.store))},e.TableView=He,e.TablesView=({store:e,tableComponent:s=He,getTableComponentProps:t,separator:o,debugIds:l})=>Ue(L(Z(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Je,e.ValuesView=({store:e,valueComponent:s=Je,getValueComponentProps:t,separator:o,debugIds:l})=>Ue(L(te(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=q(o);return A((t=>h(n,(o=>h(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,l,r)=>K(w,q(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>K(b,q(u),o,l,[e,s,t],r),e.useCheckpoint=be,e.useCheckpointIds=Ce,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",F(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",F(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>O(11),e.useCheckpointsOrCheckpointsById=F,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=z(),u=U((()=>s(e)),[e,...t]);return G((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>X(l,b,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>X(t,c,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,q(t),e,s),e.useGoBackwardCallback=we,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>J("IndexIds",M(e),[]),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>O(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,l)=>K("Linked"+p,D(l),t,o,[e,s]),e.useLocalRowIds=de,e.useLocalRowIdsListener=(e,s,t,o,l)=>K("Local"+p,D(l),t,o,[e,s]),e.useMetric=le,e.useMetricIds=e=>J("MetricIds",B(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",B(o),s,t,[e]),e.useMetrics=e=>x(e,2),e.useMetricsIds=()=>O(3),e.useMetricsOrMetricsById=B,e.useQueries=e=>x(e,8),e.useQueriesIds=()=>O(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>J("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=F(e),[,,[l]]=Ce(t);return[!g(l),Re(t),l,null!=(s=h(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>J("RelationshipIds",D(e),[]),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>O(7),e.useRelationshipsOrRelationshipsById=D,e.useRemoteRowId=ne,e.useRemoteRowIdListener=(e,s,t,o,l)=>K("RemoteRowId",D(l),t,o,[e,s]),e.useResultCell=pe,e.useResultCellIds=Ie,e.useResultCellIdsListener=(e,s,t,o,l)=>K(u+w,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>K(u+b,j(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>J(u+c,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(u+I,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(u+I,j(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(u+p,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>K(u+c,j(l),t,o,[e,s]),e.useResultSortedRowIds=ce,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>K(u+C,j(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>J(u+d,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(u+d+w,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(u+d+w,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(u+d,j(o),s,t,[e]),e.useRow=(e,s,t)=>J(c,q(t),{},[e,s]),e.useRowCount=(e,s)=>J(I,q(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>K(I,q(l),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,l)=>K(p,q(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>K(c,q(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>N(r,b,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>N(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>N(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>N(l,c,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>N(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>N(t,i,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>N(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>N(t,k,e,s,o,l),e.useSliceIds=re,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=ue,e.useSliceRowIdsListener=(e,s,t,o,l)=>K("Slice"+p,M(l),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>K(C,q(d),r,u,[e,s,t,o,l],n),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,q(t),e,s),e.useStore=e=>x(e,0),e.useStoreIds=()=>O(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>J(d,q(s),{},[e]),e.useTableCellIds=(e,s)=>J(d+w,q(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>K(d+w,q(l),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,q(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>K(d,q(l),s,t,[e],o),e.useTables=e=>J(i,q(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,q(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=F(e),[l,r]=Ce(t);return[(u=l,!(0==(e=>e.length)(u))),we(t),r,null!=(s=h(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(v,q(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>K(R,q(l),s,t,[e],o),e.useValues=e=>J(k,q(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,q(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,q(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -234,8 +234,8 @@
|
|
|
234
234
|
"@types/react-dom": "^18.2.7",
|
|
235
235
|
"@types/react-test-renderer": "^18.0.1",
|
|
236
236
|
"@types/tmp": "^0.2.3",
|
|
237
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
238
|
-
"@typescript-eslint/parser": "^6.
|
|
237
|
+
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
238
|
+
"@typescript-eslint/parser": "^6.7.0",
|
|
239
239
|
"@vlcn.io/crsqlite-wasm": "^0.15.1",
|
|
240
240
|
"asciichart": "^1.5.25",
|
|
241
241
|
"automerge-repo": "^0.1.0",
|
|
@@ -246,12 +246,12 @@
|
|
|
246
246
|
"babel-preset-minify": "^0.5.2",
|
|
247
247
|
"buffer-replace": "^1.0.0",
|
|
248
248
|
"country-flag-emoji-json": "^2.0.0",
|
|
249
|
-
"cspell": "^7.3.
|
|
249
|
+
"cspell": "^7.3.5",
|
|
250
250
|
"esbuild": "^0.19.2",
|
|
251
251
|
"eslint": "^8.49.0",
|
|
252
252
|
"eslint-config-prettier": "^9.0.0",
|
|
253
253
|
"eslint-plugin-jest": "^27.2.3",
|
|
254
|
-
"eslint-plugin-jsdoc": "^46.
|
|
254
|
+
"eslint-plugin-jsdoc": "^46.6.0",
|
|
255
255
|
"eslint-plugin-react": "7.33.2",
|
|
256
256
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
257
257
|
"expo-sqlite": "^11.5.0",
|
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
"react": "^18.2.0",
|
|
271
271
|
"react-dom": "^18.2.0",
|
|
272
272
|
"react-test-renderer": "^18.2.0",
|
|
273
|
-
"rollup": "^3.29.
|
|
273
|
+
"rollup": "^3.29.1",
|
|
274
274
|
"rollup-plugin-esbuild": "^5.0.0",
|
|
275
275
|
"rollup-plugin-gzip": "^3.1.0",
|
|
276
276
|
"rollup-plugin-preserve-shebang": "^1.0.1",
|
|
@@ -319,4 +319,4 @@
|
|
|
319
319
|
"optional": true
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
}
|
|
322
|
+
}
|
package/readme.md
CHANGED
|
@@ -247,4 +247,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
247
247
|
};
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.
|
|
250
|
+
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.5kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.8kB</td><td>11.4kB</td><td>48.7kB</td><td>220.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.1kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.2kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>126.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.6kB</td><td>3.1kB</td><td>12.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.7kB</td><td>1.5kB</td><td>5.1kB</td><td>43.4kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>9.2kB</td><td>22.5kB</td><td>97.5kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,880</td><td>1,880</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,034</td><td>2,034</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>811</td><td>811</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>689</td><td>689</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,365</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,251</td></tr></tbody></table></div><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussions">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.2.2">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section>
|