generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #627 from bcgov/SRS-188-NEW
updated folder name
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
...-flow-ai-ee/forms-flow-web/src/custom-components/application-file-upload/AppFileUpload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
38 changes: 38 additions & 0 deletions
38
...orms-flow-web/src/custom-components/application-file-upload/appFileUpload.settingsForm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|