@bpmn-io/form-js-playground 1.9.1 → 1.9.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.
@@ -1987,7 +1987,7 @@
1987
1987
  * rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
1988
1988
  * [more] {boolean} Whether the result of division was truncated.
1989
1989
  */
1990
- function round$2(x, sd, rm, more) {
1990
+ function round$1(x, sd, rm, more) {
1991
1991
  var xc = x.c;
1992
1992
  if (rm === UNDEFINED$1) rm = x.constructor.RM;
1993
1993
  if (rm !== 0 && rm !== 1 && rm !== 2 && rm !== 3) {
@@ -2208,7 +2208,7 @@
2208
2208
  }
2209
2209
 
2210
2210
  // Round?
2211
- if (qi > p) round$2(q, p, Big.RM, r[0] !== UNDEFINED$1);
2211
+ if (qi > p) round$1(q, p, Big.RM, r[0] !== UNDEFINED$1);
2212
2212
  return q;
2213
2213
  };
2214
2214
 
@@ -2497,7 +2497,7 @@
2497
2497
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP$1) {
2498
2498
  throw Error(INVALID$4 + 'precision');
2499
2499
  }
2500
- return round$2(new this.constructor(this), sd, rm);
2500
+ return round$1(new this.constructor(this), sd, rm);
2501
2501
  };
2502
2502
 
2503
2503
  /*
@@ -2513,7 +2513,7 @@
2513
2513
  if (dp === UNDEFINED$1) dp = 0;else if (dp !== ~~dp || dp < -MAX_DP$1 || dp > MAX_DP$1) {
2514
2514
  throw Error(INVALID_DP$1);
2515
2515
  }
2516
- return round$2(new this.constructor(this), dp + this.e + 1, rm);
2516
+ return round$1(new this.constructor(this), dp + this.e + 1, rm);
2517
2517
  };
2518
2518
 
2519
2519
  /*
@@ -2559,7 +2559,7 @@
2559
2559
  t = r;
2560
2560
  r = half.times(t.plus(x.div(t)));
2561
2561
  } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
2562
- return round$2(r, (Big.DP -= 4) + r.e + 1, Big.RM);
2562
+ return round$1(r, (Big.DP -= 4) + r.e + 1, Big.RM);
2563
2563
  };
2564
2564
 
2565
2565
  /*
@@ -2642,7 +2642,7 @@
2642
2642
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP$1) {
2643
2643
  throw Error(INVALID_DP$1);
2644
2644
  }
2645
- x = round$2(new x.constructor(x), ++dp, rm);
2645
+ x = round$1(new x.constructor(x), ++dp, rm);
2646
2646
  for (; x.c.length < dp;) x.c.push(0);
2647
2647
  }
2648
2648
  return stringify$1(x, true, !!n);
@@ -2665,7 +2665,7 @@
2665
2665
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP$1) {
2666
2666
  throw Error(INVALID_DP$1);
2667
2667
  }
2668
- x = round$2(new x.constructor(x), dp + x.e + 1, rm);
2668
+ x = round$1(new x.constructor(x), dp + x.e + 1, rm);
2669
2669
 
2670
2670
  // x.e may have changed if the value is rounded up.
2671
2671
  for (dp = dp + x.e + 1; x.c.length < dp;) x.c.push(0);
@@ -2713,7 +2713,7 @@
2713
2713
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP$1) {
2714
2714
  throw Error(INVALID$4 + 'precision');
2715
2715
  }
2716
- x = round$2(new Big(x), sd, rm);
2716
+ x = round$1(new Big(x), sd, rm);
2717
2717
  for (; x.c.length < sd;) x.c.push(0);
2718
2718
  }
2719
2719
  return stringify$1(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
@@ -28778,13 +28778,15 @@
28778
28778
  let {
28779
28779
  parser
28780
28780
  } = this.p;
28781
+ let lookaheadRecord = this.reducePos < this.pos - 25 /* Lookahead.Margin */;
28782
+ if (lookaheadRecord) this.setLookAhead(this.pos);
28781
28783
  let dPrec = parser.dynamicPrecedence(type);
28782
28784
  if (dPrec) this.score += dPrec;
28783
28785
  if (depth == 0) {
28784
28786
  this.pushState(parser.getGoto(this.state, type, true), this.reducePos);
28785
28787
  // Zero-depth reductions are a special case—they add stuff to
28786
28788
  // the stack without popping anything off.
28787
- if (type < parser.minRepeatTerm) this.storeNode(type, this.reducePos, this.reducePos, 4, true);
28789
+ if (type < parser.minRepeatTerm) this.storeNode(type, this.reducePos, this.reducePos, lookaheadRecord ? 8 : 4, true);
28788
28790
  this.reduceContext(type, this.reducePos);
28789
28791
  return;
28790
28792
  }
@@ -28829,7 +28831,7 @@
28829
28831
  /**
28830
28832
  @internal
28831
28833
  */
