mixinPanel.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import xcrud from 'xcrud'
  2. import golbalConfig from 'xcrud/package/common/config'
  3. import showConfig from '../flowable/showConfig'
  4. golbalConfig.set({
  5. input: {
  6. // size: 'mini'
  7. },
  8. select: {
  9. // size: 'mini'
  10. },
  11. colorPicker: {
  12. showAlpha: true
  13. },
  14. xform: {
  15. form: {
  16. labelWidth: 'auto'
  17. // size: 'mini'
  18. }
  19. }
  20. })
  21. export default {
  22. components: { xForm: xcrud.xForm },
  23. props: {
  24. modeler: {
  25. type: Object,
  26. required: true
  27. },
  28. element: {
  29. type: Object,
  30. required: true
  31. },
  32. categorys: {
  33. type: Array,
  34. default: () => []
  35. }
  36. },
  37. watch: {
  38. 'formData.id': function(val) {
  39. this.updateProperties({ id: val })
  40. },
  41. 'formData.name': function(val) {
  42. this.updateProperties({ name: val })
  43. },
  44. 'formData.documentation': function(val) {
  45. if (!val) {
  46. this.updateProperties({ documentation: [] })
  47. return
  48. }
  49. const documentationElement = this.modeler.get('moddle').create('bpmn:Documentation', { text: val })
  50. this.updateProperties({ documentation: [documentationElement] })
  51. }
  52. },
  53. methods: {
  54. updateProperties(properties) {
  55. const modeling = this.modeler.get('modeling')
  56. modeling.updateProperties(this.element, properties)
  57. }
  58. },
  59. computed: {
  60. elementType() {
  61. const bizObj = this.element.businessObject
  62. return bizObj.eventDefinitions
  63. ? bizObj.eventDefinitions[0].$type
  64. : bizObj.$type
  65. },
  66. showConfig() {
  67. return showConfig[this.elementType] || {}
  68. }
  69. }
  70. }