@bpmn-io/form-js-viewer 1.19.0 → 1.21.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/README.md +31 -0
- package/dist/index.cjs +186 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +186 -52
- package/dist/index.es.js.map +1 -1
- package/dist/types/core/Validator.d.ts +1 -0
- package/dist/types/features/expressionLanguage/ConditionChecker.d.ts +12 -1
- package/dist/types/features/expressionLanguage/FeelExpressionLanguage.d.ts +9 -0
- package/dist/types/render/components/form-fields/DocumentPreview.d.ts +4 -2
- package/dist/types/render/hooks/index.d.ts +1 -0
- package/dist/types/render/hooks/useCondition.d.ts +3 -3
- package/dist/types/render/hooks/useUnaryTestEvaluation.d.ts +8 -0
- package/dist/types/types.d.ts +17 -0
- package/dist/types/util/expressions.d.ts +12 -2
- package/dist/types/util/getSchemaVariables.d.ts +8 -4
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -260,16 +260,38 @@ class FeelExpressionLanguage {
|
|
|
260
260
|
* @returns {any}
|
|
261
261
|
*/
|
|
262
262
|
evaluate(expression, data = {}) {
|
|
263
|
-
if (!expression) {
|
|
263
|
+
if (!this.isExpression(expression)) {
|
|
264
264
|
return null;
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
try {
|
|
267
|
+
const {
|
|
268
|
+
value: result
|
|
269
|
+
} = evaluate(expression.slice(1), data);
|
|
270
|
+
return result;
|
|
271
|
+
} catch (error) {
|
|
272
|
+
this._eventBus.fire('error', {
|
|
273
|
+
error
|
|
274
|
+
});
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Evaluate a unary test expression. Returns null for invalid/missing expressions.
|
|
281
|
+
*
|
|
282
|
+
* @param {string} expression
|
|
283
|
+
* @param {import('../../types').Data} [data]
|
|
284
|
+
*
|
|
285
|
+
* @returns {boolean|null}
|
|
286
|
+
*/
|
|
287
|
+
evaluateUnaryTest(expression, data = {}) {
|
|
288
|
+
if (!this.isExpression(expression)) {
|
|
267
289
|
return null;
|
|
268
290
|
}
|
|
269
291
|
try {
|
|
270
292
|
const {
|
|
271
293
|
value: result
|
|
272
|
-
} =
|
|
294
|
+
} = unaryTest(expression.slice(1), data);
|
|
273
295
|
return result;
|
|
274
296
|
} catch (error) {
|
|
275
297
|
this._eventBus.fire('error', {
|
|
@@ -746,31 +768,53 @@ function buildExpressionContext(context) {
|
|
|
746
768
|
/**
|
|
747
769
|
* If the value is a valid expression, it is evaluated and returned. Otherwise, it is returned as-is.
|
|
748
770
|
*
|
|
749
|
-
* @param {
|
|
771
|
+
* @param {import('../types').ExpressionLanguage} expressionLanguage - The expression language to use.
|
|
750
772
|
* @param {any} value - The static value or expression to evaluate.
|
|
751
773
|
* @param {Object} expressionContextInfo - The context information to use.
|
|
752
774
|
* @returns {any} - Evaluated value or the original value if not an expression.
|
|
753
775
|
*/
|
|
754
776
|
function runExpressionEvaluation(expressionLanguage, value, expressionContextInfo) {
|
|
755
|
-
if (expressionLanguage
|
|
777
|
+
if (expressionLanguage.isExpression(value)) {
|
|
756
778
|
return expressionLanguage.evaluate(value, buildExpressionContext(expressionContextInfo));
|
|
757
779
|
}
|
|
758
780
|
return value;
|
|
759
781
|
}
|
|
760
782
|
|
|
761
783
|
/**
|
|
762
|
-
* Evaluate
|
|
784
|
+
* Evaluate a value as a unary test expression. Returns null for invalid/missing expressions or
|
|
785
|
+
* if the expression language is not available.
|
|
786
|
+
*
|
|
787
|
+
* @param {import('../types').ExpressionLanguage} expressionLanguage - The expression language to use.
|
|
788
|
+
* @param {string} value - The unary test expression to evaluate.
|
|
789
|
+
* @param {Object} expressionContextInfo - The context information to use.
|
|
790
|
+
* @returns {boolean | null} - Evaluated result, or null if expression is invalid/missing.
|
|
791
|
+
*/
|
|
792
|
+
function runUnaryTestEvaluation(expressionLanguage, value, expressionContextInfo) {
|
|
793
|
+
return expressionLanguage.evaluateUnaryTest(value, buildExpressionContext(expressionContextInfo));
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Evaluate a unary test expression reactively. Returns null for invalid/missing expressions.
|
|
798
|
+
* The function is memoized to minimize re-renders.
|
|
799
|
+
*
|
|
800
|
+
* @param {string | undefined} value - A unary test expression to evaluate.
|
|
801
|
+
* @returns {boolean | null} - Evaluated result, or null if expression is invalid/missing.
|
|
802
|
+
*/
|
|
803
|
+
function useUnaryTestEvaluation(value) {
|
|
804
|
+
const expressionLanguage = useService('expressionLanguage');
|
|
805
|
+
const expressionContextInfo = useContext(LocalExpressionContext);
|
|
806
|
+
return useMemo(() => runUnaryTestEvaluation(expressionLanguage, value, expressionContextInfo), [expressionLanguage, expressionContextInfo, value]);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Evaluate if condition is met reactively based on the expression language and form data.
|
|
763
811
|
*
|
|
764
812
|
* @param {string | undefined} condition
|
|
765
813
|
*
|
|
766
|
-
* @returns {boolean} true if condition is met
|
|
814
|
+
* @returns {boolean | null} true if condition is met, false if not, null if no condition or expression language
|
|
767
815
|
*/
|
|
768
816
|
function useCondition(condition) {
|
|
769
|
-
|
|
770
|
-
const expressionContextInfo = useContext(LocalExpressionContext);
|
|
771
|
-
return useMemo(() => {
|
|
772
|
-
return conditionChecker ? conditionChecker.check(condition, buildExpressionContext(expressionContextInfo)) : null;
|
|
773
|
-
}, [conditionChecker, condition, expressionContextInfo]);
|
|
817
|
+
return useUnaryTestEvaluation(condition);
|
|
774
818
|
}
|
|
775
819
|
|
|
776
820
|
/**
|
|
@@ -1258,16 +1302,16 @@ function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
|
1258
1302
|
*/
|
|
1259
1303
|
function useReadonly(formField, properties = {}) {
|
|
1260
1304
|
const expressionLanguage = useService('expressionLanguage');
|
|
1261
|
-
const conditionChecker = useService('conditionChecker', false);
|
|
1262
|
-
const expressionContextInfo = useContext(LocalExpressionContext);
|
|
1263
1305
|
const {
|
|
1264
1306
|
readonly
|
|
1265
1307
|
} = formField;
|
|
1308
|
+
const isExpression = expressionLanguage && expressionLanguage.isExpression(readonly);
|
|
1309
|
+
const evaluatedReadonly = useUnaryTestEvaluation(isExpression ? readonly : undefined);
|
|
1266
1310
|
if (properties.readOnly) {
|
|
1267
1311
|
return true;
|
|
1268
1312
|
}
|
|
1269
|
-
if (
|
|
1270
|
-
return
|
|
1313
|
+
if (isExpression) {
|
|
1314
|
+
return evaluatedReadonly === true;
|
|
1271
1315
|
}
|
|
1272
1316
|
return readonly || false;
|
|
1273
1317
|
}
|
|
@@ -2496,6 +2540,9 @@ function Datepicker(props) {
|
|
|
2496
2540
|
// flatpicker logic that was lost when setting allowInput to true
|
|
2497
2541
|
instance.config.onOpen = [() => instance.calendarContainer.addEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.addEventListener('mousedown', onCalendarMouseDown)];
|
|
2498
2542
|
instance.config.onClose = [() => instance.calendarContainer.removeEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.removeEventListener('mousedown', onCalendarMouseDown)];
|
|
2543
|
+
return () => {
|
|
2544
|
+
instance.destroy();
|
|
2545
|
+
};
|
|
2499
2546
|
}, [disallowPassedDates]);
|
|
2500
2547
|
|
|
2501
2548
|
// onChange is updated dynamically, so not to re-render the flatpicker every time it changes
|
|
@@ -5929,7 +5976,8 @@ const type = 'documentPreview';
|
|
|
5929
5976
|
|
|
5930
5977
|
/**
|
|
5931
5978
|
* @typedef DocumentEndpointBuilder
|
|
5932
|
-
* @property {(document: DocumentMetadata) => string} buildUrl
|
|
5979
|
+
* @property {(document: DocumentMetadata) => string} [buildUrl]
|
|
5980
|
+
* @property {(document: DocumentMetadata) => RequestInit|undefined} [buildRequestInit]
|
|
5933
5981
|
*/
|
|
5934
5982
|
|
|
5935
5983
|
/**
|
|
@@ -5980,13 +6028,18 @@ function DocumentPreview(props) {
|
|
|
5980
6028
|
class: `fjs-${type}-document-container`,
|
|
5981
6029
|
id: domId,
|
|
5982
6030
|
children: data.map((document, index) => {
|
|
5983
|
-
const finalEndpoint = tryCatch(() => documentEndpointBuilder?.buildUrl(document)) ?? document.endpoint;
|
|
5984
|
-
|
|
6031
|
+
const finalEndpoint = tryCatch(() => documentEndpointBuilder?.buildUrl?.(document)) ?? document.endpoint;
|
|
6032
|
+
if (!isValidDocumentEndpoint(finalEndpoint)) {
|
|
6033
|
+
return null;
|
|
6034
|
+
}
|
|
6035
|
+
const requestInit = getDocumentRequestInit(documentEndpointBuilder, document);
|
|
6036
|
+
return jsx(DocumentRenderer, {
|
|
5985
6037
|
documentMetadata: document,
|
|
5986
6038
|
endpoint: finalEndpoint,
|
|
6039
|
+
requestInit: requestInit,
|
|
5987
6040
|
maxHeight: maxHeight,
|
|
5988
6041
|
domId: `${domId}-${index}`
|
|
5989
|
-
}, document.documentId)
|
|
6042
|
+
}, document.documentId);
|
|
5990
6043
|
})
|
|
5991
6044
|
}), jsx(Errors, {
|
|
5992
6045
|
id: errorMessageId,
|
|
@@ -6062,13 +6115,15 @@ function useValidDocumentData(dataSource) {
|
|
|
6062
6115
|
* @param {string} props.fileName
|
|
6063
6116
|
* @param {Function} props.onError
|
|
6064
6117
|
* @param {string} props.errorMessageId
|
|
6118
|
+
* @param {RequestInit|undefined} props.requestInit
|
|
6065
6119
|
* @returns {import("preact").JSX.Element}
|
|
6066
6120
|
*/
|
|
6067
6121
|
function PdfRenderer(props) {
|
|
6068
6122
|
const {
|
|
6069
6123
|
url,
|
|
6070
6124
|
onError,
|
|
6071
|
-
errorMessageId
|
|
6125
|
+
errorMessageId,
|
|
6126
|
+
requestInit
|
|
6072
6127
|
} = props;
|
|
6073
6128
|
/** @type {ReturnType<typeof import("preact/hooks").useState<null | string>>} */
|
|
6074
6129
|
const [pdfObjectUrl, setPdfObjectUrl] = useState(null);
|
|
@@ -6078,7 +6133,7 @@ function PdfRenderer(props) {
|
|
|
6078
6133
|
let objectUrl = null;
|
|
6079
6134
|
const fetchPdf = async () => {
|
|
6080
6135
|
try {
|
|
6081
|
-
const response = await fetch(url);
|
|
6136
|
+
const response = await fetch(url, requestInit);
|
|
6082
6137
|
if (!response.ok) {
|
|
6083
6138
|
setHasError(true);
|
|
6084
6139
|
onError();
|
|
@@ -6098,7 +6153,7 @@ function PdfRenderer(props) {
|
|
|
6098
6153
|
URL.revokeObjectURL(objectUrl);
|
|
6099
6154
|
}
|
|
6100
6155
|
};
|
|
6101
|
-
}, [url, onError]);
|
|
6156
|
+
}, [url, onError, requestInit]);
|
|
6102
6157
|
return jsxs(Fragment, {
|
|
6103
6158
|
children: [pdfObjectUrl !== null ? jsx("embed", {
|
|
6104
6159
|
src: pdfObjectUrl,
|
|
@@ -6111,12 +6166,61 @@ function PdfRenderer(props) {
|
|
|
6111
6166
|
});
|
|
6112
6167
|
}
|
|
6113
6168
|
|
|
6169
|
+
/**
|
|
6170
|
+
* @param {Object} props
|
|
6171
|
+
* @param {string} props.url
|
|
6172
|
+
* @param {string} props.alt
|
|
6173
|
+
* @param {Function} props.onError
|
|
6174
|
+
* @param {RequestInit|undefined} props.requestInit
|
|
6175
|
+
* @returns {import("preact").JSX.Element}
|
|
6176
|
+
*/
|
|
6177
|
+
function ImageRenderer(props) {
|
|
6178
|
+
const {
|
|
6179
|
+
url,
|
|
6180
|
+
alt,
|
|
6181
|
+
onError,
|
|
6182
|
+
requestInit
|
|
6183
|
+
} = props;
|
|
6184
|
+
/** @type {ReturnType<typeof import("preact/hooks").useState<null | string>>} */
|
|
6185
|
+
const [imageObjectUrl, setImageObjectUrl] = useState(null);
|
|
6186
|
+
useEffect(() => {
|
|
6187
|
+
/** @type {null | string} */
|
|
6188
|
+
let objectUrl = null;
|
|
6189
|
+
const fetchImage = async () => {
|
|
6190
|
+
try {
|
|
6191
|
+
const response = await fetch(url, requestInit);
|
|
6192
|
+
if (!response.ok) {
|
|
6193
|
+
onError();
|
|
6194
|
+
return;
|
|
6195
|
+
}
|
|
6196
|
+
const blob = await response.blob();
|
|
6197
|
+
objectUrl = URL.createObjectURL(blob);
|
|
6198
|
+
setImageObjectUrl(objectUrl);
|
|
6199
|
+
} catch {
|
|
6200
|
+
onError();
|
|
6201
|
+
}
|
|
6202
|
+
};
|
|
6203
|
+
fetchImage();
|
|
6204
|
+
return () => {
|
|
6205
|
+
if (objectUrl) {
|
|
6206
|
+
URL.revokeObjectURL(objectUrl);
|
|
6207
|
+
}
|
|
6208
|
+
};
|
|
6209
|
+
}, [url, onError, requestInit]);
|
|
6210
|
+
return imageObjectUrl !== null ? jsx("img", {
|
|
6211
|
+
src: imageObjectUrl,
|
|
6212
|
+
alt: alt,
|
|
6213
|
+
class: `fjs-${type}-image`
|
|
6214
|
+
}) : null;
|
|
6215
|
+
}
|
|
6216
|
+
|
|
6114
6217
|
/**
|
|
6115
6218
|
*
|
|
6116
6219
|
* @param {Object} props
|
|
6117
6220
|
* @param {DocumentMetadata} props.documentMetadata
|
|
6118
6221
|
* @param {string} props.endpoint
|
|
6119
6222
|
* @param {string} props.domId
|
|
6223
|
+
* @param {RequestInit|undefined} props.requestInit
|
|
6120
6224
|
* @param {number|undefined} props.maxHeight
|
|
6121
6225
|
*
|
|
6122
6226
|
* @returns {import("preact").JSX.Element}
|
|
@@ -6126,7 +6230,8 @@ function DocumentRenderer(props) {
|
|
|
6126
6230
|
documentMetadata,
|
|
6127
6231
|
endpoint,
|
|
6128
6232
|
maxHeight,
|
|
6129
|
-
domId
|
|
6233
|
+
domId,
|
|
6234
|
+
requestInit
|
|
6130
6235
|
} = props;
|
|
6131
6236
|
const {
|
|
6132
6237
|
metadata
|
|
@@ -6145,13 +6250,15 @@ function DocumentRenderer(props) {
|
|
|
6145
6250
|
maxHeight
|
|
6146
6251
|
},
|
|
6147
6252
|
"aria-describedby": hasError ? errorMessageId : undefined,
|
|
6148
|
-
children: [jsx(
|
|
6149
|
-
|
|
6253
|
+
children: [jsx(ImageRenderer, {
|
|
6254
|
+
url: endpoint,
|
|
6150
6255
|
alt: metadata.fileName,
|
|
6151
|
-
|
|
6256
|
+
requestInit: requestInit,
|
|
6257
|
+
onError: () => setHasError(true)
|
|
6152
6258
|
}), jsx(DownloadButton, {
|
|
6153
6259
|
endpoint: endpoint,
|
|
6154
6260
|
fileName: metadata.fileName,
|
|
6261
|
+
requestInit: requestInit,
|
|
6155
6262
|
onDownloadError: () => {
|
|
6156
6263
|
setHasError(true);
|
|
6157
6264
|
}
|
|
@@ -6171,6 +6278,7 @@ function DocumentRenderer(props) {
|
|
|
6171
6278
|
children: jsx(PdfRenderer, {
|
|
6172
6279
|
url: endpoint,
|
|
6173
6280
|
fileName: metadata.fileName,
|
|
6281
|
+
requestInit: requestInit,
|
|
6174
6282
|
onError: () => setHasError(true),
|
|
6175
6283
|
errorMessageId: errorMessageId
|
|
6176
6284
|
})
|
|
@@ -6191,6 +6299,7 @@ function DocumentRenderer(props) {
|
|
|
6191
6299
|
}), jsx(DownloadButton, {
|
|
6192
6300
|
endpoint: endpoint,
|
|
6193
6301
|
fileName: metadata.fileName,
|
|
6302
|
+
requestInit: requestInit,
|
|
6194
6303
|
onDownloadError: () => {
|
|
6195
6304
|
setHasError(true);
|
|
6196
6305
|
}
|
|
@@ -6203,6 +6312,7 @@ function DocumentRenderer(props) {
|
|
|
6203
6312
|
* @param {string} props.endpoint
|
|
6204
6313
|
* @param {string} props.fileName
|
|
6205
6314
|
* @param {Function} props.onDownloadError
|
|
6315
|
+
* @param {RequestInit|undefined} props.requestInit
|
|
6206
6316
|
*
|
|
6207
6317
|
* @returns {import("preact").JSX.Element}
|
|
6208
6318
|
*/
|
|
@@ -6210,11 +6320,12 @@ function DownloadButton(props) {
|
|
|
6210
6320
|
const {
|
|
6211
6321
|
endpoint,
|
|
6212
6322
|
fileName,
|
|
6213
|
-
onDownloadError
|
|
6323
|
+
onDownloadError,
|
|
6324
|
+
requestInit
|
|
6214
6325
|
} = props;
|
|
6215
6326
|
const handleDownload = async () => {
|
|
6216
6327
|
try {
|
|
6217
|
-
const response = await fetch(endpoint);
|
|
6328
|
+
const response = await fetch(endpoint, requestInit);
|
|
6218
6329
|
if (!response.ok) {
|
|
6219
6330
|
onDownloadError();
|
|
6220
6331
|
return;
|
|
@@ -6268,6 +6379,16 @@ function useInViewport(ref) {
|
|
|
6268
6379
|
return isInViewport;
|
|
6269
6380
|
}
|
|
6270
6381
|
|
|
6382
|
+
/**
|
|
6383
|
+
* @param {DocumentEndpointBuilder | null} documentEndpointBuilder
|
|
6384
|
+
* @param {DocumentMetadata} document
|
|
6385
|
+
* @returns {RequestInit|undefined}
|
|
6386
|
+
*/
|
|
6387
|
+
function getDocumentRequestInit(documentEndpointBuilder, document) {
|
|
6388
|
+
const requestInit = tryCatch(() => documentEndpointBuilder?.buildRequestInit?.(document));
|
|
6389
|
+
return requestInit !== null && typeof requestInit === 'object' ? requestInit : undefined;
|
|
6390
|
+
}
|
|
6391
|
+
|
|
6271
6392
|
/**
|
|
6272
6393
|
* @template T
|
|
6273
6394
|
* @param {() => T} fn - Function to execute
|
|
@@ -6444,6 +6565,8 @@ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suff
|
|
|
6444
6565
|
|
|
6445
6566
|
/**
|
|
6446
6567
|
* @typedef { import('../types').Schema } Schema
|
|
6568
|
+
* @typedef { import('../types').ExpressionLanguage } ExpressionLanguage
|
|
6569
|
+
* @typedef { import('../types').Templating } Templating
|
|
6447
6570
|
*/
|
|
6448
6571
|
|
|
6449
6572
|
/**
|
|
@@ -6466,8 +6589,8 @@ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suff
|
|
|
6466
6589
|
*
|
|
6467
6590
|
* @param {Schema} schema
|
|
6468
6591
|
* @param {object} [options]
|
|
6469
|
-
* @param {
|
|
6470
|
-
* @param {
|
|
6592
|
+
* @param {ExpressionLanguage} [options.expressionLanguage]
|
|
6593
|
+
* @param {Templating} [options.templating]
|
|
6471
6594
|
* @param {any} [options.formFields]
|
|
6472
6595
|
* @param {boolean} [options.inputs=true]
|
|
6473
6596
|
* @param {boolean} [options.outputs=true]
|
|
@@ -6566,15 +6689,26 @@ const getAncestryList = (formFieldId, formFieldRegistry) => {
|
|
|
6566
6689
|
return ids;
|
|
6567
6690
|
};
|
|
6568
6691
|
|
|
6692
|
+
/**
|
|
6693
|
+
* @typedef { import('../../types').ExpressionLanguage } ExpressionLanguage
|
|
6694
|
+
*/
|
|
6695
|
+
|
|
6569
6696
|
/**
|
|
6570
6697
|
* @typedef {object} Condition
|
|
6571
6698
|
* @property {string} [hide]
|
|
6572
6699
|
*/
|
|
6573
6700
|
|
|
6574
6701
|
class ConditionChecker {
|
|
6575
|
-
|
|
6702
|
+
/**
|
|
6703
|
+
* @param {Object} formFieldRegistry
|
|
6704
|
+
* @param {Object} pathRegistry
|
|
6705
|
+
* @param {ExpressionLanguage} expressionLanguage
|
|
6706
|
+
* @param {Object} eventBus
|
|
6707
|
+
*/
|
|
6708
|
+
constructor(formFieldRegistry, pathRegistry, expressionLanguage, eventBus) {
|
|
6576
6709
|
this._formFieldRegistry = formFieldRegistry;
|
|
6577
6710
|
this._pathRegistry = pathRegistry;
|
|
6711
|
+
this._expressionLanguage = expressionLanguage;
|
|
6578
6712
|
this._eventBus = eventBus;
|
|
6579
6713
|
}
|
|
6580
6714
|
|
|
@@ -6697,24 +6831,7 @@ class ConditionChecker {
|
|
|
6697
6831
|
* @returns {boolean|null}
|
|
6698
6832
|
*/
|
|
6699
6833
|
check(condition, data = {}) {
|
|
6700
|
-
|
|
6701
|
-
return null;
|
|
6702
|
-
}
|
|
6703
|
-
if (!isString(condition) || !condition.startsWith('=')) {
|
|
6704
|
-
return null;
|
|
6705
|
-
}
|
|
6706
|
-
try {
|
|
6707
|
-
// cut off initial '='
|
|
6708
|
-
const {
|
|
6709
|
-
value: result
|
|
6710
|
-
} = unaryTest(condition.slice(1), data);
|
|
6711
|
-
return result;
|
|
6712
|
-
} catch (error) {
|
|
6713
|
-
this._eventBus.fire('error', {
|
|
6714
|
-
error
|
|
6715
|
-
});
|
|
6716
|
-
return null;
|
|
6717
|
-
}
|
|
6834
|
+
return this._expressionLanguage.evaluateUnaryTest(condition, data);
|
|
6718
6835
|
}
|
|
6719
6836
|
|
|
6720
6837
|
/**
|
|
@@ -6748,7 +6865,7 @@ class ConditionChecker {
|
|
|
6748
6865
|
return Array.isArray(parentObject) && (!parentObject.length || parentObject.every(item => item === undefined));
|
|
6749
6866
|
}
|
|
6750
6867
|
}
|
|
6751
|
-
ConditionChecker.$inject = ['formFieldRegistry', 'pathRegistry', 'eventBus'];
|
|
6868
|
+
ConditionChecker.$inject = ['formFieldRegistry', 'pathRegistry', 'expressionLanguage', 'eventBus'];
|
|
6752
6869
|
|
|
6753
6870
|
const ExpressionLanguageModule = {
|
|
6754
6871
|
__init__: ['expressionLanguage', 'templating', 'conditionChecker'],
|
|
@@ -8258,6 +8375,10 @@ function invokeFunction(fn, args) {
|
|
|
8258
8375
|
return fn.apply(null, args);
|
|
8259
8376
|
}
|
|
8260
8377
|
|
|
8378
|
+
/**
|
|
8379
|
+
* @typedef { import('../types').ExpressionLanguage } ExpressionLanguage
|
|
8380
|
+
*/
|
|
8381
|
+
|
|
8261
8382
|
const EMAIL_PATTERN = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
8262
8383
|
const PHONE_PATTERN = /(\+|00)(297|93|244|1264|358|355|376|971|54|374|1684|1268|61|43|994|257|32|229|226|880|359|973|1242|387|590|375|501|1441|591|55|1246|673|975|267|236|1|61|41|56|86|225|237|243|242|682|57|269|238|506|53|5999|61|1345|357|420|49|253|1767|45|1809|1829|1849|213|593|20|291|212|34|372|251|358|679|500|33|298|691|241|44|995|44|233|350|224|590|220|245|240|30|1473|299|502|594|1671|592|852|504|385|509|36|62|44|91|246|353|98|964|354|972|39|1876|44|962|81|76|77|254|996|855|686|1869|82|383|965|856|961|231|218|1758|423|94|266|370|352|371|853|590|212|377|373|261|960|52|692|389|223|356|95|382|976|1670|258|222|1664|596|230|265|60|262|264|687|227|672|234|505|683|31|47|977|674|64|968|92|507|64|51|63|680|675|48|1787|1939|850|351|595|970|689|974|262|40|7|250|966|249|221|65|500|4779|677|232|503|378|252|508|381|211|239|597|421|386|46|268|1721|248|963|1649|235|228|66|992|690|993|670|676|1868|216|90|688|886|255|256|380|598|1|998|3906698|379|1784|58|1284|1340|84|678|681|685|967|27|260|263)(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{4,20}$/;
|
|
8263
8384
|
const VALIDATE_FEEL_PROPERTIES = ['min', 'max', 'minLength', 'maxLength'];
|
|
@@ -8386,6 +8507,12 @@ function runPresetValidation(field, validation, value) {
|
|
|
8386
8507
|
}
|
|
8387
8508
|
return errors;
|
|
8388
8509
|
}
|
|
8510
|
+
|
|
8511
|
+
/**
|
|
8512
|
+
* @param {Object} validate
|
|
8513
|
+
* @param {ExpressionLanguage} expressionLanguage
|
|
8514
|
+
* @param {Object} expressionContextInfo
|
|
8515
|
+
*/
|
|
8389
8516
|
function evaluateFEELValues(validate, expressionLanguage, expressionContextInfo) {
|
|
8390
8517
|
const evaluatedValidate = {
|
|
8391
8518
|
...validate
|
|
@@ -8398,6 +8525,13 @@ function evaluateFEELValues(validate, expressionLanguage, expressionContextInfo)
|
|
|
8398
8525
|
});
|
|
8399
8526
|
return evaluatedValidate;
|
|
8400
8527
|
}
|
|
8528
|
+
|
|
8529
|
+
/**
|
|
8530
|
+
* @param {Object} validate
|
|
8531
|
+
* @param {ExpressionLanguage} expressionLanguage
|
|
8532
|
+
* @param {Object} conditionChecker
|
|
8533
|
+
* @param {Object} form
|
|
8534
|
+
*/
|
|
8401
8535
|
function oldEvaluateFEELValues(validate, expressionLanguage, conditionChecker, form) {
|
|
8402
8536
|
const evaluatedValidate = {
|
|
8403
8537
|
...validate
|
|
@@ -9859,5 +9993,5 @@ function createForm(options) {
|
|
|
9859
9993
|
});
|
|
9860
9994
|
}
|
|
9861
9995
|
|
|
9862
|
-
export { ALLOW_ATTRIBUTE, Button, Checkbox, Checklist, ConditionChecker, DATETIME_SUBTYPES, DATETIME_SUBTYPES_LABELS, DATETIME_SUBTYPE_PATH, DATE_DISALLOW_PAST_PATH, DATE_LABEL_PATH, Datetime, Default, Description, DocumentPreview, DynamicList, Errors, ExpressionField, ExpressionFieldModule, ExpressionLanguageModule, ExpressionLoopPreventer, FeelExpressionLanguage, FeelersTemplating, FieldFactory, FilePicker, Form, FormComponent, FormContext, FormField, FormFieldRegistry, FormFields, FormLayouter, FormRenderContext, Group, Html, IFrame, Image, Importer, Label, LocalExpressionContext, MINUTES_IN_DAY, MarkdownRenderer, MarkdownRendererModule, Numberfield, OPTIONS_SOURCES, OPTIONS_SOURCES_DEFAULTS, OPTIONS_SOURCES_LABELS, OPTIONS_SOURCES_PATHS, OPTIONS_SOURCE_DEFAULT, PathRegistry, Radio, RenderModule, RepeatRenderManager, RepeatRenderModule, SANDBOX_ATTRIBUTE, SECURITY_ATTRIBUTES_DEFINITIONS, Select, Separator, Spacer, TEXT_VIEW_DEFAULT_TEXT, TIME_INTERVAL_PATH, TIME_LABEL_PATH, TIME_SERIALISINGFORMAT_LABELS, TIME_SERIALISING_FORMATS, TIME_SERIALISING_FORMAT_PATH, TIME_USE24H_PATH, Table, Taglist, Text, Textarea, Textfield, ViewerCommands, ViewerCommandsModule, buildExpressionContext, clone, createForm, createFormContainer, createInjector, escapeHTML, formFields, generateIdForType, generateIndexForType, getAncestryList, getOptionsSource, getSchemaVariables, getScrollContainer, hasEqualValue, iconsByType, isRequired, pathParse, pathsEqual, runExpressionEvaluation, runRecursively, sanitizeDateTimePickerValue, sanitizeHTML, sanitizeIFrameSource, sanitizeImageSource, sanitizeMultiSelectValue, sanitizeSingleSelectValue, schemaVersion, useExpressionEvaluation, useSingleLineTemplateEvaluation, useTemplateEvaluation, wrapCSSStyles, wrapObjectKeysWithUnderscores };
|
|
9996
|
+
export { ALLOW_ATTRIBUTE, Button, Checkbox, Checklist, ConditionChecker, DATETIME_SUBTYPES, DATETIME_SUBTYPES_LABELS, DATETIME_SUBTYPE_PATH, DATE_DISALLOW_PAST_PATH, DATE_LABEL_PATH, Datetime, Default, Description, DocumentPreview, DynamicList, Errors, ExpressionField, ExpressionFieldModule, ExpressionLanguageModule, ExpressionLoopPreventer, FeelExpressionLanguage, FeelersTemplating, FieldFactory, FilePicker, Form, FormComponent, FormContext, FormField, FormFieldRegistry, FormFields, FormLayouter, FormRenderContext, Group, Html, IFrame, Image, Importer, Label, LocalExpressionContext, MINUTES_IN_DAY, MarkdownRenderer, MarkdownRendererModule, Numberfield, OPTIONS_SOURCES, OPTIONS_SOURCES_DEFAULTS, OPTIONS_SOURCES_LABELS, OPTIONS_SOURCES_PATHS, OPTIONS_SOURCE_DEFAULT, PathRegistry, Radio, RenderModule, RepeatRenderManager, RepeatRenderModule, SANDBOX_ATTRIBUTE, SECURITY_ATTRIBUTES_DEFINITIONS, Select, Separator, Spacer, TEXT_VIEW_DEFAULT_TEXT, TIME_INTERVAL_PATH, TIME_LABEL_PATH, TIME_SERIALISINGFORMAT_LABELS, TIME_SERIALISING_FORMATS, TIME_SERIALISING_FORMAT_PATH, TIME_USE24H_PATH, Table, Taglist, Text, Textarea, Textfield, ViewerCommands, ViewerCommandsModule, buildExpressionContext, clone, createForm, createFormContainer, createInjector, escapeHTML, formFields, generateIdForType, generateIndexForType, getAncestryList, getOptionsSource, getSchemaVariables, getScrollContainer, hasEqualValue, iconsByType, isRequired, pathParse, pathsEqual, runExpressionEvaluation, runRecursively, runUnaryTestEvaluation, sanitizeDateTimePickerValue, sanitizeHTML, sanitizeIFrameSource, sanitizeImageSource, sanitizeMultiSelectValue, sanitizeSingleSelectValue, schemaVersion, useExpressionEvaluation, useSingleLineTemplateEvaluation, useTemplateEvaluation, wrapCSSStyles, wrapObjectKeysWithUnderscores };
|
|
9863
9997
|
//# sourceMappingURL=index.es.js.map
|