@itwin/components-react 3.3.0-dev.9 → 3.3.0

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 (135) hide show
  1. package/CHANGELOG.md +58 -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/editors/DateTimeEditor.d.ts.map +1 -1
  11. package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -0
  12. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  13. package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +36 -0
  14. package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -0
  15. package/lib/cjs/components-react/filter-builder/FilterBuilder.js +118 -0
  16. package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -0
  17. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +11 -0
  18. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -0
  19. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +76 -0
  20. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -0
  21. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +41 -0
  22. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +29 -0
  23. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -0
  24. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +79 -0
  25. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -0
  26. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +73 -0
  27. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +12 -0
  28. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -0
  29. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +47 -0
  30. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -0
  31. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +11 -0
  32. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -0
  33. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +52 -0
  34. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -0
  35. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -0
  36. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -0
  37. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +43 -0
  38. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -0
  39. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +43 -0
  40. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -0
  41. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +152 -0
  42. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -0
  43. package/lib/cjs/components-react/filter-builder/Operators.d.ts +27 -0
  44. package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -0
  45. package/lib/cjs/components-react/filter-builder/Operators.js +113 -0
  46. package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -0
  47. package/lib/cjs/components-react/filter-builder/Types.d.ts +18 -0
  48. package/lib/cjs/components-react/filter-builder/Types.d.ts.map +1 -0
  49. package/lib/cjs/components-react/filter-builder/Types.js +9 -0
  50. package/lib/cjs/components-react/filter-builder/Types.js.map +1 -0
  51. package/lib/cjs/components-react/toolbar/Overflow.scss +3 -2
  52. package/lib/cjs/components-react/toolbar/PopupItem.scss +4 -5
  53. package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
  54. package/lib/cjs/components-react/tree/controlled/TreeHooks.js +5 -8
  55. package/lib/cjs/components-react/tree/controlled/TreeHooks.js.map +1 -1
  56. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts +8 -4
  57. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
  58. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +54 -45
  59. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  60. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +2 -0
  61. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  62. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -1
  63. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  64. package/lib/cjs/components-react.d.ts +9 -0
  65. package/lib/cjs/components-react.d.ts.map +1 -1
  66. package/lib/cjs/components-react.js +9 -0
  67. package/lib/cjs/components-react.js.map +1 -1
  68. package/lib/esm/components-react/common/DateUtils.d.ts +12 -2
  69. package/lib/esm/components-react/common/DateUtils.d.ts.map +1 -1
  70. package/lib/esm/components-react/common/DateUtils.js +12 -2
  71. package/lib/esm/components-react/common/DateUtils.js.map +1 -1
  72. package/lib/esm/components-react/common/SubscriptionScheduler.d.ts +6 -8
  73. package/lib/esm/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
  74. package/lib/esm/components-react/common/SubscriptionScheduler.js +18 -52
  75. package/lib/esm/components-react/common/SubscriptionScheduler.js.map +1 -1
  76. package/lib/esm/components-react/editors/DateTimeEditor.d.ts.map +1 -1
  77. package/lib/esm/components-react/editors/DateTimeEditor.js +2 -0
  78. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  79. package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +36 -0
  80. package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -0
  81. package/lib/esm/components-react/filter-builder/FilterBuilder.js +94 -0
  82. package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -0
  83. package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +11 -0
  84. package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -0
  85. package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +53 -0
  86. package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -0
  87. package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +41 -0
  88. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +29 -0
  89. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -0
  90. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +55 -0
  91. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -0
  92. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +73 -0
  93. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +12 -0
  94. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -0
  95. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +24 -0
  96. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -0
  97. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +11 -0
  98. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -0
  99. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +29 -0
  100. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -0
  101. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -0
  102. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -0
  103. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +20 -0
  104. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -0
  105. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +43 -0
  106. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -0
  107. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +127 -0
  108. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -0
  109. package/lib/esm/components-react/filter-builder/Operators.d.ts +27 -0
  110. package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -0
  111. package/lib/esm/components-react/filter-builder/Operators.js +107 -0
  112. package/lib/esm/components-react/filter-builder/Operators.js.map +1 -0
  113. package/lib/esm/components-react/filter-builder/Types.d.ts +18 -0
  114. package/lib/esm/components-react/filter-builder/Types.d.ts.map +1 -0
  115. package/lib/esm/components-react/filter-builder/Types.js +5 -0
  116. package/lib/esm/components-react/filter-builder/Types.js.map +1 -0
  117. package/lib/esm/components-react/toolbar/Overflow.scss +3 -2
  118. package/lib/esm/components-react/toolbar/PopupItem.scss +4 -5
  119. package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
  120. package/lib/esm/components-react/tree/controlled/TreeHooks.js +6 -9
  121. package/lib/esm/components-react/tree/controlled/TreeHooks.js.map +1 -1
  122. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts +8 -4
  123. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
  124. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +53 -44
  125. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  126. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +2 -0
  127. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  128. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -1
  129. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  130. package/lib/esm/components-react.d.ts +9 -0
  131. package/lib/esm/components-react.d.ts.map +1 -1
  132. package/lib/esm/components-react.js +9 -0
  133. package/lib/esm/components-react.js.map +1 -1
  134. package/lib/public/locales/en/UiComponents.json +16 -0
  135. package/package.json +19 -16
