@itwin/components-react 3.3.0-dev.6 → 3.3.0-dev.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/lib/cjs/components-react/common/DateUtils.d.ts +12 -2
  3. package/lib/cjs/components-react/common/DateUtils.d.ts.map +1 -1
  4. package/lib/cjs/components-react/common/DateUtils.js +14 -4
  5. package/lib/cjs/components-react/common/DateUtils.js.map +1 -1
  6. package/lib/cjs/components-react/common/SubscriptionScheduler.d.ts +6 -8
  7. package/lib/cjs/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
  8. package/lib/cjs/components-react/common/SubscriptionScheduler.js +18 -52
  9. package/lib/cjs/components-react/common/SubscriptionScheduler.js.map +1 -1
  10. package/lib/cjs/components-react/converters/NumericTypeConverter.d.ts +4 -2
  11. package/lib/cjs/components-react/converters/NumericTypeConverter.d.ts.map +1 -1
  12. package/lib/cjs/components-react/converters/NumericTypeConverter.js +14 -4
  13. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  14. package/lib/cjs/components-react/converters/TypeConverter.js +1 -1
  15. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  16. package/lib/cjs/components-react/editors/CustomNumberEditor.js +3 -3
  17. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  18. package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
  19. package/lib/cjs/components-react/tree/controlled/TreeHooks.js +5 -8
  20. package/lib/cjs/components-react/tree/controlled/TreeHooks.js.map +1 -1
  21. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts +8 -4
  22. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
  23. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +54 -45
  24. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  25. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +2 -0
  26. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  27. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -1
  28. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  29. package/lib/esm/components-react/common/DateUtils.d.ts +12 -2
  30. package/lib/esm/components-react/common/DateUtils.d.ts.map +1 -1
  31. package/lib/esm/components-react/common/DateUtils.js +12 -2
  32. package/lib/esm/components-react/common/DateUtils.js.map +1 -1
  33. package/lib/esm/components-react/common/SubscriptionScheduler.d.ts +6 -8
  34. package/lib/esm/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
  35. package/lib/esm/components-react/common/SubscriptionScheduler.js +18 -52
  36. package/lib/esm/components-react/common/SubscriptionScheduler.js.map +1 -1
  37. package/lib/esm/components-react/converters/NumericTypeConverter.d.ts +4 -2
  38. package/lib/esm/components-react/converters/NumericTypeConverter.d.ts.map +1 -1
  39. package/lib/esm/components-react/converters/NumericTypeConverter.js +14 -4
  40. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  41. package/lib/esm/components-react/converters/TypeConverter.js +1 -1
  42. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  43. package/lib/esm/components-react/editors/CustomNumberEditor.js +3 -3
  44. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  45. package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
  46. package/lib/esm/components-react/tree/controlled/TreeHooks.js +6 -9
  47. package/lib/esm/components-react/tree/controlled/TreeHooks.js.map +1 -1
  48. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts +8 -4
  49. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
  50. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +53 -44
  51. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  52. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +2 -0
  53. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  54. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -1
  55. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  56. package/package.json +16 -16
package/CHANGELOG.md CHANGED
@@ -1,6 +1,36 @@
1
1
  # Change Log - @itwin/components-react
2
2
 
3
- This log was last generated on Fri, 15 Apr 2022 13:49:25 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 21 Jun 2022 18:06:33 GMT and should not be manually modified.
4
+
5
+ ## 3.2.4
6
+ Tue, 21 Jun 2022 18:06:33 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.2.3
11
+ Fri, 17 Jun 2022 15:18:39 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 3.2.2
16
+ Fri, 10 Jun 2022 16:11:36 GMT
17
+
18
+ ### Updates
19
+
20
+ - Fix `useTreeModel` returning stale model for the given model source
21
+
22
+ ## 3.2.1
23
+ Tue, 07 Jun 2022 15:02:56 GMT
24
+
25
+ _Version update only_
26
+
27
+ ## 3.2.0
28
+ Fri, 20 May 2022 13:10:54 GMT
29
+
30
+ ### Updates
31
+
32
+ - Add ability to pass parameters to UiItemsManager when loading items provider to specify what stages allow the provider to supply items.
33
+ - Update UI to new UX design to allow only 2 sections of widgets per panel.
4
34
 
5
35
  ## 3.1.3
6
36
  Fri, 15 Apr 2022 13:49:25 GMT
@@ -1,6 +1,14 @@
1
1
  /** @packageDocumentation
2
2
  * @module Common
3
3
  */
4
+ /**
5
+ * Define formatting options for use when component are generating a formatted date string calling `Date.toLocaleTimeString()`.
6
+ * @public
7
+ */
8
+ export interface DateFormatOptions {
9
+ locales?: string | string[] | undefined;
10
+ options?: Intl.DateTimeFormatOptions | undefined;
11
+ }
4
12
  /**
5
13
  * Adjust a Date object to show time in one time zone as if it is in the local time zone.
6
14
  * This is useful when showing sunrise and sunset times for a project location in a different time zone
@@ -34,16 +42,18 @@ export declare function adjustDateToTimezone(inDateTime: Date, utcOffset: number
34
42
  * Format a date in a display string, optionally converting to time zone, if specified by timeZoneOffset
35
43
  * @param date Date object to format
36
44
  * @param timeZoneOffset optional: offset from UTC to use for conversion
45
+ * @param formatOptions optional: allow locale and format for output Date string. If not defined current locale options are used.
37
46
  * @returns formatted date string
38
47
  * @public
39
48
  */
40
- export declare const toDateString: (date: Date, timeZoneOffset?: number | undefined) => string;
49
+ export declare const toDateString: (date: Date, timeZoneOffset?: number | undefined, formatOptions?: DateFormatOptions | undefined) => string;
41
50
  /**
42
51
  * Format the time included in a date, optionally converting to time zone, if specified
43
52
  * @param date Date object
44
53
  * @param timeZoneOffset optional: offset from UTC to use for conversion
54
+ * @param formatOptions optional: allow locale and format for output Time string. If not defined current locale options are used.
45
55
  * @returns formatted time string
46
56
  * @public
47
57
  */
48
- export declare const toTimeString: (date: Date, timeZoneOffset?: number | undefined) => string;
58
+ export declare const toTimeString: (date: Date, timeZoneOffset?: number | undefined, formatOptions?: DateFormatOptions | undefined) => string;
49
59
  //# sourceMappingURL=DateUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateUtils.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/DateUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAEvE;AACD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,SAAU,IAAI,gDAEtC,CAAC;AACF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,SAAU,IAAI,gDAEtC,CAAC"}
1
+ {"version":3,"file":"DateUtils.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/DateUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IACxC,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAEvE;AACD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,SAAU,IAAI,+FAMtC,CAAC;AACF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,SAAU,IAAI,+FAMtC,CAAC"}
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toTimeString = exports.toDateString = exports.adjustDateToTimezone = void 0;
4
2
  /*---------------------------------------------------------------------------------------------
5
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -8,6 +6,8 @@ exports.toTimeString = exports.toDateString = exports.adjustDateToTimezone = voi
8
6
  /** @packageDocumentation
9
7
  * @module Common
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.toTimeString = exports.toDateString = exports.adjustDateToTimezone = void 0;
11
11
  /**
12
12
  * Adjust a Date object to show time in one time zone as if it is in the local time zone.
13
13
  * This is useful when showing sunrise and sunset times for a project location in a different time zone
@@ -44,10 +44,15 @@ exports.adjustDateToTimezone = adjustDateToTimezone;
44
44
  * Format a date in a display string, optionally converting to time zone, if specified by timeZoneOffset
45
45
  * @param date Date object to format
46
46
  * @param timeZoneOffset optional: offset from UTC to use for conversion
47
+ * @param formatOptions optional: allow locale and format for output Date string. If not defined current locale options are used.
47
48
  * @returns formatted date string
48
49
  * @public
49
50
  */
