swoop-common 2.0.29 → 2.0.31

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.
@@ -15,10 +15,21 @@ import { registerComponent } from '../registry/components';
15
15
  import { ComponentPool } from '../registry/types';
16
16
  import { CoreService } from '../../api/generated/core';
17
17
  const FormTemplatePicker = ({ templates, selectedTemplates, onChange, label, enabled }) => {
18
- const selectedValues = templates.filter(t => (Array.isArray(selectedTemplates) ? selectedTemplates : (() => {
19
- console.log("SELECTED TEMPLATES IS NOT ARRAY", selectedTemplates);
20
- return [];
21
- })()).includes(t.id));
18
+ // Very ugly chain, just temp as the data is ass right now.
19
+ const cleanSelected = typeof selectedTemplates === "string"
20
+ ?
21
+ [selectedTemplates]
22
+ :
23
+ Array.isArray(selectedTemplates)
24
+ ?
25
+ selectedTemplates
26
+ :
27
+ !!selectedTemplates
28
+ ?
29
+ [...selectedTemplates]
30
+ :
31
+ [];
32
+ const selectedValues = templates.filter(t => cleanSelected.includes(t.id));
22
33
  return (React.createElement(Paper, { component: "form", sx: { display: 'flex', flexDirection: 'column', gap: 2, p: 2, mb: 1 }, noValidate: true, autoComplete: "off" },
23
34
  React.createElement(Typography, { variant: "h6" }, label),
24
35
  React.createElement(Autocomplete, { multiple: true, options: templates, getOptionLabel: (option) => option.name, getOptionKey: o => o.id, value: selectedValues, onChange: (_, newValue) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.0.29",
3
+ "version": "2.0.31",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {