@svgrid/enterprise 1.2.0 → 2.0.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/dist/cdn/svgrid-enterprise.svelte-external.js +26039 -805
- package/dist/designer/assets/index-Dp44bTid.js +939 -0
- package/dist/designer/assets/index-RJp6x8tw.css +1 -0
- package/dist/designer/assets/jszip.min-CjMo-QGg.js +2 -0
- package/dist/designer/index.html +13 -0
- package/dist/node/studio.js +22554 -0
- package/package.json +10 -3
- package/src/SvAuthGate.svelte +115 -0
- package/src/SvBoard.dom.test.ts +67 -0
- package/src/SvBoard.svelte +192 -0
- package/src/SvExportMenu.svelte +553 -0
- package/src/SvFileInput.svelte +113 -0
- package/src/SvGridEditPanel.dom.test.ts +146 -0
- package/src/SvGridEditPanel.svelte +793 -0
- package/src/SvGridMasterDetail.svelte +95 -0
- package/src/SvImportDialog.svelte +1020 -0
- package/src/SvLookupInput.svelte +180 -0
- package/src/SvRecordDetail.dom.test.ts +137 -0
- package/src/SvRecordDetail.svelte +288 -0
- package/src/SvSchedule.dom.test.ts +57 -0
- package/src/SvSchedule.svelte +156 -0
- package/src/SvSchemaChart.svelte +233 -0
- package/src/SvSchemaDashboard.svelte +130 -0
- package/src/ai-export-pdf.test.ts +74 -0
- package/src/ai-export-xlsx.test.ts +87 -0
- package/src/ai-export.test.ts +110 -0
- package/src/ai.ts +1188 -782
- package/src/edit-panel.test.ts +213 -0
- package/src/edit-panel.ts +228 -0
- package/src/export-conditional.test.ts +60 -0
- package/src/export-conditional.ts +94 -0
- package/src/export-ooxml.test.ts +152 -0
- package/src/export-ooxml.ts +485 -0
- package/src/export-pdf.test.ts +138 -0
- package/src/export-pdf.ts +245 -0
- package/src/export-print.test.ts +66 -0
- package/src/export-print.ts +132 -0
- package/src/export-serialize.test.ts +56 -0
- package/src/export-serialize.ts +24 -0
- package/src/export-xls.ts +196 -0
- package/src/export-xlsx-roundtrip.test.ts +120 -0
- package/src/export-xlsx.test.ts +150 -0
- package/src/export.test.ts +349 -0
- package/src/export.ts +1452 -549
- package/src/import-automap.test.ts +131 -0
- package/src/import-hardening.test.ts +158 -0
- package/src/import.ts +1042 -648
- package/src/index.ts +282 -0
- package/src/install.ts +134 -114
- package/src/license-core.test.ts +23 -0
- package/src/license-core.ts +35 -0
- package/src/license.ts +103 -90
- package/src/master-detail.test.ts +61 -0
- package/src/master-detail.ts +42 -0
- package/src/print.ts +107 -127
- package/src/schema-designer.test.ts +121 -0
- package/src/schema-designer.ts +142 -0
- package/src/schema.test.ts +268 -0
- package/src/schema.ts +499 -0
- package/src/smart-shim.ts +107 -105
- package/src/sources/aggregate.test.ts +79 -0
- package/src/sources/aggregate.ts +102 -0
- package/src/sources/auth-supabase.test.ts +80 -0
- package/src/sources/auth-supabase.ts +87 -0
- package/src/sources/dashboard.kpi.test.ts +50 -0
- package/src/sources/dashboard.test.ts +61 -0
- package/src/sources/dashboard.ts +136 -0
- package/src/sources/field-inference.test.ts +60 -0
- package/src/sources/field-inference.ts +63 -0
- package/src/sources/filters.test.ts +58 -0
- package/src/sources/filters.ts +64 -0
- package/src/sources/index.ts +67 -0
- package/src/sources/introspect-supabase.test.ts +100 -0
- package/src/sources/introspect-supabase.ts +119 -0
- package/src/sources/realtime-supabase.test.ts +93 -0
- package/src/sources/realtime-supabase.ts +99 -0
- package/src/sources/relation-lookup.test.ts +99 -0
- package/src/sources/relation-lookup.ts +128 -0
- package/src/sources/rest-adapters.test.ts +95 -0
- package/src/sources/rest-adapters.ts +120 -0
- package/src/sources/rest.test.ts +104 -0
- package/src/sources/rest.ts +129 -0
- package/src/sources/schema-from-columns.test.ts +106 -0
- package/src/sources/schema-from-columns.ts +88 -0
- package/src/sources/supabase.test.ts +110 -0
- package/src/sources/supabase.ts +99 -0
- package/src/sources/with-entity-rules.test.ts +104 -0
- package/src/sources/with-entity-rules.ts +78 -0
- package/src/sources/with-relation-labels.test.ts +75 -0
- package/src/sources/with-relation-labels.ts +73 -0
- package/src/studio/bug-report.test.ts +101 -0
- package/src/studio/bug-report.ts +165 -0
- package/src/studio/cli.test.ts +187 -0
- package/src/studio/cli.ts +112 -0
- package/src/studio/csv.test.ts +90 -0
- package/src/studio/csv.ts +165 -0
- package/src/studio/db-connect-string.test.ts +94 -0
- package/src/studio/db-connect-string.ts +128 -0
- package/src/studio/emit-project.test.ts +923 -0
- package/src/studio/emit-project.ts +1273 -0
- package/src/studio/emit-schema.test.ts +94 -0
- package/src/studio/emit-schema.ts +920 -0
- package/src/studio/index.ts +195 -0
- package/src/studio/introspect-db.test.ts +186 -0
- package/src/studio/introspect-db.ts +312 -0
- package/src/studio/introspect-prisma.test.ts +99 -0
- package/src/studio/introspect-prisma.ts +175 -0
- package/src/studio/introspect.test.ts +172 -0
- package/src/studio/introspect.ts +310 -0
- package/src/studio/pipeline.test.ts +42 -0
- package/src/studio/project-robust.test.ts +157 -0
- package/src/studio/project.test.ts +473 -0
- package/src/studio/project.ts +916 -0
- package/src/studio/sample-data.test.ts +58 -0
- package/src/studio/sample-data.ts +200 -0
- package/src/studio/samples/ats.ts +202 -0
- package/src/studio/samples/clinic.ts +177 -0
- package/src/studio/samples/crm.ts +250 -0
- package/src/studio/samples/ecommerce.ts +187 -0
- package/src/studio/samples/events.ts +199 -0
- package/src/studio/samples/fleet.ts +184 -0
- package/src/studio/samples/gym.ts +213 -0
- package/src/studio/samples/hr.ts +193 -0
- package/src/studio/samples/index.ts +55 -0
- package/src/studio/samples/insurance.ts +195 -0
- package/src/studio/samples/inventory.ts +182 -0
- package/src/studio/samples/invoicing.ts +162 -0
- package/src/studio/samples/library.ts +180 -0
- package/src/studio/samples/live-data.test.ts +98 -0
- package/src/studio/samples/live-data.ts +308 -0
- package/src/studio/samples/projects.ts +190 -0
- package/src/studio/samples/realestate.ts +196 -0
- package/src/studio/samples/restaurant.ts +187 -0
- package/src/studio/samples/samples.test.ts +208 -0
- package/src/studio/samples/school.ts +197 -0
- package/src/studio/samples/seed-floor.test.ts +25 -0
- package/src/studio/samples/shared.ts +305 -0
- package/src/studio/samples/subscriptions.ts +183 -0
- package/src/studio/samples/support.ts +182 -0
- package/src/studio/scaffold-app.test.ts +91 -0
- package/src/studio/scaffold-app.ts +161 -0
- package/src/studio/scaffold.test.ts +178 -0
- package/src/studio/scaffold.ts +374 -0
- package/src/studio/themes.ts +172 -0
- package/src/studio/verify.test.ts +47 -0
- package/src/studio/verify.ts +79 -0
- package/src/sveltekit/in-memory.test.ts +104 -0
- package/src/sveltekit/in-memory.ts +129 -0
- package/src/sveltekit/index.ts +23 -0
- package/src/sveltekit/query-plan.test.ts +109 -0
- package/src/sveltekit/query-plan.ts +125 -0
- package/src/sveltekit/sql-source.test.ts +185 -0
- package/src/sveltekit/sql-source.ts +166 -0
- package/src/sveltekit/sql.test.ts +80 -0
- package/src/sveltekit/sql.ts +131 -0
- package/src/sveltekit/transport.test.ts +175 -0
- package/src/sveltekit/transport.ts +254 -0
- package/src/sveltekit/types.ts +11 -0
- package/src/upgrade-prompt.ts +149 -148
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
type MdRow = Record<string, unknown>
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" generics="TParent extends MdRow, TChild extends MdRow">
|
|
6
|
+
/**
|
|
7
|
+
* SvGridMasterDetail - expand a master row into a nested grid of related
|
|
8
|
+
* records. A feature of the grid's data stack (built on SvGrid's own
|
|
9
|
+
* `isDetailRow` / `renderDetailRow`), not a separate widget. Click a master
|
|
10
|
+
* row to expand or collapse its detail region.
|
|
11
|
+
*
|
|
12
|
+
* Minimal wire-up:
|
|
13
|
+
* <SvGridMasterDetail
|
|
14
|
+
* schema={orderSchema}
|
|
15
|
+
* data={orders}
|
|
16
|
+
* detailSchema={lineItemSchema}
|
|
17
|
+
* getChildren={(order) => lineItems.filter((li) => li.orderId === order.id)}
|
|
18
|
+
* />
|
|
19
|
+
*/
|
|
20
|
+
import { SvGrid } from '@svgrid/grid'
|
|
21
|
+
import { resolveIdField, schemaToColumns, type EntitySchema } from './schema'
|
|
22
|
+
import { buildDisplayRows, isDetailRow, toggleExpanded, type DetailRow } from './master-detail'
|
|
23
|
+
|
|
24
|
+
type Props = {
|
|
25
|
+
/** The master entity. */
|
|
26
|
+
schema: EntitySchema<TParent>
|
|
27
|
+
/** Master rows. */
|
|
28
|
+
data: ReadonlyArray<TParent>
|
|
29
|
+
/** The detail entity, rendered in the nested grid. */
|
|
30
|
+
detailSchema: EntitySchema<TChild>
|
|
31
|
+
/** Return the child rows for a given master row. */
|
|
32
|
+
getChildren: (parent: TParent) => ReadonlyArray<TChild>
|
|
33
|
+
/** Height of the outer grid. Default 320. */
|
|
34
|
+
containerHeight?: number | string
|
|
35
|
+
/** Height of each nested detail grid. Default 200. */
|
|
36
|
+
detailHeight?: number | string
|
|
37
|
+
/** When set, a parent row click calls this (with the row id) to drill into a
|
|
38
|
+
* detail page, instead of expanding the inline child grid. */
|
|
39
|
+
onParentClick?: (id: string) => void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let {
|
|
43
|
+
schema,
|
|
44
|
+
data,
|
|
45
|
+
detailSchema,
|
|
46
|
+
getChildren,
|
|
47
|
+
containerHeight = 320,
|
|
48
|
+
detailHeight = 200,
|
|
49
|
+
onParentClick,
|
|
50
|
+
}: Props = $props()
|
|
51
|
+
|
|
52
|
+
const parentIdOf = (p: TParent) => String(p[resolveIdField(schema)])
|
|
53
|
+
const columns = $derived(schemaToColumns(schema))
|
|
54
|
+
const detailColumns = $derived(schemaToColumns(detailSchema))
|
|
55
|
+
|
|
56
|
+
let expanded = $state<Set<string>>(new Set())
|
|
57
|
+
// Detail rows are woven in; SvGrid renders them full-width via isDetailRow.
|
|
58
|
+
const displayRows = $derived(buildDisplayRows(data, expanded, parentIdOf) as unknown as TParent[])
|
|
59
|
+
|
|
60
|
+
function handleRowClick(row: unknown) {
|
|
61
|
+
if (isDetailRow(row)) return
|
|
62
|
+
// When wired to a detail page, a parent row navigates there (the detail page
|
|
63
|
+
// shows this record's children); otherwise it expands the child grid inline.
|
|
64
|
+
if (onParentClick) { onParentClick(parentIdOf(row as TParent)); return }
|
|
65
|
+
expanded = toggleExpanded(expanded, parentIdOf(row as TParent))
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<SvGrid
|
|
70
|
+
data={displayRows}
|
|
71
|
+
{columns}
|
|
72
|
+
{containerHeight}
|
|
73
|
+
virtualization={false}
|
|
74
|
+
isDetailRow={(row) => isDetailRow(row)}
|
|
75
|
+
onRowClick={(e) => handleRowClick(e.row)}
|
|
76
|
+
>
|
|
77
|
+
{#snippet renderDetailRow({ row })}
|
|
78
|
+
{@const parent = (row as unknown as DetailRow<TParent>).parent}
|
|
79
|
+
<div class="sv-md-detail">
|
|
80
|
+
<SvGrid data={getChildren(parent)} columns={detailColumns} containerHeight={detailHeight} />
|
|
81
|
+
</div>
|
|
82
|
+
{/snippet}
|
|
83
|
+
</SvGrid>
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
.sv-md-detail {
|
|
87
|
+
padding: 10px 12px;
|
|
88
|
+
/* Fall back to the themed header surface (not a fixed light grey) so the
|
|
89
|
+
detail region tracks light/dark - `--sg-bg-subtle` is unset by default,
|
|
90
|
+
which used to leave this white on every dark theme. */
|
|
91
|
+
background: var(--sg-bg-subtle, var(--sg-header-bg, #f8fafc));
|
|
92
|
+
color: var(--sg-fg, inherit);
|
|
93
|
+
border-left: 3px solid var(--sg-accent, #2563eb);
|
|
94
|
+
}
|
|
95
|
+
</style>
|