camunda-bpmn-js 0.13.1 → 0.13.2

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.
@@ -61699,19 +61699,19 @@
61699
61699
  getDescriptionForId: () => {}
61700
61700
  });
61701
61701
 
61702
- /**
61703
- * @typedef {Function} <propertiesPanel.showEntry> callback
61704
- *
61705
- * @example
61706
- *
61707
- * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
61708
- * // ...
61709
- * });
61710
- *
61711
- * @param {Object} context
61712
- * @param {boolean} [context.focus]
61713
- *
61714
- * @returns void
61702
+ /**
61703
+ * @typedef {Function} <propertiesPanel.showEntry> callback
61704
+ *
61705
+ * @example
61706
+ *
61707
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
61708
+ * // ...
61709
+ * });
61710
+ *
61711
+ * @param {Object} context
61712
+ * @param {boolean} [context.focus]
61713
+ *
61714
+ * @returns void
61715
61715
  */
61716
61716
  const EventContext = q({
61717
61717
  eventBus: null
@@ -61724,20 +61724,20 @@
61724
61724
  setLayoutForKey: () => {}
61725
61725
  });
61726
61726
 
61727
- /**
61728
- * Accesses the global DescriptionContext and returns a description for a given id and element.
61729
- *
61730
- * @example
61731
- * ```jsx
61732
- * function TextField(props) {
61733
- * const description = useDescriptionContext('input1', element);
61734
- * }
61735
- * ```
61736
- *
61737
- * @param {string} id
61738
- * @param {djs.model.Base} element
61739
- *
61740
- * @returns {string}
61727
+ /**
61728
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
61729
+ *
61730
+ * @example
61731
+ * ```jsx
61732
+ * function TextField(props) {
61733
+ * const description = useDescriptionContext('input1', element);
61734
+ * }
61735
+ * ```
61736
+ *
61737
+ * @param {string} id
61738
+ * @param {djs.model.Base} element
61739
+ *
61740
+ * @returns {string}
61741
61741
  */
61742
61742
 
61743
61743
  function useDescriptionContext(id, element) {
@@ -61748,14 +61748,14 @@
61748
61748
  }
61749
61749
 
61750
61750
  const DEFAULT_PRIORITY$6 = 1000;
61751
- /**
61752
- * Subscribe to an event.
61753
- *
61754
- * @param {string} event
61755
- * @param {Function} callback
61756
- * @param {number} [priority]
61757
- *
61758
- * @returns {import('preact').Ref}
61751
+ /**
61752
+ * Subscribe to an event.
61753
+ *
61754
+ * @param {string} event
61755
+ * @param {Function} callback
61756
+ * @param {number} [priority]
61757
+ *
61758
+ * @returns {import('preact').Ref}
61759
61759
  */
61760
61760
 
61761
61761
  function useEvent(event, callback, priority = DEFAULT_PRIORITY$6) {
@@ -61773,11 +61773,11 @@
61773
61773
  }
61774
61774
 
61775
61775
  const HIGH_PRIORITY$l = 10000;
61776
- /**
61777
- * Buffer events and re-fire during passive effect phase.
61778
- *
61779
- * @param {string[]} bufferedEvents
61780
- * @param {Object} [eventBus]
61776
+ /**
61777
+ * Buffer events and re-fire during passive effect phase.
61778
+ *
61779
+ * @param {string[]} bufferedEvents
61780
+ * @param {Object} [eventBus]
61781
61781
  */
61782
61782
 
61783
61783
  function useEventBuffer(bufferedEvents, eventBus) {
@@ -61825,20 +61825,20 @@
61825
61825
  });
61826
61826
  }
61827
61827
 
61828
- /**
61829
- * Creates a state that persists in the global LayoutContext.
61830
- *
61831
- * @example
61832
- * ```jsx
61833
- * function Group(props) {
61834
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
61835
- * }
61836
- * ```
61837
- *
61838
- * @param {(string|number)[]} path
61839
- * @param {any} [defaultValue]
61840
- *
61841
- * @returns {[ any, Function ]}
61828
+ /**
61829
+ * Creates a state that persists in the global LayoutContext.
61830
+ *
61831
+ * @example
61832
+ * ```jsx
61833
+ * function Group(props) {
61834
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
61835
+ * }
61836
+ * ```
61837
+ *
61838
+ * @param {(string|number)[]} path
61839
+ * @param {any} [defaultValue]
61840
+ *
61841
+ * @returns {[ any, Function ]}
61842
61842
  */
