Skip to content

Commit a80117f

Browse files
committed
Optional show negative numbers as positive and with a different label
1 parent 2cc4efc commit a80117f

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

src/BootstrapInputAddons/BootstrapInputAddons.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
<category>Behaviour</category>
5858
<description>Displays a numeric negative value as a positive value</description>
5959
</property>
60+
<property defaultValue="" key="negativeLabelCaption" required="false" type="string">
61+
<caption>Label caption for negative number</caption>
62+
<category>Behaviour</category>
63+
<description>Label caption for a negative number that is shown as positive</description>
64+
</property>
6065
<property key="visibilityAttribute" required="false" type="attribute">
6166
<caption>Visible</caption>
6267
<category>Appearance</category>

src/BootstrapInputAddons/widget/BootstrapInputAddons.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ define([
5959
editableAttribute: "",
6060
showLabel: "",
6161
labelCaption: "",
62+
negativeLabelCaption: "",
6263
showLeftAddon: "",
6364
leftAddonCaption: "",
6465
showRightAddon: "",
@@ -254,7 +255,13 @@ define([
254255
});
255256

256257
var expression = /({(.+?)})/g;
257-
var result = this.labelCaption.replace(expression, replaceFunction);
258+
259+
var label = this.labelCaption;
260+
if (this.showNegativeAsPositive){
261+
label = this.negativeLabelCaption;
262+
}
263+
264+
var result = label.replace(expression, replaceFunction);
258265

259266
return result;
260267
},

test/Test.mpr

51 KB
Binary file not shown.
69 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)