@toclocoinc/lattice-grid 1.9.1 → 1.10.0
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/README.md +6 -5
- package/docs/API.html +199 -2
- package/lattice-grid.d.ts +206 -4
- package/lattice-grid.esm.min.js +723 -101
- package/lattice-grid.min.cjs +720 -101
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +720 -101
- package/modules/charts.esm.min.js +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/dhtmlx-compat.esm.min.js +720 -101
- package/modules/htmx.esm.min.js +428 -36
- package/modules/htmx.min.cjs +428 -36
- package/modules/htmx.min.js +428 -36
- package/modules/react.esm.min.js +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/webcomponent.esm.min.js +720 -101
- package/package.json +1 -1
package/modules/htmx.esm.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.10.0 — htmx module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -15047,6 +15047,354 @@ if(isFunction(emit))emit(type,payload);
|
|
|
15047
15047
|
}
|
|
15048
15048
|
}
|
|
15049
15049
|
});
|
|
15050
|
+
__def("packages/core/src/source/derive.js",function(__exports,__req){
|
|
15051
|
+
'use strict';
|
|
15052
|
+
Object.defineProperty(__exports,"FOLLOW_MODES",{enumerable:true,get:function(){return FOLLOW_MODES;}});
|
|
15053
|
+
Object.defineProperty(__exports,"BUCKETS",{enumerable:true,get:function(){return BUCKETS;}});
|
|
15054
|
+
Object.defineProperty(__exports,"DERIVED_ROW_KEY",{enumerable:true,get:function(){return DERIVED_ROW_KEY;}});
|
|
15055
|
+
Object.defineProperty(__exports,"readPath",{enumerable:true,get:function(){return readPath;}});
|
|
15056
|
+
Object.defineProperty(__exports,"unnest",{enumerable:true,get:function(){return unnest;}});
|
|
15057
|
+
Object.defineProperty(__exports,"bucketOf",{enumerable:true,get:function(){return bucketOf;}});
|
|
15058
|
+
Object.defineProperty(__exports,"reduceValues",{enumerable:true,get:function(){return reduceValues;}});
|
|
15059
|
+
Object.defineProperty(__exports,"applyLimit",{enumerable:true,get:function(){return applyLimit;}});
|
|
15060
|
+
Object.defineProperty(__exports,"applyCumulative",{enumerable:true,get:function(){return applyCumulative;}});
|
|
15061
|
+
Object.defineProperty(__exports,"derive",{enumerable:true,get:function(){return derive;}});
|
|
15062
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
15063
|
+
const isFunction=__m0["isFunction"];
|
|
15064
|
+
const isObject=__m0["isObject"];
|
|
15065
|
+
const __m1=__req("packages/core/src/compute/total.js");
|
|
15066
|
+
const TOTAL_FNS=__m1["TOTAL_FNS"];
|
|
15067
|
+
const FOLLOW_MODES=Object.freeze(['filtered','all','selected','grouped']);
|
|
15068
|
+
const BUCKETS=Object.freeze(['day','week','month','quarter','year']);
|
|
15069
|
+
const DERIVED_ROW_KEY='__key';
|
|
15070
|
+
function readPath(obj,path){
|
|
15071
|
+
if(!isObject(obj)||typeof path!=='string')return undefined;
|
|
15072
|
+
if(!path.includes('.'))return(obj)[path];
|
|
15073
|
+
let cursor=(obj);
|
|
15074
|
+
for(const part of path.split('.')){
|
|
15075
|
+
if(!isObject(cursor))return undefined;
|
|
15076
|
+
cursor=(cursor)[part];
|
|
15077
|
+
}
|
|
15078
|
+
return cursor;
|
|
15079
|
+
}
|
|
15080
|
+
function unnest(rows,path){
|
|
15081
|
+
const out=[];
|
|
15082
|
+
for(const row of rows){
|
|
15083
|
+
const list=readPath(row,path);
|
|
15084
|
+
if(!Array.isArray(list)||!list.length)continue;
|
|
15085
|
+
for(const item of list)out.push({...((row)),[path]:item});
|
|
15086
|
+
}
|
|
15087
|
+
return out;
|
|
15088
|
+
}
|
|
15089
|
+
function bucketOf(value,by){
|
|
15090
|
+
const at=value instanceof Date?value:new Date((value));
|
|
15091
|
+
const time=at.getTime();
|
|
15092
|
+
if(!Number.isFinite(time))return null;
|
|
15093
|
+
const y=at.getUTCFullYear();
|
|
15094
|
+
const m=at.getUTCMonth();
|
|
15095
|
+
const d=at.getUTCDate();
|
|
15096
|
+
const iso=(date)=>date.toISOString().slice(0,10);
|
|
15097
|
+
switch(by){
|
|
15098
|
+
case'year':return iso(new Date(Date.UTC(y,0,1)));
|
|
15099
|
+
case'quarter':return iso(new Date(Date.UTC(y,Math.floor(m/3)*3,1)));
|
|
15100
|
+
case'month':return iso(new Date(Date.UTC(y,m,1)));
|
|
15101
|
+
case'week':{
|
|
15102
|
+
const day=(at.getUTCDay()+6)%7;
|
|
15103
|
+
return iso(new Date(Date.UTC(y,m,d-day)));
|
|
15104
|
+
}
|
|
15105
|
+
default:return iso(new Date(Date.UTC(y,m,d)));
|
|
15106
|
+
}
|
|
15107
|
+
}
|
|
15108
|
+
function groupKeyOf(row,by,bucket){
|
|
15109
|
+
const values=by.map((path)=>(
|
|
15110
|
+
bucket&&bucket.of===path?bucketOf(readPath(row,path),bucket.by):readPath(row,path)
|
|
15111
|
+
));
|
|
15112
|
+
return{key:values.map((v)=>(v===undefined||v===null?'\u0000':String(v))).join('\u001f'),values};
|
|
15113
|
+
}
|
|
15114
|
+
function reduceValues(values,fn){
|
|
15115
|
+
const kernel=TOTAL_FNS[fn];
|
|
15116
|
+
if(!kernel)return null;
|
|
15117
|
+
return kernel({get:(i)=>values[i]},ROW_INDICES(values.length));
|
|
15118
|
+
}
|
|
15119
|
+
function reduceGroup(rows,select){
|
|
15120
|
+
const out={};
|
|
15121
|
+
const indices=ROW_INDICES(rows.length);
|
|
15122
|
+
for(const[id,spec]of Object.entries(select)){
|
|
15123
|
+
const fn=spec.fn||'count';
|
|
15124
|
+
const kernel=TOTAL_FNS[fn];
|
|
15125
|
+
if(!kernel){out[id]=null;continue;}
|
|
15126
|
+
const values=spec.of?rows.map((row)=>readPath(row,spec.of)):[];
|
|
15127
|
+
out[id]=kernel({get:(i)=>values[i]},indices);
|
|
15128
|
+
}
|
|
15129
|
+
return out;
|
|
15130
|
+
}
|
|
15131
|
+
const ROW_INDICES=(()=>{
|
|
15132
|
+
const cache=new Map();
|
|
15133
|
+
return(n)=>{
|
|
15134
|
+
let hit=cache.get(n);
|
|
15135
|
+
if(!hit){
|
|
15136
|
+
hit=new Uint32Array(n);
|
|
15137
|
+
for(let i=0;i<n;i++)hit[i]=i;
|
|
15138
|
+
if(cache.size<512)cache.set(n,hit);
|
|
15139
|
+
}
|
|
15140
|
+
return hit;
|
|
15141
|
+
};
|
|
15142
|
+
})();
|
|
15143
|
+
function applyLimit(rows,limit,per){
|
|
15144
|
+
if(!Number.isFinite(limit)||limit<=0)return rows;
|
|
15145
|
+
if(!per)return rows.slice(0,limit);
|
|
15146
|
+
const seen=new Map();
|
|
15147
|
+
const out=[];
|
|
15148
|
+
for(const row of rows){
|
|
15149
|
+
const key=String(readPath(row,per));
|
|
15150
|
+
const taken=seen.get(key)||0;
|
|
15151
|
+
if(taken>=limit)continue;
|
|
15152
|
+
seen.set(key,taken+1);
|
|
15153
|
+
out.push(row);
|
|
15154
|
+
}
|
|
15155
|
+
return out;
|
|
15156
|
+
}
|
|
15157
|
+
function applyCumulative(rows,spec){
|
|
15158
|
+
const total=rows.reduce((sum,row)=>sum+(Number(readPath(row,spec.of))||0),0);
|
|
15159
|
+
if(!total)return rows;
|
|
15160
|
+
const cutoff=total*spec.upTo;
|
|
15161
|
+
let running=0;
|
|
15162
|
+
const out=[];
|
|
15163
|
+
for(const row of rows){
|
|
15164
|
+
out.push(row);
|
|
15165
|
+
running+=Number(readPath(row,spec.of))||0;
|
|
15166
|
+
if(running>=cutoff)break;
|
|
15167
|
+
}
|
|
15168
|
+
return out;
|
|
15169
|
+
}
|
|
15170
|
+
function sortRows(rows,spec){
|
|
15171
|
+
if(!Array.isArray(spec)||!spec.length)return rows;
|
|
15172
|
+
return[...rows].sort((a,b)=>{
|
|
15173
|
+
for(const entry of spec){
|
|
15174
|
+
const av=readPath(a,entry.col);
|
|
15175
|
+
const bv=readPath(b,entry.col);
|
|
15176
|
+
if(av===bv)continue;
|
|
15177
|
+
if(av===null||av===undefined)return 1;
|
|
15178
|
+
if(bv===null||bv===undefined)return-1;
|
|
15179
|
+
const less=typeof av==='number'&&typeof bv==='number'
|
|
15180
|
+
?av<bv
|
|
15181
|
+
:String(av)<String(bv);
|
|
15182
|
+
return(less?-1:1)*(entry.dir==='desc'?-1:1);
|
|
15183
|
+
}
|
|
15184
|
+
return 0;
|
|
15185
|
+
});
|
|
15186
|
+
}
|
|
15187
|
+
function derive(rows,spec){
|
|
15188
|
+
let working=Array.isArray(rows)?rows:[];
|
|
15189
|
+
if(spec.unnest)working=unnest(working,spec.unnest);
|
|
15190
|
+
if(isFunction(spec.where))working=working.filter((row)=>!!spec.where(row));
|
|
15191
|
+
const by=spec.groupBy
|
|
15192
|
+
?(Array.isArray(spec.groupBy)?spec.groupBy:[spec.groupBy])
|
|
15193
|
+
:null;
|
|
15194
|
+
const bucket=isObject(spec.bucket)?spec.bucket:null;
|
|
15195
|
+
let out;
|
|
15196
|
+
if(!by){
|
|
15197
|
+
out=working.map((row,i)=>({
|
|
15198
|
+
...((row)),
|
|
15199
|
+
[DERIVED_ROW_KEY]:String(readPath(row,spec.rowKey||'id')??i),
|
|
15200
|
+
}));
|
|
15201
|
+
}else{
|
|
15202
|
+
const groups=new Map();
|
|
15203
|
+
for(const row of working){
|
|
15204
|
+
const{key,values}=groupKeyOf(row,by,bucket);
|
|
15205
|
+
let bucketed=groups.get(key);
|
|
15206
|
+
if(!bucketed){bucketed={values,rows:[]};groups.set(key,bucketed);}
|
|
15207
|
+
bucketed.rows.push(row);
|
|
15208
|
+
}
|
|
15209
|
+
out=[...groups.entries()].map(([key,group])=>{
|
|
15210
|
+
const row={[DERIVED_ROW_KEY]:key};
|
|
15211
|
+
by.forEach((path,i)=>{row[path.includes('.')?path.split('.').pop():path]=group.values[i];});
|
|
15212
|
+
Object.assign(row,reduceGroup(group.rows,spec.select||{}));
|
|
15213
|
+
return row;
|
|
15214
|
+
});
|
|
15215
|
+
}
|
|
15216
|
+
out=sortRows(out,spec.sort);
|
|
15217
|
+
if(isObject(spec.cumulative))out=applyCumulative(out,spec.cumulative);
|
|
15218
|
+
return applyLimit(out,spec.limit,spec.limitPer||null);
|
|
15219
|
+
}
|
|
15220
|
+
});
|
|
15221
|
+
__def("packages/core/src/source/derived.js",function(__exports,__req){
|
|
15222
|
+
'use strict';
|
|
15223
|
+
Object.defineProperty(__exports,"IDLE_REFRESH_MS",{enumerable:true,get:function(){return IDLE_REFRESH_MS;}});
|
|
15224
|
+
Object.defineProperty(__exports,"PROFILE_FIELDS",{enumerable:true,get:function(){return PROFILE_FIELDS;}});
|
|
15225
|
+
Object.defineProperty(__exports,"DerivedSource",{enumerable:true,get:function(){return DerivedSource;}});
|
|
15226
|
+
Object.defineProperty(__exports,"createDerivedSource",{enumerable:true,get:function(){return createDerivedSource;}});
|
|
15227
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
15228
|
+
const isFunction=__m0["isFunction"];
|
|
15229
|
+
const isObject=__m0["isObject"];
|
|
15230
|
+
const warnOnce=__m0["warnOnce"];
|
|
15231
|
+
const __m1=__req("packages/core/src/source/memory.js");
|
|
15232
|
+
const MemorySource=__m1["MemorySource"];
|
|
15233
|
+
const __m2=__req("packages/core/src/source/derive.js");
|
|
15234
|
+
const derive=__m2["derive"];
|
|
15235
|
+
const FOLLOW_MODES=__m2["FOLLOW_MODES"];
|
|
15236
|
+
const DERIVED_ROW_KEY=__m2["DERIVED_ROW_KEY"];
|
|
15237
|
+
const IDLE_REFRESH_MS=16;
|
|
15238
|
+
const PROFILE_FIELDS=Object.freeze([
|
|
15239
|
+
'column','rows','present','missing','distinct',
|
|
15240
|
+
'min','max','mean','median','q1','q3','iqr','stddev','outliers',
|
|
15241
|
+
]);
|
|
15242
|
+
class DerivedSource extends MemorySource{
|
|
15243
|
+
#from=null;
|
|
15244
|
+
#spec={};
|
|
15245
|
+
#off=[];
|
|
15246
|
+
#pending=null;
|
|
15247
|
+
#gone=false;
|
|
15248
|
+
#ctx={};
|
|
15249
|
+
#deriving=false;
|
|
15250
|
+
constructor(config,ctx){
|
|
15251
|
+
super({mode:'memory',rows:[]},ctx);
|
|
15252
|
+
this.#ctx=ctx||{};
|
|
15253
|
+
this.#spec=isObject(config)?config:{};
|
|
15254
|
+
this.#from=(this.#spec.from)||null;
|
|
15255
|
+
if(!this.#from){
|
|
15256
|
+
warnOnce('source.derived.from','source.mode "derived" needs `from`: the grid to derive from.');
|
|
15257
|
+
return;
|
|
15258
|
+
}
|
|
15259
|
+
if(this.#spec.follow&&!FOLLOW_MODES.includes(String(this.#spec.follow))){
|
|
15260
|
+
warnOnce(
|
|
15261
|
+
`source.derived.follow.${this.#spec.follow}`,
|
|
15262
|
+
`unknown follow "${this.#spec.follow}"; using "filtered". Known: ${FOLLOW_MODES.join(', ')}.`,
|
|
15263
|
+
);
|
|
15264
|
+
}
|
|
15265
|
+
this.#watch();
|
|
15266
|
+
this.refresh();
|
|
15267
|
+
}
|
|
15268
|
+
#watch(){
|
|
15269
|
+
const grid=this.#from;
|
|
15270
|
+
if(!grid||!isFunction(grid.on))return;
|
|
15271
|
+
const follow=String(this.#spec.follow||'filtered');
|
|
15272
|
+
const events=['rows:changed'];
|
|
15273
|
+
if(follow==='filtered'||follow==='grouped')events.push('filter:changed');
|
|
15274
|
+
if(follow==='selected')events.push('selection:changed');
|
|
15275
|
+
if(follow==='grouped')events.push('column:grouped');
|
|
15276
|
+
for(const name of events){
|
|
15277
|
+
const handler=()=>this.schedule();
|
|
15278
|
+
grid.on(name,handler);
|
|
15279
|
+
this.#off.push(()=>isFunction(grid.off)&&grid.off(name,handler));
|
|
15280
|
+
}
|
|
15281
|
+
}
|
|
15282
|
+
schedule(){
|
|
15283
|
+
const mode=this.#spec.refresh===undefined?'idle':this.#spec.refresh;
|
|
15284
|
+
if(mode==='manual')return;
|
|
15285
|
+
if(mode==='live'){this.refresh();return;}
|
|
15286
|
+
const wait=typeof mode==='number'&&Number.isFinite(mode)?mode:IDLE_REFRESH_MS;
|
|
15287
|
+
if(this.#pending)return;
|
|
15288
|
+
this.#pending=setTimeout(()=>{this.#pending=null;this.refresh();},wait);
|
|
15289
|
+
}
|
|
15290
|
+
refresh(){
|
|
15291
|
+
if(this.#gone||!this.#from)return;
|
|
15292
|
+
if(this.#deriving){
|
|
15293
|
+
warnOnce(
|
|
15294
|
+
'source.derived.cycle',
|
|
15295
|
+
'a derived grid is deriving from itself, directly or through a chain. '
|
|
15296
|
+
+'The cycle was refused; check the `from` of each grid in the chain.',
|
|
15297
|
+
);
|
|
15298
|
+
return;
|
|
15299
|
+
}
|
|
15300
|
+
this.#deriving=true;
|
|
15301
|
+
try{
|
|
15302
|
+
const rows=this.#spec.profile
|
|
15303
|
+
?this.#deriveProfile()
|
|
15304
|
+
:derive(this.#sourceRows(),this.#resolvedSpec());
|
|
15305
|
+
this.setRows(rows);
|
|
15306
|
+
this.invalidate('filter');
|
|
15307
|
+
if(isFunction(this.#ctx.emit)){
|
|
15308
|
+
(this.#ctx.emit)('rows:changed',{},'derived');
|
|
15309
|
+
}
|
|
15310
|
+
}finally{
|
|
15311
|
+
this.#deriving=false;
|
|
15312
|
+
}
|
|
15313
|
+
}
|
|
15314
|
+
#resolvedSpec(){
|
|
15315
|
+
if(String(this.#spec.follow||'filtered')!=='grouped')return this.#spec;
|
|
15316
|
+
const grid=this.#from;
|
|
15317
|
+
const state=grid&&grid.state&&isFunction(grid.state.get)?grid.state.get():null;
|
|
15318
|
+
const grouped=state&&Array.isArray(state.group)?state.group:[];
|
|
15319
|
+
if(!grouped.length)return this.#spec;
|
|
15320
|
+
return{...this.#spec,groupBy:[...grouped]};
|
|
15321
|
+
}
|
|
15322
|
+
#sourceRows(){
|
|
15323
|
+
const grid=this.#from;
|
|
15324
|
+
const follow=String(this.#spec.follow||'filtered');
|
|
15325
|
+
if(!grid||!grid.rows)return[];
|
|
15326
|
+
if(follow==='all'){
|
|
15327
|
+
const every=[];
|
|
15328
|
+
if(isFunction(grid.rows.forEachAll)){
|
|
15329
|
+
grid.rows.forEachAll((row)=>{if(!row.group)every.push(unwrap(row));});
|
|
15330
|
+
}
|
|
15331
|
+
return every;
|
|
15332
|
+
}
|
|
15333
|
+
if(follow==='selected'){
|
|
15334
|
+
const rows=grid.selection&&isFunction(grid.selection.rows)?grid.selection.rows():[];
|
|
15335
|
+
return rows.filter(Boolean).map(unwrap);
|
|
15336
|
+
}
|
|
15337
|
+
const out=[];
|
|
15338
|
+
if(isFunction(grid.rows.forEach)){
|
|
15339
|
+
grid.rows.forEach((row)=>{if(!row.group)out.push(unwrap(row));});
|
|
15340
|
+
}
|
|
15341
|
+
return out;
|
|
15342
|
+
}
|
|
15343
|
+
#deriveProfile(){
|
|
15344
|
+
const grid=this.#from;
|
|
15345
|
+
if(!grid||!grid.statistics||!isFunction(grid.statistics.profile))return[];
|
|
15346
|
+
const wanted=Array.isArray(this.#spec.profile)?this.#spec.profile:[this.#spec.profile];
|
|
15347
|
+
const rows=wanted.filter(Boolean).map((colId)=>{
|
|
15348
|
+
const stats=grid.statistics.profile(String(colId))||{};
|
|
15349
|
+
const row={[DERIVED_ROW_KEY]:String(colId)};
|
|
15350
|
+
for(const field of PROFILE_FIELDS){
|
|
15351
|
+
row[field]=field==='column'?String(colId):(stats[field]??null);
|
|
15352
|
+
}
|
|
15353
|
+
row.outliers=Array.isArray(stats.outliers)?stats.outliers.length:(stats.outliers??null);
|
|
15354
|
+
return row;
|
|
15355
|
+
});
|
|
15356
|
+
if(this.#spec.orient!=='metrics')return rows;
|
|
15357
|
+
const first=rows[0];
|
|
15358
|
+
if(!first)return[];
|
|
15359
|
+
return PROFILE_FIELDS.filter((f)=>f!=='column').map((field)=>({
|
|
15360
|
+
[DERIVED_ROW_KEY]:field,metric:field,value:first[field],
|
|
15361
|
+
}));
|
|
15362
|
+
}
|
|
15363
|
+
apply(change){
|
|
15364
|
+
const ops=['add','update','remove'];
|
|
15365
|
+
const rejected=[];
|
|
15366
|
+
for(const op of ops){
|
|
15367
|
+
for(const row of(change&&change[op])||[]){
|
|
15368
|
+
rejected.push({operation:op,id:row&&row.id,reason:'derived-read-only'});
|
|
15369
|
+
}
|
|
15370
|
+
}
|
|
15371
|
+
if(rejected.length){
|
|
15372
|
+
warnOnce(
|
|
15373
|
+
'source.derived.readonly',
|
|
15374
|
+
'a derived grid is read-only: its rows are computed from another grid. '
|
|
15375
|
+
+'Write to the source grid instead, and the derived one follows.',
|
|
15376
|
+
);
|
|
15377
|
+
}
|
|
15378
|
+
return{added:[],updated:[],removed:[],rejected};
|
|
15379
|
+
}
|
|
15380
|
+
destroy(){
|
|
15381
|
+
this.#gone=true;
|
|
15382
|
+
if(this.#pending){clearTimeout(this.#pending);this.#pending=null;}
|
|
15383
|
+
for(const off of this.#off){try{off();}catch{}}
|
|
15384
|
+
this.#off=[];
|
|
15385
|
+
this.#from=null;
|
|
15386
|
+
super.destroy();
|
|
15387
|
+
}
|
|
15388
|
+
}
|
|
15389
|
+
function unwrap(row){
|
|
15390
|
+
return isObject(row)&&'data'in(row)
|
|
15391
|
+
?(row).data
|
|
15392
|
+
:row;
|
|
15393
|
+
}
|
|
15394
|
+
function createDerivedSource(config,ctx){
|
|
15395
|
+
return new DerivedSource(config,ctx);
|
|
15396
|
+
}
|
|
15397
|
+
});
|
|
15050
15398
|
__def("packages/core/src/source/index.js",function(__exports,__req){
|
|
15051
15399
|
'use strict';
|
|
15052
15400
|
Object.defineProperty(__exports,"createMemorySource",{enumerable:true,get:function(){return createMemorySource;}});
|
|
@@ -15060,6 +15408,10 @@ Object.defineProperty(__exports,"PROTOCOL",{enumerable:true,get:function(){retur
|
|
|
15060
15408
|
Object.defineProperty(__exports,"createStreamSource",{enumerable:true,get:function(){return createStreamSource;}});
|
|
15061
15409
|
Object.defineProperty(__exports,"StreamSource",{enumerable:true,get:function(){return StreamSource;}});
|
|
15062
15410
|
Object.defineProperty(__exports,"DEFAULT_PROMOTE_BELOW",{enumerable:true,get:function(){return DEFAULT_PROMOTE_BELOW;}});
|
|
15411
|
+
Object.defineProperty(__exports,"createDerivedSource",{enumerable:true,get:function(){return createDerivedSource;}});
|
|
15412
|
+
Object.defineProperty(__exports,"DerivedSource",{enumerable:true,get:function(){return DerivedSource;}});
|
|
15413
|
+
Object.defineProperty(__exports,"IDLE_REFRESH_MS",{enumerable:true,get:function(){return IDLE_REFRESH_MS;}});
|
|
15414
|
+
Object.defineProperty(__exports,"PROFILE_FIELDS",{enumerable:true,get:function(){return PROFILE_FIELDS;}});
|
|
15063
15415
|
Object.defineProperty(__exports,"MODES",{enumerable:true,get:function(){return MODES;}});
|
|
15064
15416
|
Object.defineProperty(__exports,"createSource",{enumerable:true,get:function(){return createSource;}});
|
|
15065
15417
|
const __m0=__req("packages/core/src/internal/util.js");
|
|
@@ -15081,41 +15433,57 @@ const __m4=__req("packages/core/src/source/stream.js");
|
|
|
15081
15433
|
const createStreamSource=__m4["createStreamSource"];
|
|
15082
15434
|
const StreamSource=__m4["StreamSource"];
|
|
15083
15435
|
const DEFAULT_PROMOTE_BELOW=__m4["DEFAULT_PROMOTE_BELOW"];
|
|
15084
|
-
const __m5=__req("packages/core/src/source/
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
Object.defineProperty(__exports,"
|
|
15092
|
-
Object.defineProperty(__exports,"
|
|
15093
|
-
Object.defineProperty(__exports,"
|
|
15094
|
-
Object.defineProperty(__exports,"
|
|
15095
|
-
Object.defineProperty(__exports,"
|
|
15096
|
-
Object.defineProperty(__exports,"
|
|
15097
|
-
Object.defineProperty(__exports,"
|
|
15098
|
-
Object.defineProperty(__exports,"
|
|
15099
|
-
Object.defineProperty(__exports,"
|
|
15100
|
-
|
|
15101
|
-
Object.defineProperty(__exports,"
|
|
15102
|
-
Object.defineProperty(__exports,"
|
|
15103
|
-
|
|
15104
|
-
Object.defineProperty(__exports,"
|
|
15105
|
-
Object.defineProperty(__exports,"
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
Object.defineProperty(__exports,"
|
|
15109
|
-
|
|
15110
|
-
Object.defineProperty(__exports,"
|
|
15111
|
-
Object.defineProperty(__exports,"
|
|
15112
|
-
Object.defineProperty(__exports,"
|
|
15113
|
-
Object.defineProperty(__exports,"
|
|
15114
|
-
Object.defineProperty(__exports,"
|
|
15115
|
-
|
|
15116
|
-
Object.defineProperty(__exports,"
|
|
15117
|
-
Object.defineProperty(__exports,"
|
|
15118
|
-
|
|
15436
|
+
const __m5=__req("packages/core/src/source/derived.js");
|
|
15437
|
+
const createDerivedSource=__m5["createDerivedSource"];
|
|
15438
|
+
const DerivedSource=__m5["DerivedSource"];
|
|
15439
|
+
const IDLE_REFRESH_MS=__m5["IDLE_REFRESH_MS"];
|
|
15440
|
+
const PROFILE_FIELDS=__m5["PROFILE_FIELDS"];
|
|
15441
|
+
const __m6=__req("packages/core/src/source/derive.js");
|
|
15442
|
+
Object.defineProperty(__exports,"derive",{enumerable:true,get:function(){return __m6["derive"];}});
|
|
15443
|
+
Object.defineProperty(__exports,"unnest",{enumerable:true,get:function(){return __m6["unnest"];}});
|
|
15444
|
+
Object.defineProperty(__exports,"readPath",{enumerable:true,get:function(){return __m6["readPath"];}});
|
|
15445
|
+
Object.defineProperty(__exports,"bucketOf",{enumerable:true,get:function(){return __m6["bucketOf"];}});
|
|
15446
|
+
Object.defineProperty(__exports,"applyLimit",{enumerable:true,get:function(){return __m6["applyLimit"];}});
|
|
15447
|
+
Object.defineProperty(__exports,"applyCumulative",{enumerable:true,get:function(){return __m6["applyCumulative"];}});
|
|
15448
|
+
Object.defineProperty(__exports,"reduceValues",{enumerable:true,get:function(){return __m6["reduceValues"];}});
|
|
15449
|
+
Object.defineProperty(__exports,"FOLLOW_MODES",{enumerable:true,get:function(){return __m6["FOLLOW_MODES"];}});
|
|
15450
|
+
Object.defineProperty(__exports,"BUCKETS",{enumerable:true,get:function(){return __m6["BUCKETS"];}});
|
|
15451
|
+
Object.defineProperty(__exports,"DERIVED_ROW_KEY",{enumerable:true,get:function(){return __m6["DERIVED_ROW_KEY"];}});
|
|
15452
|
+
const __m7=__req("packages/core/src/source/abort.js");
|
|
15453
|
+
Object.defineProperty(__exports,"AbortScope",{enumerable:true,get:function(){return __m7["AbortScope"];}});
|
|
15454
|
+
Object.defineProperty(__exports,"RequestToken",{enumerable:true,get:function(){return __m7["RequestToken"];}});
|
|
15455
|
+
Object.defineProperty(__exports,"SupersededError",{enumerable:true,get:function(){return __m7["SupersededError"];}});
|
|
15456
|
+
Object.defineProperty(__exports,"createAbortScope",{enumerable:true,get:function(){return __m7["createAbortScope"];}});
|
|
15457
|
+
Object.defineProperty(__exports,"isAbortError",{enumerable:true,get:function(){return __m7["isAbortError"];}});
|
|
15458
|
+
const __m8=__req("packages/core/src/source/filterwire.js");
|
|
15459
|
+
Object.defineProperty(__exports,"RELATIVE_TOKENS",{enumerable:true,get:function(){return __m8["RELATIVE_TOKENS"];}});
|
|
15460
|
+
Object.defineProperty(__exports,"parseRelativeToken",{enumerable:true,get:function(){return __m8["parseRelativeToken"];}});
|
|
15461
|
+
Object.defineProperty(__exports,"resolveRelativeRange",{enumerable:true,get:function(){return __m8["resolveRelativeRange"];}});
|
|
15462
|
+
Object.defineProperty(__exports,"resolveRelativeCondition",{enumerable:true,get:function(){return __m8["resolveRelativeCondition"];}});
|
|
15463
|
+
Object.defineProperty(__exports,"relativeTokenOf",{enumerable:true,get:function(){return __m8["relativeTokenOf"];}});
|
|
15464
|
+
Object.defineProperty(__exports,"buildFilterSet",{enumerable:true,get:function(){return __m8["buildFilterSet"];}});
|
|
15465
|
+
Object.defineProperty(__exports,"normaliseFilterSet",{enumerable:true,get:function(){return __m8["normaliseFilterSet"];}});
|
|
15466
|
+
Object.defineProperty(__exports,"wireFilters",{enumerable:true,get:function(){return __m8["wireFilters"];}});
|
|
15467
|
+
Object.defineProperty(__exports,"querySignature",{enumerable:true,get:function(){return __m8["querySignature"];}});
|
|
15468
|
+
Object.defineProperty(__exports,"mapConditions",{enumerable:true,get:function(){return __m8["mapConditions"];}});
|
|
15469
|
+
Object.defineProperty(__exports,"forEachCondition",{enumerable:true,get:function(){return __m8["forEachCondition"];}});
|
|
15470
|
+
Object.defineProperty(__exports,"isGroup",{enumerable:true,get:function(){return __m8["isGroup"];}});
|
|
15471
|
+
const __m9=__req("packages/core/src/source/blockcache.js");
|
|
15472
|
+
Object.defineProperty(__exports,"BlockCache",{enumerable:true,get:function(){return __m9["BlockCache"];}});
|
|
15473
|
+
Object.defineProperty(__exports,"DEFAULT_PAGE_SIZE",{enumerable:true,get:function(){return __m9["DEFAULT_PAGE_SIZE"];}});
|
|
15474
|
+
Object.defineProperty(__exports,"DEFAULT_MAX_CACHED_PAGES",{enumerable:true,get:function(){return __m9["DEFAULT_MAX_CACHED_PAGES"];}});
|
|
15475
|
+
const __m10=__req("packages/core/src/source/gapbuffer.js");
|
|
15476
|
+
Object.defineProperty(__exports,"GapBuffer",{enumerable:true,get:function(){return __m10["GapBuffer"];}});
|
|
15477
|
+
const __m11=__req("packages/core/src/source/rows.js");
|
|
15478
|
+
Object.defineProperty(__exports,"RowFactory",{enumerable:true,get:function(){return __m11["RowFactory"];}});
|
|
15479
|
+
Object.defineProperty(__exports,"createRowFactory",{enumerable:true,get:function(){return __m11["createRowFactory"];}});
|
|
15480
|
+
Object.defineProperty(__exports,"groupKey",{enumerable:true,get:function(){return __m11["groupKey"];}});
|
|
15481
|
+
Object.defineProperty(__exports,"lazyRowView",{enumerable:true,get:function(){return __m11["lazyRowView"];}});
|
|
15482
|
+
Object.defineProperty(__exports,"DEFAULT_ROW_HEIGHT",{enumerable:true,get:function(){return __m11["DEFAULT_ROW_HEIGHT"];}});
|
|
15483
|
+
const __m12=__req("packages/core/src/source/handles.js");
|
|
15484
|
+
Object.defineProperty(__exports,"HandleProvider",{enumerable:true,get:function(){return __m12["HandleProvider"];}});
|
|
15485
|
+
Object.defineProperty(__exports,"createHandleProvider",{enumerable:true,get:function(){return __m12["createHandleProvider"];}});
|
|
15486
|
+
const MODES=Object.freeze(['memory','paged','remote','stream','derived']);
|
|
15119
15487
|
function createSource(config,ctx){
|
|
15120
15488
|
if(!ctx)fail('createSource requires a SourceContext');
|
|
15121
15489
|
const resolved=isObject(config)?config:{mode:'memory'};
|
|
@@ -15125,6 +15493,7 @@ case'memory':return createMemorySource((resolved),ctx);
|
|
|
15125
15493
|
case'paged':return createPagedSource((resolved),ctx);
|
|
15126
15494
|
case'remote':return createRemoteSource((resolved),ctx);
|
|
15127
15495
|
case'stream':return createStreamSource((resolved),ctx);
|
|
15496
|
+
case'derived':return createDerivedSource((resolved),ctx);
|
|
15128
15497
|
default:
|
|
15129
15498
|
warnOnce(
|
|
15130
15499
|
`source.mode.${mode}`,
|
|
@@ -25215,6 +25584,7 @@ const __m19=__req("packages/core/src/compute/index.js");
|
|
|
25215
25584
|
const compute=__m19;
|
|
25216
25585
|
const __m20=__req("packages/core/src/source/index.js");
|
|
25217
25586
|
const createSource=__m20["createSource"];
|
|
25587
|
+
const DERIVED_ROW_KEY=__m20["DERIVED_ROW_KEY"];
|
|
25218
25588
|
const __m21=__req("packages/core/src/source/rows.js");
|
|
25219
25589
|
const pinnedRow=__m21["pinnedRow"];
|
|
25220
25590
|
const DEFAULT_ROW_HEIGHT=__m21["DEFAULT_ROW_HEIGHT"];
|
|
@@ -25471,6 +25841,10 @@ for(const[name,fn]of Object.entries(this.#config.totalFns||{})){
|
|
|
25471
25841
|
if(isFunction(fn))this.#registry.register('totalFn',name,fn);
|
|
25472
25842
|
}
|
|
25473
25843
|
this.#pool=new MaskPool();
|
|
25844
|
+
if(this.#config.rowKey===undefined&&isObject(this.#config.source)
|
|
25845
|
+
&&(this.#config.source).mode==='derived'){
|
|
25846
|
+
this.#config.rowKey=DERIVED_ROW_KEY;
|
|
25847
|
+
}
|
|
25474
25848
|
this.#rowKeyResolver=createRowKey(this.#config.rowKey);
|
|
25475
25849
|
this.#rowKey=(data,index)=>this.#rowKeyResolver.key(data,index);
|
|
25476
25850
|
if(Array.isArray(this.#config.pinnedTopRows))this.#pinnedTop=this.#config.pinnedTopRows.slice();
|
|
@@ -38448,6 +38822,7 @@ const PREFIX='lat';
|
|
|
38448
38822
|
const NAMESPACE='lattice';
|
|
38449
38823
|
const CLASS={
|
|
38450
38824
|
root:`${PREFIX}-grid-root`,
|
|
38825
|
+
title:`${PREFIX}-title`,
|
|
38451
38826
|
header:`${PREFIX}-header`,
|
|
38452
38827
|
headerStart:`${PREFIX}-header-left-pinned`,
|
|
38453
38828
|
headerCentreClip:`${PREFIX}-header-centre-clip`,
|
|
@@ -38503,6 +38878,8 @@ fail('DomRenderer needs a DOM. Use createHeadlessGrid() on the server.');
|
|
|
38503
38878
|
this.#document=document;
|
|
38504
38879
|
this.#host=element;
|
|
38505
38880
|
this.root=el(document,`${NAMESPACE} ${CLASS.root}`);
|
|
38881
|
+
this.title=el(document,CLASS.title);
|
|
38882
|
+
this.title.hidden=true;
|
|
38506
38883
|
this.header=el(document,CLASS.header);
|
|
38507
38884
|
this.headerStart=el(document,CLASS.headerStart);
|
|
38508
38885
|
this.headerCentreClip=el(document,CLASS.headerCentreClip);
|
|
@@ -38532,6 +38909,7 @@ this.stickyBottom=el(document,CLASS.stickyBottom);
|
|
|
38532
38909
|
this.overlays=el(document,CLASS.overlays);
|
|
38533
38910
|
this.statusBar=el(document,CLASS.statusBar);
|
|
38534
38911
|
this.measureLayer=el(document,CLASS.measure);
|
|
38912
|
+
this.root.appendChild(this.title);
|
|
38535
38913
|
this.root.appendChild(this.header);
|
|
38536
38914
|
this.root.appendChild(this.bodyViewport);
|
|
38537
38915
|
this.root.appendChild(this.stickyTop);
|
|
@@ -38541,6 +38919,14 @@ this.root.appendChild(this.statusBar);
|
|
|
38541
38919
|
this.root.appendChild(this.measureLayer);
|
|
38542
38920
|
}
|
|
38543
38921
|
get document(){return this.#document;}
|
|
38922
|
+
setTitle(text){
|
|
38923
|
+
const value=text===null||text===undefined?'':String(text);
|
|
38924
|
+
this.title.textContent=value;
|
|
38925
|
+
this.title.hidden=value==='';
|
|
38926
|
+
}
|
|
38927
|
+
setHeaderVisible(visible){
|
|
38928
|
+
this.header.hidden=!visible;
|
|
38929
|
+
}
|
|
38544
38930
|
mount(){
|
|
38545
38931
|
this.#host.appendChild(this.root);
|
|
38546
38932
|
}
|
|
@@ -42288,6 +42674,7 @@ this.#host=host;
|
|
|
42288
42674
|
this.#cellLayer=host.cellLayer||textCellLayer;
|
|
42289
42675
|
this.#overscan=Number.isFinite(host.config?.overscan)?host.config.overscan:DEFAULT_OVERSCAN;
|
|
42290
42676
|
this.#viewport=new Viewport(element,{document:host.document});
|
|
42677
|
+
this.#applyChrome(host.config);
|
|
42291
42678
|
this.#layout=new ColumnLayout({
|
|
42292
42679
|
columns:()=>this.#visibleColumns(),
|
|
42293
42680
|
threshold:host.config?.columnVirtualisationAbove,
|
|
@@ -42357,6 +42744,11 @@ onFrame:(ctx)=>this.#frame(ctx),
|
|
|
42357
42744
|
onScrollEnd:()=>this.#host.emit('scroll:end',this.scrollPosition()),
|
|
42358
42745
|
});
|
|
42359
42746
|
}
|
|
42747
|
+
#applyChrome(config){
|
|
42748
|
+
const title=config&&config.title;
|
|
42749
|
+
this.#viewport.setTitle(typeof title==='string'?title:null);
|
|
42750
|
+
this.#viewport.setHeaderVisible(!(config&&config.showHeader===false));
|
|
42751
|
+
}
|
|
42360
42752
|
mount(){
|
|
42361
42753
|
if(this.#mountedOnce)return;
|
|
42362
42754
|
this.#mountedOnce=true;
|