package/CHANGELOG.md CHANGED
@@ -1,6 +1,63 @@
1
1
  # Change Log - @itwin/components-react
2
2
 
3
- This log was last generated on Fri, 20 May 2022 13:10:54 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 18 Aug 2022 19:08:02 GMT and should not be manually modified.
4
+
5
+ ## 3.3.0
6
+ Thu, 18 Aug 2022 19:08:02 GMT
7
+
8
+ ### Updates
9
+
10
+ - upgrade mocha to version 10.0.0
11
+ - Add ability to specify locale and format of Data and Time shown by timeline component.
12
+ - Add children to render inside the node
13
+ - Added 'PropertyFilterBuilder' component for building complex filters using properties list
14
+ - Add support for undefined value in TypeConverter.
15
+ - Avoid creating "NaN" string in numeric type converters.
16
+ - Changed FloatTypeConverter and IntTypeConverter 'convertFromString' method to return 'undefined' if string is no a number.
17
+ - Fix processing of widget container dragging to empty panel.
18
+ - Update iTwinUI-react to 1.38.1
19
+
20
+ ## 3.2.8
21
+ Tue, 09 Aug 2022 15:52:41 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 3.2.7
26
+ Mon, 01 Aug 2022 13:36:56 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 3.2.6
31
+ Fri, 15 Jul 2022 19:04:43 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 3.2.5
36
+ Wed, 13 Jul 2022 15:45:52 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 3.2.4
41
+ Tue, 21 Jun 2022 18:06:33 GMT
42
+
43
+ _Version update only_
44
+
45
+ ## 3.2.3
46
+ Fri, 17 Jun 2022 15:18:39 GMT
47
+
48
+ _Version update only_
49
+
50
+ ## 3.2.2
51
+ Fri, 10 Jun 2022 16:11:36 GMT
52
+
53
+ ### Updates
54
+
55
+ - Fix `useTreeModel` returning stale model for the given model source
56
+
57
+ ## 3.2.1
58
+ Tue, 07 Jun 2022 15:02:56 GMT
59
+
60
+ _Version update only_
4
61
 
5
62
  ## 3.2.0
