@itwin/components-react 3.3.0-dev.7 → 3.3.0-dev.72
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 +36 -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/editors/CustomNumberEditor.js +3 -3
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -0
- package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +36 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +118 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +11 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +76 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +41 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +29 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +79 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +73 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +12 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +47 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +11 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +52 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +43 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +43 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +152 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.d.ts +27 -0
- package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.js +113 -0
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/Types.d.ts +18 -0
- package/lib/cjs/components-react/filter-builder/Types.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/Types.js +9 -0
- package/lib/cjs/components-react/filter-builder/Types.js.map +1 -0
- 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/cjs/components-react.d.ts +9 -0
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +9 -0
- package/lib/cjs/components-react.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/editors/CustomNumberEditor.js +3 -3
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.js +2 -0
- package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +36 -0
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +94 -0
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +11 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +53 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +41 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +29 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +55 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +73 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +12 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +24 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +11 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +29 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +20 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +43 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +127 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -0
- package/lib/esm/components-react/filter-builder/Operators.d.ts +27 -0
- package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/Operators.js +107 -0
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -0
- package/lib/esm/components-react/filter-builder/Types.d.ts +18 -0
- package/lib/esm/components-react/filter-builder/Types.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/Types.js +5 -0
- package/lib/esm/components-react/filter-builder/Types.js.map +1 -0
- 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/lib/esm/components-react.d.ts +9 -0
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +9 -0
- package/lib/esm/components-react.js.map +1 -1
- package/lib/public/locales/en/UiComponents.json +16 -0
- package/package.json +19 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
# Change Log - @itwin/components-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 13 Jul 2022 15:45:52 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.2.5
|
|
6
|
+
Wed, 13 Jul 2022 15:45:52 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 3.2.4
|
|
11
|
+
Tue, 21 Jun 2022 18:06:33 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 3.2.3
|
|
16
|
+
Fri, 17 Jun 2022 15:18:39 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 3.2.2
|
|
21
|
+
Fri, 10 Jun 2022 16:11:36 GMT
|
|
22
|
+
|
|
23
|
+
### Updates
|
|
24
|
+
|
|
25
|
+
- Fix `useTreeModel` returning stale model for the given model source
|
|
26
|
+
|
|
27
|
+
## 3.2.1
|
|
28
|
+
Tue, 07 Jun 2022 15:02:56 GMT
|
|
29
|
+
|
|
30
|
+
_Version update only_
|
|
31
|
+
|
|
32
|
+
## 3.2.0
|
|
33
|
+
Fri, 20 May 2022 13:10:54 GMT
|
|
34
|
+
|
|
35
|
+
### Updates
|
|
36
|
+
|
|
37
|
+
- Add ability to pass parameters to UiItemsManager when loading items provider to specify what stages allow the provider to supply items.
|
|
38
|
+
- Update UI to new UX design to allow only 2 sections of widgets per panel.
|
|
4
39
|
|
|
5
40
|
## 3.1.3
|
|
6
41
|
Fri, 15 Apr 2022 13:49:25 GMT
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Common
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Define formatting options for use when component are generating a formatted date string calling `Date.toLocaleTimeString()`.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface DateFormatOptions {
|
|
9
|
+
locales?: string | string[] | undefined;
|
|
10
|
+
options?: Intl.DateTimeFormatOptions | undefined;
|
|
11
|
+
}
|
|
4
12
|
/**
|
|
5
13
|
* Adjust a Date object to show time in one time zone as if it is in the local time zone.
|
|
6
14
|
* This is useful when showing sunrise and sunset times for a project location in a different time zone
|
|
@@ -34,16 +42,18 @@ export declare function adjustDateToTimezone(inDateTime: Date, utcOffset: number
|
|
|
34
42
|
* Format a date in a display string, optionally converting to time zone, if specified by timeZoneOffset
|
|
35
43
|
* @param date Date object to format
|
|
36
44
|
* @param timeZoneOffset optional: offset from UTC to use for conversion
|
|
45
|
+
* @param formatOptions optional: allow locale and format for output Date string. If not defined current locale options are used.
|
|
37
46
|
* @returns formatted date string
|
|
38
47
|
* @public
|
|
39
48
|
*/
|
|
40
|
-
export declare const toDateString: (date: Date, timeZoneOffset?: number | undefined) => string;
|
|
49
|
+
export declare const toDateString: (date: Date, timeZoneOffset?: number | undefined, formatOptions?: DateFormatOptions | undefined) => string;
|
|
41
50
|
/**
|
|
42
51
|
* Format the time included in a date, optionally converting to time zone, if specified
|
|
43
52
|
* @param date Date object
|
|
44
53
|
* @param timeZoneOffset optional: offset from UTC to use for conversion
|
|
54
|
+
* @param formatOptions optional: allow locale and format for output Time string. If not defined current locale options are used.
|
|
45
55
|
* @returns formatted time string
|
|
46
56
|
* @public
|
|
47
57
|
*/
|
|
48
|
-
export declare const toTimeString: (date: Date, timeZoneOffset?: number | undefined) => string;
|
|
58
|
+
export declare const toTimeString: (date: Date, timeZoneOffset?: number | undefined, formatOptions?: DateFormatOptions | undefined) => string;
|
|
49
59
|
//# sourceMappingURL=DateUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateUtils.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/DateUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAEvE;AACD
|
|
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":"
|
|
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
|
-
*
|
|
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"}
|
|
@@ -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
|
-
*
|
|
26
|
+
* Limits concurrent observable subscriptions to one.
|
|
27
27
|
*
|
|
28
|
-
* Scheduled observables are placed at the end of a queue.
|
|
29
|
-
*
|
|
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
|
-
//
|
|
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
|
-
//
|
|
44
|
+
// Delay the connection until another event loop task
|
|
52
45
|
(0, subscribeOn_1.subscribeOn)(asap_1.asapScheduler),
|
|
53
|
-
//
|
|
46
|
+
// Ignore errors in this pipeline without suppressing them for other subscribers
|
|
54
47
|
(0, onErrorResumeNext_1.onErrorResumeNext)()), MAX_CONCURRENT_SUBSCRIPTIONS))
|
|
55
|
-
// Start
|
|
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
|
-
*
|
|
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
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
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;;;
|
|
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"]}
|
|
@@ -59,7 +59,7 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
59
59
|
var _a;
|
|
60
60
|
// istanbul ignore else
|
|
61
61
|
if (e.key === appui_abstract_1.SpecialKey.Escape) {
|
|
62
|
-
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : this._getInitialDisplayValue();
|
|
62
|
+
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : ( /* istanbul ignore next */this._getInitialDisplayValue());
|
|
63
63
|
if (initialDisplayValue !== this.state.inputValue) {
|
|
64
64
|
e.preventDefault();
|
|
65
65
|
e.stopPropagation();
|
|
@@ -118,7 +118,7 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
118
118
|
appui_abstract_1.UiAdmin.messagePresenter.displayMessage(appui_abstract_1.MessageSeverity.Error, parseResults.parseError ? parseResults.parseError : /* istanbul ignore next */ UiComponents_1.UiComponents.translate("errors.unable-to-parse-quantity"));
|
|
119
119
|
}
|
|
120
120
|
const displayValue = (record.value.displayValue && record.value.displayValue.length > 0) ? record.value.displayValue : /* istanbul ignore next */ this._formatParams.formatFunction(record.value.value);
|
|
121
|
-
propertyValue = this._lastValidValue ? { ...this._lastValidValue } : {
|
|
121
|
+
propertyValue = this._lastValidValue ? { ...this._lastValidValue } : /* istanbul ignore next */ {
|
|
122
122
|
valueFormat: appui_abstract_1.PropertyValueFormat.Primitive,
|
|
123
123
|
value: record.value.value,
|
|
124
124
|
displayValue,
|
|
@@ -238,7 +238,7 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
238
238
|
}
|
|
239
239
|
_resetToLastValidDisplayValue() {
|
|
240
240
|
var _a;
|
|
241
|
-
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : this._getInitialDisplayValue();
|
|
241
|
+
const initialDisplayValue = (_a = (this._lastValidValue && this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a : ( /* istanbul ignore next */this._getInitialDisplayValue());
|
|
242
242
|
this.setState({ inputValue: initialDisplayValue });
|
|
243
243
|
}
|
|
244
244
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oCAAoC;AAEpC,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAC/B,sDAA6C;AAC7C,0DAG+B;AAC/B,kDAAoD;AACpD,wDAAyD;AAEzD,kDAA+C;AAE/C,mEAAoF;AAUpF;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK,CAAC,aAA2D;IAAzG;;QACU,eAAU,GAAG,KAAK,CAAC;QAEnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAG5D,gBA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AK,CAAC;IACf,CAAC;CACF;AAPD,gEAOC;AACD,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,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\n// cSpell:ignore customnumber testid\r\n\r\nimport \"./CustomNumberEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n CustomFormattedNumberParams, IconEditorParams, InputEditorSizeParams, MessageSeverity, PrimitiveValue, PropertyEditorParams, PropertyEditorParamTypes,\r\n PropertyRecord, PropertyValue, PropertyValueFormat, SpecialKey, StandardEditorNames, StandardTypeNames, UiAdmin,\r\n} from \"@itwin/appui-abstract\";\r\nimport { Icon, IconInput } from \"@itwin/core-react\";\r\nimport { Input, InputProps } from \"@itwin/itwinui-react\";\r\n\r\nimport { UiComponents } from \"../UiComponents\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\n\r\n/** @internal */\r\ninterface CustomNumberEditorState {\r\n inputValue: string;\r\n size?: number;\r\n maxLength?: number;\r\n iconSpec?: string;\r\n}\r\n\r\n/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.\r\n * @alpha\r\n */\r\nexport class CustomNumberEditor extends React.PureComponent<PropertyEditorProps, CustomNumberEditorState> implements TypeEditor {\r\n private _isMounted = false;\r\n private _formatParams: CustomFormattedNumberParams | undefined;\r\n private _inputElement = React.createRef<HTMLInputElement>();\r\n private _lastValidValue: PropertyValue | undefined;\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<CustomNumberEditorState> = {\r\n inputValue: \"\",\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n if (record.isReadonly) {\r\n return {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: (record.value as PrimitiveValue).value,\r\n displayValue: (record.value as PrimitiveValue).displayValue,\r\n };\r\n }\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const parseResults = (this._formatParams as CustomFormattedNumberParams).parseFunction(this.state.inputValue);\r\n if (!parseResults.parseError && undefined !== parseResults.value) {\r\n const newDisplayValue = (this._formatParams as CustomFormattedNumberParams).formatFunction(parseResults.value as number);\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: parseResults.value,\r\n displayValue: newDisplayValue,\r\n };\r\n this._lastValidValue = { ...propertyValue };\r\n // make sure the text in the input item matches the latest formatted text... this could get out if the input string say 1.5 === the display string of 1'-6\"\r\n // istanbul ignore else\r\n if (newDisplayValue !== this.state.inputValue) {\r\n this.setState({ inputValue: newDisplayValue });\r\n }\r\n } else {\r\n // istanbul ignore else\r\n if (this.htmlElement) {\r\n UiAdmin.messagePresenter.displayInputFieldMessage(this.htmlElement, MessageSeverity.Error, parseResults.parseError ? parseResults.parseError : /* istanbul ignore next */ UiComponents.translate(\"errors.unable-to-parse-quantity\"));\r\n this.htmlElement.focus();\r\n } else {\r\n UiAdmin.messagePresenter.displayMessage(MessageSeverity.Error, parseResults.parseError ? parseResults.parseError : /* istanbul ignore next */ UiComponents.translate(\"errors.unable-to-parse-quantity\"));\r\n }\r\n\r\n const displayValue = (record.value.displayValue && record.value.displayValue.length > 0) ? record.value.displayValue : /* istanbul ignore next */ (this._formatParams as CustomFormattedNumberParams).formatFunction(record.value.value as number);\r\n propertyValue = this._lastValidValue ? { ...this._lastValidValue } : {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: record.value.value,\r\n displayValue,\r\n };\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._inputElement.current;\r\n }\r\n\r\n public get hasFocus(): boolean {\r\n return document.activeElement === this._inputElement.current;\r\n }\r\n\r\n private shouldSetFocus(): boolean {\r\n if (!this.props.setFocus)\r\n return false;\r\n\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n const disabled = (record && !record.isDisabled) ? false : true;\r\n const readonly = (record && !record.isReadonly) ? false : true;\r\n\r\n return (!disabled && !readonly);\r\n }\r\n\r\n private _applyUpdatedValue(userInput: string) {\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n const readonly = (record && !record.isReadonly) ? false : true;\r\n const disabled = (record && !record.isDisabled) ? false : true;\r\n\r\n if (readonly || disabled)\r\n return;\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({\r\n inputValue: userInput,\r\n });\r\n }\r\n\r\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\r\n this._applyUpdatedValue(e.target.value);\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 _getInitialDisplayValue(): string {\r\n const record = this.props.propertyRecord;\r\n let initialDisplayValue = \"\";\r\n let numberValue = 0;\r\n // istanbul ignore else\r\n if (record) {\r\n // istanbul ignore else\r\n if (record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const primitiveValue = record.value;\r\n numberValue = (undefined !== primitiveValue.value) ? primitiveValue.value as number : /* istanbul ignore next */ 0;\r\n // istanbul ignore else\r\n if (primitiveValue.displayValue)\r\n initialDisplayValue = primitiveValue.displayValue;\r\n else\r\n initialDisplayValue = (this._formatParams as CustomFormattedNumberParams).formatFunction(numberValue);\r\n }\r\n }\r\n\r\n return initialDisplayValue;\r\n }\r\n\r\n private async setStateFromProps() {\r\n const record = this.props.propertyRecord;\r\n // istanbul ignore next\r\n if (!record || !record.property) {\r\n Logger.logError(UiComponents.loggerCategory(this), \"PropertyRecord must be defined to use CustomNumberPropertyEditor\");\r\n // eslint-disable-next-line no-console\r\n // console.log(\"PropertyRecord must be defined to use CustomNumberPropertyEditor\");\r\n return;\r\n }\r\n // istanbul ignore else\r\n if (record.property && record.property.editor && record.property.editor.params) {\r\n this._formatParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.CustomFormattedNumber) as CustomFormattedNumberParams;\r\n }\r\n\r\n if (!this._formatParams) {\r\n Logger.logError(UiComponents.loggerCategory(this), `CustomFormattedNumberParams must be defined for property ${record.property.name}`);\r\n // eslint-disable-next-line no-console\r\n // console.log(`CustomFormattedNumberParams must be defined for property ${record!.property!.name}`);\r\n return;\r\n }\r\n\r\n const initialDisplayValue = this._getInitialDisplayValue();\r\n this._lastValidValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: (record.value as PrimitiveValue).value,\r\n displayValue: initialDisplayValue,\r\n };\r\n let size: number | undefined;\r\n let maxLength: number | undefined;\r\n let iconSpec: string | undefined;\r\n\r\n // istanbul ignore else\r\n if (record.property && record.property.editor && record.property.editor.params) {\r\n const editorSizeParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.InputEditorSize) as InputEditorSizeParams;\r\n // istanbul ignore else\r\n if (editorSizeParams) {\r\n // istanbul ignore else\r\n if (editorSizeParams.size)\r\n size = editorSizeParams.size;\r\n // istanbul ignore else\r\n if (editorSizeParams.maxLength)\r\n maxLength = editorSizeParams.maxLength;\r\n }\r\n\r\n const iconParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.Icon) as IconEditorParams;\r\n if (iconParams) {\r\n iconSpec = iconParams.definition.iconSpec;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({ inputValue: initialDisplayValue, size, maxLength, iconSpec });\r\n }\r\n\r\n private _resetToLastValidDisplayValue() {\r\n const initialDisplayValue = (this._lastValidValue && (this._lastValidValue as PrimitiveValue).displayValue) ?? this._getInitialDisplayValue();\r\n this.setState({ inputValue: initialDisplayValue });\r\n }\r\n\r\n private _onKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\r\n // istanbul ignore else\r\n if (e.key === SpecialKey.Escape) {\r\n const initialDisplayValue = (this._lastValidValue && (this._lastValidValue as PrimitiveValue).displayValue) ?? this._getInitialDisplayValue();\r\n if (initialDisplayValue !== this.state.inputValue) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this._resetToLastValidDisplayValue();\r\n } else {\r\n // istanbul ignore else\r\n if (this.props.onCancel)\r\n this.props.onCancel();\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (e.key !== SpecialKey.Enter) {\r\n UiAdmin.messagePresenter.closeInputFieldMessage();\r\n }\r\n };\r\n\r\n // istanbul ignore next\r\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\r\n e.target.select();\r\n };\r\n\r\n /** @internal */\r\n public override render(): React.ReactNode {\r\n const minSize = this.state.size ? this.state.size : 8;\r\n const minWidthStyle: React.CSSProperties = {\r\n minWidth: `${minSize * 0.75}em`,\r\n };\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n if (!record || !this._formatParams)\r\n return null;\r\n\r\n const readOnly = !record.isReadonly ? false : true;\r\n const disabled = !record.isDisabled ? false : true;\r\n\r\n const className = classnames(\"components-cell-editor\", \"components-customnumber-editor\", this.props.className);\r\n\r\n const inputProps: Omit<InputProps, \"size\"> = { // eslint-disable-line deprecation/deprecation\r\n className,\r\n style: this.props.style ? this.props.style : minWidthStyle,\r\n readOnly,\r\n disabled,\r\n maxLength: this.state.maxLength,\r\n value: this.state.inputValue,\r\n onChange: this._updateInputValue,\r\n onBlur: this.props.onBlur,\r\n onFocus: this._onFocus,\r\n setFocus: this.shouldSetFocus(),\r\n onKeyDown: this._onKeyPress,\r\n };\r\n\r\n let reactNode: React.ReactNode;\r\n if (this.state.iconSpec) {\r\n const icon = <Icon iconSpec={this.state.iconSpec} />;\r\n reactNode = (\r\n <IconInput\r\n {...inputProps}\r\n ref={this._inputElement}\r\n icon={icon}\r\n data-testid=\"components-customnumber-editor\"\r\n />\r\n );\r\n } else {\r\n // NEEDSWORK: still using core-react Input component because of `nativeKeyHandler` prop\r\n reactNode = (\r\n <Input\r\n {...inputProps}\r\n ref={this._inputElement}\r\n data-testid=\"components-customnumber-editor\"\r\n size=\"small\"\r\n />\r\n );\r\n }\r\n\r\n return reactNode;\r\n }\r\n}\r\n\r\n/** Custom Property Editor registered for the \"number\" type name and the \"number-custom\" editor name.\r\n * It uses the [[CustomNumberEditor]] React component.\r\n * @alpha\r\n */\r\nexport class CustomNumberPropertyEditor extends PropertyEditorBase {\r\n public get reactNode(): React.ReactNode {\r\n return <CustomNumberEditor />;\r\n }\r\n public override get containerHandlesEscape(): boolean {\r\n return false;\r\n }\r\n}\r\nPropertyEditorManager.registerEditor(StandardTypeNames.Number, CustomNumberPropertyEditor, StandardEditorNames.NumberCustom);\r\n"]}
|
|
1
|
+
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oCAAoC;AAEpC,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAC/B,sDAA6C;AAC7C,0DAG+B;AAC/B,kDAAoD;AACpD,wDAAyD;AAEzD,kDAA+C;AAE/C,mEAAoF;AAUpF;;GAEG;AACH,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,SAAS,CAAC;IACnB,CAAC;CACF;AArRD,gDAqRC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,0CAAkB;IAChE,IAAW,SAAS;QAClB,OAAO,oBAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;IACD,IAAoB,sBAAsB;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAPD,gEAOC;AACD,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,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\n// cSpell:ignore customnumber testid\r\n\r\nimport \"./CustomNumberEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n CustomFormattedNumberParams, IconEditorParams, InputEditorSizeParams, MessageSeverity, PrimitiveValue, PropertyEditorParams, PropertyEditorParamTypes,\r\n PropertyRecord, PropertyValue, PropertyValueFormat, SpecialKey, StandardEditorNames, StandardTypeNames, UiAdmin,\r\n} from \"@itwin/appui-abstract\";\r\nimport { Icon, IconInput } from \"@itwin/core-react\";\r\nimport { Input, InputProps } from \"@itwin/itwinui-react\";\r\n\r\nimport { UiComponents } from \"../UiComponents\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\n\r\n/** @internal */\r\ninterface CustomNumberEditorState {\r\n inputValue: string;\r\n size?: number;\r\n maxLength?: number;\r\n iconSpec?: string;\r\n}\r\n\r\n/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.\r\n * @alpha\r\n */\r\nexport class CustomNumberEditor extends React.PureComponent<PropertyEditorProps, CustomNumberEditorState> implements TypeEditor {\r\n private _isMounted = false;\r\n private _formatParams: CustomFormattedNumberParams | undefined;\r\n private _inputElement = React.createRef<HTMLInputElement>();\r\n private _lastValidValue: PropertyValue | undefined;\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<CustomNumberEditorState> = {\r\n inputValue: \"\",\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n if (record.isReadonly) {\r\n return {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: (record.value as PrimitiveValue).value,\r\n displayValue: (record.value as PrimitiveValue).displayValue,\r\n };\r\n }\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const parseResults = (this._formatParams as CustomFormattedNumberParams).parseFunction(this.state.inputValue);\r\n if (!parseResults.parseError && undefined !== parseResults.value) {\r\n const newDisplayValue = (this._formatParams as CustomFormattedNumberParams).formatFunction(parseResults.value as number);\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: parseResults.value,\r\n displayValue: newDisplayValue,\r\n };\r\n this._lastValidValue = { ...propertyValue };\r\n // make sure the text in the input item matches the latest formatted text... this could get out if the input string say 1.5 === the display string of 1'-6\"\r\n // istanbul ignore else\r\n if (newDisplayValue !== this.state.inputValue) {\r\n this.setState({ inputValue: newDisplayValue });\r\n }\r\n } else {\r\n // istanbul ignore else\r\n if (this.htmlElement) {\r\n UiAdmin.messagePresenter.displayInputFieldMessage(this.htmlElement, MessageSeverity.Error, parseResults.parseError ? parseResults.parseError : /* istanbul ignore next */ UiComponents.translate(\"errors.unable-to-parse-quantity\"));\r\n this.htmlElement.focus();\r\n } else {\r\n UiAdmin.messagePresenter.displayMessage(MessageSeverity.Error, parseResults.parseError ? parseResults.parseError : /* istanbul ignore next */ UiComponents.translate(\"errors.unable-to-parse-quantity\"));\r\n }\r\n\r\n const displayValue = (record.value.displayValue && record.value.displayValue.length > 0) ? record.value.displayValue : /* istanbul ignore next */ (this._formatParams as CustomFormattedNumberParams).formatFunction(record.value.value as number);\r\n propertyValue = this._lastValidValue ? { ...this._lastValidValue } : /* istanbul ignore next */ {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: record.value.value,\r\n displayValue,\r\n };\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._inputElement.current;\r\n }\r\n\r\n public get hasFocus(): boolean {\r\n return document.activeElement === this._inputElement.current;\r\n }\r\n\r\n private shouldSetFocus(): boolean {\r\n if (!this.props.setFocus)\r\n return false;\r\n\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n const disabled = (record && !record.isDisabled) ? false : true;\r\n const readonly = (record && !record.isReadonly) ? false : true;\r\n\r\n return (!disabled && !readonly);\r\n }\r\n\r\n private _applyUpdatedValue(userInput: string) {\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n const readonly = (record && !record.isReadonly) ? false : true;\r\n const disabled = (record && !record.isDisabled) ? false : true;\r\n\r\n if (readonly || disabled)\r\n return;\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({\r\n inputValue: userInput,\r\n });\r\n }\r\n\r\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\r\n this._applyUpdatedValue(e.target.value);\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 _getInitialDisplayValue(): string {\r\n const record = this.props.propertyRecord;\r\n let initialDisplayValue = \"\";\r\n let numberValue = 0;\r\n // istanbul ignore else\r\n if (record) {\r\n // istanbul ignore else\r\n if (record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const primitiveValue = record.value;\r\n numberValue = (undefined !== primitiveValue.value) ? primitiveValue.value as number : /* istanbul ignore next */ 0;\r\n // istanbul ignore else\r\n if (primitiveValue.displayValue)\r\n initialDisplayValue = primitiveValue.displayValue;\r\n else\r\n initialDisplayValue = (this._formatParams as CustomFormattedNumberParams).formatFunction(numberValue);\r\n }\r\n }\r\n\r\n return initialDisplayValue;\r\n }\r\n\r\n private async setStateFromProps() {\r\n const record = this.props.propertyRecord;\r\n // istanbul ignore next\r\n if (!record || !record.property) {\r\n Logger.logError(UiComponents.loggerCategory(this), \"PropertyRecord must be defined to use CustomNumberPropertyEditor\");\r\n // eslint-disable-next-line no-console\r\n // console.log(\"PropertyRecord must be defined to use CustomNumberPropertyEditor\");\r\n return;\r\n }\r\n // istanbul ignore else\r\n if (record.property && record.property.editor && record.property.editor.params) {\r\n this._formatParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.CustomFormattedNumber) as CustomFormattedNumberParams;\r\n }\r\n\r\n if (!this._formatParams) {\r\n Logger.logError(UiComponents.loggerCategory(this), `CustomFormattedNumberParams must be defined for property ${record.property.name}`);\r\n // eslint-disable-next-line no-console\r\n // console.log(`CustomFormattedNumberParams must be defined for property ${record!.property!.name}`);\r\n return;\r\n }\r\n\r\n const initialDisplayValue = this._getInitialDisplayValue();\r\n this._lastValidValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: (record.value as PrimitiveValue).value,\r\n displayValue: initialDisplayValue,\r\n };\r\n let size: number | undefined;\r\n let maxLength: number | undefined;\r\n let iconSpec: string | undefined;\r\n\r\n // istanbul ignore else\r\n if (record.property && record.property.editor && record.property.editor.params) {\r\n const editorSizeParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.InputEditorSize) as InputEditorSizeParams;\r\n // istanbul ignore else\r\n if (editorSizeParams) {\r\n // istanbul ignore else\r\n if (editorSizeParams.size)\r\n size = editorSizeParams.size;\r\n // istanbul ignore else\r\n if (editorSizeParams.maxLength)\r\n maxLength = editorSizeParams.maxLength;\r\n }\r\n\r\n const iconParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.Icon) as IconEditorParams;\r\n if (iconParams) {\r\n iconSpec = iconParams.definition.iconSpec;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({ inputValue: initialDisplayValue, size, maxLength, iconSpec });\r\n }\r\n\r\n private _resetToLastValidDisplayValue() {\r\n const initialDisplayValue = (this._lastValidValue && (this._lastValidValue as PrimitiveValue).displayValue) ?? (/* istanbul ignore next */ this._getInitialDisplayValue());\r\n this.setState({ inputValue: initialDisplayValue });\r\n }\r\n\r\n private _onKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\r\n // istanbul ignore else\r\n if (e.key === SpecialKey.Escape) {\r\n const initialDisplayValue = (this._lastValidValue && (this._lastValidValue as PrimitiveValue).displayValue) ?? (/* istanbul ignore next */ this._getInitialDisplayValue());\r\n if (initialDisplayValue !== this.state.inputValue) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this._resetToLastValidDisplayValue();\r\n } else {\r\n // istanbul ignore else\r\n if (this.props.onCancel)\r\n this.props.onCancel();\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (e.key !== SpecialKey.Enter) {\r\n UiAdmin.messagePresenter.closeInputFieldMessage();\r\n }\r\n };\r\n\r\n // istanbul ignore next\r\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\r\n e.target.select();\r\n };\r\n\r\n /** @internal */\r\n public override render(): React.ReactNode {\r\n const minSize = this.state.size ? this.state.size : 8;\r\n const minWidthStyle: React.CSSProperties = {\r\n minWidth: `${minSize * 0.75}em`,\r\n };\r\n const record = this.props.propertyRecord as PropertyRecord;\r\n if (!record || !this._formatParams)\r\n return null;\r\n\r\n const readOnly = !record.isReadonly ? false : true;\r\n const disabled = !record.isDisabled ? false : true;\r\n\r\n const className = classnames(\"components-cell-editor\", \"components-customnumber-editor\", this.props.className);\r\n\r\n const inputProps: Omit<InputProps, \"size\"> = { // eslint-disable-line deprecation/deprecation\r\n className,\r\n style: this.props.style ? this.props.style : minWidthStyle,\r\n readOnly,\r\n disabled,\r\n maxLength: this.state.maxLength,\r\n value: this.state.inputValue,\r\n onChange: this._updateInputValue,\r\n onBlur: this.props.onBlur,\r\n onFocus: this._onFocus,\r\n setFocus: this.shouldSetFocus(),\r\n onKeyDown: this._onKeyPress,\r\n };\r\n\r\n let reactNode: React.ReactNode;\r\n if (this.state.iconSpec) {\r\n const icon = <Icon iconSpec={this.state.iconSpec} />;\r\n reactNode = (\r\n <IconInput\r\n {...inputProps}\r\n ref={this._inputElement}\r\n icon={icon}\r\n data-testid=\"components-customnumber-editor\"\r\n />\r\n );\r\n } else {\r\n // NEEDSWORK: still using core-react Input component because of `nativeKeyHandler` prop\r\n reactNode = (\r\n <Input\r\n {...inputProps}\r\n ref={this._inputElement}\r\n data-testid=\"components-customnumber-editor\"\r\n size=\"small\"\r\n />\r\n );\r\n }\r\n\r\n return reactNode;\r\n }\r\n}\r\n\r\n/** Custom Property Editor registered for the \"number\" type name and the \"number-custom\" editor name.\r\n * It uses the [[CustomNumberEditor]] React component.\r\n * @alpha\r\n */\r\nexport class CustomNumberPropertyEditor extends PropertyEditorBase {\r\n public get reactNode(): React.ReactNode {\r\n return <CustomNumberEditor />;\r\n }\r\n public override get containerHandlesEscape(): boolean {\r\n return false;\r\n }\r\n}\r\nPropertyEditorManager.registerEditor(StandardTypeNames.Number, CustomNumberPropertyEditor, StandardEditorNames.NumberCustom);\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react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,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAM7B;IAEY,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3F,OAAO,CAAC,aAAa,CAWnB;IAEF,OAAO,CAAC,iBAAiB,CAWvB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,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) {
|