@graphenedata/cli 0.0.13 → 0.0.14
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/cli/cli.js +8591 -1214
- package/dist/docs/base.md +98 -0
- package/dist/docs/cli.md +22 -0
- package/dist/docs/graphene.md +10 -10
- package/dist/ui/component-utilities/echarts.js +2 -3
- package/dist/ui/component-utilities/formatting.js +3 -11
- package/dist/ui/component-utilities/getSeriesConfig.js +2 -1
- package/dist/ui/components/Area.svelte +188 -151
- package/dist/ui/components/AreaChart.svelte +43 -79
- package/dist/ui/components/Bar.svelte +273 -255
- package/dist/ui/components/BarChart.svelte +58 -112
- package/dist/ui/components/BigValue.svelte +13 -7
- package/dist/ui/components/Chart.svelte +280 -317
- package/dist/ui/components/Column.svelte +102 -113
- package/dist/ui/components/DateRange.svelte +37 -27
- package/dist/ui/components/Dropdown.svelte +77 -57
- package/dist/ui/components/DropdownOption.svelte +10 -7
- package/dist/ui/components/ECharts.svelte +23 -16
- package/dist/ui/components/ErrorChart.svelte +85 -21
- package/dist/ui/components/GrapheneQuery.svelte +7 -3
- package/dist/ui/components/InlineDelta.svelte +53 -34
- package/dist/ui/components/Line.svelte +192 -178
- package/dist/ui/components/LineChart.svelte +53 -96
- package/dist/ui/components/PieChart.svelte +26 -15
- package/dist/ui/components/QueryLoad.svelte +15 -10
- package/dist/ui/components/SortIcon.svelte +5 -1
- package/dist/ui/components/Table.svelte +15 -9
- package/dist/ui/components/TableCell.svelte +30 -17
- package/dist/ui/components/TableGroupRow.svelte +26 -19
- package/dist/ui/components/TableGroupToggle.svelte +9 -6
- package/dist/ui/components/TableHeader.svelte +37 -27
- package/dist/ui/components/TableRow.svelte +30 -20
- package/dist/ui/components/TableSubtotalRow.svelte +16 -9
- package/dist/ui/components/TableTotalRow.svelte +18 -11
- package/dist/ui/components/TextInput.svelte +23 -20
- package/dist/ui/components/_Table.svelte +303 -260
- package/dist/ui/internal/LocalApp.svelte +40 -0
- package/dist/ui/internal/NavSidebar.svelte +27 -30
- package/dist/ui/internal/PageError.svelte +23 -0
- package/dist/ui/internal/checkSocket.ts +48 -0
- package/dist/ui/internal/queryEngine.ts +9 -2
- package/dist/ui/internal/telemetry.ts +1 -0
- package/dist/ui/web.js +5 -55
- package/package.json +8 -9
- package/dist/ui/internal/NavSidebarHMR.svelte +0 -8
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import {onDestroy, onMount, type Snippet} from 'svelte'
|
|
2
3
|
import ErrorChart from './ErrorChart.svelte'
|
|
3
|
-
import {onDestroy, onMount} from 'svelte'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interface Props {
|
|
6
|
+
data: string | {rows?: any[]}
|
|
7
|
+
height?: number
|
|
8
|
+
fields?: Record<string, string | string[]>
|
|
9
|
+
children?: Snippet<[any[]]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {data, height = 200, fields = {}, children}: Props = $props()
|
|
8
13
|
|
|
9
|
-
let errors: Error[] | null = null
|
|
10
|
-
let loaded: any[] | null = null
|
|
14
|
+
let errors: Error[] | null = $state(null)
|
|
15
|
+
let loaded: any[] | null = $state(null)
|
|
11
16
|
|
|
12
|
-
let handleResults = (result) => {
|
|
17
|
+
let handleResults = (result: any) => {
|
|
13
18
|
errors = result.errors || null
|
|
14
19
|
loaded = result.rows
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
onMount(() => {
|
|
18
23
|
if (typeof data !== 'string') {
|
|
19
|
-
loaded = data.rows
|
|
24
|
+
loaded = data.rows ?? null
|
|
20
25
|
} else {
|
|
21
26
|
let usedFields = Object.fromEntries(Object.entries(fields).filter(e => !!e[1]))
|
|
22
27
|
window.$GRAPHENE.query(data, usedFields, handleResults)
|
|
@@ -32,12 +37,12 @@
|
|
|
32
37
|
<ErrorChart title="Error" error={errors[0]} />
|
|
33
38
|
{:else if !loaded}
|
|
34
39
|
<div class='ql-skeleton' style={`height:${height}px`} role="status" aria-live="polite">
|
|
35
|
-
<span class="ql-skeleton__pulse"
|
|
40
|
+
<span class="ql-skeleton__pulse"></span>
|
|
36
41
|
</div>
|
|
37
42
|
{:else if loaded.length == 0}
|
|
38
43
|
<div class="empty-chart" role="note">Dataset is empty - query ran successfully, but no data was returned from the database</div>
|
|
39
44
|
{:else}
|
|
40
|
-
|
|
45
|
+
{@render children?.(loaded)}
|
|
41
46
|
{/if}
|
|
42
47
|
|
|
43
48
|
<style>
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type {Snippet} from 'svelte'
|
|
2
3
|
import QueryLoad from './QueryLoad.svelte'
|
|
3
4
|
import TableInner from './_Table.svelte'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
data: string
|
|
8
|
+
children?: Snippet
|
|
9
|
+
[key: string]: unknown
|
|
10
|
+
}
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
let {data, children, ...restProps}: Props = $props()
|
|
13
|
+
|
|
14
|
+
let spreadProps = $derived(Object.fromEntries(Object.entries(restProps).filter(([, value]) => value !== undefined)))
|
|
9
15
|
</script>
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
{#if
|
|
13
|
-
<TableInner {...spreadProps} data={loaded}
|
|
14
|
-
<slot />
|
|
15
|
-
</TableInner>
|
|
17
|
+
{#snippet tableContent(loaded: any[])}
|
|
18
|
+
{#if children}
|
|
19
|
+
<TableInner {...spreadProps} data={loaded} {children} />
|
|
16
20
|
{:else}
|
|
17
21
|
<TableInner {...spreadProps} data={loaded} />
|
|
18
22
|
{/if}
|
|
19
|
-
|
|
23
|
+
{/snippet}
|
|
24
|
+
|
|
25
|
+
<QueryLoad {data} children={tableContent} />
|
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import type {Snippet} from 'svelte'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
dataType?: string
|
|
6
|
+
align?: string
|
|
7
|
+
height?: string | number
|
|
8
|
+
width?: string | number
|
|
9
|
+
wrap?: boolean
|
|
10
|
+
verticalAlign?: 'top' | 'middle' | 'bottom' | string
|
|
11
|
+
rowSpan?: number
|
|
12
|
+
colSpan?: number
|
|
13
|
+
show?: boolean
|
|
14
|
+
cellColor?: string
|
|
15
|
+
fontColor?: string
|
|
16
|
+
topBorder?: string
|
|
17
|
+
paddingLeft?: string
|
|
18
|
+
borderBottom?: string
|
|
19
|
+
compact?: boolean
|
|
20
|
+
class?: string
|
|
21
|
+
children?: Snippet
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let {
|
|
25
|
+
dataType = undefined, align = undefined, height = undefined, width = undefined, wrap = undefined,
|
|
26
|
+
verticalAlign = 'middle', rowSpan = 1, colSpan = 1, show = true, cellColor = undefined,
|
|
27
|
+
fontColor = undefined, topBorder = undefined, paddingLeft = undefined, borderBottom = undefined,
|
|
28
|
+
compact = false, class: className = undefined, children,
|
|
29
|
+
}: Props = $props()
|
|
17
30
|
</script>
|
|
18
31
|
|
|
19
32
|
<td
|
|
20
33
|
role="cell"
|
|
21
34
|
rowspan={rowSpan}
|
|
22
35
|
colspan={colSpan}
|
|
23
|
-
class={`table-cell ${dataType ?? ''} ${compact ? 'table-cell--compact' : ''} ${topBorder ?? ''} ${
|
|
36
|
+
class={`table-cell ${dataType ?? ''} ${compact ? 'table-cell--compact' : ''} ${topBorder ?? ''} ${className ?? ''}`.trim()}
|
|
24
37
|
style:text-align={align}
|
|
25
38
|
style:height={height}
|
|
26
39
|
style:width={width}
|
|
@@ -33,7 +46,7 @@
|
|
|
33
46
|
style:border-top={topBorder}
|
|
34
47
|
style:border-bottom={borderBottom}
|
|
35
48
|
>
|
|
36
|
-
|
|
49
|
+
{@render children?.()}
|
|
37
50
|
</td>
|
|
38
51
|
|
|
39
52
|
<style>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {createEventDispatcher} from 'svelte'
|
|
3
2
|
import TableCell from './TableCell.svelte'
|
|
4
3
|
import TableGroupToggle from './TableGroupToggle.svelte'
|
|
5
4
|
import InlineDelta from './InlineDelta.svelte'
|
|
@@ -7,22 +6,30 @@
|
|
|
7
6
|
import {formatValue, getFormatObjectFromString} from '../component-utilities/formatting.js'
|
|
8
7
|
import {toBoolean} from '../component-utilities/convert'
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
interface Props {
|
|
10
|
+
groupName: string
|
|
11
|
+
currentGroupData?: any[]
|
|
12
|
+
toggled?: boolean
|
|
13
|
+
columnSummary?: any[]
|
|
14
|
+
rowNumbers?: boolean | string
|
|
15
|
+
rowColor?: string
|
|
16
|
+
subtotals?: boolean | string
|
|
17
|
+
orderedColumns?: any[]
|
|
18
|
+
compact?: boolean | string
|
|
19
|
+
onToggle?: (detail: {groupName: string}) => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
groupName, currentGroupData = [], toggled = true, columnSummary = [],
|
|
24
|
+
rowNumbers: rowNumbersProp = undefined, rowColor = undefined, subtotals: subtotalsProp = true,
|
|
25
|
+
orderedColumns = [], compact: compactProp = undefined, onToggle,
|
|
26
|
+
}: Props = $props()
|
|
19
27
|
|
|
20
|
-
rowNumbers = toBoolean(
|
|
21
|
-
subtotals = toBoolean(
|
|
22
|
-
compact = toBoolean(
|
|
28
|
+
let rowNumbers = $derived(toBoolean(rowNumbersProp) ?? false)
|
|
29
|
+
let subtotals = $derived(toBoolean(subtotalsProp) ?? true)
|
|
30
|
+
let compact = $derived(toBoolean(compactProp))
|
|
23
31
|
|
|
24
|
-
const
|
|
25
|
-
const toggleGroup = () => dispatch('toggle', {groupName})
|
|
32
|
+
const toggleGroup = () => onToggle?.({groupName})
|
|
26
33
|
|
|
27
34
|
const handleKeydown = (event: KeyboardEvent) => {
|
|
28
35
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -31,7 +38,7 @@
|
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
|
|
34
|
-
const resolveFormat = (column, summary) => {
|
|
41
|
+
const resolveFormat = (column: any, summary: any) => {
|
|
35
42
|
if (column.subtotalFmt) return getFormatObjectFromString(column.subtotalFmt)
|
|
36
43
|
if (column.totalFmt) return getFormatObjectFromString(column.totalFmt)
|
|
37
44
|
if (column.fmt) return getFormatObjectFromString(column.fmt, summary.format?.valueType)
|
|
@@ -42,8 +49,8 @@
|
|
|
42
49
|
<tr
|
|
43
50
|
class="group-row"
|
|
44
51
|
tabindex="0"
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
onclick={toggleGroup}
|
|
53
|
+
onkeydown={handleKeydown}
|
|
47
54
|
style:background-color={rowColor}
|
|
48
55
|
>
|
|
49
56
|
{#if rowNumbers}
|
|
@@ -97,7 +104,7 @@
|
|
|
97
104
|
{/if}
|
|
98
105
|
</TableCell>
|
|
99
106
|
{:else}
|
|
100
|
-
<TableCell
|
|
107
|
+
<TableCell></TableCell>
|
|
101
108
|
{/if}
|
|
102
109
|
{/each}
|
|
103
110
|
</tr>
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {getThemeStores} from '../component-utilities/themeStores'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
interface Props {
|
|
5
|
+
toggled?: boolean
|
|
6
|
+
color?: string
|
|
7
|
+
size?: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let {toggled = false, color = undefined, size = 10}: Props = $props()
|
|
7
11
|
|
|
8
12
|
const {theme, resolveColor} = getThemeStores()
|
|
9
|
-
let colorStore = resolveColor(color)
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
let colorStore = $derived(resolveColor(color))
|
|
15
|
+
let fill = $derived($colorStore ?? $theme.colors['base-content'])
|
|
13
16
|
</script>
|
|
14
17
|
|
|
15
18
|
<span aria-expanded={toggled} class="group-toggle">
|
|
@@ -3,24 +3,33 @@
|
|
|
3
3
|
import {safeExtractColumn} from '../component-utilities/tableUtils'
|
|
4
4
|
import {toBoolean} from '../component-utilities/convert'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
rowNumbers?: boolean | string
|
|
8
|
+
headerColor?: string
|
|
9
|
+
headerFontColor?: string
|
|
10
|
+
orderedColumns?: any[]
|
|
11
|
+
columnSummary?: any[]
|
|
12
|
+
sortable?: boolean | string
|
|
13
|
+
sortClick?: (columnId: string) => () => void
|
|
14
|
+
formatColumnTitles?: boolean | string
|
|
15
|
+
sortObj?: {col: string | null; ascending: boolean | null}
|
|
16
|
+
wrapTitles?: boolean | string
|
|
17
|
+
compact?: boolean | string
|
|
18
|
+
link?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
rowNumbers: rowNumbersProp = false, headerColor = undefined, headerFontColor = undefined,
|
|
23
|
+
orderedColumns = [], columnSummary = [], sortable: sortableProp = true, sortClick = () => () => {},
|
|
24
|
+
formatColumnTitles: formatColumnTitlesProp = true, sortObj = {col: null, ascending: null},
|
|
25
|
+
wrapTitles: wrapTitlesProp = false, compact: compactProp = false, link = undefined,
|
|
26
|
+
}: Props = $props()
|
|
27
|
+
|
|
28
|
+
let rowNumbers = $derived(toBoolean(rowNumbersProp) ?? false)
|
|
29
|
+
let sortable = $derived(toBoolean(sortableProp) ?? true)
|
|
30
|
+
let formatColumnTitles = $derived(toBoolean(formatColumnTitlesProp) ?? true)
|
|
31
|
+
let wrapTitles = $derived(toBoolean(wrapTitlesProp) ?? false)
|
|
32
|
+
let compact = $derived(toBoolean(compactProp) ?? false)
|
|
24
33
|
|
|
25
34
|
const getWrapTitleAlignment = (column: any) => {
|
|
26
35
|
if (column.align === 'right') return 'header-title--align-end'
|
|
@@ -30,8 +39,8 @@
|
|
|
30
39
|
return 'header-title--align-start'
|
|
31
40
|
}
|
|
32
41
|
|
|
33
|
-
const computeGroupSpans = () => {
|
|
34
|
-
return
|
|
42
|
+
const computeGroupSpans = (columns: any[]) => {
|
|
43
|
+
return columns.map((column, index, array) => {
|
|
35
44
|
let isNewGroup = index === 0 || column.colGroup !== array[index - 1].colGroup
|
|
36
45
|
let span = 1
|
|
37
46
|
if (column.colGroup) {
|
|
@@ -52,14 +61,15 @@
|
|
|
52
61
|
return summary.id
|
|
53
62
|
}
|
|
54
63
|
|
|
55
|
-
|
|
64
|
+
let columnsWithGroupSpan = $derived(computeGroupSpans(orderedColumns))
|
|
65
|
+
let hasColumnGroups = $derived(orderedColumns.some((col) => col.colGroup))
|
|
56
66
|
</script>
|
|
57
67
|
|
|
58
68
|
<thead>
|
|
59
|
-
{#if
|
|
69
|
+
{#if hasColumnGroups}
|
|
60
70
|
<tr class="header-group-row" style:background-color={headerColor}>
|
|
61
71
|
{#if rowNumbers}
|
|
62
|
-
<th class={`header-index ${compact ? 'header-index--compact' : ''}`} style:background-color={headerColor}
|
|
72
|
+
<th class={`header-index ${compact ? 'header-index--compact' : ''}`} style:background-color={headerColor}></th>
|
|
63
73
|
{/if}
|
|
64
74
|
{#each columnsWithGroupSpan as column (column.id)}
|
|
65
75
|
{#if column.colGroup && column.isNewGroup}
|
|
@@ -67,11 +77,11 @@
|
|
|
67
77
|
<div class="header-group__label">{column.colGroup}</div>
|
|
68
78
|
</th>
|
|
69
79
|
{:else}
|
|
70
|
-
<th class="header-group--spacer"
|
|
80
|
+
<th class="header-group--spacer"></th>
|
|
71
81
|
{/if}
|
|
72
82
|
{/each}
|
|
73
83
|
{#if link}
|
|
74
|
-
<th class="header-group--spacer"
|
|
84
|
+
<th class="header-group--spacer"></th>
|
|
75
85
|
{/if}
|
|
76
86
|
</tr>
|
|
77
87
|
{/if}
|
|
@@ -83,7 +93,7 @@
|
|
|
83
93
|
class={`header-index ${compact ? 'header-index--compact' : ''}`}
|
|
84
94
|
style:background-color={headerColor}
|
|
85
95
|
style:color={headerFontColor}
|
|
86
|
-
|
|
96
|
+
></th>
|
|
87
97
|
{/if}
|
|
88
98
|
{#each orderedColumns as column (column.id)}
|
|
89
99
|
{@const summary = safeExtractColumn(column, columnSummary)}
|
|
@@ -94,7 +104,7 @@
|
|
|
94
104
|
style:background={headerColor}
|
|
95
105
|
style:text-align={column.align ?? (['sparkline', 'sparkbar', 'sparkarea', 'bar'].includes(column.contentType) ? 'center' : undefined)}
|
|
96
106
|
style:cursor={sortable ? 'pointer' : 'auto'}
|
|
97
|
-
|
|
107
|
+
onclick={sortable ? sortClick(column.id) : undefined}
|
|
98
108
|
aria-sort={getAriaSortValue(column.id)}
|
|
99
109
|
>
|
|
100
110
|
<div class={`header-title ${wrapTitles || column.wrapTitle ? 'header-title--wrap' : ''} ${wrapTitles || column.wrapTitle ? getWrapTitleAlignment(column) : ''}`.trim()}>
|
|
@@ -6,20 +6,29 @@
|
|
|
6
6
|
import {formatValue, getFormatObjectFromString} from '../component-utilities/formatting.js'
|
|
7
7
|
import {getThemeStores} from '../component-utilities/themeStores'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
interface Props {
|
|
10
|
+
displayedData?: any[]
|
|
11
|
+
rowShading?: boolean | string
|
|
12
|
+
link?: string
|
|
13
|
+
rowNumbers?: boolean | string
|
|
14
|
+
rowLines?: boolean | string
|
|
15
|
+
index?: number
|
|
16
|
+
columnSummary?: any[]
|
|
17
|
+
grouped?: boolean
|
|
18
|
+
groupType?: 'accordion' | 'section'
|
|
19
|
+
groupColumn?: string
|
|
20
|
+
rowSpan?: number
|
|
21
|
+
groupNamePosition?: 'top' | 'middle' | 'bottom'
|
|
22
|
+
orderedColumns?: any[]
|
|
23
|
+
compact?: boolean | string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
displayedData = [], rowShading: rowShadingProp = undefined, link = undefined,
|
|
28
|
+
rowNumbers: rowNumbersProp = undefined, rowLines: rowLinesProp = undefined, index = 0,
|
|
29
|
+
columnSummary = [], grouped = false, groupType = undefined, groupColumn = undefined,
|
|
30
|
+
rowSpan = 1, groupNamePosition = 'middle', orderedColumns = [], compact: compactProp = undefined,
|
|
31
|
+
}: Props = $props()
|
|
23
32
|
|
|
24
33
|
const {theme} = getThemeStores()
|
|
25
34
|
|
|
@@ -29,7 +38,8 @@
|
|
|
29
38
|
columnMax: number | undefined,
|
|
30
39
|
) => {
|
|
31
40
|
if (!column?.colorScale || !column?.colorScale.length) return undefined
|
|
32
|
-
|
|
41
|
+
let hasBreakpoints = Array.isArray(column.colorBreakpoints) && column.colorBreakpoints.length >= 2
|
|
42
|
+
if (!hasBreakpoints && (!hasFiniteNumber(columnMin) || !hasFiniteNumber(columnMax) || columnMin === columnMax)) return undefined
|
|
33
43
|
|
|
34
44
|
let rawDomain
|
|
35
45
|
if (Array.isArray(column.colorBreakpoints) && column.colorBreakpoints.length) {
|
|
@@ -66,10 +76,10 @@
|
|
|
66
76
|
return Boolean(val)
|
|
67
77
|
}
|
|
68
78
|
|
|
69
|
-
rowShading = toBool(
|
|
70
|
-
rowNumbers = toBool(
|
|
71
|
-
rowLines = toBool(
|
|
72
|
-
compact = toBool(
|
|
79
|
+
let rowShading = $derived(toBool(rowShadingProp))
|
|
80
|
+
let rowNumbers = $derived(toBool(rowNumbersProp))
|
|
81
|
+
let rowLines = $derived(toBool(rowLinesProp ?? true))
|
|
82
|
+
let compact = $derived(toBool(compactProp))
|
|
73
83
|
|
|
74
84
|
const isExternalUrl = (url: string) => {
|
|
75
85
|
try {
|
|
@@ -105,7 +115,7 @@
|
|
|
105
115
|
class:table-row--shaded={shaded}
|
|
106
116
|
class:table-row--lined={rowLines}
|
|
107
117
|
class:table-row--clickable={clickable}
|
|
108
|
-
|
|
118
|
+
onclick={(event) => clickable && navigateToLink(row, event)}
|
|
109
119
|
>
|
|
110
120
|
{#if rowNumbers && groupType !== 'section'}
|
|
111
121
|
<TableCell class="index" {compact}>
|
|
@@ -4,15 +4,22 @@
|
|
|
4
4
|
import {formatValue, getFormatObjectFromString} from '../component-utilities/formatting.js'
|
|
5
5
|
import TableCell from './TableCell.svelte'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
interface Props {
|
|
8
|
+
groupName?: string
|
|
9
|
+
currentGroupData?: any[]
|
|
10
|
+
columnSummary?: any[]
|
|
11
|
+
rowColor?: string
|
|
12
|
+
groupBy?: string
|
|
13
|
+
groupType?: 'accordion' | 'section'
|
|
14
|
+
fontColor?: string
|
|
15
|
+
orderedColumns?: any[]
|
|
16
|
+
compact?: boolean | string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
groupName = undefined, currentGroupData = [], columnSummary = [], rowColor = undefined,
|
|
21
|
+
groupBy = undefined, groupType = undefined, fontColor = undefined, orderedColumns = [], compact = undefined,
|
|
22
|
+
}: Props = $props()
|
|
16
23
|
</script>
|
|
17
24
|
|
|
18
25
|
<tr class="subtotal-row" style:background-color={rowColor} style:color={fontColor}>
|
|
@@ -4,14 +4,21 @@
|
|
|
4
4
|
import {safeExtractColumn, weightedMean} from '../component-utilities/tableUtils'
|
|
5
5
|
import {formatValue, getFormatObjectFromString} from '../component-utilities/formatting.js'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
interface Props {
|
|
8
|
+
data?: any[]
|
|
9
|
+
rowNumbers?: boolean | string
|
|
10
|
+
columnSummary?: any[]
|
|
11
|
+
rowColor?: string
|
|
12
|
+
fontColor?: string
|
|
13
|
+
groupType?: 'accordion' | 'section'
|
|
14
|
+
orderedColumns?: any[]
|
|
15
|
+
compact?: boolean | string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
data = [], rowNumbers: rowNumbersProp = undefined, columnSummary = [], rowColor = undefined,
|
|
20
|
+
fontColor = undefined, groupType = undefined, orderedColumns = [], compact: compactProp = undefined,
|
|
21
|
+
}: Props = $props()
|
|
15
22
|
|
|
16
23
|
const toBool = (value: boolean | string | undefined) => {
|
|
17
24
|
if (value === undefined) return false
|
|
@@ -23,13 +30,13 @@
|
|
|
23
30
|
return Boolean(value)
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
rowNumbers = toBool(
|
|
27
|
-
compact = toBool(
|
|
33
|
+
let rowNumbers = $derived(toBool(rowNumbersProp))
|
|
34
|
+
let compact = $derived(toBool(compactProp))
|
|
28
35
|
</script>
|
|
29
36
|
|
|
30
37
|
<tr class="total-row" style:background-color={rowColor} style:color={fontColor}>
|
|
31
38
|
{#if rowNumbers && groupType !== 'section'}
|
|
32
|
-
<TableCell class="index" {compact} topBorder="1px solid rgba(107, 114, 128, 0.5)"
|
|
39
|
+
<TableCell class="index" {compact} topBorder="1px solid rgba(107, 114, 128, 0.5)"></TableCell>
|
|
33
40
|
{/if}
|
|
34
41
|
|
|
35
42
|
{#each orderedColumns as column (column.id)}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {onMount} from 'svelte'
|
|
3
2
|
import {toBoolean} from '../component-utilities/inputUtils'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
interface Props {
|
|
5
|
+
name: string
|
|
6
|
+
title?: string
|
|
7
|
+
label?: string
|
|
8
|
+
description?: string
|
|
9
|
+
placeholder?: string
|
|
10
|
+
defaultValue?: string
|
|
11
|
+
hideDuringPrint?: boolean | string
|
|
12
|
+
unsafe?: boolean | string
|
|
13
|
+
}
|
|
13
14
|
|
|
14
|
-
let
|
|
15
|
+
let {
|
|
16
|
+
name, title = undefined, label = undefined, description = undefined,
|
|
17
|
+
placeholder = 'Type to search', defaultValue = undefined, hideDuringPrint = true, unsafe = false,
|
|
18
|
+
}: Props = $props()
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
$: displayLabel = title || label
|
|
20
|
+
// svelte-ignore state_referenced_locally - intentionally capturing initial value only
|
|
21
|
+
let value = $state(defaultValue ?? '')
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
let hidePrint = $derived(toBoolean(hideDuringPrint))
|
|
24
|
+
let allowUnsafe = $derived(toBoolean(unsafe))
|
|
25
|
+
let displayLabel = $derived(title || label)
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
// Push value changes to parent
|
|
28
|
+
$effect(() => {
|
|
26
29
|
pushValue(value)
|
|
27
|
-
}
|
|
30
|
+
})
|
|
28
31
|
|
|
29
32
|
function sanitize (input: string): string {
|
|
30
33
|
if (allowUnsafe) return input
|
|
@@ -57,7 +60,7 @@
|
|
|
57
60
|
type="text"
|
|
58
61
|
value={value}
|
|
59
62
|
placeholder={placeholder}
|
|
60
|
-
|
|
63
|
+
oninput={onInput}
|
|
61
64
|
/>
|
|
62
65
|
</div>
|
|
63
66
|
|