@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.cjs CHANGED
@@ -1138,9 +1138,6 @@ function _isElementScrollable(el) {
1138
1138
  return (overflowY === 'auto' || overflowY === 'scroll') && el.scrollHeight > el.clientHeight;
1139
1139
  }
1140
1140
 
1141
- const EMPTY_OBJECT = {};
1142
- const EMPTY_ARRAY$2 = [];
1143
-
1144
1141
  /**
1145
1142
  * Custom hook to scroll an element within a scrollable container.
1146
1143
  *
@@ -1154,8 +1151,8 @@ const EMPTY_ARRAY$2 = [];
1154
1151
  * @param {Array} [flagRefs] - An array of refs that are used as flags to control when to scroll.
1155
1152
  */
1156
1153
  function useScrollIntoView(scrolledElementRef, deps, scrollOptions, flagRefs) {
1157
- const _scrollOptions = scrollOptions || EMPTY_OBJECT;
1158
- const _flagRefs = flagRefs || EMPTY_ARRAY$2;
1154
+ const _scrollOptions = scrollOptions;
1155
+ const _flagRefs = flagRefs;
1159
1156
  hooks.useEffect(() => {
1160
1157
  // return early if flags are not raised, or component is not mounted
1161
1158
  if (minDash.some(_flagRefs, ref => !ref.current) || !scrolledElementRef.current) {
@@ -1543,9 +1540,8 @@ function _getZeroPaddedString(time) {
1543
1540
  return time.toString().padStart(2, '0');
1544
1541
  }
1545
1542
 
1546
- const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i; // eslint-disable-line no-useless-escape
1547
- const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i; // eslint-disable-line no-useless-escape
1548
-
1543
+ const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i;
1544
+ const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i;
1549
1545
  function sanitizeDateTimePickerValue(options) {
1550
1546
  const {
1551
1547
  formField,
@@ -1787,10 +1783,10 @@ function Errors(props) {
1787
1783
  "aria-live": "polite",
1788
1784
  id: id,
1789
1785
  children: jsxRuntime.jsx("ul", {
1790
- children: errors.map(error => {
1786
+ children: errors.map((error, index) => {
1791
1787
  return jsxRuntime.jsx("li", {
1792
1788
  children: error
1793
- });
1789
+ }, index);
1794
1790
  })
1795
1791
  })
1796
1792
  });
@@ -1809,7 +1805,7 @@ function Label(props) {
1809
1805
  });
1810
1806
  return jsxRuntime.jsxs("label", {
1811
1807
  id: id,
1812
- for: htmlFor,
1808
+ htmlFor: htmlFor,
1813
1809
  class: classNames('fjs-form-field-label', {
1814
1810
  'fjs-incollapsible-label': !collapseOnEmpty
1815
1811
  }, props['class']),
@@ -2292,7 +2288,7 @@ function RowsRenderer(props) {
2292
2288
  indexes: indexes
2293
2289
  });
2294
2290
  })
2295
- });
2291
+ }, row.id);
2296
2292
  }), ' ']
2297
2293
  });
2298
2294
  }
@@ -2702,16 +2698,16 @@ function DropdownList(props) {
2702
2698
  maxHeight: height,
2703
2699
  scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
2704
2700
  },
