tinybase 4.1.1 → 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom.cjs +1 -1
- package/lib/cjs/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
- package/lib/debug/ui-react-dom.js +82 -78
- package/lib/es6/ui-react-dom-debug.js +1 -1
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react-dom.js +1 -1
- package/lib/es6/ui-react-dom.js.gz +0 -0
- package/lib/ui-react-dom.js +1 -1
- package/lib/ui-react-dom.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -1
- package/lib/umd/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd/ui-react-dom.js +1 -1
- package/lib/umd/ui-react-dom.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -1
- package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom.js +1 -1
- package/lib/umd-es6/ui-react-dom.js.gz +0 -0
- package/package.json +17 -17
- package/readme.md +2 -2
|
@@ -195,85 +195,89 @@ const EDIT_SVG = PRE + `<path d='${PENCIL}' />` + POST;
|
|
|
195
195
|
const DONE_SVG = PRE + `<path d='${PENCIL}M20 20l60 60' />` + POST;
|
|
196
196
|
|
|
197
197
|
const SCROLLBAR = '*::-webkit-scrollbar';
|
|
198
|
-
const APP_STYLESHEET =
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// Panel
|
|
220
|
-
main: 'display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;',
|
|
221
|
-
...objNew(
|
|
222
|
-
arrayMap(
|
|
223
|
-
[
|
|
224
|
-
'bottom:0;left:0;width:35vw;height:100vh',
|
|
225
|
-
'top:0;right:0;width:100vw;height:30vh',
|
|
226
|
-
'bottom:0;left:0;width:100vw;height:30vh',
|
|
227
|
-
'top:0;right:0;width:35vw;height:100vh',
|
|
228
|
-
'top:0;right:0;width:100vw;height:100vh',
|
|
229
|
-
],
|
|
230
|
-
(css, p) => [`main[data-position='${p}']`, css],
|
|
198
|
+
const APP_STYLESHEET = `#${UNIQUE_ID}{
|
|
199
|
+
all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;
|
|
200
|
+
${arrayJoin(
|
|
201
|
+
objMap(
|
|
202
|
+
{
|
|
203
|
+
'*': 'all:revert',
|
|
204
|
+
'*::before': 'all:revert',
|
|
205
|
+
'*::after': 'all:revert',
|
|
206
|
+
[SCROLLBAR]: 'width:0.5rem;height:0.5rem;',
|
|
207
|
+
[SCROLLBAR + '-track']: 'background:#111',
|
|
208
|
+
[SCROLLBAR + '-thumb']: 'background:#999;border:1px solid #111',
|
|
209
|
+
[SCROLLBAR + '-thumb:hover']: 'background:#fff',
|
|
210
|
+
[SCROLLBAR + '-corner']: 'background:#111',
|
|
211
|
+
img: 'width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom',
|
|
212
|
+
// Nub
|
|
213
|
+
'>img': 'padding:0.25rem;bottom:0;right:0;position:fixed;' + LOGO_SVG,
|
|
214
|
+
...objNew(
|
|
215
|
+
arrayMap(['bottom:0;left:0', 'top:0;right:0'], (css, p) => [
|
|
216
|
+
`>img[data-position='${p}']`,
|
|
217
|
+
css,
|
|
218
|
+
]),
|
|
231
219
|
),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
'
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
'
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
220
|
+
// Panel
|
|
221
|
+
main: 'display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;',
|
|
222
|
+
...objNew(
|
|
223
|
+
arrayMap(
|
|
224
|
+
[
|
|
225
|
+
'bottom:0;left:0;width:35vw;height:100vh',
|
|
226
|
+
'top:0;right:0;width:100vw;height:30vh',
|
|
227
|
+
'bottom:0;left:0;width:100vw;height:30vh',
|
|
228
|
+
'top:0;right:0;width:35vw;height:100vh',
|
|
229
|
+
'top:0;right:0;width:100vw;height:100vh',
|
|
230
|
+
],
|
|
231
|
+
(css, p) => [`main[data-position='${p}']`, css],
|
|
232
|
+
),
|
|
233
|
+
),
|
|
234
|
+
// Header
|
|
235
|
+
header:
|
|
236
|
+
'display:flex;padding:0.25rem;background:#000;align-items:center',
|
|
237
|
+
'header>img:nth-of-type(1)': LOGO_SVG,
|
|
238
|
+
'header>img:nth-of-type(6)': CLOSE_SVG,
|
|
239
|
+
...objNew(
|
|
240
|
+
arrayMap(POSITIONS_SVG, (SVG, p) => [
|
|
241
|
+
`header>img[data-id='${p}']`,
|
|
242
|
+
SVG,
|
|
243
|
+
]),
|
|
244
|
+
),
|
|
245
|
+
'header>span':
|
|
246
|
+
'flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem',
|
|
247
|
+
// Body
|
|
248
|
+
article: 'padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1',
|
|
249
|
+
details: 'margin-left:0.75rem;width:fit-content;',
|
|
250
|
+
'details img': 'display:none',
|
|
251
|
+
'details[open]>summary img':
|
|
252
|
+
'display:unset;background:none;margin-left:0.25rem',
|
|
253
|
+
'details[open]>summary img.edit': EDIT_SVG,
|
|
254
|
+
'details[open]>summary img.done': DONE_SVG,
|
|
255
|
+
summary:
|
|
256
|
+
'margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content',
|
|
257
|
+
// tables
|
|
258
|
+
table:
|
|
259
|
+
'border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem',
|
|
260
|
+
'table input':
|
|
261
|
+
'background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0',
|
|
262
|
+
'table input[type="number"]': 'width:4rem',
|
|
263
|
+
'table tbody button':
|
|
264
|
+
'font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111',
|
|
265
|
+
'table button:first-letter': 'font-size:0.75rem',
|
|
266
|
+
thead: 'background:#222',
|
|
267
|
+
'th:nth-of-type(1)': 'min-width:2rem;',
|
|
268
|
+
'th.sorted': 'background:#000',
|
|
269
|
+
'table caption':
|
|
270
|
+
'text-align:left;white-space:nowrap;line-height:1.25rem',
|
|
271
|
+
button: 'width:1.5rem;border:none;background:none;color:#fff;padding:0',
|
|
272
|
+
'button[disabled]': 'color:#777',
|
|
273
|
+
'button.next': 'margin-right:0.5rem',
|
|
274
|
+
[`th,td`]:
|
|
275
|
+
'overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left',
|
|
276
|
+
'span.warn': 'margin:0.25rem;color:#d81b60',
|
|
277
|
+
},
|
|
278
|
+
(style, selector) => (style ? `& ${selector}{${style}}` : ''),
|
|
279
|
+
),
|
|
280
|
+
)}`;
|
|
277
281
|
|
|
278
282
|
const Nub = ({s}) => {
|
|
279
283
|
const position = useValue(POSITION_VALUE, s) ?? 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as b,useResultRowCount as v,useResultSortedRowIds as g,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as V,useRelationships as N,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,be=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),ve=e=>e==W||e==H,ge=e=>D(e)==G,fe=e=>Array.isArray(e),{PureComponent:ye,Fragment:Ie,createElement:we,useCallback:Ce,useLayoutEffect:ke,useRef:xe,useState:Te}=e,Se=(e,...t)=>pe(e)?{}:e(...t),Oe=(e,t)=>e.forEach(t),qe=(e,t)=>e.map(t),Ve=e=>e.length,Ne=e=>0==Ve(e),Pe=(e,t,l)=>e.slice(t,l),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>be(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>qe(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ve(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>qe(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),Ce((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",dt=qe([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))gt.call(t,l)&&yt(e,l,t[l]);if(vt)for(var l of vt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,bt(t));const Ct="*::-webkit-scrollbar",kt=((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+it},Ae(qe(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Ae(qe(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":it,"header>img:nth-of-type(6)":ut}),Ae(qe(dt,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":ct,"details[open]>summary img.done":ht,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${Qe} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`#${Qe} ${t}{${e}}`:""))),xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:we("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return we("details",{open:i,onToggle:d},we("summary",null,l,o?we("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return ve(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Vt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Nt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>qe(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),b=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:we(b,{offset:u,limit:r,total:o,onChange:p})),[s,b,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(qe(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>we("table",{className:e},i?we("caption",null,i):null,!1===t?null:we("thead",null,we("tr",null,!1===l?null:we(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>we(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),we("tbody",null,qe(o,(e=>we("tr",{key:e},!1===l?null:we("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>we("td",{key:n},we(t,$t(zt(zt({},Se(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>we("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return we("tr",null,!1===l?null:we(e.Fragment,null,we("th",null,t),we("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:we("td",{key:n},we(e,$t(zt({},Se(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n})=>{const[r,o]=Dt(),[s,a]=Dt(),[i,d]=Dt(),[u,c]=Dt(),[h,m]=Dt();s!==e&&(o(St(e)),a(e),d(e+""),c(Number(e)||0),m(!!e));const p=Ft(((e,l)=>{l(e),a(e),t(e)}),[t]);return we("div",{className:l},we("button",{className:r,onClick:Ft((()=>{if(!(null==n?void 0:n())){const e=Vt(r,Q,H,W),l=Vt(e,i,u,h);o(e),a(l),t(l)}}),[n,t,i,u,h,r])},r),Vt(r,we("input",{key:r,value:i,onChange:Ft((e=>p(e[ie][de]+"",d)),[p])}),we("input",{key:r,type:"number",value:u,onChange:Ft((e=>p(Number(e[ie][de]||0),c)),[p])}),we("input",{key:r,type:"checkbox",checked:h,onChange:Ft((e=>p(!!e[ie].checked,m)),[p])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:b}=t,v=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return we(Yt,$t(zt({},v),{params:Qt(Xt(s(l,u),b,c?il:I),Gt(u,l),i(l,...g,d,u),g,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>we("table",{className:r},!1===o?null:we("thead",null,we("tr",null,!1===s?null:we("th",null,"Id"),we("th",null,oe))),we("tbody",null,qe(d(e),(t=>we("tr",{key:t},!1===s?null:we("th",null,t),we("td",null,we(l,$t(zt({},Se(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),b=Qt(i,p,c,h,t,d,u);return we("table",{className:s},!1===a?null:we("thead",null,we("tr",null,!1===i?null:we(e.Fragment,null,we("th",null,c,".Id"),we("th",null,h,".Id")),De(p,(({label:e},t)=>we("th",{key:t},e))))),we("tbody",null,qe(o(c,u),(e=>we(_t,{key:e,localRowId:e,params:b})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return we(Yt,$t(zt({},o),{params:Qt(Xt(b(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,v(l,a),d,c);return we(Yt,$t(zt({},h),{params:Qt(Xt(b(l,a),u,w),Kt(a,l),g(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s})=>{var a;return we(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,hasSchema:null==(a=f(o))?void 0:a.hasTablesSchema})},dl=({valueId:e,store:t,className:r})=>{var o;return we(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,hasSchema:null==(o=f(t))?void 0:o.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return we(e.Fragment,null,l>r&&we(e.Fragment,null,we("button",{className:"previous",disabled:0==n,onClick:a},"←"),we("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>we(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},qe(x(l,e),(r=>we(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return we(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},we(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:we(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Ne(n)?"No indexes defined":lt(n,(n=>we(cl,{indexes:l,indexesId:e,indexId:n,s:t}))))},pl=({metrics:e,metricId:t})=>we("tr",null,we("th",null,t),we("td",null,null==e?void 0:e.getTableId(t)),we("td",null,O(t,e))),bl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:we(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Ne(n)?"No metrics defined":we("table",null,we("thead",null,we("th",null,"Metric Id"),we("th",null,"Table Id"),we("th",null,"Metric")),we("tbody",null,qe(n,(e=>we(pl,{metrics:l,metricId:e}))))))},vl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return we(Tt,{uniqueId:a,summary:"Query: "+n,s:o},we(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},gl=({queriesId:e,s:t})=>{const l=q(e),n=V(l);return pe(l)?null:we(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Ne(n)?"No queries defined":lt(n,(n=>we(vl,{queries:l,queriesId:e,queryId:n,s:t}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return we(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},we(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=N(e),n=P(l);return pe(l)?null:we(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Ne(n)?"No relationships defined":lt(n,(n=>we(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return we(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},we(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Ne(d(e))?null:we(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},we(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:we(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},we(wl,{storeId:e,store:l,s:t}),lt(n,(n=>we(Il,{store:l,storeId:e,tableId:n,s:t}))))},kl=({s:e})=>{const t=xe(null),l=xe(0),[n,r]=Te(!1),{scrollLeft:o,scrollTop:s}=E(e);ke((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=Ce((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=N(),b=$(),v=q(),g=A();return pe(i)&&Ne(d)&&pe(u)&&Ne(c)&&pe(h)&&Ne(m)&&pe(p)&&Ne(b)&&pe(v)&&Ne(g)?we("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):we("article",{ref:t,onScroll:a},we(Cl,{s:e}),qe(d,(t=>we(Cl,{storeId:t,key:t,s:e}))),we(bl,{s:e}),qe(c,(t=>we(bl,{metricsId:t,key:t,s:e}))),we(ml,{s:e}),qe(m,(t=>we(ml,{indexesId:t,key:t,s:e}))),we(yl,{s:e}),qe(b,(t=>we(yl,{relationshipsId:t,key:t,s:e}))),we(gl,{s:e}),qe(g,(t=>we(gl,{queriesId:t,key:t,s:e}))))};var xl=Object.defineProperty,Tl=(e,t,l)=>(((e,t,l)=>{t in e?xl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l})(e,"symbol"!=typeof t?t+"":t,l),l);class Sl extends ye{constructor(e){super(e),Tl(this,"componentDidCatch",((e,t)=>console.error(e,t.componentStack))),this.state={e:0}}render(){return this.state.e?we("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}Tl(Sl,"getDerivedStateFromError",(()=>({e:1})));const Ol=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return we("header",null,we("img",{title:Ge}),we("span",null,Ge),qe(Ke,((e,t)=>t==r?null:we("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),we("img",{onClick:o,title:"Close"}))},ql=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?we("main",{"data-position":n},we(Ol,{s:e}),we(Sl,null,we(kl,{s:e}))):null},Vl=e=>t=>{return l=(t,l)=>t+e(l),Ml(t).reduce(l,0);var l},Nl=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Pl=Vl(Nl),Ll=Vl(Pl),Rl=Vl(Ll),El=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},jl=e=>pe(e)||0==Nl(e),Ml=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},zl=e=>e.clear(),$l=(e,t)=>null==e?void 0:e.forEach(t),Al=(e,t)=>null==e?void 0:e.delete(t),Fl=e=>new Map(e),Jl=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Dl=(e,t)=>null==e?void 0:e.get(t),Bl=(e,t)=>$l(e,((e,l)=>t(l,e))),Wl=(e,t,l)=>pe(l)?(Al(e,t),e):null==e?void 0:e.set(t,l),Hl=(e,t,l)=>(El(e,t)||Wl(e,t,l()),Dl(e,t)),Ql=(e,t,l,n=Wl)=>(De(t,((t,n)=>l(e,n,t))),Bl(e,(l=>Fe(t,l)?0:n(e,l))),e),Gl=(e,t,l)=>{const n={};return $l(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Kl=(e,t,l)=>Gl(e,(e=>Gl(e,t,l)),Be),Ul=(e,t,l)=>Gl(e,(e=>Kl(e,t,l)),Be),Xl=(e,t)=>{const l=Fl();return $l(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Yl=e=>Xl(e,Xl),Zl=e=>Xl(e,Yl),_l=(e,t,l,n,r=0)=>be((l?Hl:Dl)(e,t[r],r>Ve(t)-2?l:Fl),(o=>{if(r>Ve(t)-2)return(null==n?void 0:n(o))&&Wl(e,t[r]),o;const s=_l(o,t,l,n,r+1);return jl(o)&&Wl(e,t[r]),s}));var en=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const tn=Fl(),ln=Fl();var nn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const rn="storage",on=globalThis.window,sn=e=>new Set(fe(e)||pe(e)?e:[e]),an=(e,t)=>null==e?void 0:e.add(t),dn=/^\d+$/,un=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{dn.test(t)&&Ve(e)<1e3&&Le(e,t)}]},cn=e=>[e,e],hn=(e,t=Pl)=>t(e[0])+t(e[1]),mn=()=>[Fl(),Fl()],pn=e=>[...e],bn=([e,t])=>e===t,vn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),gn=(e,t,l)=>Wl(e,t,Dl(e,t)==-l?void 0:l),fn=()=>{let e,t,l=!1,n=!1,r=0;const o=Fl(),s=Fl(),a=Fl(),i=Fl(),d=Fl(),u=Fl(),c=Fl(),h=Fl(),m=Fl(),p=Fl(),b=Fl(),v=Fl(),g=Fl(),f=Fl(),y=sn(),I=Fl(),w=Fl(),C=Fl(),k=Fl(),x=mn(),T=mn(),S=mn(),O=mn(),q=mn(),V=mn(),N=mn(),P=mn(),L=mn(),R=mn(),E=mn(),j=mn(),M=mn(),z=mn(),$=mn(),A=Fl(),F=mn(),[J,D,W,H]=(e=>{let t;const[l,n]=un(),r=Fl();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Wl(r,i,[e,n,o,s,a]),an(_l(n,null!=o?o:[B],sn),i),i},(e,l,...n)=>Oe(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ve(t)?Le(l,e):null===t[r]?$l(e,(e=>n(e,r+1))):Oe([t[r],null],(t=>n(Dl(e,t),r+1)));return n(e,0),l})(e,l),(e=>$l(e,(e=>Dl(r,e)[0](t,...null!=l?l:[],...n))))),e=>be(Dl(r,e),(([,t,l])=>(_l(t,null!=l?l:[B],void 0,(t=>(Al(t,e),jl(t)?1:0))),Wl(r,e),n(e),l))),e=>be(Dl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ve(s);d==Ve(l)?e(t,...s,...r(s)):pe(l[d])?Oe(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!vn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!ve(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||El(b,l)||et(l))&&vn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>vn(n?l:me(l,e,t),((n,r)=>be(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?be(Dl(Dl(b,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>vn(t?e:fe(e),((t,l)=>be(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?be(Dl(g,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(be(Dl(v,t),(([n,r])=>{$l(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&($l(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(y,(t=>{Fe(e,t)||tt(t)}))),e),ye=e=>Ql(b,e,((e,t,l)=>{const n=Fl(),r=sn();Ql(Hl(b,t,Fl),l,((e,t,l)=>{Wl(e,t,l),be(l[U],(e=>Wl(n,t,e)),(()=>an(r,t)))})),Wl(v,t,[n,r])}),((e,t)=>{Wl(b,t),Wl(v,t)})),Ie=e=>Ql(g,e,((e,t,l)=>{Wl(g,t,l),be(l[U],(e=>Wl(f,t,e)),(()=>an(y,t)))}),((e,t)=>{Wl(g,t),Wl(f,t),Al(y,t)})),we=e=>Be(e)?Nt():Ct(e),Ce=e=>Ql(C,e,((e,t,l)=>ke(t,l)),((e,t)=>$e(t))),ke=(e,t)=>Ql(Hl(C,e,(()=>(Ke(e,1),Wl(I,e,un()),Wl(w,e,Fl()),Fl()))),t,((t,l,n)=>xe(e,t,l,n)),((t,l)=>Ae(e,t,l))),xe=(e,t,l,n,r)=>Ql(Hl(t,l,(()=>(Ue(e,l,1),Fl()))),n,((t,n,r)=>Te(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Te=(e,t,l,n,r)=>{El(l,n)||Xe(e,t,n,1);const o=Dl(l,n);r!==o&&(Ye(e,t,n,o,r),Wl(l,n,r))},Se=(e,t,l,n,r)=>be(Dl(t,l),(t=>Te(e,l,t,n,r)),(()=>xe(e,t,l,me({[n]:r},e,l)))),Ne=e=>Be(e)?Rt():kt(e),Re=e=>Ql(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{El(k,e)||Ze(e,1);const l=Dl(k,e);t!==l&&(_e(e,l,t),Wl(k,e,t))},je=(e,t)=>{const[l]=Dl(I,e),n=l(t);return El(Dl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Dl(C,e))?t:ke(e,{})},$e=e=>ke(e,{}),Ae=(e,t,l)=>{const[,n]=Dl(I,e);n(l),xe(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Dl(null==(s=Dl(v,e))?void 0:s[0],r);if(!pe(a)&&!o)return Te(e,l,n,r,a);const i=t=>{Ye(e,l,t,Dl(n,t)),Xe(e,l,t,-1),Wl(n,t)};pe(a)?i(r):Bl(n,i),jl(n)&&(Ue(e,l,-1),jl(Wl(t,l))&&(Ke(e,-1),Wl(C,e),Wl(I,e),Wl(w,e)))},Ge=e=>{const t=Dl(f,e);if(!pe(t))return Ee(e,t);_e(e,Dl(k,e)),Ze(e,-1),Wl(k,e)},Ke=(e,t)=>gn(o,e,t),Ue=(e,t,l)=>gn(Hl(i,e,Fl),t,l)&&Wl(a,e,Hl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Dl(w,e),a=null!=(r=Dl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&gn(Hl(s,e,Fl),l,n),Wl(o,l,a!=-n?a+n:null),gn(Hl(Hl(d,e,Fl),t,Fl),l,n)},Ye=(e,t,l,n,r)=>Hl(Hl(Hl(u,e,Fl),t,Fl),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>gn(c,e,t),_e=(e,t,l)=>Hl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Hl(Hl(Hl(m,e,Fl),t,Fl),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Hl(p,e,(()=>[])),t),l),lt=(e,t,l)=>be(Dl(Dl(Dl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(ft(e,t,l))])),nt=e=>be(Dl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(wt(e))])),rt=e=>jl(m)||jl(E[e])?0:$l(e?Zl(m):m,((t,l)=>$l(t,((t,n)=>$l(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>jl(p)||jl(j[e])?0:$l(e?Xl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!jl(t))return D(e,l,(()=>Gl(t))),1},at=e=>{const t=jl(N[e]),l=jl(L[e])&&jl(O[e])&&jl(q[e])&&jl(V[e])&&t&&jl(T[e]),n=jl(R[e])&&jl(P[e])&&jl(S[e])&&jl(x[e]);if(!l||!n){const r=e?[Xl(o),Yl(s),Xl(a),Yl(i),Zl(d),Zl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),$l(r[1],((t,l)=>st(O[e],t,[l]))),$l(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=sn();$l(r[3],((n,r)=>{st(V[e],n,[r])&&!t&&(D(N[e],[r,null]),an(l,r))})),t||$l(r[5],((t,n)=>{if(!El(l,n)){const l=sn();$l(t,(e=>$l(e,(([t,n],r)=>n!==t?an(l,r):Al(e,r))))),$l(l,(t=>D(N[e],[n,t])))}})),$l(r[4],((t,l)=>$l(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;$l(r[5],((l,n)=>{let r;$l(l,((l,o)=>{let s;$l(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=jl(z[e]),l=jl($[e])&&jl(M[e]);if(!t||!l){const n=e?[Xl(c),Xl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;$l(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...qe(t,ue)))),At),ut=()=>[Gl(u,((e,t)=>-1===Dl(o,t)?null:Gl(e,((e,l)=>-1===Dl(Dl(i,t),l)?null:Gl(e,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))),Be)),Be),Gl(h,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Ul(u,pn,bn),invalidCells:Ul(m),changedValues:Gl(h,pn,bn),invalidValues:Gl(p),changedTableIds:Gl(o),changedRowIds:Kl(i),changedCellIds:Ul(d),changedValueIds:Gl(c)}),ht=()=>Ul(C),mt=()=>Jl(C),pt=e=>Nl(Dl(C,ue(e))),bt=e=>Jl(Dl(C,ue(e))),vt=(e,t,l,n=0,r)=>{return qe(Pe((s=Dl(C,ue(e)),a=(e,l)=>[pe(t)?l:Dl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},qe([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},gt=(e,t)=>Jl(Dl(Dl(C,ue(e)),ue(t))),ft=(e,t,l)=>Dl(Dl(Dl(C,ue(e)),ue(t)),ue(l)),yt=()=>Gl(k),It=()=>Jl(k),wt=e=>Dl(k,ue(e)),Ct=e=>dt((()=>(e=>vn(e,X,et))(e)?Ce(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{we(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=vn(t,(e=>vn(e,G))))&&(ye(t),!jl(C))){const e=ht();Nt(),Ct(e)}})),Vt=e=>dt((()=>{if(t=(e=>vn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ie(e),kt(l)}})),Nt=()=>dt((()=>Ce({}))),Pt=e=>dt((e=>El(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>be(Dl(C,e),(l=>El(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{ye({}),e=!1})),jt=()=>dt((()=>{Ie({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!jl(u),n=!jl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&($l(u,((e,t)=>$l(e,((e,l)=>$l(e,(([e],n)=>Ot(At,t,l,n,e))))))),$l(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Oe([o,s,a,i,d,u,m,c,h,p],zl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Kl(Dl(C,ue(e))),getTableCellIds:e=>Jl(Dl(w,ue(e))),getRowCount:pt,getRowIds:bt,getSortedRowIds:vt,getRow:(e,t)=>Gl(Dl(Dl(C,ue(e)),ue(t))),getCellIds:gt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!jl(C),hasTable:e=>El(C,ue(e)),hasTableCell:(e,t)=>El(Dl(w,ue(e)),ue(t)),hasRow:(e,t)=>El(Dl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>El(Dl(Dl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!jl(k),hasValue:e=>El(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(b),getValuesSchemaJson:()=>We(g),getSchemaJson:()=>We([b,g]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Nt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?ke(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?xe(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),xe(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>Se(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>be(de(e,t,l,ge(n)?n(ft(e,t,l)):n),(n=>Se(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>be(he(e,ge(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Ne(He(e))}catch(e){}return At},setJson:e=>{try{const[t,l]=He(e);we(t),Ne(l)}catch(t){xt(e)}return At},setTablesSchema:Tt,setValuesSchema:Vt,setSchema:(e,t)=>dt((()=>{Tt(e),Vt(t)})),delTables:Nt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>be(Dl(C,e),(r=>be(Dl(r,t),(o=>El(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>El(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>$l(C,((t,l)=>e(l,(e=>$l(t,((t,l)=>e(l,(e=>Bl(t,e))))))))),forEachTableCell:(e,t)=>Bl(Dl(w,ue(e)),t),forEachRow:(e,t)=>$l(Dl(C,ue(e)),((e,l)=>t(l,(t=>Bl(e,t))))),forEachCell:(e,t,l)=>Bl(Dl(Dl(C,ue(e)),ue(t)),l),forEachValue:e=>Bl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=vt(e,t,l,n,r);return J((()=>{const s=vt(e,t,l,n,r);var i,d,u;d=a,Ve(i=s)===Ve(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),N[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:hn(x),tableIds:hn(T),tableCellIds:hn(O),table:hn(S),rowCount:hn(q),rowIds:hn(V),sortedRowIds:hn(N),row:hn(P,Ll),cellIds:hn(L,Ll),cell:hn(R,Rl),invalidCell:hn(E,Rl),values:hn(M),valueIds:hn(z),value:hn($),invalidValue:hn(j),transaction:Pl(A)+hn(F)}),createStore:fn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,V,[mt]],[ee]:[2,P,[mt,bt]],[re]:[2,L,[mt,bt]],[ne]:[3,R,[mt,bt,gt],e=>cn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>cn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?Pe(r,0,e):void 0,l,n)})),ze(At)},yn=({position:e="right",open:t=!1})=>{const l=F(fn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,s=[])=>{let a,i,d,u=0,c=0,h=0,m=0;Hl(tn,s,(()=>0)),Hl(ln,s,(()=>[]));const p=e=>en(void 0,null,(function*(){return 2!=u&&(u=1,c++,yield b.schedule((()=>en(void 0,null,(function*(){yield e(),u=0}))))),b})),b={load:(l,n)=>en(void 0,null,(function*(){return yield p((()=>en(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>en(void 0,[...l],(function*(l={},r={}){return b.stopAutoLoad(),yield b.load(l,r),m=1,d=n(((l,n)=>en(void 0,null,(function*(){if(n){const t=n();yield p((()=>en(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield p((()=>en(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),b})),stopAutoLoad:()=>(m&&(r(d),d=void 0,m=0),b),save:t=>en(void 0,null,(function*(){return 1!=u&&(u=2,h++,yield b.schedule((()=>en(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}u=0}))))),b})),startAutoSave:()=>en(void 0,null,(function*(){return yield b.stopAutoSave().save(),a=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||b.save((()=>[l,n]))})),b})),stopAutoSave:()=>(be(a,e.delListener),b),schedule:(...e)=>en(void 0,null,(function*(){return Le(Dl(ln,s),...e),yield en(void 0,null,(function*(){if(!Dl(tn,s)){for(Wl(tn,s,1);!pe(i=Re(Dl(ln,s)));)try{yield i()}catch(e){null==o||o(e)}Wl(tn,s,0)}})),b})),getStore:()=>e,destroy:()=>b.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return ze(b)})(e,(()=>nn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>nn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return on.addEventListener(rn,n),n}),(e=>on.removeEventListener(rn,e)),n))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),we(Ie,null,we("aside",{id:Qe},we(xt,{s:l}),we(ql,{s:l})),we("style",null,kt))};var In=Object.defineProperty,wn=Object.getOwnPropertySymbols,Cn=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,xn=(e,t,l)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const Tn=e=>we(yn,((e,t)=>{for(var l in t||(t={}))Cn.call(t,l)&&xn(e,l,t[l]);if(wn)for(var l of wn(t))kn.call(t,l)&&xn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,Tn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
|
|
1
|
+
import e from"react";import{useCell as t,useValue as l,useSetValueCallback as n,useSetCellCallback as r,useRowIds as o,useTableCellIds as s,useRowCount as a,useSortedRowIds as i,useValueIds as d,ValueView as u,useIndexesOrIndexesById as c,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useResultRowIds as p,useResultTableCellIds as b,useResultRowCount as v,useResultSortedRowIds as g,useStoreOrStoreById as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as C,useIndexIds as k,useSliceIds as x,useMetrics as T,useMetricIds as S,useMetric as O,useQueries as q,useQueryIds as V,useRelationships as N,useRelationshipIds as P,useStore as L,useTableIds as R,useValues as E,useStoreIds as j,useMetricsIds as M,useIndexesIds as z,useRelationshipsIds as $,useQueriesIds as A,useCreateStore as F,useCreatePersister as J}from"./ui-react";const D=e=>typeof e,B="",W=D(B),H=D(!0),Q=D(0),G=D(D),K="type",U="default",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",le=ee+X,ne="Cell",re=ne+X,oe="Value",se=oe+"s",ae=oe+X,ie="currentTarget",de="value",ue=e=>B+e,ce=Math.floor,he=isFinite,me=(e,t)=>e instanceof t,pe=e=>null==e,be=(e,t,l)=>pe(e)?null==l?void 0:l():t(e),ve=e=>e==W||e==H,ge=e=>D(e)==G,fe=e=>Array.isArray(e),{PureComponent:ye,Fragment:Ie,createElement:we,useCallback:Ce,useLayoutEffect:ke,useRef:xe,useState:Te}=e,Se=(e,...t)=>pe(e)?{}:e(...t),Oe=(e,t)=>e.forEach(t),qe=(e,t)=>e.map(t),Ve=e=>e.length,Ne=e=>0==Ve(e),Pe=(e,t,l)=>e.slice(t,l),Le=(e,...t)=>e.push(...t),Re=e=>e.shift(),Ee=Object,je=Ee.keys,Me=Ee.isFrozen,ze=Ee.freeze,$e=e=>me(e,Ee)&&e.constructor==Ee,Ae=(e=[])=>Ee.fromEntries(e),Fe=(e,t)=>!pe(((e,t)=>be(e,(e=>e[t])))(e,t)),Je=(e,t)=>(delete e[t],e),De=(e,t)=>qe(Ee.entries(e),(([e,l])=>t(l,e))),Be=e=>$e(e)&&0==(e=>Ve(je(e)))(e),We=e=>JSON.stringify(e,((e,t)=>me(t,Map)?Ee.fromEntries([...t]):t)),He=JSON.parse,Qe="tinybaseStoreInspector",Ge="TinyBase Store Inspector",Ke=["left","top","bottom","right","full"],Ue="state",Xe="sort",Ye="open",Ze="position",_e=Ye,et="editable",tt=(...e)=>We(e),lt=(e,t)=>qe(e.sort(),t),nt=(e,l)=>[!!t(Ue,e,et,l),Ce((t=>{l.setCell(Ue,e,et,(e=>!e)),t.preventDefault()}),[l,e])],rt="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ot='content:url("',st=ot+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",at='</svg>")',it=ot+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",dt=qe([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,n])=>st+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${n}' fill='white'/>`+at)),ut=st+"<path d='M20 20l60 60M20 80l60-60' />"+at,ct=st+`<path d='${rt}' />`+at,ht=st+`<path d='${rt}M20 20l60 60' />`+at;var mt=Object.defineProperty,pt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,yt=(e,t,l)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,It=(e,t)=>{for(var l in t||(t={}))gt.call(t,l)&&yt(e,l,t[l]);if(vt)for(var l of vt(t))ft.call(t,l)&&yt(e,l,t[l]);return e},wt=(e,t)=>pt(e,bt(t));const Ct="*::-webkit-scrollbar",kt=`#${Qe}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,t="")=>e.join(t))(De(wt(It(wt(It(wt(It({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Ct]:"width:0.5rem;height:0.5rem;",[Ct+"-track"]:"background:#111",[Ct+"-thumb"]:"background:#999;border:1px solid #111",[Ct+"-thumb:hover"]:"background:#fff",[Ct+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+it},Ae(qe(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),Ae(qe(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":it,"header>img:nth-of-type(6)":ut}),Ae(qe(dt,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":ct,"details[open]>summary img.done":ht,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`& ${t}{${e}}`:"")))}`,xt=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!0),[],e);return l(_e,e)?null:we("img",{onClick:o,title:Ge,"data-position":r})},Tt=({uniqueId:e,summary:l,editable:n,handleEditable:o,children:s,s:a})=>{const i=!!t(Ue,e,Ye,a),d=r(Ue,e,Ye,(e=>e[ie].open),[],a);return we("details",{open:i,onToggle:d},we("summary",null,l,o?we("img",{onClick:o,className:n?"done":"edit"}):null),s)},St=e=>{const t=D(e);return ve(t)||t==Q&&he(e)?t:void 0},Ot=(e,t,l,n,r)=>pe(r)?e.delCell(t,l,n,!0):e.setCell(t,l,n,r),qt=(e,t,l)=>pe(l)?e.delValue(t):e.setValue(t,l),Vt=(e,t,l,n)=>e==W?t:e==Q?l:n;var Nt=Object.defineProperty,Pt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=(e,t,l)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,zt=(e,t)=>{for(var l in t||(t={}))Et.call(t,l)&&Mt(e,l,t[l]);if(Rt)for(var l of Rt(t))jt.call(t,l)&&Mt(e,l,t[l]);return e},$t=(e,t)=>Pt(e,Lt(t)),At=(e,t)=>{var l={};for(var n in e)Et.call(e,n)&&t.indexOf(n)<0&&(l[n]=e[n]);if(null!=e&&Rt)for(var n of Rt(e))t.indexOf(n)<0&&jt.call(e,n)&&(l[n]=e[n]);return l};const{useCallback:Ft,useMemo:Jt,useState:Dt}=e,Bt="editable",Wt=(e,t)=>qe(s(e,t),(t=>e+"."+t)),Ht=(e,t,l)=>{const n=Ft(e,t);return l?n:void 0},Qt=(...e)=>Jt((()=>e),e),Gt=(e,t)=>Jt((()=>({store:e,tableId:t})),[e,t]),Kt=(e,t)=>Jt((()=>({queries:e,queryId:t})),[e,t]),Ut=(e,t=!1,l,n=0,r,o,s,a)=>{const[[i,d,u],c]=Dt([e,t,n]),h=Ft((e=>{c(e),null==a||a(e)}),[a]),m=Ht((e=>h([e,e==i&&!d,u])),[h,i,d,u],l),p=Ft((e=>h([i,d,e])),[h,i,d]),b=!0===s?ul:s;return[[i,d,u],m,Jt((()=>!1===s?null:we(b,{offset:u,limit:r,total:o,onChange:p})),[s,b,u,r,o,p])]},Xt=(e,t,l)=>Jt((()=>{const n=null!=t?t:e;return Ae(De(fe(n)?Ae(qe(n,(e=>[e,e]))):n,((e,t)=>{return[t,zt(zt({},{label:t,component:l}),(n=e,D(n)==W?{label:e}:e))];var n})))}),[t,l,e]),Yt=({className:e,headerRow:t,idColumn:l,params:[n,r,o,s,a,i]})=>we("table",{className:e},i?we("caption",null,i):null,!1===t?null:we("thead",null,we("tr",null,!1===l?null:we(Zt,{sort:null!=s?s:[],label:"Id",onClick:a}),De(n,(({label:e},t)=>we(Zt,{key:t,cellId:t,label:e,sort:null!=s?s:[],onClick:a}))))),we("tbody",null,qe(o,(e=>we("tr",{key:e},!1===l?null:we("th",null,e),De(n,(({component:t,getComponentProps:l},n)=>we("td",{key:n},we(t,$t(zt(zt({},Se(l,e,n)),r),{rowId:e,cellId:n})))))))))),Zt=({cellId:e,sort:[t,l],label:n=(null!=e?e:B),onClick:r})=>we("th",{onClick:Ht((()=>null==r?void 0:r(e)),[r,e],r),className:pe(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},pe(l)||t!=e?null:(l?"↓":"↑")+" ",n),_t=({localRowId:t,params:[l,n,r,o,s,a,i]})=>{const d=y(s,t,a);return we("tr",null,!1===l?null:we(e.Fragment,null,we("th",null,t),we("th",null,d)),De(n,(({component:e,getComponentProps:l},n)=>{const[s,a]=n.split(".",2),u=s===r?t:s===o?d:null;return pe(u)?null:we("td",{key:n},we(e,$t(zt({},Se(l,u,a)),{store:i,tableId:s,rowId:u,cellId:a})))})))},el=({thing:e,onThingChange:t,className:l,hasSchema:n})=>{const[r,o]=Dt(),[s,a]=Dt(),[i,d]=Dt(),[u,c]=Dt(),[h,m]=Dt();s!==e&&(o(St(e)),a(e),d(e+""),c(Number(e)||0),m(!!e));const p=Ft(((e,l)=>{l(e),a(e),t(e)}),[t]);return we("div",{className:l},we("button",{className:r,onClick:Ft((()=>{if(!(null==n?void 0:n())){const e=Vt(r,Q,H,W),l=Vt(e,i,u,h);o(e),a(l),t(l)}}),[n,t,i,u,h,r])},r),Vt(r,we("input",{key:r,value:i,onChange:Ft((e=>p(e[ie][de]+"",d)),[p])}),we("input",{key:r,type:"number",value:u,onChange:Ft((e=>p(Number(e[ie][de]||0),c)),[p])}),we("input",{key:r,type:"checkbox",checked:h,onChange:Ft((e=>p(!!e[ie].checked,m)),[p])})))},tl=e=>{var t=e,{tableId:l,store:n,editable:r,customCells:a}=t,i=At(t,["tableId","store","editable","customCells"]);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(l,n),a,r?il:I),Gt(n,l),o(l,n))}))},ll=e=>{var t=e,{tableId:l,cellId:n,descending:r,offset:o,limit:d,store:u,editable:c,sortOnClick:h,paginator:m=!1,onChange:p,customCells:b}=t,v=At(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,y]=Ut(n,r,h,o,d,a(l,u),m,p);return we(Yt,$t(zt({},v),{params:Qt(Xt(s(l,u),b,c?il:I),Gt(u,l),i(l,...g,d,u),g,f,y)}))},nl=({store:e,editable:t=!1,valueComponent:l=(t?dl:u),getValueComponentProps:n,className:r,headerRow:o,idColumn:s})=>we("table",{className:r},!1===o?null:we("thead",null,we("tr",null,!1===s?null:we("th",null,"Id"),we("th",null,oe))),we("tbody",null,qe(d(e),(t=>we("tr",{key:t},!1===s?null:we("th",null,t),we("td",null,we(l,$t(zt({},Se(n,t)),{valueId:t,store:e})))))))),rl=e=>{var t=e,{indexId:l,sliceId:n,indexes:r,editable:o,customCells:a}=t,i=At(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(c(r),l);return we(Yt,$t(zt({},i),{params:Qt(Xt(s(m,u),a,o?il:I),Gt(u,m),h(l,n,d))}))},ol=({relationshipId:t,relationships:l,editable:n,customCells:r,className:s,headerRow:a,idColumn:i=!0})=>{const[d,u,c,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(m(l),t),p=Xt([...Wt(c,u),...Wt(h,u)],r,n?il:I),b=Qt(i,p,c,h,t,d,u);return we("table",{className:s},!1===a?null:we("thead",null,we("tr",null,!1===i?null:we(e.Fragment,null,we("th",null,c,".Id"),we("th",null,h,".Id")),De(p,(({label:e},t)=>we("th",{key:t},e))))),we("tbody",null,qe(o(c,u),(e=>we(_t,{key:e,localRowId:e,params:b})))))},sl=e=>{var t=e,{queryId:l,queries:n,customCells:r}=t,o=At(t,["queryId","queries","customCells"]);return we(Yt,$t(zt({},o),{params:Qt(Xt(b(l,n),r,w),Kt(n,l),p(l,n))}))},al=e=>{var t=e,{queryId:l,cellId:n,descending:r,offset:o,limit:s,queries:a,sortOnClick:i,paginator:d=!1,customCells:u,onChange:c}=t,h=At(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[m,p,f]=Ut(n,r,i,o,s,v(l,a),d,c);return we(Yt,$t(zt({},h),{params:Qt(Xt(b(l,a),u,w),Kt(a,l),g(l,...m,s,a),m,p,f)}))},il=({tableId:e,rowId:l,cellId:n,store:o,className:s})=>{var a;return we(el,{thing:t(e,l,n,o),onThingChange:r(e,l,n,(e=>e),[],o),className:null!=s?s:Bt+ne,hasSchema:null==(a=f(o))?void 0:a.hasTablesSchema})},dl=({valueId:e,store:t,className:r})=>{var o;return we(el,{thing:l(e,t),onThingChange:n(e,(e=>e),[],t),className:null!=r?r:Bt+oe,hasSchema:null==(o=f(t))?void 0:o.hasValuesSchema})},ul=({onChange:t,total:l,offset:n=0,limit:r=l,singular:o="row",plural:s=o+"s"})=>{(n>l||n<0)&&(n=0,t(0));const a=Ht((()=>t(n-r)),[t,n,r],n>0),i=Ht((()=>t(n+r)),[t,n,r],n+r<l);return we(e.Fragment,null,l>r&&we(e.Fragment,null,we("button",{className:"previous",disabled:0==n,onClick:a},"←"),we("button",{className:"next",disabled:n+r>=l,onClick:i},"→"),n+1," to ",Math.min(l,n+r)," of "),l," ",1!=l?s:o)},cl=({indexes:e,indexesId:t,indexId:l,s:n})=>we(Tt,{uniqueId:tt("i",t,l),summary:"Index: "+l,s:n},qe(x(l,e),(r=>we(hl,{indexes:e,indexesId:t,indexId:l,sliceId:r,s:n})))),hl=({indexes:e,indexesId:t,indexId:l,sliceId:n,s:r})=>{const o=tt("i",t,l,n),[s,a]=nt(o,r);return we(Tt,{uniqueId:o,summary:"Slice: "+n,editable:s,handleEditable:a,s:r},we(rl,{sliceId:n,indexId:l,indexes:e,editable:s}))},ml=({indexesId:e,s:t})=>{const l=C(e),n=k(l);return pe(l)?null:we(Tt,{uniqueId:tt("i",e),summary:"Indexes: "+(null!=e?e:U),s:t},Ne(n)?"No indexes defined":lt(n,(n=>we(cl,{indexes:l,indexesId:e,indexId:n,s:t}))))},pl=({metrics:e,metricId:t})=>we("tr",null,we("th",null,t),we("td",null,null==e?void 0:e.getTableId(t)),we("td",null,O(t,e))),bl=({metricsId:e,s:t})=>{const l=T(e),n=S(l);return pe(l)?null:we(Tt,{uniqueId:tt("m",e),summary:"Metrics: "+(null!=e?e:U),s:t},Ne(n)?"No metrics defined":we("table",null,we("thead",null,we("th",null,"Metric Id"),we("th",null,"Table Id"),we("th",null,"Metric")),we("tbody",null,qe(n,(e=>we(pl,{metrics:l,metricId:e}))))))},vl=({queries:e,queriesId:l,queryId:n,s:o})=>{var s;const a=tt("q",l,n),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o);return we(Tt,{uniqueId:a,summary:"Query: "+n,s:o},we(al,{queryId:n,queries:e,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},gl=({queriesId:e,s:t})=>{const l=q(e),n=V(l);return pe(l)?null:we(Tt,{uniqueId:tt("q",e),summary:"Queries: "+(null!=e?e:U),s:t},Ne(n)?"No queries defined":lt(n,(n=>we(vl,{queries:l,queriesId:e,queryId:n,s:t}))))},fl=({relationships:e,relationshipsId:t,relationshipId:l,s:n})=>{const r=tt("r",t,l),[o,s]=nt(r,n);return we(Tt,{uniqueId:r,summary:"Relationship: "+l,editable:o,handleEditable:s,s:n},we(ol,{relationshipId:l,relationships:e,editable:o}))},yl=({relationshipsId:e,s:t})=>{const l=N(e),n=P(l);return pe(l)?null:we(Tt,{uniqueId:tt("r",e),summary:"Relationships: "+(null!=e?e:U),s:t},Ne(n)?"No relationships defined":lt(n,(n=>we(fl,{relationships:l,relationshipsId:e,relationshipId:n,s:t}))))},Il=({tableId:e,store:l,storeId:n,s:o})=>{var s;const a=tt("t",n,e),[i,d,u]=He(null!=(s=t(Ue,a,Xe,o))?s:"[]"),c=r(Ue,a,Xe,We,[],o),[h,m]=nt(a,o);return we(Tt,{uniqueId:a,summary:Y+": "+e,editable:h,handleEditable:m,s:o},we(ll,{tableId:e,store:l,cellId:i,descending:d,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:h}))},wl=({store:e,storeId:t,s:l})=>{const n=tt("v",t),[r,o]=nt(n,l);return Ne(d(e))?null:we(Tt,{uniqueId:n,summary:se,editable:r,handleEditable:o,s:l},we(nl,{store:e,editable:r}))},Cl=({storeId:e,s:t})=>{const l=L(e),n=R(l);return pe(l)?null:we(Tt,{uniqueId:tt("s",e),summary:"Store: "+(null!=e?e:U),s:t},we(wl,{storeId:e,store:l,s:t}),lt(n,(n=>we(Il,{store:l,storeId:e,tableId:n,s:t}))))},kl=({s:e})=>{const t=xe(null),l=xe(0),[n,r]=Te(!1),{scrollLeft:o,scrollTop:s}=E(e);ke((()=>{const e=t.current;if(e&&!n){const t=new MutationObserver((()=>{e.scrollWidth>=ce(o)+e.clientWidth&&e.scrollHeight>=ce(s)+e.clientHeight&&e.scrollTo(o,s)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[n,o,s]);const a=Ce((t=>{const{scrollLeft:n,scrollTop:o}=t[ie];cancelIdleCallback(l.current),l.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:n,scrollTop:o})}))}),[e]),i=L(),d=j(),u=T(),c=M(),h=C(),m=z(),p=N(),b=$(),v=q(),g=A();return pe(i)&&Ne(d)&&pe(u)&&Ne(c)&&pe(h)&&Ne(m)&&pe(p)&&Ne(b)&&pe(v)&&Ne(g)?we("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):we("article",{ref:t,onScroll:a},we(Cl,{s:e}),qe(d,(t=>we(Cl,{storeId:t,key:t,s:e}))),we(bl,{s:e}),qe(c,(t=>we(bl,{metricsId:t,key:t,s:e}))),we(ml,{s:e}),qe(m,(t=>we(ml,{indexesId:t,key:t,s:e}))),we(yl,{s:e}),qe(b,(t=>we(yl,{relationshipsId:t,key:t,s:e}))),we(gl,{s:e}),qe(g,(t=>we(gl,{queriesId:t,key:t,s:e}))))};var xl=Object.defineProperty,Tl=(e,t,l)=>(((e,t,l)=>{t in e?xl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l})(e,"symbol"!=typeof t?t+"":t,l),l);class Sl extends ye{constructor(e){super(e),Tl(this,"componentDidCatch",((e,t)=>console.error(e,t.componentStack))),this.state={e:0}}render(){return this.state.e?we("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}Tl(Sl,"getDerivedStateFromError",(()=>({e:1})));const Ol=({s:e})=>{var t;const r=null!=(t=l(Ze,e))?t:1,o=n(_e,(()=>!1),[],e),s=n(Ze,(e=>Number(e[ie].dataset.id)),[],e);return we("header",null,we("img",{title:Ge}),we("span",null,Ge),qe(Ke,((e,t)=>t==r?null:we("img",{onClick:s,"data-id":t,title:"Dock to "+e,key:t}))),we("img",{onClick:o,title:"Close"}))},ql=({s:e})=>{var t;const n=null!=(t=l(Ze,e))?t:1;return l(_e,e)?we("main",{"data-position":n},we(Ol,{s:e}),we(Sl,null,we(kl,{s:e}))):null},Vl=e=>t=>{return l=(t,l)=>t+e(l),Ml(t).reduce(l,0);var l},Nl=e=>{var t;return null!=(t=null==e?void 0:e.size)?t:0},Pl=Vl(Nl),Ll=Vl(Pl),Rl=Vl(Ll),El=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},jl=e=>pe(e)||0==Nl(e),Ml=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},zl=e=>e.clear(),$l=(e,t)=>null==e?void 0:e.forEach(t),Al=(e,t)=>null==e?void 0:e.delete(t),Fl=e=>new Map(e),Jl=e=>{var t;return[...null!=(t=null==e?void 0:e.keys())?t:[]]},Dl=(e,t)=>null==e?void 0:e.get(t),Bl=(e,t)=>$l(e,((e,l)=>t(l,e))),Wl=(e,t,l)=>pe(l)?(Al(e,t),e):null==e?void 0:e.set(t,l),Hl=(e,t,l)=>(El(e,t)||Wl(e,t,l()),Dl(e,t)),Ql=(e,t,l,n=Wl)=>(De(t,((t,n)=>l(e,n,t))),Bl(e,(l=>Fe(t,l)?0:n(e,l))),e),Gl=(e,t,l)=>{const n={};return $l(e,((e,r)=>{const o=t?t(e,r):e;!(null==l?void 0:l(o,e))&&(n[r]=o)})),n},Kl=(e,t,l)=>Gl(e,(e=>Gl(e,t,l)),Be),Ul=(e,t,l)=>Gl(e,(e=>Kl(e,t,l)),Be),Xl=(e,t)=>{const l=Fl();return $l(e,((e,n)=>{var r;return l.set(n,null!=(r=null==t?void 0:t(e))?r:e)})),l},Yl=e=>Xl(e,Xl),Zl=e=>Xl(e,Yl),_l=(e,t,l,n,r=0)=>be((l?Hl:Dl)(e,t[r],r>Ve(t)-2?l:Fl),(o=>{if(r>Ve(t)-2)return(null==n?void 0:n(o))&&Wl(e,t[r]),o;const s=_l(o,t,l,n,r+1);return jl(o)&&Wl(e,t[r]),s}));var en=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const tn=Fl(),ln=Fl();var nn=(e,t,l)=>new Promise(((n,r)=>{var o=e=>{try{a(l.next(e))}catch(e){r(e)}},s=e=>{try{a(l.throw(e))}catch(e){r(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((l=l.apply(e,t)).next())}));const rn="storage",on=globalThis.window,sn=e=>new Set(fe(e)||pe(e)?e:[e]),an=(e,t)=>null==e?void 0:e.add(t),dn=/^\d+$/,un=()=>{const e=[];let t=0;return[l=>{var n;return null!=(n=l?Re(e):null)?n:B+t++},t=>{dn.test(t)&&Ve(e)<1e3&&Le(e,t)}]},cn=e=>[e,e],hn=(e,t=Pl)=>t(e[0])+t(e[1]),mn=()=>[Fl(),Fl()],pn=e=>[...e],bn=([e,t])=>e===t,vn=(e,t,l)=>pe(e)||!$e(e)||Be(e)||Me(e)?(null==l||l(),!1):(De(e,((l,n)=>{t(l,n)||Je(e,n)})),!Be(e)),gn=(e,t,l)=>Wl(e,t,Dl(e,t)==-l?void 0:l),fn=()=>{let e,t,l=!1,n=!1,r=0;const o=Fl(),s=Fl(),a=Fl(),i=Fl(),d=Fl(),u=Fl(),c=Fl(),h=Fl(),m=Fl(),p=Fl(),b=Fl(),v=Fl(),g=Fl(),f=Fl(),y=sn(),I=Fl(),w=Fl(),C=Fl(),k=Fl(),x=mn(),T=mn(),S=mn(),O=mn(),q=mn(),V=mn(),N=mn(),P=mn(),L=mn(),R=mn(),E=mn(),j=mn(),M=mn(),z=mn(),$=mn(),A=Fl(),F=mn(),[J,D,W,H]=(e=>{let t;const[l,n]=un(),r=Fl();return[(e,n,o,s=[],a=(()=>[]))=>{null!=t||(t=At);const i=l(1);return Wl(r,i,[e,n,o,s,a]),an(_l(n,null!=o?o:[B],sn),i),i},(e,l,...n)=>Oe(((e,t=[B])=>{const l=[],n=(e,r)=>r==Ve(t)?Le(l,e):null===t[r]?$l(e,(e=>n(e,r+1))):Oe([t[r],null],(t=>n(Dl(e,t),r+1)));return n(e,0),l})(e,l),(e=>$l(e,(e=>Dl(r,e)[0](t,...null!=l?l:[],...n))))),e=>be(Dl(r,e),(([,t,l])=>(_l(t,null!=l?l:[B],void 0,(t=>(Al(t,e),jl(t)?1:0))),Wl(r,e),n(e),l))),e=>be(Dl(r,e),(([e,,l=[],n,r])=>{const o=(...s)=>{var a,i;const d=Ve(s);d==Ve(l)?e(t,...s,...r(s)):pe(l[d])?Oe(null!=(i=null==(a=n[d])?void 0:a.call(n,...s))?i:[],(e=>o(...s,e))):o(...s,l[d])};o()}))]})(),G=e=>{if(!vn(e,((e,t)=>[K,U].includes(t))))return!1;const t=e[K];return!(!ve(t)&&t!=Q||(St(e[U])!=t&&Je(e,U),0))},X=(t,l)=>(!e||El(b,l)||et(l))&&vn(t,((e,t)=>ie(l,t,e)),(()=>et(l))),ie=(e,t,l,n)=>vn(n?l:me(l,e,t),((n,r)=>be(de(e,t,r,n),(e=>(l[r]=e,!0)),(()=>!1))),(()=>et(e,t))),de=(t,l,n,r)=>e?be(Dl(Dl(b,t),n),(e=>St(r)!=e[K]?et(t,l,n,r,e[U]):r),(()=>et(t,l,n,r))):pe(St(r))?et(t,l,n,r):r,ce=(e,t)=>vn(t?e:fe(e),((t,l)=>be(he(l,t),(t=>(e[l]=t,!0)),(()=>!1))),(()=>tt())),he=(e,l)=>t?be(Dl(g,e),(t=>St(l)!=t[K]?tt(e,l,t[U]):l),(()=>tt(e,l))):pe(St(l))?tt(e,l):l,me=(e,t,l)=>(be(Dl(v,t),(([n,r])=>{$l(n,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(r,(n=>{Fe(e,n)||et(t,l,n)}))})),e),fe=e=>(t&&($l(f,((t,l)=>{Fe(e,l)||(e[l]=t)})),$l(y,(t=>{Fe(e,t)||tt(t)}))),e),ye=e=>Ql(b,e,((e,t,l)=>{const n=Fl(),r=sn();Ql(Hl(b,t,Fl),l,((e,t,l)=>{Wl(e,t,l),be(l[U],(e=>Wl(n,t,e)),(()=>an(r,t)))})),Wl(v,t,[n,r])}),((e,t)=>{Wl(b,t),Wl(v,t)})),Ie=e=>Ql(g,e,((e,t,l)=>{Wl(g,t,l),be(l[U],(e=>Wl(f,t,e)),(()=>an(y,t)))}),((e,t)=>{Wl(g,t),Wl(f,t),Al(y,t)})),we=e=>Be(e)?Nt():Ct(e),Ce=e=>Ql(C,e,((e,t,l)=>ke(t,l)),((e,t)=>$e(t))),ke=(e,t)=>Ql(Hl(C,e,(()=>(Ke(e,1),Wl(I,e,un()),Wl(w,e,Fl()),Fl()))),t,((t,l,n)=>xe(e,t,l,n)),((t,l)=>Ae(e,t,l))),xe=(e,t,l,n,r)=>Ql(Hl(t,l,(()=>(Ue(e,l,1),Fl()))),n,((t,n,r)=>Te(e,l,t,n,r)),((n,o)=>Qe(e,t,l,n,o,r))),Te=(e,t,l,n,r)=>{El(l,n)||Xe(e,t,n,1);const o=Dl(l,n);r!==o&&(Ye(e,t,n,o,r),Wl(l,n,r))},Se=(e,t,l,n,r)=>be(Dl(t,l),(t=>Te(e,l,t,n,r)),(()=>xe(e,t,l,me({[n]:r},e,l)))),Ne=e=>Be(e)?Rt():kt(e),Re=e=>Ql(k,e,((e,t,l)=>Ee(t,l)),((e,t)=>Ge(t))),Ee=(e,t)=>{El(k,e)||Ze(e,1);const l=Dl(k,e);t!==l&&(_e(e,l,t),Wl(k,e,t))},je=(e,t)=>{const[l]=Dl(I,e),n=l(t);return El(Dl(C,e),n)?je(e,t):n},Me=e=>{var t;return null!=(t=Dl(C,e))?t:ke(e,{})},$e=e=>ke(e,{}),Ae=(e,t,l)=>{const[,n]=Dl(I,e);n(l),xe(e,t,l,{},!0)},Qe=(e,t,l,n,r,o)=>{var s;const a=Dl(null==(s=Dl(v,e))?void 0:s[0],r);if(!pe(a)&&!o)return Te(e,l,n,r,a);const i=t=>{Ye(e,l,t,Dl(n,t)),Xe(e,l,t,-1),Wl(n,t)};pe(a)?i(r):Bl(n,i),jl(n)&&(Ue(e,l,-1),jl(Wl(t,l))&&(Ke(e,-1),Wl(C,e),Wl(I,e),Wl(w,e)))},Ge=e=>{const t=Dl(f,e);if(!pe(t))return Ee(e,t);_e(e,Dl(k,e)),Ze(e,-1),Wl(k,e)},Ke=(e,t)=>gn(o,e,t),Ue=(e,t,l)=>gn(Hl(i,e,Fl),t,l)&&Wl(a,e,Hl(a,e,(()=>0))+l),Xe=(e,t,l,n)=>{var r;const o=Dl(w,e),a=null!=(r=Dl(o,l))?r:0;(0==a&&1==n||1==a&&-1==n)&&gn(Hl(s,e,Fl),l,n),Wl(o,l,a!=-n?a+n:null),gn(Hl(Hl(d,e,Fl),t,Fl),l,n)},Ye=(e,t,l,n,r)=>Hl(Hl(Hl(u,e,Fl),t,Fl),l,(()=>[n,0]))[1]=r,Ze=(e,t)=>gn(c,e,t),_e=(e,t,l)=>Hl(h,e,(()=>[t,0]))[1]=l,et=(e,t,l,n,r)=>(Le(Hl(Hl(Hl(m,e,Fl),t,Fl),l,(()=>[])),n),r),tt=(e,t,l)=>(Le(Hl(p,e,(()=>[])),t),l),lt=(e,t,l)=>be(Dl(Dl(Dl(u,e),t),l),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(ft(e,t,l))])),nt=e=>be(Dl(h,e),(([e,t])=>[!0,e,t]),(()=>[!1,...cn(wt(e))])),rt=e=>jl(m)||jl(E[e])?0:$l(e?Zl(m):m,((t,l)=>$l(t,((t,n)=>$l(t,((t,r)=>D(E[e],[l,n,r],t))))))),ot=e=>jl(p)||jl(j[e])?0:$l(e?Xl(p):p,((t,l)=>D(j[e],[l],t))),st=(e,t,l)=>{if(!jl(t))return D(e,l,(()=>Gl(t))),1},at=e=>{const t=jl(N[e]),l=jl(L[e])&&jl(O[e])&&jl(q[e])&&jl(V[e])&&t&&jl(T[e]),n=jl(R[e])&&jl(P[e])&&jl(S[e])&&jl(x[e]);if(!l||!n){const r=e?[Xl(o),Yl(s),Xl(a),Yl(i),Zl(d),Zl(u)]:[o,s,a,i,d,u];if(!l){st(T[e],r[0]),$l(r[1],((t,l)=>st(O[e],t,[l]))),$l(r[2],((t,l)=>{0!=t&&D(q[e],[l],pt(l))}));const l=sn();$l(r[3],((n,r)=>{st(V[e],n,[r])&&!t&&(D(N[e],[r,null]),an(l,r))})),t||$l(r[5],((t,n)=>{if(!El(l,n)){const l=sn();$l(t,(e=>$l(e,(([t,n],r)=>n!==t?an(l,r):Al(e,r))))),$l(l,(t=>D(N[e],[n,t])))}})),$l(r[4],((t,l)=>$l(t,((t,n)=>st(L[e],t,[l,n])))))}if(!n){let t;$l(r[5],((l,n)=>{let r;$l(l,((l,o)=>{let s;$l(l,(([l,a],i)=>{a!==l&&(D(R[e],[n,o,i],a,l,lt),t=r=s=1)})),s&&D(P[e],[n,o],lt)})),r&&D(S[e],[n],lt)})),t&&D(x[e],void 0,lt)}}},it=e=>{const t=jl(z[e]),l=jl($[e])&&jl(M[e]);if(!t||!l){const n=e?[Xl(c),Xl(h)]:[c,h];if(t||st(z[e],n[0]),!l){let t;$l(n[1],(([l,n],r)=>{n!==l&&(D($[e],[r],n,l,nt),t=1)})),t&&D(M[e],void 0,nt)}}},dt=(e,...t)=>(Mt((()=>e(...qe(t,ue)))),At),ut=()=>[Gl(u,((e,t)=>-1===Dl(o,t)?null:Gl(e,((e,l)=>-1===Dl(Dl(i,t),l)?null:Gl(e,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))),Be)),Be),Gl(h,(([,e])=>null!=e?e:null),((e,t)=>bn(t)))],ct=()=>({cellsTouched:l,valuesTouched:n,changedCells:Ul(u,pn,bn),invalidCells:Ul(m),changedValues:Gl(h,pn,bn),invalidValues:Gl(p),changedTableIds:Gl(o),changedRowIds:Kl(i),changedCellIds:Ul(d),changedValueIds:Gl(c)}),ht=()=>Ul(C),mt=()=>Jl(C),pt=e=>Nl(Dl(C,ue(e))),bt=e=>Jl(Dl(C,ue(e))),vt=(e,t,l,n=0,r)=>{return qe(Pe((s=Dl(C,ue(e)),a=(e,l)=>[pe(t)?l:Dl(e,ue(t)),l],o=([e],[t])=>{return((null!=(n=e)?n:0)<(null!=(r=t)?r:0)?-1:1)*(l?-1:1);var n,r},qe([...null!=(i=null==s?void 0:s.entries())?i:[]],(([e,t])=>a(t,e))).sort(o)),n,pe(r)?r:n+r),(([,e])=>e));var o,s,a,i},gt=(e,t)=>Jl(Dl(Dl(C,ue(e)),ue(t))),ft=(e,t,l)=>Dl(Dl(Dl(C,ue(e)),ue(t)),ue(l)),yt=()=>Gl(k),It=()=>Jl(k),wt=e=>Dl(k,ue(e)),Ct=e=>dt((()=>(e=>vn(e,X,et))(e)?Ce(e):0)),kt=e=>dt((()=>ce(e)?Re(e):0)),xt=e=>{try{we(He(e))}catch(e){}return At},Tt=t=>dt((()=>{if((e=vn(t,(e=>vn(e,G))))&&(ye(t),!jl(C))){const e=ht();Nt(),Ct(e)}})),Vt=e=>dt((()=>{if(t=(e=>vn(e,G))(e)){const l=yt();jt(),Rt(),t=!0,Ie(e),kt(l)}})),Nt=()=>dt((()=>Ce({}))),Pt=e=>dt((e=>El(C,e)?$e(e):0),e),Lt=(e,t)=>dt(((e,t)=>be(Dl(C,e),(l=>El(l,t)?Ae(e,l,t):0))),e,t),Rt=()=>dt((()=>Re({}))),Et=()=>dt((()=>{ye({}),e=!1})),jt=()=>dt((()=>{Ie({}),t=!1})),Mt=(e,t)=>{if(-1!=r){zt();const l=e();return $t(t),l}},zt=()=>(-1!=r&&r++,1==r&&D(A,void 0,ut,ct),At),$t=e=>(r>0&&(r--,0==r&&(l=!jl(u),n=!jl(h),r=1,rt(1),l&&at(1),ot(1),n&&it(1),(null==e?void 0:e(ut,ct))&&($l(u,((e,t)=>$l(e,((e,l)=>$l(e,(([e],n)=>Ot(At,t,l,n,e))))))),$l(h,(([e],t)=>qt(At,t,e))),l=n=!1),D(F[0],void 0,ut,ct),r=-1,rt(0),l&&at(0),ot(0),n&&it(0),D(F[1],void 0,ut,ct),r=0,l=n=!1,Oe([o,s,a,i,d,u,m,c,h,p],zl))),At),At={getContent:()=>[ht(),yt()],getTables:ht,getTableIds:mt,getTable:e=>Kl(Dl(C,ue(e))),getTableCellIds:e=>Jl(Dl(w,ue(e))),getRowCount:pt,getRowIds:bt,getSortedRowIds:vt,getRow:(e,t)=>Gl(Dl(Dl(C,ue(e)),ue(t))),getCellIds:gt,getCell:ft,getValues:yt,getValueIds:It,getValue:wt,hasTables:()=>!jl(C),hasTable:e=>El(C,ue(e)),hasTableCell:(e,t)=>El(Dl(w,ue(e)),ue(t)),hasRow:(e,t)=>El(Dl(C,ue(e)),ue(t)),hasCell:(e,t,l)=>El(Dl(Dl(C,ue(e)),ue(t)),ue(l)),hasValues:()=>!jl(k),hasValue:e=>El(k,ue(e)),getTablesJson:()=>We(C),getValuesJson:()=>We(k),getJson:()=>We([C,k]),getTablesSchemaJson:()=>We(b),getValuesSchemaJson:()=>We(g),getSchemaJson:()=>We([b,g]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:([e,t])=>dt((()=>{(Be(e)?Nt:Ct)(e),(Be(t)?Rt:kt)(t)})),setTables:Ct,setTable:(e,t)=>dt((e=>X(t,e)?ke(e,t):0),e),setRow:(e,t,l)=>dt(((e,t)=>ie(e,t,l)?xe(e,Me(e),t,l):0),e,t),addRow:(e,t,l=!0)=>Mt((()=>{let n;return ie(e,n,t)&&(e=ue(e),xe(e,Me(e),n=je(e,l?1:0),t)),n})),setPartialRow:(e,t,l)=>dt(((e,t)=>{if(ie(e,t,l,1)){const n=Me(e);De(l,((l,r)=>Se(e,n,t,r,l)))}}),e,t),setCell:(e,t,l,n)=>dt(((e,t,l)=>be(de(e,t,l,ge(n)?n(ft(e,t,l)):n),(n=>Se(e,Me(e),t,l,n)))),e,t,l),setValues:kt,setPartialValues:e=>dt((()=>ce(e,1)?De(e,((e,t)=>Ee(t,e))):0)),setValue:(e,t)=>dt((e=>be(he(e,ge(t)?t(wt(e)):t),(t=>Ee(e,t)))),e),setTransactionChanges:e=>dt((()=>{De(e[0],((e,t)=>pe(e)?Pt(t):De(e,((e,l)=>pe(e)?Lt(t,l):De(e,((e,n)=>Ot(At,t,l,n,e))))))),De(e[1],((e,t)=>qt(At,t,e)))})),setTablesJson:xt,setValuesJson:e=>{try{Ne(He(e))}catch(e){}return At},setJson:e=>{try{const[t,l]=He(e);we(t),Ne(l)}catch(t){xt(e)}return At},setTablesSchema:Tt,setValuesSchema:Vt,setSchema:(e,t)=>dt((()=>{Tt(e),Vt(t)})),delTables:Nt,delTable:Pt,delRow:Lt,delCell:(e,t,l,n)=>dt(((e,t,l)=>be(Dl(C,e),(r=>be(Dl(r,t),(o=>El(o,l)?Qe(e,r,t,o,l,n):0))))),e,t,l),delValues:Rt,delValue:e=>dt((e=>El(k,e)?Ge(e):0),e),delTablesSchema:Et,delValuesSchema:jt,delSchema:()=>dt((()=>{Et(),jt()})),transaction:Mt,startTransaction:zt,finishTransaction:$t,forEachTable:e=>$l(C,((t,l)=>e(l,(e=>$l(t,((t,l)=>e(l,(e=>Bl(t,e))))))))),forEachTableCell:(e,t)=>Bl(Dl(w,ue(e)),t),forEachRow:(e,t)=>$l(Dl(C,ue(e)),((e,l)=>t(l,(t=>Bl(e,t))))),forEachCell:(e,t,l)=>Bl(Dl(Dl(C,ue(e)),ue(t)),l),forEachValue:e=>Bl(k,e),addSortedRowIdsListener:(e,t,l,n,r,o,s)=>{let a=vt(e,t,l,n,r);return J((()=>{const s=vt(e,t,l,n,r);var i,d,u;d=a,Ve(i=s)===Ve(d)&&(u=(e,t)=>d[t]===e,i.every(u))||(a=s,o(At,e,t,l,n,r,a))}),N[s?1:0],[e,t],[mt])},addStartTransactionListener:e=>J(e,A),addWillFinishTransactionListener:e=>J(e,F[0]),addDidFinishTransactionListener:e=>J(e,F[1]),callListener:e=>(H(e),At),delListener:e=>(W(e),At),getListenerStats:()=>({tables:hn(x),tableIds:hn(T),tableCellIds:hn(O),table:hn(S),rowCount:hn(q),rowIds:hn(V),sortedRowIds:hn(N),row:hn(P,Ll),cellIds:hn(L,Ll),cell:hn(R,Rl),invalidCell:hn(E,Rl),values:hn(M),valueIds:hn(z),value:hn($),invalidValue:hn(j),transaction:Pl(A)+hn(F)}),createStore:fn,addListener:J,callListeners:D};return De({[Z]:[0,x],[_]:[0,T],[Y]:[1,S,[mt]],[Y+re]:[1,O,[mt]],[te]:[1,q,[mt]],[le]:[1,V,[mt]],[ee]:[2,P,[mt,bt]],[re]:[2,L,[mt,bt]],[ne]:[3,R,[mt,bt,gt],e=>cn(ft(...e))],InvalidCell:[3,E],[se]:[0,M],[ae]:[0,z],[oe]:[1,$,[It],e=>cn(wt(e[0]))],InvalidValue:[1,j]},(([e,t,l,n],r)=>{At["add"+r+"Listener"]=(...r)=>J(r[e],t[r[e+1]?1:0],e>0?Pe(r,0,e):void 0,l,n)})),ze(At)},yn=({position:e="right",open:t=!1})=>{const l=F(fn),n=Ke.indexOf(e);return J(l,(e=>{return((e,t,l,n)=>((e,t,l,n,r,o,s=[])=>{let a,i,d,u=0,c=0,h=0,m=0;Hl(tn,s,(()=>0)),Hl(ln,s,(()=>[]));const p=e=>en(void 0,null,(function*(){return 2!=u&&(u=1,c++,yield b.schedule((()=>en(void 0,null,(function*(){yield e(),u=0}))))),b})),b={load:(l,n)=>en(void 0,null,(function*(){return yield p((()=>en(void 0,null,(function*(){try{e.setContent(yield t())}catch(t){e.setContent([l,n])}}))))})),startAutoLoad:(...l)=>en(void 0,[...l],(function*(l={},r={}){return b.stopAutoLoad(),yield b.load(l,r),m=1,d=n(((l,n)=>en(void 0,null,(function*(){if(n){const t=n();yield p((()=>en(void 0,null,(function*(){return e.setTransactionChanges(t)}))))}else yield p((()=>en(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==l?void 0:l())?n:yield t())}catch(e){null==o||o(e)}}))))})))),b})),stopAutoLoad:()=>(m&&(r(d),d=void 0,m=0),b),save:t=>en(void 0,null,(function*(){return 1!=u&&(u=2,h++,yield b.schedule((()=>en(void 0,null,(function*(){try{yield l(e.getContent,t)}catch(e){null==o||o(e)}u=0}))))),b})),startAutoSave:()=>en(void 0,null,(function*(){return yield b.stopAutoSave().save(),a=e.addDidFinishTransactionListener(((e,t)=>{const[l,n]=t();Be(l)&&Be(n)||b.save((()=>[l,n]))})),b})),stopAutoSave:()=>(be(a,e.delListener),b),schedule:(...e)=>en(void 0,null,(function*(){return Le(Dl(ln,s),...e),yield en(void 0,null,(function*(){if(!Dl(tn,s)){for(Wl(tn,s,1);!pe(i=Re(Dl(ln,s)));)try{yield i()}catch(e){null==o||o(e)}Wl(tn,s,0)}})),b})),getStore:()=>e,destroy:()=>b.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:c,saves:h})};return ze(b)})(e,(()=>nn(void 0,null,(function*(){return He(l.getItem(t))}))),(e=>nn(void 0,null,(function*(){return l.setItem(t,We(e()))}))),(e=>{const n=n=>{n.storageArea===l&&n.key===t&&e((()=>He(n.newValue)))};return on.addEventListener(rn,n),n}),(e=>on.removeEventListener(rn,e)),n))(e,Qe,sessionStorage,t);var t}),void 0,(e=>{return l=function*(){yield e.load(void 0,{position:-1==n?1:n,open:!!t}),yield e.startAutoSave()},new Promise(((e,t)=>{var n=e=>{try{o(l.next(e))}catch(e){t(e)}},r=e=>{try{o(l.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((l=l.apply(void 0,null)).next())}));var l})),we(Ie,null,we("aside",{id:Qe},we(xt,{s:l}),we(ql,{s:l})),we("style",null,kt))};var In=Object.defineProperty,wn=Object.getOwnPropertySymbols,Cn=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,xn=(e,t,l)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;const Tn=e=>we(yn,((e,t)=>{for(var l in t||(t={}))Cn.call(t,l)&&xn(e,l,t[l]);if(wn)for(var l of wn(t))kn.call(t,l)&&xn(e,l,t[l]);return e})({},e));export{il as EditableCellView,dl as EditableValueView,ol as RelationshipInHtmlTable,al as ResultSortedTableInHtmlTable,sl as ResultTableInHtmlTable,rl as SliceInHtmlTable,ll as SortedTableInHtmlTable,ul as SortedTablePaginator,Tn as StoreInspector,tl as TableInHtmlTable,nl as ValuesInHtmlTable};
|
|
Binary file
|
package/lib/es6/ui-react-dom.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as r,useSortedRowIds as n,useValueIds as o,ValueView as a,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as c,useResultTableCellIds as u,useResultRowCount as m,useResultSortedRowIds as h,useCell as p,useSetCellCallback as b,useStoreOrStoreById as g,useValue as f,useSetValueCallback as v,useRemoteRowId as w,CellView as y,ResultCellView as k}from"./ui-react";const C=e=>typeof e,I=C(""),x=C(!0),O=C(0),N="Value",j="currentTarget",z="value",P=isFinite,S=e=>null==e,{PureComponent:$,Fragment:M,createElement:q,useCallback:T,useLayoutEffect:F,useRef:R,useState:E}=e,D=(e,...t)=>S(e)?{}:e(...t),V=(e,t)=>e.map(t),A=Object,B=(e=[])=>A.fromEntries(e),L=(e,t)=>V(A.entries(e),(([e,l])=>t(l,e))),G="tinybaseStoreInspector",H="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",J='content:url("',K=J+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Q='</svg>")',U=J+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",W=V([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>K+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+Q)),X=K+"<path d='M20 20l60 60M20 80l60-60' />"+Q,Y=K+`<path d='${H}' />`+Q,Z=K+`<path d='${H}M20 20l60 60' />`+Q;var _=Object.defineProperty,ee=Object.defineProperties,te=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,oe=(e,t,l)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,ae=(e,t)=>{for(var l in t||(t={}))re.call(t,l)&&oe(e,l,t[l]);if(le)for(var l of le(t))ne.call(t,l)&&oe(e,l,t[l]);return e},ie=(e,t)=>ee(e,te(t));const se="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L(ie(ae(ie(ae(ie(ae({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[se]:"width:0.5rem;height:0.5rem;",[se+"-track"]:"background:#111",[se+"-thumb"]:"background:#999;border:1px solid #111",[se+"-thumb:hover"]:"background:#fff",[se+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+U},B(V(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),B(V(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":U,"header>img:nth-of-type(6)":X}),B(V(W,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":Y,"details[open]>summary img.done":Z,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${G} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`#${G} ${t}{${e}}`:"")));const de=(e,t,l,r)=>e==I?t:e==O?l:r;var ce=Object.defineProperty,ue=Object.defineProperties,me=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,ge=(e,t,l)=>t in e?ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,fe=(e,t)=>{for(var l in t||(t={}))pe.call(t,l)&&ge(e,l,t[l]);if(he)for(var l of he(t))be.call(t,l)&&ge(e,l,t[l]);return e},ve=(e,t)=>ue(e,me(t)),we=(e,t)=>{var l={};for(var r in e)pe.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&he)for(var r of he(e))t.indexOf(r)<0&&be.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:ye,useMemo:ke,useState:Ce}=e,Ie="editable",xe=(e,t)=>V(l(e,t),(t=>e+"."+t)),Oe=(e,t,l)=>{const r=ye(e,t);return l?r:void 0},Ne=(...e)=>ke((()=>e),e),je=(e,t)=>ke((()=>({store:e,tableId:t})),[e,t]),ze=(e,t)=>ke((()=>({queries:e,queryId:t})),[e,t]),Pe=(e,t=!1,l,r=0,n,o,a,i)=>{const[[s,d,c],u]=Ce([e,t,r]),m=ye((e=>{u(e),null==i||i(e)}),[i]),h=Oe((e=>m([e,e==s&&!d,c])),[m,s,d,c],l),p=ye((e=>m([s,d,e])),[m,s,d]),b=!0===a?He:a;return[[s,d,c],h,ke((()=>!1===a?null:q(b,{offset:c,limit:n,total:o,onChange:p})),[a,b,c,n,o,p])]},Se=(e,t,l)=>ke((()=>{const r=null!=t?t:e;return B(L(Array.isArray(r)?B(V(r,(e=>[e,e]))):r,((e,t)=>{return[t,fe(fe({},{label:t,component:l}),(r=e,C(r)==I?{label:e}:e))];var r})))}),[t,l,e]),$e=({className:e,headerRow:t,idColumn:l,params:[r,n,o,a,i,s]})=>q("table",{className:e},s?q("caption",null,s):null,!1===t?null:q("thead",null,q("tr",null,!1===l?null:q(Me,{sort:null!=a?a:[],label:"Id",onClick:i}),L(r,(({label:e},t)=>q(Me,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:i}))))),q("tbody",null,V(o,(e=>q("tr",{key:e},!1===l?null:q("th",null,e),L(r,(({component:t,getComponentProps:l},r)=>q("td",{key:r},q(t,ve(fe(fe({},D(l,e,r)),n),{rowId:e,cellId:r})))))))))),Me=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:n})=>q("th",{onClick:Oe((()=>null==n?void 0:n(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",r),qe=({localRowId:t,params:[l,r,n,o,a,i,s]})=>{const d=w(a,t,i);return q("tr",null,!1===l?null:q(e.Fragment,null,q("th",null,t),q("th",null,d)),L(r,(({component:e,getComponentProps:l},r)=>{const[a,i]=r.split(".",2),c=a===n?t:a===o?d:null;return S(c)?null:q("td",{key:r},q(e,ve(fe({},D(l,c,i)),{store:s,tableId:a,rowId:c,cellId:i})))})))},Te=({thing:e,onThingChange:t,className:l,hasSchema:r})=>{const[n,o]=Ce(),[a,i]=Ce(),[s,d]=Ce(),[c,u]=Ce(),[m,h]=Ce();a!==e&&(o((e=>{const t=C(e);return(e=>e==I||e==x)(t)||t==O&&P(e)?t:void 0})(e)),i(e),d(e+""),u(Number(e)||0),h(!!e));const p=ye(((e,l)=>{l(e),i(e),t(e)}),[t]);return q("div",{className:l},q("button",{className:n,onClick:ye((()=>{if(!(null==r?void 0:r())){const e=de(n,O,x,I),l=de(e,s,c,m);o(e),i(l),t(l)}}),[r,t,s,c,m,n])},n),de(n,q("input",{key:n,value:s,onChange:ye((e=>p(e[j][z]+"",d)),[p])}),q("input",{key:n,type:"number",value:c,onChange:ye((e=>p(Number(e[j][z]||0),u)),[p])}),q("input",{key:n,type:"checkbox",checked:m,onChange:ye((e=>p(!!e[j].checked,h)),[p])})))},Fe=e=>{var r=e,{tableId:n,store:o,editable:a,customCells:i}=r,s=we(r,["tableId","store","editable","customCells"]);return q($e,ve(fe({},s),{params:Ne(Se(l(n,o),i,a?Le:y),je(o,n),t(n,o))}))},Re=e=>{var t=e,{tableId:o,cellId:a,descending:i,offset:s,limit:d,store:c,editable:u,sortOnClick:m,paginator:h=!1,onChange:p,customCells:b}=t,g=we(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[f,v,w]=Pe(a,i,m,s,d,r(o,c),h,p);return q($e,ve(fe({},g),{params:Ne(Se(l(o,c),b,u?Le:y),je(c,o),n(o,...f,d,c),f,v,w)}))},Ee=({store:e,editable:t=!1,valueComponent:l=(t?Ge:a),getValueComponentProps:r,className:n,headerRow:i,idColumn:s})=>q("table",{className:n},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q("th",null,"Id"),q("th",null,N))),q("tbody",null,V(o(e),(t=>q("tr",{key:t},!1===s?null:q("th",null,t),q("td",null,q(l,ve(fe({},D(r,t)),{valueId:t,store:e})))))))),De=e=>{var t=e,{indexId:r,sliceId:n,indexes:o,editable:a,customCells:d}=t,c=we(t,["indexId","sliceId","indexes","editable","customCells"]);const[u,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(i(o),r);return q($e,ve(fe({},c),{params:Ne(Se(l(h,m),d,a?Le:y),je(m,h),s(r,n,u))}))},Ve=({relationshipId:l,relationships:r,editable:n,customCells:o,className:a,headerRow:i,idColumn:s=!0})=>{const[c,u,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(d(r),l),p=Se([...xe(m,u),...xe(h,u)],o,n?Le:y),b=Ne(s,p,m,h,l,c,u);return q("table",{className:a},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q(e.Fragment,null,q("th",null,m,".Id"),q("th",null,h,".Id")),L(p,(({label:e},t)=>q("th",{key:t},e))))),q("tbody",null,V(t(m,u),(e=>q(qe,{key:e,localRowId:e,params:b})))))},Ae=e=>{var t=e,{queryId:l,queries:r,customCells:n}=t,o=we(t,["queryId","queries","customCells"]);return q($e,ve(fe({},o),{params:Ne(Se(u(l,r),n,k),ze(r,l),c(l,r))}))},Be=e=>{var t=e,{queryId:l,cellId:r,descending:n,offset:o,limit:a,queries:i,sortOnClick:s,paginator:d=!1,customCells:c,onChange:p}=t,b=we(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[g,f,v]=Pe(r,n,s,o,a,m(l,i),d,p);return q($e,ve(fe({},b),{params:Ne(Se(u(l,i),c,k),ze(i,l),h(l,...g,a,i),g,f,v)}))},Le=({tableId:e,rowId:t,cellId:l,store:r,className:n})=>{var o;return q(Te,{thing:p(e,t,l,r),onThingChange:b(e,t,l,(e=>e),[],r),className:null!=n?n:Ie+"Cell",hasSchema:null==(o=g(r))?void 0:o.hasTablesSchema})},Ge=({valueId:e,store:t,className:l})=>{var r;return q(Te,{thing:f(e,t),onThingChange:v(e,(e=>e),[],t),className:null!=l?l:Ie+N,hasSchema:null==(r=g(t))?void 0:r.hasValuesSchema})},He=({onChange:t,total:l,offset:r=0,limit:n=l,singular:o="row",plural:a=o+"s"})=>{(r>l||r<0)&&(r=0,t(0));const i=Oe((()=>t(r-n)),[t,r,n],r>0),s=Oe((()=>t(r+n)),[t,r,n],r+n<l);return q(e.Fragment,null,l>n&&q(e.Fragment,null,q("button",{className:"previous",disabled:0==r,onClick:i},"←"),q("button",{className:"next",disabled:r+n>=l,onClick:s},"→"),r+1," to ",Math.min(l,r+n)," of "),l," ",1!=l?a:o)};var Je=Object.defineProperty,Ke=(e,t,l)=>(((e,t,l)=>{t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l})(e,"symbol"!=typeof t?t+"":t,l),l);Ke(class extends ${constructor(e){super(e),Ke(this,"componentDidCatch",((e,t)=>console.error(e,t.componentStack))),this.state={e:0}}render(){return this.state.e?q("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}},"getDerivedStateFromError",(()=>({e:1})));const Qe=e=>new Map(e);Qe(),Qe();const Ue=e=>null;export{Le as EditableCellView,Ge as EditableValueView,Ve as RelationshipInHtmlTable,Be as ResultSortedTableInHtmlTable,Ae as ResultTableInHtmlTable,De as SliceInHtmlTable,Re as SortedTableInHtmlTable,He as SortedTablePaginator,Ue as StoreInspector,Fe as TableInHtmlTable,Ee as ValuesInHtmlTable};
|
|
1
|
+
import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as r,useSortedRowIds as n,useValueIds as o,ValueView as a,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as u,useResultTableCellIds as c,useResultRowCount as m,useResultSortedRowIds as h,useCell as p,useSetCellCallback as g,useStoreOrStoreById as b,useValue as f,useSetValueCallback as v,useRemoteRowId as w,CellView as y,ResultCellView as k}from"./ui-react";const C=e=>typeof e,I=C(""),x=C(!0),O=C(0),N="Value",j="currentTarget",P="value",z=isFinite,S=e=>null==e,{PureComponent:M,Fragment:$,createElement:q,useCallback:T,useLayoutEffect:F,useRef:R,useState:E}=e,D=(e,...t)=>S(e)?{}:e(...t),V=(e,t)=>e.map(t),A=Object,B=(e=[])=>A.fromEntries(e),L=(e,t)=>V(A.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",U=V([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K;var Z=Object.defineProperty,_=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,ne=(e,t,l)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,oe=(e,t)=>{for(var l in t||(t={}))le.call(t,l)&&ne(e,l,t[l]);if(te)for(var l of te(t))re.call(t,l)&&ne(e,l,t[l]);return e},ae=(e,t)=>_(e,ee(t));const ie="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(L(ae(oe(ae(oe(ae(oe({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ie]:"width:0.5rem;height:0.5rem;",[ie+"-track"]:"background:#111",[ie+"-thumb"]:"background:#999;border:1px solid #111",[ie+"-thumb:hover"]:"background:#fff",[ie+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+Q},B(V(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),B(V(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Q,"header>img:nth-of-type(6)":W}),B(V(U,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":X,"details[open]>summary img.done":Y,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`& ${t}{${e}}`:"")));const se=(e,t,l,r)=>e==I?t:e==O?l:r;var de=Object.defineProperty,ue=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,ge=(e,t,l)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,be=(e,t)=>{for(var l in t||(t={}))he.call(t,l)&&ge(e,l,t[l]);if(me)for(var l of me(t))pe.call(t,l)&&ge(e,l,t[l]);return e},fe=(e,t)=>ue(e,ce(t)),ve=(e,t)=>{var l={};for(var r in e)he.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&me)for(var r of me(e))t.indexOf(r)<0&&pe.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:we,useMemo:ye,useState:ke}=e,Ce="editable",Ie=(e,t)=>V(l(e,t),(t=>e+"."+t)),xe=(e,t,l)=>{const r=we(e,t);return l?r:void 0},Oe=(...e)=>ye((()=>e),e),Ne=(e,t)=>ye((()=>({store:e,tableId:t})),[e,t]),je=(e,t)=>ye((()=>({queries:e,queryId:t})),[e,t]),Pe=(e,t=!1,l,r=0,n,o,a,i)=>{const[[s,d,u],c]=ke([e,t,r]),m=we((e=>{c(e),null==i||i(e)}),[i]),h=xe((e=>m([e,e==s&&!d,u])),[m,s,d,u],l),p=we((e=>m([s,d,e])),[m,s,d]),g=!0===a?Ge:a;return[[s,d,u],h,ye((()=>!1===a?null:q(g,{offset:u,limit:n,total:o,onChange:p})),[a,g,u,n,o,p])]},ze=(e,t,l)=>ye((()=>{const r=null!=t?t:e;return B(L(Array.isArray(r)?B(V(r,(e=>[e,e]))):r,((e,t)=>{return[t,be(be({},{label:t,component:l}),(r=e,C(r)==I?{label:e}:e))];var r})))}),[t,l,e]),Se=({className:e,headerRow:t,idColumn:l,params:[r,n,o,a,i,s]})=>q("table",{className:e},s?q("caption",null,s):null,!1===t?null:q("thead",null,q("tr",null,!1===l?null:q(Me,{sort:null!=a?a:[],label:"Id",onClick:i}),L(r,(({label:e},t)=>q(Me,{key:t,cellId:t,label:e,sort:null!=a?a:[],onClick:i}))))),q("tbody",null,V(o,(e=>q("tr",{key:e},!1===l?null:q("th",null,e),L(r,(({component:t,getComponentProps:l},r)=>q("td",{key:r},q(t,fe(be(be({},D(l,e,r)),n),{rowId:e,cellId:r})))))))))),Me=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:n})=>q("th",{onClick:xe((()=>null==n?void 0:n(e)),[n,e],n),className:S(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},S(l)||t!=e?null:(l?"↓":"↑")+" ",r),$e=({localRowId:t,params:[l,r,n,o,a,i,s]})=>{const d=w(a,t,i);return q("tr",null,!1===l?null:q(e.Fragment,null,q("th",null,t),q("th",null,d)),L(r,(({component:e,getComponentProps:l},r)=>{const[a,i]=r.split(".",2),u=a===n?t:a===o?d:null;return S(u)?null:q("td",{key:r},q(e,fe(be({},D(l,u,i)),{store:s,tableId:a,rowId:u,cellId:i})))})))},qe=({thing:e,onThingChange:t,className:l,hasSchema:r})=>{const[n,o]=ke(),[a,i]=ke(),[s,d]=ke(),[u,c]=ke(),[m,h]=ke();a!==e&&(o((e=>{const t=C(e);return(e=>e==I||e==x)(t)||t==O&&z(e)?t:void 0})(e)),i(e),d(e+""),c(Number(e)||0),h(!!e));const p=we(((e,l)=>{l(e),i(e),t(e)}),[t]);return q("div",{className:l},q("button",{className:n,onClick:we((()=>{if(!(null==r?void 0:r())){const e=se(n,O,x,I),l=se(e,s,u,m);o(e),i(l),t(l)}}),[r,t,s,u,m,n])},n),se(n,q("input",{key:n,value:s,onChange:we((e=>p(e[j][P]+"",d)),[p])}),q("input",{key:n,type:"number",value:u,onChange:we((e=>p(Number(e[j][P]||0),c)),[p])}),q("input",{key:n,type:"checkbox",checked:m,onChange:we((e=>p(!!e[j].checked,h)),[p])})))},Te=e=>{var r=e,{tableId:n,store:o,editable:a,customCells:i}=r,s=ve(r,["tableId","store","editable","customCells"]);return q(Se,fe(be({},s),{params:Oe(ze(l(n,o),i,a?Be:y),Ne(o,n),t(n,o))}))},Fe=e=>{var t=e,{tableId:o,cellId:a,descending:i,offset:s,limit:d,store:u,editable:c,sortOnClick:m,paginator:h=!1,onChange:p,customCells:g}=t,b=ve(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[f,v,w]=Pe(a,i,m,s,d,r(o,u),h,p);return q(Se,fe(be({},b),{params:Oe(ze(l(o,u),g,c?Be:y),Ne(u,o),n(o,...f,d,u),f,v,w)}))},Re=({store:e,editable:t=!1,valueComponent:l=(t?Le:a),getValueComponentProps:r,className:n,headerRow:i,idColumn:s})=>q("table",{className:n},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q("th",null,"Id"),q("th",null,N))),q("tbody",null,V(o(e),(t=>q("tr",{key:t},!1===s?null:q("th",null,t),q("td",null,q(l,fe(be({},D(r,t)),{valueId:t,store:e})))))))),Ee=e=>{var t=e,{indexId:r,sliceId:n,indexes:o,editable:a,customCells:d}=t,u=ve(t,["indexId","sliceId","indexes","editable","customCells"]);const[c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(i(o),r);return q(Se,fe(be({},u),{params:Oe(ze(l(h,m),d,a?Be:y),Ne(m,h),s(r,n,c))}))},De=({relationshipId:l,relationships:r,editable:n,customCells:o,className:a,headerRow:i,idColumn:s=!0})=>{const[u,c,m,h]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(d(r),l),p=ze([...Ie(m,c),...Ie(h,c)],o,n?Be:y),g=Oe(s,p,m,h,l,u,c);return q("table",{className:a},!1===i?null:q("thead",null,q("tr",null,!1===s?null:q(e.Fragment,null,q("th",null,m,".Id"),q("th",null,h,".Id")),L(p,(({label:e},t)=>q("th",{key:t},e))))),q("tbody",null,V(t(m,c),(e=>q($e,{key:e,localRowId:e,params:g})))))},Ve=e=>{var t=e,{queryId:l,queries:r,customCells:n}=t,o=ve(t,["queryId","queries","customCells"]);return q(Se,fe(be({},o),{params:Oe(ze(c(l,r),n,k),je(r,l),u(l,r))}))},Ae=e=>{var t=e,{queryId:l,cellId:r,descending:n,offset:o,limit:a,queries:i,sortOnClick:s,paginator:d=!1,customCells:u,onChange:p}=t,g=ve(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,f,v]=Pe(r,n,s,o,a,m(l,i),d,p);return q(Se,fe(be({},g),{params:Oe(ze(c(l,i),u,k),je(i,l),h(l,...b,a,i),b,f,v)}))},Be=({tableId:e,rowId:t,cellId:l,store:r,className:n})=>{var o;return q(qe,{thing:p(e,t,l,r),onThingChange:g(e,t,l,(e=>e),[],r),className:null!=n?n:Ce+"Cell",hasSchema:null==(o=b(r))?void 0:o.hasTablesSchema})},Le=({valueId:e,store:t,className:l})=>{var r;return q(qe,{thing:f(e,t),onThingChange:v(e,(e=>e),[],t),className:null!=l?l:Ce+N,hasSchema:null==(r=b(t))?void 0:r.hasValuesSchema})},Ge=({onChange:t,total:l,offset:r=0,limit:n=l,singular:o="row",plural:a=o+"s"})=>{(r>l||r<0)&&(r=0,t(0));const i=xe((()=>t(r-n)),[t,r,n],r>0),s=xe((()=>t(r+n)),[t,r,n],r+n<l);return q(e.Fragment,null,l>n&&q(e.Fragment,null,q("button",{className:"previous",disabled:0==r,onClick:i},"←"),q("button",{className:"next",disabled:r+n>=l,onClick:s},"→"),r+1," to ",Math.min(l,r+n)," of "),l," ",1!=l?a:o)};var He=Object.defineProperty,Je=(e,t,l)=>(((e,t,l)=>{t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l})(e,"symbol"!=typeof t?t+"":t,l),l);Je(class extends M{constructor(e){super(e),Je(this,"componentDidCatch",((e,t)=>console.error(e,t.componentStack))),this.state={e:0}}render(){return this.state.e?q("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}},"getDerivedStateFromError",(()=>({e:1})));const Ke=e=>new Map(e);Ke(),Ke();const Qe=e=>null;export{Be as EditableCellView,Le as EditableValueView,De as RelationshipInHtmlTable,Ae as ResultSortedTableInHtmlTable,Ve as ResultTableInHtmlTable,Ee as SliceInHtmlTable,Fe as SortedTableInHtmlTable,Ge as SortedTablePaginator,Qe as StoreInspector,Te as TableInHtmlTable,Re as ValuesInHtmlTable};
|
|
Binary file
|
package/lib/ui-react-dom.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as a,useSortedRowIds as n,useValueIds as o,ValueView as r,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as m,useResultTableCellIds as u,useResultRowCount as h,useResultSortedRowIds as c,useCell as g,useSetCellCallback as
|
|
1
|
+
import e from"react";import{useRowIds as t,useTableCellIds as l,useRowCount as a,useSortedRowIds as n,useValueIds as o,ValueView as r,useIndexesOrIndexesById as i,useSliceRowIds as s,useRelationshipsOrRelationshipsById as d,useResultRowIds as m,useResultTableCellIds as u,useResultRowCount as h,useResultSortedRowIds as c,useCell as g,useSetCellCallback as b,useStoreOrStoreById as p,useValue as f,useSetValueCallback as w,useRemoteRowId as k,CellView as v,ResultCellView as y}from"./ui-react";const C=e=>typeof e,x=C(""),I=C(!0),N=C(0),z="Value",M="currentTarget",$="value",S=isFinite,T=e=>null==e,{PureComponent:R,Fragment:q,createElement:F,useCallback:P,useLayoutEffect:E,useRef:O,useState:V}=e,j=(e,...t)=>T(e)?{}:e(...t),A=(e,t)=>e.map(t),B=Object,L=(e=[])=>B.fromEntries(e),D=(e,t)=>A(B.entries(e),(([e,l])=>t(l,e))),G="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",H='content:url("',J=H+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",K='</svg>")',Q=H+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",U=A([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,a])=>J+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${a}' fill='white'/>`+K)),W=J+"<path d='M20 20l60 60M20 80l60-60' />"+K,X=J+`<path d='${G}' />`+K,Y=J+`<path d='${G}M20 20l60 60' />`+K,Z="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(D({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[Z]:"width:0.5rem;height:0.5rem;",[Z+"-track"]:"background:#111",[Z+"-thumb"]:"background:#999;border:1px solid #111",[Z+"-thumb:hover"]:"background:#fff",[Z+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+Q,...L(A(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...L(A(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":Q,"header>img:nth-of-type(6)":W,...L(A(U,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":X,"details[open]>summary img.done":Y,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`& ${t}{${e}}`:"")));const _=(e,t,l,a)=>e==x?t:e==N?l:a,{useCallback:ee,useMemo:te,useState:le}=e,ae="editable",ne=(e,t)=>A(l(e,t),(t=>e+"."+t)),oe=(e,t,l)=>{const a=ee(e,t);return l?a:void 0},re=(...e)=>te((()=>e),e),ie=(e,t)=>te((()=>({store:e,tableId:t})),[e,t]),se=(e,t)=>te((()=>({queries:e,queryId:t})),[e,t]),de=(e,t=!1,l,a=0,n,o,r,i)=>{const[[s,d,m],u]=le([e,t,a]),h=ee((e=>{u(e),i?.(e)}),[i]),c=oe((e=>h([e,e==s&&!d,m])),[h,s,d,m],l),g=ee((e=>h([s,d,e])),[h,s,d]),b=!0===r?Ie:r;return[[s,d,m],c,te((()=>!1===r?null:F(b,{offset:m,limit:n,total:o,onChange:g})),[r,b,m,n,o,g])]},me=(e,t,l)=>te((()=>{const a=t??e;return L(D(Array.isArray(a)?L(A(a,(e=>[e,e]))):a,((e,t)=>{return[t,{label:t,component:l,...(a=e,C(a)==x?{label:e}:e)}];var a})))}),[t,l,e]),ue=({className:e,headerRow:t,idColumn:l,params:[a,n,o,r,i,s]})=>F("table",{className:e},s?F("caption",null,s):null,!1===t?null:F("thead",null,F("tr",null,!1===l?null:F(he,{sort:r??[],label:"Id",onClick:i}),D(a,(({label:e},t)=>F(he,{key:t,cellId:t,label:e,sort:r??[],onClick:i}))))),F("tbody",null,A(o,(e=>F("tr",{key:e},!1===l?null:F("th",null,e),D(a,(({component:t,getComponentProps:l},a)=>F("td",{key:a},F(t,{...j(l,e,a),...n,rowId:e,cellId:a}))))))))),he=({cellId:e,sort:[t,l],label:a=e??"",onClick:n})=>F("th",{onClick:oe((()=>n?.(e)),[n,e],n),className:T(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},T(l)||t!=e?null:(l?"↓":"↑")+" ",a),ce=({localRowId:t,params:[l,a,n,o,r,i,s]})=>{const d=k(r,t,i);return F("tr",null,!1===l?null:F(e.Fragment,null,F("th",null,t),F("th",null,d)),D(a,(({component:e,getComponentProps:l},a)=>{const[r,i]=a.split(".",2),m=r===n?t:r===o?d:null;return T(m)?null:F("td",{key:a},F(e,{...j(l,m,i),store:s,tableId:r,rowId:m,cellId:i}))})))},ge=({thing:e,onThingChange:t,className:l,hasSchema:a})=>{const[n,o]=le(),[r,i]=le(),[s,d]=le(),[m,u]=le(),[h,c]=le();r!==e&&(o((e=>{const t=C(e);return(e=>e==x||e==I)(t)||t==N&&S(e)?t:void 0})(e)),i(e),d(e+""),u(Number(e)||0),c(!!e));const g=ee(((e,l)=>{l(e),i(e),t(e)}),[t]);return F("div",{className:l},F("button",{className:n,onClick:ee((()=>{if(!a?.()){const e=_(n,N,I,x),l=_(e,s,m,h);o(e),i(l),t(l)}}),[a,t,s,m,h,n])},n),_(n,F("input",{key:n,value:s,onChange:ee((e=>g(e[M][$]+"",d)),[g])}),F("input",{key:n,type:"number",value:m,onChange:ee((e=>g(Number(e[M][$]||0),u)),[g])}),F("input",{key:n,type:"checkbox",checked:h,onChange:ee((e=>g(!!e[M].checked,c)),[g])})))},be=({tableId:e,store:a,editable:n,customCells:o,...r})=>F(ue,{...r,params:re(me(l(e,a),o,n?Ce:v),ie(a,e),t(e,a))}),pe=({tableId:e,cellId:t,descending:o,offset:r,limit:i,store:s,editable:d,sortOnClick:m,paginator:u=!1,onChange:h,customCells:c,...g})=>{const[b,p,f]=de(t,o,m,r,i,a(e,s),u,h);return F(ue,{...g,params:re(me(l(e,s),c,d?Ce:v),ie(s,e),n(e,...b,i,s),b,p,f)})},fe=({store:e,editable:t=!1,valueComponent:l=(t?xe:r),getValueComponentProps:a,className:n,headerRow:i,idColumn:s})=>F("table",{className:n},!1===i?null:F("thead",null,F("tr",null,!1===s?null:F("th",null,"Id"),F("th",null,z))),F("tbody",null,A(o(e),(t=>F("tr",{key:t},!1===s?null:F("th",null,t),F("td",null,F(l,{...j(a,t),valueId:t,store:e}))))))),we=({indexId:e,sliceId:t,indexes:a,editable:n,customCells:o,...r})=>{const[d,m,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(i(a),e);return F(ue,{...r,params:re(me(l(u,m),o,n?Ce:v),ie(m,u),s(e,t,d))})},ke=({relationshipId:l,relationships:a,editable:n,customCells:o,className:r,headerRow:i,idColumn:s=!0})=>{const[m,u,h,c]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(d(a),l),g=me([...ne(h,u),...ne(c,u)],o,n?Ce:v),b=re(s,g,h,c,l,m,u);return F("table",{className:r},!1===i?null:F("thead",null,F("tr",null,!1===s?null:F(e.Fragment,null,F("th",null,h,".Id"),F("th",null,c,".Id")),D(g,(({label:e},t)=>F("th",{key:t},e))))),F("tbody",null,A(t(h,u),(e=>F(ce,{key:e,localRowId:e,params:b})))))},ve=({queryId:e,queries:t,customCells:l,...a})=>F(ue,{...a,params:re(me(u(e,t),l,y),se(t,e),m(e,t))}),ye=({queryId:e,cellId:t,descending:l,offset:a,limit:n,queries:o,sortOnClick:r,paginator:i=!1,customCells:s,onChange:d,...m})=>{const[g,b,p]=de(t,l,r,a,n,h(e,o),i,d);return F(ue,{...m,params:re(me(u(e,o),s,y),se(o,e),c(e,...g,n,o),g,b,p)})},Ce=({tableId:e,rowId:t,cellId:l,store:a,className:n})=>F(ge,{thing:g(e,t,l,a),onThingChange:b(e,t,l,(e=>e),[],a),className:n??ae+"Cell",hasSchema:p(a)?.hasTablesSchema}),xe=({valueId:e,store:t,className:l})=>F(ge,{thing:f(e,t),onThingChange:w(e,(e=>e),[],t),className:l??ae+z,hasSchema:p(t)?.hasValuesSchema}),Ie=({onChange:t,total:l,offset:a=0,limit:n=l,singular:o="row",plural:r=o+"s"})=>{(a>l||a<0)&&(a=0,t(0));const i=oe((()=>t(a-n)),[t,a,n],a>0),s=oe((()=>t(a+n)),[t,a,n],a+n<l);return F(e.Fragment,null,l>n&&F(e.Fragment,null,F("button",{className:"previous",disabled:0==a,onClick:i},"←"),F("button",{className:"next",disabled:a+n>=l,onClick:s},"→"),a+1," to ",Math.min(l,a+n)," of "),l," ",1!=l?r:o)},Ne=e=>new Map(e);Ne(),Ne();const ze=e=>null;export{Ce as EditableCellView,xe as EditableValueView,ke as RelationshipInHtmlTable,ye as ResultSortedTableInHtmlTable,ve as ResultTableInHtmlTable,we as SliceInHtmlTable,pe as SortedTableInHtmlTable,Ie as SortedTablePaginator,ze as StoreInspector,be as TableInHtmlTable,fe as ValuesInHtmlTable};
|
package/lib/ui-react-dom.js.gz
CHANGED
|
Binary file
|