@genspectrum/dashboard-components 0.11.4 → 0.11.6

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.
Files changed (28) hide show
  1. package/custom-elements.json +54 -3
  2. package/dist/assets/{mutationOverTimeWorker-Cr-NmYEs.js.map → mutationOverTimeWorker-CWneD7i5.js.map} +1 -1
  3. package/dist/components.d.ts +29 -15
  4. package/dist/components.js +184 -55
  5. package/dist/components.js.map +1 -1
  6. package/dist/style.css +5 -5
  7. package/dist/util.d.ts +21 -18
  8. package/package.json +1 -1
  9. package/src/preact/aggregatedData/__mockData__/aggregatedWith1Field.json +399 -0
  10. package/src/preact/aggregatedData/__mockData__/aggregatedWith2Fields.json +1771 -0
  11. package/src/preact/aggregatedData/aggregate-bar-chart.tsx +177 -0
  12. package/src/preact/aggregatedData/aggregate-table.tsx +24 -2
  13. package/src/preact/aggregatedData/aggregate.stories.tsx +61 -2
  14. package/src/preact/aggregatedData/aggregate.tsx +18 -6
  15. package/src/preact/components/tabs.tsx +19 -39
  16. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +1 -1
  17. package/src/preact/shared/charts/colors.ts +1 -1
  18. package/src/query/queryAggregateData.spec.ts +16 -109
  19. package/src/query/queryAggregateData.ts +2 -12
  20. package/src/query/queryGeneralStatistics.ts +2 -2
  21. package/src/utils/temporal.spec.ts +62 -8
  22. package/src/utils/temporalClass.ts +1 -8
  23. package/src/web-components/visualization/gs-aggregate.stories.ts +90 -20
  24. package/src/web-components/visualization/gs-aggregate.tsx +20 -0
  25. package/standalone-bundle/assets/{mutationOverTimeWorker-DIQRmxvC.js.map → mutationOverTimeWorker-x1ipPFL0.js.map} +1 -1
  26. package/standalone-bundle/dashboard-components.js +3771 -3651
  27. package/standalone-bundle/dashboard-components.js.map +1 -1
  28. package/standalone-bundle/style.css +1 -1
@@ -1369,7 +1369,7 @@
1369
1369
  "type": {
1370
1370
  "text": "Meta<Required<AggregateProps>>"
1371
1371
  },
1372
- "default": "{ title: 'Visualization/Aggregate', component: 'gs-aggregate', argTypes: { fields: [{ control: 'object' }], views: { options: ['table'], control: { type: 'check' }, }, width: { control: 'text' }, height: { control: 'text' }, pageSize: { control: 'object' }, initialSortField: { control: 'text' }, initialSortDirection: { options: ['ascending', 'descending'], control: { type: 'radio' }, }, }, parameters: withComponentDocs({ fetchMock: { mocks: [ { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['division', 'host'], country: 'USA', }, }, response: { status: 200, body: aggregatedData, }, }, ], }, componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, }), tags: ['autodocs'], }"
1372
+ "default": "{ title: 'Visualization/Aggregate', component: 'gs-aggregate', argTypes: { fields: [{ control: 'object' }], views: { options: ['table', 'bar'], control: { type: 'check' }, }, width: { control: 'text' }, height: { control: 'text' }, pageSize: { control: 'object' }, initialSortField: { control: 'text' }, initialSortDirection: { options: ['ascending', 'descending'], control: { type: 'radio' }, }, }, parameters: withComponentDocs({ componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, }), tags: ['autodocs'], }"
1373
1373
  },
1374
1374
  {
1375
1375
  "kind": "variable",
@@ -1377,7 +1377,23 @@
1377
1377
  "type": {
1378
1378
  "text": "StoryObj<Required<AggregateProps>>"
1379
1379
  },
1380
- "default": "{ render: (args) => html` <gs-app lapis=\"${LAPIS_URL}\"> <gs-aggregate .fields=${args.fields} .lapisFilter=${args.lapisFilter} .views=${args.views} .width=${args.width} .height=${args.height} .initialSortField=${args.initialSortField} .initialSortDirection=${args.initialSortDirection} .pageSize=${args.pageSize} ></gs-aggregate> </gs-app> `, args: { fields: ['division', 'host'], views: ['table'], lapisFilter: { country: 'USA', }, width: '100%', height: '700px', initialSortField: 'count', initialSortDirection: 'descending', pageSize: 10, }, }"
1380
+ "default": "{ render: (args) => html` <gs-app lapis=\"${LAPIS_URL}\"> <gs-aggregate .fields=${args.fields} .lapisFilter=${args.lapisFilter} .views=${args.views} .width=${args.width} .height=${args.height} .initialSortField=${args.initialSortField} .initialSortDirection=${args.initialSortDirection} .pageSize=${args.pageSize} .maxNumberOfBars=${args.maxNumberOfBars} ></gs-aggregate> </gs-app> `, parameters: { fetchMock: { mocks: [ { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['division', 'host'], country: 'USA', }, }, response: { status: 200, body: aggregatedData, }, }, ], }, }, args: { fields: ['division', 'host'], views: ['table', 'bar'], lapisFilter: { country: 'USA', }, width: '100%', height: '700px', initialSortField: 'count', initialSortDirection: 'descending', pageSize: 10, maxNumberOfBars: 10, }, }"
1381
+ },
1382
+ {
1383
+ "kind": "variable",
1384
+ "name": "BarChartWithOneField",
1385
+ "type": {
1386
+ "text": "StoryObj<Required<AggregateProps>>"
1387
+ },
1388
+ "default": "{ ...Table, args: { ...Table.args, fields: ['division'], views: ['bar', 'table'], }, parameters: { fetchMock: { mocks: [ { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['division'], country: 'USA', }, }, response: { status: 200, body: aggregatedDataWith1Field, }, }, ], }, }, }"
1389
+ },
1390
+ {
1391
+ "kind": "variable",
1392
+ "name": "BarChartWithTwoFields",
1393
+ "type": {
1394
+ "text": "StoryObj<Required<AggregateProps>>"
1395
+ },
1396
+ "default": "{ ...Table, args: { ...Table.args, fields: ['division', 'nextstrainClade'], lapisFilter: { country: 'Germany', dateTo: '2022-02-01', }, views: ['bar', 'table'], }, parameters: { fetchMock: { mocks: [ { matcher: { name: 'aggregatedData', url: AGGREGATED_ENDPOINT, body: { fields: ['division', 'nextstrainClade'], country: 'Germany', dateTo: '2022-02-01', }, }, response: { status: 200, body: aggregatedDataWith2Fields, }, }, ], }, }, }"
1381
1397
  }
