@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.
Files changed (197) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/lib/components-react/editors/BooleanEditor.d.ts +2 -0
  3. package/lib/components-react/editors/BooleanEditor.d.ts.map +1 -1
  4. package/lib/components-react/editors/BooleanEditor.js +3 -1
  5. package/lib/components-react/editors/BooleanEditor.js.map +1 -1
  6. package/lib/components-react/editors/CustomNumberEditor.d.ts +2 -0
  7. package/lib/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  8. package/lib/components-react/editors/CustomNumberEditor.js +4 -6
  9. package/lib/components-react/editors/CustomNumberEditor.js.map +1 -1
  10. package/lib/components-react/editors/DateTimeEditor.d.ts.map +1 -1
  11. package/lib/components-react/editors/DateTimeEditor.js +2 -3
  12. package/lib/components-react/editors/DateTimeEditor.js.map +1 -1
  13. package/lib/components-react/editors/EditorContainer.d.ts +5 -1
  14. package/lib/components-react/editors/EditorContainer.d.ts.map +1 -1
  15. package/lib/components-react/editors/EditorContainer.js +1 -1
  16. package/lib/components-react/editors/EditorContainer.js.map +1 -1
  17. package/lib/components-react/editors/EnumButtonGroupEditor.d.ts +2 -0
  18. package/lib/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
  19. package/lib/components-react/editors/EnumButtonGroupEditor.js +3 -1
  20. package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  21. package/lib/components-react/editors/EnumEditor.d.ts +2 -0
  22. package/lib/components-react/editors/EnumEditor.d.ts.map +1 -1
  23. package/lib/components-react/editors/EnumEditor.js +3 -0
  24. package/lib/components-react/editors/EnumEditor.js.map +1 -1
  25. package/lib/components-react/editors/IconEditor.d.ts +2 -0
  26. package/lib/components-react/editors/IconEditor.d.ts.map +1 -1
  27. package/lib/components-react/editors/IconEditor.js +3 -1
  28. package/lib/components-react/editors/IconEditor.js.map +1 -1
  29. package/lib/components-react/editors/ImageCheckBoxEditor.d.ts +2 -0
  30. package/lib/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  31. package/lib/components-react/editors/ImageCheckBoxEditor.js +3 -3
  32. package/lib/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  33. package/lib/components-react/editors/NumericInputEditor.d.ts +2 -0
  34. package/lib/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  35. package/lib/components-react/editors/NumericInputEditor.js +4 -4
  36. package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
  37. package/lib/components-react/editors/PopupButton.d.ts +2 -0
  38. package/lib/components-react/editors/PopupButton.d.ts.map +1 -1
  39. package/lib/components-react/editors/PopupButton.js +1 -1
  40. package/lib/components-react/editors/PopupButton.js.map +1 -1
  41. package/lib/components-react/editors/PropertyEditorManager.d.ts +11 -2
  42. package/lib/components-react/editors/PropertyEditorManager.d.ts.map +1 -1
  43. package/lib/components-react/editors/PropertyEditorManager.js +6 -1
  44. package/lib/components-react/editors/PropertyEditorManager.js.map +1 -1
  45. package/lib/components-react/editors/SliderEditor.d.ts +4 -1
  46. package/lib/components-react/editors/SliderEditor.d.ts.map +1 -1
  47. package/lib/components-react/editors/SliderEditor.js +7 -8
  48. package/lib/components-react/editors/SliderEditor.js.map +1 -1
  49. package/lib/components-react/editors/TextEditor.d.ts +1 -0
  50. package/lib/components-react/editors/TextEditor.d.ts.map +1 -1
  51. package/lib/components-react/editors/TextEditor.js +3 -6
  52. package/lib/components-react/editors/TextEditor.js.map +1 -1
  53. package/lib/components-react/editors/TextareaEditor.d.ts +2 -0
  54. package/lib/components-react/editors/TextareaEditor.d.ts.map +1 -1
  55. package/lib/components-react/editors/TextareaEditor.js +3 -1
  56. package/lib/components-react/editors/TextareaEditor.js.map +1 -1
  57. package/lib/components-react/editors/ToggleEditor.d.ts +2 -0
  58. package/lib/components-react/editors/ToggleEditor.d.ts.map +1 -1
  59. package/lib/components-react/editors/ToggleEditor.js +3 -1
  60. package/lib/components-react/editors/ToggleEditor.js.map +1 -1
  61. package/lib/components-react/editors/registerEditors.d.ts.map +1 -1
  62. package/lib/components-react/editors/registerEditors.js +1 -0
  63. package/lib/components-react/editors/registerEditors.js.map +1 -1
  64. package/lib/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
  65. package/lib/components-react/favorite/FavoritePropertyList.js +4 -1
  66. package/lib/components-react/favorite/FavoritePropertyList.js.map +1 -1
  67. package/lib/components-react/filter-builder/FilterBuilderRule.d.ts +1 -0
  68. package/lib/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
  69. package/lib/components-react/filter-builder/FilterBuilderRule.js +5 -3
  70. package/lib/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
  71. package/lib/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +1 -0
  72. package/lib/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
  73. package/lib/components-react/filter-builder/FilterBuilderRuleGroup.js +5 -5
  74. package/lib/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  75. package/lib/components-react/filter-builder/FilterBuilderRuleValue.d.ts +45 -8
  76. package/lib/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
  77. package/lib/components-react/filter-builder/FilterBuilderRuleValue.js +17 -8
  78. package/lib/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  79. package/lib/components-react/new-editors/ConstraintUtils.d.ts +62 -0
  80. package/lib/components-react/new-editors/ConstraintUtils.d.ts.map +1 -0
  81. package/lib/components-react/new-editors/ConstraintUtils.js +49 -0
  82. package/lib/components-react/new-editors/ConstraintUtils.js.map +1 -0
  83. package/lib/components-react/new-editors/Types.d.ts +6 -0
  84. package/lib/components-react/new-editors/Types.d.ts.map +1 -1
  85. package/lib/components-react/new-editors/Types.js.map +1 -1
  86. package/lib/components-react/new-editors/UseCommittableValue.d.ts +2 -5
  87. package/lib/components-react/new-editors/UseCommittableValue.d.ts.map +1 -1
  88. package/lib/components-react/new-editors/UseCommittableValue.js +4 -1
  89. package/lib/components-react/new-editors/UseCommittableValue.js.map +1 -1
  90. package/lib/components-react/new-editors/editors/BooleanEditor.d.ts +1 -1
  91. package/lib/components-react/new-editors/editors/BooleanEditor.d.ts.map +1 -1
  92. package/lib/components-react/new-editors/editors/BooleanEditor.js +2 -2
  93. package/lib/components-react/new-editors/editors/BooleanEditor.js.map +1 -1
  94. package/lib/components-react/new-editors/editors/DateEditor.d.ts +1 -1
  95. package/lib/components-react/new-editors/editors/DateEditor.d.ts.map +1 -1
  96. package/lib/components-react/new-editors/editors/DateEditor.js +2 -2
  97. package/lib/components-react/new-editors/editors/DateEditor.js.map +1 -1
  98. package/lib/components-react/new-editors/editors/DateInput.d.ts +2 -1
  99. package/lib/components-react/new-editors/editors/DateInput.d.ts.map +1 -1
  100. package/lib/components-react/new-editors/editors/DateInput.js +2 -2
  101. package/lib/components-react/new-editors/editors/DateInput.js.map +1 -1
  102. package/lib/components-react/new-editors/editors/DateTimeEditor.d.ts +1 -1
  103. package/lib/components-react/new-editors/editors/DateTimeEditor.d.ts.map +1 -1
  104. package/lib/components-react/new-editors/editors/DateTimeEditor.js +2 -2
  105. package/lib/components-react/new-editors/editors/DateTimeEditor.js.map +1 -1
  106. package/lib/components-react/new-editors/editors/EnumEditor.d.ts +1 -1
  107. package/lib/components-react/new-editors/editors/EnumEditor.d.ts.map +1 -1
  108. package/lib/components-react/new-editors/editors/EnumEditor.js +2 -2
  109. package/lib/components-react/new-editors/editors/EnumEditor.js.map +1 -1
  110. package/lib/components-react/new-editors/editors/FallbackEditor.d.ts +1 -1
  111. package/lib/components-react/new-editors/editors/FallbackEditor.d.ts.map +1 -1
  112. package/lib/components-react/new-editors/editors/FallbackEditor.js +2 -2
  113. package/lib/components-react/new-editors/editors/FallbackEditor.js.map +1 -1
  114. package/lib/components-react/new-editors/editors/NumericEditor.d.ts +2 -2
  115. package/lib/components-react/new-editors/editors/NumericEditor.d.ts.map +1 -1
  116. package/lib/components-react/new-editors/editors/NumericEditor.js +7 -3
  117. package/lib/components-react/new-editors/editors/NumericEditor.js.map +1 -1
  118. package/lib/components-react/new-editors/editors/TextEditor.d.ts +2 -2
  119. package/lib/components-react/new-editors/editors/TextEditor.d.ts.map +1 -1
  120. package/lib/components-react/new-editors/editors/TextEditor.js +4 -2
  121. package/lib/components-react/new-editors/editors/TextEditor.js.map +1 -1
  122. package/lib/components-react/new-editors/editors/ToggleEditor.d.ts +1 -1
  123. package/lib/components-react/new-editors/editors/ToggleEditor.d.ts.map +1 -1
  124. package/lib/components-react/new-editors/editors/ToggleEditor.js +2 -2
  125. package/lib/components-react/new-editors/editors/ToggleEditor.js.map +1 -1
  126. package/lib/components-react/new-editors/editors-registry/DefaultEditors.d.ts.map +1 -1
  127. package/lib/components-react/new-editors/editors-registry/DefaultEditors.js.map +1 -1
  128. package/lib/components-react/new-editors/interop/EditorInterop.d.ts +5 -4
  129. package/lib/components-react/new-editors/interop/EditorInterop.d.ts.map +1 -1
  130. package/lib/components-react/new-editors/interop/EditorInterop.js +1 -0
  131. package/lib/components-react/new-editors/interop/EditorInterop.js.map +1 -1
  132. package/lib/components-react/new-editors/interop/Metadata.d.ts +9 -6
  133. package/lib/components-react/new-editors/interop/Metadata.d.ts.map +1 -1
  134. package/lib/components-react/new-editors/interop/Metadata.js +6 -3
  135. package/lib/components-react/new-editors/interop/Metadata.js.map +1 -1
  136. package/lib/components-react/new-editors/interop/PropertyRecordEditor.d.ts +42 -3
  137. package/lib/components-react/new-editors/interop/PropertyRecordEditor.d.ts.map +1 -1
  138. package/lib/components-react/new-editors/interop/PropertyRecordEditor.js +11 -6
  139. package/lib/components-react/new-editors/interop/PropertyRecordEditor.js.map +1 -1
  140. package/lib/components-react/new-editors/interop/old-editors/Color.js +4 -4
  141. package/lib/components-react/new-editors/interop/old-editors/Color.js.map +1 -1
  142. package/lib/components-react/new-editors/interop/old-editors/CustomNumber.d.ts +4 -3
  143. package/lib/components-react/new-editors/interop/old-editors/CustomNumber.d.ts.map +1 -1
  144. package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js +11 -5
  145. package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js.map +1 -1
  146. package/lib/components-react/new-editors/interop/old-editors/Enum.js +2 -2
  147. package/lib/components-react/new-editors/interop/old-editors/Enum.js.map +1 -1
  148. package/lib/components-react/new-editors/interop/old-editors/EnumButtonGroup.js +4 -4
  149. package/lib/components-react/new-editors/interop/old-editors/EnumButtonGroup.js.map +1 -1
  150. package/lib/components-react/new-editors/interop/old-editors/NumericInput.d.ts +7 -1
  151. package/lib/components-react/new-editors/interop/old-editors/NumericInput.d.ts.map +1 -1
  152. package/lib/components-react/new-editors/interop/old-editors/NumericInput.js +21 -6
  153. package/lib/components-react/new-editors/interop/old-editors/NumericInput.js.map +1 -1
  154. package/lib/components-react/new-editors/interop/old-editors/Slider.js +4 -4
  155. package/lib/components-react/new-editors/interop/old-editors/Slider.js.map +1 -1
  156. package/lib/components-react/new-editors/interop/old-editors/TextArea.d.ts.map +1 -1
  157. package/lib/components-react/new-editors/interop/old-editors/TextArea.js +4 -4
  158. package/lib/components-react/new-editors/interop/old-editors/TextArea.js.map +1 -1
  159. package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.d.ts +8 -8
  160. package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.d.ts.map +1 -1
  161. package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.js.map +1 -1
  162. package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.d.ts +2 -2
  163. package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.d.ts.map +1 -1
  164. package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.js.map +1 -1
  165. package/lib/components-react/new-editors/values/Metadata.d.ts +22 -0
  166. package/lib/components-react/new-editors/values/Metadata.d.ts.map +1 -1
  167. package/lib/components-react/new-editors/values/Metadata.js.map +1 -1
  168. package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts.map +1 -1
  169. package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +4 -1
  170. package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  171. package/lib/components-react/properties/renderers/PropertyRenderer.d.ts +45 -7
  172. package/lib/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  173. package/lib/components-react/properties/renderers/PropertyRenderer.js +13 -5
  174. package/lib/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  175. package/lib/components-react/propertygrid/component/PropertyList.d.ts +40 -10
  176. package/lib/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  177. package/lib/components-react/propertygrid/component/PropertyList.js +7 -2
  178. package/lib/components-react/propertygrid/component/PropertyList.js.map +1 -1
  179. package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +37 -33
  180. package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  181. package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js +10 -4
  182. package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  183. package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +41 -5
  184. package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
  185. package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +6 -4
  186. package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
  187. package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +3 -1
  188. package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  189. package/lib/components-react.d.ts +2 -1
  190. package/lib/components-react.d.ts.map +1 -1
  191. package/lib/components-react.js +1 -0
  192. package/lib/components-react.js.map +1 -1
  193. package/lib/internal.d.ts +1 -1
  194. package/lib/internal.d.ts.map +1 -1
  195. package/lib/internal.js +1 -1
  196. package/lib/internal.js.map +1 -1
  197. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/DateTimeEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,GAC8B;IACtC,OAAO,CACL,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EAAE,KAAK,EACnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;YACrB,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChC,CAAC,EACD,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,IAAI,GACpB,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\nimport type { DateValue } from \"../values/Values.js\";\nimport { DateInput } from \"./DateInput.js\";\n\n/* v8 ignore start */\n\n/**\n * Date time value editor that render `DatePicker` component with time selector for changing value.\n * @internal\n */\nexport function DateTimeEditor({\n value,\n onChange,\n commit,\n size,\n disabled,\n}: EditorProps<ValueMetadata, DateValue>) {\n return (\n <DateInput\n value={value?.value}\n onChange={(newValue) => {\n onChange({ value: newValue });\n }}\n onClose={commit}\n size={size}\n disabled={disabled}\n showTimePicker={true}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