6
63
  Fri, 20 May 2022 13:10:54 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;AAC9D,iFAA8E;AAC9E,6DAA0D;AAC1D,+DAA4D;AAC5D,qEAAkE;AAClE,iEAA8D;AAC9D,uDAA6D;AAC7D,yDAA+D;AAC/D,mDAAgD;AAEhD,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAa,qBAAqB;IAOhC;QANA,oDAAoD;QAC5C,0BAAqB,GAAG,IAAI,GAAG,EAAgC,CAAC;QAExE,uDAAuD;QAC/C,eAAU,GAAG,IAAI,iBAAO,EAA4B,CAAC;QAG3D,IAAI,CAAC,UAAU;aACZ,IAAI;QACH,iDAAiD;QACjD,IAAA,mBAAQ,EACN,CAAC,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI;QACzC,yBAAyB;QACzB,IAAA,mBAAQ,GAAE;QACV,wEAAwE;QACxE,iEAAiE;QACjE,+CAA+C;QAC/C,IAAA,qBAAS,EAAC,sBAAc,CAAC;QACzB,sGAAsG;QACtG,IAAA,yBAAW,EAAC,oBAAa,CAAC;QAC1B,0GAA0G;QAC1G,IAAA,qCAAiB,GAAE,CACpB,EACD,4BAA4B,CAC7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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":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,0DAAuD;AACvD,0DAAuD;AACvD,sDAAmD;AACnD,+DAA4D;AAC5D,+DAA4D;AAC5D,iEAA8D;AAC9D,iFAA8E;AAC9E,6DAA0D;AAC1D,+DAA4D;AAC5D,qEAAkE;AAClE,uDAA6D;AAC7D,yDAA+D;AAC/D,mDAAgD;AAEhD,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAa,qBAAqB;IAGhC;QAFQ,eAAU,GAAG,IAAI,iBAAO,EAA4B,CAAC;QAG3D,IAAI,CAAC,UAAU;aACZ,IAAI,CACH,IAAA,mBAAQ,EACN,CAAC,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI;QACzC,yBAAyB;QACzB,IAAA,mBAAQ,GAAE;QACV,0GAA0G;QAC1G,4EAA4E;QAC5E,IAAA,qBAAS,EAAC,sBAAc,CAAC;QACzB,qDAAqD;QACrD,IAAA,yBAAW,EAAC,oBAAa,CAAC;QAC1B,gFAAgF;QAChF,IAAA,qCAAiB,GAAE,CACpB,EACD,4BAA4B,CAC7B,CACF;YACD,wCAAwC;aACvC,SAAS,EAAE,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACI,oBAAoB,CAAC,MAAqB;QAC/C,OAAO,IAAA,aAAK,EAAC,GAAG,EAAE;YAChB,IAAI,YAAY,GAAG,KAAK,CAAC;YACzB,4GAA4G;YAC5G,MAAM,qBAAqB,GAAG,IAAA,SAAG,EAAC,GAAG,EAAE,CAAC,YAAY,EAAE,aAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAO,GAAE,CAA6B,CAAC;YACjH,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAC5C,OAAO,qBAAqB,CAAC,IAAI,CAAC,IAAA,mBAAQ,EAAC,GAAG,EAAE,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACiB,aAAa,EAA0C,WAAW,EACzF,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAyB,MAAM,yBAAyB,CAAC;AAGpF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAS5D,gBAAgB;AAChB,UAAU,mBAAmB;IAC3B,KAAK,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAChB,UAAU,mBAAoB,SAAQ,mBAAmB;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,mBAAmB,CAAE,YAAW,UAAU;IACrH,OAA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jC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IA+F/B,OAAO,CAAC,YAAY,CAGlB;IAEF,OAAO,CAAC,YAAY,CAQlB;IAEF,OAAO,CAAC,SAAS,CAEf;IAEF,OAAO,CAAC,aAAa,CAKnB;IAEF,OAAO,CAAC,aAAa,CASnB;IAEF,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CAgC1C;AAED;;;IAGI;AACJ,qBAAa,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IAED,IAAoB,mBAAmB,IAAI,OAAO,CAEjD;CACF;AAED;;;IAGI;AACJ,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IAED,IAAoB,mBAAmB,IAAI,OAAO,CAEjD;CACF"}
@@ -180,6 +180,8 @@ class DateTimeEditor extends React.PureComponent {
180
180
  initialValue = new Date(record.value.value);
181
181
  else if (typeof record.value.value === "string")
182
182
  initialValue = new Date(record.value.value);
183
+ else if (record.value.value === undefined)
184
+ initialValue = new Date();
183
185
  typeConverter = TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, (_a = record.property.converter) === null || _a === void 0 ? void 0 : _a.name);
184
186
  const options = (_b = record.property.converter) === null || _b === void 0 ? void 0 : _b.options;