1382
1398
  ],
1383
1399
  "exports": [
@@ -1396,6 +1412,22 @@
1396
1412
  "name": "Table",
1397
1413
  "module": "src/web-components/visualization/gs-aggregate.stories.ts"
1398
1414
  }
1415
+ },
1416
+ {
1417
+ "kind": "js",
1418
+ "name": "BarChartWithOneField",
1419
+ "declaration": {
1420
+ "name": "BarChartWithOneField",
1421
+ "module": "src/web-components/visualization/gs-aggregate.stories.ts"
1422
+ }
1423
+ },
1424
+ {
1425
+ "kind": "js",
1426
+ "name": "BarChartWithTwoFields",
1427
+ "declaration": {
1428
+ "name": "BarChartWithTwoFields",
1429
+ "module": "src/web-components/visualization/gs-aggregate.stories.ts"
1430
+ }
1399
1431
  }
1400
1432
  ]
1401
1433
  },
@@ -1405,7 +1437,7 @@
1405
1437
  "declarations": [
1406
1438
  {
1407
1439
  "kind": "class",
1408
- "description": "## Context\n\nThis component displays aggregated data in a table, which can provide an overview of the underlying data.\n\nIt expects a list of `fields` to aggregate by and a `filter` to apply to the data.\n\n## Views\n\n### Table View\n\nIn the table view, the data is presented in a table format where each field is a column,\nalong with the aggregated value and its proportion.\nThe proportion represents the ratio of the aggregated value to the total count of the data\n(considering the applied filter).",
1440
+ "description": "## Context\n\nThis component displays aggregated data in a table, which can provide an overview of the underlying data.\n\nIt expects a list of `fields` to aggregate by and a `filter` to apply to the data.\n\n## Views\n\n### Table View\n\nIn the table view, the data is presented in a table format where each field is a column,\nalong with the aggregated value and its proportion.\nThe proportion represents the ratio of the aggregated value to the total count of the data\n(considering the applied filter).\n\n### Bar Chart View\n\nIn the bar chart view, the data is presented in vertical bars.\nThe bar chart is supported when `fields` contains one or two entries.\nThe first field will be used as the y-axis.\nIf a second field is provided, it's values will be stacked along the x-axis for each key on the y-axis.\n\nThe chart shows the bars with the highest aggregated `count`.\nThe number of bars can be adjusted with the `maxNumberOfBars` property.",
1409
1441
  "name": "AggregateComponent",
1410
1442
  "members": [
1411
1443
  {
@@ -1487,6 +1519,16 @@
1487
1519
  "default": "false",
1488
1520
  "description": "The maximum number of rows to display in the table view.\nSet to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).",
1489
1521
  "attribute": "pageSize"
1522
+ },
1523
+ {
1524
+ "kind": "field",
1525
+ "name": "maxNumberOfBars",
1526
+ "type": {
1527
+ "text": "number"
1528
+ },
1529
+ "default": "20",
1530
+ "description": "The maximum number of bars to display in the bar chart view.",
1531
+ "attribute": "maxNumberOfBars"
1490
1532
  }
1491
1533
  ],
1492
1534
  "attributes": [
@@ -1561,6 +1603,15 @@
1561
1603
  "default": "false",
1562
1604
  "description": "The maximum number of rows to display in the table view.\nSet to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).",
1563
1605
  "fieldName": "pageSize"
1606
+ },
1607
+ {
1608
+ "name": "maxNumberOfBars",
1609
+ "type": {
1610
+ "text": "number"
1611
+ },
1612
+ "default": "20",
1613
+ "description": "The maximum number of bars to display in the bar chart view.",
1614
+ "fieldName": "maxNumberOfBars"
1564
1615
  }
1565
1616
  ],
1566
1617
  "superclass": {