@bpmn-io/form-js-viewer 2.0.0 → 2.1.0

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.
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Ids } from 'ids';
2
- import { isString, get, isNil, isObject, some, isNumber, set, isDefined, findIndex, isArray, values, uniqueBy, isFunction, bind, assign, groupBy, isUndefined } from 'min-dash';
2
+ import { isString, get, isNil, isObject, some, merge, isNumber, set, isDefined, findIndex, isArray, values, uniqueBy, isFunction, bind, assign, groupBy, isUndefined } from 'min-dash';
3
3
  import Big from 'big.js';
4
4
  import classNames from 'classnames';
5
5
  import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
@@ -191,7 +191,7 @@ const _linearizePathExpression = root => {
191
191
 
192
192
  // Traverse the tree and collect path components
193
193
  while (node.name === 'PathExpression') {
194
- parts.push(node.children[1]);
194
+ parts.push(node.children[node.children.length - 1]);
195
195
  node = node.children[0];
196
196
  }
197
197
 
@@ -223,7 +223,7 @@ const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
223
223
  if (node.type.name === 'VariableName') {
224
224
  nodeRepresentation.variableName = feelString.slice(node.from, node.to);
225
225
  }
226
- if (node.type.name === 'Name') {
226
+ if (['Name', 'PathName'].includes(node.type.name)) {
227
227
  nodeRepresentation.variableName = feelString.slice(node.from, node.to);
228
228
  }
229
229
  stack.push(nodeRepresentation);
@@ -1408,10 +1408,11 @@ function useFilteredFormData() {
1408
1408
  const conditionChecker = useService('conditionChecker', false);
1409
1409
  return useMemo(() => {
1410
1410
  const newData = conditionChecker ? conditionChecker.applyConditions(data, data) : data;
1411
- return {
1412
- ...initialData,
1413
- ...newData
1414
- };
1411
+
1412
+ // deep-merge newData over a clone of initialData, so keys pruned from
1413
+ // newData (e.g. by a hidden group) fall back to their initial value
1414
+ // instead of the whole branch disappearing
1415
+ return merge(clone(initialData || {}), newData);
1415
1416
  }, [conditionChecker, data, initialData]);
1416
1417
  }
1417
1418