How to use the diagram-js/lib/command/CommandInterceptor.default function in diagram-js

To help you get started, we’ve selected a few diagram-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpmn-io / cmmn-js / lib / features / modeling / behavior / LabelBehavior.js View on Github external
var LabelUtil = require('../../../util/LabelUtil'),
    ModelUtil = require('../../../util/ModelUtil'),
    DiUtil = require('../../../util/DiUtil'),
    ModelingUtil = require('../util/ModelingUtil');

var getBusinessObject = ModelUtil.getBusinessObject,
    getName = ModelUtil.getName;

var hasExternalLabel = LabelUtil.hasExternalLabel,
    getExternalLabelMid = LabelUtil.getExternalLabelMid;

var isStandardEventVisible = DiUtil.isStandardEventVisible;

var isAny = ModelingUtil.isAny;

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;


/**
 * A component that makes sure that external labels are added
 * together with respective elements and properly updated (DI wise)
 * during move.
 *
 * @param {EventBus} eventBus
 * @param {Modeling} modeling
 * @param {cmmnFactory} cmmnFactory
 */
function LabelBehavior(eventBus, modeling, cmmnFactory) {

  CommandInterceptor.call(this, eventBus);

  // create external labels on shape creation
github bpmn-io / cmmn-js / lib / features / modeling / behavior / UnclaimIdBehavior.js View on Github external
'use strict';

var forEach = require('min-dash').forEach;

var inherits = require('inherits');

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

function UnclaimIdBehavior(eventBus, modeling) {

  CommandInterceptor.call(this, eventBus);

  this.preExecute('elements.delete', function(event) {
    var context = event.context,
        elements = context.elements;

    forEach(elements, function(element) {
      modeling.unclaimId(element.businessObject.id, element.businessObject);
    });

  });
}
github bpmn-io / cmmn-js / lib / features / modeling / behavior / PlanItemDefinitionUpdater.js View on Github external
'use strict';

var inherits = require('inherits');

var forEach = require('min-dash').forEach,
    unionBy = require('min-dash').unionBy,
    filter = require('min-dash').filter;

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var ModelUtil = require('../../../util/ModelUtil'),
    is = ModelUtil.is,
    getDefinition = ModelUtil.getDefinition,
    getBusinessObject = ModelUtil.getBusinessObject;

var ModelingUtil = require('../util/ModelingUtil'),
    getParents = ModelingUtil.getParents,
    getParent = ModelingUtil.getParent,
    getCase = ModelingUtil.getCase,
    isLabel = ModelingUtil.isLabel;

var PlanItemDefinitionUtil = require('../util/PlanItemDefinitionUtil'),
    getAllDiscretionaryItems = PlanItemDefinitionUtil.getAllDiscretionaryItems,
    getDirectItemCapables = PlanItemDefinitionUtil.getDirectItemCapables,
    isItemCapable = PlanItemDefinitionUtil.isItemCapable,
github bpmn-io / cmmn-js / lib / features / modeling / behavior / CaseFileItemUpdater.js View on Github external
'use strict';

var inherits = require('inherits');

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var forEach = require('min-dash').forEach;
var filter = require('min-dash').filter;
var reduce = require('min-dash').reduce;

var ModelUtil = require('../../../util/ModelUtil'),
    getDefinition = ModelUtil.getDefinition,
    getBusinessObject = ModelUtil.getBusinessObject,
    is = ModelUtil.is;

var ModelingUtil = require('../util/ModelingUtil'),
    getCase = ModelingUtil.getCase,
    getParent = ModelingUtil.getParent,
    isSameCase = ModelingUtil.isSameCase,
    isLabel = ModelingUtil.isLabel;
github bpmn-io / cmmn-js / lib / features / modeling / behavior / AttachCriterionBehavior.js View on Github external
'use strict';

var inherits = require('inherits');

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var ModelUtil = require('../../../util/ModelUtil'),
    is = ModelUtil.is,
    isCasePlanModel = ModelUtil.isCasePlanModel;

/*
 * If a criterion is (re-)attached to a case plan model,
 * then the (visual) parent must be the case plan model itself,
 * and not the root element.
 */
function AttachCriterionBehavior(eventBus) {

  CommandInterceptor.call(this, eventBus);

  this.preExecute([ 'shape.create', 'elements.move' ], function(context) {
github bpmn-io / cmmn-js / lib / features / modeling / behavior / SentryUpdater.js View on Github external
'use strict';

var inherits = require('inherits');

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var forEach = require('min-dash').forEach,
    flatten = require('min-dash').flatten,
    groupBy = require('min-dash').groupBy,
    map = require('min-dash').map,
    some = require('min-dash').some;

var ModelUtil = require('../../../util/ModelUtil'),
    is = ModelUtil.is,
    isCasePlanModel = ModelUtil.isCasePlanModel,
    getSentry = ModelUtil.getSentry,
    getBusinessObject = ModelUtil.getBusinessObject,
    getDefinition = ModelUtil.getDefinition,
    getStandardEvents = ModelUtil.getStandardEvents;

var getParent = require('../util/ModelingUtil').getParent;
github bpmn-io / cmmn-js / lib / features / modeling / behavior / PlanningTableUpdater.js View on Github external
'use strict';

var inherits = require('inherits');

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var some = require('min-dash').some,
    forEach = require('min-dash').forEach;

var ModelUtil = require('../../../util/ModelUtil'),
    is = ModelUtil.is,
    isCasePlanModel = ModelUtil.isCasePlanModel,
    getDefinition = ModelUtil.getDefinition,
    getBusinessObject = ModelUtil.getBusinessObject;

var getParent = require('../util/ModelingUtil').getParent,
    isLabel = require('../util/ModelingUtil').isLabel,
    getParents = require('../util/ModelingUtil').getParents;

var PlanItemDefinitionUtil = require('../util/PlanItemDefinitionUtil'),
    isDiscretionaryToHumanTask = PlanItemDefinitionUtil.isDiscretionaryToHumanTask,
github bpmn-io / cmmn-js / lib / features / modeling / behavior / ReplaceConnectionBehavior.js View on Github external
'use strict';

var forEach = require('min-dash').forEach,
    inherits = require('inherits'),
    assign = require('min-dash').assign;

var isArray = require('min-dash').isArray;

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var is = require('../../../util/ModelUtil').is;

var LOW_PRIORITY = 200,
    HIGH_PRIORITY = 5000;

function ReplaceConnectionBehavior(eventBus, modeling, cmmnRules, selection, rules) {

  CommandInterceptor.call(this, eventBus);


  function canConnectPlanItemOnPartConnection(source, target) {
    return cmmnRules.canConnectPlanItemOnPartConnection(source, target);
  }
github bpmn-io / cmmn-js / lib / features / modeling / CmmnUpdater.js View on Github external
'use strict';

var assign = require('min-dash').assign,
    inherits = require('inherits');

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var Collections = require('diagram-js/lib/util/Collections');

var getBusinessObject = require('../../util/ModelUtil').getBusinessObject,
    is = require('../../util/ModelUtil').is,
    isCasePlanModel = require('../../util/ModelUtil').isCasePlanModel;

var getParent = require('./util/ModelingUtil').getParent,
    isLabel = require('./util/ModelingUtil').isLabel;

var isAny = require('./util/ModelingUtil').isAny;

/**
 * A handler responsible for updating the underlying CMMN 1.1 XML + DI
 * once changes on the diagram happen
 */
github bpmn-io / cmmn-js / lib / features / replace-preview / CmmnReplacePreview.js View on Github external
'use strict';

var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor').default;

var cssEscape = require('css.escape');

var inherits = require('inherits');

var assign = require('min-dash').assign,
    forEach = require('min-dash').forEach;

var getVisual = require('diagram-js/lib/util/GraphicsUtil').getVisual;

var isItemCapable = require('../modeling/util/PlanItemDefinitionUtil').isItemCapable;

var ModelUtil = require('../../util/ModelUtil'),
    getBusinessObject = ModelUtil.getBusinessObject,
    getDefinition = ModelUtil.getDefinition;