@toclocoinc/lattice-grid 1.64.0 → 1.66.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 -3
- 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 +791 -8
- package/docs/api-detail.html +172 -4
- package/lattice-grid.d.ts +241 -205
- package/lattice-grid.esm.min.js +19 -7
- package/lattice-grid.min.cjs +19 -7
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +19 -7
- package/modules/ai.d.ts +10 -13
- 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 +2 -2
- package/modules/angular.esm.min.js +433 -7
- package/modules/angular.min.cjs +433 -7
- package/modules/angular.min.js +433 -7
- package/modules/chart-alluvial.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +4 -5
- 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 +5 -6
- package/modules/data-router.esm.min.js +3 -3
- package/modules/data-router.min.cjs +3 -3
- package/modules/data-router.min.js +3 -3
- 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 +37 -43
- package/modules/gantt.esm.min.js +3 -3
- package/modules/gantt.min.cjs +3 -3
- package/modules/gantt.min.js +3 -3
- package/modules/geo-europe-nuts.d.ts +2 -2
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-uk.d.ts +2 -2
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-us-states.d.ts +2 -2
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-world-110m.d.ts +2 -2
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-50m.d.ts +2 -2
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/htmx.d.ts +2 -2
- package/modules/htmx.esm.min.js +19 -7
- package/modules/htmx.min.cjs +19 -7
- package/modules/htmx.min.js +19 -7
- package/modules/kanban.d.ts +14 -14
- package/modules/kanban.esm.min.js +3 -3
- package/modules/kanban.min.cjs +3 -3
- package/modules/kanban.min.js +3 -3
- package/modules/kpi.d.ts +5 -5
- package/modules/kpi.esm.min.js +3 -3
- package/modules/kpi.min.cjs +3 -3
- package/modules/kpi.min.js +3 -3
- package/modules/layout.d.ts +2 -2
- 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 +4 -5
- 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 +252 -4
- 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 +2 -3
- 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 +234 -2
- package/modules/webcomponent.esm.min.js +1267 -38
- package/modules/webcomponent.min.cjs +1249 -38
- package/modules/webcomponent.min.js +1249 -38
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toclocoinc/lattice-grid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.66.0",
|
|
4
4
|
"description": "Lattice Grid JS: a high-performance JavaScript data grid for millions of rows, live data sources and zero runtime dependencies, free on localhost and licensed per domain to ship.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-grid",
|
|
@@ -41,6 +41,15 @@
|
|
|
41
41
|
},
|
|
42
42
|
"./modules/*.js": "./modules/*.js",
|
|
43
43
|
"./modules/*.cjs": "./modules/*.cjs",
|
|
44
|
+
"./angular": {
|
|
45
|
+
"types": "./angular/types/toclocoinc-lattice-grid-angular.d.ts",
|
|
46
|
+
"default": "./angular/fesm2022/toclocoinc-lattice-grid-angular.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./angular/package.json": "./angular/package.json",
|
|
49
|
+
"./svelte/*.svelte": {
|
|
50
|
+
"svelte": "./svelte/*.svelte",
|
|
51
|
+
"default": "./svelte/*.svelte"
|
|
52
|
+
},
|
|
44
53
|
"./css": "./lattice-grid.min.css",
|
|
45
54
|
"./lattice-grid.css": "./lattice-grid.min.css",
|
|
46
55
|
"./package.json": "./package.json"
|
|
@@ -48,5 +57,21 @@
|
|
|
48
57
|
"sideEffects": [
|
|
49
58
|
"*.css"
|
|
50
59
|
],
|
|
51
|
-
"dependencies": {}
|
|
60
|
+
"dependencies": {},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@angular/common": ">=17.0.0",
|
|
63
|
+
"@angular/core": ">=17.0.0",
|
|
64
|
+
"svelte": ">=5.0.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"@angular/common": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@angular/core": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"svelte": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
52
77
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from 'svelte';
|
|
3
|
+
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
|
|
4
|
+
import { bindViewer, GRID_REGISTRY_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
5
|
+
|
|
6
|
+
let { class: klass = '', style = '', id = undefined, ...props } = $props();
|
|
7
|
+
|
|
8
|
+
let el = $state(null);
|
|
9
|
+
let published = $state(0);
|
|
10
|
+
let binding = null;
|
|
11
|
+
const registry = getContext(GRID_REGISTRY_KEY) ?? null;
|
|
12
|
+
const unsubscribe = registry ? registry.subscribe(() => { published += 1; }) : null;
|
|
13
|
+
|
|
14
|
+
export function instance() { return binding ? binding.instance : null; }
|
|
15
|
+
|
|
16
|
+
onMount(() => {
|
|
17
|
+
binding = bindViewer({ viewer: 'chart', factory: createChart, element: el, registry });
|
|
18
|
+
binding.sync(props);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
onDestroy(() => {
|
|
22
|
+
if (unsubscribe) unsubscribe();
|
|
23
|
+
if (binding) binding.destroy();
|
|
24
|
+
binding = null;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
void published;
|
|
29
|
+
const now = { ...props };
|
|
30
|
+
if (binding) binding.sync(now);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div bind:this={el} class={klass} {style} {id}></div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from 'svelte';
|
|
3
|
+
import { createGantt } from '@toclocoinc/lattice-grid/modules/gantt';
|
|
4
|
+
import { bindViewer, GRID_REGISTRY_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
5
|
+
|
|
6
|
+
let { class: klass = '', style = '', id = undefined, ...props } = $props();
|
|
7
|
+
|
|
8
|
+
let el = $state(null);
|
|
9
|
+
let published = $state(0);
|
|
10
|
+
let binding = null;
|
|
11
|
+
const registry = getContext(GRID_REGISTRY_KEY) ?? null;
|
|
12
|
+
const unsubscribe = registry ? registry.subscribe(() => { published += 1; }) : null;
|
|
13
|
+
|
|
14
|
+
export function instance() { return binding ? binding.instance : null; }
|
|
15
|
+
|
|
16
|
+
onMount(() => {
|
|
17
|
+
binding = bindViewer({ viewer: 'gantt', factory: createGantt, element: el, registry });
|
|
18
|
+
binding.sync(props);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
onDestroy(() => {
|
|
22
|
+
if (unsubscribe) unsubscribe();
|
|
23
|
+
if (binding) binding.destroy();
|
|
24
|
+
binding = null;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
void published;
|
|
29
|
+
const now = { ...props };
|
|
30
|
+
if (binding) binding.sync(now);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div bind:this={el} class={klass} {style} {id}></div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from 'svelte';
|
|
3
|
+
import { createGrid } from '@toclocoinc/lattice-grid';
|
|
4
|
+
import { bindGrid, GRID_REGISTRY_KEY, ROUTER_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
5
|
+
|
|
6
|
+
let { class: klass = '', style = '', id = undefined, ...props } = $props();
|
|
7
|
+
|
|
8
|
+
let el = $state(null);
|
|
9
|
+
let binding = null;
|
|
10
|
+
const registry = getContext(GRID_REGISTRY_KEY) ?? null;
|
|
11
|
+
const router = getContext(ROUTER_KEY) ?? null;
|
|
12
|
+
|
|
13
|
+
export function grid() { return binding ? binding.grid : null; }
|
|
14
|
+
|
|
15
|
+
onMount(() => {
|
|
16
|
+
binding = bindGrid({ createGrid, element: el, props, registry, router });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
onDestroy(() => {
|
|
20
|
+
if (binding) binding.destroy(props);
|
|
21
|
+
binding = null;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
const now = { ...props };
|
|
26
|
+
if (binding) binding.update(now);
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div bind:this={el} class={klass} {style} {id}></div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { setContext } from 'svelte';
|
|
3
|
+
import { createGridRegistry, GRID_REGISTRY_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
4
|
+
|
|
5
|
+
let { children } = $props();
|
|
6
|
+
|
|
7
|
+
const registry = createGridRegistry();
|
|
8
|
+
setContext(GRID_REGISTRY_KEY, registry);
|
|
9
|
+
|
|
10
|
+
export function grids() { return registry; }
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
{@render children?.()}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from 'svelte';
|
|
3
|
+
import { createKPI } from '@toclocoinc/lattice-grid/modules/kpi';
|
|
4
|
+
import { bindViewer, GRID_REGISTRY_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
5
|
+
|
|
6
|
+
let { class: klass = '', style = '', id = undefined, ...props } = $props();
|
|
7
|
+
|
|
8
|
+
let el = $state(null);
|
|
9
|
+
let published = $state(0);
|
|
10
|
+
let binding = null;
|
|
11
|
+
const registry = getContext(GRID_REGISTRY_KEY) ?? null;
|
|
12
|
+
const unsubscribe = registry ? registry.subscribe(() => { published += 1; }) : null;
|
|
13
|
+
|
|
14
|
+
export function instance() { return binding ? binding.instance : null; }
|
|
15
|
+
|
|
16
|
+
onMount(() => {
|
|
17
|
+
binding = bindViewer({ viewer: 'kpi', factory: createKPI, element: el, registry });
|
|
18
|
+
binding.sync(props);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
onDestroy(() => {
|
|
22
|
+
if (unsubscribe) unsubscribe();
|
|
23
|
+
if (binding) binding.destroy();
|
|
24
|
+
binding = null;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
void published;
|
|
29
|
+
const now = { ...props };
|
|
30
|
+
if (binding) binding.sync(now);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div bind:this={el} class={klass} {style} {id}></div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from 'svelte';
|
|
3
|
+
import { createKanban } from '@toclocoinc/lattice-grid/modules/kanban';
|
|
4
|
+
import { bindViewer, GRID_REGISTRY_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
5
|
+
|
|
6
|
+
let { class: klass = '', style = '', id = undefined, ...props } = $props();
|
|
7
|
+
|
|
8
|
+
let el = $state(null);
|
|
9
|
+
let published = $state(0);
|
|
10
|
+
let binding = null;
|
|
11
|
+
const registry = getContext(GRID_REGISTRY_KEY) ?? null;
|
|
12
|
+
const unsubscribe = registry ? registry.subscribe(() => { published += 1; }) : null;
|
|
13
|
+
|
|
14
|
+
export function instance() { return binding ? binding.instance : null; }
|
|
15
|
+
|
|
16
|
+
onMount(() => {
|
|
17
|
+
binding = bindViewer({ viewer: 'kanban', factory: createKanban, element: el, registry });
|
|
18
|
+
binding.sync(props);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
onDestroy(() => {
|
|
22
|
+
if (unsubscribe) unsubscribe();
|
|
23
|
+
if (binding) binding.destroy();
|
|
24
|
+
binding = null;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
void published;
|
|
29
|
+
const now = { ...props };
|
|
30
|
+
if (binding) binding.sync(now);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div bind:this={el} class={klass} {style} {id}></div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from 'svelte';
|
|
3
|
+
import { createLayout } from '@toclocoinc/lattice-grid/modules/layout';
|
|
4
|
+
import { bindViewer, GRID_REGISTRY_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
5
|
+
|
|
6
|
+
let { class: klass = '', style = '', id = undefined, ...props } = $props();
|
|
7
|
+
|
|
8
|
+
let el = $state(null);
|
|
9
|
+
let published = $state(0);
|
|
10
|
+
let binding = null;
|
|
11
|
+
const registry = getContext(GRID_REGISTRY_KEY) ?? null;
|
|
12
|
+
const unsubscribe = registry ? registry.subscribe(() => { published += 1; }) : null;
|
|
13
|
+
|
|
14
|
+
export function instance() { return binding ? binding.instance : null; }
|
|
15
|
+
|
|
16
|
+
onMount(() => {
|
|
17
|
+
binding = bindViewer({ viewer: 'layout', factory: createLayout, element: el, registry });
|
|
18
|
+
binding.sync(props);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
onDestroy(() => {
|
|
22
|
+
if (unsubscribe) unsubscribe();
|
|
23
|
+
if (binding) binding.destroy();
|
|
24
|
+
binding = null;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
void published;
|
|
29
|
+
const now = { ...props };
|
|
30
|
+
if (binding) binding.sync(now);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div bind:this={el} class={klass} {style} {id}></div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { setContext, onDestroy } from 'svelte';
|
|
3
|
+
import { createDataRouter } from '@toclocoinc/lattice-grid/modules/data-router';
|
|
4
|
+
import { createRouterHandle, ROUTER_KEY } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
5
|
+
|
|
6
|
+
let { config = {}, children } = $props();
|
|
7
|
+
|
|
8
|
+
const handle = createRouterHandle({ createDataRouter, config: () => config });
|
|
9
|
+
setContext(ROUTER_KEY, handle);
|
|
10
|
+
|
|
11
|
+
export function router() { return handle.router; }
|
|
12
|
+
|
|
13
|
+
onDestroy(() => handle.destroy());
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{@render children?.()}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from 'svelte';
|
|
3
|
+
import { createTabs } from '@toclocoinc/lattice-grid/modules/tabs';
|
|
4
|
+
import { createGrid } from '@toclocoinc/lattice-grid';
|
|
5
|
+
import { bindTabs, snippetTabIds } from '@toclocoinc/lattice-grid/modules/svelte';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
class: klass = '', style = '', id = undefined, tabs = [], ...props
|
|
9
|
+
} = $props();
|
|
10
|
+
|
|
11
|
+
let el = $state(null);
|
|
12
|
+
let open = $state([]);
|
|
13
|
+
let holders = $state({});
|
|
14
|
+
let binding = null;
|
|
15
|
+
|
|
16
|
+
const contentIds = $derived(snippetTabIds(tabs, props));
|
|
17
|
+
|
|
18
|
+
export function instance() { return binding ? binding.instance : null; }
|
|
19
|
+
|
|
20
|
+
onMount(() => {
|
|
21
|
+
binding = bindTabs({
|
|
22
|
+
createTabs,
|
|
23
|
+
createGrid,
|
|
24
|
+
element: el,
|
|
25
|
+
onPanels: (ids) => { open = ids; },
|
|
26
|
+
});
|
|
27
|
+
binding.sync({ ...props, tabs, contentIds });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
onDestroy(() => {
|
|
31
|
+
if (binding) binding.destroy({ ...props, tabs, contentIds });
|
|
32
|
+
binding = null;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
$effect(() => {
|
|
36
|
+
const now = { ...props, tabs, contentIds };
|
|
37
|
+
if (binding) binding.sync(now);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
$effect(() => {
|
|
41
|
+
for (const tabId of open) {
|
|
42
|
+
if (binding) binding.place(tabId, holders[tabId]);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<div bind:this={el} class={klass} {style} {id}></div>
|
|
48
|
+
|
|
49
|
+
{#each open as tabId (tabId)}
|
|
50
|
+
<div bind:this={holders[tabId]} style="display: contents">
|
|
51
|
+
{@render props[tabId]()}
|
|
52
|
+
</div>
|
|
53
|
+
{/each}
|