@toclocoinc/lattice-grid 1.13.0 → 1.14.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 +1 -1
- package/docs/API.html +592 -2
- package/docs/api-detail.html +276 -2
- package/lattice-grid.d.ts +30 -7
- package/lattice-grid.esm.min.js +158 -2
- package/lattice-grid.min.cjs +158 -2
- package/lattice-grid.min.js +158 -2
- package/modules/charts.esm.min.js +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/dhtmlx-compat.esm.min.js +227 -31
- package/modules/htmx.esm.min.js +158 -2
- package/modules/htmx.min.cjs +158 -2
- package/modules/htmx.min.js +158 -2
- package/modules/react.esm.min.js +26 -11
- package/modules/svelte.esm.min.js +26 -11
- package/modules/vue.esm.min.js +26 -11
- package/modules/webcomponent.esm.min.js +158 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.14.0, dhtmlx-compat module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -1428,7 +1428,7 @@ return{valid:false,...info,reason:'product'};
|
|
|
1428
1428
|
}
|
|
1429
1429
|
if(isExpired(parsed.expires,at)){
|
|
1430
1430
|
if(warn){
|
|
1431
|
-
warnOnce('licence.expired',`licence expired on ${parsed.expires}. The grid will render with a watermark. Renew at
|
|
1431
|
+
warnOnce('licence.expired',`licence expired on ${parsed.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`);
|
|
1432
1432
|
}
|
|
1433
1433
|
return{valid:false,...info,reason:'expired'};
|
|
1434
1434
|
}
|
|
@@ -27081,6 +27081,123 @@ return out;
|
|
|
27081
27081
|
}
|
|
27082
27082
|
return value;
|
|
27083
27083
|
}
|
|
27084
|
+
function describeValue(value){
|
|
27085
|
+
if(value===null)return'null';
|
|
27086
|
+
if(Array.isArray(value))return`an array of ${value.length}`;
|
|
27087
|
+
const kind=typeof value;
|
|
27088
|
+
if(kind==='string')return`the string '${value.length>24?`${value.slice(0,24)}…`:value}'`;
|
|
27089
|
+
if(kind==='number'||kind==='boolean')return`the ${kind} ${String(value)}`;
|
|
27090
|
+
return`a ${kind}`;
|
|
27091
|
+
}
|
|
27092
|
+
const CONFIG_SHAPES=Object.freeze({
|
|
27093
|
+
allowUnsafeTemplates:'boolean',
|
|
27094
|
+
columnVirtualisationAbove:'number',
|
|
27095
|
+
groupFooter:'boolean',
|
|
27096
|
+
headerHeight:'number',
|
|
27097
|
+
licence:'string',
|
|
27098
|
+
locale:'string',
|
|
27099
|
+
maximise:'boolean',
|
|
27100
|
+
overscan:'number',
|
|
27101
|
+
quickFilterText:'string',
|
|
27102
|
+
sampleSize:'number',
|
|
27103
|
+
sharedMemory:'boolean',
|
|
27104
|
+
shortcuts:'boolean',
|
|
27105
|
+
showColumnFunctions:'boolean',
|
|
27106
|
+
showHeader:'boolean',
|
|
27107
|
+
showTotalInHeader:'boolean',
|
|
27108
|
+
targetSize:['default','large'],
|
|
27109
|
+
timeZone:'string',
|
|
27110
|
+
title:'string',
|
|
27111
|
+
totalFilteredOnly:'boolean',
|
|
27112
|
+
totalOnlyChangedColumns:'boolean',
|
|
27113
|
+
useWorker:'boolean',
|
|
27114
|
+
workerThreshold:'number',
|
|
27115
|
+
workerUrl:'string',
|
|
27116
|
+
});
|
|
27117
|
+
function isPlainObject(v){
|
|
27118
|
+
return v!==null&&typeof v==='object'&&!Array.isArray(v);
|
|
27119
|
+
}
|
|
27120
|
+
const CONFIG_WIDE_CHECKS=Object.freeze({
|
|
27121
|
+
columns:(v)=>!Array.isArray(v),
|
|
27122
|
+
columnGroups:(v)=>!Array.isArray(v),
|
|
27123
|
+
rows:(v)=>!Array.isArray(v),
|
|
27124
|
+
pinnedTopRows:(v)=>!Array.isArray(v),
|
|
27125
|
+
pinnedBottomRows:(v)=>!Array.isArray(v),
|
|
27126
|
+
alignedGrids:(v)=>!Array.isArray(v),
|
|
27127
|
+
rowKey:(v)=>typeof v!=='string'&&typeof v!=='function',
|
|
27128
|
+
rowHeight:(v)=>typeof v!=='number'&&typeof v!=='function',
|
|
27129
|
+
source:(v)=>!isPlainObject(v),
|
|
27130
|
+
columnDefaults:(v)=>!isPlainObject(v),
|
|
27131
|
+
columnPresets:(v)=>!isPlainObject(v),
|
|
27132
|
+
dataTypes:(v)=>!isPlainObject(v),
|
|
27133
|
+
components:(v)=>!isPlainObject(v),
|
|
27134
|
+
pipes:(v)=>!isPlainObject(v),
|
|
27135
|
+
totalFns:(v)=>!isPlainObject(v),
|
|
27136
|
+
variants:(v)=>!isPlainObject(v),
|
|
27137
|
+
formulaFunctions:(v)=>!isPlainObject(v),
|
|
27138
|
+
typeOptions:(v)=>!isPlainObject(v),
|
|
27139
|
+
formatting:(v)=>!isPlainObject(v),
|
|
27140
|
+
tree:(v)=>!isPlainObject(v),
|
|
27141
|
+
detail:(v)=>!isPlainObject(v),
|
|
27142
|
+
comments:(v)=>!isPlainObject(v),
|
|
27143
|
+
presence:(v)=>!isPlainObject(v),
|
|
27144
|
+
permissions:(v)=>!isPlainObject(v),
|
|
27145
|
+
state:(v)=>!isPlainObject(v),
|
|
27146
|
+
updates:(v)=>!isPlainObject(v),
|
|
27147
|
+
diff:(v)=>!isPlainObject(v),
|
|
27148
|
+
views:(v)=>!isPlainObject(v),
|
|
27149
|
+
responsive:(v)=>!isPlainObject(v),
|
|
27150
|
+
hostFilter:(v)=>!isPlainObject(v),
|
|
27151
|
+
pivot:(v)=>!isPlainObject(v),
|
|
27152
|
+
ai:(v)=>!isPlainObject(v),
|
|
27153
|
+
environment:(v)=>typeof v!=='function',
|
|
27154
|
+
edit:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27155
|
+
pagination:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27156
|
+
facets:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27157
|
+
rowForm:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27158
|
+
rowReorder:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27159
|
+
columnTagFilter:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27160
|
+
historyBar:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27161
|
+
rowTransfer:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27162
|
+
statusBar:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27163
|
+
toolPanel:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27164
|
+
stickyGroupHeaders:(v)=>!isPlainObject(v)&&typeof v!=='boolean'&&typeof v!=='number',
|
|
27165
|
+
contextMenu:(v)=>typeof v!=='boolean'&&typeof v!=='function',
|
|
27166
|
+
columnMenu:(v)=>typeof v!=='boolean'&&typeof v!=='function',
|
|
27167
|
+
fullWidth:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27168
|
+
highlightOnChange:(v)=>!isPlainObject(v)&&typeof v!=='boolean'&&typeof v!=='string',
|
|
27169
|
+
rowTemplate:(v)=>!isPlainObject(v)&&typeof v!=='string',
|
|
27170
|
+
cornerRadius:(v)=>typeof v!=='boolean'&&typeof v!=='number'&&typeof v!=='string',
|
|
27171
|
+
grandTotalRow:(v)=>v!=='bottom'&&typeof v!=='boolean',
|
|
27172
|
+
autoHeight:(v)=>v!=='visible'&&typeof v!=='boolean',
|
|
27173
|
+
gridLines:(v)=>!['both','horizontal','vertical','none','rows','columns'].includes(
|
|
27174
|
+
(v),
|
|
27175
|
+
)&&typeof v!=='boolean',
|
|
27176
|
+
selection:(v)=>!isPlainObject(v)
|
|
27177
|
+
&&v!=='single'&&v!=='multiple'&&v!=='none',
|
|
27178
|
+
density:(v)=>typeof v!=='number'
|
|
27179
|
+
&&!['compact','standard','comfortable','spacious'].includes((v)),
|
|
27180
|
+
theme:(v)=>typeof v!=='string',
|
|
27181
|
+
rowClass:(v)=>typeof v!=='string'&&typeof v!=='function'&&!Array.isArray(v),
|
|
27182
|
+
rowStyle:(v)=>!isPlainObject(v)&&typeof v!=='function',
|
|
27183
|
+
});
|
|
27184
|
+
const KNOWN_CONFIG_KEYS=new Set([
|
|
27185
|
+
'ai','alignedGrids','allowUnsafeTemplates','autoHeight','columnDefaults',
|
|
27186
|
+
'columnGroups','columnMenu','columnPresets','columnTagFilter',
|
|
27187
|
+
'columnVirtualisationAbove','columns','comments','components','context',
|
|
27188
|
+
'contextMenu','cornerRadius','dataTypes','density','detail','diff','edit',
|
|
27189
|
+
'environment','facets','formatting','formulaFunctions','fullWidth',
|
|
27190
|
+
'grandTotalRow','gridLines','groupFooter','headerHeight','highlightOnChange',
|
|
27191
|
+
'historyBar','hostFilter','licence','locale','maximise','overscan','pagination',
|
|
27192
|
+
'permissions','pinnedBottomRows','pinnedTopRows','pipes','pivot','presence',
|
|
27193
|
+
'quickFilterText','responsive','rowClass','rowForm','rowHeight','rowKey',
|
|
27194
|
+
'rowReorder','rowStyle','rowTemplate','rowTransfer','rows','sampleSize',
|
|
27195
|
+
'selection','sharedMemory','shortcuts','showColumnFunctions','showHeader',
|
|
27196
|
+
'showTotalInHeader','source','state','statusBar','stickyGroupHeaders',
|
|
27197
|
+
'targetSize','theme','timeZone','title','toolPanel','totalFilteredOnly',
|
|
27198
|
+
'totalFns','totalOnlyChangedColumns','tree','typeOptions','updates','useWorker',
|
|
27199
|
+
'variants','views','workerThreshold','workerUrl',
|
|
27200
|
+
]);
|
|
27084
27201
|
const CONFIG_DEFAULTS=Object.freeze({
|
|
27085
27202
|
locale:undefined,
|
|
27086
27203
|
messages:undefined,
|
|
@@ -27178,6 +27295,45 @@ pageSize:0,
|
|
|
27178
27295
|
#ready=false;
|
|
27179
27296
|
#teardown=new Set();
|
|
27180
27297
|
constructor(config={}){
|
|
27298
|
+
for(const key of Object.keys(config)){
|
|
27299
|
+
if(!KNOWN_CONFIG_KEYS.has(key)){
|
|
27300
|
+
warnOnce(
|
|
27301
|
+
`config.unknown:${key}`,
|
|
27302
|
+
`'${key}' is not a configuration key this grid recognises, so it had no `
|
|
27303
|
+
+'effect. Check the spelling against the reference.',
|
|
27304
|
+
);
|
|
27305
|
+
continue;
|
|
27306
|
+
}
|
|
27307
|
+
const shape=CONFIG_SHAPES[key];
|
|
27308
|
+
const value=config[key];
|
|
27309
|
+
if(value===undefined)continue;
|
|
27310
|
+
if(shape===undefined){
|
|
27311
|
+
const unusable=CONFIG_WIDE_CHECKS[key];
|
|
27312
|
+
if(unusable&&unusable(value)){
|
|
27313
|
+
warnOnce(
|
|
27314
|
+
`config.value:${key}`,
|
|
27315
|
+
`'${key}' was given ${describeValue(value)}, which is not one of the `
|
|
27316
|
+
+'shapes it accepts. Check the type against the reference.',
|
|
27317
|
+
);
|
|
27318
|
+
}
|
|
27319
|
+
continue;
|
|
27320
|
+
}
|
|
27321
|
+
if(Array.isArray(shape)){
|
|
27322
|
+
if(!shape.includes(value)){
|
|
27323
|
+
warnOnce(
|
|
27324
|
+
`config.value:${key}`,
|
|
27325
|
+
`'${key}' was given ${describeValue(value)}, which is not one of `
|
|
27326
|
+
+`${shape.map((v)=>`'${v}'`).join(', ')}. It was ignored.`,
|
|
27327
|
+
);
|
|
27328
|
+
}
|
|
27329
|
+
}else if(typeof value!==shape){
|
|
27330
|
+
warnOnce(
|
|
27331
|
+
`config.value:${key}`,
|
|
27332
|
+
`'${key}' expects a ${shape} and was given ${describeValue(value)}. `
|
|
27333
|
+
+'It was ignored.',
|
|
27334
|
+
);
|
|
27335
|
+
}
|
|
27336
|
+
}
|
|
27181
27337
|
this.#config={...CONFIG_DEFAULTS,...config};
|
|
27182
27338
|
this.#suppliedConfig={...config};
|
|
27183
27339
|
this.#bus=new EventBus();
|
|
@@ -65360,10 +65516,60 @@ createLocalViewStorage,
|
|
|
65360
65516
|
};
|
|
65361
65517
|
const __default=LatticeGrid;
|
|
65362
65518
|
});
|
|
65519
|
+
__def("packages/modules/dhtmlx-compat/util.js",function(__exports,__req){
|
|
65520
|
+
'use strict';
|
|
65521
|
+
Object.defineProperty(__exports,"reportUntranslated",{enumerable:true,get:function(){return reportUntranslated;}});
|
|
65522
|
+
Object.defineProperty(__exports,"indexOfKey",{enumerable:true,get:function(){return indexOfKey;}});
|
|
65523
|
+
Object.defineProperty(__exports,"rowsFrom",{enumerable:true,get:function(){return rowsFrom;}});
|
|
65524
|
+
Object.defineProperty(__exports,"rowShape",{enumerable:true,get:function(){return rowShape;}});
|
|
65525
|
+
Object.defineProperty(__exports,"columnShape",{enumerable:true,get:function(){return columnShape;}});
|
|
65526
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
65527
|
+
const warnOnce=__m0["warnOnce"];
|
|
65528
|
+
function reportUntranslated(source,translated,kind){
|
|
65529
|
+
if(!source||typeof source!=='object')return;
|
|
65530
|
+
for(const key of Object.keys(source)){
|
|
65531
|
+
if(translated.has(key))continue;
|
|
65532
|
+
warnOnce(
|
|
65533
|
+
`dhtmlx.${kind}.dropped:${key}`,
|
|
65534
|
+
`dhtmlx-compat does not translate the ${kind} key '${key}', so it has no effect. `
|
|
65535
|
+
+'Nothing was applied for it.',
|
|
65536
|
+
);
|
|
65537
|
+
}
|
|
65538
|
+
}
|
|
65539
|
+
function indexOfKey(grid,key){
|
|
65540
|
+
const count=grid.rows.count();
|
|
65541
|
+
for(let i=0;i<count;i++){
|
|
65542
|
+
const row=grid.rows.get(i);
|
|
65543
|
+
if(row&&row.key===key)return i;
|
|
65544
|
+
}
|
|
65545
|
+
return-1;
|
|
65546
|
+
}
|
|
65547
|
+
function rowsFrom(data){
|
|
65548
|
+
if(Array.isArray(data))return data;
|
|
65549
|
+
if(data&&typeof data==='object'&&Array.isArray(data.data))return data.data;
|
|
65550
|
+
return[];
|
|
65551
|
+
}
|
|
65552
|
+
function rowShape(grid,key){
|
|
65553
|
+
const row=grid.rows.byKey(key);
|
|
65554
|
+
return{...(row?row.data:undefined),id:key};
|
|
65555
|
+
}
|
|
65556
|
+
function columnShape(grid,colId){
|
|
65557
|
+
return{id:colId};
|
|
65558
|
+
}
|
|
65559
|
+
});
|
|
65363
65560
|
__def("packages/modules/dhtmlx-compat/columns.js",function(__exports,__req){
|
|
65364
65561
|
'use strict';
|
|
65365
65562
|
Object.defineProperty(__exports,"translateColumn",{enumerable:true,get:function(){return translateColumn;}});
|
|
65366
65563
|
Object.defineProperty(__exports,"translateColumns",{enumerable:true,get:function(){return translateColumns;}});
|
|
65564
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
65565
|
+
const warnOnce=__m0["warnOnce"];
|
|
65566
|
+
const __m1=__req("packages/modules/dhtmlx-compat/util.js");
|
|
65567
|
+
const reportUntranslated=__m1["reportUntranslated"];
|
|
65568
|
+
const TRANSLATED_COLUMN=new Set([
|
|
65569
|
+
'id','header','type','width','minWidth','maxWidth','resizable','hidden',
|
|
65570
|
+
'draggable','align','tooltip','tooltipTemplate','template','htmlEnable',
|
|
65571
|
+
'sortable','editable','editorType','editorConfig','options','summary',
|
|
65572
|
+
]);
|
|
65367
65573
|
const EDITOR_NAMES=Object.freeze({
|
|
65368
65574
|
input:'text',
|
|
65369
65575
|
select:'select',
|
|
@@ -65380,6 +65586,13 @@ date:'date',
|
|
|
65380
65586
|
function headerText(header){
|
|
65381
65587
|
if(typeof header==='string')return header;
|
|
65382
65588
|
if(Array.isArray(header)&&header.length>0){
|
|
65589
|
+
if(header.length>1){
|
|
65590
|
+
warnOnce(
|
|
65591
|
+
'dhtmlx.header.multirow',
|
|
65592
|
+
`dhtmlx-compat collapsed a ${header.length}-row header to its first row. `
|
|
65593
|
+
+'Lattice titles are a single string; the remaining rows were not applied.',
|
|
65594
|
+
);
|
|
65595
|
+
}
|
|
65383
65596
|
const first=header[0];
|
|
65384
65597
|
if(typeof first==='string')return first;
|
|
65385
65598
|
if(first&&typeof first==='object'&&typeof first.text==='string')return first.text;
|
|
@@ -65398,6 +65611,7 @@ function translateColumn(col){
|
|
|
65398
65611
|
if(!col||typeof col!=='object'||!col.id){
|
|
65399
65612
|
throw new TypeError('dhtmlx-compat: every column needs an id.');
|
|
65400
65613
|
}
|
|
65614
|
+
reportUntranslated(col,TRANSLATED_COLUMN,'column');
|
|
65401
65615
|
const out={id:col.id,field:col.id};
|
|
65402
65616
|
const title=headerText(col.header);
|
|
65403
65617
|
if(title!==undefined)out.title=title;
|
|
@@ -65432,8 +65646,11 @@ out.edit={enabled:col.editable!==false};
|
|
|
65432
65646
|
if(col.editorType!==undefined){
|
|
65433
65647
|
const name=EDITOR_NAMES[col.editorType];
|
|
65434
65648
|
if(!name){
|
|
65435
|
-
|
|
65436
|
-
|
|
65649
|
+
warnOnce(
|
|
65650
|
+
`dhtmlx.editorType.unknown:${String(col.editorType)}`,
|
|
65651
|
+
`dhtmlx-compat does not recognise editorType '${String(col.editorType)}'; `
|
|
65652
|
+
+'the default text editor was used instead.',
|
|
65653
|
+
);
|
|
65437
65654
|
}
|
|
65438
65655
|
out.edit.editor=name||'text';
|
|
65439
65656
|
}
|
|
@@ -65450,33 +65667,6 @@ if(!Array.isArray(columns))return[];
|
|
|
65450
65667
|
return columns.map(translateColumn);
|
|
65451
65668
|
}
|
|
65452
65669
|
});
|
|
65453
|
-
__def("packages/modules/dhtmlx-compat/util.js",function(__exports,__req){
|
|
65454
|
-
'use strict';
|
|
65455
|
-
Object.defineProperty(__exports,"indexOfKey",{enumerable:true,get:function(){return indexOfKey;}});
|
|
65456
|
-
Object.defineProperty(__exports,"rowsFrom",{enumerable:true,get:function(){return rowsFrom;}});
|
|
65457
|
-
Object.defineProperty(__exports,"rowShape",{enumerable:true,get:function(){return rowShape;}});
|
|
65458
|
-
Object.defineProperty(__exports,"columnShape",{enumerable:true,get:function(){return columnShape;}});
|
|
65459
|
-
function indexOfKey(grid,key){
|
|
65460
|
-
const count=grid.rows.count();
|
|
65461
|
-
for(let i=0;i<count;i++){
|
|
65462
|
-
const row=grid.rows.get(i);
|
|
65463
|
-
if(row&&row.key===key)return i;
|
|
65464
|
-
}
|
|
65465
|
-
return-1;
|
|
65466
|
-
}
|
|
65467
|
-
function rowsFrom(data){
|
|
65468
|
-
if(Array.isArray(data))return data;
|
|
65469
|
-
if(data&&typeof data==='object'&&Array.isArray(data.data))return data.data;
|
|
65470
|
-
return[];
|
|
65471
|
-
}
|
|
65472
|
-
function rowShape(grid,key){
|
|
65473
|
-
const row=grid.rows.byKey(key);
|
|
65474
|
-
return{...(row?row.data:undefined),id:key};
|
|
65475
|
-
}
|
|
65476
|
-
function columnShape(grid,colId){
|
|
65477
|
-
return{id:colId};
|
|
65478
|
-
}
|
|
65479
|
-
});
|
|
65480
65670
|
__def("packages/modules/dhtmlx-compat/data.js",function(__exports,__req){
|
|
65481
65671
|
'use strict';
|
|
65482
65672
|
Object.defineProperty(__exports,"createData",{enumerable:true,get:function(){return createData;}});
|
|
@@ -65790,7 +65980,13 @@ const __m5=__req("packages/modules/dhtmlx-compat/events.js");
|
|
|
65790
65980
|
const createEvents=__m5["createEvents"];
|
|
65791
65981
|
const __m6=__req("packages/modules/dhtmlx-compat/util.js");
|
|
65792
65982
|
const rowsFrom=__m6["rowsFrom"];
|
|
65983
|
+
const reportUntranslated=__m6["reportUntranslated"];
|
|
65984
|
+
const TRANSLATED_CONFIG=new Set([
|
|
65985
|
+
'rowKey','columns','data','autoHeight','rowHeight','headerRowHeight',
|
|
65986
|
+
'multiselection','dragItem','rowTransfer',
|
|
65987
|
+
]);
|
|
65793
65988
|
function translateConfig(config){
|
|
65989
|
+
reportUntranslated(config,TRANSLATED_CONFIG,'config');
|
|
65794
65990
|
const out={rowKey:config.rowKey||'id'};
|
|
65795
65991
|
if(config.columns!==undefined)out.columns=translateColumns(config.columns);
|
|
65796
65992
|
if(config.data!==undefined)out.rows=rowsFrom(config.data);
|
package/modules/htmx.esm.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.14.0, htmx module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -1428,7 +1428,7 @@ return{valid:false,...info,reason:'product'};
|
|
|
1428
1428
|
}
|
|
1429
1429
|
if(isExpired(parsed.expires,at)){
|
|
1430
1430
|
if(warn){
|
|
1431
|
-
warnOnce('licence.expired',`licence expired on ${parsed.expires}. The grid will render with a watermark. Renew at
|
|
1431
|
+
warnOnce('licence.expired',`licence expired on ${parsed.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`);
|
|
1432
1432
|
}
|
|
1433
1433
|
return{valid:false,...info,reason:'expired'};
|
|
1434
1434
|
}
|
|
@@ -27081,6 +27081,123 @@ return out;
|
|
|
27081
27081
|
}
|
|
27082
27082
|
return value;
|
|
27083
27083
|
}
|
|
27084
|
+
function describeValue(value){
|
|
27085
|
+
if(value===null)return'null';
|
|
27086
|
+
if(Array.isArray(value))return`an array of ${value.length}`;
|
|
27087
|
+
const kind=typeof value;
|
|
27088
|
+
if(kind==='string')return`the string '${value.length>24?`${value.slice(0,24)}…`:value}'`;
|
|
27089
|
+
if(kind==='number'||kind==='boolean')return`the ${kind} ${String(value)}`;
|
|
27090
|
+
return`a ${kind}`;
|
|
27091
|
+
}
|
|
27092
|
+
const CONFIG_SHAPES=Object.freeze({
|
|
27093
|
+
allowUnsafeTemplates:'boolean',
|
|
27094
|
+
columnVirtualisationAbove:'number',
|
|
27095
|
+
groupFooter:'boolean',
|
|
27096
|
+
headerHeight:'number',
|
|
27097
|
+
licence:'string',
|
|
27098
|
+
locale:'string',
|
|
27099
|
+
maximise:'boolean',
|
|
27100
|
+
overscan:'number',
|
|
27101
|
+
quickFilterText:'string',
|
|
27102
|
+
sampleSize:'number',
|
|
27103
|
+
sharedMemory:'boolean',
|
|
27104
|
+
shortcuts:'boolean',
|
|
27105
|
+
showColumnFunctions:'boolean',
|
|
27106
|
+
showHeader:'boolean',
|
|
27107
|
+
showTotalInHeader:'boolean',
|
|
27108
|
+
targetSize:['default','large'],
|
|
27109
|
+
timeZone:'string',
|
|
27110
|
+
title:'string',
|
|
27111
|
+
totalFilteredOnly:'boolean',
|
|
27112
|
+
totalOnlyChangedColumns:'boolean',
|
|
27113
|
+
useWorker:'boolean',
|
|
27114
|
+
workerThreshold:'number',
|
|
27115
|
+
workerUrl:'string',
|
|
27116
|
+
});
|
|
27117
|
+
function isPlainObject(v){
|
|
27118
|
+
return v!==null&&typeof v==='object'&&!Array.isArray(v);
|
|
27119
|
+
}
|
|
27120
|
+
const CONFIG_WIDE_CHECKS=Object.freeze({
|
|
27121
|
+
columns:(v)=>!Array.isArray(v),
|
|
27122
|
+
columnGroups:(v)=>!Array.isArray(v),
|
|
27123
|
+
rows:(v)=>!Array.isArray(v),
|
|
27124
|
+
pinnedTopRows:(v)=>!Array.isArray(v),
|
|
27125
|
+
pinnedBottomRows:(v)=>!Array.isArray(v),
|
|
27126
|
+
alignedGrids:(v)=>!Array.isArray(v),
|
|
27127
|
+
rowKey:(v)=>typeof v!=='string'&&typeof v!=='function',
|
|
27128
|
+
rowHeight:(v)=>typeof v!=='number'&&typeof v!=='function',
|
|
27129
|
+
source:(v)=>!isPlainObject(v),
|
|
27130
|
+
columnDefaults:(v)=>!isPlainObject(v),
|
|
27131
|
+
columnPresets:(v)=>!isPlainObject(v),
|
|
27132
|
+
dataTypes:(v)=>!isPlainObject(v),
|
|
27133
|
+
components:(v)=>!isPlainObject(v),
|
|
27134
|
+
pipes:(v)=>!isPlainObject(v),
|
|
27135
|
+
totalFns:(v)=>!isPlainObject(v),
|
|
27136
|
+
variants:(v)=>!isPlainObject(v),
|
|
27137
|
+
formulaFunctions:(v)=>!isPlainObject(v),
|
|
27138
|
+
typeOptions:(v)=>!isPlainObject(v),
|
|
27139
|
+
formatting:(v)=>!isPlainObject(v),
|
|
27140
|
+
tree:(v)=>!isPlainObject(v),
|
|
27141
|
+
detail:(v)=>!isPlainObject(v),
|
|
27142
|
+
comments:(v)=>!isPlainObject(v),
|
|
27143
|
+
presence:(v)=>!isPlainObject(v),
|
|
27144
|
+
permissions:(v)=>!isPlainObject(v),
|
|
27145
|
+
state:(v)=>!isPlainObject(v),
|
|
27146
|
+
updates:(v)=>!isPlainObject(v),
|
|
27147
|
+
diff:(v)=>!isPlainObject(v),
|
|
27148
|
+
views:(v)=>!isPlainObject(v),
|
|
27149
|
+
responsive:(v)=>!isPlainObject(v),
|
|
27150
|
+
hostFilter:(v)=>!isPlainObject(v),
|
|
27151
|
+
pivot:(v)=>!isPlainObject(v),
|
|
27152
|
+
ai:(v)=>!isPlainObject(v),
|
|
27153
|
+
environment:(v)=>typeof v!=='function',
|
|
27154
|
+
edit:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27155
|
+
pagination:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27156
|
+
facets:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27157
|
+
rowForm:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27158
|
+
rowReorder:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27159
|
+
columnTagFilter:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27160
|
+
historyBar:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27161
|
+
rowTransfer:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27162
|
+
statusBar:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27163
|
+
toolPanel:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27164
|
+
stickyGroupHeaders:(v)=>!isPlainObject(v)&&typeof v!=='boolean'&&typeof v!=='number',
|
|
27165
|
+
contextMenu:(v)=>typeof v!=='boolean'&&typeof v!=='function',
|
|
27166
|
+
columnMenu:(v)=>typeof v!=='boolean'&&typeof v!=='function',
|
|
27167
|
+
fullWidth:(v)=>!isPlainObject(v)&&typeof v!=='boolean',
|
|
27168
|
+
highlightOnChange:(v)=>!isPlainObject(v)&&typeof v!=='boolean'&&typeof v!=='string',
|
|
27169
|
+
rowTemplate:(v)=>!isPlainObject(v)&&typeof v!=='string',
|
|
27170
|
+
cornerRadius:(v)=>typeof v!=='boolean'&&typeof v!=='number'&&typeof v!=='string',
|
|
27171
|
+
grandTotalRow:(v)=>v!=='bottom'&&typeof v!=='boolean',
|
|
27172
|
+
autoHeight:(v)=>v!=='visible'&&typeof v!=='boolean',
|
|
27173
|
+
gridLines:(v)=>!['both','horizontal','vertical','none','rows','columns'].includes(
|
|
27174
|
+
(v),
|
|
27175
|
+
)&&typeof v!=='boolean',
|
|
27176
|
+
selection:(v)=>!isPlainObject(v)
|
|
27177
|
+
&&v!=='single'&&v!=='multiple'&&v!=='none',
|
|
27178
|
+
density:(v)=>typeof v!=='number'
|
|
27179
|
+
&&!['compact','standard','comfortable','spacious'].includes((v)),
|
|
27180
|
+
theme:(v)=>typeof v!=='string',
|
|
27181
|
+
rowClass:(v)=>typeof v!=='string'&&typeof v!=='function'&&!Array.isArray(v),
|
|
27182
|
+
rowStyle:(v)=>!isPlainObject(v)&&typeof v!=='function',
|
|
27183
|
+
});
|
|
27184
|
+
const KNOWN_CONFIG_KEYS=new Set([
|
|
27185
|
+
'ai','alignedGrids','allowUnsafeTemplates','autoHeight','columnDefaults',
|
|
27186
|
+
'columnGroups','columnMenu','columnPresets','columnTagFilter',
|
|
27187
|
+
'columnVirtualisationAbove','columns','comments','components','context',
|
|
27188
|
+
'contextMenu','cornerRadius','dataTypes','density','detail','diff','edit',
|
|
27189
|
+
'environment','facets','formatting','formulaFunctions','fullWidth',
|
|
27190
|
+
'grandTotalRow','gridLines','groupFooter','headerHeight','highlightOnChange',
|
|
27191
|
+
'historyBar','hostFilter','licence','locale','maximise','overscan','pagination',
|
|
27192
|
+
'permissions','pinnedBottomRows','pinnedTopRows','pipes','pivot','presence',
|
|
27193
|
+
'quickFilterText','responsive','rowClass','rowForm','rowHeight','rowKey',
|
|
27194
|
+
'rowReorder','rowStyle','rowTemplate','rowTransfer','rows','sampleSize',
|
|
27195
|
+
'selection','sharedMemory','shortcuts','showColumnFunctions','showHeader',
|
|
27196
|
+
'showTotalInHeader','source','state','statusBar','stickyGroupHeaders',
|
|
27197
|
+
'targetSize','theme','timeZone','title','toolPanel','totalFilteredOnly',
|
|
27198
|
+
'totalFns','totalOnlyChangedColumns','tree','typeOptions','updates','useWorker',
|
|
27199
|
+
'variants','views','workerThreshold','workerUrl',
|
|
27200
|
+
]);
|
|
27084
27201
|
const CONFIG_DEFAULTS=Object.freeze({
|
|
27085
27202
|
locale:undefined,
|
|
27086
27203
|
messages:undefined,
|
|
@@ -27178,6 +27295,45 @@ pageSize:0,
|
|
|
27178
27295
|
#ready=false;
|
|
27179
27296
|
#teardown=new Set();
|
|
27180
27297
|
constructor(config={}){
|
|
27298
|
+
for(const key of Object.keys(config)){
|
|
27299
|
+
if(!KNOWN_CONFIG_KEYS.has(key)){
|
|
27300
|
+
warnOnce(
|
|
27301
|
+
`config.unknown:${key}`,
|
|
27302
|
+
`'${key}' is not a configuration key this grid recognises, so it had no `
|
|
27303
|
+
+'effect. Check the spelling against the reference.',
|
|
27304
|
+
);
|
|
27305
|
+
continue;
|
|
27306
|
+
}
|
|
27307
|
+
const shape=CONFIG_SHAPES[key];
|
|
27308
|
+
const value=config[key];
|
|
27309
|
+
if(value===undefined)continue;
|
|
27310
|
+
if(shape===undefined){
|
|
27311
|
+
const unusable=CONFIG_WIDE_CHECKS[key];
|
|
27312
|
+
if(unusable&&unusable(value)){
|
|
27313
|
+
warnOnce(
|
|
27314
|
+
`config.value:${key}`,
|
|
27315
|
+
`'${key}' was given ${describeValue(value)}, which is not one of the `
|
|
27316
|
+
+'shapes it accepts. Check the type against the reference.',
|
|
27317
|
+
);
|
|
27318
|
+
}
|
|
27319
|
+
continue;
|
|
27320
|
+
}
|
|
27321
|
+
if(Array.isArray(shape)){
|
|
27322
|
+
if(!shape.includes(value)){
|
|
27323
|
+
warnOnce(
|
|
27324
|
+
`config.value:${key}`,
|
|
27325
|
+
`'${key}' was given ${describeValue(value)}, which is not one of `
|
|
27326
|
+
+`${shape.map((v)=>`'${v}'`).join(', ')}. It was ignored.`,
|
|
27327
|
+
);
|
|
27328
|
+
}
|
|
27329
|
+
}else if(typeof value!==shape){
|
|
27330
|
+
warnOnce(
|
|
27331
|
+
`config.value:${key}`,
|
|
27332
|
+
`'${key}' expects a ${shape} and was given ${describeValue(value)}. `
|
|
27333
|
+
+'It was ignored.',
|
|
27334
|
+
);
|
|
27335
|
+
}
|
|
27336
|
+
}
|
|
27181
27337
|
this.#config={...CONFIG_DEFAULTS,...config};
|
|
27182
27338
|
this.#suppliedConfig={...config};
|
|
27183
27339
|
this.#bus=new EventBus();
|