28832
- storeNode(term, start, end, size = 4, isReduce = false) {
28834
+ storeNode(term, start, end, size = 4, mustSink = false) {
28833
28835
  if (term == 0 /* Term.Err */ && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
28834
28836
  // Try to omit/merge adjacent error nodes
28835
28837
  let cur = this,
@@ -28846,20 +28848,29 @@
28846
28848
  }
28847
28849
  }
28848
28850
  }
28849
- if (!isReduce || this.pos == end) {
28851
+ if (!mustSink || this.pos == end) {
28850
28852
  // Simple case, just append
28851
28853
  this.buffer.push(term, start, end, size);
28852
28854
  } else {
28853
28855
  // There may be skipped nodes that have to be moved forward
28854
28856
  let index = this.buffer.length;
28855
- if (index > 0 && this.buffer[index - 4] != 0 /* Term.Err */) while (index > 0 && this.buffer[index - 2] > end) {
28856
- // Move this record forward
28857
- this.buffer[index] = this.buffer[index - 4];
28858
- this.buffer[index + 1] = this.buffer[index - 3];
28859
- this.buffer[index + 2] = this.buffer[index - 2];
28860
- this.buffer[index + 3] = this.buffer[index - 1];
28861
- index -= 4;
28862
- if (size > 4) size -= 4;
28857
+ if (index > 0 && this.buffer[index - 4] != 0 /* Term.Err */) {
28858
+ let mustMove = false;
28859
+ for (let scan = index; scan > 0 && this.buffer[scan - 2] > end; scan -= 4) {
28860
+ if (this.buffer[scan - 1] >= 0) {
28861
+ mustMove = true;
28862
+ break;
28863
+ }
28864
+ }
28865
+ if (mustMove) while (index > 0 && this.buffer[index - 2] > end) {
28866
+ // Move this record forward
28867
+ this.buffer[index] = this.buffer[index - 4];
28868
+ this.buffer[index + 1] = this.buffer[index - 3];
28869
+ this.buffer[index + 2] = this.buffer[index - 2];
28870
+ this.buffer[index + 3] = this.buffer[index - 1];
28871
+ index -= 4;
28872
+ if (size > 4) size -= 4;
28873
+ }
28863
28874
  }
28864
28875
  this.buffer[index] = term;
28865
28876
  this.buffer[index + 1] = start;
@@ -29610,7 +29621,7 @@
29610
29621
  cursor.moveTo(pos);
29611
29622
  for (;;) {
29612
29623
  if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos))) for (;;) {
29613
- if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError) return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Safety.Margin */)) : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Safety.Margin */));
29624
+ if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError) return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Lookahead.Margin */)) : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Lookahead.Margin */));
29614
29625
  if (side < 0 ? cursor.prevSibling() : cursor.nextSibling()) break;
29615
29626
  if (!cursor.parent()) return side < 0 ? 0 : tree.length;
29616
29627
  }
@@ -29726,7 +29737,7 @@
29726
29737
  token.mask = mask;
29727
29738
  token.context = context;
29728
29739
  }
29729
- if (token.lookAhead > token.end + 25 /* Safety.Margin */) lookAhead = Math.max(token.lookAhead, lookAhead);
29740
+ if (token.lookAhead > token.end + 25 /* Lookahead.Margin */) lookAhead = Math.max(token.lookAhead, lookAhead);
29730
29741
  if (token.value != 0 /* Term.Err */) {
29731
29742
  let startIndex = actionIndex;
29732
29743
  if (token.extended > -1) actionIndex = this.addActions(stack, token.extended, token.end, actionIndex);
@@ -32249,6 +32260,7 @@
32249
32260
  },
32250
32261
  dynamicPrecedences: {
32251
32262
  "31": -1,
32263
+ "67": 1,
32252
32264
  "71": -1,
32253
32265
  "73": -1
32254
32266
  },
@@ -32855,10 +32867,10 @@
32855
32867
  // 10.3.4.5 Numeric functions
32856
32868
  'decimal': fn(function (n, scale) {
32857
32869
  if (!scale) {
32858
- return round$1(n);
32870
+ return bankersRound(n);
32859
32871
  }
32860
32872
  const offset = Math.pow(10, scale);
32861
- return round$1(n * offset) / offset;
32873
+ return bankersRound(n * offset) / offset;
32862
32874
  }, ['number', 'number']),
