@bpmn-io/form-js-editor 1.8.6 → 1.8.8

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,7 +1,7 @@
1
1
  import Ids from 'ids';
2
2
  import { FormFieldRegistry as FormFieldRegistry$1, iconsByType, Label as Label$3, IFrame, Text as Text$1, Html, Table, ExpressionField, FormFields, sanitizeImageSource, getAncestryList, FormContext, FormRenderContext, FormComponent, getScrollContainer, Importer, PathRegistry, FormLayouter, FieldFactory, FeelExpressionLanguage, OPTIONS_SOURCES, OPTIONS_SOURCES_PATHS, clone, runRecursively, getSchemaVariables, DATETIME_SUBTYPES, DATE_LABEL_PATH, TIME_LABEL_PATH, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES_LABELS, TIME_SERIALISING_FORMAT_PATH, TIME_SERIALISING_FORMATS, TIME_INTERVAL_PATH, TIME_USE24H_PATH, DATE_DISALLOW_PAST_PATH, TIME_SERIALISINGFORMAT_LABELS, getOptionsSource, OPTIONS_SOURCES_DEFAULTS, OPTIONS_SOURCES_LABELS, SECURITY_ATTRIBUTES_DEFINITIONS, createFormContainer, createInjector, MarkdownRendererModule, schemaVersion } from '@bpmn-io/form-js-viewer';
3
3
  export { schemaVersion } from '@bpmn-io/form-js-viewer';
4
- import { isArray, isFunction, isNumber, bind, assign, debounce, forEach, isString, uniqueBy, isObject, get, isDefined, sortBy, find, set as set$1, reduce, without, isNil, has } from 'min-dash';
4
+ import { isArray, isFunction, isNumber, bind, assign, debounce, forEach, isString, uniqueBy, isObject, get, isDefined, set as set$1, reduce, without, isNil, has } from 'min-dash';
5
5
  import classnames from 'classnames';
6
6
  import { jsxs, jsx, Fragment as Fragment$1 } from 'preact/jsx-runtime';
7
7
  import { useContext, useRef, useEffect, useMemo, useState, useCallback, useLayoutEffect } from 'preact/hooks';
@@ -866,11 +866,10 @@ var SvgClose = function SvgClose(props) {
866
866
  fill: "currentColor"
867
867
  }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
868
868
  fillRule: "evenodd",
869
- d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
869
+ d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z",
870
870
  clipRule: "evenodd"
871
871
  })));
872
872
  };
873
- var CloseIcon = SvgClose;
874
873
 
875
874
  var _path$4, _path2$1;
876
875
  function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
@@ -898,13 +897,12 @@ var SvgDelete = function SvgDelete(props) {
898
897
  transform: "translate(.536)"
899
898
  }), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
900
899
  fill: "currentcolor",
901
- d: "M7.536 6h-1v6h1V6Zm3 0h-1v6h1V6Z"
900
+ d: "M7.536 6h-1v6h1zm3 0h-1v6h1z"
902
901
  })), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
903
902
  fill: "currentcolor",
904
- d: "M2.536 3v1h1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4h1V3h-12Zm2 11V4h8v10h-8Zm6-13h-4v1h4V1Z"
903
+ d: "M2.536 3v1h1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4h1V3zm2 11V4h8v10zm6-13h-4v1h4z"
905
904
  })));
906
905
  };
907
- var DeleteIcon$1 = SvgDelete;
908
906
 
909
907
  var _path$3;
910
908
  function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
@@ -925,7 +923,6 @@ var SvgDraggable = function SvgDraggable(props) {
925
923
  }
926
924
  }));
927
925
  };
928
- var DraggableIcon = SvgDraggable;
929
926
 
930
927
  var _path$2;
931
928
  function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
@@ -937,10 +934,9 @@ var SvgSearch = function SvgSearch(props) {
937
934
  fill: "none"
938
935
  }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
939
936
  fill: "currentColor",
940
- d: "m14.5 13.793-3.776-3.776a5.508 5.508 0 1 0-.707.707l3.776 3.776.707-.707ZM2 6.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0Z"
937
+ d: "m14.5 13.793-3.776-3.776a5.508 5.508 0 1 0-.707.707l3.776 3.776zM2 6.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0"
941
938
  })));
942
939
  };
943
- var SearchIcon = SvgSearch;
944
940
 
