Skip to content

Commit

Permalink
fix imports of other decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel committed May 2, 2022
1 parent ebfa470 commit ffdcb56
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import get from "lodash/get.js";
import { VulcanGraphqlFieldSchema } from "../typings";

export const makeCheckboxgroup = (field = {}) => {
export const makeCheckboxgroup = (
// FIXME: leads to weird typing issue with simple schema
field: Partial</*VulcanGraphqlFieldSchema*/ any> = {}
) => {
const hasOther = !!get(field, "itemProperties.showOther");

if (!field.options) {
throw new Error(`Checkboxgroup fields need an 'options' property`);
}

// add additional field object properties
const cbgField = {
const cbgField: any = {
...field,
type: Array,
input: "checkboxgroup",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./likert";
export * from "./autocomplete";
export * from "./checkboxgroup";
export * from "./radiogroup";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SimpleSchema from 'simpl-schema';
import SimpleSchema from "simpl-schema";

export const makeLikert = (field = {}) => {
// get typeName from fieldName unless it's already specified in field object
Expand All @@ -23,8 +23,9 @@ export const makeLikert = (field = {}) => {
// add additional field object properties
const likertField = {
...field,
// TODO: drop this dependency
type: new SimpleSchema(typeObject),
input: 'likert',
input: "likert",
};

return likertField;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import get from "lodash/get.js";

export const makeRadiogroup = (field = {}) => {
export const makeRadiogroup = (field: any = {}) => {
const hasOther = !!get(field, "itemProperties.showOther");

if (!field.options) {
throw new Error(`Radiogroup fields need an 'options' property`);
}

const rgField = {
const rgField: any = {
...field,
type: Array,
input: "radiogroup",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export * from "./fragments/defaultFragment";
export * from "./fragments/typings";
export * from "./fragments/utils";

export * from "./decorators/autocomplete";
export * from "./decorators";
2 changes: 0 additions & 2 deletions packages/react-ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ export * from "./components/form";
export * from "./components/VulcanComponents";
export * from "./components/VulcanCurrentUser";
export * from "./componentsHelpers";

export * from "./decorators";

0 comments on commit ffdcb56

Please sign in to comment.