61843
61843
 
61844
61844
  function useLayoutState(path, defaultValue) {
@@ -61859,11 +61859,11 @@
61859
61859
  return [value, setState];
61860
61860
  }
61861
61861
 
61862
- /**
61863
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
61864
- * state on updates.
61865
- *
61866
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
61862
+ /**
61863
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
61864
+ * state on updates.
61865
+ *
61866
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
61867
61867
  */
61868
61868
 
61869
61869
  function usePrevious(value) {
@@ -61874,12 +61874,12 @@
61874
61874
  return ref.current;
61875
61875
  }
61876
61876
 
61877
- /**
61878
- * Subscribe to `propertiesPanel.showEntry`.
61879
- *
61880
- * @param {Function} show
61881
- *
61882
- * @returns {import('preact').Ref}
61877
+ /**
61878
+ * Subscribe to `propertiesPanel.showEntry`.
61879
+ *
61880
+ * @param {Function} show
61881
+ *
61882
+ * @returns {import('preact').Ref}
61883
61883
  */
61884
61884
 
61885
61885
  function useShowEntryEvent(show) {
@@ -61916,14 +61916,14 @@
61916
61916
  return ref;
61917
61917
  }
61918
61918
 
61919
- /**
61920
- * Subscribe to `propertiesPanel.showError`. On `propertiesPanel.showError` set
61921
- * temporary error. Fire `propertiesPanel.showEntry` for temporary error to be
61922
- * visible. Unset error on `propertiesPanel.updated`.
61923
- *
61924
- * @param {Function} show
61925
- *
61926
- * @returns {import('preact').Ref}
61919
+ /**
61920
+ * Subscribe to `propertiesPanel.showError`. On `propertiesPanel.showError` set
61921
+ * temporary error. Fire `propertiesPanel.showEntry` for temporary error to be
61922
+ * visible. Unset error on `propertiesPanel.updated`.
61923
+ *
61924
+ * @param {Function} show
61925
+ *
61926
+ * @returns {import('preact').Ref}
61927
61927
  */
61928
61928
 
61929
61929
  function useShowErrorEvent(show) {
@@ -62034,66 +62034,66 @@
62034
62034
  };
62035
62035
  const DEFAULT_DESCRIPTION = {};
62036
62036
  const bufferedEvents = ['propertiesPanel.showEntry', 'propertiesPanel.showError'];
