@itwin/components-react 5.28.1 → 5.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +144 -0
- package/lib/components-react/editors/BooleanEditor.d.ts +2 -0
- package/lib/components-react/editors/BooleanEditor.d.ts.map +1 -1
- package/lib/components-react/editors/BooleanEditor.js +3 -1
- package/lib/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/components-react/editors/CustomNumberEditor.d.ts +2 -0
- package/lib/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/components-react/editors/CustomNumberEditor.js +4 -6
- package/lib/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/components-react/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/components-react/editors/DateTimeEditor.js +2 -3
- package/lib/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/components-react/editors/EditorContainer.d.ts +5 -1
- package/lib/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/components-react/editors/EditorContainer.js +1 -1
- package/lib/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.d.ts +2 -0
- package/lib/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.js +3 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/components-react/editors/EnumEditor.d.ts +2 -0
- package/lib/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/components-react/editors/EnumEditor.js +3 -0
- package/lib/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/components-react/editors/IconEditor.d.ts +2 -0
- package/lib/components-react/editors/IconEditor.d.ts.map +1 -1
- package/lib/components-react/editors/IconEditor.js +3 -1
- package/lib/components-react/editors/IconEditor.js.map +1 -1
- package/lib/components-react/editors/ImageCheckBoxEditor.d.ts +2 -0
- package/lib/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
- package/lib/components-react/editors/ImageCheckBoxEditor.js +3 -3
- package/lib/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.d.ts +2 -0
- package/lib/components-react/editors/NumericInputEditor.d.ts.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.js +4 -4
- package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/components-react/editors/PopupButton.d.ts +2 -0
- package/lib/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/components-react/editors/PopupButton.js +1 -1
- package/lib/components-react/editors/PopupButton.js.map +1 -1
- package/lib/components-react/editors/PropertyEditorManager.d.ts +11 -2
- package/lib/components-react/editors/PropertyEditorManager.d.ts.map +1 -1
- package/lib/components-react/editors/PropertyEditorManager.js +6 -1
- package/lib/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/components-react/editors/SliderEditor.d.ts +4 -1
- package/lib/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/components-react/editors/SliderEditor.js +7 -8
- package/lib/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/components-react/editors/TextEditor.d.ts +1 -0
- package/lib/components-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/components-react/editors/TextEditor.js +3 -6
- package/lib/components-react/editors/TextEditor.js.map +1 -1
- package/lib/components-react/editors/TextareaEditor.d.ts +2 -0
- package/lib/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/components-react/editors/TextareaEditor.js +3 -1
- package/lib/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/components-react/editors/ToggleEditor.d.ts +2 -0
- package/lib/components-react/editors/ToggleEditor.d.ts.map +1 -1
- package/lib/components-react/editors/ToggleEditor.js +3 -1
- package/lib/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/components-react/editors/registerEditors.d.ts.map +1 -1
- package/lib/components-react/editors/registerEditors.js +1 -0
- package/lib/components-react/editors/registerEditors.js.map +1 -1
- package/lib/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/components-react/favorite/FavoritePropertyList.js +4 -1
- package/lib/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRule.d.ts +1 -0
- package/lib/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRule.js +5 -3
- package/lib/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +1 -0
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.js +5 -5
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.d.ts +45 -8
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.js +17 -8
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/components-react/new-editors/ConstraintUtils.d.ts +62 -0
- package/lib/components-react/new-editors/ConstraintUtils.d.ts.map +1 -0
- package/lib/components-react/new-editors/ConstraintUtils.js +49 -0
- package/lib/components-react/new-editors/ConstraintUtils.js.map +1 -0
- package/lib/components-react/new-editors/Types.d.ts +6 -0
- package/lib/components-react/new-editors/Types.d.ts.map +1 -1
- package/lib/components-react/new-editors/Types.js.map +1 -1
- package/lib/components-react/new-editors/UseCommittableValue.d.ts +2 -5
- package/lib/components-react/new-editors/UseCommittableValue.d.ts.map +1 -1
- package/lib/components-react/new-editors/UseCommittableValue.js +4 -1
- package/lib/components-react/new-editors/UseCommittableValue.js.map +1 -1
- package/lib/components-react/new-editors/editors/BooleanEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/BooleanEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/BooleanEditor.js +2 -2
- package/lib/components-react/new-editors/editors/BooleanEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/DateEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/DateEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/DateEditor.js +2 -2
- package/lib/components-react/new-editors/editors/DateEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/DateInput.d.ts +2 -1
- package/lib/components-react/new-editors/editors/DateInput.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/DateInput.js +2 -2
- package/lib/components-react/new-editors/editors/DateInput.js.map +1 -1
- package/lib/components-react/new-editors/editors/DateTimeEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/DateTimeEditor.js +2 -2
- package/lib/components-react/new-editors/editors/DateTimeEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/EnumEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/EnumEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/EnumEditor.js +2 -2
- package/lib/components-react/new-editors/editors/EnumEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/FallbackEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/FallbackEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/FallbackEditor.js +2 -2
- package/lib/components-react/new-editors/editors/FallbackEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/NumericEditor.d.ts +2 -2
- package/lib/components-react/new-editors/editors/NumericEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/NumericEditor.js +7 -3
- package/lib/components-react/new-editors/editors/NumericEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/TextEditor.d.ts +2 -2
- package/lib/components-react/new-editors/editors/TextEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/TextEditor.js +4 -2
- package/lib/components-react/new-editors/editors/TextEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/ToggleEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/ToggleEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/ToggleEditor.js +2 -2
- package/lib/components-react/new-editors/editors/ToggleEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors-registry/DefaultEditors.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors-registry/DefaultEditors.js.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.d.ts +5 -4
- package/lib/components-react/new-editors/interop/EditorInterop.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.js +1 -0
- package/lib/components-react/new-editors/interop/EditorInterop.js.map +1 -1
- package/lib/components-react/new-editors/interop/Metadata.d.ts +9 -6
- package/lib/components-react/new-editors/interop/Metadata.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/Metadata.js +6 -3
- package/lib/components-react/new-editors/interop/Metadata.js.map +1 -1
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.d.ts +42 -3
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.js +11 -6
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/Color.js +4 -4
- package/lib/components-react/new-editors/interop/old-editors/Color.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.d.ts +4 -3
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js +11 -5
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/Enum.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/Enum.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/EnumButtonGroup.js +4 -4
- package/lib/components-react/new-editors/interop/old-editors/EnumButtonGroup.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.d.ts +7 -1
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.js +21 -6
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/Slider.js +4 -4
- package/lib/components-react/new-editors/interop/old-editors/Slider.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/TextArea.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/TextArea.js +4 -4
- package/lib/components-react/new-editors/interop/old-editors/TextArea.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.d.ts +8 -8
- package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.d.ts +2 -2
- package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.js.map +1 -1
- package/lib/components-react/new-editors/values/Metadata.d.ts +22 -0
- package/lib/components-react/new-editors/values/Metadata.d.ts.map +1 -1
- package/lib/components-react/new-editors/values/Metadata.js.map +1 -1
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +4 -1
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts +45 -7
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.js +13 -5
- package/lib/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyList.d.ts +40 -10
- package/lib/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyList.js +7 -2
- package/lib/components-react/propertygrid/component/PropertyList.js.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +37 -33
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js +10 -4
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +41 -5
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +6 -4
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +3 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/components-react.d.ts +2 -1
- package/lib/components-react.d.ts.map +1 -1
- package/lib/components-react.js +1 -0
- package/lib/components-react.js.map +1 -1
- package/lib/internal.d.ts +1 -1
- package/lib/internal.d.ts.map +1 -1
- package/lib/internal.js +1 -1
- package/lib/internal.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,149 @@
|
|
|
1
1
|
# Change Log - @itwin/components-react
|
|
2
2
|
|
|
3
|
+
## 5.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b6ca75b: Deprecated legacy editors system
|
|
8
|
+
|
|
9
|
+
Deprecated the legacy editor system in favor of the new `EditorSpec`-based system. The following APIs are deprecated:
|
|
10
|
+
|
|
11
|
+
- `EditorContainer` - use `PropertyRecordEditor` or `EditorRenderer` instead.
|
|
12
|
+
- `PropertyEditorBase`, `TypeEditor`, `PropertyEditorProps` - use `EditorSpec` / `createEditorSpec` to define custom editors.
|
|
13
|
+
- `PropertyEditorManager` - use `EditorsRegistryProvider` to register custom editors.
|
|
14
|
+
- `DataControllerBase`, `DataController`, `AsyncErrorMessage`, `AsyncValueProcessingResult` - no longer needed in the new system.
|
|
15
|
+
|
|
16
|
+
Deprecated individual editor components. Use `EditorRenderer` to render editors based on metadata instead of using these directly:
|
|
17
|
+
|
|
18
|
+
- `BasicPropertyEditor`, `BooleanEditor`, `BooleanPropertyEditor`
|
|
19
|
+
- `TextEditor`, `TextareaEditor`, `TextareaPropertyEditor`
|
|
20
|
+
- `EnumEditor`, `EnumPropertyEditor`, `EnumButtonGroupEditor`, `EnumPropertyButtonGroupEditor`
|
|
21
|
+
- `NumericInputEditor`, `NumericInputPropertyEditor`
|
|
22
|
+
- `SliderEditor`, `SliderPropertyEditor`
|
|
23
|
+
- `ToggleEditor`, `TogglePropertyEditor`
|
|
24
|
+
- `ImageCheckBoxEditor`, `ImageCheckBoxPropertyEditor`
|
|
25
|
+
- `IconEditor`, `IconPropertyEditor`
|
|
26
|
+
- `CustomNumberEditor`, `CustomNumberPropertyEditor`
|
|
27
|
+
|
|
28
|
+
- b6ca75b: Added `PropertyRecordEditorMetadata` and `isPropertyRecordEditorMetadata`
|
|
29
|
+
|
|
30
|
+
Promoted `PropertyRecordEditorMetadata` interface and `isPropertyRecordEditorMetadata` type guard to `@beta`. These allow custom editors to access legacy `PropertyRecord` metadata (e.g. `typename`, `params`, `enum`, `extendedData`) when used with the new editor system.
|
|
31
|
+
|
|
32
|
+
#### Migration
|
|
33
|
+
|
|
34
|
+
Migrate from `EditorContainer` to the new system using `PropertyRecordEditor`:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// before
|
|
38
|
+
<EditorContainer
|
|
39
|
+
propertyRecord={propertyRecord}
|
|
40
|
+
onCommit={onCommit}
|
|
41
|
+
onCancel={onCancel}
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
// after
|
|
45
|
+
<PropertyRecordEditor
|
|
46
|
+
propertyRecord={propertyRecord}
|
|
47
|
+
onCommit={onCommit}
|
|
48
|
+
onCancel={onCancel}
|
|
49
|
+
editorSystem="new"
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Migrate custom editors from `PropertyEditorBase` to `EditorSpec`:
|
|
54
|
+
|
|
55
|
+
**Before**
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
const CustomBooleanEditor = React.forwardRef<TypeEditor, PropertyEditorProps>(
|
|
59
|
+
(props, ref) => {
|
|
60
|
+
const currentValue =
|
|
61
|
+
props.propertyRecord?.value.valueFormat ===
|
|
62
|
+
PropertyValueFormat.Primitive
|
|
63
|
+
? (props.propertyRecord.value.value as boolean)
|
|
64
|
+
: false;
|
|
65
|
+
|
|
66
|
+
React.useImperativeHandle(ref, () => ({
|
|
67
|
+
getPropertyValue: async () => ({
|
|
68
|
+
valueFormat: PropertyValueFormat.Primitive,
|
|
69
|
+
value: currentValue,
|
|
70
|
+
displayValue: "",
|
|
71
|
+
}),
|
|
72
|
+
htmlElement: null,
|
|
73
|
+
hasFocus: false,
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<ToggleSwitch
|
|
78
|
+
checked={currentValue}
|
|
79
|
+
onChange={(e) => {
|
|
80
|
+
props.onCommit?.({
|
|
81
|
+
propertyRecord: props.propertyRecord!,
|
|
82
|
+
newValue: {
|
|
83
|
+
valueFormat: PropertyValueFormat.Primitive,
|
|
84
|
+
value: e.target.checked,
|
|
85
|
+
displayValue: "",
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export class CustomBooleanPropertyEditor extends PropertyEditorBase {
|
|
95
|
+
public get reactNode(): React.ReactNode {
|
|
96
|
+
return <CustomBooleanEditor />;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**After**
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
export const CustomBoolEditorSpec: EditorSpec = createEditorSpec({
|
|
105
|
+
isMetadataSupported: (metadata): metadata is ValueMetadata =>
|
|
106
|
+
metadata.type === "bool",
|
|
107
|
+
isValueSupported: ValueUtilities.isBoolean,
|
|
108
|
+
Editor: CustomBooleanEditor,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
function CustomBooleanEditor(
|
|
112
|
+
props: EditorProps<ValueMetadata, BooleanValue>
|
|
113
|
+
) {
|
|
114
|
+
const currentValue = props.value?.value ?? false;
|
|
115
|
+
return (
|
|
116
|
+
<ToggleSwitch
|
|
117
|
+
checked={currentValue}
|
|
118
|
+
onChange={(e) => {
|
|
119
|
+
props.onChange({ value: e.target.checked });
|
|
120
|
+
props.commit?.();
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- @itwin/core-react@5.30.0
|
|
130
|
+
|
|
131
|
+
## 5.29.0
|
|
132
|
+
|
|
133
|
+
### Minor Changes
|
|
134
|
+
|
|
135
|
+
- 8202fee: Added constraint enforcement for new editor system:
|
|
136
|
+
|
|
137
|
+
- Added `NumericValueMetadata` interface with `minimumValue`/`maximumValue` constraints.
|
|
138
|
+
- Updated `useCommittableValue` return type to use `Pick<EditorProps, ...>` for consistency.
|
|
139
|
+
|
|
140
|
+
- cdd7f5b: Associate PropertyEditor labels with editor controls using generated element ids
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- 8202fee: New editor system now enforces numeric and string constraints. Numeric and quantity editors clamp rawValues to `minimumValue`/`maximumValue`. Text editors truncate to `maximumLength` and reject values shorter than `minimumLength`.
|
|
145
|
+
- @itwin/core-react@5.29.0
|
|
146
|
+
|
|
3
147
|
## 5.28.1
|
|
4
148
|
|
|
5
149
|
### Patch Changes
|
|
@@ -12,6 +12,7 @@ interface BooleanEditorState {
|
|
|
12
12
|
}
|
|
13
13
|
/** BooleanEditor React component that is a property editor with checkbox input
|
|
14
14
|
* @public
|
|
15
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
15
16
|
*/
|
|
16
17
|
export declare class BooleanEditor extends React.PureComponent<PropertyEditorProps, BooleanEditorState> implements TypeEditor {
|
|
17
18
|
private _isMounted;
|
|
@@ -32,6 +33,7 @@ export declare class BooleanEditor extends React.PureComponent<PropertyEditorPro
|
|
|
32
33
|
/** Boolean Property Editor registered for the "bool" and "boolean" type names.
|
|
33
34
|
* It uses the [[BooleanEditor]] React component.
|
|
34
35
|
* @public
|
|
36
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
35
37
|
*/
|
|
36
38
|
export declare class BooleanPropertyEditor extends PropertyEditorBase {
|
|
37
39
|
get containerHandlesBlur(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"BooleanEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAKhE,gBAAgB;AAChB,UAAU,kBAAkB;IAC1B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,qBAAa,aACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,kBAAkB,CACnE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAuC;IAE5D,SAAyB,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAE1D;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAInE,OAAO,CAAC,oBAAoB;IAe5B,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,OAAO,CAAC,oBAAoB,CAqB1B;IAEc,iBAAiB;IAKjB,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAMjE,OAAO,CAAC,iBAAiB;IAkBT,MAAM;CA0BvB;AAED;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,kBAAkB;IAC3D,IAAoB,oBAAoB,IAAI,OAAO,CAElD;IAED,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
|
|
@@ -13,6 +13,7 @@ import { Checkbox } from "@itwin/itwinui-react";
|
|
|
13
13
|
import { PropertyEditorBase } from "./PropertyEditorManager.js";
|
|
14
14
|
/** BooleanEditor React component that is a property editor with checkbox input
|
|
15
15
|
* @public
|
|
16
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
16
17
|
*/
|
|
17
18
|
export class BooleanEditor extends React.PureComponent {
|
|
18
19
|
_isMounted = false;
|
|
@@ -89,12 +90,13 @@ export class BooleanEditor extends React.PureComponent {
|
|
|
89
90
|
const className = classnames("components-cell-editor", "components-boolean-editor", this.props.className);
|
|
90
91
|
const checked = this.state.checkboxValue;
|
|
91
92
|
return (React.createElement(Checkbox, { ref: this._inputElement, onBlur: this.props.onBlur, className: className, style: this.props.style, checked: checked, onChange: this._updateCheckboxValue, autoFocus: this.props.setFocus, disabled: this.props.propertyRecord?.isDisabled ||
|
|
92
|
-
this.props.propertyRecord?.isReadonly, "data-testid": "components-checkbox-editor" }));
|
|
93
|
+
this.props.propertyRecord?.isReadonly, "data-testid": "components-checkbox-editor", id: this.props.propertyRecord?.property.name }));
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
/** Boolean Property Editor registered for the "bool" and "boolean" type names.
|
|
96
97
|
* It uses the [[BooleanEditor]] React component.
|
|
97
98
|
* @public
|
|
99
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
98
100
|
*/
|
|
99
101
|
export class BooleanPropertyEditor extends PropertyEditorBase {
|
|
100
102
|
get containerHandlesBlur() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC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e,MAAM;QACpB,MAAM,SAAS,GAAG,UAAU,CAC1B,wBAAwB,EACxB,2BAA2B,EAC3B,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QAEzC,OAAO,CACL,oBAAC,QAAQ,IACP,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC9B,QAAQ,EACN,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU;gBACrC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU,iBAE3B,4BAA4B,EACxC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,GAClC,CACb,CAAC;IACJ,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,kBAAkB;IAC3D,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./BooleanEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport { EditorRenderer } from \"../new-editors/EditorRenderer.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\ninterface BooleanEditorState {\n checkboxValue: boolean;\n}\n\n/** BooleanEditor React component that is a property editor with checkbox input\n * @public\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class BooleanEditor\n extends React.PureComponent<PropertyEditorProps, BooleanEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n public override readonly state: Readonly<BooleanEditorState> = {\n checkboxValue: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n return this.getPropertyValueSync();\n }\n\n private getPropertyValueSync(): PropertyValue | undefined {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateCheckboxValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (this._isMounted) {\n const checkboxValue = !!e.target.checked;\n\n this.setState(\n {\n checkboxValue,\n },\n () => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = this.getPropertyValueSync();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n }\n );\n }\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps();\n }\n }\n\n private setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n if (this._isMounted)\n this.setState({\n checkboxValue,\n });\n }\n\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-boolean-editor\",\n this.props.className\n );\n const checked = this.state.checkboxValue;\n\n return (\n <Checkbox\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={checked}\n onChange={this._updateCheckboxValue}\n autoFocus={this.props.setFocus} // eslint-disable-line jsx-a11y/no-autofocus\n disabled={\n this.props.propertyRecord?.isDisabled ||\n this.props.propertyRecord?.isReadonly\n }\n data-testid=\"components-checkbox-editor\"\n id={this.props.propertyRecord?.property.name}\n ></Checkbox>\n );\n }\n}\n\n/** Boolean Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[BooleanEditor]] React component.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class BooleanPropertyEditor extends PropertyEditorBase {\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <BooleanEditor />;\n }\n}\n"]}
|
|
@@ -15,6 +15,7 @@ interface CustomNumberEditorState {
|
|
|
15
15
|
}
|
|
16
16
|
/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.
|
|
17
17
|
* @alpha
|
|
18
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
18
19
|
*/
|
|
19
20
|
export declare class CustomNumberEditor extends React.PureComponent<PropertyEditorProps, CustomNumberEditorState> implements TypeEditor {
|
|
20
21
|
#private;
|
|
@@ -44,6 +45,7 @@ export declare class CustomNumberEditor extends React.PureComponent<PropertyEdit
|
|
|
44
45
|
/** Custom Property Editor registered for the "number" type name and the "number-custom" editor name.
|
|
45
46
|
* It uses the [[CustomNumberEditor]] React component.
|
|
46
47
|
* @alpha
|
|
48
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
47
49
|
*/
|
|
48
50
|
export declare class CustomNumberPropertyEditor extends PropertyEditorBase {
|
|
49
51
|
get reactNode(): React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAOV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAOV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAQhE,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,kBACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,uBAAuB,CACxE,YAAW,UAAU;;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,eAAe,CAA4B;IAGnD,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,UAAU,CAA4B;IAE9C,SAAyB,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAE/D;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IA8FnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,kBAAkB;IA8B1B,OAAO,CAAC,iBAAiB,CAEvB;IAEc,iBAAiB;IAKjB,oBAAoB;IAIpB,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAMjE,OAAO,CAAC,uBAAuB;IAuB/B,OAAO,CAAC,iBAAiB;IAgGzB,OAAO,CAAC,6BAA6B;IAQrC,OAAO,CAAC,WAAW,CAkBjB;IAEF,OAAO,CAAC,QAAQ,CAEd;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;CAiD1C;AAED;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IACD,IAAoB,sBAAsB,IAAI,OAAO,CAEpD;CACF"}
|
|
@@ -17,6 +17,7 @@ import { UiComponents } from "../UiComponents.js";
|
|
|
17
17
|
import { PropertyEditorBase } from "./PropertyEditorManager.js";
|
|
18
18
|
/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.
|
|
19
19
|
* @alpha
|
|
20
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
20
21
|
*/
|
|
21
22
|
export class CustomNumberEditor extends React.PureComponent {
|
|
22
23
|
_isMounted = false;
|
|
@@ -298,15 +299,14 @@ export class CustomNumberEditor extends React.PureComponent {
|
|
|
298
299
|
autoFocus: this.shouldSetFocus(),
|
|
299
300
|
onKeyDown: this._onKeyPress,
|
|
300
301
|
};
|
|
301
|
-
const icon = this.state.iconSpec ? (
|
|
302
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
303
|
-
React.createElement(Icon, { iconSpec: this.state.iconSpec })) : undefined;
|
|
302
|
+
const icon = this.state.iconSpec ? (React.createElement(Icon, { iconSpec: this.state.iconSpec })) : undefined;
|
|
304
303
|
return (React.createElement(LockNumberEditor, { ...inputProps, ref: this._inputElement, id: this.props.propertyRecord?.property.name, icon: icon, decoration: decoration }));
|
|
305
304
|
}
|
|
306
305
|
}
|
|
307
306
|
/** Custom Property Editor registered for the "number" type name and the "number-custom" editor name.
|
|
308
307
|
* It uses the [[CustomNumberEditor]] React component.
|
|
309
308
|
* @alpha
|
|
309
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
310
310
|
*/
|
|
311
311
|
export class CustomNumberPropertyEditor extends PropertyEditorBase {
|
|
312
312
|
get reactNode() {
|
|
@@ -325,9 +325,7 @@ const LockNumberEditor = React.forwardRef(function LockNumberEditor(props, forwa
|
|
|
325
325
|
decoration));
|
|
326
326
|
}
|
|
327
327
|
if (icon) {
|
|
328
|
-
return (
|
|
329
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
330
|
-
React.createElement(IconInput, { ...rest, ref: forwardedRef, icon: icon, "data-testid": "components-customnumber-editor" }));
|
|
328
|
+
return (React.createElement(IconInput, { ...rest, ref: forwardedRef, icon: icon, "data-testid": "components-customnumber-editor" }));
|
|
331
329
|
}
|
|
332
330
|
return (React.createElement(Input, { ...rest, ref: forwardedRef, "data-testid": "components-customnumber-editor", size: "small" }));
|
|
333
331
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAU7C,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,OAAO,GACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAahE;;GAEG;AACH,MAAM,OAAO,kBACX,SAAQ,KAAK,CAAC,aAA2D;IAGjE,UAAU,GAAG,KAAK,CAAC;IACnB,aAAa,CAA0C;IACvD,aAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;IACpD,eAAe,CAA4B;IAEnD,2CAA2C;IACnC,eAAe,CAAqB;IACpC,UAAU,CAA4B;IAErB,KAAK,GAAsC;QAClE,UAAU,EAAE,EAAE;KACf,CAAC;IAEK,KAAK,CAAC,gBAAgB;QAC3B,yEAAyE;QACzE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE7C,IACE,IAAI,CAA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","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./CustomNumberEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type {\n CustomFormattedNumberParams,\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n MessageSeverity,\n PropertyEditorParamTypes,\n PropertyValueFormat,\n UiAdmin,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport { Input, InputWithDecorations } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents.js\";\nimport type {\n InternalInputEditorProps,\n PropertyEditorProps,\n TypeEditor,\n} from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport type { IconNodeEditorParams } from \"../../internal.js\";\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\ninterface CustomNumberEditorState {\n inputValue: string;\n size?: number;\n maxSize?: number;\n maxLength?: number;\n iconSpec?: React.ReactNode;\n}\n\n/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.\n * @alpha\n */\nexport class CustomNumberEditor\n extends React.PureComponent<PropertyEditorProps, CustomNumberEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _formatParams: CustomFormattedNumberParams | undefined;\n private _inputElement = React.createRef<HTMLInputElement>();\n private _lastValidValue: PropertyValue | undefined;\n\n // Used to track the last user typed value.\n private _lastInputValue: string | undefined;\n private _lastValue: PropertyValue | undefined;\n\n public override readonly state: Readonly<CustomNumberEditorState> = {\n inputValue: \"\",\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n // This is called by the container to commit the value. Format the value.\n this._lastInputValue = undefined;\n this._lastValue = undefined;\n\n const value = await this.#getPropertyValue();\n\n if (\n this.props.shouldCommitOnChange &&\n this._formatParams &&\n isPrimitiveValue(value) &&\n typeof value.value === \"number\"\n ) {\n const newDisplayValue = this._formatParams.formatFunction(value.value);\n this.setState({\n inputValue: newDisplayValue,\n });\n }\n return value;\n }\n\n async #getPropertyValue(): Promise<PropertyValue | undefined> {\n // This is called by the editor to get the current input value as a PropertyValue.\n const record = this.props.propertyRecord as PropertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record.isReadonly) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: (record.value as PrimitiveValue).displayValue,\n };\n }\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const parseResults = (\n this._formatParams as CustomFormattedNumberParams\n ).parseFunction(this.state.inputValue);\n if (!parseResults.parseError && undefined !== parseResults.value) {\n const newDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(parseResults.value as number);\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: parseResults.value,\n displayValue: newDisplayValue,\n };\n this._lastValidValue = { ...propertyValue };\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\"\n if (\n // This should not happen in a getter, for now fix only if shouldCommitOnChange is true.\n !this.props.shouldCommitOnChange &&\n newDisplayValue !== this.state.inputValue\n ) {\n this.setState({ inputValue: newDisplayValue });\n }\n } else {\n if (this.htmlElement) {\n UiAdmin.messagePresenter.displayInputFieldMessage(\n this.htmlElement,\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : UiComponents.translate(\"errors.unable-to-parse-quantity\")\n );\n this.htmlElement.focus();\n } else {\n UiAdmin.messagePresenter.displayMessage(\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : UiComponents.translate(\"errors.unable-to-parse-quantity\")\n );\n }\n\n const displayValue =\n record.value.displayValue && record.value.displayValue.length > 0\n ? record.value.displayValue\n : (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(record.value.value as number);\n propertyValue = this._lastValidValue\n ? { ...this._lastValidValue }\n : {\n valueFormat: PropertyValueFormat.Primitive,\n value: record.value.value,\n displayValue,\n };\n }\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private shouldSetFocus(): boolean {\n if (!this.props.setFocus) return false;\n\n const record = this.props.propertyRecord as PropertyRecord;\n const disabled = record && !record.isDisabled ? false : true;\n const readonly = record && !record.isReadonly ? false : true;\n\n return !disabled && !readonly;\n }\n\n private _applyUpdatedValue(userInput: string) {\n const record = this.props.propertyRecord as PropertyRecord;\n const readonly = record && !record.isReadonly ? false : true;\n const disabled = record && !record.isDisabled ? false : true;\n\n if (readonly || disabled) return;\n\n if (this._isMounted)\n this.setState(\n {\n inputValue: userInput,\n },\n async () => {\n if (!this.props.shouldCommitOnChange) return;\n if (!this.props.onCommit) return;\n if (!this.props.propertyRecord) return;\n\n const newValue = await this.#getPropertyValue();\n if (!newValue) return;\n\n this._lastInputValue = this.state.inputValue;\n this._lastValue = newValue;\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\n });\n }\n );\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n this._applyUpdatedValue(e.target.value);\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps();\n }\n }\n\n private _getInitialDisplayValue(): string {\n const record = this.props.propertyRecord;\n let initialDisplayValue = \"\";\n let numberValue = 0;\n if (record) {\n if (record.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = record.value;\n numberValue =\n undefined !== primitiveValue.value\n ? (primitiveValue.value as number)\n : 0;\n if (primitiveValue.displayValue)\n initialDisplayValue = primitiveValue.displayValue;\n else\n initialDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(numberValue);\n }\n }\n\n return initialDisplayValue;\n }\n\n private setStateFromProps() {\n if (!this._isMounted) return;\n\n const record = this.props.propertyRecord;\n if (!record || !record.property) {\n Logger.logError(\n UiComponents.loggerCategory(\"CustomNumberEditor\"),\n \"PropertyRecord must be defined to use CustomNumberPropertyEditor\"\n );\n return;\n }\n if (\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n this._formatParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type ===\n PropertyEditorParamTypes.CustomFormattedNumber.valueOf()\n ) as CustomFormattedNumberParams;\n }\n\n if (!this._formatParams) {\n Logger.logError(\n UiComponents.loggerCategory(\"CustomNumberEditor\"),\n `CustomFormattedNumberParams must be defined for property ${record.property.name}`\n );\n return;\n }\n\n const initialDisplayValue = this._getInitialDisplayValue();\n this._lastValidValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: initialDisplayValue,\n };\n let size: number | undefined;\n let maxSize: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: React.ReactNode | undefined;\n\n if (\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n if (editorSizeParams.size) size = editorSizeParams.size;\n if (editorSizeParams.maxSize) maxSize = editorSizeParams.maxSize;\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon.valueOf()\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n\n const iconNodeParam = record.property.editor.params.find(\n (param): param is IconNodeEditorParams =>\n param.type ===\n (\"appui-icon-node\" satisfies IconNodeEditorParams[\"type\"])\n );\n if (iconNodeParam) {\n iconSpec = iconNodeParam.icon;\n }\n }\n\n let inputValue = initialDisplayValue;\n if (\n this.props.shouldCommitOnChange &&\n this._lastInputValue &&\n isPrimitiveValue(this._lastValue) &&\n isPrimitiveValue(this.props.propertyRecord?.value) &&\n this._lastValue.value === this.props.propertyRecord.value.value\n ) {\n // If the value matches the user-entered value - keep it unformatted.\n inputValue = this._lastInputValue;\n }\n\n this.setState({\n inputValue,\n size,\n maxLength,\n maxSize,\n iconSpec,\n });\n }\n\n private _resetToLastValidDisplayValue() {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n this._getInitialDisplayValue();\n this.setState({ inputValue: initialDisplayValue });\n }\n\n private _onKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === Key.Escape.valueOf()) {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n this._getInitialDisplayValue();\n if (initialDisplayValue !== this.state.inputValue) {\n e.preventDefault();\n e.stopPropagation();\n this._resetToLastValidDisplayValue();\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n }\n\n if (e.key !== Key.Enter.valueOf()) {\n UiAdmin.messagePresenter.closeInputFieldMessage();\n }\n };\n\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n e.target.select();\n };\n\n public override render(): React.ReactNode {\n const { decoration } = this.props as InternalInputEditorProps;\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n maxWidth: this.state.maxSize\n ? `${this.state.maxSize * 0.75}em`\n : undefined,\n };\n const record = this.props.propertyRecord as PropertyRecord;\n if (!record || !this._formatParams) return null;\n\n const readOnly = !record.isReadonly ? false : true;\n const disabled = !record.isDisabled ? false : true;\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-customnumber-editor\",\n this.props.className\n );\n\n const inputProps: Omit<InputProps, \"size\"> = {\n className,\n style: this.props.style ? this.props.style : style,\n readOnly,\n disabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateInputValue,\n onBlur: this.props.onBlur,\n onFocus: this._onFocus,\n autoFocus: this.shouldSetFocus(),\n onKeyDown: this._onKeyPress,\n };\n\n const icon = this.state.iconSpec ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={this.state.iconSpec} />\n ) : undefined;\n\n return (\n <LockNumberEditor\n {...inputProps}\n ref={this._inputElement}\n id={this.props.propertyRecord?.property.name}\n icon={icon}\n decoration={decoration}\n />\n );\n }\n}\n\n/** Custom Property Editor registered for the \"number\" type name and the \"number-custom\" editor name.\n * It uses the [[CustomNumberEditor]] React component.\n * @alpha\n */\nexport class CustomNumberPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <CustomNumberEditor />;\n }\n public override get containerHandlesEscape(): boolean {\n return false;\n }\n}\n\ninterface LockNumberEditorProps extends InputProps {\n icon?: React.ReactNode;\n decoration?: React.ReactNode;\n}\n\nconst LockNumberEditor = React.forwardRef<\n HTMLInputElement,\n LockNumberEditorProps\n>(function LockNumberEditor(props, forwardedRef) {\n const { icon, decoration, ...rest } = props;\n if (decoration) {\n return (\n <InputWithDecorations size=\"small\">\n {icon && (\n <InputWithDecorations.Icon size=\"small\">\n {icon}\n </InputWithDecorations.Icon>\n )}\n <InputWithDecorations.Input\n {...rest}\n ref={forwardedRef}\n data-testid=\"components-customnumber-editor\"\n size=\"small\"\n />\n {decoration}\n </InputWithDecorations>\n );\n }\n\n if (icon) {\n return (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <IconInput\n {...rest}\n ref={forwardedRef}\n icon={icon}\n data-testid=\"components-customnumber-editor\"\n />\n );\n }\n return (\n <Input\n {...rest}\n ref={forwardedRef}\n data-testid=\"components-customnumber-editor\"\n size=\"small\"\n />\n );\n});\n\nfunction isPrimitiveValue(value?: PropertyValue): value is PrimitiveValue {\n return value?.valueFormat === PropertyValueFormat.Primitive;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAU7C,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,OAAO,GACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAgBhE;;;GAGG;AACH,MAAM,OAAO,kBACX,SAAQ,KAAK,CAAC,aAA2D;IAGjE,UAAU,GAAG,KAAK,CAAC;IACnB,aAAa,CAA0C;IACvD,aAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;IACpD,eAAe,CAA4B;IAEnD,2CAA2C;IACnC,eAAe,CAAqB;IACpC,UAAU,CAA4B;IAErB,KAAK,GAAsC;QAClE,UAAU,EAAE,EAAE;KACf,CAAC;IAEK,KAAK,CAAC,gBAAgB;QAC3B,yEAAyE;QACzE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,UAAU,GAA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,OAAO,KAAK,EAAE,WAAW,KAAK,mBAAmB,CAAC,SAAS,CAAC;AAC9D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./CustomNumberEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type {\n CustomFormattedNumberParams,\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n MessageSeverity,\n PropertyEditorParamTypes,\n PropertyValueFormat,\n UiAdmin,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport { Input, InputWithDecorations } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents.js\";\nimport type {\n InternalInputEditorProps,\n PropertyEditorProps,\n TypeEditor,\n} from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport type { IconNodeEditorParams } from \"../../internal.js\";\nimport { EditorRenderer } from \"../new-editors/EditorRenderer.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\ninterface CustomNumberEditorState {\n inputValue: string;\n size?: number;\n maxSize?: number;\n maxLength?: number;\n iconSpec?: React.ReactNode;\n}\n\n/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.\n * @alpha\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class CustomNumberEditor\n extends React.PureComponent<PropertyEditorProps, CustomNumberEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _formatParams: CustomFormattedNumberParams | undefined;\n private _inputElement = React.createRef<HTMLInputElement>();\n private _lastValidValue: PropertyValue | undefined;\n\n // Used to track the last user typed value.\n private _lastInputValue: string | undefined;\n private _lastValue: PropertyValue | undefined;\n\n public override readonly state: Readonly<CustomNumberEditorState> = {\n inputValue: \"\",\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n // This is called by the container to commit the value. Format the value.\n this._lastInputValue = undefined;\n this._lastValue = undefined;\n\n const value = await this.#getPropertyValue();\n\n if (\n this.props.shouldCommitOnChange &&\n this._formatParams &&\n isPrimitiveValue(value) &&\n typeof value.value === \"number\"\n ) {\n const newDisplayValue = this._formatParams.formatFunction(value.value);\n this.setState({\n inputValue: newDisplayValue,\n });\n }\n return value;\n }\n\n async #getPropertyValue(): Promise<PropertyValue | undefined> {\n // This is called by the editor to get the current input value as a PropertyValue.\n const record = this.props.propertyRecord as PropertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record.isReadonly) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: (record.value as PrimitiveValue).displayValue,\n };\n }\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const parseResults = (\n this._formatParams as CustomFormattedNumberParams\n ).parseFunction(this.state.inputValue);\n if (!parseResults.parseError && undefined !== parseResults.value) {\n const newDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(parseResults.value as number);\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: parseResults.value,\n displayValue: newDisplayValue,\n };\n this._lastValidValue = { ...propertyValue };\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\"\n if (\n // This should not happen in a getter, for now fix only if shouldCommitOnChange is true.\n !this.props.shouldCommitOnChange &&\n newDisplayValue !== this.state.inputValue\n ) {\n this.setState({ inputValue: newDisplayValue });\n }\n } else {\n if (this.htmlElement) {\n UiAdmin.messagePresenter.displayInputFieldMessage(\n this.htmlElement,\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : UiComponents.translate(\"errors.unable-to-parse-quantity\")\n );\n this.htmlElement.focus();\n } else {\n UiAdmin.messagePresenter.displayMessage(\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : UiComponents.translate(\"errors.unable-to-parse-quantity\")\n );\n }\n\n const displayValue =\n record.value.displayValue && record.value.displayValue.length > 0\n ? record.value.displayValue\n : (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(record.value.value as number);\n propertyValue = this._lastValidValue\n ? { ...this._lastValidValue }\n : {\n valueFormat: PropertyValueFormat.Primitive,\n value: record.value.value,\n displayValue,\n };\n }\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private shouldSetFocus(): boolean {\n if (!this.props.setFocus) return false;\n\n const record = this.props.propertyRecord as PropertyRecord;\n const disabled = record && !record.isDisabled ? false : true;\n const readonly = record && !record.isReadonly ? false : true;\n\n return !disabled && !readonly;\n }\n\n private _applyUpdatedValue(userInput: string) {\n const record = this.props.propertyRecord as PropertyRecord;\n const readonly = record && !record.isReadonly ? false : true;\n const disabled = record && !record.isDisabled ? false : true;\n\n if (readonly || disabled) return;\n\n if (this._isMounted)\n this.setState(\n {\n inputValue: userInput,\n },\n async () => {\n if (!this.props.shouldCommitOnChange) return;\n if (!this.props.onCommit) return;\n if (!this.props.propertyRecord) return;\n\n const newValue = await this.#getPropertyValue();\n if (!newValue) return;\n\n this._lastInputValue = this.state.inputValue;\n this._lastValue = newValue;\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\n });\n }\n );\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n this._applyUpdatedValue(e.target.value);\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps();\n }\n }\n\n private _getInitialDisplayValue(): string {\n const record = this.props.propertyRecord;\n let initialDisplayValue = \"\";\n let numberValue = 0;\n if (record) {\n if (record.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = record.value;\n numberValue =\n undefined !== primitiveValue.value\n ? (primitiveValue.value as number)\n : 0;\n if (primitiveValue.displayValue)\n initialDisplayValue = primitiveValue.displayValue;\n else\n initialDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(numberValue);\n }\n }\n\n return initialDisplayValue;\n }\n\n private setStateFromProps() {\n if (!this._isMounted) return;\n\n const record = this.props.propertyRecord;\n if (!record || !record.property) {\n Logger.logError(\n UiComponents.loggerCategory(\"CustomNumberEditor\"),\n \"PropertyRecord must be defined to use CustomNumberPropertyEditor\"\n );\n return;\n }\n if (\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n this._formatParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type ===\n PropertyEditorParamTypes.CustomFormattedNumber.valueOf()\n ) as CustomFormattedNumberParams;\n }\n\n if (!this._formatParams) {\n Logger.logError(\n UiComponents.loggerCategory(\"CustomNumberEditor\"),\n `CustomFormattedNumberParams must be defined for property ${record.property.name}`\n );\n return;\n }\n\n const initialDisplayValue = this._getInitialDisplayValue();\n this._lastValidValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: initialDisplayValue,\n };\n let size: number | undefined;\n let maxSize: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: React.ReactNode | undefined;\n\n if (\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n if (editorSizeParams.size) size = editorSizeParams.size;\n if (editorSizeParams.maxSize) maxSize = editorSizeParams.maxSize;\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon.valueOf()\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n\n const iconNodeParam = record.property.editor.params.find(\n (param): param is IconNodeEditorParams =>\n param.type ===\n (\"appui-icon-node\" satisfies IconNodeEditorParams[\"type\"])\n );\n if (iconNodeParam) {\n iconSpec = iconNodeParam.icon;\n }\n }\n\n let inputValue = initialDisplayValue;\n if (\n this.props.shouldCommitOnChange &&\n this._lastInputValue &&\n isPrimitiveValue(this._lastValue) &&\n isPrimitiveValue(this.props.propertyRecord?.value) &&\n this._lastValue.value === this.props.propertyRecord.value.value\n ) {\n // If the value matches the user-entered value - keep it unformatted.\n inputValue = this._lastInputValue;\n }\n\n this.setState({\n inputValue,\n size,\n maxLength,\n maxSize,\n iconSpec,\n });\n }\n\n private _resetToLastValidDisplayValue() {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n this._getInitialDisplayValue();\n this.setState({ inputValue: initialDisplayValue });\n }\n\n private _onKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === Key.Escape.valueOf()) {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n this._getInitialDisplayValue();\n if (initialDisplayValue !== this.state.inputValue) {\n e.preventDefault();\n e.stopPropagation();\n this._resetToLastValidDisplayValue();\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n }\n\n if (e.key !== Key.Enter.valueOf()) {\n UiAdmin.messagePresenter.closeInputFieldMessage();\n }\n };\n\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n e.target.select();\n };\n\n public override render(): React.ReactNode {\n const { decoration } = this.props as InternalInputEditorProps;\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n maxWidth: this.state.maxSize\n ? `${this.state.maxSize * 0.75}em`\n : undefined,\n };\n const record = this.props.propertyRecord as PropertyRecord;\n if (!record || !this._formatParams) return null;\n\n const readOnly = !record.isReadonly ? false : true;\n const disabled = !record.isDisabled ? false : true;\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-customnumber-editor\",\n this.props.className\n );\n\n const inputProps: Omit<InputProps, \"size\"> = {\n className,\n style: this.props.style ? this.props.style : style,\n readOnly,\n disabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateInputValue,\n onBlur: this.props.onBlur,\n onFocus: this._onFocus,\n autoFocus: this.shouldSetFocus(),\n onKeyDown: this._onKeyPress,\n };\n\n const icon = this.state.iconSpec ? (\n <Icon iconSpec={this.state.iconSpec} />\n ) : undefined;\n\n return (\n <LockNumberEditor\n {...inputProps}\n ref={this._inputElement}\n id={this.props.propertyRecord?.property.name}\n icon={icon}\n decoration={decoration}\n />\n );\n }\n}\n\n/** Custom Property Editor registered for the \"number\" type name and the \"number-custom\" editor name.\n * It uses the [[CustomNumberEditor]] React component.\n * @alpha\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class CustomNumberPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <CustomNumberEditor />;\n }\n public override get containerHandlesEscape(): boolean {\n return false;\n }\n}\n\ninterface LockNumberEditorProps extends InputProps {\n icon?: React.ReactNode;\n decoration?: React.ReactNode;\n}\n\nconst LockNumberEditor = React.forwardRef<\n HTMLInputElement,\n LockNumberEditorProps\n>(function LockNumberEditor(props, forwardedRef) {\n const { icon, decoration, ...rest } = props;\n if (decoration) {\n return (\n <InputWithDecorations size=\"small\">\n {icon && (\n <InputWithDecorations.Icon size=\"small\">\n {icon}\n </InputWithDecorations.Icon>\n )}\n <InputWithDecorations.Input\n {...rest}\n ref={forwardedRef}\n data-testid=\"components-customnumber-editor\"\n size=\"small\"\n />\n {decoration}\n </InputWithDecorations>\n );\n }\n\n if (icon) {\n return (\n <IconInput\n {...rest}\n ref={forwardedRef}\n icon={icon}\n data-testid=\"components-customnumber-editor\"\n />\n );\n }\n return (\n <Input\n {...rest}\n ref={forwardedRef}\n data-testid=\"components-customnumber-editor\"\n size=\"small\"\n />\n );\n});\n\nfunction isPrimitiveValue(value?: PropertyValue): value is PrimitiveValue {\n return value?.valueFormat === PropertyValueFormat.Primitive;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAGL,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAQhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"DateTimeEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAGL,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,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AAK,CAAC,SAAS;CA6D1C;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IACD,IAAoB,mBAAmB,IAAI,OAAO,CAEjD;CACF;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IACD,IAAoB,mBAAmB,IAAI,OAAO,CAEjD;CACF"}
|
|
@@ -208,12 +208,11 @@ export class DateTimeEditor extends React.PureComponent {
|
|
|
208
208
|
};
|
|
209
209
|
const className = classnames("components-cell-editor", "components-datetime-editor", this.props.className);
|
|
210
210
|
return (React.createElement("div", { className: className, ref: this._divElement },
|
|
211
|
-
React.createElement(PopupButton, { label: this.state.displayValue, onClose: this._handleClose, onEnter: this._handleEnter, setFocus: this.props.setFocus, disabled: this.props.propertyRecord?.isDisabled, readonly: this.props.propertyRecord?.isReadonly },
|
|
211
|
+
React.createElement(PopupButton, { id: this.props.propertyRecord?.property.name, label: this.state.displayValue, onClose: this._handleClose, onEnter: this._handleEnter, setFocus: this.props.setFocus, disabled: this.props.propertyRecord?.isDisabled, readonly: this.props.propertyRecord?.isReadonly },
|
|
212
212
|
React.createElement(PopupContent, null,
|
|
213
213
|
React.createElement(React.Fragment, null,
|
|
214
214
|
React.createElement("div", { className: "components-date-picker-calendar-popup-panel", "data-testid": "components-date-picker-calendar-popup-panel" },
|
|
215
|
-
React.createElement(DatePicker
|
|
216
|
-
, { selected: date, onDateChange: this._handleChange, showFocusOutline: false }),
|
|
215
|
+
React.createElement(DatePicker, { selected: date, onDateChange: this._handleChange, showFocusOutline: false }),
|
|
217
216
|
this.state.timeDisplay && (React.createElement("div", { className: "time-container" },
|
|
218
217
|
React.createElement(Text, { variant: "body", className: "time-label" }, "Time"),
|
|
219
218
|
React.createElement(TimeField, { time: timeSpec, timeDisplay: this.state.timeDisplay, onTimeChange: this._handleTimeChange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AY,EAAE,IAAI,CAAC,aAAa,EAChC,gBAAgB,EAAE,KAAK,GACvB;4BACD,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CACzB,6BAAK,SAAS,EAAC,gBAAgB;gCAC7B,oBAAC,IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IACxC,MAAM,CACF;gCACP,oBAAC,SAAS,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,YAAY,EAAE,IAAI,CAAC,iBAAiB,GACpC,CACE,CACP,CACG,CACL;oBACH,oBAAC,oBAAoB,IACnB,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAC5B,CACW,CACH,CACV,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,KAAK,GAAI,CAAC;IAC7C,CAAC;IACD,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5D,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAC;IAC5C,CAAC;IACD,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./DateTimeEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n AlternateDateFormats,\n PropertyValueFormat,\n TimeDisplay,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport {\n PopupButton,\n PopupContent,\n PopupOkCancelButtons,\n} from \"./PopupButton.js\";\nimport type { TimeSpec } from \"../datepicker/TimeField.js\";\nimport { TimeField } from \"../datepicker/TimeField.js\";\nimport type { TypeConverter } from \"../converters/TypeConverter.js\";\nimport { DatePicker } from \"../datepicker/DatePicker.js\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager.js\";\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter.js\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { adjustDateToTimezone } from \"../common/DateUtils.js\";\n\n/** @internal */\ninterface DateTimeEditorState {\n value: Date;\n displayValue?: string;\n timeDisplay?: TimeDisplay;\n typeConverter?: TypeConverter;\n editInUtc: boolean;\n}\n\n/** @internal */\ninterface DateTimeEditorProps extends PropertyEditorProps {\n showTime?: boolean;\n}\n\n/** DateTimeEditor React component that is a property editor for selection of date and time.\n * @internal\n */\nexport class DateTimeEditor\n extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<DateTimeEditorState> = {\n value: new Date(),\n editInUtc: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: this.state.displayValue,\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n public async processDateChange(\n typeConverter: TypeConverter,\n newValue: Date\n ): Promise<void> {\n if (this.props.propertyRecord) {\n const displayValue = await typeConverter.convertPropertyToString(\n this.props.propertyRecord.property,\n newValue\n );\n this.setState({\n value: newValue,\n displayValue,\n });\n }\n }\n\n private _handleChange = (newValue: Date): void => {\n if (this._isMounted && this.state.typeConverter) {\n if (this.state.editInUtc) {\n newValue = adjustDateToTimezone(\n newValue,\n newValue.getTimezoneOffset() * -1\n );\n }\n\n void this.processDateChange(this.state.typeConverter, newValue);\n }\n };\n\n private _handleTimeChange = (time: TimeSpec): void => {\n // Combine new time into selected Date\n if (this.state.editInUtc) {\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n } else {\n const newWorkingDate = new Date(this.state.value.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n }\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue: Date | undefined;\n let typeConverter: TypeConverter | undefined;\n let timeDisplay: TimeDisplay | undefined;\n let alternateDateFormat = AlternateDateFormats.None;\n let editInUtc = false;\n\n if (this.props.showTime) timeDisplay = TimeDisplay.H12MC;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n if (record.value.value instanceof Date)\n initialValue = new Date(record.value.value);\n else if (typeof record.value.value === \"string\")\n initialValue = new Date(record.value.value);\n else if (record.value.value === undefined) initialValue = new Date();\n\n typeConverter = TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n );\n\n const options = record.property.converter?.options;\n if (options) {\n if (\"alternateDateFormat\" in options) {\n if (\n DateTimeTypeConverterBase.isAlternateDateFormats(\n options.alternateDateFormat\n )\n ) {\n timeDisplay = TimeDisplay.H24MS;\n alternateDateFormat = options.alternateDateFormat;\n }\n }\n\n if (\"timeDisplay\" in options && this.props.showTime) {\n timeDisplay = options.timeDisplay;\n // use 24 hr time display if alternateDateFormat is defined\n if (\n alternateDateFormat &&\n timeDisplay !== TimeDisplay.H24MS &&\n timeDisplay !== TimeDisplay.H24M\n )\n timeDisplay = TimeDisplay.H24MS;\n }\n\n if (alternateDateFormat) {\n editInUtc = true;\n\n if (this.props.showTime) {\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\n }\n } else {\n timeDisplay = undefined;\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\n alternateDateFormat = AlternateDateFormats.IsoShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\n alternateDateFormat = AlternateDateFormats.UtcShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\n }\n }\n }\n }\n\n if (!initialValue) {\n throw new Error(\"Bad Value\");\n }\n\n if (!typeConverter) {\n throw new Error(\"Unable to determine TypeConverter\");\n }\n\n const displayValue = await typeConverter.convertPropertyToString(\n record!.property,\n initialValue\n );\n\n if (this._isMounted)\n this.setState({\n value: initialValue,\n timeDisplay,\n typeConverter,\n displayValue,\n editInUtc,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n public override render(): React.ReactNode {\n const date = this.state.editInUtc\n ? adjustDateToTimezone(this.state.value, 0)\n : this.state.value;\n const timeSpec: TimeSpec = {\n hours: date.getHours(),\n minutes: date.getMinutes(),\n seconds: date.getSeconds(),\n };\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-datetime-editor\",\n this.props.className\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.displayValue}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n disabled={this.props.propertyRecord?.isDisabled}\n readonly={this.props.propertyRecord?.isReadonly}\n >\n <PopupContent>\n <>\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line @typescript-eslint/no-deprecated\n selected={date}\n onDateChange={this._handleChange}\n showFocusOutline={false}\n />\n {this.state.timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {\"Time\"}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={this.state.timeDisplay}\n onTimeChange={this._handleTimeChange}\n />\n </div>\n )}\n </div>\n </>\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={false} />;\n }\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class DateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={true} />;\n }\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAkB9D;;GAEG;AACH,MAAM,OAAO,cACX,SAAQ,KAAK,CAAC,aAAuD;IAG7D,UAAU,GAAG,KAAK,CAAC;IACnB,SAAS,GAAG,KAAK,CAAC;IAClB,WAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;IAE/B,KAAK,GAAkC;Q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IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./DateTimeEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n AlternateDateFormats,\n PropertyValueFormat,\n TimeDisplay,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport {\n PopupButton,\n PopupContent,\n PopupOkCancelButtons,\n} from \"./PopupButton.js\";\nimport type { TimeSpec } from \"../datepicker/TimeField.js\";\nimport { TimeField } from \"../datepicker/TimeField.js\";\nimport type { TypeConverter } from \"../converters/TypeConverter.js\";\nimport { DatePicker } from \"../datepicker/DatePicker.js\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager.js\";\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter.js\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { adjustDateToTimezone } from \"../common/DateUtils.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\ninterface DateTimeEditorState {\n value: Date;\n displayValue?: string;\n timeDisplay?: TimeDisplay;\n typeConverter?: TypeConverter;\n editInUtc: boolean;\n}\n\n/** @internal */\ninterface DateTimeEditorProps extends PropertyEditorProps {\n showTime?: boolean;\n}\n\n/** DateTimeEditor React component that is a property editor for selection of date and time.\n * @internal\n */\nexport class DateTimeEditor\n extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<DateTimeEditorState> = {\n value: new Date(),\n editInUtc: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: this.state.displayValue,\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n public async processDateChange(\n typeConverter: TypeConverter,\n newValue: Date\n ): Promise<void> {\n if (this.props.propertyRecord) {\n const displayValue = await typeConverter.convertPropertyToString(\n this.props.propertyRecord.property,\n newValue\n );\n this.setState({\n value: newValue,\n displayValue,\n });\n }\n }\n\n private _handleChange = (newValue: Date): void => {\n if (this._isMounted && this.state.typeConverter) {\n if (this.state.editInUtc) {\n newValue = adjustDateToTimezone(\n newValue,\n newValue.getTimezoneOffset() * -1\n );\n }\n\n void this.processDateChange(this.state.typeConverter, newValue);\n }\n };\n\n private _handleTimeChange = (time: TimeSpec): void => {\n // Combine new time into selected Date\n if (this.state.editInUtc) {\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n } else {\n const newWorkingDate = new Date(this.state.value.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n }\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue: Date | undefined;\n let typeConverter: TypeConverter | undefined;\n let timeDisplay: TimeDisplay | undefined;\n let alternateDateFormat = AlternateDateFormats.None;\n let editInUtc = false;\n\n if (this.props.showTime) timeDisplay = TimeDisplay.H12MC;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n if (record.value.value instanceof Date)\n initialValue = new Date(record.value.value);\n else if (typeof record.value.value === \"string\")\n initialValue = new Date(record.value.value);\n else if (record.value.value === undefined) initialValue = new Date();\n\n typeConverter = TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n );\n\n const options = record.property.converter?.options;\n if (options) {\n if (\"alternateDateFormat\" in options) {\n if (\n DateTimeTypeConverterBase.isAlternateDateFormats(\n options.alternateDateFormat\n )\n ) {\n timeDisplay = TimeDisplay.H24MS;\n alternateDateFormat = options.alternateDateFormat;\n }\n }\n\n if (\"timeDisplay\" in options && this.props.showTime) {\n timeDisplay = options.timeDisplay;\n // use 24 hr time display if alternateDateFormat is defined\n if (\n alternateDateFormat &&\n timeDisplay !== TimeDisplay.H24MS &&\n timeDisplay !== TimeDisplay.H24M\n )\n timeDisplay = TimeDisplay.H24MS;\n }\n\n if (alternateDateFormat) {\n editInUtc = true;\n\n if (this.props.showTime) {\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\n }\n } else {\n timeDisplay = undefined;\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\n alternateDateFormat = AlternateDateFormats.IsoShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\n alternateDateFormat = AlternateDateFormats.UtcShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\n }\n }\n }\n }\n\n if (!initialValue) {\n throw new Error(\"Bad Value\");\n }\n\n if (!typeConverter) {\n throw new Error(\"Unable to determine TypeConverter\");\n }\n\n const displayValue = await typeConverter.convertPropertyToString(\n record!.property,\n initialValue\n );\n\n if (this._isMounted)\n this.setState({\n value: initialValue,\n timeDisplay,\n typeConverter,\n displayValue,\n editInUtc,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n public override render(): React.ReactNode {\n const date = this.state.editInUtc\n ? adjustDateToTimezone(this.state.value, 0)\n : this.state.value;\n const timeSpec: TimeSpec = {\n hours: date.getHours(),\n minutes: date.getMinutes(),\n seconds: date.getSeconds(),\n };\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-datetime-editor\",\n this.props.className\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n id={this.props.propertyRecord?.property.name}\n label={this.state.displayValue}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n disabled={this.props.propertyRecord?.isDisabled}\n readonly={this.props.propertyRecord?.isReadonly}\n >\n <PopupContent>\n <>\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker\n selected={date}\n onDateChange={this._handleChange}\n showFocusOutline={false}\n />\n {this.state.timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {\"Time\"}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={this.state.timeDisplay}\n onTimeChange={this._handleTimeChange}\n />\n </div>\n )}\n </div>\n </>\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={false} />;\n }\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class DateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={true} />;\n }\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n"]}
|
|
@@ -16,6 +16,7 @@ export interface PropertyUpdatedArgs {
|
|
|
16
16
|
}
|
|
17
17
|
/** Properties for a property editor component
|
|
18
18
|
* @public
|
|
19
|
+
* @deprecated in 5.30. This interface is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.
|
|
19
20
|
*/
|
|
20
21
|
export interface PropertyEditorProps extends CommonProps {
|
|
21
22
|
/** The property being updated. */
|
|
@@ -65,8 +66,10 @@ export interface EditorContainerProps extends CommonProps {
|
|
|
65
66
|
*/
|
|
66
67
|
shouldCommitOnChange?: boolean;
|
|
67
68
|
}
|
|
68
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Interface implemented by React based type editors
|
|
69
71
|
* @public
|
|
72
|
+
* @deprecated in 5.30. This interface is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.
|
|
70
73
|
*/
|
|
71
74
|
export interface TypeEditor {
|
|
72
75
|
getPropertyValue: () => Promise<PropertyValue | undefined>;
|
|
@@ -75,6 +78,7 @@ export interface TypeEditor {
|
|
|
75
78
|
}
|
|
76
79
|
/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.
|
|
77
80
|
* @public
|
|
81
|
+
* @deprecated in 5.30. This component is part of the old editor system. Use {@link EditorRenderer} instead.
|
|
78
82
|
*/
|
|
79
83
|
export declare function EditorContainer(props: EditorContainerProps): React.JSX.Element;
|
|
80
84
|
//# sourceMappingURL=EditorContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWrD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,m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} from "./PropertyEditorManager.js";
|
|
13
13
|
/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.
|
|
14
14
|
* @public
|
|
15
|
+
* @deprecated in 5.30. This component is part of the old editor system. Use {@link EditorRenderer} instead.
|
|
15
16
|
*/
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
17
17
|
export function EditorContainer(props) {
|
|
18
18
|
const { ignoreEditorBlur, title, shouldCommitOnChange, propertyRecord, setFocus, onCommit, onCancel, onClick, ...rest } = props;
|
|
19
19
|
const editorRef = React.useRef(undefined);
|