1
+ {"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/DateTimeEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,EAAE,GACoC;IACtC,OAAO,CACL,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EAAE,KAAK,EACnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;YACrB,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChC,CAAC,EACD,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,IAAI,EACpB,EAAE,EAAE,EAAE,GACN,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\nimport type { DateValue } from \"../values/Values.js\";\nimport { DateInput } from \"./DateInput.js\";\n\n/* v8 ignore start */\n\n/**\n * Date time value editor that render `DatePicker` component with time selector for changing value.\n * @internal\n */\nexport function DateTimeEditor({\n value,\n onChange,\n commit,\n size,\n disabled,\n id,\n}: EditorProps<ValueMetadata, DateValue>) {\n return (\n <DateInput\n value={value?.value}\n onChange={(newValue) => {\n onChange({ value: newValue });\n }}\n onClose={commit}\n size={size}\n disabled={disabled}\n showTimePicker={true}\n id={id}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
@@ -6,5 +6,5 @@ import type { EnumValue } from "../values/Values.js";
6
6
  * Enum value editor that renders `Select` component for changing value.
7
7
  * @internal
8
8
  */
9
- export declare function EnumEditor({ metadata, value, onChange, commit, size, disabled, }: EditorProps<EnumValueMetadata, EnumValue>): React.JSX.Element;
9
+ export declare function EnumEditor({ metadata, value, onChange, commit, size, disabled, id, }: EditorProps<EnumValueMetadata, EnumValue>): React.JSX.Element;
10
10
  //# sourceMappingURL=EnumEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnumEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/EnumEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,GACT,EAAE,WAAW,CAAC,iBAAiB,EAAE,SAAS,CAAC,qBAoB3C"}
1
+ {"version":3,"file":"EnumEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/EnumEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,iBAAiB,EAAE,SAAS,CAAC,qBAqB3C"}
@@ -9,7 +9,7 @@ import { Select } from "@itwin/itwinui-react";
9
9
  * Enum value editor that renders `Select` component for changing value.
10
10
  * @internal
11
11
  */
12
- export function EnumEditor({ metadata, value, onChange, commit, size, disabled, }) {
12
+ export function EnumEditor({ metadata, value, onChange, commit, size, disabled, id, }) {
13
13
  const choices = metadata.choices;
14
14
  const currentValue = getEnumValue(value, choices);
15
15
  const handleChange = (newChoice) => {
@@ -18,7 +18,7 @@ export function EnumEditor({ metadata, value, onChange, commit, size, disabled,
18
18
  onChange(newValue);
19
19
  commit?.();
20
20
  };
21
- return (React.createElement(Select, { size: size, value: currentValue.choice, onChange: handleChange, options: choices.map((c) => ({ value: c.value, label: c.label })), disabled: disabled }));
21
+ return (React.createElement(Select, { id: id, size: size, value: currentValue.choice, onChange: handleChange, options: choices.map((c) => ({ value: c.value, label: c.label })), disabled: disabled }));
22
22
  }
23
23
  function getEnumValue(value, choices) {
24
24
  const defaultValue = choices.length > 0
@@ -1 +1 @@
1
- {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/EnumEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,GACkC;IAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;IACjC,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,CAAC,SAA0B,EAAE,EAAE;QAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC;QACnE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,MAAM,EAAE,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,IACL,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,YAAY,CAAC,MAAM,EAC1B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EACjE,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,KAA4B,EAC5B,OAAqB;IAErB,MAAM,YAAY,GAChB,OAAO,CAAC,MAAM,GAAG,CAAC;QAChB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;QACvD,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC;AACtC,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Select } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { EnumChoice, EnumValueMetadata } from \"../values/Metadata.js\";\nimport type { EnumValue } from \"../values/Values.js\";\n\n/* v8 ignore start */\n\n/**\n * Enum value editor that renders `Select` component for changing value.\n * @internal\n */\nexport function EnumEditor({\n metadata,\n value,\n onChange,\n commit,\n size,\n disabled,\n}: EditorProps<EnumValueMetadata, EnumValue>) {\n const choices = metadata.choices;\n const currentValue = getEnumValue(value, choices);\n\n const handleChange = (newChoice: number | string) => {\n const choice = choices.find((c) => c.value === newChoice);\n const newValue = { choice: newChoice, label: choice?.label ?? \"\" };\n onChange(newValue);\n commit?.();\n };\n\n return (\n <Select\n size={size}\n value={currentValue.choice}\n onChange={handleChange}\n options={choices.map((c) => ({ value: c.value, label: c.label }))}\n disabled={disabled}\n />\n );\n}\n\nfunction getEnumValue(\n value: EnumValue | undefined,\n choices: EnumChoice[]\n): EnumValue {\n const defaultValue =\n choices.length > 0\n ? { choice: choices[0].value, label: choices[0].label }\n : { choice: \"\", label: \"\" };\n return value ? value : defaultValue;\n}\n\n/* v8 ignore stop */\n"]}
1
+ {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/EnumEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,EAAE,GACwC;IAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;IACjC,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,CAAC,SAA0B,EAAE,EAAE;QAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC;QACnE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,MAAM,EAAE,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,IACL,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,YAAY,CAAC,MAAM,EAC1B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EACjE,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,KAA4B,EAC5B,OAAqB;IAErB,MAAM,YAAY,GAChB,OAAO,CAAC,MAAM,GAAG,CAAC;QAChB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;QACvD,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC;AACtC,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Select } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { EnumChoice, EnumValueMetadata } from \"../values/Metadata.js\";\nimport type { EnumValue } from \"../values/Values.js\";\n\n/* v8 ignore start */\n\n/**\n * Enum value editor that renders `Select` component for changing value.\n * @internal\n */\nexport function EnumEditor({\n metadata,\n value,\n onChange,\n commit,\n size,\n disabled,\n id,\n}: EditorProps<EnumValueMetadata, EnumValue>) {\n const choices = metadata.choices;\n const currentValue = getEnumValue(value, choices);\n\n const handleChange = (newChoice: number | string) => {\n const choice = choices.find((c) => c.value === newChoice);\n const newValue = { choice: newChoice, label: choice?.label ?? \"\" };\n onChange(newValue);\n commit?.();\n };\n\n return (\n <Select\n id={id}\n size={size}\n value={currentValue.choice}\n onChange={handleChange}\n options={choices.map((c) => ({ value: c.value, label: c.label }))}\n disabled={disabled}\n />\n );\n}\n\nfunction getEnumValue(\n value: EnumValue | undefined,\n choices: EnumChoice[]\n): EnumValue {\n const defaultValue =\n choices.length > 0\n ? { choice: choices[0].value, label: choices[0].label }\n : { choice: \"\", label: \"\" };\n return value ? value : defaultValue;\n}\n\n/* v8 ignore stop */\n"]}
@@ -4,5 +4,5 @@ import type { EditorProps } from "../Types.js";
4
4
  * Fallback editor that renders readonly value if no editor is found.
5
5
  * @internal
6
6
  */
7
- export declare function FallbackEditor({ value, size }: EditorProps): React.JSX.Element;
7
+ export declare function FallbackEditor({ value, size, id }: EditorProps): React.JSX.Element;
8
8
  //# sourceMappingURL=FallbackEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/FallbackEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAa/C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,WAAW,qBAE1D"}
1
+ {"version":3,"file":"FallbackEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/FallbackEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAa/C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,WAAW,qBAE9D"}
@@ -10,8 +10,8 @@ import { isBoolean, isDate, isEnum, isInstanceKey, isNumeric, isText, } from "..
10
10
  * Fallback editor that renders readonly value if no editor is found.
11
11
  * @internal
12
12
  */
13
- export function FallbackEditor({ value, size }) {
14
- return React.createElement(Input, { readOnly: true, value: getTextValue(value), size: size });
13
+ export function FallbackEditor({ value, size, id }) {
14
+ return React.createElement(Input, { id: id, readOnly: true, value: getTextValue(value), size: size });
15
15
  }
16
16
  function getTextValue(value) {
17
17
  if (value === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/FallbackEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,aAAa,EACb,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAErC,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAe;IACzD,OAAO,oBAAC,KAAK,IAAC,QAAQ,QAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;AACpE,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACxC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACpC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,CAAC;IACD,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC,YAAY,CAAC;IAC5B,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IACD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { Value } from \"../values/Values.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isInstanceKey,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\n\n/* v8 ignore start */\n\n/**\n * Fallback editor that renders readonly value if no editor is found.\n * @internal\n */\nexport function FallbackEditor({ value, size }: EditorProps) {\n return <Input readOnly value={getTextValue(value)} size={size} />;\n}\n\nfunction getTextValue(value?: Value) {\n if (value === undefined) {\n return value;\n }\n if (isBoolean(value)) {\n return value.value ? \"true\" : \"false\";\n }\n if (isDate(value)) {\n return value.value.toDateString();\n }\n if (isEnum(value)) {\n return value.choice;\n }\n if (isNumeric(value)) {\n return value.displayValue;\n }\n if (isText(value)) {\n return value.value;\n }\n if (isInstanceKey(value)) {\n return value.label;\n }\n return \"\";\n}\n\n/* v8 ignore stop */\n"]}
1
+ {"version":3,"file":"FallbackEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/FallbackEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,aAAa,EACb,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAErC,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAe;IAC7D,OAAO,oBAAC,KAAK,IAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,QAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;AAC5E,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACxC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACpC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,CAAC;IACD,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC,YAAY,CAAC;IAC5B,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IACD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { Value } from \"../values/Values.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isInstanceKey,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\n\n/* v8 ignore start */\n\n/**\n * Fallback editor that renders readonly value if no editor is found.\n * @internal\n */\nexport function FallbackEditor({ value, size, id }: EditorProps) {\n return <Input id={id} readOnly value={getTextValue(value)} size={size} />;\n}\n\nfunction getTextValue(value?: Value) {\n if (value === undefined) {\n return value;\n }\n if (isBoolean(value)) {\n return value.value ? \"true\" : \"false\";\n }\n if (isDate(value)) {\n return value.value.toDateString();\n }\n if (isEnum(value)) {\n return value.choice;\n }\n if (isNumeric(value)) {\n return value.displayValue;\n }\n if (isText(value)) {\n return value.value;\n }\n if (isInstanceKey(value)) {\n return value.label;\n }\n return \"\";\n}\n\n/* v8 ignore stop */\n"]}
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
2
  import type { EditorProps } from "../Types.js";
3
- import type { ValueMetadata } from "../values/Metadata.js";
3
+ import type { NumericValueMetadata } from "../values/Metadata.js";
4
4
  import type { NumericValue } from "../values/Values.js";
5
5
  /**
6
6
  * Numeric value editor that renders `Input` components for changing value.
7
7
  * @internal
8
8
  */
9
- export declare function NumericEditor({ value, onChange, size, disabled, }: EditorProps<ValueMetadata, NumericValue>): React.JSX.Element;
9
+ export declare function NumericEditor({ metadata, value, onChange, size, disabled, id, }: EditorProps<NumericValueMetadata, NumericValue>): React.JSX.Element;
10
10
  //# sourceMappingURL=NumericEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,GACT,EAAE,WAAW,CAAC,aAAa,EAAE,YAAY,CAAC,qBAkB1C"}
1
+ {"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,oBAAoB,EAAE,YAAY,CAAC,qBAsBjD"}
@@ -4,19 +4,23 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from "react";
6
6
  import { Input } from "@itwin/itwinui-react";
7
+ import { applyNumericConstraints, getNumericConstraints, } from "../ConstraintUtils.js";
7
8
  /* v8 ignore start */
8
9
  /**
9
10
  * Numeric value editor that renders `Input` components for changing value.
10
11
  * @internal
11
12
  */
12
- export function NumericEditor({ value, onChange, size, disabled, }) {
13
+ export function NumericEditor({ metadata, value, onChange, size, disabled, id, }) {
13
14
  const currentValue = getNumericValue(value);
14
- return (React.createElement(Input, { value: currentValue.displayValue, onChange: (e) => {
15
+ return (React.createElement(Input, { id: id, value: currentValue.displayValue, onChange: (e) => {
15
16
  const parsedValue = parseFloat(e.target.value);
16
17
  onChange({
17
18
  rawValue: Number.isNaN(parsedValue)
18
19
  ? undefined
19
- : parseFloat(e.target.value),
20
+ : applyNumericConstraints({
21
+ ...getNumericConstraints(metadata.constraints),
22
+ value: parsedValue,
23
+ }),
20
24
  displayValue: e.target.value,
21
25
  });
22
26
  }, size: size, disabled: disabled }));
@@ -1 +1 @@
1
- {"version":3,"file":"NumericEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAK7C,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,GACiC;IACzC,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,YAAY,CAAC,YAAY,EAChC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/C,QAAQ,CAAC;gBACP,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;oBACjC,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC9B,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;aAC7B,CAAC,CAAC;QACL,CAAC,EACD,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAA+B;IACtD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;AACnE,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\nimport type { NumericValue } from \"../values/Values.js\";\n\n/* v8 ignore start */\n\n/**\n * Numeric value editor that renders `Input` components for changing value.\n * @internal\n */\nexport function NumericEditor({\n value,\n onChange,\n size,\n disabled,\n}: EditorProps<ValueMetadata, NumericValue>) {\n const currentValue = getNumericValue(value);\n return (\n <Input\n value={currentValue.displayValue}\n onChange={(e) => {\n const parsedValue = parseFloat(e.target.value);\n onChange({\n rawValue: Number.isNaN(parsedValue)\n ? undefined\n : parseFloat(e.target.value),\n displayValue: e.target.value,\n });\n }}\n size={size}\n disabled={disabled}\n />\n );\n}\n\nfunction getNumericValue(value: NumericValue | undefined): NumericValue {\n return value ? value : { rawValue: undefined, displayValue: \"\" };\n}\n\n/* v8 ignore stop */\n"]}
1
+ {"version":3,"file":"NumericEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GAC8C;IAChD,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,CACL,oBAAC,KAAK,IACJ,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,YAAY,CAAC,YAAY,EAChC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/C,QAAQ,CAAC;gBACP,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;oBACjC,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,uBAAuB,CAAC;wBACtB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,WAAW,CAAC;wBAC9C,KAAK,EAAE,WAAW;qBACnB,CAAC;gBACN,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;aAC7B,CAAC,CAAC;QACL,CAAC,EACD,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAA+B;IACtD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;AACnE,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { NumericValueMetadata } from \"../values/Metadata.js\";\nimport type { NumericValue } from \"../values/Values.js\";\nimport {\n applyNumericConstraints,\n getNumericConstraints,\n} from \"../ConstraintUtils.js\";\n\n/* v8 ignore start */\n\n/**\n * Numeric value editor that renders `Input` components for changing value.\n * @internal\n */\nexport function NumericEditor({\n metadata,\n value,\n onChange,\n size,\n disabled,\n id,\n}: EditorProps<NumericValueMetadata, NumericValue>) {\n const currentValue = getNumericValue(value);\n return (\n <Input\n id={id}\n value={currentValue.displayValue}\n onChange={(e) => {\n const parsedValue = parseFloat(e.target.value);\n onChange({\n rawValue: Number.isNaN(parsedValue)\n ? undefined\n : applyNumericConstraints({\n ...getNumericConstraints(metadata.constraints),\n value: parsedValue,\n }),\n displayValue: e.target.value,\n });\n }}\n size={size}\n disabled={disabled}\n />\n );\n}\n\nfunction getNumericValue(value: NumericValue | undefined): NumericValue {\n return value ? value : { rawValue: undefined, displayValue: \"\" };\n}\n\n/* v8 ignore stop */\n"]}
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
2
  import type { EditorProps } from "../Types.js";
3
- import type { ValueMetadata } from "../values/Metadata.js";
3
+ import type { TextValueMetadata } from "../values/Metadata.js";
4
4
  import type { TextValue } from "../values/Values.js";
5
5
  /**
6
6
  * Text value editor that renders `Input` component for changing value.
7
7
  * @internal
8
8
  */
9
- export declare function TextEditor({ value, onChange, size, disabled, }: EditorProps<ValueMetadata, TextValue>): React.JSX.Element;
9
+ export declare function TextEditor({ metadata, value, onChange, size, disabled, id, }: EditorProps<TextValueMetadata, TextValue>): React.JSX.Element;
10
10
  //# sourceMappingURL=TextEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,GACT,EAAE,WAAW,CAAC,aAAa,EAAE,SAAS,CAAC,qBAWvC"}
1
+ {"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,iBAAiB,EAAE,SAAS,CAAC,qBAe3C"}
@@ -4,14 +4,16 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from "react";
6
6
  import { Input } from "@itwin/itwinui-react";
7
+ import { getStringConstraints } from "../ConstraintUtils.js";
7
8
  /* v8 ignore start */
8
9
  /**
9
10
  * Text value editor that renders `Input` component for changing value.
10
11
  * @internal
11
12
  */
12
- export function TextEditor({ value, onChange, size, disabled, }) {
13
+ export function TextEditor({ metadata, value, onChange, size, disabled, id, }) {
13
14
  const currentValue = value ? value : { value: "" };
14
- return (React.createElement(Input, { value: currentValue.value, onChange: (e) => onChange({ value: e.target.value }), size: size, disabled: disabled }));
15
+ const { maxLength, minLength } = getStringConstraints(metadata.constraints);
16
+ return (React.createElement(Input, { id: id, value: currentValue.value, onChange: (e) => onChange({ value: e.target.value }), maxLength: maxLength, minLength: minLength, size: size, disabled: disabled }));
15
17
  }
16
18
  /* v8 ignore stop */
17
19
  //# sourceMappingURL=TextEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAK7C,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,GAC8B;IACtC,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAEnD,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EACpD,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\nimport type { TextValue } from \"../values/Values.js\";\n\n/* v8 ignore start */\n\n/**\n * Text value editor that renders `Input` component for changing value.\n * @internal\n */\nexport function TextEditor({\n value,\n onChange,\n size,\n disabled,\n}: EditorProps<ValueMetadata, TextValue>) {\n const currentValue = value ? value : { value: \"\" };\n\n return (\n <Input\n value={currentValue.value}\n onChange={(e) => onChange({ value: e.target.value })}\n size={size}\n disabled={disabled}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
1
+ {"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACwC;IAC1C,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACnD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,oBAAoB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE5E,OAAO,CACL,oBAAC,KAAK,IACJ,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EACpD,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { TextValueMetadata } from \"../values/Metadata.js\";\nimport type { TextValue } from \"../values/Values.js\";\nimport { getStringConstraints } from \"../ConstraintUtils.js\";\n\n/* v8 ignore start */\n\n/**\n * Text value editor that renders `Input` component for changing value.\n * @internal\n */\nexport function TextEditor({\n metadata,\n value,\n onChange,\n size,\n disabled,\n id,\n}: EditorProps<TextValueMetadata, TextValue>) {\n const currentValue = value ? value : { value: \"\" };\n const { maxLength, minLength } = getStringConstraints(metadata.constraints);\n\n return (\n <Input\n id={id}\n value={currentValue.value}\n onChange={(e) => onChange({ value: e.target.value })}\n maxLength={maxLength}\n minLength={minLength}\n size={size}\n disabled={disabled}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
@@ -6,5 +6,5 @@ import type { EditorProps } from "../Types.js";
6
6
  * Boolean value editor that renders `ToggleSwitch` component for changing value.
7
7
  * @internal
8
8
  */
9
- export declare function ToggleEditor({ value, onChange, commit, disabled, size, }: EditorProps<ValueMetadata, BooleanValue>): React.JSX.Element;
9
+ export declare function ToggleEditor({ value, onChange, commit, disabled, size, id, }: EditorProps<ValueMetadata, BooleanValue>): React.JSX.Element;
10
10
  //# sourceMappingURL=ToggleEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/ToggleEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,GACL,EAAE,WAAW,CAAC,aAAa,EAAE,YAAY,CAAC,qBAgB1C"}
1
+ {"version":3,"file":"ToggleEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/ToggleEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,EAAE,GACH,EAAE,WAAW,CAAC,aAAa,EAAE,YAAY,CAAC,qBAiB1C"}
@@ -9,14 +9,14 @@ import { ToggleSwitch } from "@itwin/itwinui-react";
9
9
  * Boolean value editor that renders `ToggleSwitch` component for changing value.
10
10
  * @internal
11
11
  */
12
- export function ToggleEditor({ value, onChange, commit, disabled, size, }) {
12
+ export function ToggleEditor({ value, onChange, commit, disabled, size, id, }) {
13
13
  const currentValue = value ?? { value: false };
14
14
  const handleChange = (e) => {
15
15
  const newValue = { value: e.target.checked };
16
16
  onChange(newValue);
17
17
  commit?.();
18
18
  };
19
- return (React.createElement(ToggleSwitch, { checked: currentValue.value, onChange: handleChange, disabled: disabled, size: size === "small" ? "small" : undefined }));
19
+ return (React.createElement(ToggleSwitch, { id: id, checked: currentValue.value, onChange: handleChange, disabled: disabled, size: size === "small" ? "small" : undefined }));
20
20
  }
21
21
  /* v8 ignore stop */
22
22
  //# sourceMappingURL=ToggleEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/ToggleEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,GACqC;IACzC,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC/C,MAAM,YAAY,GAAG,CAAC,CAAsC,EAAE,EAAE;QAC9D,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC7C,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,MAAM,EAAE,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,YAAY,IACX,OAAO,EAAE,YAAY,CAAC,KAAK,EAC3B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,GAC5C,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\nimport type { BooleanValue } from \"../values/Values.js\";\nimport type { EditorProps } from \"../Types.js\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\n\n/* v8 ignore start */\n\n/**\n * Boolean value editor that renders `ToggleSwitch` component for changing value.\n * @internal\n */\nexport function ToggleEditor({\n value,\n onChange,\n commit,\n disabled,\n size,\n}: EditorProps<ValueMetadata, BooleanValue>) {\n const currentValue = value ?? { value: false };\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = { value: e.target.checked };\n onChange(newValue);\n commit?.();\n };\n\n return (\n <ToggleSwitch\n checked={currentValue.value}\n onChange={handleChange}\n disabled={disabled}\n size={size === \"small\" ? \"small\" : undefined}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
1
+ {"version":3,"file":"ToggleEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/ToggleEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,EAAE,GACuC;IACzC,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC/C,MAAM,YAAY,GAAG,CAAC,CAAsC,EAAE,EAAE;QAC9D,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC7C,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,MAAM,EAAE,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,YAAY,IACX,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,YAAY,CAAC,KAAK,EAC3B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,GAC5C,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\nimport type { BooleanValue } from \"../values/Values.js\";\nimport type { EditorProps } from \"../Types.js\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\n\n/* v8 ignore start */\n\n/**\n * Boolean value editor that renders `ToggleSwitch` component for changing value.\n * @internal\n */\nexport function ToggleEditor({\n value,\n onChange,\n commit,\n disabled,\n size,\n id,\n}: EditorProps<ValueMetadata, BooleanValue>) {\n const currentValue = value ?? { value: false };\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = { value: e.target.checked };\n onChange(newValue);\n commit?.();\n };\n\n return (\n <ToggleSwitch\n id={id}\n checked={currentValue.value}\n onChange={handleChange}\n disabled={disabled}\n size={size === \"small\" ? \"small\" : undefined}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultEditors.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors-registry/DefaultEditors.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAYhE,sBAAsB;AAEtB;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAK/B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAK9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAM7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,EAW1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,EAS1C,CAAC;AAEF,qBAAqB"}
1
+ {"version":3,"file":"DefaultEditors.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors-registry/DefaultEditors.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAiBhE,sBAAsB;AAEtB;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAK/B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAK9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,UAK3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAM7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,EAW1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,EAS1C,CAAC;AAEF,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultEditors.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors-registry/DefaultEditors.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,sBA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AAM,kBAAkB,GAAiB;IAC9C,uBAAuB;IACvB,gCAAgC;IAChC,6BAA6B;IAC7B,6BAA6B;IAC7B,sBAAsB;IACtB,0BAA0B;IAE1B,qBAAqB;CACtB,CAAC;AAEF,qBAAqB","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\nimport { StandardEditorNames } from \"@itwin/appui-abstract\";\nimport { BooleanEditor } from \"../editors/BooleanEditor.js\";\nimport { DateTimeEditor } from \"../editors/DateTimeEditor.js\";\nimport { EnumEditor } from \"../editors/EnumEditor.js\";\nimport { NumericEditor } from \"../editors/NumericEditor.js\";\nimport { TextEditor } from \"../editors/TextEditor.js\";\n\nimport { ColorEditorSpec as InteropColorEditorSpec } from \"../interop/old-editors/Color.js\";\nimport { CustomNumberEditorSpec as InteropCustomNumberEditorSpec } from \"../interop/old-editors/CustomNumber.js\";\nimport { EnumEditorSpec as InteropEnumEditorSpec } from \"../interop/old-editors/Enum.js\";\nimport { EnumButtonGroupEditorSpec as InteropEnumButtonGroupEditorSpec } from \"../interop/old-editors/EnumButtonGroup.js\";\nimport { MultilineEditorSpec as InteropMultilineEditorSpec } from \"../interop/old-editors/TextArea.js\";\nimport { SliderEditorSpec as InteropSliderEditorSpec } from \"../interop/old-editors/Slider.js\";\nimport { NumericInputEditorSpec as InteropNumericInputEditorSpec } from \"../interop/old-editors/NumericInput.js\";\n\nimport { createEditorSpec, type EditorSpec } from \"../Types.js\";\nimport type { EnumValueMetadata, ValueMetadata } from \"../values/Metadata.js\";\nimport { ToggleEditor } from \"../editors/ToggleEditor.js\";\nimport { DateEditor } from \"../editors/DateEditor.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\n\n/** v8 ignore start */\n\n/**\n * Specification for default text editor. It applies for values whose type is \"string\".\n * @internal\n */\nexport const TextEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"string\",\n isValueSupported: isText,\n Editor: TextEditor,\n});\n\n/**\n * Specification for default date editor. It applies for values whose type is \"date\".\n * @internal\n */\nexport const DateEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"date\",\n isValueSupported: isDate,\n Editor: DateEditor,\n});\n\n/**\n * Specification for default date time editor. It applies for values whose type is \"dateTime\".\n * @internal\n */\nexport const DateTimeEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"dateTime\",\n isValueSupported: isDate,\n Editor: DateTimeEditor,\n});\n\n/**\n * Specification for default boolean editor. It applies for values whose type is \"bool\".\n * @internal\n */\nexport const BoolEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"bool\",\n isValueSupported: isBoolean,\n Editor: BooleanEditor,\n});\n\n/**\n * Specification for default numeric editor. It applies for values whose type is \"number\".\n * @internal\n */\nexport const NumericEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"number\",\n isValueSupported: isNumeric,\n Editor: NumericEditor,\n});\n\n/**\n * Specification for default toggle editor. It applies for values whose type is \"bool\" when preferred editor set to `toggle`.\n * @internal\n */\nexport const EnumEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is EnumValueMetadata =>\n metadata.type === \"enum\",\n isValueSupported: isEnum,\n Editor: EnumEditor,\n});\n\n/**\n * Specification for default enum editor. It applies for values whose type is \"enum\".\n * @internal\n */\nexport const ToggleEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"bool\" &&\n metadata.preferredEditor === StandardEditorNames.Toggle,\n isValueSupported: isBoolean,\n Editor: ToggleEditor,\n});\n\n/**\n * List of default editor specifications that are used as fallback if EditorRegistry does not provide a custom editor.\n * @internal\n */\nexport const defaultEditorSpecs: EditorSpec[] = [\n // list editors with preferred editor check first\n ToggleEditorSpec,\n\n // list editors that checks only value type\n TextEditorSpec,\n BoolEditorSpec,\n NumericEditorSpec,\n DateEditorSpec,\n DateTimeEditorSpec,\n EnumEditorSpec,\n];\n\n/**\n * List of editor specifications that are rewritten based on the old version that accepts editor params from `PropertyRecord`. Needed to support\n * editing customizations used through `PropertyRecord`.\n * @internal\n */\nexport const interopEditorSpecs: EditorSpec[] = [\n InteropSliderEditorSpec,\n InteropEnumButtonGroupEditorSpec,\n InteropNumericInputEditorSpec,\n InteropCustomNumberEditorSpec,\n InteropColorEditorSpec,\n InteropMultilineEditorSpec,\n\n InteropEnumEditorSpec,\n];\n\n/** v8 ignore stop */\n"]}
1
+ {"version":3,"file":"DefaultEditors.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors-registry/DefaultEditors.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,sBAAsB,IAAI,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACjH,OAAO,EAAE,cAAc,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,yBAAyB,IAAI,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAC1H,OA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AC3D,QAAQ,CAAC,IAAI,KAAK,MAAM;IAC1B,gBAAgB,EAAE,SAAS;IAC3B,MAAM,EAAE,aAAa;CACtB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAe,gBAAgB,CAAC;IAC5D,mBAAmB,EAAE,CAAC,QAAQ,EAAoC,EAAE,CAClE,QAAQ,CAAC,IAAI,KAAK,QAAQ;IAC5B,gBAAgB,EAAE,SAAS;IAC3B,MAAM,EAAE,aAAa;CACtB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAe,gBAAgB,CAAC;IACzD,mBAAmB,EAAE,CAAC,QAAQ,EAAiC,EAAE,CAC/D,QAAQ,CAAC,IAAI,KAAK,MAAM;IAC1B,gBAAgB,EAAE,MAAM;IACxB,MAAM,EAAE,UAAU;CACnB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAe,gBAAgB,CAAC;IAC3D,mBAAmB,EAAE,CAAC,QAAQ,EAA6B,EAAE,CAC3D,QAAQ,CAAC,IAAI,KAAK,MAAM;QACxB,QAAQ,CAAC,eAAe,KAAK,mBAAmB,CAAC,MAAM;IACzD,gBAAgB,EAAE,SAAS;IAC3B,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,iDAAiD;IACjD,gBAAgB;IAEhB,2CAA2C;IAC3C,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,cAAc;IACd,kBAAkB;IAClB,cAAc;CACf,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,uBAAuB;IACvB,gCAAgC;IAChC,6BAA6B;IAC7B,6BAA6B;IAC7B,sBAAsB;IACtB,0BAA0B;IAE1B,qBAAqB;CACtB,CAAC;AAEF,qBAAqB","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\nimport { StandardEditorNames } from \"@itwin/appui-abstract\";\nimport { BooleanEditor } from \"../editors/BooleanEditor.js\";\nimport { DateTimeEditor } from \"../editors/DateTimeEditor.js\";\nimport { EnumEditor } from \"../editors/EnumEditor.js\";\nimport { NumericEditor } from \"../editors/NumericEditor.js\";\nimport { TextEditor } from \"../editors/TextEditor.js\";\n\nimport { ColorEditorSpec as InteropColorEditorSpec } from \"../interop/old-editors/Color.js\";\nimport { CustomNumberEditorSpec as InteropCustomNumberEditorSpec } from \"../interop/old-editors/CustomNumber.js\";\nimport { EnumEditorSpec as InteropEnumEditorSpec } from \"../interop/old-editors/Enum.js\";\nimport { EnumButtonGroupEditorSpec as InteropEnumButtonGroupEditorSpec } from \"../interop/old-editors/EnumButtonGroup.js\";\nimport { MultilineEditorSpec as InteropMultilineEditorSpec } from \"../interop/old-editors/TextArea.js\";\nimport { SliderEditorSpec as InteropSliderEditorSpec } from \"../interop/old-editors/Slider.js\";\nimport { NumericInputEditorSpec as InteropNumericInputEditorSpec } from \"../interop/old-editors/NumericInput.js\";\n\nimport { createEditorSpec, type EditorSpec } from \"../Types.js\";\nimport type {\n EnumValueMetadata,\n NumericValueMetadata,\n TextValueMetadata,\n ValueMetadata,\n} from \"../values/Metadata.js\";\nimport { ToggleEditor } from \"../editors/ToggleEditor.js\";\nimport { DateEditor } from \"../editors/DateEditor.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\n\n/** v8 ignore start */\n\n/**\n * Specification for default text editor. It applies for values whose type is \"string\".\n * @internal\n */\nexport const TextEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is TextValueMetadata =>\n metadata.type === \"string\",\n isValueSupported: isText,\n Editor: TextEditor,\n});\n\n/**\n * Specification for default date editor. It applies for values whose type is \"date\".\n * @internal\n */\nexport const DateEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"date\",\n isValueSupported: isDate,\n Editor: DateEditor,\n});\n\n/**\n * Specification for default date time editor. It applies for values whose type is \"dateTime\".\n * @internal\n */\nexport const DateTimeEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"dateTime\",\n isValueSupported: isDate,\n Editor: DateTimeEditor,\n});\n\n/**\n * Specification for default boolean editor. It applies for values whose type is \"bool\".\n * @internal\n */\nexport const BoolEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"bool\",\n isValueSupported: isBoolean,\n Editor: BooleanEditor,\n});\n\n/**\n * Specification for default numeric editor. It applies for values whose type is \"number\".\n * @internal\n */\nexport const NumericEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is NumericValueMetadata =>\n metadata.type === \"number\",\n isValueSupported: isNumeric,\n Editor: NumericEditor,\n});\n\n/**\n * Specification for default toggle editor. It applies for values whose type is \"bool\" when preferred editor set to `toggle`.\n * @internal\n */\nexport const EnumEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is EnumValueMetadata =>\n metadata.type === \"enum\",\n isValueSupported: isEnum,\n Editor: EnumEditor,\n});\n\n/**\n * Specification for default enum editor. It applies for values whose type is \"enum\".\n * @internal\n */\nexport const ToggleEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"bool\" &&\n metadata.preferredEditor === StandardEditorNames.Toggle,\n isValueSupported: isBoolean,\n Editor: ToggleEditor,\n});\n\n/**\n * List of default editor specifications that are used as fallback if EditorRegistry does not provide a custom editor.\n * @internal\n */\nexport const defaultEditorSpecs: EditorSpec[] = [\n // list editors with preferred editor check first\n ToggleEditorSpec,\n\n // list editors that checks only value type\n TextEditorSpec,\n BoolEditorSpec,\n NumericEditorSpec,\n DateEditorSpec,\n DateTimeEditorSpec,\n EnumEditorSpec,\n];\n\n/**\n * List of editor specifications that are rewritten based on the old version that accepts editor params from `PropertyRecord`. Needed to support\n * editing customizations used through `PropertyRecord`.\n * @internal\n */\nexport const interopEditorSpecs: EditorSpec[] = [\n InteropSliderEditorSpec,\n InteropEnumButtonGroupEditorSpec,\n InteropNumericInputEditorSpec,\n InteropCustomNumberEditorSpec,\n InteropColorEditorSpec,\n InteropMultilineEditorSpec,\n\n InteropEnumEditorSpec,\n];\n\n/** v8 ignore stop */\n"]}
@@ -1,14 +1,15 @@
1
- import type { PrimitiveValue, PropertyRecord } from "@itwin/appui-abstract";
1
+ import type { PrimitiveValue } from "@itwin/appui-abstract";
2
2
  import type { Value as NewEditorValue } from "../values/Values.js";
3
- import type { OldEditorMetadata } from "./Metadata.js";
3
+ import type { PropertyRecordEditorMetadata } from "./Metadata.js";
4
+ import type { PropertyRecordWithConstraints, WithConstraints } from "../ConstraintUtils.js";
4
5
  /**
5
6
  * Interop utilities for converting between old and new editor values.
6
7
  * @internal
7
8
  */
8
9
  export declare namespace EditorInterop {
9
10
  /** Attempts to convert `PropertyRecord` into `ValueMetadata` and `Value`. */
10
- function getMetadataAndValue(propertyRecord: PropertyRecord): {
11
- metadata: OldEditorMetadata | undefined;
11
+ function getMetadataAndValue(propertyRecord: PropertyRecordWithConstraints): {
12
+ metadata: WithConstraints<PropertyRecordEditorMetadata> | undefined;
12
13
  value: NewEditorValue | undefined;
13
14
  };
14
15
  /** Converts new editors system `Value` into old `PrimitiveValue` */
@@ -1 +1 @@
1
- {"version":3,"file":"EditorInterop.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACf,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AASvD;;;GAGG;AACH,yBAAiB,aAAa,CAAC;IAC7B,6EAA6E;IAC7E,SAAgB,mBAAmB,CAAC,cAAc,EAAE,cAAc,GAAG;QACnE,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;QACxC,KAAK,EAAE,cAAc,GAAG,SAAS,CAAC;KACnC,CAgGA;IAED,oEAAoE;IACpE,SAAgB,uBAAuB,CACrC,QAAQ,EAAE,cAAc,GACvB,cAAc,CAuChB;CACF"}
1
+ {"version":3,"file":"EditorInterop.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUxE,OAAO,KAAK,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAQlE,OAAO,KAAK,EACV,6BAA6B,EAC7B,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,yBAAiB,aAAa,CAAC;IAC7B,6EAA6E;IAC7E,SAAgB,mBAAmB,CACjC,cAAc,EAAE,6BAA6B,GAC5C;QACD,QAAQ,EAAE,eAAe,CAAC,4BAA4B,CAAC,GAAG,SAAS,CAAC;QACpE,KAAK,EAAE,cAAc,GAAG,SAAS,CAAC;KACnC,CAoGA;IAED,oEAAoE;IACpE,SAAgB,uBAAuB,CACrC,QAAQ,EAAE,cAAc,GACvB,cAAc,CAuChB;CACF"}
@@ -20,6 +20,7 @@ export var EditorInterop;
20
20
  typename: propertyRecord.property.typename,
21
21
  // eslint-disable-next-line @typescript-eslint/no-deprecated
22
22
  quantityType: propertyRecord.property.quantityType,
23
+ constraints: propertyRecord.property.constraints,
23
24
  };
24
25
  const primitiveValue = propertyRecord.value;
25
26
  switch (propertyRecord.property.typename) {
@@ -1 +1 @@
1
- {"version":3,"file":"EditorInterop.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAOhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,MAAM,KAAW,aAAa,CAkJ7B;AAlJD,WAAiB,aAAa;IAC5B,6EAA6E;IAC7E,SAAgB,mBAAmB,CAAC,cAA8B;QAIhE,MAAM,YAAY,GAAoC;YACpD,eAAe,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI;YACrD,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;YAC9C,YAAY,EAAE,cAAc,CAAC,YAAY;YACzC,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI;YAClC,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ;YAC1C,4DAA4D;YAC5D,YAAY,EAAE,cAAc,CAAC,QAAQ,CAAC,YAAY;SACnD,CAAC;QAEF,MAAM,cAAc,GAAG,cAAc,CAAC,KAAuB,CAAC;QAC9D,QAAQ,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC;YACZ,KAAK,QAAQ;gBACX,OAAO;oBACL,QAAQ,EAAE;wBACR,GAAG,YAAY;wBACf,IAAI,EAAE,QAAQ;qBACf;oBACD,KAAK,EAAE;wBACL,KAAK,EAAG,cAAc,CAAC,KAAgB,IAAI,EAAE;qBAC1B;iBACtB,CAAC;YACJ,KAAK,UAAU,CAAC;YAChB,KAAK,WAAW;gBACd,OAAO;oBACL,QAAQ,EAAE;wBACR,GAAG,YAAY;wBACf,IAAI,EACF,cAAc,CAAC,QAAQ,CAAC,QAAQ,KAAK,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MAAM;aACvB,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAzCe,qCAAuB,0BAyCtC,CAAA;AACH,CAAC,EAlJgB,aAAa,KAAb,aAAa,QAkJ7B","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\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyRecord,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type {\n BooleanValue,\n DateValue,\n EnumValue,\n InstanceKeyValue,\n NumericValue,\n TextValue,\n} from \"../values/Values.js\";\nimport type { Value as NewEditorValue } from \"../values/Values.js\";\nimport type { OldEditorMetadata } from \"./Metadata.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\n\n/**\n * Interop utilities for converting between old and new editor values.\n * @internal\n */\nexport namespace EditorInterop {\n /** Attempts to convert `PropertyRecord` into `ValueMetadata` and `Value`. */\n export function getMetadataAndValue(propertyRecord: PropertyRecord): {\n metadata: OldEditorMetadata | undefined;\n value: NewEditorValue | undefined;\n } {\n const baseMetadata: Omit<OldEditorMetadata, \"type\"> = {\n preferredEditor: propertyRecord.property.editor?.name,\n params: propertyRecord.property.editor?.params,\n extendedData: propertyRecord.extendedData,\n enum: propertyRecord.property.enum,\n typename: propertyRecord.property.typename,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n quantityType: propertyRecord.property.quantityType,\n };\n\n const primitiveValue = propertyRecord.value as PrimitiveValue;\n switch (propertyRecord.property.typename) {\n case \"text\":\n case \"string\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"string\",\n },\n value: {\n value: (primitiveValue.value as string) ?? \"\",\n } satisfies TextValue,\n };\n case \"dateTime\":\n case \"shortdate\":\n return {\n metadata: {\n ...baseMetadata,\n type:\n propertyRecord.property.typename === \"shortdate\"\n ? \"date\"\n : \"dateTime\",\n },\n value: {\n value: (primitiveValue.value as Date) ?? new Date(),\n } satisfies DateValue,\n };\n case \"boolean\":\n case \"bool\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"bool\",\n },\n value: {\n value: (primitiveValue.value as boolean) ?? false,\n } satisfies BooleanValue,\n };\n case \"float\":\n case \"double\":\n case \"int\":\n case \"integer\":\n case \"number\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"number\",\n },\n value: {\n rawValue: primitiveValue.value as number,\n displayValue: primitiveValue.displayValue\n ? primitiveValue.displayValue\n : primitiveValue.value !== undefined\n ? `${primitiveValue.value as number}`\n : \"\",\n roundingError: primitiveValue.roundingError,\n } satisfies NumericValue,\n };\n case \"enum\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"enum\",\n },\n value: {\n choice: primitiveValue.value as number | string,\n } satisfies EnumValue,\n };\n case \"navigation\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"instanceKey\",\n },\n value: {\n key: primitiveValue.value as Primitives.InstanceKey,\n label: primitiveValue.displayValue ?? \"\",\n } satisfies InstanceKeyValue,\n };\n }\n\n return {\n metadata: undefined,\n value: undefined,\n };\n }\n\n /** Converts new editors system `Value` into old `PrimitiveValue` */\n export function convertToPrimitiveValue(\n newValue: NewEditorValue\n ): PrimitiveValue {\n if (isText(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value,\n };\n }\n if (isNumeric(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.rawValue,\n displayValue: newValue.displayValue,\n roundingError: newValue.roundingError,\n };\n }\n if (isBoolean(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n if (isDate(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n\n if (isEnum(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.choice,\n };\n }\n\n throw new Error(\"Unsupported value type\");\n }\n}\n"]}
1
+ {"version":3,"file":"EditorInterop.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAMrC;;;GAGG;AACH,MAAM,KAAW,aAAa,CAwJ7B;AAxJD,WAAiB,aAAa;IAC5B,6EAA6E;IAC7E,SAAgB,mBAAmB,CACjC,cAA6C;QAK7C,MAAM,YAAY,GAGd;YACF,eAAe,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI;YACrD,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;YAC9C,YAAY,EAAE,cAAc,CAAC,YAAY;YACzC,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI;YAClC,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ;YAC1C,4DAA4D;YAC5D,YAAY,EAAE,cAAc,CAAC,QAAQ,CAAC,YAAY;YAClD,WAAW,EAAE,cAAc,CAAC,QAAQ,CAAC,WAAW;SACjD,CAAC;QAEF,MAAM,cAAc,GAAG,cAAc,CAAC,KAAuB,CAAC;QAC9D,QAAQ,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC;YACZ,KAAK,QAAQ;gBACX,OAAO;oBACL,QAAQ,EAAE;wBACR,GAAG,YAAY;wBACf,IAAI,EAAE,QAAQ;qBACf;oBACD,KAAK,EAAE;wBACL,KAAK,EAAG,cAAc,CAAC,KAAgB,IAAI,EAAE;qBAC1B;iBACt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ACxC,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,SAAS;gBAC1C,KAAK,EAAE,QAAQ,CAAC,MAAM;aACvB,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAzCe,qCAAuB,0BAyCtC,CAAA;AACH,CAAC,EAxJgB,aAAa,KAAb,aAAa,QAwJ7B","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\nimport type { Primitives, PrimitiveValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type {\n BooleanValue,\n DateValue,\n EnumValue,\n InstanceKeyValue,\n NumericValue,\n TextValue,\n} from \"../values/Values.js\";\nimport type { Value as NewEditorValue } from \"../values/Values.js\";\nimport type { PropertyRecordEditorMetadata } from \"./Metadata.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\nimport type {\n PropertyRecordWithConstraints,\n WithConstraints,\n} from \"../ConstraintUtils.js\";\n\n/**\n * Interop utilities for converting between old and new editor values.\n * @internal\n */\nexport namespace EditorInterop {\n /** Attempts to convert `PropertyRecord` into `ValueMetadata` and `Value`. */\n export function getMetadataAndValue(\n propertyRecord: PropertyRecordWithConstraints\n ): {\n metadata: WithConstraints<PropertyRecordEditorMetadata> | undefined;\n value: NewEditorValue | undefined;\n } {\n const baseMetadata: Omit<\n WithConstraints<PropertyRecordEditorMetadata>,\n \"type\"\n > = {\n preferredEditor: propertyRecord.property.editor?.name,\n params: propertyRecord.property.editor?.params,\n extendedData: propertyRecord.extendedData,\n enum: propertyRecord.property.enum,\n typename: propertyRecord.property.typename,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n quantityType: propertyRecord.property.quantityType,\n constraints: propertyRecord.property.constraints,\n };\n\n const primitiveValue = propertyRecord.value as PrimitiveValue;\n switch (propertyRecord.property.typename) {\n case \"text\":\n case \"string\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"string\",\n },\n value: {\n value: (primitiveValue.value as string) ?? \"\",\n } satisfies TextValue,\n };\n case \"dateTime\":\n case \"shortdate\":\n return {\n metadata: {\n ...baseMetadata,\n type:\n propertyRecord.property.typename === \"shortdate\"\n ? \"date\"\n : \"dateTime\",\n },\n value: {\n value: (primitiveValue.value as Date) ?? new Date(),\n } satisfies DateValue,\n };\n case \"boolean\":\n case \"bool\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"bool\",\n },\n value: {\n value: (primitiveValue.value as boolean) ?? false,\n } satisfies BooleanValue,\n };\n case \"float\":\n case \"double\":\n case \"int\":\n case \"integer\":\n case \"number\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"number\",\n },\n value: {\n rawValue: primitiveValue.value as number,\n displayValue: primitiveValue.displayValue\n ? primitiveValue.displayValue\n : primitiveValue.value !== undefined\n ? `${primitiveValue.value as number}`\n : \"\",\n roundingError: primitiveValue.roundingError,\n } satisfies NumericValue,\n };\n case \"enum\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"enum\",\n },\n value: {\n choice: primitiveValue.value as number | string,\n } satisfies EnumValue,\n };\n case \"navigation\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"instanceKey\",\n },\n value: {\n key: primitiveValue.value as Primitives.InstanceKey,\n label: primitiveValue.displayValue ?? \"\",\n } satisfies InstanceKeyValue,\n };\n }\n\n return {\n metadata: undefined,\n value: undefined,\n };\n }\n\n /** Converts new editors system `Value` into old `PrimitiveValue` */\n export function convertToPrimitiveValue(\n newValue: NewEditorValue\n ): PrimitiveValue {\n if (isText(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value,\n };\n }\n if (isNumeric(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.rawValue,\n displayValue: newValue.displayValue,\n roundingError: newValue.roundingError,\n };\n }\n if (isBoolean(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n if (isDate(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n\n if (isEnum(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.choice,\n };\n }\n\n throw new Error(\"Unsupported value type\");\n }\n}\n"]}
@@ -1,10 +1,13 @@
1
+ /** @packageDocumentation
2
+ * @module PropertyEditors
3
+ */
1
4
  import type { EnumerationChoicesInfo, PropertyEditorParams } from "@itwin/appui-abstract";
2
5
  import type { ValueMetadata } from "../values/Metadata.js";
3
6
  /**
4
- * Metadata that is created by mapping `PropertyRecord` used to render old editor into the new editor metadata.
5
- * @internal
7
+ * Metadata that is created by mapping `PropertyRecord` into the editor metadata.
8
+ * @beta
6
9
  */
7
- export interface OldEditorMetadata extends ValueMetadata {
10
+ export interface PropertyRecordEditorMetadata extends ValueMetadata {
8
11
  params?: PropertyEditorParams[];
9
12
  extendedData?: {
10
13
  [key: string]: unknown;
@@ -14,8 +17,8 @@ export interface OldEditorMetadata extends ValueMetadata {
14
17
  typename: string;
15
18
  }
16
19
  /**
17
- * Type guard for `OldEditorMetadata`.
18
- * @internal
20
+ * Type guard for `PropertyRecordEditorMetadata`.
21
+ * @beta
19
22
  */
20
- export declare function isOldEditorMetadata(metadata: ValueMetadata): metadata is OldEditorMetadata;
23
+ export declare function isPropertyRecordEditorMetadata(metadata: ValueMetadata): metadata is PropertyRecordEditorMetadata;
21
24
  //# sourceMappingURL=Metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1C,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,GACtB,QAAQ,IAAI,iBAAiB,CAE/B"}
1
+ {"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;;GAGG;AACH,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IACjE,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1C,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,aAAa,GACtB,QAAQ,IAAI,4BAA4B,CAE1C"}
@@ -2,11 +2,14 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module PropertyEditors
7
+ */
5
8
  /**
6
- * Type guard for `OldEditorMetadata`.
7
- * @internal
9
+ * Type guard for `PropertyRecordEditorMetadata`.
10
+ * @beta
8
11
  */
9
- export function isOldEditorMetadata(metadata) {
12
+ export function isPropertyRecordEditorMetadata(metadata) {
10
13
  return metadata.typename !== undefined;
11
14
  }
12
15
  /* v8 ignore stop */
@@ -1 +1 @@
1
- {"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAsBhG;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAuB;IAEvB,OAAQ,QAA8B,CAAC,QAAQ,KAAK,SAAS,CAAC;AAChE,CAAC;AAED,oBAAoB","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\nimport type {\n EnumerationChoicesInfo,\n PropertyEditorParams,\n} from \"@itwin/appui-abstract\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\n\n/* v8 ignore start */\n\n/**\n * Metadata that is created by mapping `PropertyRecord` used to render old editor into the new editor metadata.\n * @internal\n */\nexport interface OldEditorMetadata extends ValueMetadata {\n params?: PropertyEditorParams[];\n extendedData?: { [key: string]: unknown };\n enum?: EnumerationChoicesInfo;\n quantityType?: string;\n typename: string;\n}\n\n/**\n * Type guard for `OldEditorMetadata`.\n * @internal\n */\nexport function isOldEditorMetadata(\n metadata: ValueMetadata\n): metadata is OldEditorMetadata {\n return (metadata as OldEditorMetadata).typename !== undefined;\n}\n\n/* v8 ignore stop */\n"]}
1
+ {"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAsBH;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAAuB;IAEvB,OAAQ,QAAyC,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC3E,CAAC;AAED,oBAAoB","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 type {\n EnumerationChoicesInfo,\n PropertyEditorParams,\n} from \"@itwin/appui-abstract\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\n\n/* v8 ignore start */\n\n/**\n * Metadata that is created by mapping `PropertyRecord` into the editor metadata.\n * @beta\n */\nexport interface PropertyRecordEditorMetadata extends ValueMetadata {\n params?: PropertyEditorParams[];\n extendedData?: { [key: string]: unknown };\n enum?: EnumerationChoicesInfo;\n quantityType?: string;\n typename: string;\n}\n\n/**\n * Type guard for `PropertyRecordEditorMetadata`.\n * @beta\n */\nexport function isPropertyRecordEditorMetadata(\n metadata: ValueMetadata\n): metadata is PropertyRecordEditorMetadata {\n return (metadata as PropertyRecordEditorMetadata).typename !== undefined;\n}\n\n/* v8 ignore stop */\n"]}
@@ -4,19 +4,58 @@
4
4
  import * as React from "react";
5
5
  import { type PropertyRecord } from "@itwin/appui-abstract";
6
6
  import { type PropertyUpdatedArgs } from "../../editors/EditorContainer.js";
7
- interface PropertyRecordEditorProps {
7
+ import type { ValueMetadata } from "../values/Metadata.js";
8
+ import type { Value } from "../values/Values.js";
9
+ import type { WithConstraints } from "../ConstraintUtils.js";
10
+ interface PropertyRecordEditorBaseProps {
8
11
  propertyRecord: PropertyRecord;
9
12
  onCommit: (args: PropertyUpdatedArgs) => void;
10
13
  onCancel: () => void;
11
14
  onClick?: () => void;
12
15
  setFocus?: boolean;
13
16
  size?: "small" | "large";
14
- editorSystem?: "legacy" | "new";
17
+ }
18
+ interface PropertyRecordEditorLegacyProps extends PropertyRecordEditorBaseProps {
19
+ /**
20
+ * @deprecated in 5.30. Use `PropertyRecordEditor` with `editorSystem="new"` instead. This is provided only in case
21
+ * there is a need to switch back to the legacy editor system.
22
+ */
23
+ editorSystem?: "legacy";
24
+ }
25
+ interface PropertyRecordEditorNewProps extends PropertyRecordEditorBaseProps {
26
+ editorSystem: "new";
27
+ }
28
+ type PropertyRecordEditorProps = PropertyRecordEditorLegacyProps | PropertyRecordEditorNewProps;
29
+ interface PropertyRecordEditorComponent {
30
+ /**
31
+ * Editor component for editing property values represented by `PropertyRecord`.
32
+ * @beta
33
+ */
34
+ (props: PropertyRecordEditorNewProps): React.JSX.Element;
35
+ /**
36
+ * @deprecated in 5.30. Use `PropertyRecordEditor` with `editorSystem="new"` instead. This is provided only in case
37
+ * there is a need to switch back to the legacy editor system.
38
+ * @beta
39
+ */
40
+ (props: PropertyRecordEditorLegacyProps): React.JSX.Element;
41
+ /** @beta */
42
+ (props: PropertyRecordEditorProps): React.JSX.Element;
15
43
  }
16
44
  /**
17
45
  * Editor component for editing property values represented by `PropertyRecord`.
18
46
  * @beta
19
47
  */
20
- export declare function PropertyRecordEditor({ propertyRecord, onCommit, onCancel, onClick, setFocus, size, editorSystem, }: PropertyRecordEditorProps): React.JSX.Element;
48
+ export declare const PropertyRecordEditor: PropertyRecordEditorComponent;
49
+ /** @internal */
50
+ export declare function CommittingEditor({ metadata, initialValue, onCancel, onCommit, onClick, disabled, size, id, }: {
51
+ metadata: WithConstraints<ValueMetadata>;
52
+ initialValue?: Value;
53
+ onCommit: (value?: Value) => void;
54
+ onCancel: () => void;
55
+ onClick?: () => void;
56
+ disabled?: boolean;
57
+ size?: "small" | "large";
58
+ id?: string;
59
+ }): React.JSX.Element;
21
60
  export {};
22
61
  //# sourceMappingURL=PropertyRecordEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyRecordEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/PropertyRecordEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAC;AAM1C,UAAU,yBAAyB;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,YAAY,GACb,EAAE,yBAAyB,qBAiC3B"}
1
+ {"version":3,"file":"PropertyRecordEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/PropertyRecordEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,6BAA6B;IACrC,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,CA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O,GAAG,OAAO,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,qBA0BA"}
@@ -15,7 +15,9 @@ import { EditorRenderer } from "../EditorRenderer.js";
15
15
  * Editor component for editing property values represented by `PropertyRecord`.
16
16
  * @beta
17
17
  */
18
- export function PropertyRecordEditor({ propertyRecord, onCommit, onCancel, onClick, setFocus, size, editorSystem, }) {
18
+ export const PropertyRecordEditor = ({ propertyRecord, onCommit, onCancel, onClick, setFocus, size,
19
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
20
+ editorSystem, }) => {
19
21
  const { metadata, value } = EditorInterop.getMetadataAndValue(propertyRecord);
20
22
  if (editorSystem === "new" && metadata && value) {
21
23
  return (React.createElement(CommittingEditor, { metadata: metadata, initialValue: value, onCommit: (newValue) => {
@@ -25,17 +27,20 @@ export function PropertyRecordEditor({ propertyRecord, onCommit, onCancel, onCli
25
27
  ? { valueFormat: PropertyValueFormat.Primitive }
26
28
  : EditorInterop.convertToPrimitiveValue(newValue),
27
29
  });
28
- }, onCancel: onCancel, onClick: onClick, disabled: propertyRecord.isDisabled || propertyRecord.isReadonly, size: size }));
30
+ }, onCancel: onCancel, onClick: onClick, disabled: propertyRecord.isDisabled || propertyRecord.isReadonly, size: size, id: propertyRecord.property.name }));
29
31
  }
30
- return (React.createElement(EditorContainer, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, onClick: onClick, setFocus: setFocus }));
31
- }
32
- function CommittingEditor({ metadata, initialValue, onCancel, onCommit, onClick, disabled, size, }) {
32
+ return (
33
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
34
+ React.createElement(EditorContainer, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, onClick: onClick, setFocus: setFocus }));
35
+ };
36
+ /** @internal */
37
+ export function CommittingEditor({ metadata, initialValue, onCancel, onCommit, onClick, disabled, size, id, }) {
33
38
  const { value, onChange, onKeydown, commit, cancel } = useCommittableValue({
34
39
  initialValue,
35
40
  onCommit,
36
41
  onCancel,
37
42
  });
38
43
  return (React.createElement("div", { onKeyDown: onKeydown, onBlur: commit, onClick: onClick, role: "presentation" },
39
- React.createElement(EditorRenderer, { metadata: metadata, value: value, onChange: onChange, commit: commit, cancel: cancel, disabled: disabled, size: size })));
44
+ React.createElement(EditorRenderer, { metadata: metadata, value: value, onChange: onChange, commit: commit, cancel: cancel, disabled: disabled, size: size, id: id })));
40
45
  }
41
46
  //# sourceMappingURL=PropertyRecordEditor.js.map