945
941
  var _path$1, _rect, _mask, _path2, _path3, _path4, _path5, _path6;
946
942
  function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
@@ -953,7 +949,7 @@ var SvgEmptyForm = function SvgEmptyForm(props) {
953
949
  }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
954
950
  fill: "#FF832B",
955
951
  fillRule: "evenodd",
956
- d: "M70 78v8a3 3 0 0 1-3 3h-8v-5h6v-6h5Zm0-16h-5V46h5v16Zm0-32h-5v-6h-6v-5h8a3 3 0 0 1 3 3v8ZM43 19v5H27v-5h16Zm-32 0v5H5v6H0v-8a3 3 0 0 1 3-3h8ZM0 46h5v16H0V46Zm0 32h5v6h6v5H3a3 3 0 0 1-3-3v-8Zm27 11v-5h16v5H27Z",
952
+ d: "M70 78v8a3 3 0 0 1-3 3h-8v-5h6v-6zm0-16h-5V46h5zm0-32h-5v-6h-6v-5h8a3 3 0 0 1 3 3zM43 19v5H27v-5zm-32 0v5H5v6H0v-8a3 3 0 0 1 3-3zM0 46h5v16H0zm0 32h5v6h6v5H3a3 3 0 0 1-3-3zm27 11v-5h16v5z",
957
953
  clipRule: "evenodd"
958
954
  })), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
959
955
  width: 70,
@@ -966,16 +962,16 @@ var SvgEmptyForm = function SvgEmptyForm(props) {
966
962
  fill: "#fff"
967
963
  }, /*#__PURE__*/React.createElement("path", {
968
964
  fillRule: "evenodd",
969
- d: "M87.085 88.684 75.43 45.185l43.499 11.656-11.044 8.072 8.557 8.556-12.728 12.728-8.557-8.556-8.072 11.043Z",
965
+ d: "M87.085 88.684 75.43 45.185l43.499 11.656-11.044 8.072 8.557 8.556-12.728 12.728-8.557-8.556z",
970
966
  clipRule: "evenodd"
971
967
  }))), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
972
968
  fill: "#393939",
973
969
  fillRule: "evenodd",
974
- d: "M87.085 88.684 75.43 45.185l43.499 11.656-11.044 8.072 8.557 8.556-12.728 12.728-8.557-8.556-8.072 11.043Z",
970
+ d: "M87.085 88.684 75.43 45.185l43.499 11.656-11.044 8.072 8.557 8.556-12.728 12.728-8.557-8.556z",
975
971
  clipRule: "evenodd"
976
972
  })), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
977
973
  fill: "#393939",
978
- d: "M75.43 45.185 70.6 46.48l-2.241-8.365 8.365 2.242-1.294 4.83Zm11.655 43.499 4.037 2.95-6.163 8.432-2.704-10.088 4.83-1.294Zm31.844-31.843 1.294-4.83 10.088 2.703-8.432 6.163-2.95-4.036Zm-11.044 8.072-3.535 3.535-4.128-4.127 4.713-3.445 2.95 4.037Zm8.557 8.556 3.535-3.535 3.536 3.535-3.536 3.536-3.535-3.536Zm-12.728 12.728 3.536 3.536-3.536 3.535-3.536-3.535 3.536-3.536Zm-8.557-8.556-4.036-2.951 3.444-4.713 4.128 4.128-3.536 3.535ZM80.26 43.89 91.915 87.39l-9.66 2.588L70.6 46.48l9.66-2.588Zm37.375 17.78L74.136 50.014l2.588-9.66 43.499 11.656-2.589 9.66Zm-12.699-.795 11.043-8.072 5.901 8.073-11.043 8.072-5.901-8.073Zm7.971 16.129-8.556-8.557 7.071-7.07 8.556 8.556-7.071 7.07Zm-12.728 5.657 12.728-12.728 7.071 7.07-12.727 12.729-7.072-7.071Zm-1.485-8.557 8.557 8.557-7.072 7.07-8.556-8.556 7.07-7.071ZM83.049 85.733 91.12 74.69l8.073 5.901-8.072 11.044-8.073-5.902Z",
974
+ d: "M75.43 45.185 70.6 46.48l-2.241-8.365 8.365 2.242zm11.655 43.499 4.037 2.95-6.163 8.432-2.704-10.088zm31.844-31.843 1.294-4.83 10.088 2.703-8.432 6.163zm-11.044 8.072-3.535 3.535-4.128-4.127 4.713-3.445zm8.557 8.556 3.535-3.535 3.536 3.535-3.536 3.536zm-12.728 12.728 3.536 3.536-3.536 3.535-3.536-3.535zm-8.557-8.556-4.036-2.951 3.444-4.713 4.128 4.128zM80.26 43.89 91.915 87.39l-9.66 2.588L70.6 46.48zm37.375 17.78L74.136 50.014l2.588-9.66 43.499 11.656zm-12.699-.795 11.043-8.072 5.901 8.073-11.043 8.072zm7.971 16.129-8.556-8.557 7.071-7.07 8.556 8.556zm-12.728 5.657 12.728-12.728 7.071 7.07-12.727 12.729zm-1.485-8.557 8.557 8.557-7.072 7.07-8.556-8.556zM83.049 85.733 91.12 74.69l8.073 5.901-8.072 11.044z",
979
975
  mask: "url(#EmptyForm_svg__a)"