62037
- /**
62038
- * @typedef { {
62039
- * component: import('preact').Component,
62040
- * id: String,
62041
- * isEdited?: Function
62042
- * } } EntryDefinition
62043
- *
62044
- * @typedef { {
62045
- * autoFocusEntry: String,
62046
- * autoOpen?: Boolean,
62047
- * entries: Array<EntryDefinition>,
62048
- * id: String,
62049
- * label: String,
62050
- * remove: (event: MouseEvent) => void
62051
- * } } ListItemDefinition
62052
- *
62053
- * @typedef { {
62054
- * add: (event: MouseEvent) => void,
62055
- * component: import('preact').Component,
62056
- * element: Object,
62057
- * id: String,
62058
- * items: Array<ListItemDefinition>,
62059
- * label: String,
62060
- * shouldSort?: Boolean,
62061
- * shouldOpen?: Boolean
62062
- * } } ListGroupDefinition
62063
- *
62064
- * @typedef { {
62065
- * component?: import('preact').Component,
62066
- * entries: Array<EntryDefinition>,
62067
- * id: String,
62068
- * label: String,
62069
- * shouldOpen?: Boolean
62070
- * } } GroupDefinition
62071
- *
62072
- * @typedef { {
62073
- * [id: String]: GetDescriptionFunction
62074
- * } } DescriptionConfig
62075
- *
62076
- * @callback { {
62077
- * @param {string} id
62078
- * @param {djs.model.base} element
62079
- * @returns {string}
62080
- * } } GetDescriptionFunction
62081
- *
62037
+ /**
62038
+ * @typedef { {
62039
+ * component: import('preact').Component,
62040
+ * id: String,
62041
+ * isEdited?: Function
62042
+ * } } EntryDefinition
62043
+ *
62044
+ * @typedef { {
62045
+ * autoFocusEntry: String,
62046
+ * autoOpen?: Boolean,
62047
+ * entries: Array<EntryDefinition>,
62048
+ * id: String,
62049
+ * label: String,
62050
+ * remove: (event: MouseEvent) => void
62051
+ * } } ListItemDefinition
62052
+ *
62053
+ * @typedef { {
62054
+ * add: (event: MouseEvent) => void,
62055
+ * component: import('preact').Component,
62056
+ * element: Object,
62057
+ * id: String,
62058
+ * items: Array<ListItemDefinition>,
62059
+ * label: String,
62060
+ * shouldSort?: Boolean,
62061
+ * shouldOpen?: Boolean
62062
+ * } } ListGroupDefinition
62063
+ *
62064
+ * @typedef { {
62065
+ * component?: import('preact').Component,
62066
+ * entries: Array<EntryDefinition>,
62067
+ * id: String,
62068
+ * label: String,
62069
+ * shouldOpen?: Boolean
62070
+ * } } GroupDefinition
62071
+ *
62072
+ * @typedef { {
62073
+ * [id: String]: GetDescriptionFunction
62074
+ * } } DescriptionConfig
62075
+ *
62076
+ * @callback { {
62077
+ * @param {string} id
62078
+ * @param {djs.model.base} element
62079
+ * @returns {string}
62080
+ * } } GetDescriptionFunction
62081
+ *
62082
62082
  */
62083
62083
 
62084
- /**
62085
- * A basic properties panel component. Describes *how* content will be rendered, accepts
62086
- * data from implementor to describe *what* will be rendered.
62087
- *
62088
- * @param {Object} props
62089
- * @param {Object} props.element
62090
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
62091
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
62092
- * @param {Object} [props.layoutConfig]
62093
- * @param {Function} [props.layoutChanged]
62094
- * @param {DescriptionConfig} [props.descriptionConfig]
62095
- * @param {Function} [props.descriptionLoaded]
62096
- * @param {Object} [props.eventBus]
62084
+ /**
62085
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
62086
+ * data from implementor to describe *what* will be rendered.
62087
+ *
62088
+ * @param {Object} props
62089
+ * @param {Object} props.element
62090
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
62091
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
62092
+ * @param {Object} [props.layoutConfig]
62093
+ * @param {Function} [props.layoutChanged]
62094
+ * @param {DescriptionConfig} [props.descriptionConfig]
62095
+ * @param {Function} [props.descriptionLoaded]
62096
+ * @param {Object} [props.eventBus]
62097
62097
  */
62098
62098
 
62099
62099
  function PropertiesPanel(props) {
@@ -62274,17 +62274,17 @@
62274
62274
  children: item.entry
62275
62275
  });
62276
62276
  }
62277
- /**
62278
- *
62279
- * @param {Array<null | Element>} ignoredElements
62280
- * @param {Function} callback
62277
+ /**
62278
+ *
62279
+ * @param {Array<null | Element>} ignoredElements
62280
+ * @param {Function} callback
62281
62281
  */
62282
62282
 
62283
62283
 
62284
62284
  function useGlobalClick(ignoredElements, callback) {
62285
62285
  y$1(() => {
62286
- /**
62287
- * @param {MouseEvent} event
62286
+ /**
62287
+ * @param {MouseEvent} event
62288
62288
  */
62289
62289
  function listener(event) {
62290
62290
  if (ignoredElements.some(element => element && element.contains(event.target))) {
@@ -62414,8 +62414,8 @@
62414
62414
  }
62415
62415
 
62416
62416
  const noop$3 = () => {};
62417
- /**
62418
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
62417
+ /**
62418
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
62419
62419
  */
62420
62420
 
62421
62421
 
@@ -62568,8 +62568,8 @@
62568
62568
  });
62569
62569
  } // helpers ////////////////////
62570
62570
 
62571
- /**
62572
- * Sorts given items alphanumeric by label
62571
+ /**
62572
+ * Sorts given items alphanumeric by label
62573
62573
  */
62574
62574
 
62575
62575
  function sortItems(items) {
@@ -62638,15 +62638,15 @@
62638
62638
  })]
