camunda-bpmn-js 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91191,19 +91191,22 @@
91191
91191
  xlinkHref: "#a"
91192
91192
  }))));
91193
91193
 
91194
- const PanelPlaceholderProvider = {
91195
- getEmpty: () => {
91196
- return {
91197
- text: 'Select an element to edit its properties.',
91198
- icon: EmptyIcon
91199
- };
91200
- },
91201
- getMultiple: () => {
91202
- return {
91203
- text: 'Multiple elements are selected. Select a single element to edit its properties.',
91204
- icon: MultipleIcon
91205
- };
91206
- }
91194
+ const PanelPlaceholderProvider = translate => {
91195
+ if (!translate) translate = text => text;
91196
+ return {
91197
+ getEmpty: () => {
91198
+ return {
91199
+ text: translate('Select an element to edit its properties.'),
91200
+ icon: EmptyIcon
91201
+ };
91202
+ },
91203
+ getMultiple: () => {
91204
+ return {
91205
+ text: translate('Multiple elements are selected. Select a single element to edit its properties.'),
91206
+ icon: MultipleIcon
91207
+ };
91208
+ }
91209
+ };
91207
91210
  };
91208
91211
 
91209
91212
  function BpmnPropertiesPanel(props) {
@@ -91217,6 +91220,7 @@
91217
91220
  const canvas = injector.get('canvas');
91218
91221
  const elementRegistry = injector.get('elementRegistry');
91219
91222
  const eventBus = injector.get('eventBus');
91223
+ const translate = injector.get('translate');
91220
91224
  const [state, setState] = l$1({
91221
91225
  selectedElement: element
91222
91226
  });
@@ -91365,7 +91369,7 @@
91365
91369
  children: o$1(PropertiesPanel, {
91366
91370
  element: selectedElement,
91367
91371
  headerProvider: PanelHeaderProvider,
91368
- placeholderProvider: PanelPlaceholderProvider,
91372
+ placeholderProvider: PanelPlaceholderProvider(translate),
91369
91373
  groups: groups,
91370
91374
  layoutConfig: layoutConfig,
91371
91375
  layoutChanged: onLayoutChanged,
@@ -93532,7 +93536,7 @@
93532
93536
  }
93533
93537
 
93534
93538
  function isTimerSupported(element) {
93535
- return isAny(element, ['bpmn:StartEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:BoundaryEvent']) && !!getTimerEventDefinition(element);
93539
+ return isAny(element, ['bpmn:StartEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:BoundaryEvent']) && !!getTimerEventDefinition$1(element);
93536
93540
  }
93537
93541
  /**
93538
93542
  * Get the timer definition type for a given timer event definition.
@@ -93565,7 +93569,7 @@
93565
93569
  return 'timeDuration';
93566
93570
  }
93567
93571
  }
93568
- function getTimerEventDefinition(element) {
93572
+ function getTimerEventDefinition$1(element) {
93569
93573
  return getEventDefinition(element, 'bpmn:TimerEventDefinition');
93570
93574
  }
93571
93575
  function getEventDefinition(element, eventType) {
@@ -93588,7 +93592,7 @@
93588
93592
 
93589
93593
  if (!timerEventDefinition) {
93590
93594
  const businessObject = getBusinessObject$1(element);
93591
- timerEventDefinition = getTimerEventDefinition(businessObject);
93595
+ timerEventDefinition = getTimerEventDefinition$1(businessObject);
93592
93596
  }
93593
93597
 
93594
93598
  const timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition); // (1) Only show for supported elements
@@ -93818,14 +93822,15 @@
93818
93822
  }
93819
93823
 
93820
93824
  function isTimerSupportedOnListener$1(listener) {
93821
- return listener && is$5(listener, 'camunda:TaskListener') && getTimerEventDefinition(listener);
93825
+ return listener && is$5(listener, 'camunda:TaskListener') && getTimerEventDefinition$1(listener);
93822
93826
  }
93823
93827
 
93824
93828
  function getId$1(idPrefix, id) {
93825
93829
  return idPrefix ? idPrefix + id : id;
93826
93830
  }
93827
93831
 
93828
- function GeneralGroup(element) {
93832
+ function GeneralGroup(element, injector) {
93833
+ const translate = injector.get('translate');
93829
93834
  const entries = [...NameProps({
93830
93835
  element
93831
93836
  }), ...IdProps(), ...ProcessProps({
@@ -93835,15 +93840,16 @@
93835
93840
  })];
93836
93841
  return {
93837
93842
  id: 'general',
93838
- label: 'General',
93843
+ label: translate('General'),
93839
93844
  entries,
93840
93845
  component: Group
93841
93846
  };
93842
93847
  }
93843
93848
 
93844
- function CompensationGroup(element) {
93849
+ function CompensationGroup(element, injector) {
93850
+ const translate = injector.get('translate');
93845
93851
  const group = {
93846
- label: 'Compensation',
93852
+ label: translate('Compensation'),
93847
93853
  id: 'compensation',
93848
93854
  component: Group,
93849
93855
  entries: [...CompensationProps({
@@ -93858,22 +93864,24 @@
93858
93864
  return null;
93859
93865
  }
93860
93866
 
93861
- function DocumentationGroup(element) {
93867
+ function DocumentationGroup(element, injector) {
93868
+ const translate = injector.get('translate');
93862
93869
  const entries = [...DocumentationProps({
93863
93870
  element
93864
93871
  })];
93865
93872
  return {
93866
93873
  id: 'documentation',
93867
- label: 'Documentation',
93874
+ label: translate('Documentation'),
93868
93875
  entries,
93869
93876
  component: Group
93870
93877
  };
93871
93878
  }
93872
93879
 
93873
- function ErrorGroup(element) {
93880
+ function ErrorGroup(element, injector) {
93881
+ const translate = injector.get('translate');
93874
93882
  const group = {
93875
93883
  id: 'error',
93876
- label: 'Error',
93884
+ label: translate('Error'),
93877
93885
  component: Group,
93878
93886
  entries: [...ErrorProps$1({
93879
93887
  element
@@ -93887,10 +93895,11 @@
93887
93895
  return null;
93888
93896
  }
93889
93897
 
93890
- function MessageGroup(element) {
93898
+ function MessageGroup(element, injector) {
93899
+ const translate = injector.get('translate');
93891
93900
  const group = {
93892
93901
  id: 'message',
93893
- label: 'Message',
93902
+ label: translate('Message'),
93894
93903
  component: Group,
93895
93904
  entries: [...MessageProps$1({
93896
93905
  element
@@ -93904,10 +93913,11 @@
93904
93913
  return null;
93905
93914
  }
93906
93915
 
93907
- function SignalGroup(element) {
93916
+ function SignalGroup(element, injector) {
93917
+ const translate = injector.get('translate');
93908
93918
  const group = {
93909
93919
  id: 'signal',
93910
- label: 'Signal',
93920
+ label: translate('Signal'),
93911
93921
  component: Group,
93912
93922
  entries: [...SignalProps({
93913
93923
  element
@@ -93921,9 +93931,10 @@
93921
93931
  return null;
93922
93932
  }
93923
93933
 
93924
- function LinkGroup(element) {
93934
+ function LinkGroup(element, injector) {
93935
+ const translate = injector.get('translate');
93925
93936
  const group = {
93926
- label: 'Link',
93937
+ label: translate('Link'),
93927
93938
  id: 'link',
93928
93939
  component: Group,
93929
93940
  entries: [...LinkProps({
@@ -93938,10 +93949,11 @@
93938
93949
  return null;
93939
93950
  }
93940
93951
 
93941
- function EscalationGroup(element) {
93952
+ function EscalationGroup(element, injector) {
93953
+ const translate = injector.get('translate');
93942
93954
  const group = {
93943
93955
  id: 'escalation',
93944
- label: 'Escalation',
93956
+ label: translate('Escalation'),
93945
93957
  component: Group,
93946
93958
  entries: [...EscalationProps$1({
93947
93959
  element
@@ -93955,9 +93967,10 @@
93955
93967
  return null;
93956
93968
  }
93957
93969
 
93958
- function TimerGroup(element) {
93970
+ function TimerGroup(element, injector) {
93971
+ const translate = injector.get('translate');
93959
93972
  const group = {
93960
- label: 'Timer',
93973
+ label: translate('Timer'),
93961
93974
  id: 'timer',
93962
93975
  component: Group,
93963
93976
  entries: [...TimerProps$2({
@@ -93972,9 +93985,10 @@
93972
93985
  return null;
93973
93986
  }
93974
93987
 
93975
- function MultiInstanceGroup(element) {
93988
+ function MultiInstanceGroup(element, injector) {
93989
+ const translate = injector.get('translate');
93976
93990
  const group = {
93977
- label: 'Multi-instance',
93991
+ label: translate('Multi-instance'),
93978
93992
  id: 'multiInstance',
93979
93993
  component: Group,
93980
93994
  entries: [...MultiInstanceProps$2({
@@ -93989,26 +94003,27 @@
93989
94003
  return null;
93990
94004
  }
93991
94005
 
93992
- function getGroups(element) {
93993
- const groups = [GeneralGroup(element), DocumentationGroup(element), CompensationGroup(element), ErrorGroup(element), LinkGroup(element), MessageGroup(element), MultiInstanceGroup(element), SignalGroup(element), EscalationGroup(element), TimerGroup(element)]; // contract: if a group returns null, it should not be displayed at all
94006
+ function getGroups(element, injector) {
94007
+ const groups = [GeneralGroup(element, injector), DocumentationGroup(element, injector), CompensationGroup(element, injector), ErrorGroup(element, injector), LinkGroup(element, injector), MessageGroup(element, injector), MultiInstanceGroup(element, injector), SignalGroup(element, injector), EscalationGroup(element, injector), TimerGroup(element, injector)]; // contract: if a group returns null, it should not be displayed at all
93994
94008
 
93995
94009
  return groups.filter(group => group !== null);
93996
94010
  }
93997
94011
 
93998
94012
  class BpmnPropertiesProvider {
93999
- constructor(propertiesPanel) {
94013
+ constructor(propertiesPanel, injector) {
94000
94014
  propertiesPanel.registerProvider(this);
94015
+ this._injector = injector;
94001
94016
  }
94002
94017
 
94003
94018
  getGroups(element) {
94004
94019
  return groups => {
94005
- groups = groups.concat(getGroups(element));
94020
+ groups = groups.concat(getGroups(element, this._injector));
94006
94021
  return groups;
94007
94022
  };
94008
94023
  }
94009
94024
 
94010
94025
  }
94011
- BpmnPropertiesProvider.$inject = ['propertiesPanel'];
94026
+ BpmnPropertiesProvider.$inject = ['propertiesPanel', 'injector'];
94012
94027
 
94013
94028
  var index$2 = {
94014
94029
  __init__: ['bpmnPropertiesProvider'],
@@ -96693,46 +96708,70 @@
96693
96708
 
96694
96709
  function TimerProps$1(props) {
96695
96710
  const {
96696
- element
96711
+ element,
96712
+ injector
96697
96713
  } = props;
96714
+ const translate = injector.get('translate');
96698
96715
  const businessObject = getBusinessObject$1(element),
96699
- timerEventDefinition = getTimerEventDefinition(businessObject),
96716
+ timerEventDefinition = getTimerEventDefinition$1(businessObject),
96700
96717
  timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition); // (1) Only show for supported elements
96701
96718
 
96702
96719
  if (!isTimerSupported(element)) {
96703
96720
  return [];
96704
- } // (2) Return duration-specific TexField only if only duration is supported
96705
-
96706
-
96707
- const onlySupportDuration = !isTimerDefinitionTypeSupported('timeCycle', element) && !isTimerDefinitionTypeSupported('timeDate', element); // (3) Only provide duration-specific textField if only duration is supported,
96708
- // otherwise push type-select and generic textField is type was selected
96721
+ }
96709
96722
 
96723
+ const timerOptions = getTimerOptions(element, translate);
96724
+ const singleOption = timerOptions.length === 1;
96710
96725
  const entries = [];
96711
96726
 
96712
- if (onlySupportDuration) {
96713
- entries.push({
96714
- id: 'timerEventDefinitionDurationValue',
96715
- component: TimerEventDefinitionDurationValue,
96716
- isEdited: isEdited$6
96717
- });
96718
- } else {
96727
+ if (!singleOption) {
96719
96728
  entries.push({
96720
96729
  id: 'timerEventDefinitionType',
96721
96730
  component: TimerEventDefinitionType$1,
96722
- isEdited: isEdited$4
96731
+ isEdited: isEdited$4,
96732
+ options: timerOptions
96723
96733
  });
96734
+ }
96724
96735
 
96725
- if (timerEventDefinitionType) {
96726
- entries.push({
96727
- id: 'timerEventDefinitionValue',
96728
- component: TimerEventDefinitionValue$1,
96729
- isEdited: isEdited$6
96730
- });
96731
- }
96736
+ if (timerEventDefinitionType || singleOption) {
96737
+ entries.push({
96738
+ id: 'timerEventDefinitionValue',
96739
+ component: TimerEventDefinitionValue$1,
96740
+ isEdited: isEdited$6,
96741
+ label: singleOption ? timerOptions[0].label : undefined,
96742
+ timerEventDefinitionType: timerEventDefinitionType || timerOptions[0].value
96743
+ });
96732
96744
  }
96733
96745
 
96734
96746
  return entries;
96735
96747
  }
96748
+
96749
+ function getTimerOptions(element, translate) {
96750
+ const options = [];
96751
+
96752
+ if (isTimerDefinitionTypeSupported('timeDate', element)) {
96753
+ options.push({
96754
+ value: 'timeDate',
96755
+ label: translate('Date')
96756
+ });
96757
+ }
96758
+
96759
+ if (isTimerDefinitionTypeSupported('timeDuration', element)) {
96760
+ options.push({
96761
+ value: 'timeDuration',
96762
+ label: translate('Duration')
96763
+ });
96764
+ }
96765
+
96766
+ if (isTimerDefinitionTypeSupported('timeCycle', element)) {
96767
+ options.push({
96768
+ value: 'timeCycle',
96769
+ label: translate('Cycle')
96770
+ });
96771
+ }
96772
+
96773
+ return options;
96774
+ }
96736
96775
  /**
96737
96776
  * TimerEventDefinitionType - Generic select entry allowing to select a specific
96738
96777
  * timerEventDefintionType. To be used together with timerEventDefinitionValue.
@@ -96741,15 +96780,17 @@
96741
96780
  * @return {SelectEntry}
96742
96781
  */
96743
96782
 
96783
+
96744
96784
  function TimerEventDefinitionType$1(props) {
96745
96785
  const {
96746
- element
96786
+ element,
96787
+ options
96747
96788
  } = props;
96748
96789
  const commandStack = useService('commandStack'),
96749
96790
  bpmnFactory = useService('bpmnFactory'),
96750
96791
  translate = useService('translate');
96751
96792
  const businessObject = getBusinessObject$1(element),
96752
- timerEventDefinition = getTimerEventDefinition(businessObject),
96793
+ timerEventDefinition = getTimerEventDefinition$1(businessObject),
96753
96794
  timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition);
96754
96795
 
96755
96796
  const getValue = () => {
@@ -96763,10 +96804,7 @@
96763
96804
  } // (2) Create empty formalExpression element
96764
96805
 
96765
96806
 
96766
- const formalExpression = bpmnFactory.create('bpmn:FormalExpression', {
96767
- body: undefined
96768
- });
96769
- formalExpression.$parent = timerEventDefinition; // (3) Set the value for selected timerEventDefinitionType
96807
+ const formalExpression = createTimerFormalExpression(bpmnFactory, timerEventDefinition); // (3) Set the value for selected timerEventDefinitionType
96770
96808
 
96771
96809
  const newProps = {
96772
96810
  timeDuration: undefined,
@@ -96787,33 +96825,10 @@
96787
96825
  };
96788
96826
 
96789
96827
  const getOptions = element => {
96790
- const options = [{
96828
+ return [{
96791
96829
  value: '',
96792
96830
  label: translate('<none>')
96793
- }];
96794
-
96795
- if (isTimerDefinitionTypeSupported('timeDate', element)) {
96796
- options.push({
96797
- value: 'timeDate',
96798
- label: translate('Date')
96799
- });
96800
- }
96801
-
96802
- if (isTimerDefinitionTypeSupported('timeDuration', element)) {
96803
- options.push({
96804
- value: 'timeDuration',
96805
- label: translate('Duration')
96806
- });
96807
- }
96808
-
96809
- if (isTimerDefinitionTypeSupported('timeCycle', element)) {
96810
- options.push({
96811
- value: 'timeCycle',
96812
- label: translate('Cycle')
96813
- });
96814
- }
96815
-
96816
- return options;
96831
+ }, ...options];
96817
96832
  };
96818
96833
 
96819
96834
  return SelectEntry({
@@ -96830,28 +96845,49 @@
96830
96845
  * timerEventDefintionValue based on the set timerEventDefintionType. To be used
96831
96846
  * together with timerEventDefinitionType.
96832
96847
  *
96833
- * @param {type} props
96848
+ * @param {object} props
96849
+ * @param {ModdleElement} props.element
96850
+ * @param {'timeCycle'|'timeDate'|'timeDuration'} props.timerEventDefinitionType?
96851
+ * @param {string} props.label?
96834
96852
  * @return {TextFieldEntry}
96835
96853
  */
96836
96854
 
96837
96855
 
96838
96856
  function TimerEventDefinitionValue$1(props) {
96839
96857
  const {
96840
- element
96858
+ element,
96859
+ label,
96860
+ timerEventDefinitionType
96841
96861
  } = props;
96842
96862
  const commandStack = useService('commandStack'),
96843
96863
  translate = useService('translate'),
96844
- debounce = useService('debounceInput');
96864
+ debounce = useService('debounceInput'),
96865
+ bpmnFactory = useService('bpmnFactory');
96845
96866
  const businessObject = getBusinessObject$1(element),
96846
- timerEventDefinition = getTimerEventDefinition(businessObject),
96847
- timerEventDefinitionType = getTimerDefinitionType(timerEventDefinition),
96848
- timerEventFormalExpression = timerEventDefinition.get(timerEventDefinitionType);
96867
+ timerEventDefinition = getTimerEventDefinition$1(businessObject),
96868
+ timerEventFormalExpression = timerEventDefinition.get(timerEventDefinitionType); // TODO(@barmac): remove with next major release
96869
+ // support `timerEventDefinitionDurationValue` for backwards compatibility
96870
+
96871
+ const legacyId = getLegacyId(element);
96849
96872
 
96850
96873
  const getValue = () => {
96851
96874
  return timerEventFormalExpression && timerEventFormalExpression.get('body');
96852
96875
  };
96853
96876
 
96854
96877
  const setValue = value => {
96878
+ if (!timerEventFormalExpression) {
96879
+ const expression = createTimerFormalExpression(bpmnFactory, timerEventDefinition);
96880
+ expression.set('body', value);
96881
+ commandStack.execute('element.updateModdleProperties', {
96882
+ element,
96883
+ moddleElement: timerEventDefinition,
96884
+ properties: {
96885
+ [timerEventDefinitionType]: expression
96886
+ }
96887
+ });
96888
+ return;
96889
+ }
96890
+
96855
96891
  commandStack.execute('element.updateModdleProperties', {
96856
96892
  element,
96857
96893
  moddleElement: timerEventFormalExpression,
@@ -96863,90 +96899,14 @@
96863
96899
 
96864
96900
  return withVariableContext(FeelEntry)({
96865
96901
  element,
96866
- id: 'timerEventDefinitionValue',
96867
- label: translate('Value'),
96902
+ id: legacyId || 'timerEventDefinitionValue',
96903
+ label: label || translate('Value'),
96868
96904
  feel: 'optional',
96869
96905
  getValue,
96870
96906
  setValue,
96871
96907
  debounce,
96872
96908
  description: getTimerEventDefinitionValueDescription$1(timerEventDefinitionType, translate)
96873
96909
  });
96874
- }
96875
- /**
96876
- * TimerEventDefinitionDurationValue - textField entry allowing to specify the
96877
- * duration value. This is to be used stand-alone, without the TimerEventDefinitionType
96878
- *
96879
- * @param {type} props
96880
- * @return {TextFieldEntry}
96881
- */
96882
-
96883
-
96884
- function TimerEventDefinitionDurationValue(props) {
96885
- const {
96886
- element
96887
- } = props;
96888
- const bpmnFactory = useService('bpmnFactory'),
96889
- commandStack = useService('commandStack'),
96890
- translate = useService('translate'),
96891
- debounce = useService('debounceInput');
96892
- const businessObject = getBusinessObject$1(element),
96893
- timerEventDefinition = getTimerEventDefinition(businessObject);
96894
- let timerEventFormalExpression = timerEventDefinition.get('timeDuration');
96895
-
96896
- const getValue = () => {
96897
- return timerEventFormalExpression && timerEventFormalExpression.get('body');
96898
- };
96899
-
96900
- const setValue = value => {
96901
- const commands = []; // (1) re-use formalExpression
96902
-
96903
- if (!timerEventFormalExpression) {
96904
- timerEventFormalExpression = bpmnFactory.create('bpmn:FormalExpression', {
96905
- body: undefined
96906
- });
96907
- timerEventFormalExpression.$parent = timerEventDefinition; // (1.1) update the formalExpression
96908
-
96909
- const properties = {
96910
- timeDuration: timerEventFormalExpression,
96911
- timeDate: undefined,
96912
- timeCycle: undefined
96913
- }; // (1.2) push command
96914
-
96915
- commands.push({
96916
- cmd: 'element.updateModdleProperties',
96917
- context: {
96918
- element,
96919
- moddleElement: timerEventDefinition,
96920
- properties
96921
- }
96922
- });
96923
- } // (2) update value
96924
-
96925
-
96926
- commands.push({
96927
- cmd: 'element.updateModdleProperties',
96928
- context: {
96929
- element,
96930
- moddleElement: timerEventFormalExpression,
96931
- properties: {
96932
- body: value
96933
- }
96934
- }
96935
- }); // (3) commit all commands
96936
-
96937
- commandStack.execute('properties-panel.multi-command-executor', commands);
96938
- };
96939
-
96940
- return withVariableContext(FeelEntry)({
96941
- element,
96942
- id: 'timerEventDefinitionDurationValue',
96943
- label: translate('Timer duration'),
96944
- feel: 'optional',
96945
- getValue,
96946
- setValue,
96947
- debounce,
96948
- description: getTimerEventDefinitionValueDescription$1('timeDuration', translate)
96949
- });
96950
96910
  } // helper //////////////////////////
96951
96911
 
96952
96912
  /**
@@ -96972,7 +96932,7 @@
96972
96932
  return false;
96973
96933
 
96974
96934
  case 'timeCycle':
96975
- if (is$5(element, 'bpmn:StartEvent')) {
96935
+ if (is$5(element, 'bpmn:StartEvent') && !isInterruptingStartEvent$1(businessObject)) {
96976
96936
  return true;
96977
96937
  }
96978
96938
 
@@ -96987,7 +96947,7 @@
96987
96947
  return true;
96988
96948
  }
96989
96949
 
96990
- if (is$5(element, 'bpmn:BoundaryEvent') && !businessObject.cancelActivity) {
96950
+ if (is$5(element, 'bpmn:BoundaryEvent')) {
96991
96951
  return true;
96992
96952
  }
96993
96953
 
@@ -96998,6 +96958,14 @@
96998
96958
  }
96999
96959
  }
97000
96960
 
96961
+ function createTimerFormalExpression(bpmnFactory, eventDefinition) {
96962
+ const formalExpression = bpmnFactory.create('bpmn:FormalExpression', {
96963
+ body: undefined
96964
+ });
96965
+ formalExpression.$parent = eventDefinition;
96966
+ return formalExpression;
96967
+ }
96968
+
97001
96969
  function getTimerEventDefinitionValueDescription$1(timerDefinitionType, translate) {
97002
96970
  switch (timerDefinitionType) {
97003
96971
  case 'timeDate':
@@ -97079,6 +97047,26 @@
97079
97047
  }
97080
97048
  }
97081
97049
 
97050
+ function isInterruptingStartEvent$1(bo) {
97051
+ return isInEventSubProcess$1(bo) && bo.get('isInterrupting') !== false;
97052
+ }
97053
+
97054
+ function isInEventSubProcess$1(bo) {
97055
+ const parent = bo.$parent;
97056
+ return is$5(parent, 'bpmn:SubProcess') && parent.triggeredByEvent;
97057
+ }
97058
+
97059
+ function getLegacyId(event) {
97060
+ if (is$5(event, 'bpmn:IntermediateCatchEvent') || isInterruptingBoundaryEvent(event)) {
97061
+ return 'timerEventDefinitionDurationValue';
97062
+ }
97063
+ }
97064
+
97065
+ function isInterruptingBoundaryEvent(event) {
97066
+ const bo = getBusinessObject$1(event);
97067
+ return is$5(bo, 'bpmn:BoundaryEvent') && bo.get('cancelActivity') !== false;
97068
+ }
97069
+
97082
97070
  function ExtensionProperty(props) {
97083
97071
  const {
97084
97072
  idPrefix,
@@ -97370,7 +97358,7 @@
97370
97358
  groups = groups.concat(this._getGroups(element)); // (2) update existing groups with zeebe specific properties
97371
97359
 
97372
97360
  updateMessageGroup(groups, element);
97373
- updateTimerGroup$1(groups, element);
97361
+ updateTimerGroup$1(groups, element, this._injector);
97374
97362
  updateMultiInstanceGroup$1(groups, element); // (3) remove message group when not applicable
97375
97363
 
97376
97364
  groups = removeMessageGroup(groups, element);
@@ -97554,7 +97542,7 @@
97554
97542
  } // overwrite bpmn generic timerEventDefinition group with zeebe-specific one
97555
97543
 
97556
97544
 
97557
- function updateTimerGroup$1(groups, element) {
97545
+ function updateTimerGroup$1(groups, element, injector) {
97558
97546
  const timerEventGroup = findGroup$1(groups, 'timer');
97559
97547
 
97560
97548
  if (!timerEventGroup) {
@@ -97562,7 +97550,8 @@
97562
97550
  }
97563
97551
 
97564
97552
  timerEventGroup.entries = [...TimerProps$1({
97565
- element
97553
+ element,
97554
+ injector
97566
97555
  })];
97567
97556
  } // overwrite bpmn generic multiInstance group with zeebe-specific one
97568
97557
 
@@ -101813,7 +101802,7 @@
101813
101802
  messageName: element => {
101814
101803
  const translate = useService('translate');
101815
101804
 
101816
- if (is$5(element, 'bpmn:StartEvent') && !isInEventSubProcess(element)) {
101805
+ if (is$5(element, 'bpmn:StartEvent') && !isInEventSubProcess$2(element)) {
101817
101806
  return o$1("a", {
101818
101807
  href: "https://docs.camunda.io/docs/components/modeler/bpmn/message-events/#messages",
101819
101808
  target: "_blank",
@@ -101908,7 +101897,7 @@
101908
101897
  }
101909
101898
  };
101910
101899
 
101911
- function isInEventSubProcess(element) {
101900
+ function isInEventSubProcess$2(element) {
101912
101901
  const bo = getBusinessObject$1(element),
101913
101902
  parent = bo.$parent;
101914
101903
  return is$5(parent, 'bpmn:SubProcess') && parent.triggeredByEvent;
@@ -102186,8 +102175,131 @@
102186
102175
  return getExtensionElementsList(businessObject, 'zeebe:TaskHeaders')[ 0 ];
102187
102176
  }
102188
102177
 
102178
+ function getTimerEventDefinition(element) {
102179
+ const bo = getBusinessObject$1(element);
102180
+
102181
+ return bo.get('eventDefinitions').find(definition => is$5(definition, 'bpmn:TimerEventDefinition'));
102182
+ }
102183
+
102184
+ /**
102185
+ * isTypeSupported - Checks whether a given time property is supported for a given element.
102186
+ *
102187
+ * @param {string} timerDefinitionType
102188
+ * @param {ModdleElement} element
102189
+ *
102190
+ * @return {boolean}
102191
+ */
102192
+ function isTypeSupported(timerDefinitionType, element) {
102193
+ const businessObject = getBusinessObject$1(element);
102194
+
102195
+ switch (timerDefinitionType) {
102196
+ case 'timeDate':
102197
+ if (is$5(element, 'bpmn:StartEvent')) {
102198
+ return true;
102199
+ }
102200
+ return false;
102201
+
102202
+ case 'timeCycle':
102203
+ if (is$5(element, 'bpmn:StartEvent') && !isInterruptingStartEvent(businessObject)) {
102204
+ return true;
102205
+ }
102206
+
102207
+ if (is$5(element, 'bpmn:BoundaryEvent') && !businessObject.cancelActivity) {
102208
+ return true;
102209
+ }
102210
+ return false;
102211
+
102212
+ case 'timeDuration':
102213
+ if (is$5(element, 'bpmn:IntermediateCatchEvent')) {
102214
+ return true;
102215
+ }
102216
+
102217
+ if (is$5(element, 'bpmn:BoundaryEvent')) {
102218
+ return true;
102219
+ }
102220
+ return false;
102221
+ }
102222
+ }
102223
+
102224
+ function isInterruptingStartEvent(bo) {
102225
+ return isInEventSubProcess(bo) && bo.get('isInterrupting') !== false;
102226
+ }
102227
+
102228
+ function isInEventSubProcess(bo) {
102229
+ const parent = bo.$parent;
102230
+
102231
+ return is$5(parent, 'bpmn:SubProcess') && parent.triggeredByEvent;
102232
+ }
102233
+
102234
+ /**
102235
+ * Zeebe BPMN behavior ensuring that bpmn:TimerEventDefinition has only allowed time properties of:
102236
+ * - timeCycle
102237
+ * - timeDate
102238
+ * - timeDuration
102239
+ */
102240
+ class CleanUpTimerExpressionBehavior extends CommandInterceptor {
102241
+ constructor(eventBus, modeling) {
102242
+ super(eventBus);
102243
+
102244
+ /**
102245
+ * Remove unsupported timer expressions.
102246
+ */
102247
+ this.postExecuted([
102248
+ 'shape.move',
102249
+ 'shape.replace',
102250
+ 'element.updateProperties',
102251
+ 'element.updateModdleProperties'
102252
+ ], context => {
102253
+ const element = context.shape || context.newShape || context.element;
102254
+
102255
+ if (element.labelTarget) {
102256
+ return;
102257
+ }
102258
+
102259
+ if (!is$5(element, 'bpmn:Event')) {
102260
+ return;
102261
+ }
102262
+
102263
+ const timerEventDefinition = getTimerEventDefinition(element);
102264
+
102265
+ if (!timerEventDefinition) {
102266
+ return;
102267
+ }
102268
+
102269
+ const propertiesUpdate = {};
102270
+
102271
+ [
102272
+ 'timeCycle',
102273
+ 'timeDate',
102274
+ 'timeDuration'
102275
+ ].forEach((type) => {
102276
+ if (timerEventDefinition.get(type) && !isTypeSupported(type, element)) {
102277
+ propertiesUpdate[ type ] = undefined;
102278
+ }
102279
+ });
102280
+
102281
+ if (!Object.keys(propertiesUpdate).length) {
102282
+ return;
102283
+ }
102284
+
102285
+ modeling.updateModdleProperties(element, timerEventDefinition, propertiesUpdate);
102286
+ }, true);
102287
+ }
102288
+ }
102289
+
102290
+ CleanUpTimerExpressionBehavior.$inject = [
102291
+ 'eventBus',
102292
+ 'modeling'
102293
+ ];
102294
+
102189
102295
  const WILDCARD = '*';
102190
102296
 
102297
+ const TIMER_PROPERTIES = [
102298
+ 'timeCycle',
102299
+ 'timeDate',
102300
+ 'timeDuration'
102301
+ ];
102302
+
102191
102303
  const zeebeServiceTaskProperties = [
102192
102304
  'zeebe:Input',
102193
102305
  'zeebe:LoopCharacteristics',
@@ -102201,14 +102313,15 @@
102201
102313
  eventBus.on('moddleCopy.canCopyProperty', (context) => {
102202
102314
  const {
102203
102315
  parent,
102204
- property
102316
+ property,
102317
+ propertyName
102205
102318
  } = context;
102206
102319
 
102207
- return this.canCopyProperty(property, parent);
102320
+ return this.canCopyProperty(property, parent, propertyName);
102208
102321
  });
102209
102322
  }
102210
102323
 
102211
- canCopyProperty(property, parent) {
102324
+ canCopyProperty(property, parent, propertyName) {
102212
102325
 
102213
102326
  // (1) check if property is allowed in parent
102214
102327
  if (isObject(property) && !isAllowedInParent(property, parent)) {
@@ -102219,6 +102332,10 @@
102219
102332
  if (!this.canHostServiceTaskLikeProperties(property, parent)) {
102220
102333
  return false;
102221
102334
  }
102335
+
102336
+ if (!this.canHostTimerExpression(property, parent, propertyName)) {
102337
+ return false;
102338
+ }
102222
102339
  }
102223
102340
 
102224
102341
  canHostServiceTaskLikeProperties(property, parent) {
@@ -102232,6 +102349,18 @@
102232
102349
 
102233
102350
  return true;
102234
102351
  }
102352
+
102353
+ canHostTimerExpression(property, parent, propertyName) {
102354
+ if (!is$5(parent, 'bpmn:TimerEventDefinition') || !TIMER_PROPERTIES.includes(propertyName)) {
102355
+ return true;
102356
+ }
102357
+
102358
+ if (!isTypeSupported(propertyName, parent.$parent)) {
102359
+ return false;
102360
+ }
102361
+
102362
+ return true;
102363
+ }
102235
102364
  }
102236
102365
 
102237
102366
  ZeebeModdleExtension.$inject = [ 'eventBus' ];
@@ -102898,6 +103027,7 @@
102898
103027
  var behaviorsModule = {
102899
103028
  __init__: [
102900
103029
  'cleanUpBusinessRuleTaskBehavior',
103030
+ 'cleanUpTimerExpressionBehavior',
102901
103031
  'copyPasteBehavior',
102902
103032
  'createZeebeCallActivityBehavior',
102903
103033
  'deleteParticipantBehaviour',
@@ -102906,6 +103036,7 @@
102906
103036
  'updatePropagateAllChildVariablesBehavior'
102907
103037
  ],
102908
103038
  cleanUpBusinessRuleTaskBehavior: [ 'type', CleanUpBusinessRuleTaskBehavior$1 ],
103039
+ cleanUpTimerExpressionBehavior: [ 'type', CleanUpTimerExpressionBehavior ],
102909
103040
  copyPasteBehavior: [ 'type', ZeebeModdleExtension ],
102910
103041
  createZeebeCallActivityBehavior: [ 'type', CreateZeebeCallActivityBehavior ],
102911
103042
  deleteParticipantBehaviour: [ 'type', DeleteParticipantBehaviour ],