@bpmn-io/form-js-viewer 1.13.2 → 1.14.1-alpha.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 +91 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +91 -39
- package/dist/index.es.js.map +1 -1
- package/dist/types/Form.d.ts +12 -12
- package/dist/types/core/Importer.d.ts +1 -1
- package/dist/types/features/expressionLanguage/ConditionChecker.d.ts +1 -1
- package/dist/types/features/expressionLanguage/FeelExpressionLanguage.d.ts +1 -1
- package/dist/types/features/expressionLanguage/FeelersTemplating.d.ts +2 -2
- package/dist/types/features/repeatRender/RepeatRenderManager.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/render/FileRegistry.d.ts +4 -4
- package/dist/types/render/Renderer.d.ts +4 -4
- package/dist/types/render/components/form-fields/FilePicker.d.ts +5 -0
- package/dist/types/render/components/form-fields/Table.d.ts +1 -1
- package/dist/types/render/hooks/useReadonly.d.ts +1 -1
- package/dist/types/render/hooks/useService.d.ts +1 -1
- package/dist/types/util/getSchemaVariables.d.ts +1 -1
- package/dist/types/util/structure.d.ts +1 -1
- package/package.json +6 -6
package/dist/index.es.js
CHANGED
|
@@ -907,7 +907,6 @@ function useDeepCompareMemoize(value) {
|
|
|
907
907
|
* @enum { String }
|
|
908
908
|
*/
|
|
909
909
|
const LOAD_STATES = {
|
|
910
|
-
LOADING: 'loading',
|
|
911
910
|
LOADED: 'loaded',
|
|
912
911
|
ERROR: 'error'
|
|
913
912
|
};
|
|
@@ -1523,9 +1522,8 @@ function _getZeroPaddedString(time) {
|
|
|
1523
1522
|
return time.toString().padStart(2, '0');
|
|
1524
1523
|
}
|
|
1525
1524
|
|
|
1526
|
-
const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i;
|
|
1527
|
-
const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i;
|
|
1528
|
-
|
|
1525
|
+
const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i;
|
|
1526
|
+
const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i;
|
|
1529
1527
|
function sanitizeDateTimePickerValue(options) {
|
|
1530
1528
|
const {
|
|
1531
1529
|
formField,
|
|
@@ -1767,10 +1765,10 @@ function Errors(props) {
|
|
|
1767
1765
|
"aria-live": "polite",
|
|
1768
1766
|
id: id,
|
|
1769
1767
|
children: jsx("ul", {
|
|
1770
|
-
children: errors.map(error => {
|
|
1768
|
+
children: errors.map((error, index) => {
|
|
1771
1769
|
return jsx("li", {
|
|
1772
1770
|
children: error
|
|
1773
|
-
});
|
|
1771
|
+
}, index);
|
|
1774
1772
|
})
|
|
1775
1773
|
})
|
|
1776
1774
|
});
|
|
@@ -1789,7 +1787,7 @@ function Label(props) {
|
|
|
1789
1787
|
});
|
|
1790
1788
|
return jsxs("label", {
|
|
1791
1789
|
id: id,
|
|
1792
|
-
|
|
1790
|
+
htmlFor: htmlFor,
|
|
1793
1791
|
class: classNames('fjs-form-field-label', {
|
|
1794
1792
|
'fjs-incollapsible-label': !collapseOnEmpty
|
|
1795
1793
|
}, props['class']),
|
|
@@ -2272,7 +2270,7 @@ function RowsRenderer(props) {
|
|
|
2272
2270
|
indexes: indexes
|
|
2273
2271
|
});
|
|
2274
2272
|
})
|
|
2275
|
-
});
|
|
2273
|
+
}, row.id);
|
|
2276
2274
|
}), ' ']
|
|
2277
2275
|
});
|
|
2278
2276
|
}
|
|
@@ -2682,16 +2680,16 @@ function DropdownList(props) {
|
|
|
2682
2680
|
maxHeight: height,
|
|
2683
2681
|
scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
|
|
2684
2682
|
},
|
|
2685
|
-
children: [values.length > 0 && values.map((
|
|
2683
|
+
children: [values.length > 0 && values.map((entry, index) => {
|
|
2686
2684
|
return jsx("div", {
|
|
2687
2685
|
class: classNames('fjs-dropdownlist-item', {
|
|
2688
|
-
focused: focusedValueIndex ===
|
|
2686
|
+
focused: focusedValueIndex === index
|
|
2689
2687
|
}),
|
|
2690
|
-
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e,
|
|
2691
|
-
onMouseEnter: mouseControl ? () => setFocusedValueIndex(
|
|
2692
|
-
onMouseDown: e => onValueSelected(
|
|
2693
|
-
children: getLabel(
|
|
2694
|
-
});
|
|
2688
|
+
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, index),
|
|
2689
|
+
onMouseEnter: mouseControl ? () => setFocusedValueIndex(index) : undefined,
|
|
2690
|
+
onMouseDown: e => onValueSelected(entry),
|
|
2691
|
+
children: getLabel(entry)
|
|
2692
|
+
}, entry.value);
|
|
2695
2693
|
}), !values.length && jsx("div", {
|
|
2696
2694
|
class: "fjs-dropdownlist-empty",
|
|
2697
2695
|
children: emptyListMessage
|
|
@@ -4758,7 +4756,7 @@ function Taglist(props) {
|
|
|
4758
4756
|
}),
|
|
4759
4757
|
children: [loadState === LOAD_STATES.LOADED && jsx("div", {
|
|
4760
4758
|
class: "fjs-taglist-tags",
|
|
4761
|
-
children: values.map(
|
|
4759
|
+
children: values.map(entry => {
|
|
4762
4760
|
return jsxs("div", {
|
|
4763
4761
|
class: classNames('fjs-taglist-tag', {
|
|
4764
4762
|
'fjs-disabled': disabled,
|
|
@@ -4767,17 +4765,17 @@ function Taglist(props) {
|
|
|
4767
4765
|
onMouseDown: e => e.preventDefault(),
|
|
4768
4766
|
children: [jsx("span", {
|
|
4769
4767
|
class: "fjs-taglist-tag-label",
|
|
4770
|
-
children: getLabelCorrelation(
|
|
4768
|
+
children: getLabelCorrelation(entry)
|
|
4771
4769
|
}), !disabled && !readonly && jsx("button", {
|
|
4772
4770
|
type: "button",
|
|
4773
4771
|
title: "Remove tag",
|
|
4774
4772
|
class: "fjs-taglist-tag-remove",
|
|
4775
4773
|
onFocus: onElementFocus,
|
|
4776
4774
|
onBlur: onElementBlur,
|
|
4777
|
-
onClick: event => onTagRemoveClick(event,
|
|
4775
|
+
onClick: event => onTagRemoveClick(event, entry),
|
|
4778
4776
|
children: jsx(SvgXMark, {})
|
|
4779
4777
|
})]
|
|
4780
|
-
});
|
|
4778
|
+
}, entry);
|
|
4781
4779
|
})
|
|
4782
4780
|
}), jsx("input", {
|
|
4783
4781
|
disabled: disabled,
|
|
@@ -5287,7 +5285,7 @@ function Textarea(props) {
|
|
|
5287
5285
|
}), jsx("textarea", {
|
|
5288
5286
|
class: "fjs-textarea",
|
|
5289
5287
|
disabled: disabled,
|
|
5290
|
-
|
|
5288
|
+
readOnly: readonly,
|
|
5291
5289
|
id: domId,
|
|
5292
5290
|
onInput: onInputChange,
|
|
5293
5291
|
onBlur: onInputBlur,
|
|
@@ -5744,6 +5742,8 @@ const EMPTY_ARRAY$1 = [];
|
|
|
5744
5742
|
* @property {string} [field.label]
|
|
5745
5743
|
* @property {string} [field.accept]
|
|
5746
5744
|
* @property {string|boolean} [field.multiple]
|
|
5745
|
+
* @property {Object} [field.validate]
|
|
5746
|
+
* @property {boolean} [field.validate.required]
|
|
5747
5747
|
* @property {string} [value]
|
|
5748
5748
|
*
|
|
5749
5749
|
* @param {Props} props
|
|
@@ -5761,13 +5761,13 @@ function FilePicker(props) {
|
|
|
5761
5761
|
errors = [],
|
|
5762
5762
|
disabled,
|
|
5763
5763
|
readonly,
|
|
5764
|
-
required,
|
|
5765
5764
|
value: filesKey = ''
|
|
5766
5765
|
} = props;
|
|
5767
5766
|
const {
|
|
5768
5767
|
label,
|
|
5769
5768
|
multiple = false,
|
|
5770
|
-
accept = ''
|
|
5769
|
+
accept = '',
|
|
5770
|
+
validate = {}
|
|
5771
5771
|
} = field;
|
|
5772
5772
|
/** @type {string} */
|
|
5773
5773
|
const evaluatedAccept = useSingleLineTemplateEvaluation(accept, {
|
|
@@ -5823,7 +5823,7 @@ function FilePicker(props) {
|
|
|
5823
5823
|
children: [jsx(Label, {
|
|
5824
5824
|
htmlFor: domId,
|
|
5825
5825
|
label: label,
|
|
5826
|
-
required: required
|
|
5826
|
+
required: validate.required
|
|
5827
5827
|
}), jsx("input", {
|
|
5828
5828
|
type: "file",
|
|
5829
5829
|
className: "fjs-hidden",
|
|
@@ -5833,13 +5833,14 @@ function FilePicker(props) {
|
|
|
5833
5833
|
disabled: isInputDisabled,
|
|
5834
5834
|
multiple: evaluatedMultiple || undefined,
|
|
5835
5835
|
accept: evaluatedAccept || undefined,
|
|
5836
|
-
onChange: onFileChange
|
|
5836
|
+
onChange: onFileChange,
|
|
5837
|
+
required: validate.required
|
|
5837
5838
|
}), jsxs("div", {
|
|
5838
5839
|
className: "fjs-filepicker-container",
|
|
5839
5840
|
children: [jsx("button", {
|
|
5840
5841
|
type: "button",
|
|
5841
5842
|
disabled: isInputDisabled,
|
|
5842
|
-
|
|
5843
|
+
readOnly: readonly,
|
|
5843
5844
|
className: "fjs-button fjs-filepicker-button",
|
|
5844
5845
|
onClick: () => {
|
|
5845
5846
|
fileInputRef.current.click();
|
|
@@ -6027,7 +6028,7 @@ function isValidDocumentEndpoint(endpoint) {
|
|
|
6027
6028
|
* @returns {metadata is DocumentMetadata}
|
|
6028
6029
|
*/
|
|
6029
6030
|
function isValidDocument(document) {
|
|
6030
|
-
return typeof document === 'object' && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
|
|
6031
|
+
return typeof document === 'object' && document !== null && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
|
|
6031
6032
|
}
|
|
6032
6033
|
|
|
6033
6034
|
/**
|
|
@@ -6042,6 +6043,59 @@ function useValidDocumentData(dataSource) {
|
|
|
6042
6043
|
return data.filter(isValidDocument);
|
|
6043
6044
|
}
|
|
6044
6045
|
|
|
6046
|
+
/**
|
|
6047
|
+
* @param {Object} props
|
|
6048
|
+
* @param {string} props.url
|
|
6049
|
+
* @param {string} props.fileName
|
|
6050
|
+
* @param {Function} props.onError
|
|
6051
|
+
* @param {string} props.errorMessageId
|
|
6052
|
+
* @returns {import("preact").JSX.Element}
|
|
6053
|
+
*/
|
|
6054
|
+
function PdfRenderer(props) {
|
|
6055
|
+
const {
|
|
6056
|
+
url,
|
|
6057
|
+
onError,
|
|
6058
|
+
errorMessageId
|
|
6059
|
+
} = props;
|
|
6060
|
+
const [pdfObjectUrl, setPdfObjectUrl] = useState(null);
|
|
6061
|
+
const [hasError, setHasError] = useState(false);
|
|
6062
|
+
useEffect(() => {
|
|
6063
|
+
let objectUrl = null;
|
|
6064
|
+
const fetchPdf = async () => {
|
|
6065
|
+
try {
|
|
6066
|
+
const response = await fetch(url);
|
|
6067
|
+
if (!response.ok) {
|
|
6068
|
+
setHasError(true);
|
|
6069
|
+
onError();
|
|
6070
|
+
return;
|
|
6071
|
+
}
|
|
6072
|
+
const blob = await response.blob();
|
|
6073
|
+
objectUrl = URL.createObjectURL(blob);
|
|
6074
|
+
setPdfObjectUrl(objectUrl);
|
|
6075
|
+
} catch {
|
|
6076
|
+
setHasError(true);
|
|
6077
|
+
onError();
|
|
6078
|
+
}
|
|
6079
|
+
};
|
|
6080
|
+
fetchPdf();
|
|
6081
|
+
return () => {
|
|
6082
|
+
if (objectUrl) {
|
|
6083
|
+
URL.revokeObjectURL(objectUrl);
|
|
6084
|
+
}
|
|
6085
|
+
};
|
|
6086
|
+
}, [url, onError]);
|
|
6087
|
+
return jsxs(Fragment, {
|
|
6088
|
+
children: [pdfObjectUrl ? jsx("embed", {
|
|
6089
|
+
src: pdfObjectUrl,
|
|
6090
|
+
type: "application/pdf",
|
|
6091
|
+
class: `fjs-${type}-pdf-viewer`
|
|
6092
|
+
}) : null, hasError ? jsx(Errors, {
|
|
6093
|
+
id: errorMessageId,
|
|
6094
|
+
errors: ['Unable to download document']
|
|
6095
|
+
}) : null]
|
|
6096
|
+
});
|
|
6097
|
+
}
|
|
6098
|
+
|
|
6045
6099
|
/**
|
|
6046
6100
|
*
|
|
6047
6101
|
* @param {Object} props
|
|
@@ -6098,20 +6152,18 @@ function DocumentRenderer(props) {
|
|
|
6098
6152
|
});
|
|
6099
6153
|
}
|
|
6100
6154
|
if (isContentTypePresent && metadata.contentType.toLowerCase() === 'application/pdf' && isInViewport) {
|
|
6101
|
-
return
|
|
6155
|
+
return jsx("div", {
|
|
6102
6156
|
class: singleDocumentContainerClassName,
|
|
6103
6157
|
style: {
|
|
6104
6158
|
maxHeight
|
|
6105
6159
|
},
|
|
6106
6160
|
"aria-describedby": hasError ? errorMessageId : undefined,
|
|
6107
|
-
children:
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
errors: [errorMessage]
|
|
6114
|
-
}) : null]
|
|
6161
|
+
children: jsx(PdfRenderer, {
|
|
6162
|
+
url: fullUrl,
|
|
6163
|
+
fileName: metadata.fileName,
|
|
6164
|
+
onError: () => setHasError(true),
|
|
6165
|
+
errorMessageId: errorMessageId
|
|
6166
|
+
})
|
|
6115
6167
|
});
|
|
6116
6168
|
}
|
|
6117
6169
|
return jsxs("div", {
|
|
@@ -6270,14 +6322,14 @@ function Lightbox(props) {
|
|
|
6270
6322
|
children: [jsx("a", {
|
|
6271
6323
|
href: "https://bpmn.io",
|
|
6272
6324
|
target: "_blank",
|
|
6273
|
-
rel: "noopener",
|
|
6325
|
+
rel: "noopener noreferrer",
|
|
6274
6326
|
style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
|
|
6275
6327
|
children: jsx(Logo, {})
|
|
6276
6328
|
}), jsxs("span", {
|
|
6277
6329
|
children: ["Web-based tooling for BPMN, DMN, and forms powered by", ' ', jsx("a", {
|
|
6278
6330
|
href: "https://bpmn.io",
|
|
6279
6331
|
target: "_blank",
|
|
6280
|
-
rel: "noopener",
|
|
6332
|
+
rel: "noopener noreferrer",
|
|
6281
6333
|
children: "bpmn.io"
|
|
6282
6334
|
}), "."]
|
|
6283
6335
|
})]
|
|
@@ -6291,7 +6343,7 @@ function Link(props) {
|
|
|
6291
6343
|
children: jsx("a", {
|
|
6292
6344
|
href: "https://bpmn.io",
|
|
6293
6345
|
target: "_blank",
|
|
6294
|
-
rel: "noopener",
|
|
6346
|
+
rel: "noopener noreferrer",
|
|
6295
6347
|
class: "fjs-powered-by-link",
|
|
6296
6348
|
title: "Powered by bpmn.io",
|
|
6297
6349
|
style: "color: var(--cds-text-primary, #404040)",
|
|
@@ -7496,7 +7548,7 @@ class RepeatRenderManager {
|
|
|
7496
7548
|
showRemove: showRemove,
|
|
7497
7549
|
...restProps
|
|
7498
7550
|
})
|
|
7499
|
-
}))
|
|
7551
|
+
}, itemIndex))
|
|
7500
7552
|
});
|
|
7501
7553
|
}
|
|
7502
7554
|
RepeatFooter(props) {
|