@bpmn-io/form-js-viewer 1.13.2 → 1.14.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
@@ -1118,9 +1118,6 @@ function _isElementScrollable(el) {
1118
1118
  return (overflowY === 'auto' || overflowY === 'scroll') && el.scrollHeight > el.clientHeight;
1119
1119
  }
1120
1120
 
1121
- const EMPTY_OBJECT = {};
1122
- const EMPTY_ARRAY$2 = [];
1123
-
1124
1121
  /**
1125
1122
  * Custom hook to scroll an element within a scrollable container.
1126
1123
  *
@@ -1134,8 +1131,8 @@ const EMPTY_ARRAY$2 = [];
1134
1131
  * @param {Array} [flagRefs] - An array of refs that are used as flags to control when to scroll.
1135
1132
  */
1136
1133
  function useScrollIntoView(scrolledElementRef, deps, scrollOptions, flagRefs) {
1137
- const _scrollOptions = scrollOptions || EMPTY_OBJECT;
1138
- const _flagRefs = flagRefs || EMPTY_ARRAY$2;
1134
+ const _scrollOptions = scrollOptions;
1135
+ const _flagRefs = flagRefs;
1139
1136
  useEffect(() => {
1140
1137
  // return early if flags are not raised, or component is not mounted
1141
1138
  if (some(_flagRefs, ref => !ref.current) || !scrolledElementRef.current) {
@@ -1523,9 +1520,8 @@ function _getZeroPaddedString(time) {
1523
1520
  return time.toString().padStart(2, '0');
1524
1521
  }
1525
1522
 
1526
- const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i; // eslint-disable-line no-useless-escape
1527
- const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i; // eslint-disable-line no-useless-escape
1528
-
1523
+ const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i;
1524
+ const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i;
1529
1525
  function sanitizeDateTimePickerValue(options) {
1530
1526
  const {
1531
1527
  formField,
@@ -1767,10 +1763,10 @@ function Errors(props) {
1767
1763
  "aria-live": "polite",
1768
1764
  id: id,
1769
1765
  children: jsx("ul", {
1770
- children: errors.map(error => {
1766
+ children: errors.map((error, index) => {
1771
1767
  return jsx("li", {
1772
1768
  children: error
1773
- });
1769
+ }, index);
1774
1770
  })
1775
1771
  })
1776
1772
  });
@@ -1789,7 +1785,7 @@ function Label(props) {
1789
1785
  });
1790
1786
  return jsxs("label", {
1791
1787
  id: id,
1792
- for: htmlFor,
1788
+ htmlFor: htmlFor,
1793
1789
  class: classNames('fjs-form-field-label', {
1794
1790
  'fjs-incollapsible-label': !collapseOnEmpty
1795
1791
  }, props['class']),
@@ -2272,7 +2268,7 @@ function RowsRenderer(props) {
2272
2268
  indexes: indexes
2273
2269
  });
2274
2270
  })
2275
- });
2271
+ }, row.id);
2276
2272
  }), ' ']
2277
2273
  });
2278
2274
  }
@@ -2682,16 +2678,16 @@ function DropdownList(props) {
2682
2678
  maxHeight: height,
2683
2679
  scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
2684
2680
  },