62639
62639
  });
62640
62640
  }
62641
- /**
62642
- * @param {Object} props
62643
- * @param {Object} props.element
62644
- * @param {String} props.id
62645
- * @param {String} props.description
62646
- * @param {String} props.label
62647
- * @param {Function} props.getValue
62648
- * @param {Function} props.setValue
62649
- * @param {boolean} [props.disabled]
62641
+ /**
62642
+ * @param {Object} props
62643
+ * @param {Object} props.element
62644
+ * @param {String} props.id
62645
+ * @param {String} props.description
62646
+ * @param {String} props.label
62647
+ * @param {Function} props.getValue
62648
+ * @param {Function} props.setValue
62649
+ * @param {boolean} [props.disabled]
62650
62650
  */
62651
62651
 
62652
62652
 
@@ -62692,21 +62692,21 @@
62692
62692
  }
62693
62693
 
62694
62694
  const noop$1 = () => {};
62695
- /**
62696
- * @typedef { { value: string, label: string, disabled: boolean } } Option
62695
+ /**
62696
+ * @typedef { { value: string, label: string, disabled: boolean } } Option
62697
62697
  */
62698
62698
 
62699
- /**
62700
- * Provides basic select input.
62701
- *
62702
- * @param {object} props
62703
- * @param {string} props.id
62704
- * @param {string[]} props.path
62705
- * @param {string} props.label
62706
- * @param {Function} props.onChange
62707
- * @param {Array<Option>} [props.options]
62708
- * @param {string} props.value
62709
- * @param {boolean} [props.disabled]
62699
+ /**
62700
+ * Provides basic select input.
62701
+ *
62702
+ * @param {object} props
62703
+ * @param {string} props.id
62704
+ * @param {string[]} props.path
62705
+ * @param {string} props.label
62706
+ * @param {Function} props.onChange
62707
+ * @param {Array<Option>} [props.options]
62708
+ * @param {string} props.value
62709
+ * @param {boolean} [props.disabled]
62710
62710
  */
62711
62711
 
62712
62712
 
@@ -62752,16 +62752,16 @@
62752
62752
  })]
62753
62753
  });
62754
62754
  }
62755
- /**
62756
- * @param {object} props
62757
- * @param {object} props.element
62758
- * @param {string} props.id
62759
- * @param {string} [props.description]
62760
- * @param {string} props.label
62761
- * @param {Function} props.getValue
62762
- * @param {Function} props.setValue
62763
- * @param {Function} props.getOptions
62764
- * @param {boolean} [props.disabled]
62755
+ /**
62756
+ * @param {object} props
62757
+ * @param {object} props.element
62758
+ * @param {string} props.id
62759
+ * @param {string} [props.description]
62760
+ * @param {string} props.label
62761
+ * @param {Function} props.getValue
62762
+ * @param {Function} props.setValue
62763
+ * @param {Function} props.getOptions
62764
+ * @param {boolean} [props.disabled]
62765
62765
  */
62766
62766
 
62767
62767
 
@@ -62863,18 +62863,18 @@
62863
62863
  })]
62864
62864
  });
62865
62865
  }
62866
- /**
62867
- * @param {object} props
62868
- * @param {object} props.element
62869
- * @param {string} props.id
62870
- * @param {string} props.description
62871
- * @param {boolean} props.debounce
62872
- * @param {string} props.label
62873
- * @param {Function} props.getValue
62874
- * @param {Function} props.setValue
62875
- * @param {number} props.rows
62876
- * @param {boolean} props.monospace
62877
- * @param {boolean} [props.disabled]
62866
+ /**
62867
+ * @param {object} props
62868
+ * @param {object} props.element
62869
+ * @param {string} props.id
62870
+ * @param {string} props.description
62871
+ * @param {boolean} props.debounce
62872
+ * @param {string} props.label
62873
+ * @param {Function} props.getValue
62874
+ * @param {Function} props.setValue
62875
+ * @param {number} props.rows
62876
+ * @param {boolean} props.monospace
62877
+ * @param {boolean} [props.disabled]
62878
62878
  */
