@toclocoinc/lattice-grid 1.9.0 → 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 +202 -5
- package/docs/api-detail.html +1 -1
- package/lattice-grid.d.ts +255 -4
- package/lattice-grid.esm.min.js +789 -116
- package/lattice-grid.min.cjs +784 -116
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +784 -116
- package/modules/charts.esm.min.js +91 -30
- package/modules/devtools.esm.min.js +1 -1
- package/modules/dhtmlx-compat.esm.min.js +784 -116
- package/modules/htmx.esm.min.js +490 -51
- package/modules/htmx.min.cjs +490 -51
- package/modules/htmx.min.js +490 -51
- 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 +784 -116
- package/package.json +1 -1
package/modules/htmx.min.cjs
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
|
*/
|
|
@@ -911,7 +911,14 @@ STDEV:(a)=>spread(numbers(a),true),
|
|
|
911
911
|
STDEVP:(a)=>spread(numbers(a),false),
|
|
912
912
|
VAR:(a)=>{const sd=spread(numbers(a),true);return sd*sd;},
|
|
913
913
|
VARP:(a)=>{const sd=spread(numbers(a),false);return sd*sd;},
|
|
914
|
-
COUNTDISTINCT:(a)=>
|
|
914
|
+
COUNTDISTINCT:(a)=>{
|
|
915
|
+
const seen=new Set();
|
|
916
|
+
for(const arg of a){
|
|
917
|
+
const values=Array.isArray(arg)?arg:[arg];
|
|
918
|
+
for(const v of values)if(v!==null&&v!==undefined&&v!=='')seen.add(v);
|
|
919
|
+
}
|
|
920
|
+
return seen.size;
|
|
921
|
+
},
|
|
915
922
|
IQR:(a)=>{
|
|
916
923
|
const values=numbers(a);
|
|
917
924
|
return percentileOf(values,0.75)-percentileOf(values,0.25);
|
|
@@ -6725,6 +6732,7 @@ const key=(ctx.row&&ctx.row.key)||api.keyOf(ctx.data);
|
|
|
6725
6732
|
return key?api.running(source,spec.kind||'total',key):null;
|
|
6726
6733
|
},
|
|
6727
6734
|
};
|
|
6735
|
+
if(def.sort===undefined)m.sort={...(m.sort||{}),enabled:false};
|
|
6728
6736
|
}
|
|
6729
6737
|
const field=def.field??(isFunction(m.value&&m.value.compute)?null:(def.id??null));
|
|
6730
6738
|
const computed=isFunction(m.value&&m.value.compute);
|
|
@@ -12945,14 +12953,22 @@ return this.#keyIndex.get(key);
|
|
|
12945
12953
|
#changedColumns(previous,next){
|
|
12946
12954
|
const changed=[];
|
|
12947
12955
|
for(const colId of this.#queryColumns()){
|
|
12948
|
-
|
|
12949
|
-
if(!column)continue;
|
|
12950
|
-
const before=isFunction(column.getValue)?column.getValue(previous):undefined;
|
|
12951
|
-
const after=isFunction(column.getValue)?column.getValue(next):undefined;
|
|
12952
|
-
if(!Object.is(before,after))changed.push(colId);
|
|
12956
|
+
if(this.#column(colId)&&this.#moved(colId,previous,next,new Set()))changed.push(colId);
|
|
12953
12957
|
}
|
|
12954
12958
|
return changed;
|
|
12955
12959
|
}
|
|
12960
|
+
#moved(colId,previous,next,seen){
|
|
12961
|
+
if(seen.has(colId))return false;
|
|
12962
|
+
seen.add(colId);
|
|
12963
|
+
const column=this.#column(colId);
|
|
12964
|
+
if(!column)return false;
|
|
12965
|
+
const deps=column.value&&column.value.deps;
|
|
12966
|
+
if(Array.isArray(deps)&&deps.length){
|
|
12967
|
+
return deps.some((dep)=>this.#moved(String(dep),previous,next,seen));
|
|
12968
|
+
}
|
|
12969
|
+
if(!isFunction(column.getValue))return false;
|
|
12970
|
+
return!Object.is(column.getValue(previous),column.getValue(next));
|
|
12971
|
+
}
|
|
12956
12972
|
#queryColumns(){
|
|
12957
12973
|
const ids=new Set();
|
|
12958
12974
|
for(const entry of this.#state('sort',[]))ids.add(entry.col);
|
|
@@ -13101,7 +13117,16 @@ handleFor(colId){
|
|
|
13101
13117
|
return this.#handles.handle(colId);
|
|
13102
13118
|
}
|
|
13103
13119
|
#runSort(filtered){
|
|
13104
|
-
const entries=this.#state('sort',[])
|
|
13120
|
+
const entries=this.#state('sort',[]).filter((entry)=>{
|
|
13121
|
+
const column=this.#column(entry.col);
|
|
13122
|
+
if(!column||!column.running)return true;
|
|
13123
|
+
warnOnce(
|
|
13124
|
+
`source.sort.running.${entry.col}`,
|
|
13125
|
+
`sort ignores "${entry.col}": a running total is a function of the sort order, `
|
|
13126
|
+
+'so it cannot also decide it. Sort by the column it runs over instead.',
|
|
13127
|
+
);
|
|
13128
|
+
return false;
|
|
13129
|
+
});
|
|
13105
13130
|
if(!entries.length)return filtered;
|
|
13106
13131
|
const locale=(this.#ctx.config||{}).locale;
|
|
13107
13132
|
if(entries.length===1){
|
|
@@ -15024,6 +15049,354 @@ if(isFunction(emit))emit(type,payload);
|
|
|
15024
15049
|
}
|
|
15025
15050
|
}
|
|
15026
15051
|
});
|
|
15052
|
+
__def("packages/core/src/source/derive.js",function(__exports,__req){
|
|
15053
|
+
'use strict';
|
|
15054
|
+
Object.defineProperty(__exports,"FOLLOW_MODES",{enumerable:true,get:function(){return FOLLOW_MODES;}});
|
|
15055
|
+
Object.defineProperty(__exports,"BUCKETS",{enumerable:true,get:function(){return BUCKETS;}});
|
|
15056
|
+
Object.defineProperty(__exports,"DERIVED_ROW_KEY",{enumerable:true,get:function(){return DERIVED_ROW_KEY;}});
|
|
15057
|
+
Object.defineProperty(__exports,"readPath",{enumerable:true,get:function(){return readPath;}});
|
|
15058
|
+
Object.defineProperty(__exports,"unnest",{enumerable:true,get:function(){return unnest;}});
|
|
15059
|
+
Object.defineProperty(__exports,"bucketOf",{enumerable:true,get:function(){return bucketOf;}});
|
|
15060
|
+
Object.defineProperty(__exports,"reduceValues",{enumerable:true,get:function(){return reduceValues;}});
|
|
15061
|
+
Object.defineProperty(__exports,"applyLimit",{enumerable:true,get:function(){return applyLimit;}});
|
|
15062
|
+
Object.defineProperty(__exports,"applyCumulative",{enumerable:true,get:function(){return applyCumulative;}});
|
|
15063
|
+
Object.defineProperty(__exports,"derive",{enumerable:true,get:function(){return derive;}});
|
|
15064
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
15065
|
+
const isFunction=__m0["isFunction"];
|
|
15066
|
+
const isObject=__m0["isObject"];
|
|
15067
|
+
const __m1=__req("packages/core/src/compute/total.js");
|
|
15068
|
+
const TOTAL_FNS=__m1["TOTAL_FNS"];
|
|
15069
|
+
const FOLLOW_MODES=Object.freeze(['filtered','all','selected','grouped']);
|
|
15070
|
+
const BUCKETS=Object.freeze(['day','week','month','quarter','year']);
|
|
15071
|
+
const DERIVED_ROW_KEY='__key';
|
|
15072
|
+
function readPath(obj,path){
|
|
15073
|
+
if(!isObject(obj)||typeof path!=='string')return undefined;
|
|
15074
|
+
if(!path.includes('.'))return(obj)[path];
|
|
15075
|
+
let cursor=(obj);
|
|
15076
|
+
for(const part of path.split('.')){
|
|
15077
|
+
if(!isObject(cursor))return undefined;
|
|
15078
|
+
cursor=(cursor)[part];
|
|
15079
|
+
}
|
|
15080
|
+
return cursor;
|
|
15081
|
+
}
|
|
15082
|
+
function unnest(rows,path){
|
|
15083
|
+
const out=[];
|
|
15084
|
+
for(const row of rows){
|
|
15085
|
+
const list=readPath(row,path);
|
|
15086
|
+
if(!Array.isArray(list)||!list.length)continue;
|
|
15087
|
+
for(const item of list)out.push({...((row)),[path]:item});
|
|
15088
|
+
}
|
|
15089
|
+
return out;
|
|
15090
|
+
}
|
|
15091
|
+
function bucketOf(value,by){
|
|
15092
|
+
const at=value instanceof Date?value:new Date((value));
|
|
15093
|
+
const time=at.getTime();
|
|
15094
|
+
if(!Number.isFinite(time))return null;
|
|
15095
|
+
const y=at.getUTCFullYear();
|
|
15096
|
+
const m=at.getUTCMonth();
|
|
15097
|
+
const d=at.getUTCDate();
|
|
15098
|
+
const iso=(date)=>date.toISOString().slice(0,10);
|
|
15099
|
+
switch(by){
|
|
15100
|
+
case'year':return iso(new Date(Date.UTC(y,0,1)));
|
|
15101
|
+
case'quarter':return iso(new Date(Date.UTC(y,Math.floor(m/3)*3,1)));
|
|
15102
|
+
case'month':return iso(new Date(Date.UTC(y,m,1)));
|
|
15103
|
+
case'week':{
|
|
15104
|
+
const day=(at.getUTCDay()+6)%7;
|
|
15105
|
+
return iso(new Date(Date.UTC(y,m,d-day)));
|
|
15106
|
+
}
|
|
15107
|
+
default:return iso(new Date(Date.UTC(y,m,d)));
|
|
15108
|
+
}
|
|
15109
|
+
}
|
|
15110
|
+
function groupKeyOf(row,by,bucket){
|
|
15111
|
+
const values=by.map((path)=>(
|
|
15112
|
+
bucket&&bucket.of===path?bucketOf(readPath(row,path),bucket.by):readPath(row,path)
|
|
15113
|
+
));
|
|
15114
|
+
return{key:values.map((v)=>(v===undefined||v===null?'\u0000':String(v))).join('\u001f'),values};
|
|
15115
|
+
}
|
|
15116
|
+
function reduceValues(values,fn){
|
|
15117
|
+
const kernel=TOTAL_FNS[fn];
|
|
15118
|
+
if(!kernel)return null;
|
|
15119
|
+
return kernel({get:(i)=>values[i]},ROW_INDICES(values.length));
|
|
15120
|
+
}
|
|
15121
|
+
function reduceGroup(rows,select){
|
|
15122
|
+
const out={};
|
|
15123
|
+
const indices=ROW_INDICES(rows.length);
|
|
15124
|
+
for(const[id,spec]of Object.entries(select)){
|
|
15125
|
+
const fn=spec.fn||'count';
|
|
15126
|
+
const kernel=TOTAL_FNS[fn];
|
|
15127
|
+
if(!kernel){out[id]=null;continue;}
|
|
15128
|
+
const values=spec.of?rows.map((row)=>readPath(row,spec.of)):[];
|
|
15129
|
+
out[id]=kernel({get:(i)=>values[i]},indices);
|
|
15130
|
+
}
|
|
15131
|
+
return out;
|
|
15132
|
+
}
|
|
15133
|
+
const ROW_INDICES=(()=>{
|
|
15134
|
+
const cache=new Map();
|
|
15135
|
+
return(n)=>{
|
|
15136
|
+
let hit=cache.get(n);
|
|
15137
|
+
if(!hit){
|
|
15138
|
+
hit=new Uint32Array(n);
|
|
15139
|
+
for(let i=0;i<n;i++)hit[i]=i;
|
|
15140
|
+
if(cache.size<512)cache.set(n,hit);
|
|
15141
|
+
}
|
|
15142
|
+
return hit;
|
|
15143
|
+
};
|
|
15144
|
+
})();
|
|
15145
|
+
function applyLimit(rows,limit,per){
|
|
15146
|
+
if(!Number.isFinite(limit)||limit<=0)return rows;
|
|
15147
|
+
if(!per)return rows.slice(0,limit);
|
|
15148
|
+
const seen=new Map();
|
|
15149
|
+
const out=[];
|
|
15150
|
+
for(const row of rows){
|
|
15151
|
+
const key=String(readPath(row,per));
|
|
15152
|
+
const taken=seen.get(key)||0;
|
|
15153
|
+
if(taken>=limit)continue;
|
|
15154
|
+
seen.set(key,taken+1);
|
|
15155
|
+
out.push(row);
|
|
15156
|
+
}
|
|
15157
|
+
return out;
|
|
15158
|
+
}
|
|
15159
|
+
function applyCumulative(rows,spec){
|
|
15160
|
+
const total=rows.reduce((sum,row)=>sum+(Number(readPath(row,spec.of))||0),0);
|
|
15161
|
+
if(!total)return rows;
|
|
15162
|
+
const cutoff=total*spec.upTo;
|
|
15163
|
+
let running=0;
|
|
15164
|
+
const out=[];
|
|
15165
|
+
for(const row of rows){
|
|
15166
|
+
out.push(row);
|
|
15167
|
+
running+=Number(readPath(row,spec.of))||0;
|
|
15168
|
+
if(running>=cutoff)break;
|
|
15169
|
+
}
|
|
15170
|
+
return out;
|
|
15171
|
+
}
|
|
15172
|
+
function sortRows(rows,spec){
|
|
15173
|
+
if(!Array.isArray(spec)||!spec.length)return rows;
|
|
15174
|
+
return[...rows].sort((a,b)=>{
|
|
15175
|
+
for(const entry of spec){
|
|
15176
|
+
const av=readPath(a,entry.col);
|
|
15177
|
+
const bv=readPath(b,entry.col);
|
|
15178
|
+
if(av===bv)continue;
|
|
15179
|
+
if(av===null||av===undefined)return 1;
|
|
15180
|
+
if(bv===null||bv===undefined)return-1;
|
|
15181
|
+
const less=typeof av==='number'&&typeof bv==='number'
|
|
15182
|
+
?av<bv
|
|
15183
|
+
:String(av)<String(bv);
|
|
15184
|
+
return(less?-1:1)*(entry.dir==='desc'?-1:1);
|
|
15185
|
+
}
|
|
15186
|
+
return 0;
|
|
15187
|
+
});
|
|
15188
|
+
}
|
|
15189
|
+
function derive(rows,spec){
|
|
15190
|
+
let working=Array.isArray(rows)?rows:[];
|
|
15191
|
+
if(spec.unnest)working=unnest(working,spec.unnest);
|
|
15192
|
+
if(isFunction(spec.where))working=working.filter((row)=>!!spec.where(row));
|
|
15193
|
+
const by=spec.groupBy
|
|
15194
|
+
?(Array.isArray(spec.groupBy)?spec.groupBy:[spec.groupBy])
|
|
15195
|
+
:null;
|
|
15196
|
+
const bucket=isObject(spec.bucket)?spec.bucket:null;
|
|
15197
|
+
let out;
|
|
15198
|
+
if(!by){
|
|
15199
|
+
out=working.map((row,i)=>({
|
|
15200
|
+
...((row)),
|
|
15201
|
+
[DERIVED_ROW_KEY]:String(readPath(row,spec.rowKey||'id')??i),
|
|
15202
|
+
}));
|
|
15203
|
+
}else{
|
|
15204
|
+
const groups=new Map();
|
|
15205
|
+
for(const row of working){
|
|
15206
|
+
const{key,values}=groupKeyOf(row,by,bucket);
|
|
15207
|
+
let bucketed=groups.get(key);
|
|
15208
|
+
if(!bucketed){bucketed={values,rows:[]};groups.set(key,bucketed);}
|
|
15209
|
+
bucketed.rows.push(row);
|
|
15210
|
+
}
|
|
15211
|
+
out=[...groups.entries()].map(([key,group])=>{
|
|
15212
|
+
const row={[DERIVED_ROW_KEY]:key};
|
|
15213
|
+
by.forEach((path,i)=>{row[path.includes('.')?path.split('.').pop():path]=group.values[i];});
|
|
15214
|
+
Object.assign(row,reduceGroup(group.rows,spec.select||{}));
|
|
15215
|
+
return row;
|
|
15216
|
+
});
|
|
15217
|
+
}
|
|
15218
|
+
out=sortRows(out,spec.sort);
|
|
15219
|
+
if(isObject(spec.cumulative))out=applyCumulative(out,spec.cumulative);
|
|
15220
|
+
return applyLimit(out,spec.limit,spec.limitPer||null);
|
|
15221
|
+
}
|
|
15222
|
+
});
|
|
15223
|
+
__def("packages/core/src/source/derived.js",function(__exports,__req){
|
|
15224
|
+
'use strict';
|
|
15225
|
+
Object.defineProperty(__exports,"IDLE_REFRESH_MS",{enumerable:true,get:function(){return IDLE_REFRESH_MS;}});
|
|
15226
|
+
Object.defineProperty(__exports,"PROFILE_FIELDS",{enumerable:true,get:function(){return PROFILE_FIELDS;}});
|
|
15227
|
+
Object.defineProperty(__exports,"DerivedSource",{enumerable:true,get:function(){return DerivedSource;}});
|
|
15228
|
+
Object.defineProperty(__exports,"createDerivedSource",{enumerable:true,get:function(){return createDerivedSource;}});
|
|
15229
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
15230
|
+
const isFunction=__m0["isFunction"];
|
|
15231
|
+
const isObject=__m0["isObject"];
|
|
15232
|
+
const warnOnce=__m0["warnOnce"];
|
|
15233
|
+
const __m1=__req("packages/core/src/source/memory.js");
|
|
15234
|
+
const MemorySource=__m1["MemorySource"];
|
|
15235
|
+
const __m2=__req("packages/core/src/source/derive.js");
|
|
15236
|
+
const derive=__m2["derive"];
|
|
15237
|
+
const FOLLOW_MODES=__m2["FOLLOW_MODES"];
|
|
15238
|
+
const DERIVED_ROW_KEY=__m2["DERIVED_ROW_KEY"];
|
|
15239
|
+
const IDLE_REFRESH_MS=16;
|
|
15240
|
+
const PROFILE_FIELDS=Object.freeze([
|
|
15241
|
+
'column','rows','present','missing','distinct',
|
|
15242
|
+
'min','max','mean','median','q1','q3','iqr','stddev','outliers',
|
|
15243
|
+
]);
|
|
15244
|
+
class DerivedSource extends MemorySource{
|
|
15245
|
+
#from=null;
|
|
15246
|
+
#spec={};
|
|
15247
|
+
#off=[];
|
|
15248
|
+
#pending=null;
|
|
15249
|
+
#gone=false;
|
|
15250
|
+
#ctx={};
|
|
15251
|
+
#deriving=false;
|
|
15252
|
+
constructor(config,ctx){
|
|
15253
|
+
super({mode:'memory',rows:[]},ctx);
|
|
15254
|
+
this.#ctx=ctx||{};
|
|
15255
|
+
this.#spec=isObject(config)?config:{};
|
|
15256
|
+
this.#from=(this.#spec.from)||null;
|
|
15257
|
+
if(!this.#from){
|
|
15258
|
+
warnOnce('source.derived.from','source.mode "derived" needs `from`: the grid to derive from.');
|
|
15259
|
+
return;
|
|
15260
|
+
}
|
|
15261
|
+
if(this.#spec.follow&&!FOLLOW_MODES.includes(String(this.#spec.follow))){
|
|
15262
|
+
warnOnce(
|
|
15263
|
+
`source.derived.follow.${this.#spec.follow}`,
|
|
15264
|
+
`unknown follow "${this.#spec.follow}"; using "filtered". Known: ${FOLLOW_MODES.join(', ')}.`,
|
|
15265
|
+
);
|
|
15266
|
+
}
|
|
15267
|
+
this.#watch();
|
|
15268
|
+
this.refresh();
|
|
15269
|
+
}
|
|
15270
|
+
#watch(){
|
|
15271
|
+
const grid=this.#from;
|
|
15272
|
+
if(!grid||!isFunction(grid.on))return;
|
|
15273
|
+
const follow=String(this.#spec.follow||'filtered');
|
|
15274
|
+
const events=['rows:changed'];
|
|
15275
|
+
if(follow==='filtered'||follow==='grouped')events.push('filter:changed');
|
|
15276
|
+
if(follow==='selected')events.push('selection:changed');
|
|
15277
|
+
if(follow==='grouped')events.push('column:grouped');
|
|
15278
|
+
for(const name of events){
|
|
15279
|
+
const handler=()=>this.schedule();
|
|
15280
|
+
grid.on(name,handler);
|
|
15281
|
+
this.#off.push(()=>isFunction(grid.off)&&grid.off(name,handler));
|
|
15282
|
+
}
|
|
15283
|
+
}
|
|
15284
|
+
schedule(){
|
|
15285
|
+
const mode=this.#spec.refresh===undefined?'idle':this.#spec.refresh;
|
|
15286
|
+
if(mode==='manual')return;
|
|
15287
|
+
if(mode==='live'){this.refresh();return;}
|
|
15288
|
+
const wait=typeof mode==='number'&&Number.isFinite(mode)?mode:IDLE_REFRESH_MS;
|
|
15289
|
+
if(this.#pending)return;
|
|
15290
|
+
this.#pending=setTimeout(()=>{this.#pending=null;this.refresh();},wait);
|
|
15291
|
+
}
|
|
15292
|
+
refresh(){
|
|
15293
|
+
if(this.#gone||!this.#from)return;
|
|
15294
|
+
if(this.#deriving){
|
|
15295
|
+
warnOnce(
|
|
15296
|
+
'source.derived.cycle',
|
|
15297
|
+
'a derived grid is deriving from itself, directly or through a chain. '
|
|
15298
|
+
+'The cycle was refused; check the `from` of each grid in the chain.',
|
|
15299
|
+
);
|
|
15300
|
+
return;
|
|
15301
|
+
}
|
|
15302
|
+
this.#deriving=true;
|
|
15303
|
+
try{
|
|
15304
|
+
const rows=this.#spec.profile
|
|
15305
|
+
?this.#deriveProfile()
|
|
15306
|
+
:derive(this.#sourceRows(),this.#resolvedSpec());
|
|
15307
|
+
this.setRows(rows);
|
|
15308
|
+
this.invalidate('filter');
|
|
15309
|
+
if(isFunction(this.#ctx.emit)){
|
|
15310
|
+
(this.#ctx.emit)('rows:changed',{},'derived');
|
|
15311
|
+
}
|
|
15312
|
+
}finally{
|
|
15313
|
+
this.#deriving=false;
|
|
15314
|
+
}
|
|
15315
|
+
}
|
|
15316
|
+
#resolvedSpec(){
|
|
15317
|
+
if(String(this.#spec.follow||'filtered')!=='grouped')return this.#spec;
|
|
15318
|
+
const grid=this.#from;
|
|
15319
|
+
const state=grid&&grid.state&&isFunction(grid.state.get)?grid.state.get():null;
|
|
15320
|
+
const grouped=state&&Array.isArray(state.group)?state.group:[];
|
|
15321
|
+
if(!grouped.length)return this.#spec;
|
|
15322
|
+
return{...this.#spec,groupBy:[...grouped]};
|
|
15323
|
+
}
|
|
15324
|
+
#sourceRows(){
|
|
15325
|
+
const grid=this.#from;
|
|
15326
|
+
const follow=String(this.#spec.follow||'filtered');
|
|
15327
|
+
if(!grid||!grid.rows)return[];
|
|
15328
|
+
if(follow==='all'){
|
|
15329
|
+
const every=[];
|
|
15330
|
+
if(isFunction(grid.rows.forEachAll)){
|
|
15331
|
+
grid.rows.forEachAll((row)=>{if(!row.group)every.push(unwrap(row));});
|
|
15332
|
+
}
|
|
15333
|
+
return every;
|
|
15334
|
+
}
|
|
15335
|
+
if(follow==='selected'){
|
|
15336
|
+
const rows=grid.selection&&isFunction(grid.selection.rows)?grid.selection.rows():[];
|
|
15337
|
+
return rows.filter(Boolean).map(unwrap);
|
|
15338
|
+
}
|
|
15339
|
+
const out=[];
|
|
15340
|
+
if(isFunction(grid.rows.forEach)){
|
|
15341
|
+
grid.rows.forEach((row)=>{if(!row.group)out.push(unwrap(row));});
|
|
15342
|
+
}
|
|
15343
|
+
return out;
|
|
15344
|
+
}
|
|
15345
|
+
#deriveProfile(){
|
|
15346
|
+
const grid=this.#from;
|
|
15347
|
+
if(!grid||!grid.statistics||!isFunction(grid.statistics.profile))return[];
|
|
15348
|
+
const wanted=Array.isArray(this.#spec.profile)?this.#spec.profile:[this.#spec.profile];
|
|
15349
|
+
const rows=wanted.filter(Boolean).map((colId)=>{
|
|
15350
|
+
const stats=grid.statistics.profile(String(colId))||{};
|
|
15351
|
+
const row={[DERIVED_ROW_KEY]:String(colId)};
|
|
15352
|
+
for(const field of PROFILE_FIELDS){
|
|
15353
|
+
row[field]=field==='column'?String(colId):(stats[field]??null);
|
|
15354
|
+
}
|
|
15355
|
+
row.outliers=Array.isArray(stats.outliers)?stats.outliers.length:(stats.outliers??null);
|
|
15356
|
+
return row;
|
|
15357
|
+
});
|
|
15358
|
+
if(this.#spec.orient!=='metrics')return rows;
|
|
15359
|
+
const first=rows[0];
|
|
15360
|
+
if(!first)return[];
|
|
15361
|
+
return PROFILE_FIELDS.filter((f)=>f!=='column').map((field)=>({
|
|
15362
|
+
[DERIVED_ROW_KEY]:field,metric:field,value:first[field],
|
|
15363
|
+
}));
|
|
15364
|
+
}
|
|
15365
|
+
apply(change){
|
|
15366
|
+
const ops=['add','update','remove'];
|
|
15367
|
+
const rejected=[];
|
|
15368
|
+
for(const op of ops){
|
|
15369
|
+
for(const row of(change&&change[op])||[]){
|
|
15370
|
+
rejected.push({operation:op,id:row&&row.id,reason:'derived-read-only'});
|
|
15371
|
+
}
|
|
15372
|
+
}
|
|
15373
|
+
if(rejected.length){
|
|
15374
|
+
warnOnce(
|
|
15375
|
+
'source.derived.readonly',
|
|
15376
|
+
'a derived grid is read-only: its rows are computed from another grid. '
|
|
15377
|
+
+'Write to the source grid instead, and the derived one follows.',
|
|
15378
|
+
);
|
|
15379
|
+
}
|
|
15380
|
+
return{added:[],updated:[],removed:[],rejected};
|
|
15381
|
+
}
|
|
15382
|
+
destroy(){
|
|
15383
|
+
this.#gone=true;
|
|
15384
|
+
if(this.#pending){clearTimeout(this.#pending);this.#pending=null;}
|
|
15385
|
+
for(const off of this.#off){try{off();}catch{}}
|
|
15386
|
+
this.#off=[];
|
|
15387
|
+
this.#from=null;
|
|
15388
|
+
super.destroy();
|
|
15389
|
+
}
|
|
15390
|
+
}
|
|
15391
|
+
function unwrap(row){
|
|
15392
|
+
return isObject(row)&&'data'in(row)
|
|
15393
|
+
?(row).data
|
|
15394
|
+
:row;
|
|
15395
|
+
}
|
|
15396
|
+
function createDerivedSource(config,ctx){
|
|
15397
|
+
return new DerivedSource(config,ctx);
|
|
15398
|
+
}
|
|
15399
|
+
});
|
|
15027
15400
|
__def("packages/core/src/source/index.js",function(__exports,__req){
|
|
15028
15401
|
'use strict';
|
|
15029
15402
|
Object.defineProperty(__exports,"createMemorySource",{enumerable:true,get:function(){return createMemorySource;}});
|
|
@@ -15037,6 +15410,10 @@ Object.defineProperty(__exports,"PROTOCOL",{enumerable:true,get:function(){retur
|
|
|
15037
15410
|
Object.defineProperty(__exports,"createStreamSource",{enumerable:true,get:function(){return createStreamSource;}});
|
|
15038
15411
|
Object.defineProperty(__exports,"StreamSource",{enumerable:true,get:function(){return StreamSource;}});
|
|
15039
15412
|
Object.defineProperty(__exports,"DEFAULT_PROMOTE_BELOW",{enumerable:true,get:function(){return DEFAULT_PROMOTE_BELOW;}});
|
|
15413
|
+
Object.defineProperty(__exports,"createDerivedSource",{enumerable:true,get:function(){return createDerivedSource;}});
|
|
15414
|
+
Object.defineProperty(__exports,"DerivedSource",{enumerable:true,get:function(){return DerivedSource;}});
|
|
15415
|
+
Object.defineProperty(__exports,"IDLE_REFRESH_MS",{enumerable:true,get:function(){return IDLE_REFRESH_MS;}});
|
|
15416
|
+
Object.defineProperty(__exports,"PROFILE_FIELDS",{enumerable:true,get:function(){return PROFILE_FIELDS;}});
|
|
15040
15417
|
Object.defineProperty(__exports,"MODES",{enumerable:true,get:function(){return MODES;}});
|
|
15041
15418
|
Object.defineProperty(__exports,"createSource",{enumerable:true,get:function(){return createSource;}});
|
|
15042
15419
|
const __m0=__req("packages/core/src/internal/util.js");
|
|
@@ -15058,41 +15435,57 @@ const __m4=__req("packages/core/src/source/stream.js");
|
|
|
15058
15435
|
const createStreamSource=__m4["createStreamSource"];
|
|
15059
15436
|
const StreamSource=__m4["StreamSource"];
|
|
15060
15437
|
const DEFAULT_PROMOTE_BELOW=__m4["DEFAULT_PROMOTE_BELOW"];
|
|
15061
|
-
const __m5=__req("packages/core/src/source/
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
Object.defineProperty(__exports,"
|
|
15069
|
-
Object.defineProperty(__exports,"
|
|
15070
|
-
Object.defineProperty(__exports,"
|
|
15071
|
-
Object.defineProperty(__exports,"
|
|
15072
|
-
Object.defineProperty(__exports,"
|
|
15073
|
-
Object.defineProperty(__exports,"
|
|
15074
|
-
Object.defineProperty(__exports,"
|
|
15075
|
-
Object.defineProperty(__exports,"
|
|
15076
|
-
Object.defineProperty(__exports,"
|
|
15077
|
-
|
|
15078
|
-
Object.defineProperty(__exports,"
|
|
15079
|
-
Object.defineProperty(__exports,"
|
|
15080
|
-
|
|
15081
|
-
Object.defineProperty(__exports,"
|
|
15082
|
-
Object.defineProperty(__exports,"
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
Object.defineProperty(__exports,"
|
|
15086
|
-
|
|
15087
|
-
Object.defineProperty(__exports,"
|
|
15088
|
-
Object.defineProperty(__exports,"
|
|
15089
|
-
Object.defineProperty(__exports,"
|
|
15090
|
-
Object.defineProperty(__exports,"
|
|
15091
|
-
Object.defineProperty(__exports,"
|
|
15092
|
-
|
|
15093
|
-
Object.defineProperty(__exports,"
|
|
15094
|
-
Object.defineProperty(__exports,"
|
|
15095
|
-
|
|
15438
|
+
const __m5=__req("packages/core/src/source/derived.js");
|
|
15439
|
+
const createDerivedSource=__m5["createDerivedSource"];
|
|
15440
|
+
const DerivedSource=__m5["DerivedSource"];
|
|
15441
|
+
const IDLE_REFRESH_MS=__m5["IDLE_REFRESH_MS"];
|
|
15442
|
+
const PROFILE_FIELDS=__m5["PROFILE_FIELDS"];
|
|
15443
|
+
const __m6=__req("packages/core/src/source/derive.js");
|
|
15444
|
+
Object.defineProperty(__exports,"derive",{enumerable:true,get:function(){return __m6["derive"];}});
|
|
15445
|
+
Object.defineProperty(__exports,"unnest",{enumerable:true,get:function(){return __m6["unnest"];}});
|
|
15446
|
+
Object.defineProperty(__exports,"readPath",{enumerable:true,get:function(){return __m6["readPath"];}});
|
|
15447
|
+
Object.defineProperty(__exports,"bucketOf",{enumerable:true,get:function(){return __m6["bucketOf"];}});
|
|
15448
|
+
Object.defineProperty(__exports,"applyLimit",{enumerable:true,get:function(){return __m6["applyLimit"];}});
|
|
15449
|
+
Object.defineProperty(__exports,"applyCumulative",{enumerable:true,get:function(){return __m6["applyCumulative"];}});
|
|
15450
|
+
Object.defineProperty(__exports,"reduceValues",{enumerable:true,get:function(){return __m6["reduceValues"];}});
|
|
15451
|
+
Object.defineProperty(__exports,"FOLLOW_MODES",{enumerable:true,get:function(){return __m6["FOLLOW_MODES"];}});
|
|
15452
|
+
Object.defineProperty(__exports,"BUCKETS",{enumerable:true,get:function(){return __m6["BUCKETS"];}});
|
|
15453
|
+
Object.defineProperty(__exports,"DERIVED_ROW_KEY",{enumerable:true,get:function(){return __m6["DERIVED_ROW_KEY"];}});
|
|
15454
|
+
const __m7=__req("packages/core/src/source/abort.js");
|
|
15455
|
+
Object.defineProperty(__exports,"AbortScope",{enumerable:true,get:function(){return __m7["AbortScope"];}});
|
|
15456
|
+
Object.defineProperty(__exports,"RequestToken",{enumerable:true,get:function(){return __m7["RequestToken"];}});
|
|
15457
|
+
Object.defineProperty(__exports,"SupersededError",{enumerable:true,get:function(){return __m7["SupersededError"];}});
|
|
15458
|
+
Object.defineProperty(__exports,"createAbortScope",{enumerable:true,get:function(){return __m7["createAbortScope"];}});
|
|
15459
|
+
Object.defineProperty(__exports,"isAbortError",{enumerable:true,get:function(){return __m7["isAbortError"];}});
|
|
15460
|
+
const __m8=__req("packages/core/src/source/filterwire.js");
|
|
15461
|
+
Object.defineProperty(__exports,"RELATIVE_TOKENS",{enumerable:true,get:function(){return __m8["RELATIVE_TOKENS"];}});
|
|
15462
|
+
Object.defineProperty(__exports,"parseRelativeToken",{enumerable:true,get:function(){return __m8["parseRelativeToken"];}});
|
|
15463
|
+
Object.defineProperty(__exports,"resolveRelativeRange",{enumerable:true,get:function(){return __m8["resolveRelativeRange"];}});
|
|
15464
|
+
Object.defineProperty(__exports,"resolveRelativeCondition",{enumerable:true,get:function(){return __m8["resolveRelativeCondition"];}});
|
|
15465
|
+
Object.defineProperty(__exports,"relativeTokenOf",{enumerable:true,get:function(){return __m8["relativeTokenOf"];}});
|
|
15466
|
+
Object.defineProperty(__exports,"buildFilterSet",{enumerable:true,get:function(){return __m8["buildFilterSet"];}});
|
|
15467
|
+
Object.defineProperty(__exports,"normaliseFilterSet",{enumerable:true,get:function(){return __m8["normaliseFilterSet"];}});
|
|
15468
|
+
Object.defineProperty(__exports,"wireFilters",{enumerable:true,get:function(){return __m8["wireFilters"];}});
|
|
15469
|
+
Object.defineProperty(__exports,"querySignature",{enumerable:true,get:function(){return __m8["querySignature"];}});
|
|
15470
|
+
Object.defineProperty(__exports,"mapConditions",{enumerable:true,get:function(){return __m8["mapConditions"];}});
|
|
15471
|
+
Object.defineProperty(__exports,"forEachCondition",{enumerable:true,get:function(){return __m8["forEachCondition"];}});
|
|
15472
|
+
Object.defineProperty(__exports,"isGroup",{enumerable:true,get:function(){return __m8["isGroup"];}});
|
|
15473
|
+
const __m9=__req("packages/core/src/source/blockcache.js");
|
|
15474
|
+
Object.defineProperty(__exports,"BlockCache",{enumerable:true,get:function(){return __m9["BlockCache"];}});
|
|
15475
|
+
Object.defineProperty(__exports,"DEFAULT_PAGE_SIZE",{enumerable:true,get:function(){return __m9["DEFAULT_PAGE_SIZE"];}});
|
|
15476
|
+
Object.defineProperty(__exports,"DEFAULT_MAX_CACHED_PAGES",{enumerable:true,get:function(){return __m9["DEFAULT_MAX_CACHED_PAGES"];}});
|
|
15477
|
+
const __m10=__req("packages/core/src/source/gapbuffer.js");
|
|
15478
|
+
Object.defineProperty(__exports,"GapBuffer",{enumerable:true,get:function(){return __m10["GapBuffer"];}});
|
|
15479
|
+
const __m11=__req("packages/core/src/source/rows.js");
|
|
15480
|
+
Object.defineProperty(__exports,"RowFactory",{enumerable:true,get:function(){return __m11["RowFactory"];}});
|
|
15481
|
+
Object.defineProperty(__exports,"createRowFactory",{enumerable:true,get:function(){return __m11["createRowFactory"];}});
|
|
15482
|
+
Object.defineProperty(__exports,"groupKey",{enumerable:true,get:function(){return __m11["groupKey"];}});
|
|
15483
|
+
Object.defineProperty(__exports,"lazyRowView",{enumerable:true,get:function(){return __m11["lazyRowView"];}});
|
|
15484
|
+
Object.defineProperty(__exports,"DEFAULT_ROW_HEIGHT",{enumerable:true,get:function(){return __m11["DEFAULT_ROW_HEIGHT"];}});
|
|
15485
|
+
const __m12=__req("packages/core/src/source/handles.js");
|
|
15486
|
+
Object.defineProperty(__exports,"HandleProvider",{enumerable:true,get:function(){return __m12["HandleProvider"];}});
|
|
15487
|
+
Object.defineProperty(__exports,"createHandleProvider",{enumerable:true,get:function(){return __m12["createHandleProvider"];}});
|
|
15488
|
+
const MODES=Object.freeze(['memory','paged','remote','stream','derived']);
|
|
15096
15489
|
function createSource(config,ctx){
|
|
15097
15490
|
if(!ctx)fail('createSource requires a SourceContext');
|
|
15098
15491
|
const resolved=isObject(config)?config:{mode:'memory'};
|
|
@@ -15102,6 +15495,7 @@ case'memory':return createMemorySource((resolved),ctx);
|
|
|
15102
15495
|
case'paged':return createPagedSource((resolved),ctx);
|
|
15103
15496
|
case'remote':return createRemoteSource((resolved),ctx);
|
|
15104
15497
|
case'stream':return createStreamSource((resolved),ctx);
|
|
15498
|
+
case'derived':return createDerivedSource((resolved),ctx);
|
|
15105
15499
|
default:
|
|
15106
15500
|
warnOnce(
|
|
15107
15501
|
`source.mode.${mode}`,
|
|
@@ -25192,6 +25586,7 @@ const __m19=__req("packages/core/src/compute/index.js");
|
|
|
25192
25586
|
const compute=__m19;
|
|
25193
25587
|
const __m20=__req("packages/core/src/source/index.js");
|
|
25194
25588
|
const createSource=__m20["createSource"];
|
|
25589
|
+
const DERIVED_ROW_KEY=__m20["DERIVED_ROW_KEY"];
|
|
25195
25590
|
const __m21=__req("packages/core/src/source/rows.js");
|
|
25196
25591
|
const pinnedRow=__m21["pinnedRow"];
|
|
25197
25592
|
const DEFAULT_ROW_HEIGHT=__m21["DEFAULT_ROW_HEIGHT"];
|
|
@@ -25448,6 +25843,10 @@ for(const[name,fn]of Object.entries(this.#config.totalFns||{})){
|
|
|
25448
25843
|
if(isFunction(fn))this.#registry.register('totalFn',name,fn);
|
|
25449
25844
|
}
|
|
25450
25845
|
this.#pool=new MaskPool();
|
|
25846
|
+
if(this.#config.rowKey===undefined&&isObject(this.#config.source)
|
|
25847
|
+
&&(this.#config.source).mode==='derived'){
|
|
25848
|
+
this.#config.rowKey=DERIVED_ROW_KEY;
|
|
25849
|
+
}
|
|
25451
25850
|
this.#rowKeyResolver=createRowKey(this.#config.rowKey);
|
|
25452
25851
|
this.#rowKey=(data,index)=>this.#rowKeyResolver.key(data,index);
|
|
25453
25852
|
if(Array.isArray(this.#config.pinnedTopRows))this.#pinnedTop=this.#config.pinnedTopRows.slice();
|
|
@@ -28627,6 +29026,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
|
|
|
28627
29026
|
Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return parseRadix;}});
|
|
28628
29027
|
Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return formatRadix;}});
|
|
28629
29028
|
Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return createUnitType;}});
|
|
29029
|
+
Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return registerUnitSystem;}});
|
|
29030
|
+
Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return defineUnit;}});
|
|
28630
29031
|
Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return UNIT_SYSTEMS;}});
|
|
28631
29032
|
Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return parseUnit;}});
|
|
28632
29033
|
Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return formatUnit;}});
|
|
@@ -28637,6 +29038,8 @@ const RADIX_PRESETS=__m0["RADIX_PRESETS"];
|
|
|
28637
29038
|
const parseRadix=__m0["parseRadix"];
|
|
28638
29039
|
const formatRadix=__m0["formatRadix"];
|
|
28639
29040
|
const createUnitType=__m0["createUnitType"];
|
|
29041
|
+
const registerUnitSystem=__m0["registerUnitSystem"];
|
|
29042
|
+
const defineUnit=__m0["defineUnit"];
|
|
28640
29043
|
const UNIT_SYSTEMS=__m0["UNIT_SYSTEMS"];
|
|
28641
29044
|
const parseUnit=__m0["parseUnit"];
|
|
28642
29045
|
const formatUnit=__m0["formatUnit"];
|
|
@@ -38088,6 +38491,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
|
|
|
38088
38491
|
Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return __m5["parseRadix"];}});
|
|
38089
38492
|
Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return __m5["formatRadix"];}});
|
|
38090
38493
|
Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return __m5["createUnitType"];}});
|
|
38494
|
+
Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return __m5["registerUnitSystem"];}});
|
|
38495
|
+
Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return __m5["defineUnit"];}});
|
|
38091
38496
|
Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return __m5["UNIT_SYSTEMS"];}});
|
|
38092
38497
|
Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return __m5["parseUnit"];}});
|
|
38093
38498
|
Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return __m5["formatUnit"];}});
|
|
@@ -38419,6 +38824,7 @@ const PREFIX='lat';
|
|
|
38419
38824
|
const NAMESPACE='lattice';
|
|
38420
38825
|
const CLASS={
|
|
38421
38826
|
root:`${PREFIX}-grid-root`,
|
|
38827
|
+
title:`${PREFIX}-title`,
|
|
38422
38828
|
header:`${PREFIX}-header`,
|
|
38423
38829
|
headerStart:`${PREFIX}-header-left-pinned`,
|
|
38424
38830
|
headerCentreClip:`${PREFIX}-header-centre-clip`,
|
|
@@ -38474,6 +38880,8 @@ fail('DomRenderer needs a DOM. Use createHeadlessGrid() on the server.');
|
|
|
38474
38880
|
this.#document=document;
|
|
38475
38881
|
this.#host=element;
|
|
38476
38882
|
this.root=el(document,`${NAMESPACE} ${CLASS.root}`);
|
|
38883
|
+
this.title=el(document,CLASS.title);
|
|
38884
|
+
this.title.hidden=true;
|
|
38477
38885
|
this.header=el(document,CLASS.header);
|
|
38478
38886
|
this.headerStart=el(document,CLASS.headerStart);
|
|
38479
38887
|
this.headerCentreClip=el(document,CLASS.headerCentreClip);
|
|
@@ -38503,6 +38911,7 @@ this.stickyBottom=el(document,CLASS.stickyBottom);
|
|
|
38503
38911
|
this.overlays=el(document,CLASS.overlays);
|
|
38504
38912
|
this.statusBar=el(document,CLASS.statusBar);
|
|
38505
38913
|
this.measureLayer=el(document,CLASS.measure);
|
|
38914
|
+
this.root.appendChild(this.title);
|
|
38506
38915
|
this.root.appendChild(this.header);
|
|
38507
38916
|
this.root.appendChild(this.bodyViewport);
|
|
38508
38917
|
this.root.appendChild(this.stickyTop);
|
|
@@ -38512,6 +38921,14 @@ this.root.appendChild(this.statusBar);
|
|
|
38512
38921
|
this.root.appendChild(this.measureLayer);
|
|
38513
38922
|
}
|
|
38514
38923
|
get document(){return this.#document;}
|
|
38924
|
+
setTitle(text){
|
|
38925
|
+
const value=text===null||text===undefined?'':String(text);
|
|
38926
|
+
this.title.textContent=value;
|
|
38927
|
+
this.title.hidden=value==='';
|
|
38928
|
+
}
|
|
38929
|
+
setHeaderVisible(visible){
|
|
38930
|
+
this.header.hidden=!visible;
|
|
38931
|
+
}
|
|
38515
38932
|
mount(){
|
|
38516
38933
|
this.#host.appendChild(this.root);
|
|
38517
38934
|
}
|
|
@@ -42259,6 +42676,7 @@ this.#host=host;
|
|
|
42259
42676
|
this.#cellLayer=host.cellLayer||textCellLayer;
|
|
42260
42677
|
this.#overscan=Number.isFinite(host.config?.overscan)?host.config.overscan:DEFAULT_OVERSCAN;
|
|
42261
42678
|
this.#viewport=new Viewport(element,{document:host.document});
|
|
42679
|
+
this.#applyChrome(host.config);
|
|
42262
42680
|
this.#layout=new ColumnLayout({
|
|
42263
42681
|
columns:()=>this.#visibleColumns(),
|
|
42264
42682
|
threshold:host.config?.columnVirtualisationAbove,
|
|
@@ -42328,6 +42746,11 @@ onFrame:(ctx)=>this.#frame(ctx),
|
|
|
42328
42746
|
onScrollEnd:()=>this.#host.emit('scroll:end',this.scrollPosition()),
|
|
42329
42747
|
});
|
|
42330
42748
|
}
|
|
42749
|
+
#applyChrome(config){
|
|
42750
|
+
const title=config&&config.title;
|
|
42751
|
+
this.#viewport.setTitle(typeof title==='string'?title:null);
|
|
42752
|
+
this.#viewport.setHeaderVisible(!(config&&config.showHeader===false));
|
|
42753
|
+
}
|
|
42331
42754
|
mount(){
|
|
42332
42755
|
if(this.#mountedOnce)return;
|
|
42333
42756
|
this.#mountedOnce=true;
|
|
@@ -59661,6 +60084,12 @@ const __m3=__req("packages/dom/src/renderer/textentry.js");
|
|
|
59661
60084
|
const isTextEntry=__m3["isTextEntry"];
|
|
59662
60085
|
const IN_RANGE='lat-cell--range';
|
|
59663
60086
|
const RANGE_EDGE='lat-cell--range-edge';
|
|
60087
|
+
const EDGE_SIDES=Object.freeze({
|
|
60088
|
+
top:'lat-cell--range-top',
|
|
60089
|
+
right:'lat-cell--range-right',
|
|
60090
|
+
bottom:'lat-cell--range-bottom',
|
|
60091
|
+
left:'lat-cell--range-left',
|
|
60092
|
+
});
|
|
59664
60093
|
const DRAG_THRESHOLD=3;
|
|
59665
60094
|
class RangeController{
|
|
59666
60095
|
#grid;
|
|
@@ -59922,7 +60351,13 @@ if(!Number.isFinite(index)||index<0)continue;
|
|
|
59922
60351
|
const inRange=hasRange&&selection.inRange(index,colId);
|
|
59923
60352
|
const inPreview=!!preview&&this.#inFillPreview(index,colId,preview);
|
|
59924
60353
|
cell.classList.toggle(IN_RANGE,inRange||inPreview);
|
|
59925
|
-
|
|
60354
|
+
const edges=(inRange||inPreview)
|
|
60355
|
+
?this.#edgesOf(index,colId,selection)
|
|
60356
|
+
:null;
|
|
60357
|
+
cell.classList.toggle(RANGE_EDGE,!!edges&&edges.any);
|
|
60358
|
+
for(const[side,className]of Object.entries(EDGE_SIDES)){
|
|
60359
|
+
cell.classList.toggle(className,!!edges&&edges[side]);
|
|
60360
|
+
}
|
|
59926
60361
|
}
|
|
59927
60362
|
this.#placeHandle();
|
|
59928
60363
|
}
|
|
@@ -59934,15 +60369,19 @@ if(!columns.has(colId))return false;
|
|
|
59934
60369
|
const last=this.#indexOfKey([...new Set(cells.map((c)=>c.key))].pop());
|
|
59935
60370
|
return index>last&&index<=preview.rowIndex;
|
|
59936
60371
|
}
|
|
59937
|
-
#
|
|
60372
|
+
#edgesOf(index,colId,selection){
|
|
59938
60373
|
const columns=this.#grid.columns.visible().map((c)=>c.id);
|
|
59939
60374
|
const at=columns.indexOf(colId);
|
|
59940
|
-
const
|
|
59941
|
-
const
|
|
59942
|
-
|
|
59943
|
-
|
|
59944
|
-
|
|
59945
|
-
||!
|
|
60375
|
+
const before=at>0?columns[at-1]:null;
|
|
60376
|
+
const after=at>=0&&at<columns.length-1?columns[at+1]:null;
|
|
60377
|
+
const edges={
|
|
60378
|
+
top:!selection.inRange(index-1,colId),
|
|
60379
|
+
bottom:!selection.inRange(index+1,colId),
|
|
60380
|
+
left:!before||!selection.inRange(index,before),
|
|
60381
|
+
right:!after||!selection.inRange(index,after),
|
|
60382
|
+
};
|
|
60383
|
+
edges.any=edges.top||edges.bottom||edges.left||edges.right;
|
|
60384
|
+
return edges;
|
|
59946
60385
|
}
|
|
59947
60386
|
#placeHandle(){
|
|
59948
60387
|
const corner=this.#grid.selection.corner();
|