@toclocoinc/lattice-grid 1.65.0 → 1.67.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 -4
- package/angular/LICENSE +111 -0
- package/angular/README.md +78 -0
- package/angular/fesm2022/toclocoinc-lattice-grid-angular.mjs +2843 -0
- package/angular/package.json +16 -0
- package/angular/types/toclocoinc-lattice-grid-angular.d.ts +1366 -0
- package/docs/API.html +741 -27
- package/docs/api-detail.html +137 -4
- package/lattice-grid.d.ts +9 -6
- package/lattice-grid.esm.min.js +26 -10
- package/lattice-grid.min.cjs +26 -10
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +26 -10
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +3 -3
- package/modules/ai.min.cjs +3 -3
- package/modules/ai.min.js +3 -3
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +7 -7
- package/modules/angular.min.cjs +7 -7
- package/modules/angular.min.js +7 -7
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +261 -48
- package/modules/charts.min.cjs +261 -48
- package/modules/charts.min.js +261 -48
- package/modules/data-router.d.ts +8 -3
- package/modules/data-router.esm.min.js +28 -6
- package/modules/data-router.min.cjs +28 -6
- package/modules/data-router.min.js +28 -6
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/devtools.min.cjs +1 -1
- package/modules/devtools.min.js +1 -1
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +3 -3
- package/modules/dhtmlx-compat.min.cjs +3 -3
- package/modules/dhtmlx-compat.min.js +3 -3
- package/modules/gantt.d.ts +8 -3
- package/modules/gantt.esm.min.js +27 -4
- package/modules/gantt.min.cjs +27 -4
- package/modules/gantt.min.js +27 -4
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +26 -10
- package/modules/htmx.min.cjs +26 -10
- package/modules/htmx.min.js +26 -10
- package/modules/kanban.d.ts +10 -3
- package/modules/kanban.esm.min.js +24 -4
- package/modules/kanban.min.cjs +24 -4
- package/modules/kanban.min.js +24 -4
- package/modules/kpi.d.ts +10 -3
- package/modules/kpi.esm.min.js +27 -4
- package/modules/kpi.min.cjs +27 -4
- package/modules/kpi.min.js +27 -4
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +3 -3
- package/modules/layout.min.cjs +3 -3
- package/modules/layout.min.js +3 -3
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +3 -3
- package/modules/react.min.cjs +3 -3
- package/modules/react.min.js +3 -3
- package/modules/svelte.d.ts +251 -2
- package/modules/svelte.esm.min.js +960 -6
- package/modules/svelte.min.cjs +942 -5
- package/modules/svelte.min.js +942 -5
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +3 -3
- package/modules/tabs.min.cjs +3 -3
- package/modules/tabs.min.js +3 -3
- package/modules/vue.d.ts +398 -9
- package/modules/vue.esm.min.js +1163 -31
- package/modules/vue.min.cjs +1147 -30
- package/modules/vue.min.js +1147 -30
- package/modules/webcomponent.d.ts +233 -1
- package/modules/webcomponent.esm.min.js +1274 -41
- package/modules/webcomponent.min.cjs +1256 -41
- package/modules/webcomponent.min.js +1256 -41
- package/package.json +27 -2
- package/svelte/Chart.svelte +34 -0
- package/svelte/Gantt.svelte +34 -0
- package/svelte/Grid.svelte +30 -0
- package/svelte/GridProvider.svelte +13 -0
- package/svelte/KPI.svelte +34 -0
- package/svelte/Kanban.svelte +34 -0
- package/svelte/Layout.svelte +34 -0
- package/svelte/Router.svelte +16 -0
- package/svelte/Tabs.svelte +53 -0
package/modules/vue.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.67.0, vue module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -18,6 +18,403 @@ if(!fn)throw new Error('[lattice] missing module: '+id);
|
|
|
18
18
|
fn(exports,__req);
|
|
19
19
|
return exports;
|
|
20
20
|
}
|
|
21
|
+
__def("packages/core/src/internal/util.js",function(__exports,__req){
|
|
22
|
+
'use strict';
|
|
23
|
+
Object.defineProperty(__exports,"VERSION",{enumerable:true,get:function(){return VERSION;}});
|
|
24
|
+
Object.defineProperty(__exports,"reportedWarnings",{enumerable:true,get:function(){return reportedWarnings;}});
|
|
25
|
+
Object.defineProperty(__exports,"warnOnce",{enumerable:true,get:function(){return warnOnce;}});
|
|
26
|
+
Object.defineProperty(__exports,"infoOnce",{enumerable:true,get:function(){return infoOnce;}});
|
|
27
|
+
Object.defineProperty(__exports,"resetWarnings",{enumerable:true,get:function(){return resetWarnings;}});
|
|
28
|
+
Object.defineProperty(__exports,"fail",{enumerable:true,get:function(){return fail;}});
|
|
29
|
+
Object.defineProperty(__exports,"invariant",{enumerable:true,get:function(){return invariant;}});
|
|
30
|
+
Object.defineProperty(__exports,"DEV",{enumerable:true,get:function(){return DEV;}});
|
|
31
|
+
Object.defineProperty(__exports,"isObject",{enumerable:true,get:function(){return isObject;}});
|
|
32
|
+
Object.defineProperty(__exports,"isFunction",{enumerable:true,get:function(){return isFunction;}});
|
|
33
|
+
Object.defineProperty(__exports,"isNil",{enumerable:true,get:function(){return isNil;}});
|
|
34
|
+
Object.defineProperty(__exports,"isBlank",{enumerable:true,get:function(){return isBlank;}});
|
|
35
|
+
Object.defineProperty(__exports,"isCtor",{enumerable:true,get:function(){return isCtor;}});
|
|
36
|
+
Object.defineProperty(__exports,"pathGetter",{enumerable:true,get:function(){return pathGetter;}});
|
|
37
|
+
Object.defineProperty(__exports,"pathSetter",{enumerable:true,get:function(){return pathSetter;}});
|
|
38
|
+
Object.defineProperty(__exports,"getPath",{enumerable:true,get:function(){return getPath;}});
|
|
39
|
+
Object.defineProperty(__exports,"setPath",{enumerable:true,get:function(){return setPath;}});
|
|
40
|
+
Object.defineProperty(__exports,"humanise",{enumerable:true,get:function(){return humanise;}});
|
|
41
|
+
Object.defineProperty(__exports,"escapeHtml",{enumerable:true,get:function(){return escapeHtml;}});
|
|
42
|
+
Object.defineProperty(__exports,"titleCase",{enumerable:true,get:function(){return titleCase;}});
|
|
43
|
+
Object.defineProperty(__exports,"expand",{enumerable:true,get:function(){return expand;}});
|
|
44
|
+
Object.defineProperty(__exports,"toArray",{enumerable:true,get:function(){return toArray;}});
|
|
45
|
+
Object.defineProperty(__exports,"merge",{enumerable:true,get:function(){return merge;}});
|
|
46
|
+
Object.defineProperty(__exports,"mergeRow",{enumerable:true,get:function(){return mergeRow;}});
|
|
47
|
+
Object.defineProperty(__exports,"Lru",{enumerable:true,get:function(){return Lru;}});
|
|
48
|
+
Object.defineProperty(__exports,"collator",{enumerable:true,get:function(){return collator;}});
|
|
49
|
+
Object.defineProperty(__exports,"defaultCompare",{enumerable:true,get:function(){return defaultCompare;}});
|
|
50
|
+
Object.defineProperty(__exports,"now",{enumerable:true,get:function(){return now;}});
|
|
51
|
+
Object.defineProperty(__exports,"nextFrame",{enumerable:true,get:function(){return nextFrame;}});
|
|
52
|
+
Object.defineProperty(__exports,"cancelFrame",{enumerable:true,get:function(){return cancelFrame;}});
|
|
53
|
+
Object.defineProperty(__exports,"frameBatched",{enumerable:true,get:function(){return frameBatched;}});
|
|
54
|
+
Object.defineProperty(__exports,"settleDebounce",{enumerable:true,get:function(){return settleDebounce;}});
|
|
55
|
+
Object.defineProperty(__exports,"whenIdle",{enumerable:true,get:function(){return whenIdle;}});
|
|
56
|
+
Object.defineProperty(__exports,"uid",{enumerable:true,get:function(){return uid;}});
|
|
57
|
+
const STAMPED_VERSION="1.67.0";
|
|
58
|
+
async function resolveVersion(){
|
|
59
|
+
if(STAMPED_VERSION!=='0.0.0-source')return STAMPED_VERSION;
|
|
60
|
+
return STAMPED_VERSION;
|
|
61
|
+
}
|
|
62
|
+
const VERSION="1.67.0";
|
|
63
|
+
const warned=new Set();
|
|
64
|
+
const WARNED_LIMIT=2000;
|
|
65
|
+
function rememberWarned(key){
|
|
66
|
+
warned.add(key);
|
|
67
|
+
if(warned.size>WARNED_LIMIT){
|
|
68
|
+
const oldest=warned.values().next().value;
|
|
69
|
+
if(oldest!==undefined)warned.delete(oldest);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const reported=[];
|
|
73
|
+
const REPORT_LIMIT=500;
|
|
74
|
+
function record(key,level,message){
|
|
75
|
+
reported.push({
|
|
76
|
+
key,
|
|
77
|
+
level,
|
|
78
|
+
message:message.map((m)=>(typeof m==='string'?m:safeString(m))).join(' '),
|
|
79
|
+
at:Date.now(),
|
|
80
|
+
});
|
|
81
|
+
if(reported.length>REPORT_LIMIT)reported.shift();
|
|
82
|
+
}
|
|
83
|
+
function safeString(value){
|
|
84
|
+
if(value instanceof Error)return value.message;
|
|
85
|
+
try{return JSON.stringify(value);}catch{return String(value);}
|
|
86
|
+
}
|
|
87
|
+
function reportedWarnings(){return reported.map((r)=>({...r}));}
|
|
88
|
+
function warnOnce(key,...message){
|
|
89
|
+
if(warned.has(key))return;
|
|
90
|
+
rememberWarned(key);
|
|
91
|
+
record(key,'warn',message);
|
|
92
|
+
console.warn('[lattice]',...message);
|
|
93
|
+
}
|
|
94
|
+
function infoOnce(key,...message){
|
|
95
|
+
if(warned.has(key))return;
|
|
96
|
+
rememberWarned(key);
|
|
97
|
+
record(key,'info',message);
|
|
98
|
+
console.info('[lattice]',...message);
|
|
99
|
+
}
|
|
100
|
+
function resetWarnings(){
|
|
101
|
+
warned.clear();
|
|
102
|
+
reported.length=0;
|
|
103
|
+
}
|
|
104
|
+
function fail(message,extra){
|
|
105
|
+
const err=new Error(`[lattice] ${message}`);
|
|
106
|
+
if(extra!==undefined)err.cause=extra;
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
109
|
+
function invariant(condition,message){
|
|
110
|
+
if(!condition)fail(message);
|
|
111
|
+
}
|
|
112
|
+
const DEV=(()=>{
|
|
113
|
+
try{
|
|
114
|
+
return!(typeof process!=='undefined'&&process.env
|
|
115
|
+
&&process.env.NODE_ENV==='production');
|
|
116
|
+
}catch{
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
function isObject(v){
|
|
121
|
+
return v!==null&&typeof v==='object'&&!Array.isArray(v);
|
|
122
|
+
}
|
|
123
|
+
function isFunction(v){
|
|
124
|
+
return typeof v==='function';
|
|
125
|
+
}
|
|
126
|
+
function isNil(v){
|
|
127
|
+
return v===null||v===undefined;
|
|
128
|
+
}
|
|
129
|
+
function isBlank(v){
|
|
130
|
+
return v===null||v===undefined||v==='';
|
|
131
|
+
}
|
|
132
|
+
function isCtor(v){
|
|
133
|
+
if(typeof v!=='function')return false;
|
|
134
|
+
if(/^class[\s{]/.test(Function.prototype.toString.call(v)))return true;
|
|
135
|
+
return!!(v.prototype&&Object.getOwnPropertyNames(v.prototype).length>1);
|
|
136
|
+
}
|
|
137
|
+
const pathCache=new Map();
|
|
138
|
+
function pathGetter(path){
|
|
139
|
+
let fn=pathCache.get(path);
|
|
140
|
+
if(fn)return fn;
|
|
141
|
+
if(!path.includes('.')){
|
|
142
|
+
fn=(o)=>(o==null?undefined:o[path]);
|
|
143
|
+
}else{
|
|
144
|
+
const parts=path.split('.');
|
|
145
|
+
const n=parts.length;
|
|
146
|
+
fn=(o)=>{
|
|
147
|
+
let cur=o;
|
|
148
|
+
for(let i=0;i<n;i++){
|
|
149
|
+
if(cur==null)return undefined;
|
|
150
|
+
cur=cur[parts[i]];
|
|
151
|
+
}
|
|
152
|
+
return cur;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
pathCache.set(path,fn);
|
|
156
|
+
return fn;
|
|
157
|
+
}
|
|
158
|
+
const setterCache=new Map();
|
|
159
|
+
function pathSetter(path){
|
|
160
|
+
let fn=setterCache.get(path);
|
|
161
|
+
if(fn)return fn;
|
|
162
|
+
if(!path.includes('.')){
|
|
163
|
+
fn=(o,v)=>{if(o!=null)o[path]=v;};
|
|
164
|
+
}else{
|
|
165
|
+
const parts=path.split('.');
|
|
166
|
+
const last=parts.length-1;
|
|
167
|
+
fn=(o,v)=>{
|
|
168
|
+
let cur=o;
|
|
169
|
+
for(let i=0;i<last;i++){
|
|
170
|
+
if(cur==null)return;
|
|
171
|
+
const k=parts[i];
|
|
172
|
+
if(cur[k]==null)cur[k]={};
|
|
173
|
+
cur=cur[k];
|
|
174
|
+
}
|
|
175
|
+
if(cur!=null)cur[parts[last]]=v;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
setterCache.set(path,fn);
|
|
179
|
+
return fn;
|
|
180
|
+
}
|
|
181
|
+
function getPath(obj,path){
|
|
182
|
+
return pathGetter(path)(obj);
|
|
183
|
+
}
|
|
184
|
+
function setPath(obj,path,value){
|
|
185
|
+
pathSetter(path)(obj,value);
|
|
186
|
+
}
|
|
187
|
+
function humanise(field){
|
|
188
|
+
if(!field)return'';
|
|
189
|
+
const leaf=field.includes('.')?field.slice(field.lastIndexOf('.')+1):field;
|
|
190
|
+
return leaf
|
|
191
|
+
.replace(/[_-]+/g,' ')
|
|
192
|
+
.replace(/([a-z0-9])([A-Z])/g,'$1 $2')
|
|
193
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g,'$1 $2')
|
|
194
|
+
.replace(/\s+/g,' ')
|
|
195
|
+
.trim()
|
|
196
|
+
.replace(/^./,(c)=>c.toUpperCase());
|
|
197
|
+
}
|
|
198
|
+
const ESCAPES={'&':'&','<':'<','>':'>','"':'"',"'":'''};
|
|
199
|
+
function escapeHtml(s){
|
|
200
|
+
const str=s==null?'':String(s);
|
|
201
|
+
return/[&<>"']/.test(str)?str.replace(/[&<>"']/g,(c)=>ESCAPES[c]):str;
|
|
202
|
+
}
|
|
203
|
+
function titleCase(s){
|
|
204
|
+
return String(s).replace(/\w\S*/g,(t)=>t[0].toUpperCase()+t.slice(1).toLowerCase());
|
|
205
|
+
}
|
|
206
|
+
function expand(value,key,whenTrue){
|
|
207
|
+
if(value===undefined)return undefined;
|
|
208
|
+
if(value===true)return{enabled:true,...whenTrue};
|
|
209
|
+
if(value===false)return{enabled:false};
|
|
210
|
+
if(isObject(value))return value;
|
|
211
|
+
return{[key]:value,enabled:true};
|
|
212
|
+
}
|
|
213
|
+
function toArray(v){
|
|
214
|
+
if(v===undefined||v===null)return[];
|
|
215
|
+
return Array.isArray(v)?v:[v];
|
|
216
|
+
}
|
|
217
|
+
const MERGE_FORBIDDEN_KEYS=Object.freeze(new Set(['__proto__','constructor','prototype']));
|
|
218
|
+
function merge(a,b){
|
|
219
|
+
if(!isObject(a))return isObject(b)?{...b}:b;
|
|
220
|
+
if(!isObject(b))return b===undefined?a:b;
|
|
221
|
+
const out={...a};
|
|
222
|
+
for(const k of Object.keys(b)){
|
|
223
|
+
if(MERGE_FORBIDDEN_KEYS.has(k))continue;
|
|
224
|
+
const bv=b[k];
|
|
225
|
+
if(bv===undefined)continue;
|
|
226
|
+
out[k]=isObject(bv)&&isObject(out[k])?merge(out[k],bv):bv;
|
|
227
|
+
}
|
|
228
|
+
return out;
|
|
229
|
+
}
|
|
230
|
+
function mergeRow(previous,patch){
|
|
231
|
+
if(!isObject(previous)||!isObject(patch)||previous===patch)return patch;
|
|
232
|
+
const out=Object.create(Object.getPrototypeOf(previous));
|
|
233
|
+
Object.assign(out,previous,patch);
|
|
234
|
+
return out;
|
|
235
|
+
}
|
|
236
|
+
class Lru{
|
|
237
|
+
#max;
|
|
238
|
+
#map=new Map();
|
|
239
|
+
#onEvict;
|
|
240
|
+
constructor(max=256,onEvict=null){
|
|
241
|
+
this.#max=max;
|
|
242
|
+
this.#onEvict=onEvict;
|
|
243
|
+
}
|
|
244
|
+
get size(){
|
|
245
|
+
return this.#map.size;
|
|
246
|
+
}
|
|
247
|
+
get max(){
|
|
248
|
+
return this.#max;
|
|
249
|
+
}
|
|
250
|
+
set max(v){
|
|
251
|
+
this.#max=v;
|
|
252
|
+
this.#trim();
|
|
253
|
+
}
|
|
254
|
+
has(k){
|
|
255
|
+
return this.#map.has(k);
|
|
256
|
+
}
|
|
257
|
+
get(k){
|
|
258
|
+
const m=this.#map;
|
|
259
|
+
if(!m.has(k))return undefined;
|
|
260
|
+
const v=m.get(k);
|
|
261
|
+
m.delete(k);
|
|
262
|
+
m.set(k,v);
|
|
263
|
+
return v;
|
|
264
|
+
}
|
|
265
|
+
peek(k){
|
|
266
|
+
return this.#map.get(k);
|
|
267
|
+
}
|
|
268
|
+
set(k,v){
|
|
269
|
+
const m=this.#map;
|
|
270
|
+
if(m.has(k))m.delete(k);
|
|
271
|
+
m.set(k,v);
|
|
272
|
+
this.#trim();
|
|
273
|
+
return v;
|
|
274
|
+
}
|
|
275
|
+
delete(k){
|
|
276
|
+
const v=this.#map.get(k);
|
|
277
|
+
if(this.#map.delete(k)&&this.#onEvict)this.#onEvict(v,k);
|
|
278
|
+
return v;
|
|
279
|
+
}
|
|
280
|
+
clear(){
|
|
281
|
+
if(this.#onEvict)for(const[k,v]of this.#map)this.#onEvict(v,k);
|
|
282
|
+
this.#map.clear();
|
|
283
|
+
}
|
|
284
|
+
keys(){
|
|
285
|
+
return this.#map.keys();
|
|
286
|
+
}
|
|
287
|
+
values(){
|
|
288
|
+
return this.#map.values();
|
|
289
|
+
}
|
|
290
|
+
#trim(){
|
|
291
|
+
const m=this.#map;
|
|
292
|
+
while(m.size>this.#max){
|
|
293
|
+
const oldest=m.keys().next().value;
|
|
294
|
+
const v=m.get(oldest);
|
|
295
|
+
m.delete(oldest);
|
|
296
|
+
if(this.#onEvict)this.#onEvict(v,oldest);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const collators=new Map();
|
|
301
|
+
function collator(locale,opts){
|
|
302
|
+
const key=`${locale||''}|${opts?JSON.stringify(opts):''}`;
|
|
303
|
+
let c=collators.get(key);
|
|
304
|
+
if(!c){
|
|
305
|
+
c=new Intl.Collator(locale||undefined,{
|
|
306
|
+
numeric:true,sensitivity:'variant',...opts,
|
|
307
|
+
});
|
|
308
|
+
collators.set(key,c);
|
|
309
|
+
}
|
|
310
|
+
return c;
|
|
311
|
+
}
|
|
312
|
+
function defaultCompare(a,b){
|
|
313
|
+
if(a===b)return 0;
|
|
314
|
+
if(a===null||a===undefined)return 1;
|
|
315
|
+
if(b===null||b===undefined)return-1;
|
|
316
|
+
if(typeof a==='number'&&typeof b==='number'){
|
|
317
|
+
if(Number.isNaN(a))return Number.isNaN(b)?0:1;
|
|
318
|
+
if(Number.isNaN(b))return-1;
|
|
319
|
+
return a<b?-1:a>b?1:0;
|
|
320
|
+
}
|
|
321
|
+
const sa=String(a);
|
|
322
|
+
const sb=String(b);
|
|
323
|
+
return sa<sb?-1:sa>sb?1:0;
|
|
324
|
+
}
|
|
325
|
+
function now(){
|
|
326
|
+
return typeof performance!=='undefined'&&performance.now
|
|
327
|
+
?performance.now()
|
|
328
|
+
:Date.now();
|
|
329
|
+
}
|
|
330
|
+
const hasRaf=typeof requestAnimationFrame==='function';
|
|
331
|
+
function nextFrame(fn){
|
|
332
|
+
if(hasRaf)return requestAnimationFrame(fn);
|
|
333
|
+
return setTimeout(()=>fn(now()),16);
|
|
334
|
+
}
|
|
335
|
+
function cancelFrame(handle){
|
|
336
|
+
if(handle==null)return;
|
|
337
|
+
if(hasRaf)cancelAnimationFrame(handle);
|
|
338
|
+
else clearTimeout(handle);
|
|
339
|
+
}
|
|
340
|
+
function frameBatched(fn){
|
|
341
|
+
let handle=null;
|
|
342
|
+
let lastArgs=null;
|
|
343
|
+
const run=()=>{
|
|
344
|
+
handle=null;
|
|
345
|
+
const a=lastArgs;
|
|
346
|
+
lastArgs=null;
|
|
347
|
+
fn(...(a||[]));
|
|
348
|
+
};
|
|
349
|
+
const wrapped=(...args)=>{
|
|
350
|
+
lastArgs=args;
|
|
351
|
+
if(handle===null)handle=nextFrame(run);
|
|
352
|
+
};
|
|
353
|
+
wrapped.cancel=()=>{
|
|
354
|
+
cancelFrame(handle);
|
|
355
|
+
handle=null;
|
|
356
|
+
lastArgs=null;
|
|
357
|
+
};
|
|
358
|
+
wrapped.flush=()=>{
|
|
359
|
+
if(handle!==null){
|
|
360
|
+
cancelFrame(handle);
|
|
361
|
+
run();
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
return wrapped;
|
|
365
|
+
}
|
|
366
|
+
function settleDebounce(fn,waitMs){
|
|
367
|
+
let timer=null;
|
|
368
|
+
let held=null;
|
|
369
|
+
const trailing=()=>{
|
|
370
|
+
timer=null;
|
|
371
|
+
if(held===null)return;
|
|
372
|
+
const args=held;
|
|
373
|
+
held=null;
|
|
374
|
+
fn(...args);
|
|
375
|
+
arm();
|
|
376
|
+
};
|
|
377
|
+
const arm=()=>{
|
|
378
|
+
timer=setTimeout(trailing,waitMs);
|
|
379
|
+
if(typeof timer?.unref==='function')timer.unref();
|
|
380
|
+
};
|
|
381
|
+
const wrapped=(...args)=>{
|
|
382
|
+
if(timer===null){
|
|
383
|
+
fn(...args);
|
|
384
|
+
arm();
|
|
385
|
+
}else{
|
|
386
|
+
held=args;
|
|
387
|
+
clearTimeout(timer);
|
|
388
|
+
arm();
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
wrapped.flush=()=>{
|
|
392
|
+
if(timer!==null)clearTimeout(timer);
|
|
393
|
+
timer=null;
|
|
394
|
+
if(held===null)return;
|
|
395
|
+
const args=held;
|
|
396
|
+
held=null;
|
|
397
|
+
fn(...args);
|
|
398
|
+
};
|
|
399
|
+
wrapped.cancel=()=>{
|
|
400
|
+
if(timer!==null)clearTimeout(timer);
|
|
401
|
+
timer=null;
|
|
402
|
+
held=null;
|
|
403
|
+
};
|
|
404
|
+
wrapped.pending=()=>timer!==null||held!==null;
|
|
405
|
+
return wrapped;
|
|
406
|
+
}
|
|
407
|
+
function whenIdle(fn,timeout=50){
|
|
408
|
+
if(typeof requestIdleCallback==='function'){
|
|
409
|
+
return requestIdleCallback(fn,{timeout});
|
|
410
|
+
}
|
|
411
|
+
return setTimeout(()=>fn({timeRemaining:()=>0,didTimeout:true}),1);
|
|
412
|
+
}
|
|
413
|
+
let idSeq=0;
|
|
414
|
+
function uid(prefix='l'){
|
|
415
|
+
return`${prefix}${(++idSeq).toString(36)}`;
|
|
416
|
+
}
|
|
417
|
+
});
|
|
21
418
|
__def("packages/modules/shared/adapter.js",function(__exports,__req){
|
|
22
419
|
'use strict';
|
|
23
420
|
Object.defineProperty(__exports,"EVENT_NAMES",{enumerable:true,get:function(){return EVENT_NAMES;}});
|
|
@@ -172,72 +569,792 @@ grid.destroy();
|
|
|
172
569
|
};
|
|
173
570
|
}
|
|
174
571
|
});
|
|
572
|
+
__def("packages/modules/react/viewers.js",function(__exports,__req){
|
|
573
|
+
'use strict';
|
|
574
|
+
Object.defineProperty(__exports,"VIEWER_EVENTS",{enumerable:true,get:function(){return VIEWER_EVENTS;}});
|
|
575
|
+
Object.defineProperty(__exports,"VIEWER_APPLY",{enumerable:true,get:function(){return VIEWER_APPLY;}});
|
|
576
|
+
Object.defineProperty(__exports,"VIEWER_BULK_UPDATE",{enumerable:true,get:function(){return VIEWER_BULK_UPDATE;}});
|
|
577
|
+
Object.defineProperty(__exports,"viewerHandlerName",{enumerable:true,get:function(){return viewerHandlerName;}});
|
|
578
|
+
Object.defineProperty(__exports,"partitionViewerProps",{enumerable:true,get:function(){return partitionViewerProps;}});
|
|
579
|
+
Object.defineProperty(__exports,"createViewerController",{enumerable:true,get:function(){return createViewerController;}});
|
|
580
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
581
|
+
const warnOnce=__m0["warnOnce"];
|
|
582
|
+
const VIEWER_EVENTS=Object.freeze({
|
|
583
|
+
kpi:Object.freeze([
|
|
584
|
+
'tile:click','tile:dblclick','tile:contextmenu','node:toggle','change',
|
|
585
|
+
]),
|
|
586
|
+
kanban:Object.freeze([
|
|
587
|
+
'card:click','card:dblclick','card:contextmenu',
|
|
588
|
+
'card:move','card:reverted','card:confirmed','selection:changed','column:collapse','card:add',
|
|
589
|
+
'drag:start','drag:end','swimlane:collapse','swimlane:reorder','column:reorder',
|
|
590
|
+
'filter:changed','sprint:changed','epic:changed','card:expand','card:drill','card:edit',
|
|
591
|
+
'card:sla',
|
|
592
|
+
'beforeMove','beforeAdd','beforeEdit',
|
|
593
|
+
'beforeLaneReorder','beforeColumnReorder','beforeColumnChange',
|
|
594
|
+
'move:cancelled','add:cancelled','edit:cancelled',
|
|
595
|
+
'laneReorder:cancelled','columnReorder:cancelled','columnChange:cancelled',
|
|
596
|
+
]),
|
|
597
|
+
tabs:Object.freeze(['beforeTabChange','tab:changed','tabChange:cancelled']),
|
|
598
|
+
chart:Object.freeze(['click','hover','leave','draw','legend']),
|
|
599
|
+
gantt:Object.freeze(['schedule','error']),
|
|
600
|
+
layout:Object.freeze([
|
|
601
|
+
'layout:changed','window:moved','window:resized','window:closed',
|
|
602
|
+
'beforeWindowClose','windowClose:cancelled',
|
|
603
|
+
]),
|
|
604
|
+
router:Object.freeze(['metrics']),
|
|
605
|
+
});
|
|
606
|
+
const VIEWER_APPLY=Object.freeze({
|
|
607
|
+
kpi:Object.freeze({
|
|
608
|
+
rows:(kpi,value)=>kpi.setRows(Array.isArray(value)?value:[]),
|
|
609
|
+
}),
|
|
610
|
+
kanban:Object.freeze({
|
|
611
|
+
rows:(board,value)=>board.setRows(Array.isArray(value)?value:[]),
|
|
612
|
+
quickFilter:(board,value)=>board.setQuickFilter(typeof value==='string'?value:''),
|
|
613
|
+
sprint:(board,value)=>board.setSprint(value),
|
|
614
|
+
epic:(board,value)=>board.setEpic(value),
|
|
615
|
+
loading:(board,value)=>board.setLoading(!!value),
|
|
616
|
+
error:(board,value)=>board.setError(value??null),
|
|
617
|
+
}),
|
|
618
|
+
gantt:Object.freeze({
|
|
619
|
+
tasks:(gantt,value)=>gantt.setTasks(Array.isArray(value)?value:[]),
|
|
620
|
+
dependencies:(gantt,value)=>gantt.setDependencies(Array.isArray(value)?value:[]),
|
|
621
|
+
}),
|
|
622
|
+
tabs:Object.freeze({
|
|
623
|
+
active:(tabs,value)=>{if(typeof value==='string')tabs.activate(value);},
|
|
624
|
+
}),
|
|
625
|
+
chart:Object.freeze({}),
|
|
626
|
+
layout:Object.freeze({}),
|
|
627
|
+
});
|
|
628
|
+
const VIEWER_BULK_UPDATE=Object.freeze({chart:'update'});
|
|
629
|
+
function viewerHandlerName(event){
|
|
630
|
+
const parts=String(event).split(':');
|
|
631
|
+
return`on${parts.map((p)=>p.charAt(0).toUpperCase()+p.slice(1)).join('')}`;
|
|
632
|
+
}
|
|
633
|
+
const BY_HANDLER=Object.freeze(Object.fromEntries(
|
|
634
|
+
Object.entries(VIEWER_EVENTS).map(([viewer,events])=>[
|
|
635
|
+
viewer,
|
|
636
|
+
Object.freeze(Object.fromEntries(events.map((e)=>[viewerHandlerName(e),e]))),
|
|
637
|
+
]),
|
|
638
|
+
));
|
|
639
|
+
function partitionViewerProps(viewer,props){
|
|
640
|
+
const byHandler=BY_HANDLER[viewer]||{};
|
|
641
|
+
const applies=VIEWER_APPLY[viewer]||{};
|
|
642
|
+
const config={};
|
|
643
|
+
const live={};
|
|
644
|
+
const handlers={};
|
|
645
|
+
for(const[key,value]of Object.entries(props||{})){
|
|
646
|
+
if(Object.hasOwn(byHandler,key)){handlers[key]=value;continue;}
|
|
647
|
+
if(Object.hasOwn(applies,key)){live[key]=value;config[key]=value;continue;}
|
|
648
|
+
config[key]=value;
|
|
649
|
+
}
|
|
650
|
+
return{config,live,handlers};
|
|
651
|
+
}
|
|
652
|
+
function createViewerController(opts){
|
|
653
|
+
const viewer=String(opts.viewer);
|
|
654
|
+
const mount=opts.mount;
|
|
655
|
+
const label=opts.name||viewer;
|
|
656
|
+
if(typeof mount!=='function'){
|
|
657
|
+
throw new TypeError(
|
|
658
|
+
`createViewerController needs a mount factory for "${viewer}"; pass the module's own `
|
|
659
|
+
+'factory in, e.g. { createKPI } from lattice-grid/modules/kpi.');
|
|
660
|
+
}
|
|
661
|
+
const initial=partitionViewerProps(viewer,opts.props||{});
|
|
662
|
+
const instance=mount(opts.element,{...initial.config});
|
|
663
|
+
if(!instance||typeof instance!=='object'){
|
|
664
|
+
throw new TypeError(`the ${label} factory returned no instance; nothing can be driven.`);
|
|
665
|
+
}
|
|
666
|
+
let handlers=initial.handlers;
|
|
667
|
+
let config=initial.config;
|
|
668
|
+
const live={...initial.live};
|
|
669
|
+
const off=[];
|
|
670
|
+
if(typeof instance.on==='function'){
|
|
671
|
+
for(const event of VIEWER_EVENTS[viewer]||[]){
|
|
672
|
+
const prop=viewerHandlerName(event);
|
|
673
|
+
const stop=instance.on(event,(payload)=>{
|
|
674
|
+
const fn=handlers[prop];
|
|
675
|
+
if(typeof fn==='function')fn(payload);
|
|
676
|
+
});
|
|
677
|
+
if(typeof stop==='function')off.push(stop);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
const bulk=VIEWER_BULK_UPDATE[viewer];
|
|
681
|
+
const applies=VIEWER_APPLY[viewer]||{};
|
|
682
|
+
let destroyed=false;
|
|
683
|
+
return{
|
|
684
|
+
instance,
|
|
685
|
+
update(next){
|
|
686
|
+
if(destroyed)return;
|
|
687
|
+
const parts=partitionViewerProps(viewer,next||{});
|
|
688
|
+
handlers=parts.handlers;
|
|
689
|
+
const changed={};
|
|
690
|
+
for(const[key,value]of Object.entries(parts.config)){
|
|
691
|
+
if(!Object.is(config[key],value))changed[key]=value;
|
|
692
|
+
}
|
|
693
|
+
config=parts.config;
|
|
694
|
+
if(!Object.keys(changed).length)return;
|
|
695
|
+
const unapplied=[];
|
|
696
|
+
for(const key of Object.keys(changed)){
|
|
697
|
+
const apply=applies[key];
|
|
698
|
+
if(apply){
|
|
699
|
+
apply(instance,changed[key]);
|
|
700
|
+
live[key]=changed[key];
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
if(bulk&&typeof instance[bulk]==='function')continue;
|
|
704
|
+
unapplied.push(key);
|
|
705
|
+
}
|
|
706
|
+
if(bulk&&typeof instance[bulk]==='function'){
|
|
707
|
+
const spec={};
|
|
708
|
+
for(const key of Object.keys(changed))if(!applies[key])spec[key]=changed[key];
|
|
709
|
+
if(Object.keys(spec).length)instance[bulk](spec);
|
|
710
|
+
}
|
|
711
|
+
if(unapplied.length){
|
|
712
|
+
warnOnce(`react.viewer.${viewer}.mountOnly.${unapplied.join('.')}`,
|
|
713
|
+
`${label}: ${unapplied.map((k)=>`\`${k}\``).join(', ')} changed, but `
|
|
714
|
+
+`${label} takes ${unapplied.length===1?'it':'them'} only when the viewer is `
|
|
715
|
+
+'created. Nothing was applied and the viewer was NOT rebuilt — rebuilding it silently '
|
|
716
|
+
+'would throw away scroll position, selection and expansion. Give the component a '
|
|
717
|
+
+'`key` that changes when this must take effect, so the rebuild is yours and visible, '
|
|
718
|
+
+'or drive the instance through the ref.');
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
destroy(){
|
|
722
|
+
if(destroyed)return;
|
|
723
|
+
destroyed=true;
|
|
724
|
+
for(const stop of off){
|
|
725
|
+
try{stop();}catch{}
|
|
726
|
+
}
|
|
727
|
+
off.length=0;
|
|
728
|
+
if(typeof instance.destroy==='function')instance.destroy();
|
|
729
|
+
},
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
});
|
|
175
733
|
__def("packages/modules/vue/index.js",function(__exports,__req){
|
|
176
734
|
'use strict';
|
|
177
735
|
Object.defineProperty(__exports,"EVENT_NAMES",{enumerable:true,get:function(){return EVENT_NAMES;}});
|
|
178
736
|
Object.defineProperty(__exports,"dashedName",{enumerable:true,get:function(){return dashedName;}});
|
|
737
|
+
Object.defineProperty(__exports,"VIEWER_EVENTS",{enumerable:true,get:function(){return VIEWER_EVENTS;}});
|
|
738
|
+
Object.defineProperty(__exports,"VIEWER_APPLY",{enumerable:true,get:function(){return VIEWER_APPLY;}});
|
|
739
|
+
Object.defineProperty(__exports,"viewerHandlerName",{enumerable:true,get:function(){return viewerHandlerName;}});
|
|
740
|
+
Object.defineProperty(__exports,"createViewerController",{enumerable:true,get:function(){return createViewerController;}});
|
|
741
|
+
Object.defineProperty(__exports,"DEFAULT_GRID_NAME",{enumerable:true,get:function(){return DEFAULT_GRID_NAME;}});
|
|
179
742
|
Object.defineProperty(__exports,"createLatticeGrid",{enumerable:true,get:function(){return createLatticeGrid;}});
|
|
743
|
+
Object.defineProperty(__exports,"createLatticeGridContext",{enumerable:true,get:function(){return createLatticeGridContext;}});
|
|
744
|
+
Object.defineProperty(__exports,"createLatticeViewer",{enumerable:true,get:function(){return createLatticeViewer;}});
|
|
745
|
+
Object.defineProperty(__exports,"createLatticeKPI",{enumerable:true,get:function(){return createLatticeKPI;}});
|
|
746
|
+
Object.defineProperty(__exports,"createLatticeChart",{enumerable:true,get:function(){return createLatticeChart;}});
|
|
747
|
+
Object.defineProperty(__exports,"createLatticeKanban",{enumerable:true,get:function(){return createLatticeKanban;}});
|
|
748
|
+
Object.defineProperty(__exports,"createLatticeGantt",{enumerable:true,get:function(){return createLatticeGantt;}});
|
|
749
|
+
Object.defineProperty(__exports,"createLatticeLayout",{enumerable:true,get:function(){return createLatticeLayout;}});
|
|
750
|
+
Object.defineProperty(__exports,"createLatticeTabs",{enumerable:true,get:function(){return createLatticeTabs;}});
|
|
751
|
+
Object.defineProperty(__exports,"createLatticeRouter",{enumerable:true,get:function(){return createLatticeRouter;}});
|
|
752
|
+
Object.defineProperty(__exports,"createLatticeVue",{enumerable:true,get:function(){return createLatticeVue;}});
|
|
180
753
|
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
181
|
-
const __m0=__req("packages/
|
|
182
|
-
const
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
const
|
|
754
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
755
|
+
const warnOnce=__m0["warnOnce"];
|
|
756
|
+
const __m1=__req("packages/modules/shared/adapter.js");
|
|
757
|
+
const createGridController=__m1["createGridController"];
|
|
758
|
+
const EVENT_NAMES=__m1["EVENT_NAMES"];
|
|
759
|
+
const dashedName=__m1["dashedName"];
|
|
760
|
+
const handlerName=__m1["handlerName"];
|
|
761
|
+
const isHandlerProp=__m1["isHandlerProp"];
|
|
762
|
+
const aliasConfigKey=__m1["aliasConfigKey"];
|
|
763
|
+
const __m2=__req("packages/modules/react/viewers.js");
|
|
764
|
+
const VIEWER_EVENTS=__m2["VIEWER_EVENTS"];
|
|
765
|
+
const VIEWER_APPLY=__m2["VIEWER_APPLY"];
|
|
766
|
+
const viewerHandlerName=__m2["viewerHandlerName"];
|
|
767
|
+
const createViewerController=__m2["createViewerController"];
|
|
768
|
+
const DEFAULT_GRID_NAME='default';
|
|
769
|
+
const HOST_ATTRS=new Set(['class','style','id']);
|
|
770
|
+
const GRID_REGISTRY_KEY=Symbol.for('lattice.vue.gridRegistry');
|
|
771
|
+
const ROUTER_KEY=Symbol.for('lattice.vue.router');
|
|
772
|
+
const ATTRS_PROBE=Symbol.for('lattice.vue.attrsProbe');
|
|
773
|
+
function requireVue(vue,fn){
|
|
774
|
+
if(!vue||typeof vue.h!=='function'){
|
|
775
|
+
throw new TypeError(`${fn} needs the Vue runtime: ${fn}({ vue, … }).`);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
function define(vue,definition){
|
|
779
|
+
return typeof vue.defineComponent==='function'?vue.defineComponent(definition):definition;
|
|
780
|
+
}
|
|
781
|
+
function configKeys(attrs){
|
|
782
|
+
const out=[];
|
|
783
|
+
const names=Object.keys(attrs||{});
|
|
784
|
+
const present=new Set(names);
|
|
785
|
+
for(const from of names){
|
|
786
|
+
if(HOST_ATTRS.has(from))continue;
|
|
787
|
+
if(isHandlerProp(from))continue;
|
|
788
|
+
const camel=aliasConfigKey(from);
|
|
789
|
+
out.push({to:camel!==from&&!present.has(camel)?camel:from,from});
|
|
790
|
+
}
|
|
791
|
+
return out;
|
|
792
|
+
}
|
|
793
|
+
function hostAttrs(attrs){
|
|
794
|
+
const out={};
|
|
795
|
+
for(const key of HOST_ATTRS){
|
|
796
|
+
if(attrs&&Object.hasOwn(attrs,key))out[key]=attrs[key];
|
|
797
|
+
}
|
|
798
|
+
return out;
|
|
799
|
+
}
|
|
800
|
+
function watchEachProp(vue,bag,onChange){
|
|
801
|
+
const{watch}=vue;
|
|
802
|
+
const perKey=new Map();
|
|
803
|
+
const options={flush:'post'};
|
|
804
|
+
const sync=()=>{
|
|
805
|
+
const attrs=bag();
|
|
806
|
+
const live=new Set(configKeys(attrs).map((entry)=>entry.from));
|
|
807
|
+
for(const key of live){
|
|
808
|
+
if(perKey.has(key))continue;
|
|
809
|
+
perKey.set(key,watch(()=>bag()[key],onChange,options));
|
|
810
|
+
}
|
|
811
|
+
for(const[key,stop]of[...perKey]){
|
|
812
|
+
if(live.has(key))continue;
|
|
813
|
+
stop();
|
|
814
|
+
perKey.delete(key);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
const keySignature=()=>{
|
|
818
|
+
const attrs=bag();
|
|
819
|
+
void attrs[ATTRS_PROBE];
|
|
820
|
+
return Object.keys(attrs).sort().join('\u0000');
|
|
821
|
+
};
|
|
822
|
+
const stopKeys=watch(
|
|
823
|
+
keySignature,
|
|
824
|
+
()=>{sync();onChange();},
|
|
825
|
+
options,
|
|
826
|
+
);
|
|
827
|
+
sync();
|
|
828
|
+
return()=>{
|
|
829
|
+
stopKeys();
|
|
830
|
+
for(const stop of perKey.values())stop();
|
|
831
|
+
perKey.clear();
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
function applyPredicates(grid,next,previous){
|
|
835
|
+
const now=next&&typeof next==='object'?next:{};
|
|
836
|
+
const before=previous&&typeof previous==='object'?previous:{};
|
|
837
|
+
for(const[name,fn]of Object.entries(now)){
|
|
838
|
+
if(Object.is(before[name],fn))continue;
|
|
839
|
+
grid.filters.where(name,typeof fn==='function'?fn:null);
|
|
840
|
+
}
|
|
841
|
+
for(const name of Object.keys(before)){
|
|
842
|
+
if(!Object.hasOwn(now,name))grid.filters.where(name,null);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
187
845
|
function createLatticeGrid(deps){
|
|
188
846
|
const vue=deps&&deps.vue;
|
|
189
847
|
const createGrid=deps&&deps.createGrid;
|
|
190
|
-
|
|
191
|
-
throw new TypeError('createLatticeGrid needs the Vue runtime: createLatticeGrid({ vue, createGrid }).');
|
|
192
|
-
}
|
|
848
|
+
requireVue(vue,'createLatticeGrid');
|
|
193
849
|
if(typeof createGrid!=='function'){
|
|
194
850
|
throw new TypeError('createLatticeGrid needs createGrid: createLatticeGrid({ vue, createGrid }).');
|
|
195
851
|
}
|
|
196
|
-
const{
|
|
197
|
-
|
|
852
|
+
const{
|
|
853
|
+
h,ref,shallowRef,onMounted,onBeforeUnmount,
|
|
854
|
+
}=vue;
|
|
855
|
+
const inject=typeof vue.inject==='function'?vue.inject:null;
|
|
856
|
+
return define(vue,{
|
|
198
857
|
name:'LatticeGrid',
|
|
199
|
-
|
|
858
|
+
props:{
|
|
859
|
+
rowUpdates:{type:Object,default:undefined},
|
|
860
|
+
predicates:{type:Object,default:undefined},
|
|
861
|
+
name:{type:String,default:undefined},
|
|
862
|
+
route:{type:null,default:undefined},
|
|
863
|
+
routeOptions:{type:Object,default:undefined},
|
|
864
|
+
},
|
|
865
|
+
emits:[...EVENT_NAMES.map(dashedName),'grid-ready','grid-destroyed'],
|
|
200
866
|
inheritAttrs:false,
|
|
201
867
|
setup(props,ctx){
|
|
202
868
|
const host=ref(null);
|
|
203
|
-
const controller=
|
|
869
|
+
const controller=shallowRef(null);
|
|
870
|
+
const registry=inject?inject(GRID_REGISTRY_KEY,null):null;
|
|
871
|
+
const router=inject?inject(ROUTER_KEY,null):null;
|
|
872
|
+
const applied={predicates:undefined};
|
|
873
|
+
let publishedAs=DEFAULT_GRID_NAME;
|
|
874
|
+
let stopWatching=null;
|
|
204
875
|
const gridProps=()=>{
|
|
205
876
|
const out={};
|
|
206
877
|
const attrs=ctx.attrs||{};
|
|
207
|
-
for(const
|
|
208
|
-
if(isHandlerProp(key))continue;
|
|
209
|
-
const camel=aliasConfigKey(key);
|
|
210
|
-
if(camel!==key&&!Object.hasOwn(attrs,camel)){
|
|
211
|
-
out[camel]=value;
|
|
212
|
-
}else{
|
|
213
|
-
out[key]=value;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
878
|
+
for(const{to,from}of configKeys(attrs))out[to]=attrs[from];
|
|
216
879
|
for(const name of EVENT_NAMES){
|
|
217
|
-
out[
|
|
880
|
+
out[handlerName(name)]=
|
|
218
881
|
(event)=>ctx.emit(dashedName(name),event);
|
|
219
882
|
}
|
|
220
883
|
return out;
|
|
221
884
|
};
|
|
222
885
|
onMounted(()=>{
|
|
223
|
-
|
|
886
|
+
const live=createGridController({
|
|
224
887
|
createGrid,element:host.value,props:gridProps(),
|
|
225
888
|
});
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
if(
|
|
889
|
+
controller.value=live;
|
|
890
|
+
const{grid}=live;
|
|
891
|
+
if(props.predicates){
|
|
892
|
+
applyPredicates(grid,(props.predicates),{});
|
|
893
|
+
applied.predicates=props.predicates;
|
|
894
|
+
}
|
|
895
|
+
publishedAs=typeof props.name==='string'&&props.name?props.name:DEFAULT_GRID_NAME;
|
|
896
|
+
if(registry)registry.publish(publishedAs,grid);
|
|
897
|
+
if(router&&props.route!==undefined){
|
|
898
|
+
router.attach(grid,props.route,props.routeOptions||{});
|
|
899
|
+
}
|
|
900
|
+
ctx.emit('grid-ready',grid);
|
|
901
|
+
stopWatching=watchEachProp(vue,()=>ctx.attrs||{},()=>{
|
|
902
|
+
const held=controller.value;
|
|
903
|
+
if(held)held.update(gridProps());
|
|
229
904
|
});
|
|
230
905
|
});
|
|
906
|
+
{
|
|
907
|
+
vue.watch(()=>props.predicates,(next,before)=>{
|
|
908
|
+
const held=controller.value;
|
|
909
|
+
if(!held)return;
|
|
910
|
+
applyPredicates(held.grid,(next),(before));
|
|
911
|
+
applied.predicates=next;
|
|
912
|
+
},{flush:'post'});
|
|
913
|
+
vue.watch(()=>props.rowUpdates,(next)=>{
|
|
914
|
+
const held=controller.value;
|
|
915
|
+
if(!held||!next)return;
|
|
916
|
+
held.grid.rows.apply(next);
|
|
917
|
+
},{flush:'post'});
|
|
918
|
+
}
|
|
231
919
|
onBeforeUnmount(()=>{
|
|
232
920
|
const live=controller.value;
|
|
233
921
|
controller.value=null;
|
|
234
|
-
if(
|
|
922
|
+
if(stopWatching)stopWatching();
|
|
923
|
+
stopWatching=null;
|
|
924
|
+
if(!live)return;
|
|
925
|
+
ctx.emit('grid-destroyed');
|
|
926
|
+
if(router){
|
|
927
|
+
try{router.detach(live.grid);}catch{}
|
|
928
|
+
}
|
|
929
|
+
if(registry)registry.publish(publishedAs,null);
|
|
930
|
+
applied.predicates=undefined;
|
|
931
|
+
live.destroy();
|
|
235
932
|
});
|
|
236
933
|
const grid=()=>(controller.value?controller.value.grid:null);
|
|
237
934
|
if(typeof ctx.expose==='function')ctx.expose({grid});
|
|
238
|
-
return()=>h('div',{ref:host});
|
|
935
|
+
return()=>h('div',{...hostAttrs(ctx.attrs||{}),ref:host});
|
|
936
|
+
},
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
function createLatticeGridContext(deps){
|
|
940
|
+
const vue=deps&&deps.vue;
|
|
941
|
+
requireVue(vue,'createLatticeGridContext');
|
|
942
|
+
if(typeof vue.provide!=='function'||typeof vue.inject!=='function'){
|
|
943
|
+
throw new TypeError('createLatticeGridContext needs a Vue with provide and inject.');
|
|
944
|
+
}
|
|
945
|
+
const{
|
|
946
|
+
h,shallowRef,provide,inject,computed,
|
|
947
|
+
}=vue;
|
|
948
|
+
const makeRegistry=()=>{
|
|
949
|
+
const grids=shallowRef({});
|
|
950
|
+
return{
|
|
951
|
+
grids,
|
|
952
|
+
publish(name,grid){
|
|
953
|
+
const key=name||DEFAULT_GRID_NAME;
|
|
954
|
+
const held=grids.value;
|
|
955
|
+
if(Object.is(held[key],grid))return;
|
|
956
|
+
const next={...held};
|
|
957
|
+
if(grid===null||grid===undefined)delete next[key];
|
|
958
|
+
else next[key]=grid;
|
|
959
|
+
grids.value=next;
|
|
960
|
+
},
|
|
961
|
+
};
|
|
962
|
+
};
|
|
963
|
+
const provideLatticeGrids=()=>{
|
|
964
|
+
const registry=makeRegistry();
|
|
965
|
+
provide(GRID_REGISTRY_KEY,registry);
|
|
966
|
+
return registry;
|
|
967
|
+
};
|
|
968
|
+
const LatticeGridProvider=define(vue,{
|
|
969
|
+
name:'LatticeGridProvider',
|
|
970
|
+
setup(props,ctx){
|
|
971
|
+
provideLatticeGrids();
|
|
972
|
+
return()=>(ctx.slots&&ctx.slots.default?ctx.slots.default():null);
|
|
973
|
+
},
|
|
974
|
+
});
|
|
975
|
+
const useLatticeGrid=(name=DEFAULT_GRID_NAME)=>{
|
|
976
|
+
const registry=inject(GRID_REGISTRY_KEY,null);
|
|
977
|
+
const read=()=>(registry?(registry.grids.value[name||DEFAULT_GRID_NAME]??null):null);
|
|
978
|
+
return computed(read);
|
|
979
|
+
};
|
|
980
|
+
return{LatticeGridProvider,provideLatticeGrids,useLatticeGrid};
|
|
981
|
+
}
|
|
982
|
+
function createLatticeViewer(options){
|
|
983
|
+
const vue=options&&options.vue;
|
|
984
|
+
requireVue(vue,'createLatticeViewer');
|
|
985
|
+
const viewer=String((options&&options.viewer)||'');
|
|
986
|
+
const mount=options.mount;
|
|
987
|
+
const label=options.name||`Lattice${viewer.charAt(0).toUpperCase()}${viewer.slice(1)}`;
|
|
988
|
+
const requires=Array.isArray(options.requires)?options.requires:[];
|
|
989
|
+
const fromContext=options.fromContext||null;
|
|
990
|
+
if(typeof mount!=='function'){
|
|
991
|
+
throw new TypeError(`${label} needs a mount factory: createLatticeViewer({ vue, mount }).`);
|
|
992
|
+
}
|
|
993
|
+
if(!Object.hasOwn(VIEWER_EVENTS,viewer)){
|
|
994
|
+
throw new TypeError(
|
|
995
|
+
`createLatticeViewer: "${viewer}" is not a viewer this adapter knows; expected one of `
|
|
996
|
+
+`${Object.keys(VIEWER_EVENTS).join(', ')}.`);
|
|
997
|
+
}
|
|
998
|
+
const{
|
|
999
|
+
h,ref,shallowRef,onMounted,onBeforeUnmount,
|
|
1000
|
+
}=vue;
|
|
1001
|
+
const inject=typeof vue.inject==='function'?vue.inject:null;
|
|
1002
|
+
const events=VIEWER_EVENTS[viewer];
|
|
1003
|
+
return define(vue,{
|
|
1004
|
+
name:label,
|
|
1005
|
+
props:{
|
|
1006
|
+
grid:{type:null,default:undefined},
|
|
1007
|
+
gridName:{type:String,default:undefined},
|
|
1008
|
+
},
|
|
1009
|
+
emits:[...events.map(dashedName),'ready','destroyed'],
|
|
1010
|
+
inheritAttrs:false,
|
|
1011
|
+
setup(props,ctx){
|
|
1012
|
+
const host=ref(null);
|
|
1013
|
+
const controller=shallowRef(null);
|
|
1014
|
+
const registry=fromContext&&inject?inject(GRID_REGISTRY_KEY,null):null;
|
|
1015
|
+
let stopWatching=null;
|
|
1016
|
+
let builtAgainst=null;
|
|
1017
|
+
const boundGrid=()=>{
|
|
1018
|
+
if(!fromContext)return null;
|
|
1019
|
+
if(props.grid!==undefined)return(props.grid);
|
|
1020
|
+
if(!registry)return null;
|
|
1021
|
+
const key=typeof props.gridName==='string'&&props.gridName
|
|
1022
|
+
?props.gridName:DEFAULT_GRID_NAME;
|
|
1023
|
+
return registry.grids.value[key]??null;
|
|
1024
|
+
};
|
|
1025
|
+
const viewerProps=()=>{
|
|
1026
|
+
const out={};
|
|
1027
|
+
const attrs=ctx.attrs||{};
|
|
1028
|
+
for(const{to,from}of configKeys(attrs))out[to]=attrs[from];
|
|
1029
|
+
if(fromContext){
|
|
1030
|
+
const bound=boundGrid();
|
|
1031
|
+
if(bound)out[fromContext]=bound;
|
|
1032
|
+
}
|
|
1033
|
+
for(const name of events){
|
|
1034
|
+
out[viewerHandlerName(name)]=
|
|
1035
|
+
(payload)=>ctx.emit(dashedName(name),payload);
|
|
1036
|
+
}
|
|
1037
|
+
return out;
|
|
1038
|
+
};
|
|
1039
|
+
const build=()=>{
|
|
1040
|
+
if(controller.value||!host.value)return;
|
|
1041
|
+
const next=viewerProps();
|
|
1042
|
+
if(requires.some((key)=>next[key]===null||next[key]===undefined))return;
|
|
1043
|
+
const live=createViewerController({
|
|
1044
|
+
viewer,mount,element:host.value,props:next,name:label,
|
|
1045
|
+
});
|
|
1046
|
+
controller.value=live;
|
|
1047
|
+
builtAgainst=fromContext?((next[fromContext])??null):null;
|
|
1048
|
+
ctx.emit('ready',live.instance);
|
|
1049
|
+
};
|
|
1050
|
+
const tearDown=()=>{
|
|
1051
|
+
const live=controller.value;
|
|
1052
|
+
controller.value=null;
|
|
1053
|
+
builtAgainst=null;
|
|
1054
|
+
if(!live)return;
|
|
1055
|
+
ctx.emit('destroyed');
|
|
1056
|
+
live.destroy();
|
|
1057
|
+
};
|
|
1058
|
+
onMounted(()=>{
|
|
1059
|
+
build();
|
|
1060
|
+
stopWatching=watchEachProp(vue,()=>ctx.attrs||{},()=>{
|
|
1061
|
+
const held=controller.value;
|
|
1062
|
+
if(held)held.update(viewerProps());
|
|
1063
|
+
else build();
|
|
1064
|
+
});
|
|
1065
|
+
});
|
|
1066
|
+
{
|
|
1067
|
+
vue.watch(boundGrid,(next)=>{
|
|
1068
|
+
if(controller.value&&Object.is(builtAgainst,next??null))return;
|
|
1069
|
+
tearDown();
|
|
1070
|
+
build();
|
|
1071
|
+
},{flush:'post'});
|
|
1072
|
+
}
|
|
1073
|
+
onBeforeUnmount(()=>{
|
|
1074
|
+
if(stopWatching)stopWatching();
|
|
1075
|
+
stopWatching=null;
|
|
1076
|
+
tearDown();
|
|
1077
|
+
});
|
|
1078
|
+
const instance=()=>(controller.value?controller.value.instance:null);
|
|
1079
|
+
if(typeof ctx.expose==='function')ctx.expose({instance});
|
|
1080
|
+
return()=>h('div',{...hostAttrs(ctx.attrs||{}),ref:host});
|
|
1081
|
+
},
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
function createLatticeKPI(deps){
|
|
1085
|
+
const createKPI=deps&&deps.createKPI;
|
|
1086
|
+
if(typeof createKPI!=='function'){
|
|
1087
|
+
throw new TypeError('createLatticeKPI needs createKPI: createLatticeKPI({ vue, createKPI }).');
|
|
1088
|
+
}
|
|
1089
|
+
return createLatticeViewer({
|
|
1090
|
+
vue:deps.vue,
|
|
1091
|
+
viewer:'kpi',
|
|
1092
|
+
name:'LatticeKPI',
|
|
1093
|
+
mount:(el,config)=>createKPI(el,config),
|
|
1094
|
+
fromContext:'grid',
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
function createLatticeChart(deps){
|
|
1098
|
+
const createChart=deps&&deps.createChart;
|
|
1099
|
+
if(typeof createChart!=='function'){
|
|
1100
|
+
throw new TypeError('createLatticeChart needs createChart: createLatticeChart({ vue, createChart }).');
|
|
1101
|
+
}
|
|
1102
|
+
return createLatticeViewer({
|
|
1103
|
+
vue:deps.vue,
|
|
1104
|
+
viewer:'chart',
|
|
1105
|
+
name:'LatticeChart',
|
|
1106
|
+
mount:(el,config)=>createChart({...config,container:el}),
|
|
1107
|
+
requires:['grid'],
|
|
1108
|
+
fromContext:'grid',
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
function createLatticeKanban(deps){
|
|
1112
|
+
const createKanban=deps&&deps.createKanban;
|
|
1113
|
+
if(typeof createKanban!=='function'){
|
|
1114
|
+
throw new TypeError('createLatticeKanban needs createKanban: createLatticeKanban({ vue, createKanban }).');
|
|
1115
|
+
}
|
|
1116
|
+
return createLatticeViewer({
|
|
1117
|
+
vue:deps.vue,
|
|
1118
|
+
viewer:'kanban',
|
|
1119
|
+
name:'LatticeKanban',
|
|
1120
|
+
mount:(el,config)=>createKanban(el,config),
|
|
1121
|
+
fromContext:'grid',
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function createLatticeGantt(deps){
|
|
1125
|
+
const createGantt=deps&&deps.createGantt;
|
|
1126
|
+
if(typeof createGantt!=='function'){
|
|
1127
|
+
throw new TypeError('createLatticeGantt needs createGantt: createLatticeGantt({ vue, createGantt }).');
|
|
1128
|
+
}
|
|
1129
|
+
return createLatticeViewer({
|
|
1130
|
+
vue:deps.vue,
|
|
1131
|
+
viewer:'gantt',
|
|
1132
|
+
name:'LatticeGantt',
|
|
1133
|
+
mount:(el,config)=>createGantt({...config,element:el}),
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
function createLatticeLayout(deps){
|
|
1137
|
+
const createLayout=deps&&deps.createLayout;
|
|
1138
|
+
if(typeof createLayout!=='function'){
|
|
1139
|
+
throw new TypeError('createLatticeLayout needs createLayout: createLatticeLayout({ vue, createLayout }).');
|
|
1140
|
+
}
|
|
1141
|
+
return createLatticeViewer({
|
|
1142
|
+
vue:deps.vue,
|
|
1143
|
+
viewer:'layout',
|
|
1144
|
+
name:'LatticeLayout',
|
|
1145
|
+
mount:(el,config)=>createLayout(el,config),
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
function tabSlotNames(id){
|
|
1149
|
+
return[String(id),`tab-${String(id)}`];
|
|
1150
|
+
}
|
|
1151
|
+
function createLatticeTabs(deps){
|
|
1152
|
+
const vue=deps&&deps.vue;
|
|
1153
|
+
const createTabs=deps&&deps.createTabs;
|
|
1154
|
+
requireVue(vue,'createLatticeTabs');
|
|
1155
|
+
if(typeof createTabs!=='function'){
|
|
1156
|
+
throw new TypeError('createLatticeTabs needs createTabs: createLatticeTabs({ vue, createTabs }).');
|
|
1157
|
+
}
|
|
1158
|
+
if(!vue.Teleport){
|
|
1159
|
+
throw new TypeError('createLatticeTabs needs a Vue with Teleport, which is how a tab\'s slot reaches the strip\'s panel.');
|
|
1160
|
+
}
|
|
1161
|
+
const{
|
|
1162
|
+
h,ref,shallowRef,Teleport,Fragment,onMounted,onBeforeUnmount,
|
|
1163
|
+
}=vue;
|
|
1164
|
+
return define(vue,{
|
|
1165
|
+
name:'LatticeTabs',
|
|
1166
|
+
props:{
|
|
1167
|
+
tabs:{type:Array,default:()=>[]},
|
|
1168
|
+
active:{type:String,default:undefined},
|
|
1169
|
+
},
|
|
1170
|
+
emits:[...VIEWER_EVENTS.tabs.map(dashedName),'ready','destroyed'],
|
|
1171
|
+
inheritAttrs:false,
|
|
1172
|
+
setup(props,ctx){
|
|
1173
|
+
const host=ref(null);
|
|
1174
|
+
const strip=shallowRef(null);
|
|
1175
|
+
const panels=shallowRef({});
|
|
1176
|
+
const off=[];
|
|
1177
|
+
let appliedTabs=null;
|
|
1178
|
+
const slotFor=(id)=>{
|
|
1179
|
+
const slots=ctx.slots||{};
|
|
1180
|
+
for(const name of tabSlotNames(id)){
|
|
1181
|
+
if(typeof slots[name]==='function')return slots[name];
|
|
1182
|
+
}
|
|
1183
|
+
return null;
|
|
1184
|
+
};
|
|
1185
|
+
onMounted(()=>{
|
|
1186
|
+
const config={};
|
|
1187
|
+
const attrs=ctx.attrs||{};
|
|
1188
|
+
for(const{to,from}of configKeys(attrs))config[to]=attrs[from];
|
|
1189
|
+
const declared=Array.isArray(props.tabs)?props.tabs:[];
|
|
1190
|
+
const descriptors=declared.map((tab)=>{
|
|
1191
|
+
const spec=(tab);
|
|
1192
|
+
if(!slotFor(spec.id))return spec;
|
|
1193
|
+
return{
|
|
1194
|
+
...spec,
|
|
1195
|
+
view:(bodyEl)=>{
|
|
1196
|
+
panels.value={...panels.value,[spec.id]:bodyEl};
|
|
1197
|
+
return{
|
|
1198
|
+
destroy(){
|
|
1199
|
+
if(!Object.hasOwn(panels.value,spec.id))return;
|
|
1200
|
+
const next={...panels.value};
|
|
1201
|
+
delete next[spec.id];
|
|
1202
|
+
panels.value=next;
|
|
1203
|
+
},
|
|
1204
|
+
};
|
|
1205
|
+
},
|
|
1206
|
+
};
|
|
1207
|
+
});
|
|
1208
|
+
const live=createTabs(host.value,{
|
|
1209
|
+
...config,
|
|
1210
|
+
tabs:descriptors,
|
|
1211
|
+
createGrid:deps.createGrid||(()=>{
|
|
1212
|
+
throw new Error(
|
|
1213
|
+
'[lattice] LatticeTabs: a tab has neither a slot nor a `createGrid` to build it '
|
|
1214
|
+
+'with. Give the tab a <template #‹id›> slot, or pass createGrid into '
|
|
1215
|
+
+'createLatticeTabs.');
|
|
1216
|
+
}),
|
|
1217
|
+
...(typeof props.active==='string'?{active:props.active}:{}),
|
|
1218
|
+
});
|
|
1219
|
+
strip.value=live;
|
|
1220
|
+
appliedTabs=props.tabs;
|
|
1221
|
+
for(const event of VIEWER_EVENTS.tabs){
|
|
1222
|
+
const stop=live.on(event,(payload)=>ctx.emit(dashedName(event),payload));
|
|
1223
|
+
if(typeof stop==='function')off.push(stop);
|
|
1224
|
+
}
|
|
1225
|
+
ctx.emit('ready',live);
|
|
1226
|
+
});
|
|
1227
|
+
{
|
|
1228
|
+
vue.watch(()=>props.active,(wanted)=>{
|
|
1229
|
+
const live=strip.value;
|
|
1230
|
+
if(live&&typeof wanted==='string'&&live.activeId!==wanted)live.activate(wanted);
|
|
1231
|
+
},{flush:'post'});
|
|
1232
|
+
vue.watch(()=>props.tabs,(next)=>{
|
|
1233
|
+
if(!strip.value||Object.is(appliedTabs,next))return;
|
|
1234
|
+
appliedTabs=next;
|
|
1235
|
+
warnOnce('vue.tabs.mountOnly.tabs',
|
|
1236
|
+
'LatticeTabs: `tabs` changed (a label, a badge or a descriptor), but the strip takes '
|
|
1237
|
+
+'it only when created — the module has no way to repaint an existing tab. Nothing '
|
|
1238
|
+
+'was applied and the strip was NOT rebuilt — rebuilding it would lose whichever tab '
|
|
1239
|
+
+'is open and any state its content holds. Give the component a `key` that changes '
|
|
1240
|
+
+'when a genuine rebuild is wanted; a live badge otherwise needs to live in your own '
|
|
1241
|
+
+'render.');
|
|
1242
|
+
},{flush:'post'});
|
|
1243
|
+
}
|
|
1244
|
+
onBeforeUnmount(()=>{
|
|
1245
|
+
const live=strip.value;
|
|
1246
|
+
strip.value=null;
|
|
1247
|
+
for(const stop of off){
|
|
1248
|
+
try{stop();}catch{}
|
|
1249
|
+
}
|
|
1250
|
+
off.length=0;
|
|
1251
|
+
if(!live)return;
|
|
1252
|
+
ctx.emit('destroyed');
|
|
1253
|
+
live.destroy();
|
|
1254
|
+
panels.value={};
|
|
1255
|
+
});
|
|
1256
|
+
const instance=()=>strip.value;
|
|
1257
|
+
if(typeof ctx.expose==='function')ctx.expose({instance,tabs:instance});
|
|
1258
|
+
return()=>{
|
|
1259
|
+
const children=[h('div',{...hostAttrs(ctx.attrs||{}),ref:host})];
|
|
1260
|
+
for(const tab of(Array.isArray(props.tabs)?props.tabs:[])){
|
|
1261
|
+
const spec=(tab);
|
|
1262
|
+
const target=panels.value[spec.id];
|
|
1263
|
+
const slot=slotFor(spec.id);
|
|
1264
|
+
if(!target||!slot)continue;
|
|
1265
|
+
children.push(h(Teleport,{to:target,key:spec.id},slot()));
|
|
1266
|
+
}
|
|
1267
|
+
return h(Fragment,null,children);
|
|
1268
|
+
};
|
|
1269
|
+
},
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
function createLatticeRouter(deps){
|
|
1273
|
+
const vue=deps&&deps.vue;
|
|
1274
|
+
const createDataRouter=deps&&deps.createDataRouter;
|
|
1275
|
+
requireVue(vue,'createLatticeRouter');
|
|
1276
|
+
if(typeof vue.provide!=='function'||typeof vue.inject!=='function'){
|
|
1277
|
+
throw new TypeError('createLatticeRouter needs a Vue with provide and inject.');
|
|
1278
|
+
}
|
|
1279
|
+
if(typeof createDataRouter!=='function'){
|
|
1280
|
+
throw new TypeError(
|
|
1281
|
+
'createLatticeRouter needs createDataRouter: createLatticeRouter({ vue, createDataRouter }).');
|
|
1282
|
+
}
|
|
1283
|
+
const{provide,inject}=vue;
|
|
1284
|
+
const provideLatticeRouter=(config)=>{
|
|
1285
|
+
let instance=null;
|
|
1286
|
+
let torn=false;
|
|
1287
|
+
const handle={
|
|
1288
|
+
get router(){
|
|
1289
|
+
if(!instance&&!torn)instance=createDataRouter(config||{});
|
|
1290
|
+
return instance;
|
|
1291
|
+
},
|
|
1292
|
+
attach(grid,route,opts){
|
|
1293
|
+
if(torn)return;
|
|
1294
|
+
handle.router.attach(grid,route,opts||{});
|
|
1295
|
+
},
|
|
1296
|
+
detach(grid){
|
|
1297
|
+
if(torn||!instance)return;
|
|
1298
|
+
instance.detach(grid);
|
|
1299
|
+
},
|
|
1300
|
+
destroy(){
|
|
1301
|
+
torn=true;
|
|
1302
|
+
const live=instance;
|
|
1303
|
+
instance=null;
|
|
1304
|
+
if(live)live.destroy();
|
|
239
1305
|
},
|
|
240
1306
|
};
|
|
1307
|
+
provide(ROUTER_KEY,handle);
|
|
1308
|
+
vue.onScopeDispose(()=>handle.destroy());
|
|
1309
|
+
return handle;
|
|
1310
|
+
};
|
|
1311
|
+
const useLatticeRouter=()=>inject(ROUTER_KEY,null);
|
|
1312
|
+
const LatticeRouterProvider=define(vue,{
|
|
1313
|
+
name:'LatticeRouterProvider',
|
|
1314
|
+
props:{
|
|
1315
|
+
config:{type:Object,default:()=>({})},
|
|
1316
|
+
},
|
|
1317
|
+
setup(props,ctx){
|
|
1318
|
+
provideLatticeRouter(props.config);
|
|
1319
|
+
return()=>(ctx.slots&&ctx.slots.default?ctx.slots.default():null);
|
|
1320
|
+
},
|
|
1321
|
+
});
|
|
1322
|
+
return{provideLatticeRouter,useLatticeRouter,LatticeRouterProvider};
|
|
1323
|
+
}
|
|
1324
|
+
function createLatticeVue(deps){
|
|
1325
|
+
const vue=deps&&deps.vue;
|
|
1326
|
+
requireVue(vue,'createLatticeVue');
|
|
1327
|
+
const{
|
|
1328
|
+
LatticeGridProvider,provideLatticeGrids,useLatticeGrid,
|
|
1329
|
+
}=createLatticeGridContext({vue});
|
|
1330
|
+
const out={LatticeGridProvider,provideLatticeGrids,useLatticeGrid};
|
|
1331
|
+
if(typeof deps.createGrid==='function'){
|
|
1332
|
+
out.LatticeGrid=createLatticeGrid({vue,createGrid:deps.createGrid});
|
|
1333
|
+
}
|
|
1334
|
+
if(typeof deps.createKPI==='function'){
|
|
1335
|
+
out.LatticeKPI=createLatticeKPI({vue,createKPI:deps.createKPI});
|
|
1336
|
+
}
|
|
1337
|
+
if(typeof deps.createChart==='function'){
|
|
1338
|
+
out.LatticeChart=createLatticeChart({vue,createChart:deps.createChart});
|
|
1339
|
+
}
|
|
1340
|
+
if(typeof deps.createKanban==='function'){
|
|
1341
|
+
out.LatticeKanban=createLatticeKanban({vue,createKanban:deps.createKanban});
|
|
1342
|
+
}
|
|
1343
|
+
if(typeof deps.createGantt==='function'){
|
|
1344
|
+
out.LatticeGantt=createLatticeGantt({vue,createGantt:deps.createGantt});
|
|
1345
|
+
}
|
|
1346
|
+
if(typeof deps.createLayout==='function'){
|
|
1347
|
+
out.LatticeLayout=createLatticeLayout({vue,createLayout:deps.createLayout});
|
|
1348
|
+
}
|
|
1349
|
+
if(typeof deps.createTabs==='function'){
|
|
1350
|
+
out.LatticeTabs=createLatticeTabs({
|
|
1351
|
+
vue,createTabs:deps.createTabs,createGrid:deps.createGrid,
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
if(typeof deps.createDataRouter==='function'){
|
|
1355
|
+
Object.assign(out,createLatticeRouter({vue,createDataRouter:deps.createDataRouter}));
|
|
1356
|
+
}
|
|
1357
|
+
return out;
|
|
241
1358
|
}
|
|
242
1359
|
const __default=createLatticeGrid;
|
|
243
1360
|
});
|