@bpmn-io/form-js-viewer 1.21.3 → 1.23.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 +18 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +19 -15
- package/dist/index.es.js.map +1 -1
- package/dist/types/features/expressionLanguage/FeelersTemplating.d.ts +13 -13
- package/dist/types/render/components/util/numberFieldUtil.d.ts +1 -0
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createPortal } from 'preact/compat';
|
|
|
13
13
|
import DOMPurify from 'dompurify';
|
|
14
14
|
import { Injector } from 'didi';
|
|
15
15
|
import { parseExpression, parseUnaryTests, evaluate, unaryTest } from '@bpmn-io/feelin';
|
|
16
|
-
import { evaluate as evaluate$1,
|
|
16
|
+
import { evaluate as evaluate$1, parseToSimpleTree } from 'feelers';
|
|
17
17
|
import { marked } from 'marked';
|
|
18
18
|
|
|
19
19
|
const getFlavouredFeelVariableNames = (feelString, feelFlavour = 'expression', options = {}) => {
|
|
@@ -356,7 +356,7 @@ class FeelersTemplating {
|
|
|
356
356
|
* @param {Object} options
|
|
357
357
|
* @param {boolean} [options.debug = false]
|
|
358
358
|
* @param {boolean} [options.strict = false]
|
|
359
|
-
* @param {
|
|
359
|
+
* @param {(error: Error) => string} [options.buildDebugString]
|
|
360
360
|
* @param {Function} [options.sanitizer]
|
|
361
361
|
*
|
|
362
362
|
* @returns
|
|
@@ -383,20 +383,19 @@ class FeelersTemplating {
|
|
|
383
383
|
*/
|
|
384
384
|
|
|
385
385
|
/**
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
386
|
+
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
387
|
+
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
388
|
+
* @name _extractExpressionsWithDepth
|
|
389
|
+
* @param {string} template - A feelers template string.
|
|
390
|
+
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
394
|
+
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
395
|
+
*/
|
|
396
396
|
_extractExpressionsWithDepth(template) {
|
|
397
397
|
// build simplified feelers syntax tree
|
|
398
|
-
const
|
|
399
|
-
const tree = buildSimpleTree(parseTree, template);
|
|
398
|
+
const tree = parseToSimpleTree(template);
|
|
400
399
|
return function _traverse(n, depth = 0) {
|
|
401
400
|
if (['Feel', 'FeelBlock'].includes(n.name)) {
|
|
402
401
|
return [{
|
|
@@ -3810,6 +3809,11 @@ function willKeyProduceValidNumber(key, previousValue, caretIndex, selectionWidt
|
|
|
3810
3809
|
function isNullEquivalentValue(value) {
|
|
3811
3810
|
return value === undefined || value === null || value === '';
|
|
3812
3811
|
}
|
|
3812
|
+
function serializeToInputString(value) {
|
|
3813
|
+
if (value === undefined || value === null) return '';
|
|
3814
|
+
if (typeof value !== 'string' && typeof value !== 'number') return '';
|
|
3815
|
+
return value.toString();
|
|
3816
|
+
}
|
|
3813
3817
|
|
|
3814
3818
|
const type$d = 'number';
|
|
3815
3819
|
function Numberfield(props) {
|
|
@@ -3893,7 +3897,7 @@ function Numberfield(props) {
|
|
|
3893
3897
|
const outerValueChanged = previousValue != value;
|
|
3894
3898
|
const outerValueEqualsCache = sanitize(value) === sanitize(cachedValue);
|
|
3895
3899
|
if (outerValueChanged && !outerValueEqualsCache) {
|
|
3896
|
-
setValue(value
|
|
3900
|
+
setValue(serializeToInputString(value));
|
|
3897
3901
|
}
|
|
3898
3902
|
|
|
3899
3903
|
// caches the value an increment/decrement operation will be based on
|