185
187
  if (options) {
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAE+B;AAE/B,mEAAoF;AACpF,+CAAgF;AAChF,uDAA8D;AAE9D,yDAAsD;AACtD,6EAA0E;AAC1E,+EAAgF;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kEAQC;AAED;;;IAGI;AACJ,MAAa,sBAAuB,SAAQ,0CAAkB;IAC5D,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAC;IAC5C,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,wDAQC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;AAC/F,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,QAAQ,EAAE,sBAAsB,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 PropertyEditors\r\n */\r\n\r\nimport \"./DateTimeEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n AlternateDateFormats, PropertyValue, PropertyValueFormat, StandardTypeNames, TimeDisplay,\r\n} from \"@itwin/appui-abstract\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\r\nimport { TimeField, TimeSpec } from \"../datepicker/TimeField\";\r\nimport { TypeConverter } from \"../converters/TypeConverter\";\r\nimport { DatePicker } from \"../datepicker/DatePicker\";\r\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\r\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter\";\r\nimport { BodyText } from \"@itwin/core-react\";\r\nimport { adjustDateToTimezone } from \"../common/DateUtils\";\r\n\r\n// cSpell:ignore datepicker\r\n\r\n/** @internal */\r\ninterface DateTimeEditorState {\r\n value: Date;\r\n displayValue?: string;\r\n timeDisplay?: TimeDisplay;\r\n isDisabled?: boolean;\r\n typeConverter?: TypeConverter;\r\n editInUtc: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface DateTimeEditorProps extends PropertyEditorProps {\r\n showTime?: boolean;\r\n}\r\n\r\n/** DateTimeEditor React component that is a property editor for selection of date and time.\r\n * @internal\r\n */\r\nexport class DateTimeEditor extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState> implements TypeEditor {\r\n private _isMounted = false;\r\n private _enterKey = false;\r\n private _divElement = React.createRef<HTMLDivElement>();\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<DateTimeEditorState> = {\r\n value: new Date(),\r\n editInUtc: false,\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: this.state.value,\r\n displayValue: this.state.displayValue,\r\n };\r\n }\r\n\r\n return propertyValue;\r\n }\r\n\r\n public get htmlElement(): HTMLElement | null {\r\n return this._divElement.current;\r\n }\r\n\r\n public get hasFocus(): boolean {\r\n let containsFocus = false;\r\n // istanbul ignore else\r\n if (this.htmlElement)\r\n containsFocus = this.htmlElement.contains(document.activeElement);\r\n return containsFocus;\r\n }\r\n\r\n public async processDateChange(typeConverter: TypeConverter, newValue: Date): Promise<void> {\r\n // istanbul ignore else\r\n if (this.props.propertyRecord) {\r\n const displayValue = await typeConverter.convertPropertyToString(this.props.propertyRecord.property, newValue);\r\n this.setState({\r\n value: newValue,\r\n displayValue,\r\n });\r\n }\r\n }\r\n\r\n private _handleChange = (newValue: Date): void => {\r\n // istanbul ignore else\r\n if (this._isMounted && this.state.typeConverter) {\r\n // istanbul ignore else\r\n if (this.state.editInUtc) {\r\n newValue = adjustDateToTimezone(newValue, newValue.getTimezoneOffset() * -1);\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.processDateChange(this.state.typeConverter, newValue);\r\n }\r\n };\r\n\r\n private _handleTimeChange = (time: TimeSpec): void => {\r\n // Combine new time into selected Date\r\n if (this.state.editInUtc) {\r\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\r\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\r\n this._handleChange(newWorkingDate);\r\n } else {\r\n const newWorkingDate = new Date(this.state.value.getTime());\r\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\r\n this._handleChange(newWorkingDate);\r\n }\r\n };\r\n\r\n /** @internal */\r\n public override componentDidMount() {\r\n this._isMounted = true;\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n this._isMounted = false;\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\r\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n\r\n private async setStateFromProps() {\r\n const record = this.props.propertyRecord;\r\n let initialValue: Date | undefined;\r\n let typeConverter: TypeConverter | undefined;\r\n let timeDisplay: TimeDisplay | undefined;\r\n let alternateDateFormat = AlternateDateFormats.None;\r\n let editInUtc = false;\r\n\r\n // istanbul ignore else\r\n if (this.props.showTime)\r\n timeDisplay = TimeDisplay.H12MC;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n // istanbul ignore else\r\n if (record.value.value instanceof Date)\r\n initialValue = new Date(record.value.value);\r\n else if (typeof record.value.value === \"string\")\r\n initialValue = new Date(record.value.value);\r\n\r\n typeConverter = TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name);\r\n\r\n const options = record.property.converter?.options;\r\n if (options) {\r\n // istanbul ignore else\r\n if (\"alternateDateFormat\" in options) {\r\n // istanbul ignore else\r\n if (DateTimeTypeConverterBase.isAlternateDateFormats(options.alternateDateFormat)) {\r\n timeDisplay = TimeDisplay.H24MS;\r\n alternateDateFormat = options.alternateDateFormat;\r\n }\r\n }\r\n\r\n if (\"timeDisplay\" in options && this.props.showTime) {\r\n timeDisplay = options.timeDisplay;\r\n // use 24 hr time display if alternateDateFormat is defined\r\n // istanbul ignore next\r\n if (alternateDateFormat && timeDisplay !== TimeDisplay.H24MS && timeDisplay !== TimeDisplay.H24M)\r\n timeDisplay = TimeDisplay.H24MS;\r\n }\r\n\r\n // istanbul ignore else\r\n if (alternateDateFormat) {\r\n editInUtc = true;\r\n\r\n if (this.props.showTime) {\r\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\r\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\r\n }\r\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\r\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\r\n }\r\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\r\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\r\n }\r\n } else {\r\n timeDisplay = undefined;\r\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\r\n alternateDateFormat = AlternateDateFormats.IsoShort;\r\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\r\n alternateDateFormat = AlternateDateFormats.UtcShort;\r\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\r\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // istanbul ignore next\r\n if (!initialValue) {\r\n throw new Error(\"Bad Value\");\r\n }\r\n\r\n // istanbul ignore next\r\n if (!typeConverter) {\r\n throw new Error(\"Unable to determine TypeConverter\");\r\n }\r\n\r\n const isDisabled = record && !!record.isDisabled;\r\n const displayValue = await typeConverter.convertPropertyToString(record!.property, initialValue);\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({\r\n value: initialValue,\r\n isDisabled,\r\n timeDisplay,\r\n typeConverter,\r\n displayValue,\r\n editInUtc,\r\n });\r\n }\r\n\r\n private _handleEnter = async (): Promise<void> => {\r\n this._enterKey = true;\r\n await this._handleCommit();\r\n };\r\n\r\n private _handleClose = async (): Promise<void> => {\r\n if (this._enterKey) {\r\n this._enterKey = false;\r\n } else {\r\n // istanbul ignore next\r\n if (this.props.onCancel)\r\n this.props.onCancel();\r\n }\r\n };\r\n\r\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\r\n await this._handleCommit();\r\n };\r\n\r\n private _handleCancel = (_event: React.MouseEvent): void => {\r\n // istanbul ignore else\r\n if (this.props.onCancel) {\r\n this.props.onCancel();\r\n }\r\n };\r\n\r\n private _handleCommit = async (): Promise<void> => {\r\n // istanbul ignore else\r\n if (this.props.propertyRecord && this.props.onCommit) {\r\n const propertyValue = await this.getPropertyValue();\r\n // istanbul ignore else\r\n if (propertyValue !== undefined) {\r\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\r\n }\r\n }\r\n };\r\n\r\n /** @internal */\r\n public override render(): React.ReactNode {\r\n const date = this.state.editInUtc ? adjustDateToTimezone(this.state.value, 0) : this.state.value;\r\n const timeSpec: TimeSpec = {\r\n hours: date.getHours(),\r\n minutes: date.getMinutes(),\r\n seconds: date.getSeconds(),\r\n };\r\n\r\n const className = classnames(\"components-cell-editor\", \"components-datetime-editor\", this.props.className);\r\n\r\n return (\r\n <div className={className} ref={this._divElement}>\r\n <PopupButton label={this.state.displayValue} onClose={this._handleClose} onEnter={this._handleEnter}\r\n setFocus={this.props.setFocus}>\r\n <PopupContent>\r\n <>\r\n <div className=\"components-date-picker-calendar-popup-panel\" data-testid=\"components-date-picker-calendar-popup-panel\">\r\n <DatePicker selected={date} onDateChange={this._handleChange} showFocusOutline={false} />\r\n {this.state.timeDisplay &&\r\n <div className=\"time-container\">\r\n <BodyText className=\"time-label\">{\"Time\"}</BodyText>\r\n <TimeField time={timeSpec} timeDisplay={this.state.timeDisplay} onTimeChange={this._handleTimeChange} />\r\n </div>\r\n }\r\n </div>\r\n </>\r\n <PopupOkCancelButtons onOk={this._handleOk} onCancel={this._handleCancel} />\r\n </PopupContent>\r\n </PopupButton>\r\n </div>\r\n );\r\n }\r\n}\r\n\r\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\r\n * It uses the [[DateTimeEditor]] React component.\r\n * @internal\r\n */\r\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\r\n public get reactNode(): React.ReactNode {\r\n return <DateTimeEditor showTime={false} />;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesTab(): boolean {\r\n return false;\r\n }\r\n}\r\n\r\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\r\n * It uses the [[DateTimeEditor]] React component.\r\n * @internal\r\n */\r\nexport class DateTimePropertyEditor extends PropertyEditorBase {\r\n public get reactNode(): React.ReactNode {\r\n return <DateTimeEditor showTime={true} />;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesTab(): boolean {\r\n return false;\r\n }\r\n}\r\n\r\nPropertyEditorManager.registerEditor(StandardTypeNames.ShortDate, ShortDateTimePropertyEditor);\r\nPropertyEditorManager.registerEditor(StandardTypeNames.DateTime, DateTimePropertyEditor);\r\n"]}
1
+ {"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAE+B;AAE/B,mEAAoF;AACpF,+CAAgF;AAChF,uDAA8D;AAE9D,yDAAsD;AACtD,6EAA0E;AAC1E,+EAAgF;AAChF,kDAA6C;AAC7C,mDAA2D;AAmB3D;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAAuD;IAAjG;;QACU,eAAU,GA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;;IAGI;AACJ,MAAa,sBAAuB,SAAQ,0CAAkB;IAC5D,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAC;IAC5C,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,wDAQC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;AAC/F,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,QAAQ,EAAE,sBAAsB,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 PropertyEditors\r\n */\r\n\r\nimport \"./DateTimeEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n AlternateDateFormats, PropertyValue, PropertyValueFormat, StandardTypeNames, TimeDisplay,\r\n} from \"@itwin/appui-abstract\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\r\nimport { TimeField, TimeSpec } from \"../datepicker/TimeField\";\r\nimport { TypeConverter } from \"../converters/TypeConverter\";\r\nimport { DatePicker } from \"../datepicker/DatePicker\";\r\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\r\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter\";\r\nimport { BodyText } from \"@itwin/core-react\";\r\nimport { adjustDateToTimezone } from \"../common/DateUtils\";\r\n\r\n// cSpell:ignore datepicker\r\n\r\n/** @internal */\r\ninterface DateTimeEditorState {\r\n value: Date;\r\n displayValue?: string;\r\n timeDisplay?: TimeDisplay;\r\n isDisabled?: boolean;\r\n typeConverter?: TypeConverter;\r\n editInUtc: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface DateTimeEditorProps extends PropertyEditorProps {\r\n showTime?: boolean;\r\n}\r\n\r\n/** DateTimeEditor React component that is a property editor for selection of date and time.\r\n * @internal\r\n */\r\nexport class DateTimeEditor extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState> implements TypeEditor {\r\n private _isMounted = false;\r\n private _enterKey = false;\r\n private _divElement = React.createRef<HTMLDivElement>();\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<DateTimeEditorState> = {\r\n value: new Date(),\r\n editInUtc: false,\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: this.state.value,\r\n displayValue: this.state.displayValue,\r\n };\r\n }\r\n\r\n return propertyValue;\r\n }\r\n\r\n public get htmlElement(): HTMLElement | null {\r\n return this._divElement.current;\r\n }\r\n\r\n public get hasFocus(): boolean {\r\n let containsFocus = false;\r\n // istanbul ignore else\r\n if (this.htmlElement)\r\n containsFocus = this.htmlElement.contains(document.activeElement);\r\n return containsFocus;\r\n }\r\n\r\n public async processDateChange(typeConverter: TypeConverter, newValue: Date): Promise<void> {\r\n // istanbul ignore else\r\n if (this.props.propertyRecord) {\r\n const displayValue = await typeConverter.convertPropertyToString(this.props.propertyRecord.property, newValue);\r\n this.setState({\r\n value: newValue,\r\n displayValue,\r\n });\r\n }\r\n }\r\n\r\n private _handleChange = (newValue: Date): void => {\r\n // istanbul ignore else\r\n if (this._isMounted && this.state.typeConverter) {\r\n // istanbul ignore else\r\n if (this.state.editInUtc) {\r\n newValue = adjustDateToTimezone(newValue, newValue.getTimezoneOffset() * -1);\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.processDateChange(this.state.typeConverter, newValue);\r\n }\r\n };\r\n\r\n private _handleTimeChange = (time: TimeSpec): void => {\r\n // Combine new time into selected Date\r\n if (this.state.editInUtc) {\r\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\r\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\r\n this._handleChange(newWorkingDate);\r\n } else {\r\n const newWorkingDate = new Date(this.state.value.getTime());\r\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\r\n this._handleChange(newWorkingDate);\r\n }\r\n };\r\n\r\n /** @internal */\r\n public override componentDidMount() {\r\n this._isMounted = true;\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n this._isMounted = false;\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\r\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n\r\n private async setStateFromProps() {\r\n const record = this.props.propertyRecord;\r\n let initialValue: Date | undefined;\r\n let typeConverter: TypeConverter | undefined;\r\n let timeDisplay: TimeDisplay | undefined;\r\n let alternateDateFormat = AlternateDateFormats.None;\r\n let editInUtc = false;\r\n\r\n // istanbul ignore else\r\n if (this.props.showTime)\r\n timeDisplay = TimeDisplay.H12MC;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n // istanbul ignore else\r\n if (record.value.value instanceof Date)\r\n initialValue = new Date(record.value.value);\r\n else if (typeof record.value.value === \"string\")\r\n initialValue = new Date(record.value.value);\r\n else if (record.value.value === undefined)\r\n initialValue = new Date();\r\n\r\n typeConverter = TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name);\r\n\r\n const options = record.property.converter?.options;\r\n if (options) {\r\n // istanbul ignore else\r\n if (\"alternateDateFormat\" in options) {\r\n // istanbul ignore else\r\n if (DateTimeTypeConverterBase.isAlternateDateFormats(options.alternateDateFormat)) {\r\n timeDisplay = TimeDisplay.H24MS;\r\n alternateDateFormat = options.alternateDateFormat;\r\n }\r\n }\r\n\r\n if (\"timeDisplay\" in options && this.props.showTime) {\r\n timeDisplay = options.timeDisplay;\r\n // use 24 hr time display if alternateDateFormat is defined\r\n // istanbul ignore next\r\n if (alternateDateFormat && timeDisplay !== TimeDisplay.H24MS && timeDisplay !== TimeDisplay.H24M)\r\n timeDisplay = TimeDisplay.H24MS;\r\n }\r\n\r\n // istanbul ignore else\r\n if (alternateDateFormat) {\r\n editInUtc = true;\r\n\r\n if (this.props.showTime) {\r\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\r\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\r\n }\r\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\r\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\r\n }\r\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\r\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\r\n }\r\n } else {\r\n timeDisplay = undefined;\r\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\r\n alternateDateFormat = AlternateDateFormats.IsoShort;\r\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\r\n alternateDateFormat = AlternateDateFormats.UtcShort;\r\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\r\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // istanbul ignore next\r\n if (!initialValue) {\r\n throw new Error(\"Bad Value\");\r\n }\r\n\r\n // istanbul ignore next\r\n if (!typeConverter) {\r\n throw new Error(\"Unable to determine TypeConverter\");\r\n }\r\n\r\n const isDisabled = record && !!record.isDisabled;\r\n const displayValue = await typeConverter.convertPropertyToString(record!.property, initialValue);\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({\r\n value: initialValue,\r\n isDisabled,\r\n timeDisplay,\r\n typeConverter,\r\n displayValue,\r\n editInUtc,\r\n });\r\n }\r\n\r\n private _handleEnter = async (): Promise<void> => {\r\n this._enterKey = true;\r\n await this._handleCommit();\r\n };\r\n\r\n private _handleClose = async (): Promise<void> => {\r\n if (this._enterKey) {\r\n this._enterKey = false;\r\n } else {\r\n // istanbul ignore next\r\n if (this.props.onCancel)\r\n this.props.onCancel();\r\n }\r\n };\r\n\r\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\r\n await this._handleCommit();\r\n };\r\n\r\n private _handleCancel = (_event: React.MouseEvent): void => {\r\n // istanbul ignore else\r\n if (this.props.onCancel) {\r\n this.props.onCancel();\r\n }\r\n };\r\n\r\n private _handleCommit = async (): Promise<void> => {\r\n // istanbul ignore else\r\n if (this.props.propertyRecord && this.props.onCommit) {\r\n const propertyValue = await this.getPropertyValue();\r\n // istanbul ignore else\r\n if (propertyValue !== undefined) {\r\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\r\n }\r\n }\r\n };\r\n\r\n /** @internal */\r\n public override render(): React.ReactNode {\r\n const date = this.state.editInUtc ? adjustDateToTimezone(this.state.value, 0) : this.state.value;\r\n const timeSpec: TimeSpec = {\r\n hours: date.getHours(),\r\n minutes: date.getMinutes(),\r\n seconds: date.getSeconds(),\r\n };\r\n\r\n const className = classnames(\"components-cell-editor\", \"components-datetime-editor\", this.props.className);\r\n\r\n return (\r\n <div className={className} ref={this._divElement}>\r\n <PopupButton label={this.state.displayValue} onClose={this._handleClose} onEnter={this._handleEnter}\r\n setFocus={this.props.setFocus}>\r\n <PopupContent>\r\n <>\r\n <div className=\"components-date-picker-calendar-popup-panel\" data-testid=\"components-date-picker-calendar-popup-panel\">\r\n <DatePicker selected={date} onDateChange={this._handleChange} showFocusOutline={false} />\r\n {this.state.timeDisplay &&\r\n <div className=\"time-container\">\r\n <BodyText className=\"time-label\">{\"Time\"}</BodyText>\r\n <TimeField time={timeSpec} timeDisplay={this.state.timeDisplay} onTimeChange={this._handleTimeChange} />\r\n </div>\r\n }\r\n </div>\r\n </>\r\n <PopupOkCancelButtons onOk={this._handleOk} onCancel={this._handleCancel} />\r\n </PopupContent>\r\n </PopupButton>\r\n </div>\r\n );\r\n }\r\n}\r\n\r\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\r\n * It uses the [[DateTimeEditor]] React component.\r\n * @internal\r\n */\r\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\r\n public get reactNode(): React.ReactNode {\r\n return <DateTimeEditor showTime={false} />;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesTab(): boolean {\r\n return false;\r\n }\r\n}\r\n\r\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\r\n * It uses the [[DateTimeEditor]] React component.\r\n * @internal\r\n */\r\nexport class DateTimePropertyEditor extends PropertyEditorBase {\r\n public get reactNode(): React.ReactNode {\r\n return <DateTimeEditor showTime={true} />;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesTab(): boolean {\r\n return false;\r\n }\r\n}\r\n\r\nPropertyEditorManager.registerEditor(StandardTypeNames.ShortDate, ShortDateTimePropertyEditor);\r\nPropertyEditorManager.registerEditor(StandardTypeNames.DateTime, DateTimePropertyEditor);\r\n"]}
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ import { PropertyDescription } from "@itwin/appui-abstract";
3
+ import { PropertyFilterBuilderRuleOperatorProps } from "./FilterBuilderRuleOperator";
4
+ import { PropertyFilterBuilderRuleValueProps } from "./FilterBuilderRuleValue";
5
+ import { PropertyFilterBuilderActions, PropertyFilterBuilderRuleGroupItem } from "./FilterBuilderState";
6
+ import { PropertyFilter } from "./Types";
7
+ /** @alpha */
8
+ export interface PropertyFilterBuilderProps {
9
+ properties: PropertyDescription[];
10
+ onFilterChanged: (filter?: PropertyFilter) => void;
11
+ onRulePropertySelected?: (property: PropertyDescription) => void;
12
+ ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;
13
+ ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;
14
+ ruleGroupDepthLimit?: number;
15
+ }
16
+ /** @alpha */
17
+ export interface PropertyFilterBuilderContextProps {
18
+ actions: PropertyFilterBuilderActions;
19
+ properties: PropertyDescription[];
20
+ onRulePropertySelected?: (property: PropertyDescription) => void;
21
+ ruleGroupDepthLimit?: number;
22
+ }
23
+ /** @alpha */
24
+ export declare const PropertyFilterBuilderContext: React.Context<PropertyFilterBuilderContextProps>;
25
+ /** @alpha */
26
+ export interface PropertyFilterBuilderRuleRenderingContextProps {
27
+ ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;
28
+ ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;
29
+ }
30
+ /** @alpha */
31
+ export declare const PropertyFilterBuilderRuleRenderingContext: React.Context<PropertyFilterBuilderRuleRenderingContextProps>;
32
+ /** @alpha */
33
+ export declare function PropertyFilterBuilder(props: PropertyFilterBuilderProps): JSX.Element;
34
+ /** @internal */
35
+ export declare function buildPropertyFilter(groupItem: PropertyFilterBuilderRuleGroupItem): PropertyFilter | undefined;
36
+ //# sourceMappingURL=FilterBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterBuilder.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAuB,MAAM,uBAAuB,CAAC;AAEjF,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAC6B,4BAA4B,EAC9D,kCAAkC,EACnC,MAAM,sBAAsB,CAAC;AAE9B,OAAO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