@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.cjs
CHANGED
|
@@ -927,7 +927,6 @@ function useDeepCompareMemoize(value) {
|
|
|
927
927
|
* @enum { String }
|
|
928
928
|
*/
|
|
929
929
|
const LOAD_STATES = {
|
|
930
|
-
LOADING: 'loading',
|
|
931
930
|
LOADED: 'loaded',
|
|
932
931
|
ERROR: 'error'
|
|
933
932
|
};
|
|
@@ -1543,9 +1542,8 @@ function _getZeroPaddedString(time) {
|
|
|
1543
1542
|
return time.toString().padStart(2, '0');
|
|
1544
1543
|
}
|
|
1545
1544
|
|
|
1546
|
-
const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i;
|
|
1547
|
-
const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i;
|
|
1548
|
-
|
|
1545
|
+
const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i;
|
|
1546
|
+
const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i;
|
|
1549
1547
|
function sanitizeDateTimePickerValue(options) {
|
|
1550
1548
|
const {
|
|
1551
1549
|
formField,
|
|
@@ -1787,10 +1785,10 @@ function Errors(props) {
|
|
|
1787
1785
|
"aria-live": "polite",
|
|
1788
1786
|
id: id,
|
|
1789
1787
|
children: jsxRuntime.jsx("ul", {
|
|
1790
|
-
children: errors.map(error => {
|
|
1788
|
+
children: errors.map((error, index) => {
|
|
1791
1789
|
return jsxRuntime.jsx("li", {
|
|
1792
1790
|
children: error
|
|
1793
|
-
});
|
|
1791
|
+
}, index);
|
|
1794
1792
|
})
|
|
1795
1793
|
})
|
|
1796
1794
|
});
|
|
@@ -1809,7 +1807,7 @@ function Label(props) {
|
|
|
1809
1807
|
});
|
|
1810
1808
|
return jsxRuntime.jsxs("label", {
|
|
1811
1809
|
id: id,
|
|
1812
|
-
|
|
1810
|
+
htmlFor: htmlFor,
|
|
1813
1811
|
class: classNames('fjs-form-field-label', {
|
|
1814
1812
|
'fjs-incollapsible-label': !collapseOnEmpty
|
|
1815
1813
|
}, props['class']),
|
|
@@ -2292,7 +2290,7 @@ function RowsRenderer(props) {
|
|
|
2292
2290
|
indexes: indexes
|
|
2293
2291
|
});
|
|
2294
2292
|
})
|
|
2295
|
-
});
|
|
2293
|
+
}, row.id);
|
|
2296
2294
|
}), ' ']
|
|
2297
2295
|
});
|
|
2298
2296
|
}
|
|
@@ -2702,16 +2700,16 @@ function DropdownList(props) {
|
|
|
2702
2700
|
maxHeight: height,
|
|
2703
2701
|
scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
|
|
2704
2702
|
},
|
|
2705
|
-
children: [values.length > 0 && values.map((
|
|
2703
|
+
children: [values.length > 0 && values.map((entry, index) => {
|
|
2706
2704
|
return jsxRuntime.jsx("div", {
|
|
2707
2705
|
class: classNames('fjs-dropdownlist-item', {
|
|
2708
|
-
focused: focusedValueIndex ===
|
|
2706
|
+
focused: focusedValueIndex === index
|
|
2709
2707
|
}),
|
|
2710
|
-
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e,
|
|
2711
|
-
onMouseEnter: mouseControl ? () => setFocusedValueIndex(
|
|
2712
|
-
onMouseDown: e => onValueSelected(
|
|
2713
|
-
children: getLabel(
|
|
2714
|
-
});
|
|
2708
|
+
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, index),
|
|
2709
|
+
onMouseEnter: mouseControl ? () => setFocusedValueIndex(index) : undefined,
|
|
2710
|
+
onMouseDown: e => onValueSelected(entry),
|
|
2711
|
+
children: getLabel(entry)
|
|
2712
|
+
}, entry.value);
|
|
2715
2713
|
}), !values.length && jsxRuntime.jsx("div", {
|
|
2716
2714
|
class: "fjs-dropdownlist-empty",
|
|
2717
2715
|
children: emptyListMessage
|
|
@@ -4778,7 +4776,7 @@ function Taglist(props) {
|
|
|
4778
4776
|
}),
|
|
4779
4777
|
children: [loadState === LOAD_STATES.LOADED && jsxRuntime.jsx("div", {
|
|
4780
4778
|
class: "fjs-taglist-tags",
|
|
4781
|
-
children: values.map(
|
|
4779
|
+
children: values.map(entry => {
|
|
4782
4780
|
return jsxRuntime.jsxs("div", {
|
|
4783
4781
|
class: classNames('fjs-taglist-tag', {
|
|
4784
4782
|
'fjs-disabled': disabled,
|
|
@@ -4787,17 +4785,17 @@ function Taglist(props) {
|
|
|
4787
4785
|
onMouseDown: e => e.preventDefault(),
|
|
4788
4786
|
children: [jsxRuntime.jsx("span", {
|
|
4789
4787
|
class: "fjs-taglist-tag-label",
|
|
4790
|
-
children: getLabelCorrelation(
|
|
4788
|
+
children: getLabelCorrelation(entry)
|
|
4791
4789
|
}), !disabled && !readonly && jsxRuntime.jsx("button", {
|
|
4792
4790
|
type: "button",
|
|
4793
4791
|
title: "Remove tag",
|
|
4794
4792
|
class: "fjs-taglist-tag-remove",
|
|
4795
4793
|
onFocus: onElementFocus,
|
|
4796
4794
|
onBlur: onElementBlur,
|
|
4797
|
-
onClick: event => onTagRemoveClick(event,
|
|
4795
|
+
onClick: event => onTagRemoveClick(event, entry),
|
|
4798
4796
|
children: jsxRuntime.jsx(SvgXMark, {})
|
|
4799
4797
|
})]
|
|
4800
|
-
});
|
|
4798
|
+
}, entry);
|
|
4801
4799
|
})
|
|
4802
4800
|
}), jsxRuntime.jsx("input", {
|
|
4803
4801
|
disabled: disabled,
|
|
@@ -5307,7 +5305,7 @@ function Textarea(props) {
|
|
|
5307
5305
|
}), jsxRuntime.jsx("textarea", {
|
|
5308
5306
|
class: "fjs-textarea",
|
|
5309
5307
|
disabled: disabled,
|
|
5310
|
-
|
|
5308
|
+
readOnly: readonly,
|
|
5311
5309
|
id: domId,
|
|
5312
5310
|
onInput: onInputChange,
|
|
5313
5311
|
onBlur: onInputBlur,
|
|
@@ -5764,6 +5762,8 @@ const EMPTY_ARRAY$1 = [];
|
|
|
5764
5762
|
* @property {string} [field.label]
|
|
5765
5763
|
* @property {string} [field.accept]
|
|
5766
5764
|
* @property {string|boolean} [field.multiple]
|
|
5765
|
+
* @property {Object} [field.validate]
|
|
5766
|
+
* @property {boolean} [field.validate.required]
|
|
5767
5767
|
* @property {string} [value]
|
|
5768
5768
|
*
|
|
5769
5769
|
* @param {Props} props
|
|
@@ -5781,13 +5781,13 @@ function FilePicker(props) {
|
|
|
5781
5781
|
errors = [],
|
|
5782
5782
|
disabled,
|
|
5783
5783
|
readonly,
|
|
5784
|
-
required,
|
|
5785
5784
|
value: filesKey = ''
|
|
5786
5785
|
} = props;
|
|
5787
5786
|
const {
|
|
5788
5787
|
label,
|
|
5789
5788
|
multiple = false,
|
|
5790
|
-
accept = ''
|
|
5789
|
+
accept = '',
|
|
5790
|
+
validate = {}
|
|
5791
5791
|
} = field;
|
|
5792
5792
|
/** @type {string} */
|
|
5793
5793
|
const evaluatedAccept = useSingleLineTemplateEvaluation(accept, {
|
|
@@ -5843,7 +5843,7 @@ function FilePicker(props) {
|
|
|
5843
5843
|
children: [jsxRuntime.jsx(Label, {
|
|
5844
5844
|
htmlFor: domId,
|
|
5845
5845
|
label: label,
|
|
5846
|
-
required: required
|
|
5846
|
+
required: validate.required
|
|
5847
5847
|
}), jsxRuntime.jsx("input", {
|
|
5848
5848
|
type: "file",
|
|
5849
5849
|
className: "fjs-hidden",
|
|
@@ -5853,13 +5853,14 @@ function FilePicker(props) {
|
|
|
5853
5853
|
disabled: isInputDisabled,
|
|
5854
5854
|
multiple: evaluatedMultiple || undefined,
|
|
5855
5855
|
accept: evaluatedAccept || undefined,
|
|
5856
|
-
onChange: onFileChange
|
|
5856
|
+
onChange: onFileChange,
|
|
5857
|
+
required: validate.required
|
|
5857
5858
|
}), jsxRuntime.jsxs("div", {
|
|
5858
5859
|
className: "fjs-filepicker-container",
|
|
5859
5860
|
children: [jsxRuntime.jsx("button", {
|
|
5860
5861
|
type: "button",
|
|
5861
5862
|
disabled: isInputDisabled,
|
|
5862
|
-
|
|
5863
|
+
readOnly: readonly,
|
|
5863
5864
|
className: "fjs-button fjs-filepicker-button",
|
|
5864
5865
|
onClick: () => {
|
|
5865
5866
|
fileInputRef.current.click();
|
|
@@ -6047,7 +6048,7 @@ function isValidDocumentEndpoint(endpoint) {
|
|
|
6047
6048
|
* @returns {metadata is DocumentMetadata}
|
|
6048
6049
|
*/
|
|
6049
6050
|
function isValidDocument(document) {
|
|
6050
|
-
return typeof document === 'object' && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
|
|
6051
|
+
return typeof document === 'object' && document !== null && 'documentId' in document && 'metadata' in document && typeof document.metadata === 'object' && 'fileName' in document.metadata;
|
|
6051
6052
|
}
|
|
6052
6053
|
|
|
6053
6054
|
/**
|
|
@@ -6062,6 +6063,59 @@ function useValidDocumentData(dataSource) {
|
|
|
6062
6063
|
return data.filter(isValidDocument);
|
|
6063
6064
|
}
|
|
6064
6065
|
|
|
6066
|
+
/**
|
|
6067
|
+
* @param {Object} props
|
|
6068
|
+
* @param {string} props.url
|
|
6069
|
+
* @param {string} props.fileName
|
|
6070
|
+
* @param {Function} props.onError
|
|
6071
|
+
* @param {string} props.errorMessageId
|
|
6072
|
+
* @returns {import("preact").JSX.Element}
|
|
6073
|
+
*/
|
|
6074
|
+
function PdfRenderer(props) {
|
|
6075
|
+
const {
|
|
6076
|
+
url,
|
|
6077
|
+
onError,
|
|
6078
|
+
errorMessageId
|
|
6079
|
+
} = props;
|
|
6080
|
+
const [pdfObjectUrl, setPdfObjectUrl] = hooks.useState(null);
|
|
6081
|
+
const [hasError, setHasError] = hooks.useState(false);
|
|
6082
|
+
hooks.useEffect(() => {
|
|
6083
|
+
let objectUrl = null;
|
|
6084
|
+
const fetchPdf = async () => {
|
|
6085
|
+
try {
|
|
6086
|
+
const response = await fetch(url);
|
|
6087
|
+
if (!response.ok) {
|
|
6088
|
+
setHasError(true);
|
|
6089
|
+
onError();
|
|
6090
|
+
return;
|
|
6091
|
+
}
|
|
6092
|
+
const blob = await response.blob();
|
|
6093
|
+
objectUrl = URL.createObjectURL(blob);
|
|
6094
|
+
setPdfObjectUrl(objectUrl);
|
|
6095
|
+
} catch {
|
|
6096
|
+
setHasError(true);
|
|
6097
|
+
onError();
|
|
6098
|
+
}
|
|
6099
|
+
};
|
|
6100
|
+
fetchPdf();
|
|
6101
|
+
return () => {
|
|
6102
|
+
if (objectUrl) {
|
|
6103
|
+
URL.revokeObjectURL(objectUrl);
|
|
6104
|
+
}
|
|
6105
|
+
};
|
|
6106
|
+
}, [url, onError]);
|
|
6107
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6108
|
+
children: [pdfObjectUrl ? jsxRuntime.jsx("embed", {
|
|
6109
|
+
src: pdfObjectUrl,
|
|
6110
|
+
type: "application/pdf",
|
|
6111
|
+
class: `fjs-${type}-pdf-viewer`
|
|
6112
|
+
}) : null, hasError ? jsxRuntime.jsx(Errors, {
|
|
6113
|
+
id: errorMessageId,
|
|
6114
|
+
errors: ['Unable to download document']
|
|
6115
|
+
}) : null]
|
|
6116
|
+
});
|
|
6117
|
+
}
|
|
6118
|
+
|
|
6065
6119
|
/**
|
|
6066
6120
|
*
|
|
6067
6121
|
* @param {Object} props
|
|
@@ -6118,20 +6172,18 @@ function DocumentRenderer(props) {
|
|
|
6118
6172
|
});
|
|
6119
6173
|
}
|
|
6120
6174
|
if (isContentTypePresent && metadata.contentType.toLowerCase() === 'application/pdf' && isInViewport) {
|
|
6121
|
-
return jsxRuntime.
|
|
6175
|
+
return jsxRuntime.jsx("div", {
|
|
6122
6176
|
class: singleDocumentContainerClassName,
|
|
6123
6177
|
style: {
|
|
6124
6178
|
maxHeight
|
|
6125
6179
|
},
|
|
6126
6180
|
"aria-describedby": hasError ? errorMessageId : undefined,
|
|
6127
|
-
children:
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
errors: [errorMessage]
|
|
6134
|
-
}) : null]
|
|
6181
|
+
children: jsxRuntime.jsx(PdfRenderer, {
|
|
6182
|
+
url: fullUrl,
|
|
6183
|
+
fileName: metadata.fileName,
|
|
6184
|
+
onError: () => setHasError(true),
|
|
6185
|
+
errorMessageId: errorMessageId
|
|
6186
|
+
})
|
|
6135
6187
|
});
|
|
6136
6188
|
}
|
|
6137
6189
|
return jsxRuntime.jsxs("div", {
|
|
@@ -6290,14 +6342,14 @@ function Lightbox(props) {
|
|
|
6290
6342
|
children: [jsxRuntime.jsx("a", {
|
|
6291
6343
|
href: "https://bpmn.io",
|
|
6292
6344
|
target: "_blank",
|
|
6293
|
-
rel: "noopener",
|
|
6345
|
+
rel: "noopener noreferrer",
|
|
6294
6346
|
style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
|
|
6295
6347
|
children: jsxRuntime.jsx(Logo, {})
|
|
6296
6348
|
}), jsxRuntime.jsxs("span", {
|
|
6297
6349
|
children: ["Web-based tooling for BPMN, DMN, and forms powered by", ' ', jsxRuntime.jsx("a", {
|
|
6298
6350
|
href: "https://bpmn.io",
|
|
6299
6351
|
target: "_blank",
|
|
6300
|
-
rel: "noopener",
|
|
6352
|
+
rel: "noopener noreferrer",
|
|
6301
6353
|
children: "bpmn.io"
|
|
6302
6354
|
}), "."]
|
|
6303
6355
|
})]
|
|
@@ -6311,7 +6363,7 @@ function Link(props) {
|
|
|
6311
6363
|
children: jsxRuntime.jsx("a", {
|
|
6312
6364
|
href: "https://bpmn.io",
|
|
6313
6365
|
target: "_blank",
|
|
6314
|
-
rel: "noopener",
|
|
6366
|
+
rel: "noopener noreferrer",
|
|
6315
6367
|
class: "fjs-powered-by-link",
|
|
6316
6368
|
title: "Powered by bpmn.io",
|
|
6317
6369
|
style: "color: var(--cds-text-primary, #404040)",
|
|
@@ -7516,7 +7568,7 @@ class RepeatRenderManager {
|
|
|
7516
7568
|
showRemove: showRemove,
|
|
7517
7569
|
...restProps
|
|
7518
7570
|
})
|
|
7519
|
-
}))
|
|
7571
|
+
}, itemIndex))
|
|
7520
7572
|
});
|
|
7521
7573
|
}
|
|
7522
7574
|
RepeatFooter(props) {
|