Skip to content

Commit

Permalink
Merge pull request #627 from bcgov/SRS-188-NEW
Browse files Browse the repository at this point in the history
updated folder name
  • Loading branch information
acoard-aot authored Feb 23, 2024
2 parents 9c00c8a + f887dd7 commit c49de62
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React from "react";
import ReactDOM from "react-dom";
import { ReactComponent } from "react-formio";
import settingsForm from "./appFileUpload.settingsForm";


export default class AppFileUpload extends ReactComponent {
/**
* This function tells the form builder about your component. It's name, icon and what group it should be in.
*
* @returns {{title: string, icon: string, group: string, documentation: string, weight: number, schema: *}}
*/
static get builderInfo() {
return {
title: "Application File Upload",
icon: "map-marker",
group: "basic",
documentation: "", //TODO
weight: 120,
schema: AppFileUpload.schema(),
};
}

/**
* This function is the default settings for the component. At a minimum you want to set the type to the registered
* type of your component (i.e. when you call Components.setComponent('type', MyComponent) these types should match.
*
* @param sources
* @returns {*}
*/
static schema() {
return ReactComponent.schema({
type: "AppFileUpload",
label: "File Upload",
});
}

/*
* Defines the settingsForm when editing a component in the builder.
*/
static editForm = settingsForm;

static eventRegistered = false;

/**
* This function is called when the DIV has been rendered and added to the DOM. You can now instantiate the react component.
*
* @param DOMElement
* #returns ReactInstance
*
*
*/
attachReact(element) {
let instance;

ReactDOM.render(
<a
href="javascript:void(0)"
onClick={() => {
console.log('file upload');
var customeApplicationId = this.data.applicationId;


let mapURL =
process.env.REACT_APP_CUSTOM_FILE_UPLOAD || window._env_.REACT_APP_CUSTOM_FILE_UPLOAD;

window.open(
mapURL + "?appId=" + customeApplicationId ,
"_blank",
"popup=yes,width=500px,heigth=500px"
);

console.log("adding listner end");

return false;
}}
>
View / Upload Documents
</a>,
element,
() => (this.reactInstance = instance)
);
}

/**
* Automatically detach any react components.
*
* @param element
*/
detachReact(element) {
if (element) {
ReactDOM.unmountComponentAtNode(element);
}
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import baseEditForm from 'formiojs/components/_classes/component/Component.form';

const settingsForm = (...extend) => {
return baseEditForm([
{
key: 'display',
components: [
{
key: 'placeholder',
ignore: true,
},
]
},
{
key: 'data',
components: [],
},
{
key: 'validation',
components: [],
},
{
key: 'api',
components: [],
},
{
key: 'conditional',
components: [],
},
{
key: 'logic',
components: [],
},
], ...extend);
};

export default settingsForm;

0 comments on commit c49de62

Please sign in to comment.