62879
62879
 
62880
62880
 
@@ -62965,17 +62965,17 @@
62965
62965
  })]
62966
62966
  });
62967
62967
  }
62968
- /**
62969
- * @param {Object} props
62970
- * @param {Object} props.element
62971
- * @param {String} props.id
62972
- * @param {String} props.description
62973
- * @param {Boolean} props.debounce
62974
- * @param {Boolean} props.disabled
62975
- * @param {String} props.label
62976
- * @param {Function} props.getValue
62977
- * @param {Function} props.setValue
62978
- * @param {Function} props.validate
62968
+ /**
62969
+ * @param {Object} props
62970
+ * @param {Object} props.element
62971
+ * @param {String} props.id
62972
+ * @param {String} props.description
62973
+ * @param {Boolean} props.debounce
62974
+ * @param {Boolean} props.disabled
62975
+ * @param {String} props.label
62976
+ * @param {Function} props.getValue
62977
+ * @param {Function} props.setValue
62978
+ * @param {Function} props.validate
62979
62979
  */
62980
62980
 
62981
62981
 
@@ -63096,15 +63096,15 @@
63096
63096
  })]
63097
63097
  });
63098
63098
  }
63099
- /**
63100
- * @param {Object} props
63101
- * @param {Object} props.element
63102
- * @param {String} props.id
63103
- * @param {String} props.description
63104
- * @param {String} props.label
63105
- * @param {String} props.switcherLabel
63106
- * @param {Function} props.getValue
63107
- * @param {Function} props.setValue
63099
+ /**
63100
+ * @param {Object} props
63101
+ * @param {Object} props.element
63102
+ * @param {String} props.id
63103
+ * @param {String} props.description
63104
+ * @param {String} props.label
63105
+ * @param {String} props.switcherLabel
63106
+ * @param {Function} props.getValue
63107
+ * @param {Function} props.setValue
63108
63108
  */
63109
63109
 
63110
63110
 
@@ -65572,9 +65572,7 @@
65572
65572
  }
65573
65573
 
65574
65574
  function getTemplate(element, elementTemplates) {
65575
- const templateId = elementTemplates._getTemplateId(element);
65576
-
65577
- return templateId && elementTemplates.get(templateId);
65575
+ return elementTemplates.get(element);
65578
65576
  }
65579
65577
 
