@bpmn-io/form-js-viewer 1.21.3 → 1.23.1
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 +22 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +24 -20
- 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
|
|
@@ -4241,7 +4245,7 @@ function SearchableSelect(props) {
|
|
|
4241
4245
|
onChange: props.onChange
|
|
4242
4246
|
});
|
|
4243
4247
|
const getLabelCorrelation = useGetLabelCorrelation(options);
|
|
4244
|
-
const label = hooks.useMemo(() => value
|
|
4248
|
+
const label = hooks.useMemo(() => minDash.isDefined(value) ? getLabelCorrelation(value) : undefined, [value, getLabelCorrelation]);
|
|
4245
4249
|
|
|
4246
4250
|
// whenever we change the underlying value, set the label to it
|
|
4247
4251
|
hooks.useEffect(() => {
|
|
@@ -4259,7 +4263,7 @@ function SearchableSelect(props) {
|
|
|
4259
4263
|
const pickOption = hooks.useCallback(option => {
|
|
4260
4264
|
setFilter(option && option.label || '');
|
|
4261
4265
|
props.onChange({
|
|
4262
|
-
value: option
|
|
4266
|
+
value: option?.value ?? null
|
|
4263
4267
|
});
|
|
4264
4268
|
}, [props]);
|
|
4265
4269
|
const displayState = hooks.useMemo(() => {
|
|
@@ -4406,10 +4410,10 @@ function SimpleSelect(props) {
|
|
|
4406
4410
|
onChange: props.onChange
|
|
4407
4411
|
});
|
|
4408
4412
|
const getLabelCorrelation = useGetLabelCorrelation(options);
|
|
4409
|
-
const valueLabel = hooks.useMemo(() => value
|
|
4413
|
+
const valueLabel = hooks.useMemo(() => minDash.isDefined(value) ? getLabelCorrelation(value) : undefined, [value, getLabelCorrelation]);
|
|
4410
4414
|
const pickOption = hooks.useCallback(option => {
|
|
4411
4415
|
props.onChange({
|
|
4412
|
-
value: option
|
|
4416
|
+
value: option?.value ?? null
|
|
4413
4417
|
});
|
|
4414
4418
|
}, [props]);
|
|
4415
4419
|
const displayState = hooks.useMemo(() => {
|