@itwin/components-react 3.3.0-dev.6 → 3.3.0-dev.62
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.
- package/CHANGELOG.md +31 -1
- package/lib/cjs/components-react/common/DateUtils.d.ts +12 -2
- package/lib/cjs/components-react/common/DateUtils.d.ts.map +1 -1
- package/lib/cjs/components-react/common/DateUtils.js +14 -4
- package/lib/cjs/components-react/common/DateUtils.js.map +1 -1
- package/lib/cjs/components-react/common/SubscriptionScheduler.d.ts +6 -8
- package/lib/cjs/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
- package/lib/cjs/components-react/common/SubscriptionScheduler.js +18 -52
- package/lib/cjs/components-react/common/SubscriptionScheduler.js.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.d.ts +4 -2
- package/lib/cjs/components-react/converters/NumericTypeConverter.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.js +14 -4
- package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.js +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js +3 -3
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.js +5 -8
- package/lib/cjs/components-react/tree/controlled/TreeHooks.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts +8 -4
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +54 -45
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +2 -0
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/components-react/common/DateUtils.d.ts +12 -2
- package/lib/esm/components-react/common/DateUtils.d.ts.map +1 -1
- package/lib/esm/components-react/common/DateUtils.js +12 -2
- package/lib/esm/components-react/common/DateUtils.js.map +1 -1
- package/lib/esm/components-react/common/SubscriptionScheduler.d.ts +6 -8
- package/lib/esm/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
- package/lib/esm/components-react/common/SubscriptionScheduler.js +18 -52
- package/lib/esm/components-react/common/SubscriptionScheduler.js.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.d.ts +4 -2
- package/lib/esm/components-react/converters/NumericTypeConverter.d.ts.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.js +14 -4
- package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverter.js +1 -1
- package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js +3 -3
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.js +6 -9
- package/lib/esm/components-react/tree/controlled/TreeHooks.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts +8 -4
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +53 -44
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +2 -0
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/package.json +16 -16
|
@@ -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
|
|
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"}
|
|
@@ -40,20 +40,30 @@ export function adjustDateToTimezone(inDateTime, utcOffset) {
|
|
|
40
40
|
* Format a date in a display string, optionally converting to time zone, if specified by timeZoneOffset
|
|
41
41
|
* @param date Date object to format
|
|
42
42
|
* @param timeZoneOffset optional: offset from UTC to use for conversion
|
|
43
|
+
* @param formatOptions optional: allow locale and format for output Date string. If not defined current locale options are used.
|
|
43
44
|
* @returns formatted date string
|
|
44
45
|
* @public
|
|
45
46
|
*/
|
|
46
|
-
export const toDateString = (date, timeZoneOffset) => {
|
|
47
|
+
export const toDateString = (date, timeZoneOffset, formatOptions) => {
|
|
48
|
+
if (formatOptions) {
|
|
49
|
+
return undefined === timeZoneOffset ? date.toLocaleDateString(formatOptions.locales, formatOptions.options) :
|
|
50
|
+
adjustDateToTimezone(date, timeZoneOffset).toLocaleDateString(formatOptions.locales, formatOptions.options);
|
|
51
|
+
}
|
|
47
52
|
return undefined === timeZoneOffset ? date.toLocaleDateString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleDateString();
|
|
48
53
|
};
|
|
49
54
|
/**
|
|
50
55
|
* Format the time included in a date, optionally converting to time zone, if specified
|
|
51
56
|
* @param date Date object
|
|
52
57
|
* @param timeZoneOffset optional: offset from UTC to use for conversion
|
|
58
|
+
* @param formatOptions optional: allow locale and format for output Time string. If not defined current locale options are used.
|
|
53
59
|
* @returns formatted time string
|
|
54
60
|
* @public
|
|
55
61
|
*/
|
|
56
|
-
export const toTimeString = (date, timeZoneOffset) => {
|
|
62
|
+
export const toTimeString = (date, timeZoneOffset, formatOptions) => {
|
|
63
|
+
if (formatOptions) {
|
|
64
|
+
return undefined === timeZoneOffset ? date.toLocaleTimeString(formatOptions.locales, formatOptions.options) :
|
|
65
|
+
adjustDateToTimezone(date, timeZoneOffset).toLocaleTimeString(formatOptions.locales, formatOptions.options);
|
|
66
|
+
}
|
|
57
67
|
return undefined === timeZoneOffset ? date.toLocaleTimeString() : adjustDateToTimezone(date, timeZoneOffset).toLocaleTimeString();
|
|
58
68
|
};
|
|
59
69
|
//# sourceMappingURL=DateUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateUtils.js","sourceRoot":"","sources":["../../../../src/components-react/common/DateUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;
|
|
1
|
+
{"version":3,"file":"DateUtils.js","sourceRoot":"","sources":["../../../../src/components-react/common/DateUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAWH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2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AAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpI,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 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
|
-
*
|
|
6
|
+
* Limits concurrent observable subscriptions to one.
|
|
7
7
|
*
|
|
8
|
-
* Scheduled observables are placed at the end of a queue.
|
|
9
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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;
|
|
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"}
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Common
|
|
7
7
|
*/
|
|
8
|
-
import { BehaviorSubject } from "rxjs/internal/BehaviorSubject";
|
|
9
8
|
import { defer } from "rxjs/internal/observable/defer";
|
|
9
|
+
import { EMPTY } from "rxjs/internal/observable/empty";
|
|
10
|
+
import { iif } from "rxjs/internal/observable/iif";
|
|
10
11
|
import { finalize } from "rxjs/internal/operators/finalize";
|
|
11
12
|
import { mergeMap } from "rxjs/internal/operators/mergeMap";
|
|
12
13
|
import { observeOn } from "rxjs/internal/operators/observeOn";
|
|
@@ -14,87 +15,52 @@ import { onErrorResumeNext } from "rxjs/internal/operators/onErrorResumeNext";
|
|
|
14
15
|
import { publish } from "rxjs/internal/operators/publish";
|
|
15
16
|
import { refCount } from "rxjs/internal/operators/refCount";
|
|
16
17
|
import { subscribeOn } from "rxjs/internal/operators/subscribeOn";
|
|
17
|
-
import { switchAll } from "rxjs/internal/operators/switchAll";
|
|
18
18
|
import { asapScheduler } from "rxjs/internal/scheduler/asap";
|
|
19
19
|
import { queueScheduler } from "rxjs/internal/scheduler/queue";
|
|
20
20
|
import { Subject } from "rxjs/internal/Subject";
|
|
21
21
|
const MAX_CONCURRENT_SUBSCRIPTIONS = 1;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Limits concurrent observable subscriptions to one.
|
|
24
24
|
*
|
|
25
|
-
* Scheduled observables are placed at the end of a queue.
|
|
26
|
-
*
|
|
27
|
-
* either complete or get unscheduled before removing them from the queue.
|
|
25
|
+
* Scheduled observables are placed at the end of a queue. Each queued observable is subscribed to and awaited until the
|
|
26
|
+
* completion.
|
|
28
27
|
*
|
|
29
28
|
* To schedule an observable, subscribe to the result of `scheduleSubscription()` call.
|
|
30
29
|
* @internal
|
|
31
30
|
*/
|
|
32
31
|
export class SubscriptionScheduler {
|
|
33
32
|
constructor() {
|
|
34
|
-
// Maps source observables to scheduled observables.
|
|
35
|
-
this._scheduledObservables = new Map();
|
|
36
|
-
// Subject that does the actual subscription scheduling
|
|
37
33
|
this._scheduler = new Subject();
|
|
38
34
|
this._scheduler
|
|
39
|
-
.pipe(
|
|
40
|
-
// Process all observables one by one in sequence
|
|
41
|
-
mergeMap((sourceObservable) => sourceObservable.pipe(
|
|
35
|
+
.pipe(mergeMap((sourceObservable) => sourceObservable.pipe(
|
|
42
36
|
// Connect the observable
|
|
43
37
|
refCount(),
|
|
44
|
-
// Guard against stack overflow when a lot of observables are scheduled.
|
|
45
|
-
//
|
|
46
|
-
// that is present in the pipeline recursively.
|
|
38
|
+
// Guard against stack overflow when a lot of observables are scheduled. Without this operation `mergeMap`
|
|
39
|
+
// will process each observable that is present in the pipeline recursively.
|
|
47
40
|
observeOn(queueScheduler),
|
|
48
|
-
//
|
|
41
|
+
// Delay the connection until another event loop task
|
|
49
42
|
subscribeOn(asapScheduler),
|
|
50
|
-
//
|
|
43
|
+
// Ignore errors in this pipeline without suppressing them for other subscribers
|
|
51
44
|
onErrorResumeNext()), MAX_CONCURRENT_SUBSCRIPTIONS))
|
|
52
|
-
// Start
|
|
45
|
+
// Start consuming scheduled observables
|
|
53
46
|
.subscribe();
|
|
54
47
|
}
|
|
55
48
|
/**
|
|
56
49
|
* Schedules `source` for subscription in the current scheduler.
|
|
57
50
|
*
|
|
58
|
-
* The actual scheduling is performed when the returned observable is subscribed to.
|
|
59
|
-
*
|
|
51
|
+
* The actual scheduling is performed when the returned observable is subscribed to. To cancel, remove all subscribers
|
|
52
|
+
* from the returned observable.
|
|
60
53
|
*
|
|
61
54
|
* @param source Input observable for which to schedule a subscription.
|
|
62
|
-
* @returns
|
|
55
|
+
* @returns Hot observable which starts emitting `source` values after subscription.
|
|
63
56
|
*/
|
|
64
57
|
scheduleSubscription(source) {
|
|
65
|
-
// On subscription, determine which observable to return
|
|
66
58
|
return defer(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return scheduledObservable;
|
|
71
|
-
}
|
|
72
|
-
// Create a subject which emits observable sources
|
|
73
|
-
const sourceSubject = new BehaviorSubject(source.pipe(
|
|
74
|
-
// When source completes, allow scheduler to move on to the next observable
|
|
75
|
-
finalize(() => {
|
|
76
|
-
sourceSubject.complete();
|
|
77
|
-
})));
|
|
78
|
-
// Create an observable which will be passed to the scheduler
|
|
79
|
-
const connectableObservable = publish()(sourceSubject.pipe(
|
|
80
|
-
// Unsubscribe from previous observable before subscribing to the next one
|
|
81
|
-
switchAll()));
|
|
82
|
-
// Create an observable which will be cached and returned
|
|
83
|
-
scheduledObservable = connectableObservable.pipe(finalize(() => {
|
|
84
|
-
// Invalidate cached scheduled observable
|
|
85
|
-
this._scheduledObservables.delete(source);
|
|
86
|
-
// Allow scheduler to move on to the next observable
|
|
87
|
-
sourceSubject.complete();
|
|
88
|
-
}),
|
|
89
|
-
// Multicast values
|
|
90
|
-
publish(),
|
|
91
|
-
// Dispose the shared subscription when there are no subscribers left
|
|
92
|
-
refCount());
|
|
93
|
-
// Cache the scheduled observable
|
|
94
|
-
this._scheduledObservables.set(source, scheduledObservable);
|
|
95
|
-
// Schedule the subscription
|
|
59
|
+
let unsubscribed = false;
|
|
60
|
+
// Do not subscribe to source observable if it was unsubscribed from before being processed by the scheduler
|
|
61
|
+
const connectableObservable = iif(() => unsubscribed, EMPTY, source).pipe(publish());
|
|
96
62
|
this._scheduler.next(connectableObservable);
|
|
97
|
-
return
|
|
63
|
+
return connectableObservable.pipe(finalize(() => unsubscribed = true));
|
|
98
64
|
});
|
|
99
65
|
}
|
|
100
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionScheduler.js","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;
|
|
1
|
+
{"version":3,"file":"SubscriptionScheduler.js","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAqB;IAGhC;QAFQ,eAAU,GAAG,IAAI,OAAO,EAA4B,CAAC;QAG3D,IAAI,CAAC,UAAU;aACZ,IAAI,CACH,QAAQ,CACN,CAAC,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI;QACzC,yBAAyB;QACzB,QAAQ,EAAE;QACV,0GAA0G;QAC1G,4EAA4E;QAC5E,SAAS,CAAC,cAAc,CAAC;QACzB,qDAAqD;QACrD,WAAW,CAAC,aAAa,CAAC;QAC1B,gFAAgF;QAChF,iBAAiB,EAAE,CACpB,EACD,4BAA4B,CAC7B,CACF;YACD,wCAAwC;aACvC,SAAS,EAAE,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACI,oBAAoB,CAAC,MAAqB;QAC/C,OAAO,KAAK,CAAC,GAAG,EAAE;YAChB,IAAI,YAAY,GAAG,KAAK,CAAC;YACzB,4GAA4G;YAC5G,MAAM,qBAAqB,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAA6B,CAAC;YACjH,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAC5C,OAAO,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAI,SAAmC;IACzE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC5D,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 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,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AE,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;IAC9D,OAAO,CAAC,MAAM,CAAC,WAAW;IAKV,eAAe,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK;IAwBxC,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"}
|
|
@@ -35,7 +35,12 @@ export class NumericTypeConverterBase extends TypeConverter {
|
|
|
35
35
|
* @public
|
|
36
36
|
*/
|
|
37
37
|
export class FloatTypeConverter extends NumericTypeConverterBase {
|
|
38
|
+
static parseString(value) {
|
|
39
|
+
const parsedValue = parseFloat(value);
|
|
40
|
+
return Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
41
|
+
}
|
|
38
42
|
convertToString(value) {
|
|
43
|
+
var _a;
|
|
39
44
|
if (value === undefined)
|
|
40
45
|
return "";
|
|
41
46
|
let numericValue = 0;
|
|
@@ -45,7 +50,7 @@ export class FloatTypeConverter extends NumericTypeConverterBase {
|
|
|
45
50
|
numericValue = 0;
|
|
46
51
|
}
|
|
47
52
|
else {
|
|
48
|
-
numericValue =
|
|
53
|
+
numericValue = (_a = FloatTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
else {
|
|
@@ -60,7 +65,7 @@ export class FloatTypeConverter extends NumericTypeConverterBase {
|
|
|
60
65
|
return stringValue;
|
|
61
66
|
}
|
|
62
67
|
convertFromString(value) {
|
|
63
|
-
return
|
|
68
|
+
return FloatTypeConverter.parseString(value);
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
TypeConverterManager.registerConverter(StandardTypeNames.Float, FloatTypeConverter);
|
|
@@ -71,7 +76,12 @@ TypeConverterManager.registerConverter(StandardTypeNames.Number, FloatTypeConver
|
|
|
71
76
|
* @public
|
|
72
77
|
*/
|
|
73
78
|
export class IntTypeConverter extends NumericTypeConverterBase {
|
|
79
|
+
static parseString(value) {
|
|
80
|
+
const parsedValue = parseInt(value, 10);
|
|
81
|
+
return Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
82
|
+
}
|
|
74
83
|
convertToString(value) {
|
|
84
|
+
var _a;
|
|
75
85
|
if (value === undefined)
|
|
76
86
|
return "";
|
|
77
87
|
let numericValue = 0;
|
|
@@ -81,7 +91,7 @@ export class IntTypeConverter extends NumericTypeConverterBase {
|
|
|
81
91
|
numericValue = 0;
|
|
82
92
|
}
|
|
83
93
|
else {
|
|
84
|
-
numericValue =
|
|
94
|
+
numericValue = (_a = IntTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
|
|
85
95
|
}
|
|
86
96
|
}
|
|
87
97
|
else {
|
|
@@ -90,7 +100,7 @@ export class IntTypeConverter extends NumericTypeConverterBase {
|
|
|
90
100
|
return Math.round(numericValue).toString();
|
|
91
101
|
}
|
|
92
102
|
convertFromString(value) {
|
|
93
|
-
return
|
|
103
|
+
return IntTypeConverter.parseString(value);
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
TypeConverterManager.registerConverter(StandardTypeNames.Int, 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,OAAO,EAAc,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAgC,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAgB,wBAAyB,SAAQ,aAAa;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;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,wBAAwB;
|
|
1
|
+
{"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAgC,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;GAGG;AACH,MAAM,O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AAE;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;AAED,oBAAoB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,oBAAoB,CAAC,iBAAiB,CAAC,iBAAiB,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"]}
|
|
@@ -41,7 +41,7 @@ export class TypeConverter {
|
|
|
41
41
|
const stringValue = await this.convertFromStringWithOptions(value, converterOptions);
|
|
42
42
|
const propertyValue = {
|
|
43
43
|
valueFormat: PropertyValueFormat.Primitive,
|
|
44
|
-
value: stringValue
|
|
44
|
+
value: stringValue,
|
|
45
45
|
displayValue: "",
|
|
46
46
|
};
|
|
47
47
|
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,OAAO,EAAkF,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AA6C5I;;;GAGG;AACH,MAAM,OAAgB,aAAa;IACjC,6CAA6C;IACtC,eAAe,CAAC,KAAwB;QAC7C,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,wEAAwE;IACjE,0BAA0B,CAAC,KAAwB,EAAE,QAAiC;QAC3F,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,6CAA6C;IACtC,iBAAiB,CAAC,MAAc;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0EAA0E;IACnE,4BAA4B,CAAC,KAAa,EAAE,QAAiC;QAClF,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,0EAA0E;IACnE,uBAAuB,CAAC,mBAAwC,EAAE,KAAwB;;QAC/F,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,MAAA,mBAAmB,CAAC,SAAS,0CAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED,mEAAmE;IAC5D,KAAK,CAAC,gCAAgC,CAAC,KAAa,EAAE,cAA+B;QAC1F,MAAM,gBAAgB,GAAG,CAAC,cAAc,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QACvI,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QACrF,MAAM,aAAa,GAAmB;YACpC,WAAW,EAAE,mBAAmB,CAAC,SAAS;YAC1C,KAAK,EAAE,WAAW
|
|
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,OAAO,EAAkF,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AA6C5I;;;GAGG;AACH,MAAM,OAAgB,aAAa;IACjC,6CAA6C;IACtC,eAAe,CAAC,KAAwB;QAC7C,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,wEAAwE;IACjE,0BAA0B,CAAC,KAAwB,EAAE,QAAiC;QAC3F,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,6CAA6C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,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","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"]}
|
|
@@ -34,7 +34,7 @@ export class CustomNumberEditor extends React.PureComponent {
|
|
|
34
34
|
var _a;
|
|
35
35
|
// istanbul ignore else
|
|
36
36
|
if (e.key === SpecialKey.Escape) {
|
|
37
|
-
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : this._getInitialDisplayValue();
|
|
37
|
+
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : ( /* istanbul ignore next */this._getInitialDisplayValue());
|
|
38
38
|
if (initialDisplayValue !== this.state.inputValue) {
|
|
39
39
|
e.preventDefault();
|
|
40
40
|
e.stopPropagation();
|
|
@@ -93,7 +93,7 @@ export class CustomNumberEditor extends React.PureComponent {
|
|
|
93
93
|
UiAdmin.messagePresenter.displayMessage(MessageSeverity.Error, parseResults.parseError ? parseResults.parseError : /* istanbul ignore next */ UiComponents.translate("errors.unable-to-parse-quantity"));
|
|
94
94
|
}
|
|
95
95
|
const displayValue = (record.value.displayValue && record.value.displayValue.length > 0) ? record.value.displayValue : /* istanbul ignore next */ this._formatParams.formatFunction(record.value.value);
|
|
96
|
-
propertyValue = this._lastValidValue ? { ...this._lastValidValue } : {
|
|
96
|
+
propertyValue = this._lastValidValue ? { ...this._lastValidValue } : /* istanbul ignore next */ {
|
|
97
97
|
valueFormat: PropertyValueFormat.Primitive,
|
|
98
98
|
value: record.value.value,
|
|
99
99
|
displayValue,
|
|
@@ -213,7 +213,7 @@ export class CustomNumberEditor extends React.PureComponent {
|
|
|
213
213
|
}
|
|
214
214
|
_resetToLastValidDisplayValue() {
|
|
215
215
|
var _a;
|
|
216
|
-
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : this._getInitialDisplayValue();
|
|
216
|
+
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : ( /* istanbul ignore next */this._getInitialDisplayValue());
|
|
217
217
|
this.setState({ inputValue: initialDisplayValue });
|
|
218
218
|
}
|
|
219
219
|
/** @internal */
|