32863
32875
  'floor': fn(function (n, scale = 0) {
32864
32876
  if (scale === null) {
@@ -32997,7 +33009,8 @@
32997
33009
  }, ['list', 'function']),
32998
33010
  // 10.3.4.10 Context function
32999
33011
  'get value': fn(function (m, key) {
33000
- return getFromContext(key, m) || null;
33012
+ const value = getFromContext(key, m);
33013
+ return value != undefined ? value : null;
33001
33014
  }, ['context', 'string']),
33002
33015
  'get entries': fn(function (m) {
33003
33016
  if (arguments.length !== 1) {
@@ -33274,13 +33287,13 @@
33274
33287
  // cf. https://mathiasbynens.be/notes/javascript-unicode
33275
33288
  return str.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length;
33276
33289
  }
33277
- function round$1(n) {
33278
- const integral = Math.trunc(n);
33279
- if (n - integral > .5) {
33280
- return integral + 1;
33281
- } else {
33282
- return integral;
33290
+ function bankersRound(n) {
33291
+ const floored = Math.floor(n);
33292
+ const decimalPart = n - floored;
33293
+ if (decimalPart === 0.5) {
33294
+ return floored % 2 === 0 ? floored : floored + 1;
33283
33295
  }
33296
+ return Math.round(n);
33284
33297
  }
33285
33298
  // adapted from https://stackoverflow.com/a/53577159
33286
33299
  function stddev(array) {
@@ -33463,6 +33476,12 @@
33463
33476
  switch (input) {
33464
33477
  case '+':
33465
33478
  return nullable((a, b) => {
33479
+ // flip these as luxon operations with durations aren't commutative
33480
+ if (isDuration(a) && !isDuration(b)) {
33481
+ const tmp = a;
33482
+ a = b;
33483
+ b = tmp;
33484
+ }
33466
33485
  if (isType(a, 'time') && isDuration(b)) {
33467
33486
  return a.plus(b).set({
33468
33487
  year: 1900,
@@ -67911,6 +67930,7 @@
67911
67930
  const hasChildren = repeaterField.components && repeaterField.components.length > 0;
67912
67931
  const showRemove = repeaterField.allowAddRemove && hasChildren;
67913
67932
  const displayValues = isCollapsed ? values.slice(0, nonCollapsedItems) : values;
67933
+ const hiddenValues = isCollapsed ? values.slice(nonCollapsedItems) : [];
67914
67934
  const onDeleteItem = index => {
67915
67935
  const updatedValues = values.slice();
67916
67936
  updatedValues.splice(index, 1);
@@ -67922,7 +67942,7 @@
67922
67942
  };
67923
67943
  const parentExpressionContextInfo = F$1(LocalExpressionContext);
67924
67944
  return e(d$1, {
67925
- children: displayValues.map((itemValue, itemIndex) => e(RepetitionScaffold, {
67945
+ children: [displayValues.map((itemValue, itemIndex) => e(RepetitionScaffold, {
67926
67946
  itemIndex: itemIndex,
67927
67947
  itemValue: itemValue,
67928
67948
  parentExpressionContextInfo: parentExpressionContextInfo,
@@ -67932,7 +67952,20 @@
67932
67952
  onDeleteItem: onDeleteItem,
67933
67953
  showRemove: showRemove,
67934
67954
  ...restProps
67935
- }, itemIndex))
67955
+ }, itemIndex)), hiddenValues.length > 0 ? e("div", {
67956
+ className: "fjs-repeat-row-collapsed",
67957
+ children: hiddenValues.map((itemValue, itemIndex) => e(RepetitionScaffold, {
67958
+ itemIndex: itemIndex + nonCollapsedItems,
67959
+ itemValue: itemValue,
67960
+ parentExpressionContextInfo: parentExpressionContextInfo,
67961
+ repeaterField: repeaterField,
67962
+ RowsRenderer: RowsRenderer,
67963
+ indexes: indexes,
67964
+ onDeleteItem: onDeleteItem,
67965
+ showRemove: showRemove,
67966
+ ...restProps
67967
+ }, itemIndex))
67968
+ }) : null]
67936
67969
  });
67937
67970
  }
67938
67971
  RepeatFooter(props) {
@@ -75769,6 +75802,9 @@
75769
75802
  let targetParentId;
75770
75803
  if (formFieldNode) {
75771
75804
  formField = this._formFieldRegistry.get(formFieldNode.dataset.id);
75805
+ if (!formField) {
75806
+ return 'No associated form field in the registry';
75807
+ }
75772
75808
  columns = (formField.layout || {}).columns;
75773
75809
 
75774
75810
  // (1) check for row constraints
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-playground",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "A form-js playground",
5
5
  "files": [
6
6
  "dist"
@@ -45,8 +45,8 @@
45
45
  "url": "https://github.com/bpmn-io"
46
46
  },
47
47
  "dependencies": {
48
- "@bpmn-io/form-js-editor": "^1.9.1",
49
- "@bpmn-io/form-js-viewer": "^1.9.1",
48
+ "@bpmn-io/form-js-editor": "^1.9.2",
49
+ "@bpmn-io/form-js-viewer": "^1.9.2",
50
50
  "@codemirror/autocomplete": "^6.16.0",
51
51
  "@codemirror/commands": "^6.5.0",
52
52
  "@codemirror/lang-json": "^6.0.1",
@@ -70,5 +70,6 @@
70
70
  "min-dom": "^4.1.0",
71
71
  "rollup-plugin-css-only": "^4.5.2",
72
72
  "style-loader": "^4.0.0"
73
- }
73
+ },
74
+ "gitHead": "74ba40e6fad356dad63315d3270b4ee61aec4058"
74
75
  }