Skip to content

Commit

Permalink
chore(deps): update to form-js@0.4.1
Browse files Browse the repository at this point in the history
related to CAM-13719, CAM-13333
  • Loading branch information
marstamm committed Sep 9, 2021
1 parent 2142eb5 commit d9112ec
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 47 deletions.
58 changes: 27 additions & 31 deletions webapps/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"dependencies": {
"@bpmn-io/dmn-migrate": "0.4.3",
"@bpmn-io/form-js": "0.1.0",
"@bpmn-io/form-js": "0.4.1",
"angular": "1.8.2",
"angular-animate": "1.8.2",
"angular-cookies": "1.8.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var fs = require('fs');

var template = fs.readFileSync(__dirname + '/cam-cockpit-form.html', 'utf8');

const createForm = require('@bpmn-io/form-js-viewer').createForm;
const Form = require('@bpmn-io/form-js').Form;

module.exports = [
function() {
Expand All @@ -38,17 +38,18 @@ module.exports = [
link: function($scope, $element) {
$scope.error = null;

try {
async function createForm() {
const json = JSON.parse($scope.source);
const form = createForm({
container: $element.find('.camundaForm')[0],
schema: json,
data: {}
const form = new Form({
container: $element.find('.camundaForm')[0]
});
await form.importSchema(json);
form.setProperty('readOnly', true);
} catch (e) {
$scope.error = e;
}

createForm().catch(e => {
$scope.error = e;
});
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

'use strict';
const createForm = require('@bpmn-io/form-js-viewer').createForm;
const Form = require('@bpmn-io/form-js').Form;

var angular = require('../../../../../../camunda-commons-ui/vendor/angular');

Expand Down Expand Up @@ -85,17 +85,17 @@ module.exports = [
});
};

function renderForm(schema) {
async function renderForm(schema) {
const data = variables.reduce((res, variable) => {
res[variable.name] = variable.value;
return res;
}, {});

form = createForm({
container: $element[0],
schema,
data: {...data, ...savedState}
form = new Form({
container: $element[0]
});

await form.importSchema(schema, {...data, ...savedState});
formController.notifyFormInitialized();

form.on('submit', () => {
Expand Down Expand Up @@ -180,7 +180,7 @@ module.exports = [
const json = await res.json();

await loadVariables();
renderForm(json);
await renderForm(json);
})
.catch(err => {
formController.notifyFormInitializationFailed(err);
Expand Down

0 comments on commit d9112ec

Please sign in to comment.