@bpmn-io/form-js-viewer 1.20.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 +183 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +183 -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
|
+
return null;
|
|
265
|
+
}
|
|
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
|
+
});
|
|
264
275
|
return null;
|
|
265
276
|
}
|
|
266
|
-
|
|
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
|
}
|
|
@@ -5932,7 +5976,8 @@ const type = 'documentPreview';
|
|
|
5932
5976
|
|
|
5933
5977
|
/**
|
|
5934
5978
|
* @typedef DocumentEndpointBuilder
|
|
5935
|
-
* @property {(document: DocumentMetadata) => string} buildUrl
|
|
5979
|
+
* @property {(document: DocumentMetadata) => string} [buildUrl]
|
|
5980
|
+
* @property {(document: DocumentMetadata) => RequestInit|undefined} [buildRequestInit]
|
|
5936
5981
|
*/
|
|
5937
5982
|
|
|
5938
5983
|
/**
|
|
@@ -5983,13 +6028,18 @@ function DocumentPreview(props) {
|
|
|
5983
6028
|
class: `fjs-${type}-document-container`,
|
|
5984
6029
|
id: domId,
|
|
5985
6030
|
children: data.map((document, index) => {
|
|
5986
|
-
const finalEndpoint = tryCatch(() => documentEndpointBuilder?.buildUrl(document)) ?? document.endpoint;
|
|
5987
|
-
|
|
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, {
|
|
5988
6037
|
documentMetadata: document,
|
|
5989
6038
|
endpoint: finalEndpoint,
|
|
6039
|
+
requestInit: requestInit,
|
|
5990
6040
|
maxHeight: maxHeight,
|
|
5991
6041
|
domId: `${domId}-${index}`
|
|
5992
|
-
}, document.documentId)
|
|
6042
|
+
}, document.documentId);
|
|
5993
6043
|
})
|
|
5994
6044
|
}), jsx(Errors, {
|
|
5995
6045
|
id: errorMessageId,
|
|
@@ -6065,13 +6115,15 @@ function useValidDocumentData(dataSource) {
|
|
|
6065
6115
|
* @param {string} props.fileName
|
|
6066
6116
|
* @param {Function} props.onError
|
|
6067
6117
|
* @param {string} props.errorMessageId
|
|
6118
|
+
* @param {RequestInit|undefined} props.requestInit
|
|
6068
6119
|
* @returns {import("preact").JSX.Element}
|
|
6069
6120
|
*/
|
|
6070
6121
|
function PdfRenderer(props) {
|
|
6071
6122
|
const {
|
|
6072
6123
|
url,
|
|
6073
6124
|
onError,
|
|
6074
|
-
errorMessageId
|
|
6125
|
+
errorMessageId,
|
|
6126
|
+
requestInit
|
|
6075
6127
|
} = props;
|
|
6076
6128
|
/** @type {ReturnType<typeof import("preact/hooks").useState<null | string>>} */
|
|
6077
6129
|
const [pdfObjectUrl, setPdfObjectUrl] = useState(null);
|
|
@@ -6081,7 +6133,7 @@ function PdfRenderer(props) {
|
|
|
6081
6133
|
let objectUrl = null;
|
|
6082
6134
|
const fetchPdf = async () => {
|
|
6083
6135
|
try {
|
|
6084
|
-
const response = await fetch(url);
|
|
6136
|
+
const response = await fetch(url, requestInit);
|
|
6085
6137
|
if (!response.ok) {
|
|
6086
6138
|
setHasError(true);
|
|
6087
6139
|
onError();
|
|
@@ -6101,7 +6153,7 @@ function PdfRenderer(props) {
|
|
|
6101
6153
|
URL.revokeObjectURL(objectUrl);
|
|
6102
6154
|
}
|
|
6103
6155
|
};
|
|
6104
|
-
}, [url, onError]);
|
|
6156
|
+
}, [url, onError, requestInit]);
|
|
6105
6157
|
return jsxs(Fragment, {
|
|
6106
6158
|
children: [pdfObjectUrl !== null ? jsx("embed", {
|
|
6107
6159
|
src: pdfObjectUrl,
|
|
@@ -6114,12 +6166,61 @@ function PdfRenderer(props) {
|
|
|
6114
6166
|
});
|
|
6115
6167
|
}
|
|
6116
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
|
+
|
|
6117
6217
|
/**
|
|
6118
6218
|
*
|
|
6119
6219
|
* @param {Object} props
|
|
6120
6220
|
* @param {DocumentMetadata} props.documentMetadata
|
|
6121
6221
|
* @param {string} props.endpoint
|
|
6122
6222
|
* @param {string} props.domId
|
|
6223
|
+
* @param {RequestInit|undefined} props.requestInit
|
|
6123
6224
|
* @param {number|undefined} props.maxHeight
|
|
6124
6225
|
*
|
|
6125
6226
|
* @returns {import("preact").JSX.Element}
|
|
@@ -6129,7 +6230,8 @@ function DocumentRenderer(props) {
|
|
|
6129
6230
|
documentMetadata,
|
|
6130
6231
|
endpoint,
|
|
6131
6232
|
maxHeight,
|
|
6132
|
-
domId
|
|
6233
|
+
domId,
|
|
6234
|
+
requestInit
|
|
6133
6235
|
} = props;
|
|
6134
6236
|
const {
|
|
6135
6237
|
metadata
|
|
@@ -6148,13 +6250,15 @@ function DocumentRenderer(props) {
|
|
|
6148
6250
|
maxHeight
|
|
6149
6251
|
},
|
|
6150
6252
|
"aria-describedby": hasError ? errorMessageId : undefined,
|
|
6151
|
-
children: [jsx(
|
|
6152
|
-
|
|
6253
|
+
children: [jsx(ImageRenderer, {
|
|
6254
|
+
url: endpoint,
|
|
6153
6255
|
alt: metadata.fileName,
|
|
6154
|
-
|
|
6256
|
+
requestInit: requestInit,
|
|
6257
|
+
onError: () => setHasError(true)
|
|
6155
6258
|
}), jsx(DownloadButton, {
|
|
6156
6259
|
endpoint: endpoint,
|
|
6157
6260
|
fileName: metadata.fileName,
|
|
6261
|
+
requestInit: requestInit,
|
|
6158
6262
|
onDownloadError: () => {
|
|
6159
6263
|
setHasError(true);
|
|
6160
6264
|
}
|
|
@@ -6174,6 +6278,7 @@ function DocumentRenderer(props) {
|
|
|
6174
6278
|
children: jsx(PdfRenderer, {
|
|
6175
6279
|
url: endpoint,
|
|
6176
6280
|
fileName: metadata.fileName,
|
|
6281
|
+
requestInit: requestInit,
|
|
6177
6282
|
onError: () => setHasError(true),
|
|
6178
6283
|
errorMessageId: errorMessageId
|
|
6179
6284
|
})
|
|
@@ -6194,6 +6299,7 @@ function DocumentRenderer(props) {
|
|
|
6194
6299
|
}), jsx(DownloadButton, {
|
|
6195
6300
|
endpoint: endpoint,
|
|
6196
6301
|
fileName: metadata.fileName,
|
|
6302
|
+
requestInit: requestInit,
|
|
6197
6303
|
onDownloadError: () => {
|
|
6198
6304
|
setHasError(true);
|
|
6199
6305
|
}
|
|
@@ -6206,6 +6312,7 @@ function DocumentRenderer(props) {
|
|
|
6206
6312
|
* @param {string} props.endpoint
|
|
6207
6313
|
* @param {string} props.fileName
|
|
6208
6314
|
* @param {Function} props.onDownloadError
|
|
6315
|
+
* @param {RequestInit|undefined} props.requestInit
|
|
6209
6316
|
*
|
|
6210
6317
|
* @returns {import("preact").JSX.Element}
|
|
6211
6318
|
*/
|
|
@@ -6213,11 +6320,12 @@ function DownloadButton(props) {
|
|
|
6213
6320
|
const {
|
|
6214
6321
|
endpoint,
|
|
6215
6322
|
fileName,
|
|
6216
|
-
onDownloadError
|
|
6323
|
+
onDownloadError,
|
|
6324
|
+
requestInit
|
|
6217
6325
|
} = props;
|
|
6218
6326
|
const handleDownload = async () => {
|
|
6219
6327
|
try {
|
|
6220
|
-
const response = await fetch(endpoint);
|
|
6328
|
+
const response = await fetch(endpoint, requestInit);
|
|
6221
6329
|
if (!response.ok) {
|
|
6222
6330
|
onDownloadError();
|
|
6223
6331
|
return;
|
|
@@ -6271,6 +6379,16 @@ function useInViewport(ref) {
|
|
|
6271
6379
|
return isInViewport;
|
|
6272
6380
|
}
|
|
6273
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
|
+
|
|
6274
6392
|
/**
|
|
6275
6393
|
* @template T
|
|
6276
6394
|
* @param {() => T} fn - Function to execute
|
|
@@ -6447,6 +6565,8 @@ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suff
|
|
|
6447
6565
|
|
|
6448
6566
|
/**
|
|
6449
6567
|
* @typedef { import('../types').Schema } Schema
|
|
6568
|
+
* @typedef { import('../types').ExpressionLanguage } ExpressionLanguage
|
|
6569
|
+
* @typedef { import('../types').Templating } Templating
|
|
6450
6570
|
*/
|
|
6451
6571
|
|
|
6452
6572
|
/**
|
|
@@ -6469,8 +6589,8 @@ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suff
|
|
|
6469
6589
|
*
|
|
6470
6590
|
* @param {Schema} schema
|
|
6471
6591
|
* @param {object} [options]
|
|
6472
|
-
* @param {
|
|
6473
|
-
* @param {
|
|
6592
|
+
* @param {ExpressionLanguage} [options.expressionLanguage]
|
|
6593
|
+
* @param {Templating} [options.templating]
|
|
6474
6594
|
* @param {any} [options.formFields]
|
|
6475
6595
|
* @param {boolean} [options.inputs=true]
|
|
6476
6596
|
* @param {boolean} [options.outputs=true]
|
|
@@ -6569,15 +6689,26 @@ const getAncestryList = (formFieldId, formFieldRegistry) => {
|
|
|
6569
6689
|
return ids;
|
|
6570
6690
|
};
|
|
6571
6691
|
|
|
6692
|
+
/**
|
|
6693
|
+
* @typedef { import('../../types').ExpressionLanguage } ExpressionLanguage
|
|
6694
|
+
*/
|
|
6695
|
+
|
|
6572
6696
|
/**
|
|
6573
6697
|
* @typedef {object} Condition
|
|
6574
6698
|
* @property {string} [hide]
|
|
6575
6699
|
*/
|
|
6576
6700
|
|
|
6577
6701
|
class ConditionChecker {
|
|
6578
|
-
|
|
6702
|
+
/**
|
|
6703
|
+
* @param {Object} formFieldRegistry
|
|
6704
|
+
* @param {Object} pathRegistry
|
|
6705
|
+
* @param {ExpressionLanguage} expressionLanguage
|
|
6706
|
+
* @param {Object} eventBus
|
|
6707
|
+
*/
|
|
6708
|
+
constructor(formFieldRegistry, pathRegistry, expressionLanguage, eventBus) {
|
|
6579
6709
|
this._formFieldRegistry = formFieldRegistry;
|
|
6580
6710
|
this._pathRegistry = pathRegistry;
|
|
6711
|
+
this._expressionLanguage = expressionLanguage;
|
|
6581
6712
|
this._eventBus = eventBus;
|
|
6582
6713
|
}
|
|
6583
6714
|
|
|
@@ -6700,24 +6831,7 @@ class ConditionChecker {
|
|
|
6700
6831
|
* @returns {boolean|null}
|
|
6701
6832
|
*/
|
|
6702
6833
|
check(condition, data = {}) {
|
|
6703
|
-
|
|
6704
|
-
return null;
|
|
6705
|
-
}
|
|
6706
|
-
if (!isString(condition) || !condition.startsWith('=')) {
|
|
6707
|
-
return null;
|
|
6708
|
-
}
|
|
6709
|
-
try {
|
|
6710
|
-
// cut off initial '='
|
|
6711
|
-
const {
|
|
6712
|
-
value: result
|
|
6713
|
-
} = unaryTest(condition.slice(1), data);
|
|
6714
|
-
return result;
|
|
6715
|
-
} catch (error) {
|
|
6716
|
-
this._eventBus.fire('error', {
|
|
6717
|
-
error
|
|
6718
|
-
});
|
|
6719
|
-
return null;
|
|
6720
|
-
}
|
|
6834
|
+
return this._expressionLanguage.evaluateUnaryTest(condition, data);
|
|
6721
6835
|
}
|
|
6722
6836
|
|
|
6723
6837
|
/**
|
|
@@ -6751,7 +6865,7 @@ class ConditionChecker {
|
|
|
6751
6865
|
return Array.isArray(parentObject) && (!parentObject.length || parentObject.every(item => item === undefined));
|
|
6752
6866
|
}
|
|
6753
6867
|
}
|
|
6754
|
-
ConditionChecker.$inject = ['formFieldRegistry', 'pathRegistry', 'eventBus'];
|
|
6868
|
+
ConditionChecker.$inject = ['formFieldRegistry', 'pathRegistry', 'expressionLanguage', 'eventBus'];
|
|
6755
6869
|
|
|
6756
6870
|
const ExpressionLanguageModule = {
|
|
6757
6871
|
__init__: ['expressionLanguage', 'templating', 'conditionChecker'],
|
|
@@ -8261,6 +8375,10 @@ function invokeFunction(fn, args) {
|
|
|
8261
8375
|
return fn.apply(null, args);
|
|
8262
8376
|
}
|
|
8263
8377
|
|
|
8378
|
+
/**
|
|
8379
|
+
* @typedef { import('../types').ExpressionLanguage } ExpressionLanguage
|
|
8380
|
+
*/
|
|
8381
|
+
|
|
8264
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])?)*$/;
|
|
8265
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}$/;
|
|
8266
8384
|
const VALIDATE_FEEL_PROPERTIES = ['min', 'max', 'minLength', 'maxLength'];
|
|
@@ -8389,6 +8507,12 @@ function runPresetValidation(field, validation, value) {
|
|
|
8389
8507
|
}
|
|
8390
8508
|
return errors;
|
|
8391
8509
|
}
|
|
8510
|
+
|
|
8511
|
+
/**
|
|
8512
|
+
* @param {Object} validate
|
|
8513
|
+
* @param {ExpressionLanguage} expressionLanguage
|
|
8514
|
+
* @param {Object} expressionContextInfo
|
|
8515
|
+
*/
|
|
8392
8516
|
function evaluateFEELValues(validate, expressionLanguage, expressionContextInfo) {
|
|
8393
8517
|
const evaluatedValidate = {
|
|
8394
8518
|
...validate
|
|
@@ -8401,6 +8525,13 @@ function evaluateFEELValues(validate, expressionLanguage, expressionContextInfo)
|
|
|
8401
8525
|
});
|
|
8402
8526
|
return evaluatedValidate;
|
|
8403
8527
|
}
|
|
8528
|
+
|
|
8529
|
+
/**
|
|
8530
|
+
* @param {Object} validate
|
|
8531
|
+
* @param {ExpressionLanguage} expressionLanguage
|
|
8532
|
+
* @param {Object} conditionChecker
|
|
8533
|
+
* @param {Object} form
|
|
8534
|
+
*/
|
|
8404
8535
|
function oldEvaluateFEELValues(validate, expressionLanguage, conditionChecker, form) {
|
|
8405
8536
|
const evaluatedValidate = {
|
|
8406
8537
|
...validate
|
|
@@ -9862,5 +9993,5 @@ function createForm(options) {
|
|
|
9862
9993
|
});
|
|
9863
9994
|
}
|
|
9864
9995
|
|
|
9865
|
-
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 };
|
|
9866
9997
|
//# sourceMappingURL=index.es.js.map
|