@servicetitan/form 22.0.1 → 22.1.2
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
# v22.1.1 (Tue Jun 28 2022)
|
2
|
+
|
3
|
+
#### 🐛 Bug Fix
|
4
|
+
|
5
|
+
- FAR-823: Adding tsconfig references to fix build [#116](https://github.com/servicetitan/anvil-uikit-contrib/pull/116) ([@rgdelato](https://github.com/rgdelato))
|
6
|
+
|
7
|
+
#### Authors: 1
|
8
|
+
|
9
|
+
- Ryan De La Torre ([@rgdelato](https://github.com/rgdelato))
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
# v22.1.0 (Mon Jun 27 2022)
|
14
|
+
|
15
|
+
#### 🐛 Bug Fix
|
16
|
+
|
17
|
+
- OPT-3600: Sales factor is rounding to 1.0 after 1.9 when entering digits 5-9 (hot-fix) [#114](https://github.com/servicetitan/anvil-uikit-contrib/pull/114) ([@rgdelato](https://github.com/rgdelato))
|
18
|
+
|
19
|
+
#### Authors: 1
|
20
|
+
|
21
|
+
- Ryan De La Torre ([@rgdelato](https://github.com/rgdelato))
|
22
|
+
|
23
|
+
---
|
24
|
+
|
1
25
|
# v22.0.1 (Tue Jun 21 2022)
|
2
26
|
|
3
27
|
#### 🐛 Bug Fix
|
@@ -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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;KAC3C;IACD,OAAO,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,EAAS;IACpE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,UAAsB;IACrD,MAAM,uBAAuB,GAAG,IAAI,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,OAAO,EAAE,GAAG,CAAC,CAAC;IAChF,MAAM,qBAAqB,GAAG,IAAI,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC9E,MAAM,uBAAuB,GAAG,SAAS,CAAC;IAC1C,MAAM,YAAY,GAAG,KAAK;QACtB,4BAA4B;SAC3B,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;QAC1B,6BAA6B;SAC5B,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC;QACrC,sCAAsC;SACrC,OAAO,CAAC,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": "22.
|
3
|
+
"version": "22.1.2",
|
4
4
|
"description": "",
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/form",
|
6
6
|
"repository": {
|
@@ -16,9 +16,9 @@
|
|
16
16
|
"src"
|
17
17
|
],
|
18
18
|
"devDependencies": {
|
19
|
-
"@servicetitan/confirm": "^22.
|
20
|
-
"@servicetitan/culture": "^22.
|
21
|
-
"@servicetitan/data-query": "^22.
|
19
|
+
"@servicetitan/confirm": "^22.1.2",
|
20
|
+
"@servicetitan/culture": "^22.1.2",
|
21
|
+
"@servicetitan/data-query": "^22.1.2",
|
22
22
|
"@servicetitan/design-system": "~11.8.0",
|
23
23
|
"@servicetitan/react-ioc": "^21.6.0",
|
24
24
|
"@servicetitan/tokens": "~11.8.0",
|
@@ -36,9 +36,9 @@
|
|
36
36
|
"resumablejs": "~1.0.2"
|
37
37
|
},
|
38
38
|
"peerDependencies": {
|
39
|
-
"@servicetitan/confirm": "^22.
|
40
|
-
"@servicetitan/culture": "^22.
|
41
|
-
"@servicetitan/data-query": "^22.
|
39
|
+
"@servicetitan/confirm": "^22.1.2",
|
40
|
+
"@servicetitan/culture": "^22.1.2",
|
41
|
+
"@servicetitan/data-query": "^22.1.2",
|
42
42
|
"@servicetitan/design-system": "~11.8.0",
|
43
43
|
"@servicetitan/react-ioc": "^20.0.0",
|
44
44
|
"@servicetitan/tokens": "~11.8.0",
|
@@ -66,5 +66,5 @@
|
|
66
66
|
"cli": {
|
67
67
|
"webpack": false
|
68
68
|
},
|
69
|
-
"gitHead": "
|
69
|
+
"gitHead": "9f87b9bf91c403984f6f4d9bdc5c0cc20302bb57"
|
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}`;
|