50
- const toDateString = (date, timeZoneOffset) => {
51
+ const toDateString = (date, timeZoneOffset, formatOptions) => {
52
+ if (formatOptions) {
53
+ return undefined === timeZoneOffset ? date.toLocaleDateString(formatOptions.locales, formatOptions.options) :
54
+ adjustDateToTimezone(date, timeZoneOffset).toLocaleDateString(formatOptions.locales, formatOptions.options);
55
+ }
51
56
  return undefined === timeZoneOffset ? date.toLocaleDateString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleDateString();
52
57
  };
53
58
  exports.toDateString = toDateString;
@@ -55,10 +60,15 @@ exports.toDateString = toDateString;
55
60
  * Format the time included in a date, optionally converting to time zone, if specified
56
61
  * @param date Date object
57
62
  * @param timeZoneOffset optional: offset from UTC to use for conversion
63
+ * @param formatOptions optional: allow locale and format for output Time string. If not defined current locale options are used.
58
64
  * @returns formatted time string
59
65
  * @public
60
66
  */
61
- const toTimeString = (date, timeZoneOffset) => {
67
+ const toTimeString = (date, timeZoneOffset, formatOptions) => {
68
+ if (formatOptions) {
69
+ return undefined === timeZoneOffset ? date.toLocaleTimeString(formatOptions.locales, formatOptions.options) :
70
+ adjustDateToTimezone(date, timeZoneOffset).toLocaleTimeString(formatOptions.locales, formatOptions.options);
71
+ }
62
72
  return undefined === timeZoneOffset ? date.toLocaleTimeString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleTimeString();
63
73
  };
64
74
  exports.toTimeString = toTimeString;
@@ -1 +1 @@
1
- {"version":3,"file":"DateUtils.js","sourceRoot":"","sources":["../../../../src/components-react/common/DateUtils.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,oBAAoB,CAAC,UAAgB,EAAE,SAAiB;IACtE,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,iBAAiB,EAAE,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC;AAC/F,CAAC;AAFD,oDAEC;AACD;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,cAAuB,EAAE,EAAE;IAClE,OAAO,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpI,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AACF;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,cAAuB,EAAE,EAAE;IAClE,OAAO,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpI,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n/**\r\n * Adjust a Date object to show time in one time zone as if it is in the local time zone.\r\n * This is useful when showing sunrise and sunset times for a project location in a different time zone\r\n * and the time displayed should appear as if the user is seeing clock in project location.\r\n * Example 1:\r\n * If you have a UTC time for London (UTC +0100) and you want to display it in Eastern-US (UTC -0400) as if you were in London.\r\n * ```ts\r\n * londonDate = new Date(\"July 22, 2018 07:22:13 +0100\");\r\n * in Eastern-US londonDate will show as '7/22/2018, 2:22:13 AM'\r\n * adjustedDate = adjustDateToTimezone(londonDate, 1*60);\r\n * in location Eastern-US adjustedDate will show as '7/22/2018, 7:22:13 AM'\r\n * ```\r\n * Example 2:\r\n * If you have a UTC time for your location (UTC -0400) and you want to display the time as if you are in Western-US (UTC -0700).\r\n * ```ts\r\n * easternDate = new Date(\"July 22, 2018 07:22:13 -0400\");\r\n * adjustedDate = adjustDateToTimezone(easternDate, -7*60);\r\n * in location Eastern-US adjustedDate will show as '7/22/2018, 7:22:13 AM'\r\n * ```\r\n *\r\n * The utcOffset must be the time in minutes between the UTC and the desired time zone at the date specified by inDateTime.\r\n * For example, if you want the time offset to New York, NY and the date is during Daylight Saving Time, utcOffset should be -240 (-4 * 60).\r\n * If the date falls during Standard Time in New York, utcOffset will be -300 (-5 * 60).\r\n *\r\n * @param inDateTime date/time at project location\r\n * @param utcOffset UTC offset in minutes\r\n * @public\r\n */\r\nexport function adjustDateToTimezone(inDateTime: Date, utcOffset: number) {\r\n return new Date(inDateTime.getTime() + (inDateTime.getTimezoneOffset() + utcOffset) * 60000);\r\n}\r\n/**\r\n * Format a date in a display string, optionally converting to time zone, if specified by timeZoneOffset\r\n * @param date Date object to format\r\n * @param timeZoneOffset optional: offset from UTC to use for conversion\r\n * @returns formatted date string\r\n * @public\r\n */\r\nexport const toDateString = (date: Date, timeZoneOffset?: number) => {\r\n return undefined === timeZoneOffset ? date.toLocaleDateString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleDateString();\r\n};\r\n/**\r\n * Format the time included in a date, optionally converting to time zone, if specified\r\n * @param date Date object\r\n * @param timeZoneOffset optional: offset from UTC to use for conversion\r\n * @returns formatted time string\r\n * @public\r\n */\r\nexport const toTimeString = (date: Date, timeZoneOffset?: number) => {\r\n return undefined === timeZoneOffset ? date.toLocaleTimeString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleTimeString();\r\n};\r\n\r\n"]}
1
+ {"version":3,"file":"DateUtils.js","sourceRoot":"","sources":["../../../../src/components-react/common/DateUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAWH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,oBAAoB,CAAC,UAAgB,EAAE,SAAiB;IACtE,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,iBAAiB,EAAE,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC;AAC/F,CAAC;AAFD,oDAEC;AACD;;;;;;;GAOG;AACI,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,cAAuB,EAAE,aAAiC,EAAE,EAAE;IACrG,IAAI,aAAa,EAAE;QACjB,OAAO,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3G,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;KAC/G;IACD,OAAO,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpI,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB;AACF;;;;;;;GAOG;AACI,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,cAAuB,EAAE,aAAiC,EAAE,EAAE;IACrG,IAAI,aAAa,EAAE;QACjB,OAAO,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3G,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;KAC/G;IACD,OAAO,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpI,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\n/**\r\n * Define formatting options for use when component are generating a formatted date string calling `Date.toLocaleTimeString()`.\r\n * @public\r\n */\r\nexport interface DateFormatOptions {\r\n locales?: string | string[] | undefined;\r\n options?: Intl.DateTimeFormatOptions | undefined;\r\n}\r\n\r\n/**\r\n * Adjust a Date object to show time in one time zone as if it is in the local time zone.\r\n * This is useful when showing sunrise and sunset times for a project location in a different time zone\r\n * and the time displayed should appear as if the user is seeing clock in project location.\r\n * Example 1:\r\n * If you have a UTC time for London (UTC +0100) and you want to display it in Eastern-US (UTC -0400) as if you were in London.\r\n * ```ts\r\n * londonDate = new Date(\"July 22, 2018 07:22:13 +0100\");\r\n * in Eastern-US londonDate will show as '7/22/2018, 2:22:13 AM'\r\n * adjustedDate = adjustDateToTimezone(londonDate, 1*60);\r\n * in location Eastern-US adjustedDate will show as '7/22/2018, 7:22:13 AM'\r\n * ```\r\n * Example 2:\r\n * If you have a UTC time for your location (UTC -0400) and you want to display the time as if you are in Western-US (UTC -0700).\r\n * ```ts\r\n * easternDate = new Date(\"July 22, 2018 07:22:13 -0400\");\r\n * adjustedDate = adjustDateToTimezone(easternDate, -7*60);\r\n * in location Eastern-US adjustedDate will show as '7/22/2018, 7:22:13 AM'\r\n * ```\r\n *\r\n * The utcOffset must be the time in minutes between the UTC and the desired time zone at the date specified by inDateTime.\r\n * For example, if you want the time offset to New York, NY and the date is during Daylight Saving Time, utcOffset should be -240 (-4 * 60).\r\n * If the date falls during Standard Time in New York, utcOffset will be -300 (-5 * 60).\r\n *\r\n * @param inDateTime date/time at project location\r\n * @param utcOffset UTC offset in minutes\r\n * @public\r\n */\r\nexport function adjustDateToTimezone(inDateTime: Date, utcOffset: number) {\r\n return new Date(inDateTime.getTime() + (inDateTime.getTimezoneOffset() + utcOffset) * 60000);\r\n}\r\n/**\r\n * Format a date in a display string, optionally converting to time zone, if specified by timeZoneOffset\r\n * @param date Date object to format\r\n * @param timeZoneOffset optional: offset from UTC to use for conversion\r\n * @param formatOptions optional: allow locale and format for output Date string. If not defined current locale options are used.\r\n * @returns formatted date string\r\n * @public\r\n */\r\nexport const toDateString = (date: Date, timeZoneOffset?: number, formatOptions?: DateFormatOptions) => {\r\n if (formatOptions) {\r\n return undefined === timeZoneOffset ? date.toLocaleDateString(formatOptions.locales, formatOptions.options) :\r\n adjustDateToTimezone(date, timeZoneOffset).toLocaleDateString(formatOptions.locales, formatOptions.options);\r\n }\r\n return undefined === timeZoneOffset ? date.toLocaleDateString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleDateString();\r\n};\r\n/**\r\n * Format the time included in a date, optionally converting to time zone, if specified\r\n * @param date Date object\r\n * @param timeZoneOffset optional: offset from UTC to use for conversion\r\n * @param formatOptions optional: allow locale and format for output Time string. If not defined current locale options are used.\r\n * @returns formatted time string\r\n * @public\r\n */\r\nexport const toTimeString = (date: Date, timeZoneOffset?: number, formatOptions?: DateFormatOptions) => {\r\n if (formatOptions) {\r\n return undefined === timeZoneOffset ? date.toLocaleTimeString(formatOptions.locales, formatOptions.options) :\r\n adjustDateToTimezone(date, timeZoneOffset).toLocaleTimeString(formatOptions.locales, formatOptions.options);\r\n }\r\n return undefined === timeZoneOffset ? date.toLocaleTimeString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleTimeString();\r\n};\r\n\r\n"]}
@@ -3,27 +3,25 @@
3
3
  */
4
4
  import { Observable } from "rxjs/internal/Observable";
5
5
  /**
6
- * Controls observable subscription order and timing.
6
+ * Limits concurrent observable subscriptions to one.
7
7
  *
8
- * Scheduled observables are placed at the end of a queue. The scheduler always
9
- * subscribes to at most one observable from the queue and waits until observables
10
- * either complete or get unscheduled before removing them from the queue.
8
+ * Scheduled observables are placed at the end of a queue. Each queued observable is subscribed to and awaited until the
9
+ * completion.
11
10
  *
12
11
  * To schedule an observable, subscribe to the result of `scheduleSubscription()` call.
13
12
  * @internal
14
13
  */
15
14
  export declare class SubscriptionScheduler<T> {
16
- private _scheduledObservables;
17
15
  private _scheduler;
18
16
  constructor();
19
17
  /**
20
18
  * Schedules `source` for subscription in the current scheduler.
21
19
  *
22
- * The actual scheduling is performed when the returned observable is subscribed to.
23
- * To cancel, simply remove all subscribers from the returned observable.
20
+ * The actual scheduling is performed when the returned observable is subscribed to. To cancel, remove all subscribers
21
+ * from the returned observable.
24
22
  *
25
23
  * @param source Input observable for which to schedule a subscription.
26
- * @returns Multicast observable which mirrors `source`.
24
+ * @returns Hot observable which starts emitting `source` values after subscription.
27
25
  */
28
26
  scheduleSubscription(source: Observable<T>): Observable<T>;
29
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionScheduler.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAiBtD;;;;;;;;;GASG;AACH,qBAAa,qBAAqB,CAAC,CAAC;IAElC,OAAO,CAAC,qBAAqB,CAA2C;IAGxE,OAAO,CAAC,UAAU,CAA2C;;IA0B7D;;;;;;;;OAQG;IACI,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;CA8ClE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAErH"}
1
+ {"version":3,"file":"SubscriptionScheduler.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAkBtD;;;;;;;;GAQG;AACH,qBAAa,qBAAqB,CAAC,CAAC;IAClC,OAAO,CAAC,UAAU,CAA2C;;IAwB7D;;;;;;;;OAQG;IACI,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;CASlE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAErH"}
@@ -8,8 +8,9 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.scheduleSubscription = exports.SubscriptionScheduler = void 0;
11
- const BehaviorSubject_1 = require("rxjs/internal/BehaviorSubject");
12
11
  const defer_1 = require("rxjs/internal/observable/defer");
12
+ const empty_1 = require("rxjs/internal/observable/empty");
13
+ const iif_1 = require("rxjs/internal/observable/iif");
13
14
  const finalize_1 = require("rxjs/internal/operators/finalize");
14
15
  const mergeMap_1 = require("rxjs/internal/operators/mergeMap");
15
16
  const observeOn_1 = require("rxjs/internal/operators/observeOn");
@@ -17,87 +18,52 @@ const onErrorResumeNext_1 = require("rxjs/internal/operators/onErrorResumeNext")
17
18
  const publish_1 = require("rxjs/internal/operators/publish");
18
19
  const refCount_1 = require("rxjs/internal/operators/refCount");
19
20
  const subscribeOn_1 = require("rxjs/internal/operators/subscribeOn");
20
- const switchAll_1 = require("rxjs/internal/operators/switchAll");
21
21
  const asap_1 = require("rxjs/internal/scheduler/asap");
22
22
  const queue_1 = require("rxjs/internal/scheduler/queue");
23
23
  const Subject_1 = require("rxjs/internal/Subject");
24
24
  const MAX_CONCURRENT_SUBSCRIPTIONS = 1;
25
25
  /**
26
- * Controls observable subscription order and timing.
26
+ * Limits concurrent observable subscriptions to one.
27
27
  *
28
- * Scheduled observables are placed at the end of a queue. The scheduler always
29
- * subscribes to at most one observable from the queue and waits until observables
30
- * either complete or get unscheduled before removing them from the queue.
28
+ * Scheduled observables are placed at the end of a queue. Each queued observable is subscribed to and awaited until the
29
+ * completion.
31
30
  *
32
31
  * To schedule an observable, subscribe to the result of `scheduleSubscription()` call.
33
32
  * @internal
34
33
  */
35
34
  class SubscriptionScheduler {
36
35
  constructor() {
37
- // Maps source observables to scheduled observables.
38
- this._scheduledObservables = new Map();
39
- // Subject that does the actual subscription scheduling
40
36
  this._scheduler = new Subject_1.Subject();
41
37
  this._scheduler
42
- .pipe(
43
- // Process all observables one by one in sequence
44
- (0, mergeMap_1.mergeMap)((sourceObservable) => sourceObservable.pipe(
38
+ .pipe((0, mergeMap_1.mergeMap)((sourceObservable) => sourceObservable.pipe(
45
39
  // Connect the observable
46
40
  (0, refCount_1.refCount)(),
47
- // Guard against stack overflow when a lot of observables are scheduled.
48
- // Without this operation `mergeMap` will process each observable
49
- // that is present in the pipeline recursively.
41
+ // Guard against stack overflow when a lot of observables are scheduled. Without this operation `mergeMap`
42
+ // will process each observable that is present in the pipeline recursively.
50
43
  (0, observeOn_1.observeOn)(queue_1.queueScheduler),
51
- // Make sure that there is enough time to subscribe to a scheduled observable multiple times if needed
44
+ // Delay the connection until another event loop task
52
45
  (0, subscribeOn_1.subscribeOn)(asap_1.asapScheduler),
53
- // On error, proceed to the next observable. Outside subscribers will still receive an error notification.
46
+ // Ignore errors in this pipeline without suppressing them for other subscribers
54
47
  (0, onErrorResumeNext_1.onErrorResumeNext)()), MAX_CONCURRENT_SUBSCRIPTIONS))
55
- // Start the scheduler and wait for observables to be scheduled
48
+ // Start consuming scheduled observables
56
49
  .subscribe();
57
50
  }
58
51
  /**
59
52
  * Schedules `source` for subscription in the current scheduler.
60
53
  *
61
- * The actual scheduling is performed when the returned observable is subscribed to.
62
- * To cancel, simply remove all subscribers from the returned observable.
54
+ * The actual scheduling is performed when the returned observable is subscribed to. To cancel, remove all subscribers
55
+ * from the returned observable.
63
56
  *
64
57
  * @param source Input observable for which to schedule a subscription.
65
- * @returns Multicast observable which mirrors `source`.
58
+ * @returns Hot observable which starts emitting `source` values after subscription.
66
59
  */
67
60
  scheduleSubscription(source) {
68
- // On subscription, determine which observable to return
69
61
  return (0, defer_1.defer)(() => {
70
- // If this observable has already been scheduled, return the scheduled observable
71
- let scheduledObservable = this._scheduledObservables.get(source);
72
- if (scheduledObservable) {
73
- return scheduledObservable;
74
- }
75
- // Create a subject which emits observable sources
76
- const sourceSubject = new BehaviorSubject_1.BehaviorSubject(source.pipe(
77
- // When source completes, allow scheduler to move on to the next observable
78
- (0, finalize_1.finalize)(() => {
79
- sourceSubject.complete();
80
- })));
81
- // Create an observable which will be passed to the scheduler
82
- const connectableObservable = (0, publish_1.publish)()(sourceSubject.pipe(
83
- // Unsubscribe from previous observable before subscribing to the next one
84
- (0, switchAll_1.switchAll)()));
85
- // Create an observable which will be cached and returned
86
- scheduledObservable = connectableObservable.pipe((0, finalize_1.finalize)(() => {
87
- // Invalidate cached scheduled observable
88
- this._scheduledObservables.delete(source);
89
- // Allow scheduler to move on to the next observable
90
- sourceSubject.complete();
91
- }),
92
- // Multicast values
93
- (0, publish_1.publish)(),
94
- // Dispose the shared subscription when there are no subscribers left
95
- (0, refCount_1.refCount)());
96
- // Cache the scheduled observable
97
- this._scheduledObservables.set(source, scheduledObservable);
98
- // Schedule the subscription
62
+ let unsubscribed = false;
63
+ // Do not subscribe to source observable if it was unsubscribed from before being processed by the scheduler
64
+ const connectableObservable = (0, iif_1.iif)(() => unsubscribed, empty_1.EMPTY, source).pipe((0, publish_1.publish)());
99
65
  this._scheduler.next(connectableObservable);
100
- return scheduledObservable;
66
+ return connectableObservable.pipe((0, finalize_1.finalize)(() => unsubscribed = true));
101
67
  });
102
68
  }
103
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionScheduler.js","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,mEAAgE;AAGhE,0DAAuD;AACvD,+DAA4D;AAC5D,+DAA4D;AAC5D,iEAA8D;A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,6DAA6D;YAC7D,MAAM,qBAAqB,GAAG,IAAA,iBAAO,GAAK,CAAC,aAAa,CAAC,IAAI;YAC3D,0EAA0E;YAC1E,IAAA,qBAAS,GAAE,CACZ,CAAC,CAAC;YAEH,yDAAyD;YACzD,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAC9C,IAAA,mBAAQ,EAAC,GAAG,EAAE;gBACZ,yCAAyC;gBACzC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAE1C,oDAAoD;gBACpD,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC3B,CAAC,CAAC;YACF,mBAAmB;YACnB,IAAA,iBAAO,GAAE;YACT,qEAAqE;YACrE,IAAA,mBAAQ,GAAE,CACX,CAAC;YAEF,iCAAiC;YACjC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;YAE5D,4BAA4B;YAC5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAC5C,OAAO,mBAAmB,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtFD,sDAsFC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAI,SAAmC;IACzE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC;AAFD,oDAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport { BehaviorSubject } from \"rxjs/internal/BehaviorSubject\";\r\nimport { Observable } from \"rxjs/internal/Observable\";\r\nimport { ConnectableObservable } from \"rxjs/internal/observable/ConnectableObservable\";\r\nimport { defer } from \"rxjs/internal/observable/defer\";\r\nimport { finalize } from \"rxjs/internal/operators/finalize\";\r\nimport { mergeMap } from \"rxjs/internal/operators/mergeMap\";\r\nimport { observeOn } from \"rxjs/internal/operators/observeOn\";\r\nimport { onErrorResumeNext } from \"rxjs/internal/operators/onErrorResumeNext\";\r\nimport { publish } from \"rxjs/internal/operators/publish\";\r\nimport { refCount } from \"rxjs/internal/operators/refCount\";\r\nimport { subscribeOn } from \"rxjs/internal/operators/subscribeOn\";\r\nimport { switchAll } from \"rxjs/internal/operators/switchAll\";\r\nimport { asapScheduler } from \"rxjs/internal/scheduler/asap\";\r\nimport { queueScheduler } from \"rxjs/internal/scheduler/queue\";\r\nimport { Subject } from \"rxjs/internal/Subject\";\r\n\r\nconst MAX_CONCURRENT_SUBSCRIPTIONS = 1;\r\n\r\n/**\r\n * Controls observable subscription order and timing.\r\n *\r\n * Scheduled observables are placed at the end of a queue. The scheduler always\r\n * subscribes to at most one observable from the queue and waits until observables\r\n * either complete or get unscheduled before removing them from the queue.\r\n *\r\n * To schedule an observable, subscribe to the result of `scheduleSubscription()` call.\r\n * @internal\r\n */\r\nexport class SubscriptionScheduler<T> {\r\n // Maps source observables to scheduled observables.\r\n private _scheduledObservables = new Map<Observable<T>, Observable<T>>();\r\n\r\n // Subject that does the actual subscription scheduling\r\n private _scheduler = new Subject<ConnectableObservable<T>>();\r\n\r\n constructor() {\r\n this._scheduler\r\n .pipe(\r\n // Process all observables one by one in sequence\r\n mergeMap(\r\n (sourceObservable) => sourceObservable.pipe(\r\n // Connect the observable\r\n refCount(),\r\n // Guard against stack overflow when a lot of observables are scheduled.\r\n // Without this operation `mergeMap` will process each observable\r\n // that is present in the pipeline recursively.\r\n observeOn(queueScheduler),\r\n // Make sure that there is enough time to subscribe to a scheduled observable multiple times if needed\r\n subscribeOn(asapScheduler),\r\n // On error, proceed to the next observable. Outside subscribers will still receive an error notification.\r\n onErrorResumeNext(),\r\n ),\r\n MAX_CONCURRENT_SUBSCRIPTIONS,\r\n ),\r\n )\r\n // Start the scheduler and wait for observables to be scheduled\r\n .subscribe();\r\n }\r\n\r\n /**\r\n * Schedules `source` for subscription in the current scheduler.\r\n *\r\n * The actual scheduling is performed when the returned observable is subscribed to.\r\n * To cancel, simply remove all subscribers from the returned observable.\r\n *\r\n * @param source Input observable for which to schedule a subscription.\r\n * @returns Multicast observable which mirrors `source`.\r\n */\r\n public scheduleSubscription(source: Observable<T>): Observable<T> {\r\n // On subscription, determine which observable to return\r\n return defer(() => {\r\n // If this observable has already been scheduled, return the scheduled observable\r\n let scheduledObservable = this._scheduledObservables.get(source);\r\n if (scheduledObservable) {\r\n return scheduledObservable;\r\n }\r\n\r\n // Create a subject which emits observable sources\r\n const sourceSubject = new BehaviorSubject<Observable<T>>(source.pipe(\r\n // When source completes, allow scheduler to move on to the next observable\r\n finalize(() => {\r\n sourceSubject.complete();\r\n }),\r\n ));\r\n\r\n // Create an observable which will be passed to the scheduler\r\n const connectableObservable = publish<T>()(sourceSubject.pipe(\r\n // Unsubscribe from previous observable before subscribing to the next one\r\n switchAll(),\r\n ));\r\n\r\n // Create an observable which will be cached and returned\r\n scheduledObservable = connectableObservable.pipe(\r\n finalize(() => {\r\n // Invalidate cached scheduled observable\r\n this._scheduledObservables.delete(source);\r\n\r\n // Allow scheduler to move on to the next observable\r\n sourceSubject.complete();\r\n }),\r\n // Multicast values\r\n publish(),\r\n // Dispose the shared subscription when there are no subscribers left\r\n refCount(),\r\n );\r\n\r\n // Cache the scheduled observable\r\n this._scheduledObservables.set(source, scheduledObservable);\r\n\r\n // Schedule the subscription\r\n this._scheduler.next(connectableObservable);\r\n return scheduledObservable;\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Helper function for use as a `pipe()` argument with `rxjs` observables.\r\n * @internal\r\n */\r\nexport function scheduleSubscription<T>(scheduler: SubscriptionScheduler<T>): (source: Observable<T>) => Observable<T> {\r\n return (source) => scheduler.scheduleSubscription(source);\r\n}\r\n"]}
1
+ {"version":3,"file":"SubscriptionScheduler.js","sourceRoot":"","sources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AAE,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA3CD,sDA2CC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAI,SAAmC;IACzE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC;AAFD,oDAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport { Observable } from \"rxjs/internal/Observable\";\r\nimport { ConnectableObservable } from \"rxjs/internal/observable/ConnectableObservable\";\r\nimport { defer } from \"rxjs/internal/observable/defer\";\r\nimport { EMPTY } from \"rxjs/internal/observable/empty\";\r\nimport { iif } from \"rxjs/internal/observable/iif\";\r\nimport { finalize } from \"rxjs/internal/operators/finalize\";\r\nimport { mergeMap } from \"rxjs/internal/operators/mergeMap\";\r\nimport { observeOn } from \"rxjs/internal/operators/observeOn\";\r\nimport { onErrorResumeNext } from \"rxjs/internal/operators/onErrorResumeNext\";\r\nimport { publish } from \"rxjs/internal/operators/publish\";\r\nimport { refCount } from \"rxjs/internal/operators/refCount\";\r\nimport { subscribeOn } from \"rxjs/internal/operators/subscribeOn\";\r\nimport { asapScheduler } from \"rxjs/internal/scheduler/asap\";\r\nimport { queueScheduler } from \"rxjs/internal/scheduler/queue\";\r\nimport { Subject } from \"rxjs/internal/Subject\";\r\n\r\nconst MAX_CONCURRENT_SUBSCRIPTIONS = 1;\r\n\r\n/**\r\n * Limits concurrent observable subscriptions to one.\r\n *\r\n * Scheduled observables are placed at the end of a queue. Each queued observable is subscribed to and awaited until the\r\n * completion.\r\n *\r\n * To schedule an observable, subscribe to the result of `scheduleSubscription()` call.\r\n * @internal\r\n */\r\nexport class SubscriptionScheduler<T> {\r\n private _scheduler = new Subject<ConnectableObservable<T>>();\r\n\r\n constructor() {\r\n this._scheduler\r\n .pipe(\r\n mergeMap(\r\n (sourceObservable) => sourceObservable.pipe(\r\n // Connect the observable\r\n refCount(),\r\n // Guard against stack overflow when a lot of observables are scheduled. Without this operation `mergeMap`\r\n // will process each observable that is present in the pipeline recursively.\r\n observeOn(queueScheduler),\r\n // Delay the connection until another event loop task\r\n subscribeOn(asapScheduler),\r\n // Ignore errors in this pipeline without suppressing them for other subscribers\r\n onErrorResumeNext(),\r\n ),\r\n MAX_CONCURRENT_SUBSCRIPTIONS,\r\n ),\r\n )\r\n // Start consuming scheduled observables\r\n .subscribe();\r\n }\r\n\r\n /**\r\n * Schedules `source` for subscription in the current scheduler.\r\n *\r\n * The actual scheduling is performed when the returned observable is subscribed to. To cancel, remove all subscribers\r\n * from the returned observable.\r\n *\r\n * @param source Input observable for which to schedule a subscription.\r\n * @returns Hot observable which starts emitting `source` values after subscription.\r\n */\r\n public scheduleSubscription(source: Observable<T>): Observable<T> {\r\n return defer(() => {\r\n let unsubscribed = false;\r\n // Do not subscribe to source observable if it was unsubscribed from before being processed by the scheduler\r\n const connectableObservable = iif(() => unsubscribed, EMPTY, source).pipe(publish()) as ConnectableObservable<T>;\r\n this._scheduler.next(connectableObservable);\r\n return connectableObservable.pipe(finalize(() => unsubscribed = true));\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Helper function for use as a `pipe()` argument with `rxjs` observables.\r\n * @internal\r\n */\r\nexport function scheduleSubscription<T>(scheduler: SubscriptionScheduler<T>): (source: Observable<T>) => Observable<T> {\r\n return (source) => scheduler.scheduleSubscription(source);\r\n}\r\n"]}
@@ -20,15 +20,17 @@ export declare abstract class NumericTypeConverterBase extends TypeConverter imp
20
20
  * @public
21
21
  */
22
22
  export declare class FloatTypeConverter extends NumericTypeConverterBase {
23
+ private static parseString;
23
24
  convertToString(value?: Primitives.Float): string;
24
- convertFromString(value: string): number;
25
+ convertFromString(value: string): number | undefined;
25
26
  }
26
27
  /**
27
28
  * Int Type Converter.
28
29
  * @public
29
30
  */
30
31
  export declare class IntTypeConverter extends NumericTypeConverterBase {
32
+ private static parseString;
31
33
  convertToString(value?: Primitives.Int): string;
32
- convertFromString(value: string): number;
34
+ convertFromString(value: string): number | undefined;
33
35
  }
34
36
  //# sourceMappingURL=NumericTypeConverter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumericTypeConverter.d.ts","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAqB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG9E;;;GAGG;AACH,8BAAsB,wBAAyB,SAAQ,aAAc,YAAW,4BAA4B;IAC1G,IAAoB,iBAAiB,IAAI,OAAO,CAAiB;IAE1D,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,OAAO,GAAG,OAAO;IAIjE,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,OAAO,GAAG,OAAO;IAI1E,aAAa,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,OAAO,GAAG,OAAO;IAIpE,sBAAsB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,OAAO,GAAG,OAAO;IAI7E,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM;CAGhG;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,wBAAwB;IAC9C,eAAe,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK;IAw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BxC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGrE;AAKD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,MAAM,CAAC,WAAW;IAKV,eAAe,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAkBtC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGrE"}
@@ -39,7 +39,12 @@ exports.NumericTypeConverterBase = NumericTypeConverterBase;
39
39
  * @public
40
40
  */
41
41
  class FloatTypeConverter extends NumericTypeConverterBase {
42
+ static parseString(value) {
43
+ const parsedValue = parseFloat(value);
44
+ return Number.isNaN(parsedValue) ? undefined : parsedValue;
45
+ }
42
46
  convertToString(value) {
47
+ var _a;
43
48
  if (value === undefined)
44
49
  return "";
45
50
  let numericValue = 0;
@@ -49,7 +54,7 @@ class FloatTypeConverter extends NumericTypeConverterBase {
49
54
  numericValue = 0;
50
55
  }
51
56
  else {
52
- numericValue = parseFloat(value);
57
+ numericValue = (_a = FloatTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
53
58
  }
54
59
  }
55
60
  else {
@@ -64,7 +69,7 @@ class FloatTypeConverter extends NumericTypeConverterBase {
64
69
  return stringValue;
65
70
  }
66
71
  convertFromString(value) {
67
- return parseFloat(value);
72
+ return FloatTypeConverter.parseString(value);
68
73
  }
69
74
  }
70
75
  exports.FloatTypeConverter = FloatTypeConverter;
@@ -76,7 +81,12 @@ TypeConverterManager_1.TypeConverterManager.registerConverter(appui_abstract_1.S
76
81
  * @public
77
82
  */
78
83
  class IntTypeConverter extends NumericTypeConverterBase {
84
+ static parseString(value) {
85
+ const parsedValue = parseInt(value, 10);
86
+ return Number.isNaN(parsedValue) ? undefined : parsedValue;
87
+ }
79
88
  convertToString(value) {
89
+ var _a;
80
90
  if (value === undefined)
81
91
  return "";
82
92
  let numericValue = 0;
@@ -86,7 +96,7 @@ class IntTypeConverter extends NumericTypeConverterBase {
86
96
  numericValue = 0;
87
97
  }
88
98
  else {
89
- numericValue = parseInt(value, 10);
99
+ numericValue = (_a = IntTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
90
100
  }
91
101
  }
92
102
  else {
@@ -95,7 +105,7 @@ class IntTypeConverter extends NumericTypeConverterBase {
95
105
  return Math.round(numericValue).toString();
96
106
  }
97
107
  convertFromString(value) {
98
- return parseInt(value, 10);
108
+ return IntTypeConverter.parseString(value);
99
109
  }
100
110
  }
101
111
  exports.IntTypeConverter = IntTypeConverter;
@@ -1 +1 @@
1
- {"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0DAAsE;AACtE,mDAA8E;AAC9E,iEAA8D;AAE9D;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,6BAAa;IAClE,IAAoB,iBAAiB,KAAc,OAAO,IAAI,CAAC,CAAC,CAAC;IAE1D,UAAU,CAAC,CAAqB,EAAE,CAAqB;QAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,mBAAmB,CAAC,CAAqB,EAAE,CAAqB;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,aAAa,CAAC,CAAqB,EAAE,CAAqB;QAC/D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,sBAAsB,CAAC,CAAqB,EAAE,CAAqB;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,WAAW,CAAC,CAAqB,EAAE,CAAqB,EAAE,WAAqB;QACpF,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;CACF;AAtBD,4DAsBC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,wBAAwB;IAC9C,eAAe,CAAC,KAA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OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;gBACnD,sCAAsC;gBACtC,YAAY,GAAG,CAAC,CAAC;aAClB;iBAAM;gBACL,YAAY,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;aACpC;SACF;aAAM;YACL,YAAY,GAAG,KAAK,CAAC;SACtB;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7C,CAAC;IAEe,iBAAiB,CAAC,KAAa;QAC7C,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;CACF;AAtBD,4CAsBC;AAED,2CAAoB,CAAC,iBAAiB,CAAC,kCAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,2CAAoB,CAAC,iBAAiB,CAAC,kCAAiB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module TypeConverters\r\n */\r\n\r\nimport { Primitives, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { LessGreaterOperatorProcessor, TypeConverter } from \"./TypeConverter\";\r\nimport { TypeConverterManager } from \"./TypeConverterManager\";\r\n\r\n/**\r\n * Base Numeric Type Converter.\r\n * @public\r\n */\r\nexport abstract class NumericTypeConverterBase extends TypeConverter implements LessGreaterOperatorProcessor {\r\n public override get isLessGreaterType(): boolean { return true; }\r\n\r\n public isLessThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a < b;\r\n }\r\n\r\n public isLessThanOrEqualTo(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a <= b;\r\n }\r\n\r\n public isGreaterThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a > b;\r\n }\r\n\r\n public isGreaterThanOrEqualTo(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a >= b;\r\n }\r\n\r\n public sortCompare(a: Primitives.Numeric, b: Primitives.Numeric, _ignoreCase?: boolean): number {\r\n return (+a) - (+b);\r\n }\r\n}\r\n\r\n/**\r\n * Float Type Converter.\r\n * @public\r\n */\r\nexport class FloatTypeConverter extends NumericTypeConverterBase {\r\n public override convertToString(value?: Primitives.Float) {\r\n if (value === undefined)\r\n return \"\";\r\n\r\n let numericValue = 0;\r\n if (typeof value === \"string\") {\r\n if (value === \"-\" || value === \"\" || value === \"-0.0\" || value === \"-0\") {\r\n // handle these semi-valid values as 0\r\n numericValue = 0;\r\n } else {\r\n numericValue = parseFloat(value);\r\n }\r\n } else {\r\n numericValue = value;\r\n }\r\n // this is close to calling `toFixed(2)`, but cuts of any trailing zeros\r\n let stringValue = (Math.round(100 * numericValue) / 100).toString();\r\n // because this is a _float_ converter, we want to emphasize the number is a float - make\r\n // sure there's a decimal part\r\n if (stringValue.indexOf(\".\") === -1)\r\n stringValue += \".0\";\r\n return stringValue;\r\n }\r\n\r\n public override convertFromString(value: string): number {\r\n return parseFloat(value);\r\n }\r\n}\r\nTypeConverterManager.registerConverter(StandardTypeNames.Float, FloatTypeConverter);\r\nTypeConverterManager.registerConverter(StandardTypeNames.Double, FloatTypeConverter);\r\nTypeConverterManager.registerConverter(StandardTypeNames.Number, FloatTypeConverter);\r\n\r\n/**\r\n * Int Type Converter.\r\n * @public\r\n */\r\nexport class IntTypeConverter extends NumericTypeConverterBase {\r\n public override convertToString(value?: Primitives.Int) {\r\n if (value === undefined)\r\n return \"\";\r\n\r\n let numericValue = 0;\r\n if (typeof value === \"string\") {\r\n if (value === \"-\" || value === \"\" || value === \"-0\") {\r\n // handle these semi-valid values as 0\r\n numericValue = 0;\r\n } else {\r\n numericValue = parseInt(value, 10);\r\n }\r\n } else {\r\n numericValue = value;\r\n }\r\n return Math.round(numericValue).toString();\r\n }\r\n\r\n public override convertFromString(value: string): number {\r\n return parseInt(value, 10);\r\n }\r\n}\r\n\r\nTypeConverterManager.registerConverter(StandardTypeNames.Int, IntTypeConverter);\r\nTypeConverterManager.registerConverter(StandardTypeNames.Integer, IntTypeConverter);\r\n"]}
1
+ {"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0DAAsE;AACtE,mDAA8E;AAC9E,iEAA8D;AAE9D;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,6BAAa;IAClE,IAAoB,iBAAiB,KAAc,OAAO,IAAI,CAAC,CAAC,CAAC;IAE1D,UAAU,CAAC,CAAqB,EAAE,CAAqB;QAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,mBAAmB,CAAC,CAAqB,EAAE,CAAqB;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,aAAa,CAAC,CAAqB,EAAE,CAAqB;QAC/D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,sBAAsB,CAAC,CAAqB,EAAE,CAAqB;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,WAAW,CAAC,CAAqB,EAAE,CAAqB,EAAE,WAAqB;QACpF,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;CACF;AAtBD,4DAsBC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,wBAAwB;IACtD,MAAM,CAAC,WAAW,CAAC,KAAa;QACtC,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,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AM,CAAC,WAAW,CAAC,KAAa;QACtC,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;IAC7D,CAAC;IAEe,eAAe,CAAC,KAAsB;;QACpD,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,EAAE,CAAC;QAEZ,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;gBACnD,sCAAsC;gBACtC,YAAY,GAAG,CAAC,CAAC;aAClB;iBAAM;gBACL,YAAY,GAAG,MAAA,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,mCAAI,CAAC,CAAC;aACzD;SACF;aAAM;YACL,YAAY,GAAG,KAAK,CAAC;SACtB;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7C,CAAC;IAEe,iBAAiB,CAAC,KAAa;QAC7C,OAAO,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AA3BD,4CA2BC;AAED,2CAAoB,CAAC,iBAAiB,CAAC,kCAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,2CAAoB,CAAC,iBAAiB,CAAC,kCAAiB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module TypeConverters\r\n */\r\n\r\nimport { Primitives, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { LessGreaterOperatorProcessor, TypeConverter } from \"./TypeConverter\";\r\nimport { TypeConverterManager } from \"./TypeConverterManager\";\r\n\r\n/**\r\n * Base Numeric Type Converter.\r\n * @public\r\n */\r\nexport abstract class NumericTypeConverterBase extends TypeConverter implements LessGreaterOperatorProcessor {\r\n public override get isLessGreaterType(): boolean { return true; }\r\n\r\n public isLessThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a < b;\r\n }\r\n\r\n public isLessThanOrEqualTo(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a <= b;\r\n }\r\n\r\n public isGreaterThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a > b;\r\n }\r\n\r\n public isGreaterThanOrEqualTo(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\r\n return a >= b;\r\n }\r\n\r\n public sortCompare(a: Primitives.Numeric, b: Primitives.Numeric, _ignoreCase?: boolean): number {\r\n return (+a) - (+b);\r\n }\r\n}\r\n\r\n/**\r\n * Float Type Converter.\r\n * @public\r\n */\r\nexport class FloatTypeConverter extends NumericTypeConverterBase {\r\n private static parseString(value: string): number | undefined {\r\n const parsedValue = parseFloat(value);\r\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\r\n }\r\n\r\n public override convertToString(value?: Primitives.Float) {\r\n if (value === undefined)\r\n return \"\";\r\n\r\n let numericValue = 0;\r\n if (typeof value === \"string\") {\r\n if (value === \"-\" || value === \"\" || value === \"-0.0\" || value === \"-0\") {\r\n // handle these semi-valid values as 0\r\n numericValue = 0;\r\n } else {\r\n numericValue = FloatTypeConverter.parseString(value) ?? 0;\r\n }\r\n } else {\r\n numericValue = value;\r\n }\r\n // this is close to calling `toFixed(2)`, but cuts of any trailing zeros\r\n let stringValue = (Math.round(100 * numericValue) / 100).toString();\r\n // because this is a _float_ converter, we want to emphasize the number is a float - make\r\n // sure there's a decimal part\r\n if (stringValue.indexOf(\".\") === -1)\r\n stringValue += \".0\";\r\n return stringValue;\r\n }\r\n\r\n public override convertFromString(value: string): number | undefined {\r\n return FloatTypeConverter.parseString(value);\r\n }\r\n}\r\nTypeConverterManager.registerConverter(StandardTypeNames.Float, FloatTypeConverter);\r\nTypeConverterManager.registerConverter(StandardTypeNames.Double, FloatTypeConverter);\r\nTypeConverterManager.registerConverter(StandardTypeNames.Number, FloatTypeConverter);\r\n\r\n/**\r\n * Int Type Converter.\r\n * @public\r\n */\r\nexport class IntTypeConverter extends NumericTypeConverterBase {\r\n private static parseString(value: string): number | undefined {\r\n const parsedValue = parseInt(value, 10);\r\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\r\n }\r\n\r\n public override convertToString(value?: Primitives.Int) {\r\n if (value === undefined)\r\n return \"\";\r\n\r\n let numericValue = 0;\r\n if (typeof value === \"string\") {\r\n if (value === \"-\" || value === \"\" || value === \"-0\") {\r\n // handle these semi-valid values as 0\r\n numericValue = 0;\r\n } else {\r\n numericValue = IntTypeConverter.parseString(value) ?? 0;\r\n }\r\n } else {\r\n numericValue = value;\r\n }\r\n return Math.round(numericValue).toString();\r\n }\r\n\r\n public override convertFromString(value: string): number | undefined {\r\n return IntTypeConverter.parseString(value);\r\n }\r\n}\r\n\r\nTypeConverterManager.registerConverter(StandardTypeNames.Int, IntTypeConverter);\r\nTypeConverterManager.registerConverter(StandardTypeNames.Integer, IntTypeConverter);\r\n"]}
@@ -44,7 +44,7 @@ class TypeConverter {
44
44
  const stringValue = await this.convertFromStringWithOptions(value, converterOptions);
45
45
  const propertyValue = {
46
46
  valueFormat: appui_abstract_1.PropertyValueFormat.Primitive,
47
- value: stringValue ? stringValue : "",
47
+ value: stringValue,
48
48
  displayValue: "",
49
49
  };
50
50
  return propertyValue;
@@ -1 +1 @@
1
- {"version":3,"file":"TypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qCAAqC;AAErC,0DAA4I;AA6C5I;;;G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AAC,MAAwB,EAAE,MAAwB;QACjE,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,uDAAuD;IAChD,YAAY,CAAC,MAAwB,EAAE,MAAwB;QACpE,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAuB;QACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,mEAAmE;IAC5D,SAAS,CAAC,KAAuB;QACtC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,uDAAuD;IACvD,IAAW,YAAY,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACpD,wDAAwD;IACxD,IAAW,iBAAiB,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACzD,wDAAwD;IACxD,IAAW,aAAa,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACrD,yDAAyD;IACzD,IAAW,cAAc,KAAc,OAAO,IAAI,CAAC,CAAC,CAAC;CACtD;AAvED,sCAuEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module TypeConverters\r\n */\r\n\r\n// cSpell:ignore valuetypes shortdate\r\n\r\nimport { Primitives, PrimitiveValue, PropertyDescription, PropertyRecord, PropertyValue, PropertyValueFormat } from \"@itwin/appui-abstract\";\r\nimport { ConvertedPrimitives } from \"./valuetypes/ConvertedTypes\";\r\n\r\n/** Sort compare method for types that support sorting\r\n * @public\r\n */\r\nexport interface SortComparer {\r\n /** Sort function for two primitive values */\r\n sortCompare(valueA: Primitives.Value, valueB: Primitives.Value, ignoreCase?: boolean): number;\r\n}\r\n\r\n/** Operators for all filterable types\r\n * @public\r\n */\r\nexport interface OperatorProcessor {\r\n /** Determines if two primitive values are equal */\r\n isEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if two primitive values are not equal */\r\n isNotEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n}\r\n\r\n/** Operators for Numeric types, DateTime, TimeSpan, or any type that supports these comparisons\r\n * @public\r\n */\r\nexport interface LessGreaterOperatorProcessor {\r\n /** Determines if a primitive values is less than another primitive value */\r\n isLessThan(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if a primitive values is less than or equal to another primitive value */\r\n isLessThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if a primitive values is greater than another primitive value */\r\n isGreaterThan(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if a primitive values is greater than or equal to another primitive value */\r\n isGreaterThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n}\r\n\r\n/** Operators for all filterable null-able types\r\n * @public\r\n */\r\nexport interface NullableOperatorProcessor {\r\n /** Determines if a primitive value is null or undefined */\r\n isNull(value: Primitives.Value): boolean;\r\n /** Determines if a primitive value is not null or not undefined */\r\n isNotNull(value: Primitives.Value): boolean;\r\n}\r\n\r\n/**\r\n * Type Converter base class.\r\n * @public\r\n */\r\nexport abstract class TypeConverter implements SortComparer, OperatorProcessor, NullableOperatorProcessor {\r\n /** Converts a primitive value to a string */\r\n public convertToString(value?: Primitives.Value): string | Promise<string> {\r\n if (value === undefined)\r\n return \"\";\r\n return value.toString();\r\n }\r\n\r\n /** Default implementation just calls convertToString with no options */\r\n public convertToStringWithOptions(value?: Primitives.Value, _options?: { [key: string]: any }): string | Promise<string> {\r\n return this.convertToString(value);\r\n }\r\n\r\n /** Converts a string to a primitive value */\r\n public convertFromString(_value: string): ConvertedPrimitives.Value | undefined | Promise<ConvertedPrimitives.Value | undefined> {\r\n return undefined;\r\n }\r\n\r\n /** Default implementation just calls convertFromString with no options */\r\n public convertFromStringWithOptions(value: string, _options?: { [key: string]: any }): ConvertedPrimitives.Value | undefined | Promise<ConvertedPrimitives.Value | undefined> {\r\n return this.convertFromString(value);\r\n }\r\n\r\n /** Converts a value associated with a property description to a string */\r\n public convertPropertyToString(propertyDescription: PropertyDescription, value?: Primitives.Value): string | Promise<string> {\r\n return this.convertToStringWithOptions(value, propertyDescription.converter?.options);\r\n }\r\n\r\n /** Converts a string with a property record to a property value */\r\n public async convertFromStringToPropertyValue(value: string, propertyRecord?: PropertyRecord): Promise<PropertyValue> {\r\n const converterOptions = (propertyRecord && propertyRecord.property.converter) ? propertyRecord.property.converter.options : undefined;\r\n const stringValue = await this.convertFromStringWithOptions(value, converterOptions);\r\n const propertyValue: PrimitiveValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: stringValue ? stringValue : \"\",\r\n displayValue: \"\",\r\n };\r\n return propertyValue;\r\n }\r\n\r\n /** Sort function for two primitive values */\r\n public abstract sortCompare(valueA: Primitives.Value, valueB: Primitives.Value, _ignoreCase?: boolean): number;\r\n\r\n /** Determines if two primitive values are equal */\r\n public isEqualTo(valueA: Primitives.Value, valueB: Primitives.Value): boolean {\r\n return valueA === valueB;\r\n }\r\n\r\n /** Determines if two primitive values are not equal */\r\n public isNotEqualTo(valueA: Primitives.Value, valueB: Primitives.Value): boolean {\r\n return valueA !== valueB;\r\n }\r\n\r\n /** Determines if a primitive value is null or undefined */\r\n public isNull(value: Primitives.Value): boolean {\r\n return value === null || value === undefined;\r\n }\r\n\r\n /** Determines if a primitive value is not null or not undefined */\r\n public isNotNull(value: Primitives.Value): boolean {\r\n return value !== null && value !== undefined;\r\n }\r\n\r\n /** Determines if the converter is for a string type */\r\n public get isStringType(): boolean { return false; }\r\n /** Determines if the converter is for a numeric type */\r\n public get isLessGreaterType(): boolean { return false; }\r\n /** Determines if the converter is for a boolean type */\r\n public get isBooleanType(): boolean { return false; }\r\n /** Determines if the converter is for a nullable type */\r\n public get isNullableType(): boolean { return true; }\r\n}\r\n"]}
1
+ {"version":3,"file":"Type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AY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;IAKD,mDAAmD;IAC5C,SAAS,CAAC,MAAwB,EAAE,MAAwB;QACjE,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,uDAAuD;IAChD,YAAY,CAAC,MAAwB,EAAE,MAAwB;QACpE,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAuB;QACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,mEAAmE;IAC5D,SAAS,CAAC,KAAuB;QACtC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,uDAAuD;IACvD,IAAW,YAAY,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACpD,wDAAwD;IACxD,IAAW,iBAAiB,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACzD,wDAAwD;IACxD,IAAW,aAAa,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACrD,yDAAyD;IACzD,IAAW,cAAc,KAAc,OAAO,IAAI,CAAC,CAAC,CAAC;CACtD;AAvED,sCAuEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module TypeConverters\r\n */\r\n\r\n// cSpell:ignore valuetypes shortdate\r\n\r\nimport { Primitives, PrimitiveValue, PropertyDescription, PropertyRecord, PropertyValue, PropertyValueFormat } from \"@itwin/appui-abstract\";\r\nimport { ConvertedPrimitives } from \"./valuetypes/ConvertedTypes\";\r\n\r\n/** Sort compare method for types that support sorting\r\n * @public\r\n */\r\nexport interface SortComparer {\r\n /** Sort function for two primitive values */\r\n sortCompare(valueA: Primitives.Value, valueB: Primitives.Value, ignoreCase?: boolean): number;\r\n}\r\n\r\n/** Operators for all filterable types\r\n * @public\r\n */\r\nexport interface OperatorProcessor {\r\n /** Determines if two primitive values are equal */\r\n isEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if two primitive values are not equal */\r\n isNotEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n}\r\n\r\n/** Operators for Numeric types, DateTime, TimeSpan, or any type that supports these comparisons\r\n * @public\r\n */\r\nexport interface LessGreaterOperatorProcessor {\r\n /** Determines if a primitive values is less than another primitive value */\r\n isLessThan(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if a primitive values is less than or equal to another primitive value */\r\n isLessThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if a primitive values is greater than another primitive value */\r\n isGreaterThan(a: Primitives.Value, b: Primitives.Value): boolean;\r\n /** Determines if a primitive values is greater than or equal to another primitive value */\r\n isGreaterThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\r\n}\r\n\r\n/** Operators for all filterable null-able types\r\n * @public\r\n */\r\nexport interface NullableOperatorProcessor {\r\n /** Determines if a primitive value is null or undefined */\r\n isNull(value: Primitives.Value): boolean;\r\n /** Determines if a primitive value is not null or not undefined */\r\n isNotNull(value: Primitives.Value): boolean;\r\n}\r\n\r\n/**\r\n * Type Converter base class.\r\n * @public\r\n */\r\nexport abstract class TypeConverter implements SortComparer, OperatorProcessor, NullableOperatorProcessor {\r\n /** Converts a primitive value to a string */\r\n public convertToString(value?: Primitives.Value): string | Promise<string> {\r\n if (value === undefined)\r\n return \"\";\r\n return value.toString();\r\n }\r\n\r\n /** Default implementation just calls convertToString with no options */\r\n public convertToStringWithOptions(value?: Primitives.Value, _options?: { [key: string]: any }): string | Promise<string> {\r\n return this.convertToString(value);\r\n }\r\n\r\n /** Converts a string to a primitive value */\r\n public convertFromString(_value: string): ConvertedPrimitives.Value | undefined | Promise<ConvertedPrimitives.Value | undefined> {\r\n return undefined;\r\n }\r\n\r\n /** Default implementation just calls convertFromString with no options */\r\n public convertFromStringWithOptions(value: string, _options?: { [key: string]: any }): ConvertedPrimitives.Value | undefined | Promise<ConvertedPrimitives.Value | undefined> {\r\n return this.convertFromString(value);\r\n }\r\n\r\n /** Converts a value associated with a property description to a string */\r\n public convertPropertyToString(propertyDescription: PropertyDescription, value?: Primitives.Value): string | Promise<string> {\r\n return this.convertToStringWithOptions(value, propertyDescription.converter?.options);\r\n }\r\n\r\n /** Converts a string with a property record to a property value */\r\n public async convertFromStringToPropertyValue(value: string, propertyRecord?: PropertyRecord): Promise<PropertyValue> {\r\n const converterOptions = (propertyRecord && propertyRecord.property.converter) ? propertyRecord.property.converter.options : undefined;\r\n const stringValue = await this.convertFromStringWithOptions(value, converterOptions);\r\n const propertyValue: PrimitiveValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: stringValue,\r\n displayValue: \"\",\r\n };\r\n return propertyValue;\r\n }\r\n\r\n /** Sort function for two primitive values */\r\n public abstract sortCompare(valueA: Primitives.Value, valueB: Primitives.Value, _ignoreCase?: boolean): number;\r\n\r\n /** Determines if two primitive values are equal */\r\n public isEqualTo(valueA: Primitives.Value, valueB: Primitives.Value): boolean {\r\n return valueA === valueB;\r\n }\r\n\r\n /** Determines if two primitive values are not equal */\r\n public isNotEqualTo(valueA: Primitives.Value, valueB: Primitives.Value): boolean {\r\n return valueA !== valueB;\r\n }\r\n\r\n /** Determines if a primitive value is null or undefined */\r\n public isNull(value: Primitives.Value): boolean {\r\n return value === null || value === undefined;\r\n }\r\n\r\n /** Determines if a primitive value is not null or not undefined */\r\n public isNotNull(value: Primitives.Value): boolean {\r\n return value !== null && value !== undefined;\r\n }\r\n\r\n /** Determines if the converter is for a string type */\r\n public get isStringType(): boolean { return false; }\r\n /** Determines if the converter is for a numeric type */\r\n public get isLessGreaterType(): boolean { return false; }\r\n /** Determines if the converter is for a boolean type */\r\n public get isBooleanType(): boolean { return false; }\r\n /** Determines if the converter is for a nullable type */\r\n public get isNullableType(): boolean { return true; }\r\n}\r\n"]}
@@ -59,7 +59,7 @@ class CustomNumberEditor extends React.PureComponent {
59
59
  var _a;
60
60
  // istanbul ignore else
61
61
  if (e.key === appui_abstract_1.SpecialKey.Escape) {
62
- const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : this._getInitialDisplayValue();
62
+ const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : ( /* istanbul ignore next */this._getInitialDisplayValue());
63
63
  if (initialDisplayValue !== this.state.inputValue) {
64
64
  e.preventDefault();
65
65
  e.stopPropagation();
@@ -118,7 +118,7 @@ class CustomNumberEditor extends React.PureComponent {
118
118
  appui_abstract_1.UiAdmin.messagePresenter.displayMessage(appui_abstract_1.MessageSeverity.Error, parseResults.parseError ? parseResults.parseError : /* istanbul ignore next */ UiComponents_1.UiComponents.translate("errors.unable-to-parse-quantity"));
119
119
  }
120
120
  const displayValue = (record.value.displayValue && record.value.displayValue.length > 0) ? record.value.displayValue : /* istanbul ignore next */ this._formatParams.formatFunction(record.value.value);
121
- propertyValue = this._lastValidValue ? { ...this._lastValidValue } : {
121
+ propertyValue = this._lastValidValue ? { ...this._lastValidValue } : /* istanbul ignore next */ {
122
122
  valueFormat: appui_abstract_1.PropertyValueFormat.Primitive,
123
123
  value: record.value.value,
124
124
  displayValue,
@@ -238,7 +238,7 @@ class CustomNumberEditor extends React.PureComponent {
238
238
  }
239
239
  _resetToLastValidDisplayValue() {
240
240
  var _a;
241
- const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : this._getInitialDisplayValue();
241
+ const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : ( /* istanbul ignore next */this._getInitialDisplayValue());
242
242
  this.setState({ inputValue: initialDisplayValue });
243
243
  }
244
244
  /** @internal */