@servicetitan/form 21.6.0 → 21.7.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/date-range-picker/date-range-picker.d.ts +2 -2
- package/dist/date-range-picker/date-range-picker.d.ts.map +1 -1
- package/dist/file-uploader/file-uploader.d.ts +2 -2
- package/dist/file-uploader/file-uploader.d.ts.map +1 -1
- package/dist/form-validators.d.ts +2 -2
- package/dist/form-validators.d.ts.map +1 -1
- package/dist/number-input/process-value.js +4 -0
- package/dist/number-input/process-value.js.map +1 -1
- package/package.json +14 -14
- package/src/number-input/__tests__/process-value.test.ts +20 -0
- package/src/number-input/process-value.ts +6 -0
@@ -38,8 +38,8 @@ export declare class DateRangePicker extends Component<DateRangePickerProps> {
|
|
38
38
|
componentDidMount(): void;
|
39
39
|
componentWillUnmount(): void;
|
40
40
|
handleChange: (event: DateRangePickerChangeEvent) => void;
|
41
|
-
handleFromChange: (from?: Date
|
42
|
-
handleToChange: (to?: Date
|
41
|
+
handleFromChange: (from?: Date) => void;
|
42
|
+
handleToChange: (to?: Date) => void;
|
43
43
|
render(): JSX.Element;
|
44
44
|
formatDate(date?: Date, inputFormat?: string): string;
|
45
45
|
handleHiddenInputChange: (ev: SyntheticEvent<HTMLInputElement>) => void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date-range-picker.d.ts","sourceRoot":"","sources":["../../src/date-range-picker/date-range-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAEH,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACb,MAAM,kCAAkC,CAAC;AAO1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAC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CAAC,EAAE,GAAG,CAAsB;IAChD,SAAS,UAAS;IACN,cAAc,UAAS;IACnC,aAAa,UAAS;IACtB,wBAAwB,UAAS;gBAErB,KAAK,EAAE,oBAAoB;IAMvC,SAAS,aAAc,cAAc,UAEnC;IAGF,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO;IAIzB,iBAAiB,QAAS,KAAK,UAqB7B;IAEF,0BAA0B,aAExB;IAEF,eAAe,aAUb;IAEF,iBAAiB;IAIjB,oBAAoB;IAIpB,YAAY,UAAW,0BAA0B,UAQ/C;IAEF,gBAAgB,UAAW,IAAI,UAQ7B;IAEF,cAAc,QAAS,IAAI,UAQzB;IAEF,MAAM;IA8HN,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,SAAM;IAIzC,uBAAuB,OAAQ,eAAe,gBAAgB,CAAC,UAG7D;IAEF,IAAI,WAAW,qBAad;IAED,IAAI,SAAS,qBAYZ;CACJ"}
|
@@ -27,8 +27,8 @@ export declare class FileUploader extends Component<FileUploaderProps> {
|
|
27
27
|
addError(file: File, message?: string): void;
|
28
28
|
clearErrors(): void;
|
29
29
|
handleUploadProgress: (file: File, progress: number) => void;
|
30
|
-
handleUploadSuccess: (file: File, message?: string
|
31
|
-
handleUploadError: (file: File, message?: string
|
30
|
+
handleUploadSuccess: (file: File, message?: string) => void;
|
31
|
+
handleUploadError: (file: File, message?: string) => void;
|
32
32
|
componentDidMount(): void;
|
33
33
|
componentWillUnmount(): void;
|
34
34
|
handleDownload: (file: FileDescriptor) => void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-uploader.d.ts","sourceRoot":"","sources":["../../src/file-uploader/file-uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,OAAO,CAAC;AAOhD,OAAO,EAAc,cAAc,EAAU,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGlG,OAAO,EAAE,kBAAkB,EAAqC,MAAM,UAAU,CAAC;AACjF,O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interface DateRangeFieldStates {
|
|
5
5
|
endDate: DatetimeFieldState;
|
6
6
|
}
|
7
7
|
export declare const FormValidators: {
|
8
|
-
required: (value?: FormValues
|
9
|
-
requiredWithCustomMessage: (errorMessage: string) => (value?: FormValues
|
8
|
+
required: (value?: FormValues) => string | false;
|
9
|
+
requiredWithCustomMessage: (errorMessage: string) => (value?: FormValues) => string | false;
|
10
10
|
hasLowerCase: (str: string) => boolean;
|
11
11
|
hasUpperCase: (str: string) => boolean;
|
12
12
|
hasNumber: (str: string) => boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"form-validators.d.ts","sourceRoot":"","sources":["../src/form-validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,UAAU,oBAAoB;IAC1B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,OAAO,EAAE,kBAAkB,CAAC;CAC/B;AAcD,eAAO,MAAM,cAAc
|
1
|
+
{"version":3,"file":"form-validators.d.ts","sourceRoot":"","sources":["../src/form-validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,UAAU,oBAAoB;IAC1B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,OAAO,EAAE,kBAAkB,CAAC;CAC/B;AAcD,eAAO,MAAM,cAAc;uBACJ,UAAU;8CAGa,MAAM,cAAc,UAAU;wBAGpD,MAAM;wBAEN,MAAM;qBAET,MAAM;sCAEW,MAAM;gCAMZ,MAAM;gDAQf,MAAM;;;wBAUL,IAAI,GAAG,IAAI;kCAID,oBAAoB;8DAQlC,SAAS,GAAG,SAAS;2DAKrB,SAAS,GAAG,SAAS;4CAOG,MAAM,WAAW,SAAS,GAAG,SAAS;0BAUxD,MAAM;8BAEF,MAAM,UAAU,MAAM,WAAW,MAAM;2BAG1C,MAAM,aAAa,MAAM,GAAG,GAAG,EAAE,GAAG,SAAS;2BAG7C,MAAM,aAAa,MAAM,GAAG,GAAG,EAAE,GAAG,SAAS;+BAGzC,MAAM,aAAa,MAAM,GAAG,GAAG,EAAE,GAAG,SAAS;CAE3E,CAAC"}
|
@@ -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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1C,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": "21.
|
3
|
+
"version": "21.7.2",
|
4
4
|
"description": "",
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/form",
|
6
6
|
"repository": {
|
@@ -16,20 +16,20 @@
|
|
16
16
|
"src"
|
17
17
|
],
|
18
18
|
"devDependencies": {
|
19
|
-
"@servicetitan/confirm": "^21.
|
20
|
-
"@servicetitan/culture": "^21.
|
21
|
-
"@servicetitan/data-query": "^21.
|
22
|
-
"@servicetitan/design-system": "~11.
|
23
|
-
"@servicetitan/react-ioc": "^21.
|
24
|
-
"@servicetitan/tokens": "~11.
|
19
|
+
"@servicetitan/confirm": "^21.7.2",
|
20
|
+
"@servicetitan/culture": "^21.7.2",
|
21
|
+
"@servicetitan/data-query": "^21.7.2",
|
22
|
+
"@servicetitan/design-system": "~11.9.0",
|
23
|
+
"@servicetitan/react-ioc": "^21.7.2",
|
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",
|
28
28
|
"@types/uuid": "~8.3.4",
|
29
29
|
"accounting": "~0.4.1",
|
30
30
|
"formstate": "~2.0.0",
|
31
|
-
"mobx": "~6.
|
32
|
-
"mobx-react": "~7.
|
31
|
+
"mobx": "~6.6.0",
|
32
|
+
"mobx-react": "~7.5.0",
|
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
|
-
"mobx": "~6.
|
48
|
-
"mobx-react": "~7.
|
47
|
+
"mobx": "~6.6.0",
|
48
|
+
"mobx-react": "~7.5.0",
|
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": "43641d5d1078ccb4b353c743c8e34666ba5a6ca5"
|
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}`;
|