How to use the teselagen-react-components.withDialog function in teselagen-react-components

To help you get started, we’ve selected a few teselagen-react-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TeselaGen / openVectorEditor / src / helperComponents / SelectDialog.js View on Github external
import { tryToRefocusEditor } from "../utils/editorUtils";

// Single validation function - from & to have the same range
const validate = (val, vals, props) => {
  const { min, max } = get(props, "extraProps.from", {});
  const circular = get(props, "extraProps.circular");
  if ((min && val < min) || (max && val > max)) {
    return "Invalid position";
  }
  if (!circular && vals.from > vals.to) {
    return "Wrong from/to order";
  }
};

export default compose(
  withDialog({
    isDraggable: true,
    width: 400,
    title: "Select Range",
    height: 270,
    onCloseHook: tryToRefocusEditor
  }),
  reduxForm({
    form: "selectDialog"
  }),
  formValues("from", "to")
)(
  class SelectDialog extends React.Component {
    updateTempHighlight = ({ isStart, isEnd } = {}) => val => {
      const { selectionLayerUpdate, from, to, invalid } = this.props;
      if (invalid) return;
      selectionLayerUpdate(
github TeselaGen / openVectorEditor / src / helperComponents / PrintDialog / index.js View on Github external
-webkit-print-color-adjust: exact; page-break-after: always; 
              } }`}
            ignoreLinks //needed because some css is linked to but is not loading..
            onAfterPrint={() => {
              this.setState({ fullscreen: false });
              hideModal();
            }}
          />
        
      
    );
  }
}

export default compose(
  withDialog({
    // isOpen: true,
    title: "Print"
  }),
  withEditorProps,
  reduxForm({
    form: "PrintDialog"
  })
)(PrintDialog);

class ReactToPrint extends React.Component {
  static propTypes = {
    /** Preview the print without actually triggering the print dialog */
    printPreview: PropTypes.bool,
    /** Copy styles over into print window. default: true */
    copyStyles: PropTypes.bool,
    /** Ignore link styles. Necessary because sometime links don't load.., default: false */
github TeselaGen / openVectorEditor / src / helperComponents / AddOrEditAnnotationDialog / index.js View on Github external
export default ({ formName, getProps, dialogProps }) => {
  return compose(
    withDialog({
      isDraggable: true,
      width: 350,
      ...dialogProps
    }),
    withEditorProps,
    withProps(getProps),
    reduxForm({
      form: formName, // "AddOrEditAnnotationDialog",
      validate: (values, { sequenceLength, sequenceData }) => {
        let errors = {};
        const { circular } = sequenceData || {};
        if (!circular && values.start > values.end) {
          errors.start = "Start must be less than End for a linear sequence";
          errors.end = "Start must be less than End for a linear sequence";
        }
        if (
github TeselaGen / openVectorEditor / demo / src / EditorDemo / AddEditFeatureOverrideExample.js View on Github external
intent={Intent.PRIMARY}
          >
            Save
          
        
      
    );
  }
}

function required(val) {
  if (!val) return "Required";
}

export default compose(
  withDialog({
    isDraggable: true,
    height: 570,
    width: 400
  }),
  withEditorProps,
  reduxForm({
    form: "AddOrEditFeatureDialog",
    validate: (values, { sequenceLength }) => {
      let errors = {};
      if (
        !isRangeWithinRange(
          convertRangeTo0Based(values, sequenceLength),
          { start: 0, end: sequenceLength - 1 },
          sequenceLength
        )
      ) {
github TeselaGen / openVectorEditor / src / helperComponents / MergeFeaturesDialog / index.js View on Github external
)}
            intent={Intent.PRIMARY}
          >
            Create Merged Feature
          
        
      
    );
  }
}

function required(val) {
  if (!val) return "Required";
}
export default compose(
  withDialog({
    isDraggable: true,
    height: 480,
    width: 400
  }),
  withEditorProps,
  reduxForm({
    form: "MergeFeaturesDialog"
  }),
  formValues("id1", "id2")
)(MergeFeaturesDialog);
github TeselaGen / openVectorEditor / src / helperComponents / RemoveDuplicates / index.js View on Github external
} ${startCase(type)}`
              );
              hideModal();
            }}
            disabled={!(duplicatesToRemoveSelectedEntities || []).length}
          >
            Remove {duplicatesToRemoveSelectedEntities.length} Duplicates
          
        
      
    );
  }
}

export default compose(
  withDialog(),
  withEditorProps,

  withSelectedEntities("duplicatesToRemove"),

  reduxForm({
    form: "RemoveDuplicatesDialog"
  }),
  formValues("ignoreName", "ignoreStrand", "ignoreStartAndEnd")
)(RemoveDuplicatesDialog);
github TeselaGen / openVectorEditor / src / helperComponents / AddOrEditPartDialog / index.js View on Github external
intent={Intent.PRIMARY}
          >
            Save
          
        
      
    );
  }
}

function required(val) {
  if (!val) return "Required";
}

export default compose(
  withDialog({
    isDraggable: true,
    height: 430,
    width: 350
  }),
  withEditorProps,
  reduxForm({
    form: "AddOrEditPartDialog",
    validate: (values, { sequenceLength }) => {
      let errors = {};
      if (
        !isRangeWithinRange(
          convertRangeTo0Based(values, sequenceLength),
          { start: 0, end: sequenceLength - 1 },
          sequenceLength
        )
      ) {
github TeselaGen / openVectorEditor / src / helperComponents / FindGuideDialog / index.js View on Github external
}
}

const validate = values => {
  const errors = {};
  if (!values.guideLength) {
    errors.guideLength = "Required";
  }
  if (!values.pamSite) {
    errors.pamSite = "Required";
  }
  return errors;
};

export default compose(
  withDialog({
    isDraggable: true,
    height: 360,
    width: 400
  }),
  withEditorProps,
  reduxForm({
    form: "FindGuideDialog",
    validate
  })
)(FindGuideDialog);
github TeselaGen / openVectorEditor / src / helperComponents / createSimpleDialog.js View on Github external
export default function createSimpleDialog(props) {
  return compose(
    withDialog({
      isDraggable: true,
      width: 400,
      ...props.dialogProps
    }),
    reduxForm({
      form: props.formName
    }),
    withProps(props)
  )(SimpleGenericDialogForm);
}
github TeselaGen / openVectorEditor / src / helperComponents / AddOrEditPrimerDialog / index.js View on Github external
})}
            intent={Intent.PRIMARY}
          >
            Save
          
        
      
    );
  }
}

function required(val) {
  if (!val) return "Required";
}
export default compose(
  withDialog({
    isDraggable: true,
    height: 430,
    width: 350
  }),
  withEditorProps,
  reduxForm({
    form: "AddOrEditPrimerDialog"
  })
)(AddOrEditPrimerDialog);