I am attempting to create a simple post it feature and add it to my BPMN, the BPMN currently has a few customs etc (was not made by me).
I have been reading the Custom Examples and I have so far done the following:
Create it on custom renderer, created it on a custom contextpad, added it to custom palette.
I click on my “post it” and it doesn’t render, I get the following error:
Uncaught Error: unknown type bpmn:PostIt
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.mi.mapTypes (bpmn-modeler.production.min.js:7:36300)
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.mi.getEffectiveDescriptor (bpmn-modeler.production.min.js:7:36468)
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.bi.getType (bpmn-modeler.production.min.js:7:37519)
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.bi.create (bpmn-modeler.production.min.js:7:37354)
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.sm.create (bpmn-modeler.production.min.js:34:231229)
at Object.click (CustomPalette.js:25:1)
at ./node_modules/bpmn-js/node_modules/diagram-js/lib/features/palette/Palette.js.Palette.trigger (Palette.js:316:1)
at HTMLDivElement. (Palette.js:156:1)
at HTMLDivElement. (index.esm.js:454:1)
I have added it to node_modules/bpmn-moddle, just to test if it would stop the error, it didn’t :
Where should I go from here to make it work? I would also accept using already-made similar post-it types that I could use instead of making one from scratch
@ahmandi This indicates that you did not define an element bpmn:PostIt.
Adding it to node_modules/bpmn-moddle won’t work as you are using a pre-built distribution of bpmn-js, cf. stack trace you published. I suggest you to not use a pre-built distribution:
import BpmnModeler from 'bpmn-js/lib/Modeler';
...
That better sets you up for such experiments, and customizing.
import * as BpmnJS from ‘bpmn-js/dist/bpmn-modeler.production.min.js’;
import postItExtension from ‘…/resources/postIt.json’
…
var modeler = new BpmnJS({
…
},
moddleExtensions: {
postIt: postItExtension
},
…
Now when I click my shape to drag it to the board, I get the following error:
bpmn-modeler.production.min.js:7 unhandled error in event listener TypeError: this._renderer(…) is not a function
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.ro.drawShape (bpmn-modeler.production.min.js:27:27225)
at CustomRenderer.drawShape (CustomRenderer.js:39:1)
at BaseRenderer.js:21:1
at bpmn-modeler.production.min.js:7:27481
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.Yn._invokeListener (bpmn-modeler.production.min.js:7:27504)
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.Yn._invokeListeners (bpmn-modeler.production.min.js:7:27328)
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.Yn.fire (bpmn-modeler.production.min.js:7:27015)
at ./node_modules/bpmn-js/dist/bpmn-modeler.production.min.js.ti.drawShape (bpmn-modeler.production.min.js:7:29497)
at CreatePreview.js:47:1
at Array.forEach ()
I have on my CustomRenderer.js the following:
drawShape(parentNode, element) {
var type = element.type;
if (type === ‘postit:PostIt’) {
const color = ‘#52B415’
const rect = drawRect(parentNode, 50, 20, TASK_BORDER_RADIUS, color)
return rect
}
…
return shape}