map: Properly apply param/@default for translation fallback
This was broken by the previous fix, because I had cast to a numeric value before invoking `set_defaults`, which needs the empty string retained so that it knows whether a default ought to be applied. This also ensures that `set_values` will always return a numeric value when that default is applied. DEV-10484main
parent
a49dd68cfd
commit
054ad9b4c4
11
RELEASES.md
11
RELEASES.md
|
@ -14,6 +14,17 @@ commits that introduce the changes. To make a new release, run
|
|||
`tools/mkrelease`, which will handle updating the heading for you.
|
||||
|
||||
|
||||
NEXT
|
||||
====
|
||||
This is a bugfix release that corrects applying param defaults via input
|
||||
maps.
|
||||
|
||||
Compiler
|
||||
--------
|
||||
- Input maps using translations that fall back to `param/@default` will now
|
||||
correctly apply that default.
|
||||
- This was broken in the previous release v19.0.1.
|
||||
|
||||
v19.0.1 (2022-03-03)
|
||||
====================
|
||||
This is a bugfix release.
|
||||
|
|
|
@ -2414,7 +2414,7 @@
|
|||
{
|
||||
// TODO: error
|
||||
if ( Array.isArray( input ) ) input = input[0];
|
||||
return ( input === '' || input === undefined ) ? value : +input||0;
|
||||
return ( input === '' || input === undefined ) ? +value : +input||0;
|
||||
}
|
||||
|
||||
// TODO: error for both
|
||||
|
@ -2423,14 +2423,14 @@
|
|||
|
||||
// TODO: this maintains old behavior, but maybe should be an error;
|
||||
// we cannot have empty index sets (see design/tpl).
|
||||
if (input.length === 0) input = [value];
|
||||
if (input.length === 0) input = [+value];
|
||||
|
||||
return input.map( function( x ) {
|
||||
return ( depth === 2 )
|
||||
? Array.isArray( x )
|
||||
? x.map( function(s) { return +s||0; } )
|
||||
: [ x ]
|
||||
: ( x === '' || x === undefined ) ? value : +x||0;
|
||||
: ( x === '' || x === undefined ) ? +value : +x||0;
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -796,7 +796,7 @@
|
|||
<call-template name="lvmc:gen-input-default">
|
||||
<with-param name="sym" select="$sym" />
|
||||
<with-param name="from-str">
|
||||
<text>+val[i]||0</text>
|
||||
<text>''+val[i]</text>
|
||||
</with-param>
|
||||
<!-- We have to reduce the nesting level by one because of
|
||||
our outer loop, but we do not want to go below 0, which
|
||||
|
|
Loading…
Reference in New Issue