@servicetitan/form 21.7.0 → 21.7.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -44,6 +44,10 @@ function trimDecimalPlace(value, separator, formatNumber, precision) {
|
|
44
44
|
let fracPart = splitValue[1];
|
45
45
|
if (fracPart && fracPart.length > precision) {
|
46
46
|
fracPart = formatNumber(parseFloat(`0.${fracPart}`), precision);
|
47
|
+
// 0.9(9) will be rounded to 1.0
|
48
|
+
if (fracPart.startsWith('1.')) {
|
49
|
+
fracPart = `0.${splitValue[1].substring(0, precision)}`;
|
50
|
+
}
|
47
51
|
fracPart = fracPart.slice(2);
|
48
52
|
}
|
49
53
|
return `${intPart}.${fracPart}`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"process-value.js","sourceRoot":"","sources":["../../src/number-input/process-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAYjE,MAAM,UAAU,YAAY,CACxB,KAAa,EACb,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,EAA+B,EAC9E,eAA6B,mBAAmB;IAEhD,IAAI,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAE/C,sBAAsB;IACtB,IAAI,UAAU,KAAK,EAAE,IAAI,UAAU,KAAK,GAAG,EAAE;QACzC,IAAI,aAAa,GAAG,UAAgC,CAAC;QACrD,IAAI,aAAa,GAAG,UAAU,CAAC;QAC/B,IAAI,aAAa,KAAK,CAAC,EAAE;YACrB,IAAI,KAAK,CAAC,GAAG,IAAI,aAAa,GAAG,KAAK,CAAC,GAAG,EAAE;gBACxC,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC;gBAC1B,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;aACtE;iBAAM,IAAI,KAAK,CAAC,GAAG,IAAI,aAAa,GAAG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,qBAAqB,EAAE,UAAU,CAAC,OAAO,CAAC;QACnD,+BAA+B;SAC9B,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IAE1C,OAAO,YAAY,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@servicetitan/form",
|
3
|
-
"version": "21.7.
|
3
|
+
"version": "21.7.3",
|
4
4
|
"description": "",
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/form",
|
6
6
|
"repository": {
|
@@ -16,12 +16,12 @@
|
|
16
16
|
"src"
|
17
17
|
],
|
18
18
|
"devDependencies": {
|
19
|
-
"@servicetitan/confirm": "^21.7.
|
20
|
-
"@servicetitan/culture": "^21.7.
|
21
|
-
"@servicetitan/data-query": "^21.7.
|
22
|
-
"@servicetitan/design-system": "~11.
|
23
|
-
"@servicetitan/react-ioc": "^21.7.
|
24
|
-
"@servicetitan/tokens": "~11.
|
19
|
+
"@servicetitan/confirm": "^21.7.3",
|
20
|
+
"@servicetitan/culture": "^21.7.3",
|
21
|
+
"@servicetitan/data-query": "^21.7.3",
|
22
|
+
"@servicetitan/design-system": "~11.9.0",
|
23
|
+
"@servicetitan/react-ioc": "^21.7.3",
|
24
|
+
"@servicetitan/tokens": "~11.9.0",
|
25
25
|
"@types/debounce": "~1.2.1",
|
26
26
|
"@types/react": "~17.0.38",
|
27
27
|
"@types/react-input-mask": "~2.0.5",
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"accounting": "~0.4.1",
|
30
30
|
"formstate": "~2.0.0",
|
31
31
|
"mobx": "~6.6.0",
|
32
|
-
"mobx-react": "~7.5.
|
32
|
+
"mobx-react": "~7.5.1",
|
33
33
|
"moment": "~2.29.3",
|
34
34
|
"react": "~17.0.2",
|
35
35
|
"react-dom": "~17.0.2",
|
@@ -39,13 +39,13 @@
|
|
39
39
|
"@servicetitan/confirm": "^20.0.0",
|
40
40
|
"@servicetitan/culture": "^20.0.0",
|
41
41
|
"@servicetitan/data-query": "^20.0.0",
|
42
|
-
"@servicetitan/design-system": "~11.
|
42
|
+
"@servicetitan/design-system": "~11.9.0",
|
43
43
|
"@servicetitan/react-ioc": "^20.0.0",
|
44
|
-
"@servicetitan/tokens": "~11.
|
44
|
+
"@servicetitan/tokens": "~11.9.0",
|
45
45
|
"accounting": "~0.4.1",
|
46
46
|
"formstate": "~2.0.0",
|
47
47
|
"mobx": "~6.6.0",
|
48
|
-
"mobx-react": "~7.5.
|
48
|
+
"mobx-react": "~7.5.1",
|
49
49
|
"moment": "~2.29.3",
|
50
50
|
"react": "~17.0.2",
|
51
51
|
"react-dom": "~17.0.2",
|
@@ -66,5 +66,5 @@
|
|
66
66
|
"cli": {
|
67
67
|
"webpack": false
|
68
68
|
},
|
69
|
-
"gitHead": "
|
69
|
+
"gitHead": "84a4b3e0c3642680d8fc6e710f9736e99e19c3d7"
|
70
70
|
}
|
@@ -257,14 +257,34 @@ describe('processValue', () => {
|
|
257
257
|
numberValue: 2,
|
258
258
|
stringValue: '2',
|
259
259
|
});
|
260
|
+
expect(processValue('2.0', options)).toEqual({
|
261
|
+
numberValue: 2,
|
262
|
+
stringValue: '2.0',
|
263
|
+
});
|
260
264
|
expect(processValue('2.00', options)).toEqual({
|
261
265
|
numberValue: 2,
|
262
266
|
stringValue: '2.00',
|
263
267
|
});
|
268
|
+
expect(processValue('2.000', options)).toEqual({
|
269
|
+
numberValue: 2,
|
270
|
+
stringValue: '2.00',
|
271
|
+
});
|
264
272
|
expect(processValue('5.5', options)).toEqual({
|
265
273
|
numberValue: 5.5,
|
266
274
|
stringValue: '5.5',
|
267
275
|
});
|
276
|
+
expect(processValue('5.554', options)).toEqual({
|
277
|
+
numberValue: 5.55,
|
278
|
+
stringValue: '5.55',
|
279
|
+
});
|
280
|
+
expect(processValue('5.555', options)).toEqual({
|
281
|
+
numberValue: 5.56,
|
282
|
+
stringValue: '5.56',
|
283
|
+
});
|
284
|
+
expect(processValue('5.999', options)).toEqual({
|
285
|
+
numberValue: 5.99,
|
286
|
+
stringValue: '5.99',
|
287
|
+
});
|
268
288
|
expect(processValue('8.000', options)).toEqual({
|
269
289
|
numberValue: 8,
|
270
290
|
stringValue: '8.00',
|
@@ -70,6 +70,12 @@ function trimDecimalPlace(
|
|
70
70
|
let fracPart = splitValue[1];
|
71
71
|
if (fracPart && fracPart.length > precision) {
|
72
72
|
fracPart = formatNumber(parseFloat(`0.${fracPart}`), precision);
|
73
|
+
|
74
|
+
// 0.9(9) will be rounded to 1.0
|
75
|
+
if (fracPart.startsWith('1.')) {
|
76
|
+
fracPart = `0.${splitValue[1].substring(0, precision)}`;
|
77
|
+
}
|
78
|
+
|
73
79
|
fracPart = fracPart.slice(2);
|
74
80
|
}
|
75
81
|
return `${intPart}.${fracPart}`;
|