@graphenedata/cli 0.0.14 → 0.0.16
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/LICENSE.md +3 -3
- package/README.md +138 -0
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/bin.js +2 -2
- package/dist/cli/bigQuery-I3F46SC6.js +75 -0
- package/dist/cli/bigQuery-I3F46SC6.js.map +7 -0
- package/dist/cli/chunk-OVWODUTJ.js +12849 -0
- package/dist/cli/chunk-OVWODUTJ.js.map +7 -0
- package/dist/cli/chunk-QAXEOZ43.js +53 -0
- package/dist/cli/chunk-QAXEOZ43.js.map +7 -0
- package/dist/cli/cli.js +245 -10290
- package/dist/cli/clickhouse-ZN5AN2UL.js +64 -0
- package/dist/cli/clickhouse-ZN5AN2UL.js.map +7 -0
- package/dist/cli/duckdb-IYBIO5KJ.js +87 -0
- package/dist/cli/duckdb-IYBIO5KJ.js.map +7 -0
- package/dist/cli/serve2-TNN5EROW.js +447 -0
- package/dist/cli/serve2-TNN5EROW.js.map +7 -0
- package/dist/cli/snowflake-MOQB5GA4.js +128 -0
- package/dist/cli/snowflake-MOQB5GA4.js.map +7 -0
- package/dist/index.d.ts +63 -0
- package/dist/lang/index.d.ts +63 -0
- package/dist/skills/graphene/SKILL.md +235 -0
- package/dist/skills/graphene/references/big-value.md +20 -0
- package/dist/skills/graphene/references/date-range.md +64 -0
- package/dist/skills/graphene/references/dropdown.md +62 -0
- package/dist/skills/graphene/references/echarts.md +162 -0
- package/dist/skills/graphene/references/gsql.md +393 -0
- package/dist/skills/graphene/references/model-gsql.md +72 -0
- package/dist/skills/graphene/references/table.md +143 -0
- package/dist/skills/graphene/references/text-input.md +29 -0
- package/dist/ui/app.css +263 -299
- package/dist/ui/component-utilities/dataShaping.ts +484 -0
- package/dist/ui/component-utilities/dataSummary.ts +57 -0
- package/dist/ui/component-utilities/enrich.ts +763 -0
- package/dist/ui/component-utilities/format.ts +177 -0
- package/dist/ui/component-utilities/inputUtils.ts +48 -9
- package/dist/ui/component-utilities/theme.ts +200 -0
- package/dist/ui/component-utilities/themeStores.ts +26 -21
- package/dist/ui/component-utilities/types.ts +70 -0
- package/dist/ui/components/AreaChart.svelte +57 -105
- package/dist/ui/components/BarChart.svelte +71 -129
- package/dist/ui/components/BigValue.svelte +24 -40
- package/dist/ui/components/Column.svelte +11 -19
- package/dist/ui/components/DateRange.svelte +71 -34
- package/dist/ui/components/Dropdown.svelte +82 -49
- package/dist/ui/components/DropdownOption.svelte +1 -2
- package/dist/ui/components/ECharts.svelte +179 -60
- package/dist/ui/components/InlineDelta.svelte +51 -32
- package/dist/ui/components/LineChart.svelte +54 -125
- package/dist/ui/components/PieChart.svelte +27 -37
- package/dist/ui/components/QueryLoad.svelte +78 -44
- package/dist/ui/components/Row.svelte +2 -1
- package/dist/ui/components/ScatterPlot.svelte +52 -0
- package/dist/ui/components/Skeleton.svelte +32 -0
- package/dist/ui/components/Table.svelte +3 -2
- package/dist/ui/components/TableGroupRow.svelte +28 -36
- package/dist/ui/components/TableHarness.svelte +32 -0
- package/dist/ui/components/TableHeader.svelte +34 -59
- package/dist/ui/components/TableRow.svelte +15 -39
- package/dist/ui/components/TableSubtotalRow.svelte +26 -21
- package/dist/ui/components/TableTotalRow.svelte +27 -37
- package/dist/ui/components/TextInput.svelte +17 -14
- package/dist/ui/components/Value.svelte +25 -0
- package/dist/ui/components/_Table.svelte +80 -76
- package/dist/ui/internal/ChartGallery.svelte +527 -0
- package/dist/ui/internal/ErrorDisplay.svelte +60 -0
- package/dist/ui/internal/LocalApp.svelte +87 -19
- package/dist/ui/internal/PageNavGroup.svelte +269 -0
- package/dist/ui/internal/Sidebar.svelte +178 -0
- package/dist/ui/internal/SidebarToggle.svelte +47 -0
- package/dist/ui/internal/StyleGallery.svelte +244 -0
- package/dist/ui/internal/clientCache.ts +15 -13
- package/dist/ui/internal/pageInputs.svelte.js +292 -0
- package/dist/ui/internal/queryEngine.ts +124 -132
- package/dist/ui/internal/runSocket.ts +59 -0
- package/dist/ui/internal/sidebar.svelte.js +18 -0
- package/dist/ui/internal/telemetry.ts +52 -17
- package/dist/ui/internal/types.d.ts +7 -0
- package/dist/ui/web.js +55 -13
- package/package.json +40 -41
- package/dist/docs/agent-instructions.md +0 -18
- package/dist/docs/base.md +0 -98
- package/dist/docs/cli.md +0 -22
- package/dist/docs/graphene.md +0 -1462
- package/dist/ui/component-utilities/autoFormatting.js +0 -301
- package/dist/ui/component-utilities/builtInFormats.js +0 -482
- package/dist/ui/component-utilities/chartContext.js +0 -12
- package/dist/ui/component-utilities/chartWindowDebug.js +0 -21
- package/dist/ui/component-utilities/checkInputs.js +0 -95
- package/dist/ui/component-utilities/convert.js +0 -15
- package/dist/ui/component-utilities/dateParsing.js +0 -57
- package/dist/ui/component-utilities/dropdownContext.ts +0 -1
- package/dist/ui/component-utilities/echarts.js +0 -272
- package/dist/ui/component-utilities/echartsThemes.js +0 -453
- package/dist/ui/component-utilities/formatTitle.js +0 -24
- package/dist/ui/component-utilities/formatting.js +0 -250
- package/dist/ui/component-utilities/getColumnExtents.js +0 -79
- package/dist/ui/component-utilities/getColumnSummary.js +0 -67
- package/dist/ui/component-utilities/getCompletedData.js +0 -114
- package/dist/ui/component-utilities/getDistinctCount.js +0 -7
- package/dist/ui/component-utilities/getDistinctValues.js +0 -15
- package/dist/ui/component-utilities/getSeriesConfig.js +0 -237
- package/dist/ui/component-utilities/getSortedData.js +0 -7
- package/dist/ui/component-utilities/getStackPercentages.js +0 -43
- package/dist/ui/component-utilities/getStackedData.js +0 -17
- package/dist/ui/component-utilities/getYAxisIndex.js +0 -15
- package/dist/ui/component-utilities/globalContexts.js +0 -1
- package/dist/ui/component-utilities/helpers/getCompletedData.helpers.js +0 -119
- package/dist/ui/component-utilities/replaceNulls.js +0 -14
- package/dist/ui/component-utilities/tableUtils.ts +0 -120
- package/dist/ui/components/Area.svelte +0 -214
- package/dist/ui/components/Bar.svelte +0 -350
- package/dist/ui/components/Chart.svelte +0 -989
- package/dist/ui/components/ErrorChart.svelte +0 -118
- package/dist/ui/components/Line.svelte +0 -227
- package/dist/ui/internal/NavSidebar.svelte +0 -396
- package/dist/ui/internal/PageError.svelte +0 -23
- package/dist/ui/internal/checkSocket.ts +0 -48
- package/dist/ui/internal/theme.ts +0 -88
- package/dist/ui/public/inter-latin-ext.woff2 +0 -0
- package/dist/ui/public/inter-latin.woff2 +0 -0
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
import {AUTO_FORMAT_CODE, applyColumnUnits, generateImplicitNumberFormat} from './autoFormatting'
|
|
2
|
-
import ssf from 'ssf'
|
|
3
|
-
|
|
4
|
-
export const SUPPORTED_CURRENCIES = [
|
|
5
|
-
{
|
|
6
|
-
primaryCode: 'usd',
|
|
7
|
-
currencySymbol: '$',
|
|
8
|
-
displayName: 'USD - United States Dollar',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
primaryCode: 'aud',
|
|
12
|
-
currencySymbol: 'A$',
|
|
13
|
-
displayName: 'AUD - Australian Dollar',
|
|
14
|
-
escapeCurrencySymbol: true,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
primaryCode: 'brl',
|
|
18
|
-
currencySymbol: 'R$',
|
|
19
|
-
displayName: 'BRL - Brazilian Real',
|
|
20
|
-
escapeCurrencySymbol: true,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
primaryCode: 'cad',
|
|
24
|
-
currencySymbol: 'C$',
|
|
25
|
-
displayName: 'CAD - Canadian Dollar',
|
|
26
|
-
escapeCurrencySymbol: true,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
primaryCode: 'cny',
|
|
30
|
-
currencySymbol: '¥',
|
|
31
|
-
displayName: 'CNY - Renminbi',
|
|
32
|
-
escapeCurrencySymbol: true,
|
|
33
|
-
},
|
|
34
|
-
{primaryCode: 'eur', currencySymbol: '€', displayName: 'EUR - Euro'},
|
|
35
|
-
{
|
|
36
|
-
primaryCode: 'gbp',
|
|
37
|
-
currencySymbol: '£',
|
|
38
|
-
displayName: 'GBP - Pound Sterling',
|
|
39
|
-
escapeCurrencySymbol: true,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
primaryCode: 'jpy',
|
|
43
|
-
currencySymbol: '¥',
|
|
44
|
-
displayName: 'JPY - Japanese Yen',
|
|
45
|
-
escapeCurrencySymbol: true,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
primaryCode: 'inr',
|
|
49
|
-
currencySymbol: '₹',
|
|
50
|
-
displayName: 'INR - Indian Rupee',
|
|
51
|
-
escapeCurrencySymbol: true,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
primaryCode: 'krw',
|
|
55
|
-
currencySymbol: '₩',
|
|
56
|
-
displayName: 'KRW - South Korean won',
|
|
57
|
-
escapeCurrencySymbol: true,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
primaryCode: 'ngn',
|
|
61
|
-
currencySymbol: '₦',
|
|
62
|
-
displayName: 'NGN - Nigerian Naira',
|
|
63
|
-
escapeCurrencySymbol: true,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
primaryCode: 'rub',
|
|
67
|
-
currencySymbol: 'rub',
|
|
68
|
-
displayName: 'RUB - Russian Ruble',
|
|
69
|
-
escapeCurrencySymbol: true,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
primaryCode: 'sek',
|
|
73
|
-
currencySymbol: 'kr',
|
|
74
|
-
displayName: 'SEK - Swedish Krona',
|
|
75
|
-
escapeCurrencySymbol: true,
|
|
76
|
-
},
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
const DERIVED_CURRENCY_FORMATS = [
|
|
80
|
-
{
|
|
81
|
-
derivedSuffix: '',
|
|
82
|
-
valueFormatCode: '#,##0',
|
|
83
|
-
exampleInput: 412.17,
|
|
84
|
-
auto: true,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
derivedSuffix: '0',
|
|
88
|
-
valueFormatCode: '#,##0',
|
|
89
|
-
exampleInput: 7043.123,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
derivedSuffix: '1',
|
|
93
|
-
valueFormatCode: '#,##0.0',
|
|
94
|
-
exampleInput: 7043.123,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
derivedSuffix: '2',
|
|
98
|
-
valueFormatCode: '#,##0.00',
|
|
99
|
-
exampleInput: 7043.123,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
derivedSuffix: '0k',
|
|
103
|
-
valueFormatCode: '#,##0,"k"',
|
|
104
|
-
exampleInput: 64301.12,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
derivedSuffix: '1k',
|
|
108
|
-
valueFormatCode: '#,##0.0,"k"',
|
|
109
|
-
exampleInput: 64301.12,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
derivedSuffix: '2k',
|
|
113
|
-
valueFormatCode: '#,##0.00,"k"',
|
|
114
|
-
exampleInput: 64301.12,
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
derivedSuffix: '0m',
|
|
118
|
-
valueFormatCode: '#,##0,,"M"',
|
|
119
|
-
exampleInput: 4564301.12,
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
derivedSuffix: '1m',
|
|
123
|
-
valueFormatCode: '#,##0.0,,"M"',
|
|
124
|
-
exampleInput: 4564301.12,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
derivedSuffix: '2m',
|
|
128
|
-
valueFormatCode: '#,##0.00,,"M"',
|
|
129
|
-
exampleInput: 4564301.12,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
derivedSuffix: '0b',
|
|
133
|
-
valueFormatCode: '#,##0,,,"B"',
|
|
134
|
-
exampleInput: 9784564301.12,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
derivedSuffix: '1b',
|
|
138
|
-
valueFormatCode: '#,##0.0,,,"B"',
|
|
139
|
-
exampleInput: 9784564301.12,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
derivedSuffix: '2b',
|
|
143
|
-
valueFormatCode: '#,##0.00,,,"B"',
|
|
144
|
-
exampleInput: 9784564301.12,
|
|
145
|
-
},
|
|
146
|
-
]
|
|
147
|
-
|
|
148
|
-
const CURRENCY_FORMATS = SUPPORTED_CURRENCIES.map((currency) => {
|
|
149
|
-
let derivedFormats = []
|
|
150
|
-
DERIVED_CURRENCY_FORMATS.forEach((derivedFormat) => {
|
|
151
|
-
let next = {
|
|
152
|
-
formatTag: currency.primaryCode + derivedFormat.derivedSuffix,
|
|
153
|
-
parentFormat: currency.primaryCode,
|
|
154
|
-
formatCategory: 'currency',
|
|
155
|
-
valueType: 'number',
|
|
156
|
-
exampleInput: derivedFormat.exampleInput,
|
|
157
|
-
titleTagReplacement: ` (${currency.currencySymbol})`,
|
|
158
|
-
}
|
|
159
|
-
let symbolInFormatCode = currency.escapeCurrencySymbol
|
|
160
|
-
? `"${currency.currencySymbol}"`
|
|
161
|
-
: currency.currencySymbol
|
|
162
|
-
if (derivedFormat.auto || AUTO_FORMAT_CODE === derivedFormat.formatCode) {
|
|
163
|
-
next.formatCode = AUTO_FORMAT_CODE
|
|
164
|
-
//TODO This should be fixed so that 1)the format is NOT recomputed for each value, 2)remove some of magic is done to make it look good.
|
|
165
|
-
next._autoFormat = {
|
|
166
|
-
autoFormatFunction: (typedValue, columnFormat, columnUnitSummary) => {
|
|
167
|
-
let format = generateImplicitNumberFormat(columnUnitSummary, 2)
|
|
168
|
-
let effectiveCode = `${symbolInFormatCode}${format._autoFormat.autoFormatCode}`
|
|
169
|
-
let suffix = ''
|
|
170
|
-
let displayValue = typedValue
|
|
171
|
-
if (format._autoFormat.truncateUnits && format._autoFormat.columnUnits) {
|
|
172
|
-
suffix = format._autoFormat.columnUnits
|
|
173
|
-
displayValue = applyColumnUnits(typedValue, format._autoFormat.columnUnits)
|
|
174
|
-
} else {
|
|
175
|
-
if (effectiveCode.endsWith('.0')) {
|
|
176
|
-
effectiveCode = effectiveCode + '0'
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return ssf.format(effectiveCode, displayValue) + suffix
|
|
180
|
-
},
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
next.formatCode = `${symbolInFormatCode}${derivedFormat.valueFormatCode}`
|
|
184
|
-
}
|
|
185
|
-
if (derivedFormat.axisValueFormatCode) {
|
|
186
|
-
next.axisFormatCode = derivedFormat.axisValueFormatCode
|
|
187
|
-
}
|
|
188
|
-
derivedFormats.push(next)
|
|
189
|
-
})
|
|
190
|
-
return derivedFormats
|
|
191
|
-
}).flat()
|
|
192
|
-
|
|
193
|
-
export const BUILT_IN_FORMATS = [
|
|
194
|
-
...CURRENCY_FORMATS,
|
|
195
|
-
//auto formats
|
|
196
|
-
// Date/Time:
|
|
197
|
-
{
|
|
198
|
-
formatTag: 'ddd',
|
|
199
|
-
formatCode: 'ddd',
|
|
200
|
-
formatCategory: 'date',
|
|
201
|
-
valueType: 'date',
|
|
202
|
-
exampleInput: '2022-01-09 12:45',
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
formatTag: 'dddd',
|
|
206
|
-
formatCode: 'dddd',
|
|
207
|
-
formatCategory: 'date',
|
|
208
|
-
valueType: 'date',
|
|
209
|
-
exampleInput: '2022-01-09 12:45',
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
formatTag: 'mmm',
|
|
213
|
-
formatCode: 'mmm',
|
|
214
|
-
formatCategory: 'date',
|
|
215
|
-
valueType: 'date',
|
|
216
|
-
exampleInput: '2022-01-09 12:45',
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
formatTag: 'mmmm',
|
|
220
|
-
formatCode: 'mmmm',
|
|
221
|
-
formatCategory: 'date',
|
|
222
|
-
valueType: 'date',
|
|
223
|
-
exampleInput: '2022-01-09 12:45',
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
formatTag: 'yyyy',
|
|
227
|
-
formatCode: 'yyyy',
|
|
228
|
-
formatCategory: 'date',
|
|
229
|
-
valueType: 'date',
|
|
230
|
-
exampleInput: '2022-01-09 12:45',
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
formatTag: 'shortdate',
|
|
234
|
-
formatCode: 'mmm d/yy',
|
|
235
|
-
formatCategory: 'date',
|
|
236
|
-
valueType: 'date',
|
|
237
|
-
exampleInput: '2022-01-09 12:45',
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
formatTag: 'longdate',
|
|
241
|
-
formatCode: 'mmmm d, yyyy',
|
|
242
|
-
formatCategory: 'date',
|
|
243
|
-
valueType: 'date',
|
|
244
|
-
exampleInput: '2022-01-09 12:45',
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
formatTag: 'fulldate',
|
|
248
|
-
formatCode: 'dddd mmmm d, yyyy',
|
|
249
|
-
formatCategory: 'date',
|
|
250
|
-
valueType: 'date',
|
|
251
|
-
exampleInput: '2022-01-09 12:45',
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
formatTag: 'mdy',
|
|
255
|
-
formatCode: 'm/d/y',
|
|
256
|
-
formatCategory: 'date',
|
|
257
|
-
valueType: 'date',
|
|
258
|
-
exampleInput: '2022-01-09 12:45',
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
formatTag: 'dmy',
|
|
262
|
-
formatCode: 'd/m/y',
|
|
263
|
-
formatCategory: 'date',
|
|
264
|
-
valueType: 'date',
|
|
265
|
-
exampleInput: '2022-01-09 12:45',
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
formatTag: 'hms',
|
|
269
|
-
formatCode: 'H:MM:SS AM/PM',
|
|
270
|
-
formatCategory: 'date',
|
|
271
|
-
valueType: 'date',
|
|
272
|
-
exampleInput: '2022-01-09T11:45:03',
|
|
273
|
-
},
|
|
274
|
-
// Numbers:
|
|
275
|
-
{
|
|
276
|
-
formatTag: 'num0',
|
|
277
|
-
formatCode: '#,##0',
|
|
278
|
-
formatCategory: 'number',
|
|
279
|
-
valueType: 'number',
|
|
280
|
-
exampleInput: 11.23168,
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
formatTag: 'num1',
|
|
284
|
-
formatCode: '#,##0.0',
|
|
285
|
-
formatCategory: 'number',
|
|
286
|
-
valueType: 'number',
|
|
287
|
-
exampleInput: 11.23168,
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
formatTag: 'num2',
|
|
291
|
-
formatCode: '#,##0.00',
|
|
292
|
-
formatCategory: 'number',
|
|
293
|
-
valueType: 'number',
|
|
294
|
-
exampleInput: 11.23168,
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
formatTag: 'num3',
|
|
298
|
-
formatCode: '#,##0.000',
|
|
299
|
-
formatCategory: 'number',
|
|
300
|
-
valueType: 'number',
|
|
301
|
-
exampleInput: 11.23168,
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
formatTag: 'num4',
|
|
305
|
-
formatCode: '#,##0.0000',
|
|
306
|
-
formatCategory: 'number',
|
|
307
|
-
valueType: 'number',
|
|
308
|
-
exampleInput: 11.23168,
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
formatTag: 'num0k',
|
|
312
|
-
formatCode: '#,##0,"k"',
|
|
313
|
-
formatCategory: 'number',
|
|
314
|
-
valueType: 'number',
|
|
315
|
-
exampleInput: 64201,
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
formatTag: 'num1k',
|
|
319
|
-
formatCode: '#,##0.0,"k"',
|
|
320
|
-
formatCategory: 'number',
|
|
321
|
-
valueType: 'number',
|
|
322
|
-
exampleInput: 64201,
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
formatTag: 'num2k',
|
|
326
|
-
formatCode: '#,##0.00,"k"',
|
|
327
|
-
formatCategory: 'number',
|
|
328
|
-
valueType: 'number',
|
|
329
|
-
exampleInput: 64201,
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
formatTag: 'num0m',
|
|
333
|
-
formatCode: '#,##0,,"M"',
|
|
334
|
-
formatCategory: 'number',
|
|
335
|
-
valueType: 'number',
|
|
336
|
-
exampleInput: 42539483,
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
formatTag: 'num1m',
|
|
340
|
-
formatCode: '#,##0.0,,"M"',
|
|
341
|
-
formatCategory: 'number',
|
|
342
|
-
valueType: 'number',
|
|
343
|
-
exampleInput: 42539483,
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
formatTag: 'num2m',
|
|
347
|
-
formatCode: '#,##0.00,,"M"',
|
|
348
|
-
formatCategory: 'number',
|
|
349
|
-
valueType: 'number',
|
|
350
|
-
exampleInput: 42539483,
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
formatTag: 'num0b',
|
|
354
|
-
formatCode: '#,##0,,,"B"',
|
|
355
|
-
formatCategory: 'number',
|
|
356
|
-
valueType: 'number',
|
|
357
|
-
exampleInput: 1384937584,
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
formatTag: 'num1b',
|
|
361
|
-
formatCode: '#,##0.0,,,"B"',
|
|
362
|
-
formatCategory: 'number',
|
|
363
|
-
valueType: 'number',
|
|
364
|
-
exampleInput: 1384937584,
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
formatTag: 'num2b',
|
|
368
|
-
formatCode: '#,##0.00,,,"B"',
|
|
369
|
-
formatCategory: 'number',
|
|
370
|
-
valueType: 'number',
|
|
371
|
-
exampleInput: 1384937584,
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
formatTag: 'id',
|
|
375
|
-
formatCode: '0',
|
|
376
|
-
formatCategory: 'number',
|
|
377
|
-
valueType: 'number',
|
|
378
|
-
exampleInput: '921594675',
|
|
379
|
-
titleTagReplacement: ' id',
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
formatTag: 'fract',
|
|
383
|
-
formatCode: '# ?/?',
|
|
384
|
-
formatCategory: 'number',
|
|
385
|
-
valueType: 'number',
|
|
386
|
-
exampleInput: '0.25',
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
formatTag: 'mult',
|
|
390
|
-
formatCode: '#,##0.0"x"',
|
|
391
|
-
formatCategory: 'number',
|
|
392
|
-
valueType: 'number',
|
|
393
|
-
exampleInput: '5.32',
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
formatTag: 'mult0',
|
|
397
|
-
formatCode: '#,##0"x"',
|
|
398
|
-
formatCategory: 'number',
|
|
399
|
-
valueType: 'number',
|
|
400
|
-
exampleInput: '5.32',
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
formatTag: 'mult1',
|
|
404
|
-
formatCode: '#,##0.0"x"',
|
|
405
|
-
formatCategory: 'number',
|
|
406
|
-
valueType: 'number',
|
|
407
|
-
exampleInput: '5.32',
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
formatTag: 'mult2',
|
|
411
|
-
formatCode: '#,##0.00"x"',
|
|
412
|
-
formatCategory: 'number',
|
|
413
|
-
valueType: 'number',
|
|
414
|
-
exampleInput: '5.32',
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
formatTag: 'sci',
|
|
418
|
-
formatCode: '0.00E+0',
|
|
419
|
-
formatCategory: 'number',
|
|
420
|
-
valueType: 'number',
|
|
421
|
-
exampleInput: '16546.1561',
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
// Percent:
|
|
425
|
-
{
|
|
426
|
-
formatTag: 'pct',
|
|
427
|
-
formatCode: AUTO_FORMAT_CODE,
|
|
428
|
-
formatCategory: 'percent',
|
|
429
|
-
valueType: 'number',
|
|
430
|
-
exampleInput: 0.731,
|
|
431
|
-
titleTagReplacement: '',
|
|
432
|
-
_autoFormat: {
|
|
433
|
-
autoFormatFunction: (typedValue, columnFormat, columnUnitSummary) => {
|
|
434
|
-
if ('number' === columnUnitSummary?.unitType) {
|
|
435
|
-
let adjustedColumnUnitSummary = {
|
|
436
|
-
min: columnUnitSummary.min * 100,
|
|
437
|
-
max: columnUnitSummary.max * 100,
|
|
438
|
-
median: columnUnitSummary.median * 100,
|
|
439
|
-
maxDecimals: Math.max(columnUnitSummary.maxDecimals - 2, 0),
|
|
440
|
-
unitType: columnUnitSummary.unitType,
|
|
441
|
-
}
|
|
442
|
-
let format = generateImplicitNumberFormat(adjustedColumnUnitSummary)
|
|
443
|
-
return ssf.format(format._autoFormat.autoFormatCode, typedValue * 100) + '%'
|
|
444
|
-
} else {
|
|
445
|
-
return ssf.format('#,##0%', typedValue)
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
},
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
formatTag: 'pct0',
|
|
452
|
-
formatCode: '#,##0%',
|
|
453
|
-
formatCategory: 'percent',
|
|
454
|
-
valueType: 'number',
|
|
455
|
-
exampleInput: 0.731,
|
|
456
|
-
titleTagReplacement: '',
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
formatTag: 'pct1',
|
|
460
|
-
formatCode: '#,##0.0%',
|
|
461
|
-
formatCategory: 'percent',
|
|
462
|
-
valueType: 'number',
|
|
463
|
-
exampleInput: 0.731,
|
|
464
|
-
titleTagReplacement: '',
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
formatTag: 'pct2',
|
|
468
|
-
formatCode: '#,##0.00%',
|
|
469
|
-
formatCategory: 'percent',
|
|
470
|
-
valueType: 'number',
|
|
471
|
-
exampleInput: 0.731,
|
|
472
|
-
titleTagReplacement: '',
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
formatTag: 'pct3',
|
|
476
|
-
formatCode: '#,##0.000%',
|
|
477
|
-
formatCategory: 'percent',
|
|
478
|
-
valueType: 'number',
|
|
479
|
-
exampleInput: 0.731,
|
|
480
|
-
titleTagReplacement: '',
|
|
481
|
-
},
|
|
482
|
-
]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {getContext, setContext} from 'svelte'
|
|
2
|
-
const configKey = Symbol()
|
|
3
|
-
const propKey = Symbol()
|
|
4
|
-
|
|
5
|
-
export const strictBuild = false
|
|
6
|
-
export {configKey, propKey}
|
|
7
|
-
|
|
8
|
-
export const getConfigContext = () => getContext(configKey)
|
|
9
|
-
export const setConfigContext = (v) => setContext(configKey, v)
|
|
10
|
-
|
|
11
|
-
export const getPropContext = () => getContext(propKey)
|
|
12
|
-
export const setPropContext = (v) => setContext(propKey, v)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const s = Symbol.for('__evidence-chart-window-debug__')
|
|
2
|
-
const isBrowser = typeof window !== 'undefined'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {string} key
|
|
6
|
-
* @param {unknown} value
|
|
7
|
-
*/
|
|
8
|
-
export const set = (key, value) => {
|
|
9
|
-
if (!isBrowser) return
|
|
10
|
-
if (!window[s]) window[s] = {}
|
|
11
|
-
window[s][key] = value
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} key
|
|
16
|
-
*/
|
|
17
|
-
export const unset = (key) => {
|
|
18
|
-
if (!isBrowser) return
|
|
19
|
-
if (!window[s]) window[s] = {}
|
|
20
|
-
delete window[s][key]
|
|
21
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export default function checkInputs (data, reqCols, optCols) {
|
|
2
|
-
// reqCols is an array of columns to check in the dataset
|
|
3
|
-
let columns = []
|
|
4
|
-
|
|
5
|
-
// Check if dataset was provided
|
|
6
|
-
if (data === undefined) {
|
|
7
|
-
throw Error('No data provided')
|
|
8
|
-
} else if (typeof data !== 'object') {
|
|
9
|
-
throw Error(
|
|
10
|
-
"'" +
|
|
11
|
-
data +
|
|
12
|
-
"'" +
|
|
13
|
-
' is not a recognized query result. Data should be provided in the format: data = {' +
|
|
14
|
-
data.replace('data.', '') +
|
|
15
|
-
'}',
|
|
16
|
-
)
|
|
17
|
-
} else if (data[0] === undefined || data.length === 0) {
|
|
18
|
-
throw Error(
|
|
19
|
-
'Dataset is empty: query ran successfully, but no data was returned from the database',
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Check if data warehouse returned an error
|
|
24
|
-
if (data[0]?.error_object?.error != null) {
|
|
25
|
-
throw Error('SQL Error: ' + data[0]?.error_object?.error?.message)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (reqCols != undefined) {
|
|
29
|
-
if (!(reqCols instanceof Array)) {
|
|
30
|
-
throw Error('reqCols must be passed in as an array')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Check if columns were provided
|
|
34
|
-
for (let i = 0; i < reqCols.length; i++) {
|
|
35
|
-
if (reqCols[i] == null) {
|
|
36
|
-
throw Error(`Missing required column(s): ${reqCols[i]} not found in data set.`)
|
|
37
|
-
} else if (reqCols[i] == '') {
|
|
38
|
-
throw Error(
|
|
39
|
-
'Missing required column(s): A Empty string was provided for one of your props.',
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// let errorString;
|
|
45
|
-
// if(missingCols.length > 0){
|
|
46
|
-
// errorString = missingCols[0]
|
|
47
|
-
// for(i = 1; i < missingCols.length; i++){
|
|
48
|
-
// errorString = errorString + ", " + missingCols[i];
|
|
49
|
-
// }
|
|
50
|
-
// errorString = errorString + " not provided";
|
|
51
|
-
// throw Error(errorString);
|
|
52
|
-
// }
|
|
53
|
-
|
|
54
|
-
// const dataIsQueryStore = data instanceof QueryStore;
|
|
55
|
-
|
|
56
|
-
// Get list of all columns in dataset
|
|
57
|
-
// we want to handle cases where the columns have not yet been fetched, but the data is avialable
|
|
58
|
-
// this is most likely to happen during pre-rendering, because column metadata is not yet included
|
|
59
|
-
// in the prerendering process
|
|
60
|
-
if (!data.columnsLoaded && data.dataLoaded) {
|
|
61
|
-
let cols = Object.keys(data[0])
|
|
62
|
-
for (let col of cols) {
|
|
63
|
-
columns.push(col)
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
for (let col of data.columns) {
|
|
67
|
-
columns.push(col.column_name)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Check if provided columns are in the dataset
|
|
72
|
-
let currentCol
|
|
73
|
-
for (let i = 0; i < reqCols.length; i++) {
|
|
74
|
-
currentCol = reqCols[i]
|
|
75
|
-
if (!columns.includes(currentCol)) {
|
|
76
|
-
throw Error("'" + currentCol + "' is not a column in the dataset")
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (optCols != undefined && optCols.some((col) => col != null)) {
|
|
81
|
-
for (let i = 0; i < optCols.length; i++) {
|
|
82
|
-
currentCol = optCols[i]
|
|
83
|
-
if (currentCol == null) continue
|
|
84
|
-
if (!columns.includes(currentCol)) {
|
|
85
|
-
throw Error("'" + currentCol + "' is not a column in the dataset")
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// IDEAS:
|
|
91
|
-
// Trigger a function call when error is caught - that function somehow sends us to the Error chart component
|
|
92
|
-
// rather than letting the rest of the current component file continue running?
|
|
93
|
-
// Almost 2 layers of error: (1) up front check errors and (2) actual execution of the chart errors
|
|
94
|
-
// (1) is handled here, (2) may need a wrapper around the main part of the component code
|
|
95
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const toBoolean = (value) => {
|
|
2
|
-
if (typeof value === 'undefined' || value === null) return undefined
|
|
3
|
-
if (typeof value === 'string') {
|
|
4
|
-
let normalized = value.trim().toLowerCase()
|
|
5
|
-
if (normalized === 'true') return true
|
|
6
|
-
if (normalized === 'false') return false
|
|
7
|
-
}
|
|
8
|
-
return Boolean(value)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const toNumber = (value) => {
|
|
12
|
-
if (typeof value === 'undefined' || value === null) return undefined
|
|
13
|
-
let num = Number(value)
|
|
14
|
-
return Number.isNaN(num) ? undefined : num
|
|
15
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {tidy, mutate} from '@tidyjs/tidy'
|
|
2
|
-
|
|
3
|
-
export function standardizeDateString (date) {
|
|
4
|
-
if (date && typeof date === 'string') {
|
|
5
|
-
// Parses an individual string into a JS date object
|
|
6
|
-
|
|
7
|
-
let dateSplit = date.split(' ')
|
|
8
|
-
|
|
9
|
-
// If date doesn't contain timestamp, add one at midnight (avoids timezone interpretation issue)
|
|
10
|
-
if (!date.includes(':')) {
|
|
11
|
-
date = date + 'T00:00:00'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Remove any character groups beyond 2 (date and time):
|
|
15
|
-
if (dateSplit.length > 2) {
|
|
16
|
-
date = dateSplit[0] + ' ' + dateSplit[1]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Replace microseconds if needed:
|
|
20
|
-
let re = /\.([^\s]+)/
|
|
21
|
-
date = date.replace(re, '')
|
|
22
|
-
|
|
23
|
-
// Remove "Z" to avoid timezone interpretation issue:
|
|
24
|
-
date = date.replace('Z', '')
|
|
25
|
-
|
|
26
|
-
// Replace spaces with "T" to conform to ECMA standard:
|
|
27
|
-
date = date.replace(' ', 'T')
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return date
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function convertColumnToDate (data, column) {
|
|
34
|
-
// Replaces a date column's string values with JS date objects, using the standardizeDateString function
|
|
35
|
-
|
|
36
|
-
let converted = tidy(
|
|
37
|
-
data,
|
|
38
|
-
mutate({[column]: (d) => (d[column] ? new Date(standardizeDateString(d[column])) : null)}),
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
if (data && typeof data === 'object') {
|
|
42
|
-
for (let key of Object.keys(data)) {
|
|
43
|
-
if (!/^\d+$/.test(key)) converted[key] = data[key]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return converted
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function standardizeDateColumn (data, column) {
|
|
51
|
-
// Replaces a date column's string values with standardized date strings, using the standardizeDateString function
|
|
52
|
-
// Used in Chart.svelte, where using Date objects leads to errors
|
|
53
|
-
|
|
54
|
-
data = tidy(data, mutate({[column]: (d) => standardizeDateString(d[column])}))
|
|
55
|
-
|
|
56
|
-
return data
|
|
57
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DROPDOWN_CONTEXT = Symbol('DropdownContext')
|