mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-22 13:48:16 +00:00
parent
fb3398fa39
commit
93a4a579dd
@ -6,7 +6,15 @@ import {
|
|||||||
getLabel
|
getLabel
|
||||||
} from './LabelUtil';
|
} from './LabelUtil';
|
||||||
|
|
||||||
import { is } from '../../util/ModelUtil';
|
import {
|
||||||
|
getBusinessObject,
|
||||||
|
is
|
||||||
|
} from '../../util/ModelUtil';
|
||||||
|
|
||||||
|
import {
|
||||||
|
createCategoryValue
|
||||||
|
} from '../modeling/behavior/util/CategoryUtil';
|
||||||
|
|
||||||
import { isAny } from '../modeling/util/ModelingUtil';
|
import { isAny } from '../modeling/util/ModelingUtil';
|
||||||
import { isExpanded } from '../../util/DiUtil';
|
import { isExpanded } from '../../util/DiUtil';
|
||||||
|
|
||||||
@ -19,9 +27,10 @@ import {
|
|||||||
|
|
||||||
|
|
||||||
export default function LabelEditingProvider(
|
export default function LabelEditingProvider(
|
||||||
eventBus, canvas, directEditing,
|
eventBus, bpmnFactory, canvas, directEditing,
|
||||||
modeling, resizeHandles, textRenderer) {
|
modeling, resizeHandles, textRenderer) {
|
||||||
|
|
||||||
|
this._bpmnFactory = bpmnFactory;
|
||||||
this._canvas = canvas;
|
this._canvas = canvas;
|
||||||
this._modeling = modeling;
|
this._modeling = modeling;
|
||||||
this._textRenderer = textRenderer;
|
this._textRenderer = textRenderer;
|
||||||
@ -102,6 +111,7 @@ export default function LabelEditingProvider(
|
|||||||
|
|
||||||
LabelEditingProvider.$inject = [
|
LabelEditingProvider.$inject = [
|
||||||
'eventBus',
|
'eventBus',
|
||||||
|
'bpmnFactory',
|
||||||
'canvas',
|
'canvas',
|
||||||
'directEditing',
|
'directEditing',
|
||||||
'modeling',
|
'modeling',
|
||||||
@ -370,6 +380,23 @@ LabelEditingProvider.prototype.update = function(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is(element, 'bpmn:Group')) {
|
||||||
|
|
||||||
|
var businessObject = getBusinessObject(element);
|
||||||
|
|
||||||
|
// initialize categoryValue if not existing
|
||||||
|
if (!businessObject.categoryValueRef) {
|
||||||
|
|
||||||
|
var rootElement = this._canvas.getRootElement(),
|
||||||
|
definitions = getBusinessObject(rootElement).$parent;
|
||||||
|
|
||||||
|
var categoryValue = createCategoryValue(definitions, this._bpmnFactory);
|
||||||
|
|
||||||
|
getBusinessObject(element).categoryValueRef = categoryValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (isEmptyText(newLabel)) {
|
if (isEmptyText(newLabel)) {
|
||||||
newLabel = null;
|
newLabel = null;
|
||||||
}
|
}
|
||||||
|
@ -421,6 +421,38 @@ describe('features - label-editing', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('group support', function() {
|
||||||
|
|
||||||
|
beforeEach(bootstrapModeler(diagramXML, {
|
||||||
|
modules: [
|
||||||
|
labelEditingModule,
|
||||||
|
coreModule,
|
||||||
|
modelingModule
|
||||||
|
],
|
||||||
|
canvas: { deferUpdate: false }
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should initialize categoryValue for empty group', inject(
|
||||||
|
function(elementRegistry, directEditing) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var shape = elementRegistry.get('Group_2');
|
||||||
|
|
||||||
|
// when
|
||||||
|
directEditing.activate(shape);
|
||||||
|
directEditing._textbox.content.innerText = 'FOO';
|
||||||
|
directEditing.complete();
|
||||||
|
|
||||||
|
// then
|
||||||
|
var label = getLabel(shape);
|
||||||
|
|
||||||
|
expect(shape.businessObject.categoryValueRef).to.exist;
|
||||||
|
expect(label).to.equal('FOO');
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
describe('sizes', function() {
|
describe('sizes', function() {
|
||||||
|
|
||||||
beforeEach(bootstrapModeler(diagramXML, {
|
beforeEach(bootstrapModeler(diagramXML, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user