2685
- children: [values.length > 0 && values.map((v, i) => {
2681
+ children: [values.length > 0 && values.map((entry, index) => {
2686
2682
  return jsx("div", {
2687
2683
  class: classNames('fjs-dropdownlist-item', {
2688
- focused: focusedValueIndex === i
2684
+ focused: focusedValueIndex === index
2689
2685
  }),
2690
- onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
2691
- onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
2692
- onMouseDown: e => onValueSelected(v),
2693
- children: getLabel(v)
2694
- });
2686
+ onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, index),
2687
+ onMouseEnter: mouseControl ? () => setFocusedValueIndex(index) : undefined,
2688
+ onMouseDown: e => onValueSelected(entry),
2689
+ children: getLabel(entry)
2690
+ }, entry.value);
2695
2691
  }), !values.length && jsx("div", {
2696
2692
  class: "fjs-dropdownlist-empty",
2697
2693
  children: emptyListMessage
@@ -4758,7 +4754,7 @@ function Taglist(props) {
4758
4754
  }),
4759
4755
  children: [loadState === LOAD_STATES.LOADED && jsx("div", {
4760
4756
  class: "fjs-taglist-tags",
4761
- children: values.map(v => {
4757
+ children: values.map(entry => {
4762
4758
  return jsxs("div", {
4763
4759
  class: classNames('fjs-taglist-tag', {
4764
4760
  'fjs-disabled': disabled,
@@ -4767,17 +4763,17 @@ function Taglist(props) {
4767
4763
  onMouseDown: e => e.preventDefault(),
4768
4764
  children: [jsx("span", {
4769
4765
  class: "fjs-taglist-tag-label",
4770
- children: getLabelCorrelation(v)
4766
+ children: getLabelCorrelation(entry)
4771
4767
  }), !disabled && !readonly && jsx("button", {
4772
4768
  type: "button",
4773
4769
  title: "Remove tag",
4774
4770
  class: "fjs-taglist-tag-remove",
4775
4771
  onFocus: onElementFocus,
4776
4772
  onBlur: onElementBlur,
4777
- onClick: event => onTagRemoveClick(event, v),
4773
+ onClick: event => onTagRemoveClick(event, entry),
4778
4774
  children: jsx(SvgXMark, {})
4779
4775
  })]
4780
- });
4776
+ }, entry);
4781
4777
  })
4782
4778
  }), jsx("input", {
4783
4779
  disabled: disabled,
@@ -5287,7 +5283,7 @@ function Textarea(props) {
5287
5283
  }), jsx("textarea", {
5288
5284
  class: "fjs-textarea",
5289
5285
  disabled: disabled,
5290
- readonly: readonly,
5286
+ readOnly: readonly,
5291
5287
  id: domId,
5292
5288
  onInput: onInputChange,
5293
5289
  onBlur: onInputBlur,
@@ -5744,6 +5740,8 @@ const EMPTY_ARRAY$1 = [];
5744
5740
  * @property {string} [field.label]
5745
5741
  * @property {string} [field.accept]
5746
5742
  * @property {string|boolean} [field.multiple]
5743
+ * @property {Object} [field.validate]
5744
+ * @property {boolean} [field.validate.required]
5747
5745
  * @property {string} [value]
5748
5746
  *
5749
5747
  * @param {Props} props
@@ -5761,13 +5759,13 @@ function FilePicker(props) {
5761
5759
  errors = [],
5762
5760
  disabled,
5763
5761
  readonly,
5764
- required,
5765
5762
  value: filesKey = ''
5766
5763
  } = props;
5767
5764
  const {
5768
5765
  label,
5769
5766
  multiple = false,
5770
- accept = ''
5767
+ accept = '',
5768
+ validate = {}
5771
5769
  } = field;
5772
5770
  /** @type {string} */
5773
5771
  const evaluatedAccept = useSingleLineTemplateEvaluation(accept, {
@@ -5823,7 +5821,7 @@ function FilePicker(props) {
5823
5821
  children: [jsx(Label, {
5824
5822
  htmlFor: domId,
5825
5823
  label: label,
5826
- required: required
5824
+ required: validate.required
5827
5825
  }), jsx("input", {
5828
5826
  type: "file",
5829
5827
  className: "fjs-hidden",
@@ -5833,13 +5831,14 @@ function FilePicker(props) {
5833
5831
  disabled: isInputDisabled,
5834
5832
  multiple: evaluatedMultiple || undefined,
5835
5833
  accept: evaluatedAccept || undefined,
5836
- onChange: onFileChange
5834
+ onChange: onFileChange,
5835
+ required: validate.required
5837
5836
  }), jsxs("div", {
5838
5837
  className: "fjs-filepicker-container",
5839
5838
  children: [jsx("button", {
5840
5839
  type: "button",
5841
5840
  disabled: isInputDisabled,
5842
- readonly: readonly,
5841
+ readOnly: readonly,
5843
5842
  className: "fjs-button fjs-filepicker-button",
5844
5843
  onClick: () => {
5845
5844
  fileInputRef.current.click();
@@ -6027,7 +6026,7 @@ function isValidDocumentEndpoint(endpoint) {
6027
6026
  * @returns {metadata is DocumentMetadata}
6028
6027
  */
6029
6028
  function isValidDocument(document) {
6030
- return typeof document === 'object' && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
6029
+ return typeof document === 'object' && document !== null && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
6031
6030
  }
6032
6031
 
6033
6032
  /**
@@ -6270,14 +6269,14 @@ function Lightbox(props) {
6270
6269
  children: [jsx("a", {
6271
6270
  href: "https://bpmn.io",
6272
6271
  target: "_blank",
6273
- rel: "noopener",
6272
+ rel: "noopener noreferrer",
6274
6273
  style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
6275
6274
  children: jsx(Logo, {})
6276
6275
  }), jsxs("span", {
6277
6276
  children: ["Web-based tooling for BPMN, DMN, and forms powered by", ' ', jsx("a", {
6278
6277
  href: "https://bpmn.io",
6279
6278
  target: "_blank",
6280
- rel: "noopener",
6279
+ rel: "noopener noreferrer",
6281
6280
  children: "bpmn.io"
6282
6281
  }), "."]
6283
6282
  })]
@@ -6291,7 +6290,7 @@ function Link(props) {
6291
6290
  children: jsx("a", {
6292
6291
  href: "https://bpmn.io",
6293
6292
  target: "_blank",
6294
- rel: "noopener",
6293
+ rel: "noopener noreferrer",
6295
6294
  class: "fjs-powered-by-link",
6296
6295
  title: "Powered by bpmn.io",
6297
6296
  style: "color: var(--cds-text-primary, #404040)",
@@ -7496,7 +7495,7 @@ class RepeatRenderManager {
7496
7495
  showRemove: showRemove,
7497
7496
  ...restProps
7498
7497
  })
7499
- }))
7498
+ }, itemIndex))
7500
7499
  });
7501
7500
  }
7502
7501
  RepeatFooter(props) {