980
976
  })), _path4 || (_path4 = /*#__PURE__*/React.createElement("path", {
981
977
  stroke: "#000",
@@ -995,7 +991,6 @@ var SvgEmptyForm = function SvgEmptyForm(props) {
995
991
  d: "M78.969 36.367v-8"
996
992
  })));
997
993
  };
998
- var EmptyFormIcon = SvgEmptyForm;
999
994
 
1000
995
  function EditorText(props) {
1001
996
  const {
@@ -1538,7 +1533,7 @@ function Palette(props) {
1538
1533
  class: "fjs-palette-search-container",
1539
1534
  children: [jsx("span", {
1540
1535
  class: "fjs-palette-search-icon",
1541
- children: jsx(SearchIcon, {})
1536
+ children: jsx(SvgSearch, {})
1542
1537
  }), jsx("input", {
1543
1538
  class: "fjs-palette-search",
1544
1539
  ref: inputRef,
@@ -1551,7 +1546,7 @@ function Palette(props) {
1551
1546
  title: "Clear content",
1552
1547
  class: "fjs-palette-search-clear",
1553
1548
  onClick: handleClear,
1554
- children: jsx(CloseIcon, {})
1549
+ children: jsx(SvgClose, {})
1555
1550
  })]
1556
1551
  }), jsxs("div", {
1557
1552
  class: "fjs-palette-entries",
@@ -2182,7 +2177,7 @@ function EmptyForm() {
2182
2177
  class: "fjs-empty-editor",
2183
2178
  children: jsxs("div", {
2184
2179
  class: "fjs-empty-editor-card",
2185
- children: [jsx(EmptyFormIcon, {}), jsx("h2", {
2180
+ children: [jsx(SvgEmptyForm, {}), jsx("h2", {
2186
2181
  children: "Build your form"
2187
2182
  }), jsx("span", {
2188
2183
  children: "Drag and drop components here to start designing."
@@ -2308,7 +2303,7 @@ function Element$1(props) {
2308
2303
  title: getRemoveButtonTitle(field, formFields),
2309
2304
  class: "fjs-context-pad-item",
2310
2305
  onClick: onRemove,
2311
- children: jsx(DeleteIcon$1, {})
2306
+ children: jsx(SvgDelete, {})
2312
2307
  }) : null
2313
2308
  }), props.children, jsx(FieldResizer, {
2314
2309
  position: "left",
@@ -2365,7 +2360,7 @@ function Row(props) {
2365
2360
  class: classnames(DRAG_ROW_MOVE_CLS),
2366
2361
  children: [jsx("span", {
2367
2362
  class: "fjs-row-dragger",
2368
- children: jsx(DraggableIcon, {})
2363
+ children: jsx(SvgDraggable, {})
2369
2364
  }), jsx("div", {
2370
2365
  class: classes.join(' '),
2371
2366
  style: props.style,
@@ -5378,6 +5373,21 @@ PopupIcon.defaultProps = {
5378
5373
  height: "16",
5379
5374
  viewBox: "0 0 32 32"
5380
5375
  };
5376
+ var CloseIcon = function CloseIcon(props) {
5377
+ return jsx("svg", {
5378
+ ...props,
5379
+ children: jsx("path", {
5380
+ fillRule: "evenodd",
5381
+ d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
5382
+ fill: "currentColor"
5383
+ })
5384
+ });
5385
+ };
5386
+ CloseIcon.defaultProps = {
5387
+ xmlns: "http://www.w3.org/2000/svg",
5388
+ width: "16",
5389
+ height: "16"
5390
+ };
5381
5391
  function Header(props) {
5382
5392
  const {
5383
5393
  element,
@@ -6078,7 +6088,8 @@ const CodeEditor$1 = forwardRef((props, ref) => {
6078
6088
  tooltipContainer,
6079
6089
  enableGutters,
6080
6090
  hostLanguage,
6081
- singleLine
6091
+ singleLine,
6092
+ lineWrap: true
6082
6093
  });
6083
6094
  setEditor(editor);
6084
6095
  return () => {
@@ -6115,7 +6126,7 @@ const CodeEditor$1 = forwardRef((props, ref) => {
6115
6126
  title: "Open pop-up editor",
6116
6127
  class: "bio-properties-panel-open-feel-popup",
6117
6128
  onClick: () => onPopupOpen('feelers'),
6118
- children: jsx(ExternalLinkIcon, {})
6129
+ children: jsx(PopupIcon, {})
6119
6130
  })]
6120
6131
  });
6121
6132
  });
@@ -6155,6 +6166,7 @@ const CodeEditor = forwardRef((props, ref) => {
6155
6166
  onFeelToggle = noop$5,
6156
6167
  onLint = noop$5,
6157
6168
  onPopupOpen = noop$5,
6169
+ placeholder,
6158
6170
  popupOpen,
6159
6171
  disabled,
6160
6172
  tooltipContainer,
@@ -6191,6 +6203,7 @@ const CodeEditor = forwardRef((props, ref) => {
6191
6203
  onChange: handleInput,
6192
6204
  onKeyDown: onKeyDown,
6193
6205
  onLint: onLint,
6206
+ placeholder: placeholder,
6194
6207
  tooltipContainer: tooltipContainer,
6195
6208
  value: localValue,
6196
6209
  variables: variables,
@@ -6220,6 +6233,12 @@ const CodeEditor = forwardRef((props, ref) => {
6220
6233
  }
6221
6234
  editor.setVariables(variables);
6222
6235
  }, [variables]);
6236
+ useEffect(() => {
6237
+ if (!editor) {
6238
+ return;
6239
+ }
6240
+ editor.setPlaceholder(placeholder);
6241
+ }, [placeholder]);
6223
6242
  const handleClick = () => {
6224
6243
  ref.current.focus();
6225
6244
  };
@@ -6472,6 +6491,9 @@ function Title(props) {
6472
6491
  draggable,
6473
6492
  emit = () => {},
6474
6493
  title,
6494
+ showCloseButton = false,
6495
+ closeButtonTooltip = 'Close popup',
6496
+ onClose,
6475
6497
  ...rest
6476
6498
  } = props;
6477
6499
 
@@ -6542,7 +6564,12 @@ function Title(props) {
6542
6564
  }), jsx("div", {
6543
6565
  class: "bio-properties-panel-popup__title",
6544
6566
  children: title
6545
- }), children]
6567
+ }), children, showCloseButton && jsx("button", {
6568
+ title: closeButtonTooltip,
6569
+ class: "bio-properties-panel-popup__close",
6570
+ onClick: onClose,
6571
+ children: jsx(CloseIcon, {})
6572
+ })]
6546
6573
  });
6547
6574
  }
6548
6575
  function Body(props) {
@@ -6760,6 +6787,9 @@ function FeelPopupComponent(props) {
6760
6787
  children: [jsxs(Popup.Title, {
6761
6788
  title: title,
6762
6789
  emit: emit,
6790
+ showCloseButton: true,
6791
+ closeButtonTooltip: "Save and close",
6792
+ onClose: onClose,
6763
6793
  draggable: true,
6764
6794
  children: [type === 'feel' && jsxs("a", {
6765
6795
  href: "https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/",
@@ -6801,14 +6831,6 @@ function FeelPopupComponent(props) {
6801
6831
  tooltipContainer: tooltipContainer
6802
6832
  })]
6803
6833
  })
6804
- }), jsx(Popup.Footer, {
6805
- children: jsx("button", {
6806
- type: "button",
6807
- onClick: () => onClose(),
6808
- title: "Close pop-up editor",
6809
- class: "bio-properties-panel-feel-popup__close-btn",
6810
- children: "Close"
6811
- })
6812
6834
  })]
6813
6835
  });
6814
6836
  }
@@ -7118,6 +7140,7 @@ function FeelTextfieldComponent(props) {
7118
7140
  hostLanguage,
7119
7141
  onInput,
7120
7142
  onError,
7143
+ placeholder,
7121
7144
  feel,
7122
7145
  value = '',
7123
7146
  disabled = false,
@@ -7292,6 +7315,7 @@ function FeelTextfieldComponent(props) {
7292
7315
  },
7293
7316
  onLint: handleLint,
7294
7317
  onPopupOpen: handlePopupOpen,
7318
+ placeholder: placeholder,
7295
7319
  value: feelOnlyValue,
7296
7320
  variables: variables,
7297
7321
  ref: editorRef,
@@ -7320,7 +7344,8 @@ const OptionalFeelInput = forwardRef((props, ref) => {
7320
7344
  onInput,
7321
7345
  value,
7322
7346
  onFocus,
7323
- onBlur
7347
+ onBlur,
7348
+ placeholder
7324
7349
  } = props;
7325
7350
  const inputRef = useRef();
7326
7351
 
@@ -7353,6 +7378,7 @@ const OptionalFeelInput = forwardRef((props, ref) => {
7353
7378
  onInput: e => onInput(e.target.value),
7354
7379
  onFocus: onFocus,
7355
7380
  onBlur: onBlur,
7381
+ placeholder: placeholder,
7356
7382
  value: value || ''
7357
7383
  });
7358
7384
  });
@@ -7410,7 +7436,8 @@ forwardRef((props, ref) => {
7410
7436
  onInput,
7411
7437
  value,
7412
7438
  onFocus,
7413
- onBlur
7439
+ onBlur,
7440
+ placeholder
7414
7441
  } = props;
7415
7442
  const inputRef = useRef();
7416
7443
 
@@ -7438,6 +7465,7 @@ forwardRef((props, ref) => {
7438
7465
  onInput: e => onInput(e.target.value),
7439
7466
  onFocus: onFocus,
7440
7467
  onBlur: onBlur,
7468
+ placeholder: placeholder,
7441
7469
  value: value || '',
7442
7470
  "data-gramm": "false"
7443
7471
  });
@@ -7533,6 +7561,7 @@ forwardRef((props, ref) => {
7533
7561
  * @param {Function} props.variables
7534
7562
  * @param {Function} props.onFocus
7535
7563
  * @param {Function} props.onBlur
7564
+ * @param {string} [props.placeholder]
7536
7565
  * @param {string|import('preact').Component} props.tooltip
7537
7566
  */
7538
7567
  function FeelEntry(props) {
@@ -7555,6 +7584,7 @@ function FeelEntry(props) {
7555
7584
  variables,
7556
7585
  onFocus,
7557
7586
  onBlur,
7587
+ placeholder,
7558
7588
  tooltip
7559
7589
  } = props;
7560
7590
  const [validationError, setValidationError] = useState(null);
@@ -7598,6 +7628,7 @@ function FeelEntry(props) {
7598
7628
  onError: onError,
7599
7629
  onFocus: onFocus,
7600
7630
  onBlur: onBlur,
7631
+ placeholder: placeholder,
7601
7632
  example: example,
7602
7633
  hostLanguage: hostLanguage,
7603
7634
  singleLine: singleLine,
@@ -7785,7 +7816,6 @@ const DEFAULT_TOOLTIP = {};
7785
7816
  * id: String,
7786
7817
  * items: Array<ListItemDefinition>,
7787
7818
  * label: String,
7788
- * shouldSort?: Boolean,
7789
7819
  * shouldOpen?: Boolean
7790
7820
  * } } ListGroupDefinition
7791
7821
  *
@@ -8113,6 +8143,7 @@ function ListItem(props) {
8113
8143
  } else if (isFunction(focusableInput.focus)) {
8114
8144
  focusableInput.focus();
8115
8145
  }
8146
+ focusableInput.scrollIntoView();
8116
8147
  }
8117
8148
  }
8118
8149
  }, [autoOpen, autoFocusEntry]);
@@ -8136,97 +8167,61 @@ function ListGroup(props) {
8136
8167
  id,
8137
8168
  items,
8138
8169
  label,
8139
- shouldOpen = true,
8140
- shouldSort = true
8170
+ shouldOpen = true
8141
8171
  } = props;
8172
+ useEffect(() => {
8173
+ if (props.shouldSort != undefined) {
8174
+ console.warn('the property \'shouldSort\' is no longer supported');
8175
+ }
8176
+ }, [props.shouldSort]);
8142
8177
  const groupRef = useRef(null);
8143
8178
  const [open, setOpen] = useLayoutState(['groups', id, 'open'], false);
8144
8179
  const [sticky, setSticky] = useState(false);
8145
8180
  const onShow = useCallback(() => setOpen(true), [setOpen]);
8146
- const [ordering, setOrdering] = useState([]);
8147
- const [newItemAdded, setNewItemAdded] = useState(false);
8181
+ const [localItems, setLocalItems] = useState([]);
8182
+ const [newlyAddedItemIds, setNewlyAddedItemIds] = useState([]);
8148
8183
 
8149
8184
  // Flag to mark that add button was clicked in the last render cycle
8150
8185
  const [addTriggered, setAddTriggered] = useState(false);
8151
- const prevItems = usePrevious(items);
8152
8186
  const prevElement = usePrevious(element);
8153
8187
  const elementChanged = element !== prevElement;
8154
- const shouldHandleEffects = !elementChanged && (shouldSort || shouldOpen);
8155
-
8156
- // reset initial ordering when element changes (before first render)
8157
- if (elementChanged) {
8158
- setOrdering(createOrdering(shouldSort ? sortItems(items) : items));
8159
- }
8160
-
8161
- // keep ordering in sync to items - and open changes
8162
-
8163
- // (0) set initial ordering from given items
8188
+ const shouldHandleEffects = !elementChanged && shouldOpen;
8189
+
8190
+ // (0) delay setting items
8191
+ //
8192
+ // We need to this to align the render cycles of items
8193
+ // with the detection of newly added items.
8194
+ // This is important, because the autoOpen property can
8195
+ // only set per list item on its very first render.
8164
8196
  useEffect(() => {
8165
- if (!prevItems || !shouldSort) {
8166
- setOrdering(createOrdering(items));
8167
- }
8168
- }, [items, element]);
8197
+ setLocalItems(items);
8198
+ }, [items]);
8169
8199
 
8170
- // (1) items were added
8200
+ // (1) handle auto opening when items were added
8171
8201
  useEffect(() => {
8172
8202
  // reset addTriggered flag
8173
8203
  setAddTriggered(false);
8174
- if (shouldHandleEffects && prevItems && items.length > prevItems.length) {
8175
- let add = [];
8176
- items.forEach(item => {
8177
- if (!ordering.includes(item.id)) {
8178
- add.push(item.id);
8204
+ if (shouldHandleEffects && localItems) {
8205
+ if (addTriggered) {
8206
+ const previousItemIds = localItems.map(item => item.id);
8207
+ const currentItemsIds = items.map(item => item.id);
8208
+ const newItemIds = currentItemsIds.filter(itemId => !previousItemIds.includes(itemId));
8209
+
8210
+ // open if not open, configured and triggered by add button
8211
+ //
8212
+ // TODO(marstamm): remove once we refactor layout handling for listGroups.
8213
+ // Ideally, opening should be handled as part of the `add` callback and
8214
+ // not be a concern for the ListGroup component.
8215
+ if (!open && shouldOpen && newItemIds.length > 0) {
8216
+ toggleOpen();
8179
8217
  }
8180
- });
8181
- let newOrdering = ordering;
8182
-
8183
- // open if not open, configured and triggered by add button
8184
- //
8185
- // TODO(marstamm): remove once we refactor layout handling for listGroups.
8186
- // Ideally, opening should be handled as part of the `add` callback and
8187
- // not be a concern for the ListGroup component.
8188
- if (addTriggered && !open && shouldOpen) {
8189
- toggleOpen();
8190
- }
8191
-
8192
- // filter when not open and configured
8193
- if (!open && shouldSort) {
8194
- newOrdering = createOrdering(sortItems(items));
8195
- }
8196
-
8197
- // add new items on top or bottom depending on sorting behavior
8198
- newOrdering = newOrdering.filter(item => !add.includes(item));
8199
- if (shouldSort) {
8200
- newOrdering.unshift(...add);
8218
+ setNewlyAddedItemIds(newItemIds);
8201
8219
  } else {
8202
- newOrdering.push(...add);
8220
+ // ignore newly added items that do not result from a triggered add
8221
+ setNewlyAddedItemIds([]);
8203
8222
  }
8204
- setOrdering(newOrdering);
8205
- setNewItemAdded(addTriggered);
8206
- } else {
8207
- setNewItemAdded(false);
8208
8223
  }
8209
- }, [items, open, shouldHandleEffects, addTriggered]);
8210
-
8211
- // (2) sort items on open if shouldSort is set
8212
- useEffect(() => {
8213
- if (shouldSort && open && !newItemAdded) {
8214
- setOrdering(createOrdering(sortItems(items)));
8215
- }
8216
- }, [open, shouldSort]);
8217
-
8218
- // (3) items were deleted
8219
- useEffect(() => {
8220
- if (shouldHandleEffects && prevItems && items.length < prevItems.length) {
8221
- let keep = [];
8222
- ordering.forEach(o => {
8223
- if (getItem(items, o)) {
8224
- keep.push(o);
8225
- }
8226
- });
8227
- setOrdering(keep);
8228
- }
8229
- }, [items, shouldHandleEffects]);
8224
+ }, [items, open, shouldHandleEffects, addTriggered, localItems]);
8230
8225
 
8231
8226
  // set css class when group is sticky to top
8232
8227
  useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
@@ -8298,8 +8293,7 @@ function ListGroup(props) {
8298
8293
  class: classnames('bio-properties-panel-list', open && hasItems ? 'open' : ''),
8299
8294
  children: jsx(LayoutContext.Provider, {
8300
8295
  value: propertiesPanelContext,
8301
- children: ordering.map((o, index) => {
8302
- const item = getItem(items, o);
8296
+ children: localItems.map((item, index) => {
8303
8297
  if (!item) {
8304
8298
  return;
8305
8299
  }
@@ -8309,7 +8303,7 @@ function ListGroup(props) {
8309
8303
 
8310
8304
  // if item was added, open it
8311
8305
  // Existing items will not be affected as autoOpen is only applied on first render
8312
- const autoOpen = newItemAdded;
8306
+ const autoOpen = newlyAddedItemIds.includes(item.id);
8313
8307
  return createElement(ListItem, {
8314
8308
  ...item,
8315
8309
  autoOpen: autoOpen,
@@ -8322,21 +8316,6 @@ function ListGroup(props) {
8322
8316
  })]
8323
8317
  });
8324
8318
  }
8325
-
8326
- // helpers ////////////////////
8327
-
8328
- /**
8329
- * Sorts given items alphanumeric by label
8330
- */
8331
- function sortItems(items) {
8332
- return sortBy(items, i => i.label.toLowerCase());
8333
- }
8334
- function getItem(items, id) {
8335
- return find(items, i => i.id === id);
8336
- }
8337
- function createOrdering(items) {
8338
- return items.map(i => i.id);
8339
- }
8340
8319
  function Checkbox(props) {
8341
8320
  const {
8342
8321
  id,
@@ -8623,6 +8602,7 @@ function TextArea(props) {
8623
8602
  onFocus,
8624
8603
  onBlur,
8625
8604
  autoResize,
8605
+ placeholder,
8626
8606
  rows = autoResize ? 1 : 2,
8627
8607
  tooltip
8628
8608
  } = props;
@@ -8665,6 +8645,7 @@ function TextArea(props) {
8665
8645
  onInput: handleInput,
8666
8646
  onFocus: onFocus,
8667
8647
  onBlur: onBlur,
8648
+ placeholder: placeholder,
8668
8649
  rows: rows,
8669
8650
  value: localValue,
8670
8651
  disabled: disabled,
@@ -8704,6 +8685,7 @@ function TextAreaEntry(props) {
8704
8685
  validate,
8705
8686
  onFocus,
8706
8687
  onBlur,
8688
+ placeholder,
8707
8689
  autoResize,
8708
8690
  tooltip
8709
8691
  } = props;
@@ -8739,6 +8721,7 @@ function TextAreaEntry(props) {
8739
8721
  debounce: debounce,
8740
8722
  monospace: monospace,
8741
8723
  disabled: disabled,
8724
+ placeholder: placeholder,
8742
8725
  autoResize: autoResize,
8743
8726
  tooltip: tooltip,
8744
8727
  element: element
@@ -8770,6 +8753,7 @@ function Textfield(props) {
8770
8753
  onInput,
8771
8754
  onFocus,
8772
8755
  onBlur,
8756
+ placeholder,
8773
8757
  value = '',
8774
8758
  tooltip
8775
8759
  } = props;
@@ -8811,6 +8795,7 @@ function Textfield(props) {
8811
8795
  onInput: handleInput,
8812
8796
  onFocus: onFocus,
8813
8797
  onBlur: onBlur,
8798
+ placeholder: placeholder,
8814
8799
  value: localValue
8815
8800
  })]
8816
8801
  });
@@ -8844,6 +8829,7 @@ function TextfieldEntry(props) {
8844
8829
  validate,
8845
8830
  onFocus,
8846
8831
  onBlur,
8832
+ placeholder,
8847
8833
  tooltip
8848
8834
  } = props;
8849
8835
  const globalError = useError(id);
@@ -8875,6 +8861,7 @@ function TextfieldEntry(props) {
8875
8861
  onInput: onInput,
8876
8862
  onFocus: onFocus,
8877
8863
  onBlur: onBlur,
8864
+ placeholder: placeholder,
8878
8865
  value: value,
8879
8866
  tooltip: tooltip,
8880
8867
  element: element
@@ -11638,8 +11625,7 @@ function StaticOptionsSourceEntry(props) {
11638
11625
  });
11639
11626
  return {
11640
11627
  items,
11641
- add: addEntry,
11642
- shouldSort: false
11628
+ add: addEntry
11643
11629
  };
11644
11630
  }
11645
11631
 
@@ -12483,8 +12469,7 @@ function StaticColumnsSourceEntry(props) {
12483
12469
  });
12484
12470
  return {
12485
12471
  items,
12486
- add: addEntry,
12487
- shouldSort: false
12472
+ add: addEntry
12488
12473
  };
12489
12474
  }
12490
12475
 
@@ -12986,8 +12971,7 @@ function CustomPropertiesGroup(field, editField) {
12986
12971
  id: 'custom-values',
12987
12972
  items,
12988
12973
  label: 'Custom properties',
12989
- tooltip: 'Add properties directly to the form schema, useful to configure functionality in custom-built task applications and form renderers.',
12990
- shouldSort: false
12974
+ tooltip: 'Add properties directly to the form schema, useful to configure functionality in custom-built task applications and form renderers.'
12991
12975
  };
12992
12976
  }
12993
12977
 
@@ -13303,10 +13287,9 @@ var SvgRepeat = function SvgRepeat(props) {
13303
13287
  fill: "none"
13304
13288
  }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
13305
13289
  fill: "currentColor",
13306
- d: "M3 3h10.086l-1.793-1.793L12 .5l3 3-3 3-.707-.707L13.086 4H3v3.5H2V4a1.001 1.001 0 0 1 1-1ZM4.707 10.207 2.914 12H13V8.5h1V12a1.002 1.002 0 0 1-1 1H2.914l1.793 1.793L4 15.5l-3-3 3-3 .707.707Z"
13290
+ d: "M3 3h10.086l-1.793-1.793L12 .5l3 3-3 3-.707-.707L13.086 4H3v3.5H2V4a1 1 0 0 1 1-1M4.707 10.207 2.914 12H13V8.5h1V12a1 1 0 0 1-1 1H2.914l1.793 1.793L4 15.5l-3-3 3-3z"
13307
13291
  })));
13308
13292
  };
13309
- var RepeatSvg = SvgRepeat;
13310
13293
 
13311
13294
  class EditorRepeatRenderManager {
13312
13295
  constructor(formFields, formFieldRegistry) {
@@ -13332,7 +13315,7 @@ class EditorRepeatRenderManager {
13332
13315
  RepeatFooter() {
13333
13316
  return jsxs("div", {
13334
13317
  className: "fjs-repeat-render-footer",
13335
- children: [jsx(RepeatSvg, {}), jsx("span", {
13318
+ children: [jsx(SvgRepeat, {}), jsx("span", {
13336
13319
  children: "Repeatable"
13337
13320
  })]
13338
13321
  });