65580
65578
  function getTemplateDocumentation(element, elementTemplates) {
@@ -72917,7 +72915,7 @@
72917
72915
  changedElement = businessObject;
72918
72916
  let properties = {};
72919
72917
 
72920
- if (oldProperty && propertyChanged$1(changedElement, oldProperty)) {
72918
+ if (shouldKeepValue(changedElement, oldProperty, newProperty)) {
72921
72919
  return;
72922
72920
  }
72923
72921
 
@@ -72958,18 +72956,18 @@
72958
72956
  const oldProperty = findOldProperty$1(oldTemplate, newProperty),
72959
72957
  oldBinding = oldProperty && oldProperty.binding,
72960
72958
  oldBindingType = oldBinding && oldBinding.type,
72961
- oldTaskDefinition = oldProperty && findOldBusinessObject$1(businessObject, oldProperty),
72959
+ oldTaskDefinition = findBusinessObject(businessObject, newProperty),
72962
72960
  newPropertyValue = newProperty.value,
72963
72961
  newBinding = newProperty.binding,
72964
72962
  newBindingType = newBinding.type; // (2) update old task definition
72965
72963
 
72966
- if (oldProperty && oldTaskDefinition) {
72967
- if (!propertyChanged$1(oldTaskDefinition, oldProperty)) {
72964
+ if (oldTaskDefinition) {
72965
+ if (!shouldKeepValue(oldTaskDefinition, oldProperty, newProperty)) {
72968
72966
  // TODO(pinussilvestrus): for now we only support <type>
72969
72967
  // this needs to be adjusted once we support more
72970
72968
  let properties = {};
72971
72969
 
72972
- if (oldBindingType === 'zeebe:taskDefinition:type') {
72970
+ if (oldBindingType === 'zeebe:taskDefinition:type' || !oldBindingType) {
72973
72971
  properties = {
72974
72972
  type: newPropertyValue
72975
72973
  };
@@ -73053,27 +73051,27 @@
73053
73051
  let propertyName;
73054
73052
  newProperties.forEach(newProperty => {
73055
73053
  const oldProperty = findOldProperty$1(oldTemplate, newProperty),
73056
- oldInputOrOutput = oldProperty && findOldBusinessObject$1(businessObject, oldProperty),
73054
+ inputOrOutput = findBusinessObject(businessObject, newProperty),
73057
73055
  newPropertyValue = newProperty.value,
73058
73056
  newBinding = newProperty.binding,
73059
73057
  newBindingType = newBinding.type;
73060
73058
  let newInputOrOutput, properties; // (2) update old inputs and outputs
73061
73059
 
73062
- if (oldProperty && oldInputOrOutput) {
73060
+ if (inputOrOutput) {
73063
73061
  // (2a) exclude old inputs and outputs from cleanup, unless
73064
73062
  // a) optional and has empty value, and
73065
73063
  // b) not changed
73066
- if (shouldUpdate(newPropertyValue, newProperty) || propertyChanged$1(oldInputOrOutput, oldProperty)) {
73067
- if (is$1(oldInputOrOutput, 'zeebe:Input')) {
73068
- remove$1$1(oldInputs, oldInputOrOutput);
73064
+ if (shouldUpdate(newPropertyValue, newProperty) || shouldKeepValue(inputOrOutput, oldProperty, newProperty)) {
73065
+ if (is$1(inputOrOutput, 'zeebe:Input')) {
73066
+ remove$1$1(oldInputs, inputOrOutput);
73069
73067
  } else {
73070
- remove$1$1(oldOutputs, oldInputOrOutput);
73068
+ remove$1$1(oldOutputs, inputOrOutput);
73071
73069
  }
73072
73070
  } // (2a) do updates (unless changed)
73073
73071
 
73074
73072
 
73075
- if (!propertyChanged$1(oldInputOrOutput, oldProperty)) {
73076
- if (is$1(oldInputOrOutput, 'zeebe:Input')) {
73073
+ if (!shouldKeepValue(inputOrOutput, oldProperty, newProperty)) {
73074
+ if (is$1(inputOrOutput, 'zeebe:Input')) {
73077
73075
  properties = {
73078
73076
  source: newPropertyValue
73079
73077
  };
@@ -73085,7 +73083,7 @@
73085
73083
 
73086
73084
  commandStack.execute('element.updateModdleProperties', {
73087
73085
  element,
73088
- moddleElement: oldInputOrOutput,
73086
+ moddleElement: inputOrOutput,
73089
73087
  properties
73090
73088
  });
73091
73089
  }
@@ -73180,12 +73178,12 @@
73180
73178
  const oldHeaders = taskHeaders.get('zeebe:values') ? taskHeaders.get('zeebe:values').slice() : [];
73181
73179
  newProperties.forEach(newProperty => {
73182
73180
  const oldProperty = findOldProperty$1(oldTemplate, newProperty),
73183
- oldHeader = oldProperty && findOldBusinessObject$1(businessObject, oldProperty),
73181
+ oldHeader = findBusinessObject(businessObject, newProperty),
73184
73182
  newPropertyValue = newProperty.value,
73185
73183
  newBinding = newProperty.binding; // (2) update old headers
73186
73184
 
73187
- if (oldProperty && oldHeader) {
73188
- if (!propertyChanged$1(oldHeader, oldProperty)) {
73185
+ if (oldHeader) {
73186
+ if (!shouldKeepValue(oldHeader, oldProperty, newProperty)) {
73189
73187
  const properties = {
73190
73188
  value: newPropertyValue
73191
73189
  };
@@ -73250,50 +73248,50 @@
73250
73248
  ChangeElementTemplateHandler$1.$inject = ['bpmnFactory', 'bpmnReplace', 'commandStack', 'modeling']; // helpers //////////
73251
73249
 
73252
73250
  /**
73253
- * Find old business object matching specified old property.
73251
+ * Find business object matching specified property.
73254
73252
  *
73255
73253
  * @param {djs.model.Base|ModdleElement} element
73256
- * @param {Object} oldProperty
73254
+ * @param {Object} property
73257
73255
  *
73258
73256
  * @returns {ModdleElement}
73259
73257
  */
73260
73258
 
73261
- function findOldBusinessObject$1(element, oldProperty) {
73262
- let businessObject = getBusinessObject(element);
73263
- const oldBinding = oldProperty.binding,
73264
- oldBindingType = oldBinding.type;
73259
+ function findBusinessObject(element, property) {
73260
+ const businessObject = getBusinessObject(element);
73261
+ const binding = property.binding,
73262
+ bindingType = binding.type;
73265
73263
 
73266
- if (oldBindingType === 'zeebe:taskDefinition:type') {
73264
+ if (bindingType === 'zeebe:taskDefinition:type') {
73267
73265
  return findExtension$1(businessObject, 'zeebe:TaskDefinition');
73268
73266
  }
73269
73267
 
73270
- if (oldBindingType === 'zeebe:input' || oldBindingType === 'zeebe:output') {
73271
- businessObject = findExtension$1(businessObject, 'zeebe:IoMapping');
73268
+ if (bindingType === 'zeebe:input' || bindingType === 'zeebe:output') {
73269
+ const extensionElements = findExtension$1(businessObject, 'zeebe:IoMapping');
73272
73270
 
73273
- if (!businessObject) {
73271
+ if (!extensionElements) {
73274
73272
  return;
73275
73273
  }
73276
73274
 
73277
- if (oldBindingType === 'zeebe:input') {
73278
- return find(businessObject.get('zeebe:inputParameters'), function (oldBusinessObject) {
73279
- return oldBusinessObject.get('zeebe:target') === oldBinding.name;
73275
+ if (bindingType === 'zeebe:input') {
73276
+ return find(extensionElements.get('zeebe:inputParameters'), function (input) {
73277
+ return input.get('zeebe:target') === binding.name;
73280
73278
  });
73281
73279
  } else {
73282
- return find(businessObject.get('zeebe:outputParameters'), function (oldBusinessObject) {
73283
- return oldBusinessObject.get('zeebe:source') === oldBinding.source;
73280
+ return find(extensionElements.get('zeebe:outputParameters'), function (output) {
73281
+ return output.get('zeebe:source') === binding.source;
73284
73282
  });
73285
73283
  }
73286
73284
  }
73287
73285
 
73288
- if (oldBindingType === 'zeebe:taskHeader') {
73289
- businessObject = findExtension$1(businessObject, 'zeebe:TaskHeaders');
73286
+ if (bindingType === 'zeebe:taskHeader') {
73287
+ const extensionElements = findExtension$1(businessObject, 'zeebe:TaskHeaders');
73290
73288
 
73291
- if (!businessObject) {
73289
+ if (!extensionElements) {
73292
73290
  return;
73293
73291
  }
73294
73292
 
73295
- return find(businessObject.get('zeebe:values'), function (oldBusinessObject) {
73296
- return oldBusinessObject.get('zeebe:key') === oldBinding.key;
73293
+ return find(extensionElements.get('zeebe:values'), function (value) {
73294
+ return value.get('zeebe:key') === binding.key;
73297
73295
  });
73298
73296
  }
73299
73297
  }
@@ -73374,6 +73372,30 @@
73374
73372
  });
73375
73373
  }
73376
73374
  }
73375
+ /**
73376
+ * Check whether the existing property should be keept. This is the case if
73377
+ * - an old template was set and the value differs from the default
73378
+ * - no template was set but the property was set manually
73379
+ *
73380
+ * @param {djs.model.Base|ModdleElement} element
73381
+ * @param {Object} oldProperty
73382
+ * @param {Object} newProperty
73383
+ *
73384
+ * @returns {boolean}
73385
+ */
73386
+
73387
+
73388
+ function shouldKeepValue(element, oldProperty, newProperty) {
73389
+ if (newProperty.type === 'Hidden') {
73390
+ return false;
73391
+ }
73392
+
73393
+ if (oldProperty) {
73394
+ return propertyChanged$1(element, oldProperty);
73395
+ } else {
73396
+ return !!getPropertyValue(element, newProperty);
73397
+ }
73398
+ }
73377
73399
  /**
73378
73400
  * Check whether property was changed after being set by template.
73379
73401
  *
@@ -73385,30 +73407,34 @@
73385
73407
 
73386
73408
 
73387
73409
  function propertyChanged$1(element, oldProperty) {
73410
+ const oldPropertyValue = oldProperty.value;
73411
+ return getPropertyValue(element, oldProperty) !== oldPropertyValue;
73412
+ }
73413
+
73414
+ function getPropertyValue(element, property) {
73388
73415
  const businessObject = getBusinessObject(element);
73389
- const oldBinding = oldProperty.binding,
73390
- oldBindingName = oldBinding.name,
73391
- oldBindingType = oldBinding.type,
73392
- oldPropertyValue = oldProperty.value;
73416
+ const binding = property.binding,
73417
+ bindingName = binding.name,
73418
+ bindingType = binding.type;
73393
73419
 
73394
- if (oldBindingType === 'property') {
73395
- return businessObject.get(oldBindingName) !== oldPropertyValue;
73420
+ if (bindingType === 'property') {
73421
+ return businessObject.get(bindingName);
73396
73422
  }
73397
73423
 
73398
- if (oldBindingType === 'zeebe:taskDefinition:type') {
73399
- return businessObject.get('zeebe:type') !== oldPropertyValue;
73424
+ if (bindingType === 'zeebe:taskDefinition:type') {
73425
+ return businessObject.get('zeebe:type');
73400
73426
  }
73401
73427
 
73402
- if (oldBindingType === 'zeebe:input') {
73403
- return businessObject.get('zeebe:source') !== oldPropertyValue;
73428
+ if (bindingType === 'zeebe:input') {
73429
+ return businessObject.get('zeebe:source');
73404
73430
  }
73405
73431
 
73406
- if (oldBindingType === 'zeebe:output') {
73407
- return businessObject.get('zeebe:target') !== oldPropertyValue;
73432
+ if (bindingType === 'zeebe:output') {
73433
+ return businessObject.get('zeebe:target');
73408
73434
  }
73409
73435
 
73410
- if (oldBindingType === 'zeebe:taskHeader') {
73411
- return businessObject.get('zeebe:value') !== oldPropertyValue;
73436
+ if (bindingType === 'zeebe:taskHeader') {
73437
+ return businessObject.get('zeebe:value');
73412
73438
  }
73413
73439
  }
73414
73440
 
@@ -74658,10 +74684,9 @@
74658
74684
  function propertyGetter$1(element, property) {
74659
74685
  return function getValue() {
74660
74686
  let businessObject = getBusinessObject(element);
74687
+ const defaultValue = '';
74661
74688
  const {
74662
- binding,
74663
- optional,
74664
- value: defaultValue = ''
74689
+ binding
74665
74690
  } = property;
74666
74691
  const {
74667
74692
  name,
@@ -74704,10 +74729,9 @@
74704
74729
 
74705
74730
  if (inputParameter) {
74706
74731
  return inputParameter.get('source');
74707
- } // allow empty values for optional parameters
74708
-
74732
+ }
74709
74733
 
74710
- return optional ? '' : defaultValue;
74734
+ return defaultValue;
74711
74735
  } // zeebe:Output
74712
74736
 
74713
74737
 
@@ -74716,10 +74740,9 @@
74716
74740
 
74717
74741
  if (outputParameter) {
74718
74742
  return outputParameter.get('target');
74719
- } // allow empty values for optional parameters
74720
-
74743
+ }
74721
74744
 
74722
- return optional ? '' : defaultValue;
74745
+ return defaultValue;
74723
74746
  }
74724
74747
  } // zeebe:taskHeaders
74725
74748