@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.cjs
CHANGED
|
@@ -376,7 +376,7 @@ class FeelersTemplating {
|
|
|
376
376
|
* @param {Object} options
|
|
377
377
|
* @param {boolean} [options.debug = false]
|
|
378
378
|
* @param {boolean} [options.strict = false]
|
|
379
|
-
* @param {
|
|
379
|
+
* @param {(error: Error) => string} [options.buildDebugString]
|
|
380
380
|
* @param {Function} [options.sanitizer]
|
|
381
381
|
*
|
|
382
382
|
* @returns
|
|
@@ -403,20 +403,19 @@ class FeelersTemplating {
|
|
|
403
403
|
*/
|
|
404
404
|
|
|
405
405
|
/**
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
406
|
+
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
407
|
+
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
408
|
+
* @name _extractExpressionsWithDepth
|
|
409
|
+
* @param {string} template - A feelers template string.
|
|
410
|
+
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
414
|
+
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
415
|
+
*/
|
|
416
416
|
_extractExpressionsWithDepth(template) {
|
|
417
417
|
// build simplified feelers syntax tree
|
|
418
|
-
const
|
|
419
|
-
const tree = feelers.buildSimpleTree(parseTree, template);
|
|
418
|
+
const tree = feelers.parseToSimpleTree(template);
|
|
420
419
|
return function _traverse(n, depth = 0) {
|
|
421
420
|
if (['Feel', 'FeelBlock'].includes(n.name)) {
|
|
422
421
|
return [{
|
|
@@ -3830,6 +3829,11 @@ function willKeyProduceValidNumber(key, previousValue, caretIndex, selectionWidt
|
|
|
3830
3829
|
function isNullEquivalentValue(value) {
|
|
3831
3830
|
return value === undefined || value === null || value === '';
|
|
3832
3831
|
}
|
|
3832
|
+
function serializeToInputString(value) {
|
|
3833
|
+
if (value === undefined || value === null) return '';
|
|
3834
|
+
if (typeof value !== 'string' && typeof value !== 'number') return '';
|
|
3835
|
+
return value.toString();
|
|
3836
|
+
}
|
|
3833
3837
|
|
|
3834
3838
|
const type$d = 'number';
|
|
3835
3839
|
function Numberfield(props) {
|
|
@@ -3913,7 +3917,7 @@ function Numberfield(props) {
|
|
|
3913
3917
|
const outerValueChanged = previousValue != value;
|
|
3914
3918
|
const outerValueEqualsCache = sanitize(value) === sanitize(cachedValue);
|
|
3915
3919
|
if (outerValueChanged && !outerValueEqualsCache) {
|
|
3916
|
-
setValue(value
|
|
3920
|
+
setValue(serializeToInputString(value));
|
|
3917
3921
|
}
|
|
3918
3922
|
|
|
3919
3923
|
// caches the value an increment/decrement operation will be based on
|