2705
- children: [values.length > 0 && values.map((v, i) => {
2701
+ children: [values.length > 0 && values.map((entry, index) => {
2706
2702
  return jsxRuntime.jsx("div", {
2707
2703
  class: classNames('fjs-dropdownlist-item', {
2708
- focused: focusedValueIndex === i
2704
+ focused: focusedValueIndex === index
2709
2705
  }),
2710
- onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
2711
- onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
2712
- onMouseDown: e => onValueSelected(v),
2713
- children: getLabel(v)
2714
- });
2706
+ onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, index),
2707
+ onMouseEnter: mouseControl ? () => setFocusedValueIndex(index) : undefined,
2708
+ onMouseDown: e => onValueSelected(entry),
2709
+ children: getLabel(entry)
2710
+ }, entry.value);
2715
2711
  }), !values.length && jsxRuntime.jsx("div", {
2716
2712
  class: "fjs-dropdownlist-empty",
2717
2713
  children: emptyListMessage
@@ -4778,7 +4774,7 @@ function Taglist(props) {
4778
4774
  }),
4779
4775
  children: [loadState === LOAD_STATES.LOADED && jsxRuntime.jsx("div", {
4780
4776
  class: "fjs-taglist-tags",
4781
- children: values.map(v => {
4777
+ children: values.map(entry => {
4782
4778
  return jsxRuntime.jsxs("div", {
4783
4779
  class: classNames('fjs-taglist-tag', {
4784
4780
  'fjs-disabled': disabled,
@@ -4787,17 +4783,17 @@ function Taglist(props) {
4787
4783
  onMouseDown: e => e.preventDefault(),
4788
4784
  children: [jsxRuntime.jsx("span", {
4789
4785
  class: "fjs-taglist-tag-label",
4790
- children: getLabelCorrelation(v)
4786
+ children: getLabelCorrelation(entry)
4791
4787
  }), !disabled && !readonly && jsxRuntime.jsx("button", {
4792
4788
  type: "button",
4793
4789
  title: "Remove tag",
4794
4790
  class: "fjs-taglist-tag-remove",
4795
4791
  onFocus: onElementFocus,
4796
4792
  onBlur: onElementBlur,
4797
- onClick: event => onTagRemoveClick(event, v),
4793
+ onClick: event => onTagRemoveClick(event, entry),
4798
4794
  children: jsxRuntime.jsx(SvgXMark, {})
4799
4795
  })]
4800
- });
4796
+ }, entry);
4801
4797
  })
4802
4798
  }), jsxRuntime.jsx("input", {
4803
4799
  disabled: disabled,
@@ -5307,7 +5303,7 @@ function Textarea(props) {
5307
5303
  }), jsxRuntime.jsx("textarea", {
5308
5304
  class: "fjs-textarea",
5309
5305
  disabled: disabled,
5310
- readonly: readonly,
5306
+ readOnly: readonly,
5311
5307
  id: domId,
5312
5308
  onInput: onInputChange,
5313
5309
  onBlur: onInputBlur,
@@ -5764,6 +5760,8 @@ const EMPTY_ARRAY$1 = [];
5764
5760
  * @property {string} [field.label]
5765
5761
  * @property {string} [field.accept]
5766
5762
  * @property {string|boolean} [field.multiple]
5763
+ * @property {Object} [field.validate]
5764
+ * @property {boolean} [field.validate.required]
5767
5765
  * @property {string} [value]
5768
5766
  *
5769
5767
  * @param {Props} props
@@ -5781,13 +5779,13 @@ function FilePicker(props) {
5781
5779
  errors = [],
5782
5780
  disabled,
5783
5781
  readonly,
5784
- required,
5785
5782
  value: filesKey = ''
5786
5783
  } = props;
5787
5784
  const {
5788
5785
  label,
5789
5786
  multiple = false,
5790
- accept = ''
5787
+ accept = '',
5788
+ validate = {}
5791
5789
  } = field;
5792
5790
  /** @type {string} */
5793
5791
  const evaluatedAccept = useSingleLineTemplateEvaluation(accept, {
@@ -5843,7 +5841,7 @@ function FilePicker(props) {
5843
5841
  children: [jsxRuntime.jsx(Label, {
5844
5842
  htmlFor: domId,
5845
5843
  label: label,
5846
- required: required
5844
+ required: validate.required
5847
5845
  }), jsxRuntime.jsx("input", {
5848
5846
  type: "file",
5849
5847
  className: "fjs-hidden",
@@ -5853,13 +5851,14 @@ function FilePicker(props) {
5853
5851
  disabled: isInputDisabled,
5854
5852
  multiple: evaluatedMultiple || undefined,
5855
5853
  accept: evaluatedAccept || undefined,
5856
- onChange: onFileChange
5854
+ onChange: onFileChange,
5855
+ required: validate.required
5857
5856
  }), jsxRuntime.jsxs("div", {
5858
5857
  className: "fjs-filepicker-container",
5859
5858
  children: [jsxRuntime.jsx("button", {
5860
5859
  type: "button",
5861
5860
  disabled: isInputDisabled,
5862
- readonly: readonly,
5861
+ readOnly: readonly,
5863
5862
  className: "fjs-button fjs-filepicker-button",
5864
5863
  onClick: () => {
5865
5864
  fileInputRef.current.click();
@@ -6047,7 +6046,7 @@ function isValidDocumentEndpoint(endpoint) {
6047
6046
  * @returns {metadata is DocumentMetadata}
6048
6047
  */
6049
6048
  function isValidDocument(document) {
6050
- return typeof document === 'object' && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
6049
+ return typeof document === 'object' && document !== null && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
6051
6050
  }
6052
6051
 
6053
6052
  /**
@@ -6290,14 +6289,14 @@ function Lightbox(props) {
6290
6289
  children: [jsxRuntime.jsx("a", {
6291
6290
  href: "https://bpmn.io",
6292
6291
  target: "_blank",
6293
- rel: "noopener",
6292
+ rel: "noopener noreferrer",
6294
6293
  style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
6295
6294
  children: jsxRuntime.jsx(Logo, {})
6296
6295
  }), jsxRuntime.jsxs("span", {
6297
6296
  children: ["Web-based tooling for BPMN, DMN, and forms powered by", ' ', jsxRuntime.jsx("a", {
6298
6297
  href: "https://bpmn.io",
6299
6298
  target: "_blank",
6300
- rel: "noopener",
6299
+ rel: "noopener noreferrer",
6301
6300
  children: "bpmn.io"
6302
6301
  }), "."]
6303
6302
  })]
@@ -6311,7 +6310,7 @@ function Link(props) {
6311
6310
  children: jsxRuntime.jsx("a", {
6312
6311
  href: "https://bpmn.io",
6313
6312
  target: "_blank",
6314
- rel: "noopener",
6313
+ rel: "noopener noreferrer",
6315
6314
  class: "fjs-powered-by-link",
6316
6315
  title: "Powered by bpmn.io",
6317
6316
  style: "color: var(--cds-text-primary, #404040)",
@@ -7516,7 +7515,7 @@ class RepeatRenderManager {
7516
7515
  showRemove: showRemove,
7517
7516
  ...restProps
7518
7517
  })
7519
- }))
7518
+ }, itemIndex))
7520
7519
  });
7521
7520
  }
7522
7521
  RepeatFooter(props) {