@itwin/components-react 3.0.0-dev.72 → 3.0.0-dev.73

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 (104) hide show
  1. package/lib/components-react/common/HighlightedText.d.ts +2 -2
  2. package/lib/components-react/common/HighlightedText.js +1 -1
  3. package/lib/components-react/common/HighlightedText.js.map +1 -1
  4. package/lib/components-react/common/HighlightingComponentProps.d.ts +2 -2
  5. package/lib/components-react/common/HighlightingComponentProps.js.map +1 -1
  6. package/lib/components-react/common/UseAsyncValue.d.ts +1 -1
  7. package/lib/components-react/common/UseAsyncValue.js +1 -1
  8. package/lib/components-react/common/UseAsyncValue.js.map +1 -1
  9. package/lib/components-react/editors/BooleanEditor.d.ts +2 -2
  10. package/lib/components-react/editors/BooleanEditor.js +2 -2
  11. package/lib/components-react/editors/BooleanEditor.js.map +1 -1
  12. package/lib/components-react/editors/EnumButtonGroupEditor.d.ts +2 -2
  13. package/lib/components-react/editors/EnumButtonGroupEditor.js +2 -2
  14. package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  15. package/lib/components-react/editors/EnumEditor.d.ts +2 -2
  16. package/lib/components-react/editors/EnumEditor.js +2 -2
  17. package/lib/components-react/editors/EnumEditor.js.map +1 -1
  18. package/lib/components-react/editors/ImageCheckBoxEditor.d.ts +2 -2
  19. package/lib/components-react/editors/ImageCheckBoxEditor.js +2 -2
  20. package/lib/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  21. package/lib/components-react/editors/NumericInputEditor.d.ts +2 -2
  22. package/lib/components-react/editors/NumericInputEditor.js +2 -2
  23. package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
  24. package/lib/components-react/editors/PropertyEditorManager.d.ts +7 -7
  25. package/lib/components-react/editors/PropertyEditorManager.js +4 -4
  26. package/lib/components-react/editors/PropertyEditorManager.js.map +1 -1
  27. package/lib/components-react/editors/SliderEditor.d.ts +2 -2
  28. package/lib/components-react/editors/SliderEditor.js +2 -2
  29. package/lib/components-react/editors/SliderEditor.js.map +1 -1
  30. package/lib/components-react/editors/TextEditor.d.ts +1 -1
  31. package/lib/components-react/editors/TextEditor.js +1 -1
  32. package/lib/components-react/editors/TextEditor.js.map +1 -1
  33. package/lib/components-react/editors/TextareaEditor.d.ts +2 -2
  34. package/lib/components-react/editors/TextareaEditor.js +2 -2
  35. package/lib/components-react/editors/TextareaEditor.js.map +1 -1
  36. package/lib/components-react/editors/ThemedEnumEditor.d.ts +3 -3
  37. package/lib/components-react/editors/ThemedEnumEditor.d.ts.map +1 -1
  38. package/lib/components-react/editors/ThemedEnumEditor.js +3 -2
  39. package/lib/components-react/editors/ThemedEnumEditor.js.map +1 -1
  40. package/lib/components-react/editors/ToggleEditor.d.ts +2 -2
  41. package/lib/components-react/editors/ToggleEditor.js +2 -2
  42. package/lib/components-react/editors/ToggleEditor.js.map +1 -1
  43. package/lib/components-react/favorite/FavoritePropertiesRenderer.d.ts +1 -1
  44. package/lib/components-react/favorite/FavoritePropertiesRenderer.js +1 -1
  45. package/lib/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
  46. package/lib/components-react/filtering/FilteringInput.d.ts +1 -2
  47. package/lib/components-react/filtering/FilteringInput.d.ts.map +1 -1
  48. package/lib/components-react/filtering/FilteringInput.js +1 -1
  49. package/lib/components-react/filtering/FilteringInput.js.map +1 -1
  50. package/lib/components-react/inputs/ParsedInput.d.ts +2 -2
  51. package/lib/components-react/inputs/ParsedInput.js +1 -1
  52. package/lib/components-react/inputs/ParsedInput.js.map +1 -1
  53. package/lib/components-react/properties/renderers/ActionButtonList.d.ts +2 -2
  54. package/lib/components-react/properties/renderers/ActionButtonList.js +1 -1
  55. package/lib/components-react/properties/renderers/ActionButtonList.js.map +1 -1
  56. package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +0 -1
  57. package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
  58. package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  59. package/lib/components-react/properties/renderers/PropertyRenderer.d.ts +5 -10
  60. package/lib/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  61. package/lib/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  62. package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts +1 -3
  63. package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts.map +1 -1
  64. package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  65. package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +1 -1
  66. package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +1 -1
  67. package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  68. package/lib/components-react/selectable-content/SelectableContent.d.ts +5 -5
  69. package/lib/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
  70. package/lib/components-react/selectable-content/SelectableContent.js +3 -2
  71. package/lib/components-react/selectable-content/SelectableContent.js.map +1 -1
  72. package/lib/components-react/table/SimpleTableDataProvider.d.ts +2 -2
  73. package/lib/components-react/table/SimpleTableDataProvider.js +2 -2
  74. package/lib/components-react/table/SimpleTableDataProvider.js.map +1 -1
  75. package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.d.ts.map +1 -1
  76. package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.js +1 -0
  77. package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.js.map +1 -1
  78. package/lib/components-react/table/component/Table.d.ts +4 -7
  79. package/lib/components-react/table/component/Table.d.ts.map +1 -1
  80. package/lib/components-react/table/component/Table.js.map +1 -1
  81. package/lib/components-react/toolbar/Item.d.ts +2 -2
  82. package/lib/components-react/toolbar/Item.js +1 -1
  83. package/lib/components-react/toolbar/Item.js.map +1 -1
  84. package/lib/components-react/toolbar/PopupItem.d.ts +2 -2
  85. package/lib/components-react/toolbar/PopupItem.js +1 -1
  86. package/lib/components-react/toolbar/PopupItem.js.map +1 -1
  87. package/lib/components-react/toolbar/PopupItemWithDrag.d.ts +2 -2
  88. package/lib/components-react/toolbar/PopupItemWithDrag.js +1 -1
  89. package/lib/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  90. package/lib/components-react/toolbar/Toolbar.d.ts +2 -2
  91. package/lib/components-react/toolbar/Toolbar.js +1 -1
  92. package/lib/components-react/toolbar/Toolbar.js.map +1 -1
  93. package/lib/components-react/toolbar/ToolbarWithOverflow.d.ts +6 -6
  94. package/lib/components-react/toolbar/ToolbarWithOverflow.js +3 -3
  95. package/lib/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  96. package/lib/components-react/toolbar/utilities/Direction.d.ts +1 -1
  97. package/lib/components-react/toolbar/utilities/Direction.js +1 -1
  98. package/lib/components-react/toolbar/utilities/Direction.js.map +1 -1
  99. package/lib/components-react/tree/HighlightingEngine.d.ts +1 -1
  100. package/lib/components-react/tree/HighlightingEngine.js +1 -1
  101. package/lib/components-react/tree/HighlightingEngine.js.map +1 -1
  102. package/lib/components-react/tree/TreeDataProvider.d.ts +1 -1
  103. package/lib/components-react/tree/TreeDataProvider.js.map +1 -1
  104. package/package.json +15 -15
@@ -4,7 +4,7 @@
4
4
  /// <reference types="react" />
5
5
  /**
6
6
  * Properties of [[HighlightedText]]
7
- * @beta
7
+ * @public
8
8
  */
9
9
  export interface HighlightedTextProps {
10
10
  searchText: string;
@@ -17,7 +17,7 @@ export interface HighlightedTextProps {
17
17
  * Highlighted text
18
18
  * Used for highlighting parts in the 'text' which match with 'searchText'
19
19
  * Also actively highlights one matched part which is selected with 'activeMatchIndex'
20
- * @beta
20
+ * @public
21
21
  */
22
22
  export declare function HighlightedText(props: HighlightedTextProps): JSX.Element;
23
23
  //# sourceMappingURL=HighlightedText.d.ts.map
@@ -18,7 +18,7 @@ const HighlightingEngine_1 = require("../tree/HighlightingEngine");
18
18
  * Highlighted text
19
19
  * Used for highlighting parts in the 'text' which match with 'searchText'
20
20
  * Also actively highlights one matched part which is selected with 'activeMatchIndex'
21
- * @beta
21
+ * @public
22
22
  */
23
23
  function HighlightedText(props) {
24
24
  const { searchText, activeMatchIndex, text, caseSensitive } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAEH,kDAA0B;AAC1B,kFAAgD;AAChD,mEAAgE;AAiBhE;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACpE,OAAO,CACL,8BAAC,+BAAW,IACV,WAAW,EAAE,CAAC,UAAU,CAAC,EACzB,UAAU,EAAE,iBAAwB,EACpC,WAAW,EAAE,gBAAuB,EACpC,eAAe,EAAE,uCAAkB,CAAC,iBAAiB,EACrD,UAAU,EAAE,IAAI,EAChB,eAAe,EAAE,IAAI,EACrB,aAAa,EAAE,aAAa,GAC5B,CACH,CAAC;AACJ,CAAC;AAbD,0CAaC;AAaD,MAAM,iBAAiB,GAAG,CAAC,IAAoB,EAAsB,EAAE;IACrE,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC;IAC5F,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1F,MAAM,MAAM,GAAuB,EAAE,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE;QACnB,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;KACvC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport React from \"react\";\nimport Highlighter from \"react-highlight-words\";\nimport { HighlightingEngine } from \"../tree/HighlightingEngine\";\n\n/**\n * Properties of [[HighlightedText]]\n * @beta\n */\nexport interface HighlightedTextProps {\n /* Filter text which we want to highlight */\n searchText: string;\n /* Index of actively highlighted part in a text */\n activeMatchIndex?: number;\n /* Full text */\n text: string;\n /** Should search be case sensitive */\n caseSensitive?: boolean;\n}\n\n/**\n * Highlighted text\n * Used for highlighting parts in the 'text' which match with 'searchText'\n * Also actively highlights one matched part which is selected with 'activeMatchIndex'\n * @beta\n */\nexport function HighlightedText(props: HighlightedTextProps) {\n const { searchText, activeMatchIndex, text, caseSensitive } = props;\n return (\n <Highlighter\n searchWords={[searchText]}\n findChunks={findChunksNoRegex as any} // .d.ts declaration wrong\n activeIndex={activeMatchIndex as any} // .d.ts file seems to be wrong, doesn't work if it's a string\n activeClassName={HighlightingEngine.ACTIVE_CLASS_NAME}\n autoEscape={true}\n textToHighlight={text}\n caseSensitive={caseSensitive}\n />\n );\n}\n\ninterface HighlighterChunk {\n highlight: boolean;\n start: number;\n end: number;\n}\ninterface FindChunksArgs {\n autoEscape?: boolean;\n caseSensitive?: boolean;\n searchWords: string[];\n textToHighlight: string;\n}\nconst findChunksNoRegex = (args: FindChunksArgs): HighlighterChunk[] => {\n const text = args.caseSensitive ? args.textToHighlight : args.textToHighlight.toUpperCase();\n const term = args.caseSensitive ? args.searchWords[0] : args.searchWords[0].toUpperCase();\n const chunks: HighlighterChunk[] = [];\n let index = text.indexOf(term);\n while (index !== -1) {\n chunks.push({ start: index, end: index + term.length, highlight: true });\n index = text.indexOf(term, index + 1);\n }\n return chunks;\n};\n"]}
1
+ {"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAEH,kDAA0B;AAC1B,kFAAgD;AAChD,mEAAgE;AAiBhE;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACpE,OAAO,CACL,8BAAC,+BAAW,IACV,WAAW,EAAE,CAAC,UAAU,CAAC,EACzB,UAAU,EAAE,iBAAwB,EACpC,WAAW,EAAE,gBAAuB,EACpC,eAAe,EAAE,uCAAkB,CAAC,iBAAiB,EACrD,UAAU,EAAE,IAAI,EAChB,eAAe,EAAE,IAAI,EACrB,aAAa,EAAE,aAAa,GAC5B,CACH,CAAC;AACJ,CAAC;AAbD,0CAaC;AAaD,MAAM,iBAAiB,GAAG,CAAC,IAAoB,EAAsB,EAAE;IACrE,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC;IAC5F,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1F,MAAM,MAAM,GAAuB,EAAE,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE;QACnB,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;KACvC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport React from \"react\";\nimport Highlighter from \"react-highlight-words\";\nimport { HighlightingEngine } from \"../tree/HighlightingEngine\";\n\n/**\n * Properties of [[HighlightedText]]\n * @public\n */\nexport interface HighlightedTextProps {\n /* Filter text which we want to highlight */\n searchText: string;\n /* Index of actively highlighted part in a text */\n activeMatchIndex?: number;\n /* Full text */\n text: string;\n /** Should search be case sensitive */\n caseSensitive?: boolean;\n}\n\n/**\n * Highlighted text\n * Used for highlighting parts in the 'text' which match with 'searchText'\n * Also actively highlights one matched part which is selected with 'activeMatchIndex'\n * @public\n */\nexport function HighlightedText(props: HighlightedTextProps) {\n const { searchText, activeMatchIndex, text, caseSensitive } = props;\n return (\n <Highlighter\n searchWords={[searchText]}\n findChunks={findChunksNoRegex as any} // .d.ts declaration wrong\n activeIndex={activeMatchIndex as any} // .d.ts file seems to be wrong, doesn't work if it's a string\n activeClassName={HighlightingEngine.ACTIVE_CLASS_NAME}\n autoEscape={true}\n textToHighlight={text}\n caseSensitive={caseSensitive}\n />\n );\n}\n\ninterface HighlighterChunk {\n highlight: boolean;\n start: number;\n end: number;\n}\ninterface FindChunksArgs {\n autoEscape?: boolean;\n caseSensitive?: boolean;\n searchWords: string[];\n textToHighlight: string;\n}\nconst findChunksNoRegex = (args: FindChunksArgs): HighlighterChunk[] => {\n const text = args.caseSensitive ? args.textToHighlight : args.textToHighlight.toUpperCase();\n const term = args.caseSensitive ? args.searchWords[0] : args.searchWords[0].toUpperCase();\n const chunks: HighlighterChunk[] = [];\n let index = text.indexOf(term);\n while (index !== -1) {\n chunks.push({ start: index, end: index + term.length, highlight: true });\n index = text.indexOf(term, index + 1);\n }\n return chunks;\n};\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * Item highlight info used for identification of a specific highlight in an item
6
- * @beta
6
+ * @public
7
7
  */
8
8
  export interface HighlightInfo {
9
9
  highlightedItemIdentifier: string;
@@ -11,7 +11,7 @@ export interface HighlightInfo {
11
11
  }
12
12
  /**
13
13
  * Properties used for highlighting parts in item by given text and actively highlighting one highlight in a distinct item specified in `activeHighlight`
14
- * @beta
14
+ * @public
15
15
  */
16
16
  export interface HighlightingComponentProps {
17
17
  highlightedText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightingComponentProps.js","sourceRoot":"","sources":["../../../src/components-react/common/HighlightingComponentProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 Common\n */\n\n/**\n * Item highlight info used for identification of a specific highlight in an item\n * @beta\n */\nexport interface HighlightInfo {\n /* item's identifier, used for its identification */\n highlightedItemIdentifier: string;\n /* Index of highlighted part in an item */\n highlightIndex: number;\n}\n\n/**\n * Properties used for highlighting parts in item by given text and actively highlighting one highlight in a distinct item specified in `activeHighlight`\n * @beta\n */\nexport interface HighlightingComponentProps {\n /* Filter text which we want to highlight */\n highlightedText: string;\n /* Information about the highlight which we want to actively highlight */\n activeHighlight?: HighlightInfo;\n}\n"]}
1
+ {"version":3,"file":"HighlightingComponentProps.js","sourceRoot":"","sources":["../../../src/components-react/common/HighlightingComponentProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 Common\n */\n\n/**\n * Item highlight info used for identification of a specific highlight in an item\n * @public\n */\nexport interface HighlightInfo {\n /* item's identifier, used for its identification */\n highlightedItemIdentifier: string;\n /* Index of highlighted part in an item */\n highlightIndex: number;\n}\n\n/**\n * Properties used for highlighting parts in item by given text and actively highlighting one highlight in a distinct item specified in `activeHighlight`\n * @public\n */\nexport interface HighlightingComponentProps {\n /* Filter text which we want to highlight */\n highlightedText: string;\n /* Information about the highlight which we want to actively highlight */\n activeHighlight?: HighlightInfo;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  /**
5
5
  * Custom hook for working with possibly async values.
6
- * @beta
6
+ * @public
7
7
  */
8
8
  export declare const useAsyncValue: <T extends unknown>(value: T | PromiseLike<T>) => T | undefined;
9
9
  //# sourceMappingURL=UseAsyncValue.d.ts.map
@@ -34,7 +34,7 @@ const Subject_1 = require("rxjs/internal/Subject");
34
34
  const core_react_1 = require("@itwin/core-react");
35
35
  /**
36
36
  * Custom hook for working with possibly async values.
37
- * @beta
37
+ * @public
38
38
  */
39
39
  const useAsyncValue = (value) => {
40
40
  const cancelled = React.useMemo(() => new Subject_1.Subject(), []);
@@ -1 +1 @@
1
- {"version":3,"file":"UseAsyncValue.js","sourceRoot":"","sources":["../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,wDAAqD;AACrD,iEAA8D;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CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACzC;QAED,WAAW,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA7BW,QAAA,aAAa,iBA6BxB","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 Common\n */\n\nimport * as React from \"react\";\nimport { from } from \"rxjs/internal/observable/from\";\nimport { takeUntil } from \"rxjs/internal/operators/takeUntil\";\nimport { Subject } from \"rxjs/internal/Subject\";\nimport { isPromiseLike, useEffectSkipFirst } from \"@itwin/core-react\";\n\n/**\n * Custom hook for working with possibly async values.\n * @beta\n */\nexport const useAsyncValue = <T extends any>(value: T | PromiseLike<T>): T | undefined => {\n const cancelled = React.useMemo(() => new Subject<void>(), []);\n // cancel any pending promises on unmount\n React.useEffect(() => () => cancelled.next(), [cancelled]);\n\n const [result, setResult] = React.useState(() => {\n if (isPromiseLike(value)) {\n from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => setResult(resolvedValue) });\n return undefined;\n }\n return value;\n });\n\n useEffectSkipFirst(() => {\n const updateValue = (newValue: T) => {\n cancelled.next();\n setResult(newValue);\n };\n\n if (isPromiseLike(value)) {\n const subscription = from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => updateValue(resolvedValue) });\n return () => subscription.unsubscribe();\n }\n\n updateValue(value);\n return undefined;\n }, [value, cancelled]);\n\n return result;\n};\n"]}
1
+ {"version":3,"file":"UseAsyncValue.js","sourceRoot":"","sources":["../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;A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EAAE,CAAC,CAAC;YAC/H,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACzC;QAED,WAAW,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA7BW,QAAA,aAAa,iBA6BxB","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 Common\n */\n\nimport * as React from \"react\";\nimport { from } from \"rxjs/internal/observable/from\";\nimport { takeUntil } from \"rxjs/internal/operators/takeUntil\";\nimport { Subject } from \"rxjs/internal/Subject\";\nimport { isPromiseLike, useEffectSkipFirst } from \"@itwin/core-react\";\n\n/**\n * Custom hook for working with possibly async values.\n * @public\n */\nexport const useAsyncValue = <T extends any>(value: T | PromiseLike<T>): T | undefined => {\n const cancelled = React.useMemo(() => new Subject<void>(), []);\n // cancel any pending promises on unmount\n React.useEffect(() => () => cancelled.next(), [cancelled]);\n\n const [result, setResult] = React.useState(() => {\n if (isPromiseLike(value)) {\n from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => setResult(resolvedValue) });\n return undefined;\n }\n return value;\n });\n\n useEffectSkipFirst(() => {\n const updateValue = (newValue: T) => {\n cancelled.next();\n setResult(newValue);\n };\n\n if (isPromiseLike(value)) {\n const subscription = from(value).pipe(takeUntil(cancelled)).subscribe({ next: (resolvedValue) => updateValue(resolvedValue) });\n return () => subscription.unsubscribe();\n }\n\n updateValue(value);\n return undefined;\n }, [value, cancelled]);\n\n return result;\n};\n"]}
@@ -12,7 +12,7 @@ interface BooleanEditorState {
12
12
  isDisabled?: boolean;
13
13
  }
14
14
  /** BooleanEditor React component that is a property editor with checkbox input
15
- * @beta
15
+ * @public
16
16
  */
17
17
  export declare class BooleanEditor extends React.PureComponent<PropertyEditorProps, BooleanEditorState> implements TypeEditor {
18
18
  private _isMounted;
@@ -35,7 +35,7 @@ export declare class BooleanEditor extends React.PureComponent<PropertyEditorPro
35
35
  }
36
36
  /** Boolean Property Editor registered for the "bool" and "boolean" type names.
37
37
  * It uses the [[BooleanEditor]] React component.
38
- * @beta
38
+ * @public
39
39
  */
40
40
  export declare class BooleanPropertyEditor extends PropertyEditorBase {
41
41
  get containerHandlesBlur(): boolean;
@@ -37,7 +37,7 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
37
37
  const itwinui_react_1 = require("@itwin/itwinui-react");
38
38
  const PropertyEditorManager_1 = require("./PropertyEditorManager");
39
39
  /** BooleanEditor React component that is a property editor with checkbox input
40
- * @beta
40
+ * @public
41
41
  */
42
42
  class BooleanEditor extends React.PureComponent {
43
43
  constructor() {
@@ -137,7 +137,7 @@ class BooleanEditor extends React.PureComponent {
137
137
  exports.BooleanEditor = BooleanEditor;
138
138
  /** Boolean Property Editor registered for the "bool" and "boolean" type names.
139
139
  * It uses the [[BooleanEditor]] React component.
140
- * @beta
140
+ * @public
141
141
  */
142
142
  class BooleanPropertyEditor extends PropertyEditorManager_1.PropertyEditorBase {
143
143
  // istanbul ignore next
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gCAA8B;AAC9B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAA8F;AAC9F,wDAAgD;AAEhD,mEAAoF;AAQpF;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK,CAAC,aAAsD;IAA/F;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAA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AAG,cAAc,CAAC,UAAU,CAAC;QAEzC,uBAAuB;QACvB,IAAI,IAAI,CAAC,UAAU;YACjB,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,SAAS,GAAG,IAAA,oBAAU,EAAC,wBAAwB,EAAE,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1G,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAE3C,OAAO,CACL,oBAAC,wBAAQ,IACP,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,QAAQ,EAAE,UAAU,iBACR,4BAA4B,GAC/B,CACZ,CAAC;IACJ,CAAC;CACF;AAzHD,sCAyHC;AAED;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,0CAAkB;IAC3D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF;AATD,sDASC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;AACpF,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./BooleanEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PropertyValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface BooleanEditorState {\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n\n/** BooleanEditor React component that is a property editor with checkbox input\n * @beta\n */\nexport class BooleanEditor extends React.PureComponent<PropertyEditorProps, BooleanEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<BooleanEditorState> = {\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateCheckboxValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted) {\n let checkboxValue: boolean = false;\n\n // istanbul ignore if\n if (e.target.checked !== undefined) // Needed for unit test environment\n checkboxValue = e.target.checked;\n else {\n // istanbul ignore else\n if (e.target.value !== undefined && typeof e.target.value === \"boolean\")\n checkboxValue = e.target.value;\n }\n\n this.setState({\n checkboxValue,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ checkboxValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-boolean-editor\", this.props.className);\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <Checkbox\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={checked}\n onChange={this._updateCheckboxValue}\n setFocus={this.props.setFocus}\n disabled={isDisabled}\n data-testid=\"components-checkbox-editor\">\n </Checkbox>\n );\n }\n}\n\n/** Boolean Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[BooleanEditor]] React component.\n * @beta\n */\nexport class BooleanPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <BooleanEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Bool, BooleanPropertyEditor);\nPropertyEditorManager.registerEditor(StandardTypeNames.Boolean, BooleanPropertyEditor);\n"]}
1
+ {"version":3,"file":"BooleanEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/BooleanEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gCAA8B;AAC9B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAA8F;AAC9F,wDAAgD;AAEhD,mEAAoF;AAQpF;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK,CAAC,aAAsD;IAA/F;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAAiC;YAC7D,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QA0BM,yBAAoB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACxE,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,aAAa,GAAY,KAAK,CAAC;gBAEnC,qBAAqB;gBACrB,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,EAAI,mCAAmC;oBACvE,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;qBAC9B;oBACH,uBAAuB;oBACvB,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS;wBACrE,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAClC;gBAED,IAAI,CAAC,QAAQ,CAAC;oBACZ,aAAa;iBACd,EAAE,KAAK,IAAI,EAAE;oBACZ,uBAAuB;oBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,C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,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,QAAQ,EAAE,UAAU,iBACR,4BAA4B,GAC/B,CACZ,CAAC;IACJ,CAAC;CACF;AAzHD,sCAyHC;AAED;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,0CAAkB;IAC3D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF;AATD,sDASC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;AACpF,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./BooleanEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PropertyValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface BooleanEditorState {\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n\n/** BooleanEditor React component that is a property editor with checkbox input\n * @public\n */\nexport class BooleanEditor extends React.PureComponent<PropertyEditorProps, BooleanEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<BooleanEditorState> = {\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateCheckboxValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted) {\n let checkboxValue: boolean = false;\n\n // istanbul ignore if\n if (e.target.checked !== undefined) // Needed for unit test environment\n checkboxValue = e.target.checked;\n else {\n // istanbul ignore else\n if (e.target.value !== undefined && typeof e.target.value === \"boolean\")\n checkboxValue = e.target.value;\n }\n\n this.setState({\n checkboxValue,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ checkboxValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-boolean-editor\", this.props.className);\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <Checkbox\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={checked}\n onChange={this._updateCheckboxValue}\n setFocus={this.props.setFocus}\n disabled={isDisabled}\n data-testid=\"components-checkbox-editor\">\n </Checkbox>\n );\n }\n}\n\n/** Boolean Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[BooleanEditor]] React component.\n * @public\n */\nexport class BooleanPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <BooleanEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Bool, BooleanPropertyEditor);\nPropertyEditorManager.registerEditor(StandardTypeNames.Boolean, BooleanPropertyEditor);\n"]}
@@ -13,7 +13,7 @@ interface EnumButtonGroupEditorState {
13
13
  choices: EnumerationChoice[];
14
14
  }
15
15
  /** EnumButtonGroupEditor React component that is a property editor with select input
16
- * @beta
16
+ * @public
17
17
  */
18
18
  export declare class EnumButtonGroupEditor extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState> implements TypeEditor {
19
19
  private _btnRefs;
@@ -35,7 +35,7 @@ export declare class EnumButtonGroupEditor extends React.Component<PropertyEdito
35
35
  }
36
36
  /** Enum Property Button Group Editor registered for the "enum" type name and the "enum-buttongroup" editor name.
37
37
  * It uses the [[EnumButtonGroupEditor]] React component.
38
- * @beta
38
+ * @public
39
39
  */
40
40
  export declare class EnumPropertyButtonGroupEditor extends PropertyEditorBase {
41
41
  get reactNode(): React.ReactNode;
@@ -37,7 +37,7 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
37
37
  const core_react_1 = require("@itwin/core-react");
38
38
  const PropertyEditorManager_1 = require("./PropertyEditorManager");
39
39
  /** EnumButtonGroupEditor React component that is a property editor with select input
40
- * @beta
40
+ * @public
41
41
  */
42
42
  class EnumButtonGroupEditor extends React.Component {
43
43
  constructor() {
@@ -168,7 +168,7 @@ class EnumButtonGroupEditor extends React.Component {
168
168
  exports.EnumButtonGroupEditor = EnumButtonGroupEditor;
169
169
  /** Enum Property Button Group Editor registered for the "enum" type name and the "enum-buttongroup" editor name.
170
170
  * It uses the [[EnumButtonGroupEditor]] React component.
171
- * @beta
171
+ * @public
172
172
  */
173
173
  class EnumPropertyButtonGroupEditor extends PropertyEditorManager_1.PropertyEditorBase {
174
174
  get reactNode() {
@@ -1 +1 @@
1
- {"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAyC;AAEzC,mEAAoF;AAWpF;;GAEG;AACH,MAAa,qBAAsB,SAAQ,KAAK,CAAC,SAA0D;IAA3G;;QACU,aAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;QACzD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAyC;YACrE,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QA2FM,uBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE;gBAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,C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GAGG;AACH,MAAa,6BAA8B,SAAQ,0CAAkB;IACnE,IAAW,SAAS;QAClB,OAAO,oBAAC,qBAAqB,OAAG,CAAC;IACnC,CAAC;CACF;AAJD,sEAIC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,6BAA6B,EAAE,oCAAmB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EnumButtonGroupEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport {\n ButtonGroupEditorParams, EnumerationChoice, IconDefinition, PropertyEditorParams, PropertyEditorParamTypes, PropertyRecord,\n PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n// cspell:ignore buttongroup enumbuttongroup\n\n/** @internal */\ninterface EnumButtonGroupEditorState {\n selectValue: string | number;\n enumIcons: IconDefinition[];\n choices: EnumerationChoice[];\n}\n\n/** EnumButtonGroupEditor React component that is a property editor with select input\n * @beta\n */\nexport class EnumButtonGroupEditor extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState> implements TypeEditor {\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\n selectValue: \"\",\n enumIcons: [],\n choices: [],\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n /** @internal */\n public override componentDidMount() {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.property.enum && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n let selectValue: string | number;\n\n if (typeof primitiveValue === \"string\") {\n selectValue = primitiveValue;\n } else {\n selectValue = primitiveValue as number;\n }\n\n let choices: EnumerationChoice[] = [];\n // istanbul ignore else\n if (propertyRecord && propertyRecord.property.enum) {\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const numChoices = choices.length;\n const enumIcons = new Array<IconDefinition>(numChoices);\n enumIcons.fill({ iconSpec: \"icon icon-placeholder\" });\n\n // istanbul ignore else\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\n // istanbul ignore else\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\n const bgParams = propertyRecord.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.ButtonGroupData) as ButtonGroupEditorParams;\n // istanbul ignore else\n if (bgParams) {\n bgParams.buttons.forEach((iconDef: IconDefinition, index: number) => {\n // istanbul ignore else\n if (index < numChoices) {\n enumIcons[index] = iconDef;\n }\n });\n }\n }\n }\n\n this.setState({ selectValue, enumIcons, choices });\n }\n }\n\n private _handleButtonClick = (index: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n // istanbul ignore else\n if (this.state.choices && this.state.choices.length > index) {\n const selectValue = this.state.choices[index].value;\n\n this.setState({\n selectValue,\n }, async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n private getButton(choice: EnumerationChoice, index: number) {\n const choiceValue = this.state.choices ? this.state.choices[index].value : /* istanbul ignore next */ 0;\n const isActive = (choiceValue === this.state.selectValue) ? true : false;\n let isDisabled = false;\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\n // istanbul ignore else\n if (isEnabledFunction) {\n isDisabled = !isEnabledFunction();\n }\n\n const className = classnames(\n \"components-enumbuttongroup-button\",\n isDisabled && \"nz-is-disabled\",\n isActive && \"nz-is-active\",\n );\n\n return (\n <button\n ref={(ref: HTMLButtonElement) => this._btnRefs.set(choiceValue, ref)}\n data-testid={choice.label}\n className={className}\n title={choice.label}\n key={choice.label}\n onClick={() => this._handleButtonClick(index)}\n >\n <Icon iconSpec={this.state.enumIcons[index].iconSpec} />\n </button >\n );\n }\n\n /** @internal */\n public override render() {\n return (\n <div className={classnames(\"components-enumbuttongroup-editor\", this.props.className)} style={this.props.style} ref={this._divElement}>\n {this.state.choices && this.state.enumIcons.length && this.state.choices.map((choice: EnumerationChoice, index: number) => this.getButton(choice, index))}\n </div>);\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\n * It uses the [[EnumButtonGroupEditor]] React component.\n * @beta\n */\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase { // istanbul ignore next\n public get reactNode(): React.ReactNode {\n return <EnumButtonGroupEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, EnumPropertyButtonGroupEditor, StandardEditorNames.EnumButtonGroup);\n"]}
1
+ {"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAyC;AAEzC,mEAAoF;AAWpF;;GAEG;AACH,MAAa,qBAAsB,SAAQ,KAAK,CAAC,SAA0D;IAA3G;;QACU,aAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;QACzD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAyC;YACrE,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QA2FM,uBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE;gBAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;gBAEpD,IAAI,CAAC,QAAQ,CAAC;oBACZ,WAAW;iBACZ,EAAE,KAAK,IAAI,EAAE;oBACZ,uBAAuB;oBACvB,IAAI,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;wBACzC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;wBACpD,uBAAuB;wBACvB,IAAI,aAAa,KAAK,SAAS,EAAE;4BAC/B,IA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AI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,iBACvD,MAAM,CAAC,KAAK,EACzB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,GAAG,EAAE,MAAM,CAAC,KAAK,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;YAE7C,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAI,CAChD,CACX,CAAC;IACJ,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,IAAA,oBAAU,EAAC,mCAAmC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,IAClI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAyB,EAAE,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CACrJ,CAAC,CAAC;IACZ,CAAC;CACF;AA/JD,sDA+JC;AAED;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,0CAAkB;IACnE,IAAW,SAAS;QAClB,OAAO,oBAAC,qBAAqB,OAAG,CAAC;IACnC,CAAC;CACF;AAJD,sEAIC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,6BAA6B,EAAE,oCAAmB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EnumButtonGroupEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport {\n ButtonGroupEditorParams, EnumerationChoice, IconDefinition, PropertyEditorParams, PropertyEditorParamTypes, PropertyRecord,\n PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n// cspell:ignore buttongroup enumbuttongroup\n\n/** @internal */\ninterface EnumButtonGroupEditorState {\n selectValue: string | number;\n enumIcons: IconDefinition[];\n choices: EnumerationChoice[];\n}\n\n/** EnumButtonGroupEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumButtonGroupEditor extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState> implements TypeEditor {\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\n selectValue: \"\",\n enumIcons: [],\n choices: [],\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n /** @internal */\n public override componentDidMount() {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.property.enum && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n let selectValue: string | number;\n\n if (typeof primitiveValue === \"string\") {\n selectValue = primitiveValue;\n } else {\n selectValue = primitiveValue as number;\n }\n\n let choices: EnumerationChoice[] = [];\n // istanbul ignore else\n if (propertyRecord && propertyRecord.property.enum) {\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const numChoices = choices.length;\n const enumIcons = new Array<IconDefinition>(numChoices);\n enumIcons.fill({ iconSpec: \"icon icon-placeholder\" });\n\n // istanbul ignore else\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\n // istanbul ignore else\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\n const bgParams = propertyRecord.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.ButtonGroupData) as ButtonGroupEditorParams;\n // istanbul ignore else\n if (bgParams) {\n bgParams.buttons.forEach((iconDef: IconDefinition, index: number) => {\n // istanbul ignore else\n if (index < numChoices) {\n enumIcons[index] = iconDef;\n }\n });\n }\n }\n }\n\n this.setState({ selectValue, enumIcons, choices });\n }\n }\n\n private _handleButtonClick = (index: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n // istanbul ignore else\n if (this.state.choices && this.state.choices.length > index) {\n const selectValue = this.state.choices[index].value;\n\n this.setState({\n selectValue,\n }, async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n private getButton(choice: EnumerationChoice, index: number) {\n const choiceValue = this.state.choices ? this.state.choices[index].value : /* istanbul ignore next */ 0;\n const isActive = (choiceValue === this.state.selectValue) ? true : false;\n let isDisabled = false;\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\n // istanbul ignore else\n if (isEnabledFunction) {\n isDisabled = !isEnabledFunction();\n }\n\n const className = classnames(\n \"components-enumbuttongroup-button\",\n isDisabled && \"nz-is-disabled\",\n isActive && \"nz-is-active\",\n );\n\n return (\n <button\n ref={(ref: HTMLButtonElement) => this._btnRefs.set(choiceValue, ref)}\n data-testid={choice.label}\n className={className}\n title={choice.label}\n key={choice.label}\n onClick={() => this._handleButtonClick(index)}\n >\n <Icon iconSpec={this.state.enumIcons[index].iconSpec} />\n </button >\n );\n }\n\n /** @internal */\n public override render() {\n return (\n <div className={classnames(\"components-enumbuttongroup-editor\", this.props.className)} style={this.props.style} ref={this._divElement}>\n {this.state.choices && this.state.enumIcons.length && this.state.choices.map((choice: EnumerationChoice, index: number) => this.getButton(choice, index))}\n </div>);\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\n * It uses the [[EnumButtonGroupEditor]] React component.\n * @public\n */\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase { // istanbul ignore next\n public get reactNode(): React.ReactNode {\n return <EnumButtonGroupEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, EnumPropertyButtonGroupEditor, StandardEditorNames.EnumButtonGroup);\n"]}
@@ -15,7 +15,7 @@ interface EnumEditorState {
15
15
  parentDiv: HTMLDivElement | null;
16
16
  }
17
17
  /** EnumEditor React component that is a property editor with select input
18
- * @beta
18
+ * @public
19
19
  */
20
20
  export declare class EnumEditor extends React.PureComponent<PropertyEditorProps, EnumEditorState> implements TypeEditor {
21
21
  private _isMounted;
@@ -39,7 +39,7 @@ export declare class EnumEditor extends React.PureComponent<PropertyEditorProps,
39
39
  }
40
40
  /** Enum Property Button Group Editor registered for the "enum" type name.
41
41
  * It uses the [[EnumEditor]] React component.
42
- * @beta
42
+ * @public
43
43
  */
44
44
  export declare class EnumPropertyEditor extends PropertyEditorBase {
45
45
  get containerHandlesEnter(): boolean;
@@ -38,7 +38,7 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
38
38
  const PropertyEditorManager_1 = require("./PropertyEditorManager");
39
39
  const UiComponents_1 = require("../UiComponents");
40
40
  /** EnumEditor React component that is a property editor with select input
41
- * @beta
41
+ * @public
42
42
  */
43
43
  class EnumEditor extends React.PureComponent {
44
44
  constructor() {
@@ -171,7 +171,7 @@ class EnumEditor extends React.PureComponent {
171
171
  exports.EnumEditor = EnumEditor;
172
172
  /** Enum Property Button Group Editor registered for the "enum" type name.
173
173
  * It uses the [[EnumEditor]] React component.
174
- * @beta
174
+ * @public
175
175
  */
176
176
  class EnumPropertyEditor extends PropertyEditorManager_1.PropertyEditorBase {
177
177
  // istanbul ignore next
@@ -1 +1 @@
1
- {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/EnumEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAiH;AACjH,wDAA4D;AAE5D,mEAAoF;AACpF,kDAA+C;AAU/C;;IAEI;AACJ,MAAa,UAAW,SAAQ,KAAK,CAAC,aAAmD;IAAzF;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACnD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAA8B;YAC1D,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,EAAE;YACX,SAAS,EAA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ChB,CAAC;QAEF,oGAAoG;QACpG,6BAA6B;QAE7B,+IAA+I;QAC/I,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,WAAW;YACxB,oBAAC,sBAAM,IACL,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAC1D,KAAK,EAAE,WAAW,EAClB,YAAY,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,QAAQ,CAAC,IAAI,EAAE,EAC3I,QAAQ,EAAE,IAAI,CAAC,kBAAkB,iBACrB,0BAA0B,EACtC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,gBACjB,IAAI,CAAC,UAAU,GAAI,CAC7B,CACP,CAAC;IACJ,CAAC;CACF;AA5JD,gCA4JC;AAED;;;IAGI;AACJ,MAAa,kBAAmB,SAAQ,0CAAkB;IACxD,uBAAuB;IACvB,IAAoB,qBAAqB;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAoB,gCAAgC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAZD,gDAYC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EnumEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { EnumerationChoice, PropertyValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface EnumEditorState {\n selectValue: string | number;\n valueIsNumber: boolean;\n options: SelectOption<string>[];\n parentDiv: HTMLDivElement | null;\n}\n\n/** EnumEditor React component that is a property editor with select input\n * @beta\n */\nexport class EnumEditor extends React.PureComponent<PropertyEditorProps, EnumEditorState> implements TypeEditor {\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.enum\");\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumEditorState> = {\n selectValue: \"\",\n valueIsNumber: false,\n options: [],\n parentDiv: null,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateSelectValue = (newValue: string) => {\n // istanbul ignore else\n if (this._isMounted) {\n let selectValue: string | number;\n\n // istanbul ignore if\n if (this.state.valueIsNumber)\n selectValue = parseInt(newValue, 10);\n else\n selectValue = newValue;\n\n this.setState({\n selectValue,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let initialValue: string | number = \"\";\n let valueIsNumber: boolean = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n if (typeof primitiveValue === \"string\") {\n initialValue = primitiveValue;\n valueIsNumber = false;\n } else {\n initialValue = primitiveValue as number;\n valueIsNumber = true;\n }\n }\n\n let choices: EnumerationChoice[] | undefined;\n\n if (propertyRecord && propertyRecord.property.enum) {\n // istanbul ignore else\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const options: SelectOption<string>[] = [];\n if (choices) {\n choices.forEach((choice: EnumerationChoice) => {\n options.push({ value: choice.value.toString(), label: choice.label });\n });\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ selectValue: initialValue, valueIsNumber, options, parentDiv: this._divElement.current });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-enum-editor\", this.props.className);\n const selectValue = this.state.selectValue !== undefined ? this.state.selectValue.toString() : /* istanbul ignore next */ undefined;\n\n // set min-width to show about 4 characters + down arrow\n const minWidthStyle: React.CSSProperties = {\n minWidth: `6em`,\n };\n\n // The iTwinUI-react Select onBlur still does not work properly, so it cannot be used yet. NEEDSWORK\n // onBlur={this.props.onBlur}\n\n /* The following popoverProps are required for the popup to properly show in floating widgets because this makes it work similar to a portal */\n return (\n <div ref={this._divElement}>\n <Select\n className={className}\n style={this.props.style ? this.props.style : minWidthStyle}\n value={selectValue}\n popoverProps={{ appendTo: () => this.state.parentDiv ? this.state.parentDiv.ownerDocument.body : /* istanbul ignore next */ document.body }}\n onChange={this._updateSelectValue}\n data-testid=\"components-select-editor\"\n options={this.state.options}\n setFocus={this.props.setFocus}\n aria-label={this._ariaLabel} />\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name.\n * It uses the [[EnumEditor]] React component.\n * @beta\n */\nexport class EnumPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n public override get containerStopsKeydownPropagation(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <EnumEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, EnumPropertyEditor);\n"]}
1
+ {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/EnumEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAiH;AACjH,wDAA4D;AAE5D,mEAAoF;AACpF,kDAA+C;AAU/C;;IAEI;AACJ,MAAa,UAAW,SAAQ,KAAK,CAAC,aAAmD;IAAzF;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACnD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAA8B;YAC1D,WAAW,EAAE,EAAE;YACf,aAAa,EAAE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AAM,aAAa,GAAwB;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QAEF,oGAAoG;QACpG,6BAA6B;QAE7B,+IAA+I;QAC/I,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,WAAW;YACxB,oBAAC,sBAAM,IACL,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAC1D,KAAK,EAAE,WAAW,EAClB,YAAY,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,QAAQ,CAAC,IAAI,EAAE,EAC3I,QAAQ,EAAE,IAAI,CAAC,kBAAkB,iBACrB,0BAA0B,EACtC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,gBACjB,IAAI,CAAC,UAAU,GAAI,CAC7B,CACP,CAAC;IACJ,CAAC;CACF;AA5JD,gCA4JC;AAED;;;IAGI;AACJ,MAAa,kBAAmB,SAAQ,0CAAkB;IACxD,uBAAuB;IACvB,IAAoB,qBAAqB;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAoB,gCAAgC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAZD,gDAYC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EnumEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { EnumerationChoice, PropertyValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface EnumEditorState {\n selectValue: string | number;\n valueIsNumber: boolean;\n options: SelectOption<string>[];\n parentDiv: HTMLDivElement | null;\n}\n\n/** EnumEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumEditor extends React.PureComponent<PropertyEditorProps, EnumEditorState> implements TypeEditor {\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.enum\");\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumEditorState> = {\n selectValue: \"\",\n valueIsNumber: false,\n options: [],\n parentDiv: null,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateSelectValue = (newValue: string) => {\n // istanbul ignore else\n if (this._isMounted) {\n let selectValue: string | number;\n\n // istanbul ignore if\n if (this.state.valueIsNumber)\n selectValue = parseInt(newValue, 10);\n else\n selectValue = newValue;\n\n this.setState({\n selectValue,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let initialValue: string | number = \"\";\n let valueIsNumber: boolean = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n if (typeof primitiveValue === \"string\") {\n initialValue = primitiveValue;\n valueIsNumber = false;\n } else {\n initialValue = primitiveValue as number;\n valueIsNumber = true;\n }\n }\n\n let choices: EnumerationChoice[] | undefined;\n\n if (propertyRecord && propertyRecord.property.enum) {\n // istanbul ignore else\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const options: SelectOption<string>[] = [];\n if (choices) {\n choices.forEach((choice: EnumerationChoice) => {\n options.push({ value: choice.value.toString(), label: choice.label });\n });\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ selectValue: initialValue, valueIsNumber, options, parentDiv: this._divElement.current });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-enum-editor\", this.props.className);\n const selectValue = this.state.selectValue !== undefined ? this.state.selectValue.toString() : /* istanbul ignore next */ undefined;\n\n // set min-width to show about 4 characters + down arrow\n const minWidthStyle: React.CSSProperties = {\n minWidth: `6em`,\n };\n\n // The iTwinUI-react Select onBlur still does not work properly, so it cannot be used yet. NEEDSWORK\n // onBlur={this.props.onBlur}\n\n /* The following popoverProps are required for the popup to properly show in floating widgets because this makes it work similar to a portal */\n return (\n <div ref={this._divElement}>\n <Select\n className={className}\n style={this.props.style ? this.props.style : minWidthStyle}\n value={selectValue}\n popoverProps={{ appendTo: () => this.state.parentDiv ? this.state.parentDiv.ownerDocument.body : /* istanbul ignore next */ document.body }}\n onChange={this._updateSelectValue}\n data-testid=\"components-select-editor\"\n options={this.state.options}\n setFocus={this.props.setFocus}\n aria-label={this._ariaLabel} />\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name.\n * It uses the [[EnumEditor]] React component.\n * @public\n */\nexport class EnumPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n public override get containerStopsKeydownPropagation(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <EnumEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, EnumPropertyEditor);\n"]}
@@ -17,7 +17,7 @@ interface ImageCheckBoxEditorState {
17
17
  }
18
18
  /** [[ImageCheckBoxEditor]]
19
19
  * Boolean editor that renders with an image instead of checkbox
20
- * @beta
20
+ * @public
21
21
  */
22
22
  export declare class ImageCheckBoxEditor extends React.PureComponent<PropertyEditorProps, ImageCheckBoxEditorState> implements TypeEditor {
23
23
  private _isMounted;
@@ -39,7 +39,7 @@ export declare class ImageCheckBoxEditor extends React.PureComponent<PropertyEdi
39
39
  }
40
40
  /** ImageCheckBox Property Editor registered for the "bool" and "boolean" type names.
41
41
  * It uses the [[ImageCheckBoxEditor]] React component.
42
- * @beta
42
+ * @public
43
43
  */
44
44
  export declare class ImageCheckBoxPropertyEditor extends PropertyEditorBase {
45
45
  get reactNode(): React.ReactNode;
@@ -38,7 +38,7 @@ const PropertyEditorManager_1 = require("./PropertyEditorManager");
38
38
  const core_react_1 = require("@itwin/core-react");
39
39
  /** [[ImageCheckBoxEditor]]
40
40
  * Boolean editor that renders with an image instead of checkbox
41
- * @beta
41
+ * @public
42
42
  */
43
43
  class ImageCheckBoxEditor extends React.PureComponent {
44
44
  constructor() {
@@ -135,7 +135,7 @@ class ImageCheckBoxEditor extends React.PureComponent {
135
135
  exports.ImageCheckBoxEditor = ImageCheckBoxEditor;
136
136
  /** ImageCheckBox Property Editor registered for the "bool" and "boolean" type names.
137
137
  * It uses the [[ImageCheckBoxEditor]] React component.
138
- * @beta
138
+ * @public
139
139
  */
140
140
  class ImageCheckBoxPropertyEditor extends PropertyEditorManager_1.PropertyEditorBase {
141
141
  get reactNode() {
@@ -1 +1 @@
1
- {"version":3,"file":"ImageCheckBoxEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sCAAoC;AACpC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAE+B;AAE/B,mEAAoF;AACpF,kDAAkD;AAalD;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,KAAK,CAAC,aAA4D;IAA3G;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QAE7E,gBAAgB;QACS,UAAK,GAAuC;YACnE,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QAwEM,iBAAY,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,CAAC;gBACZ,aAAa,EAAE,OAAO;aACvB,EAAE,KAAK,IAAI,EAAE;gBACZ,uBAAuB;gBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,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AAG,IAAA,oBAAU,EAAC,wBAAwB,EAAE,iCAAiC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAChH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAE3C,OAAO,CACL,oBAAC,0BAAa,IACZ,QAAQ,EAAE,IAAI,CAAC,aAAa,EAC5B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,IAAI,CAAC,YAAY,iBACd,iCAAiC,GAC/B,CACjB,CAAC;IACJ,CAAC;CACF;AArHD,kDAqHC;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,0CAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,mBAAmB,OAAG,CAAC;IACjC,CAAC;CACF;AAJD,kEAIC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,OAAO,EAAE,2BAA2B,EAAE,oCAAmB,CAAC,aAAa,CAAC,CAAC;AAChI,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,2BAA2B,EAAE,oCAAmB,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./ImageCheckBoxEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport {\n ImageCheckBoxParams, PropertyEditorParams, PropertyEditorParamTypes, PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\nimport { ImageCheckBox } from \"@itwin/core-react\";\n\n// cSpell:ignore imagecheckbox\n\n/** @internal */\ninterface ImageCheckBoxEditorState {\n /** Image for the \"checked\" state */\n imageOn: string;\n /** Image for the \"unchecked\" (default) state */\n imageOff: string;\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n/** [[ImageCheckBoxEditor]]\n * Boolean editor that renders with an image instead of checkbox\n * @beta\n */\nexport class ImageCheckBoxEditor extends React.PureComponent<PropertyEditorProps, ImageCheckBoxEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n\n /** @internal */\n public override readonly state: Readonly<ImageCheckBoxEditorState> = {\n imageOff: \"\",\n imageOn: \"\",\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps();\n }\n }\n\n private setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let imageOn = \"\";\n let imageOff = \"\";\n let isDisabled = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n if (propertyRecord && propertyRecord.property && propertyRecord.property.editor && propertyRecord.property.editor.params) {\n const imageCheckBoxParams = propertyRecord.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.CheckBoxImages) as ImageCheckBoxParams;\n // istanbul ignore else\n if (imageCheckBoxParams) {\n imageOn = imageCheckBoxParams.imageOn;\n imageOff = imageCheckBoxParams.imageOff;\n }\n }\n this.setState({ imageOn, imageOff, checkboxValue, isDisabled });\n }\n\n private _handleClick = (checked: boolean) => {\n this.setState({\n checkboxValue: checked,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (this._isMounted && propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n };\n\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-imagecheckbox-editor\", this.props.className);\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <ImageCheckBox\n inputRef={this._inputElement}\n imageOff={this.state.imageOff}\n imageOn={this.state.imageOn}\n className={className}\n border={true}\n style={this.props.style}\n checked={checked}\n disabled={isDisabled}\n onClick={this._handleClick}\n data-testid=\"components-imagecheckbox-editor\">\n </ImageCheckBox>\n );\n }\n}\n\n/** ImageCheckBox Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[ImageCheckBoxEditor]] React component.\n * @beta\n */\nexport class ImageCheckBoxPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <ImageCheckBoxEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Boolean, ImageCheckBoxPropertyEditor, StandardEditorNames.ImageCheckBox);\nPropertyEditorManager.registerEditor(StandardTypeNames.Bool, ImageCheckBoxPropertyEditor, StandardEditorNames.ImageCheckBox);\n"]}
1
+ {"version":3,"file":"ImageCheckBoxEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sCAAoC;AACpC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAE+B;AAE/B,mEAAoF;AACpF,kDAAkD;AAalD;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,KAAK,CAAC,aAA4D;IAA3G;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QAE7E,gBAAgB;QACS,UAAK,GAAuC;YACnE,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QAwEM,iBAAY,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,CAAC;gBACZ,aAAa,EAAE,OAAO;aACvB,EAAE,KAAK,IAAI,EAAE;gBACZ,uBAAuB;gBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACpD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACpD,uBAAuB;oBACvB,IAAI,IAAI,CAAC,UAAU,IAAI,aAAa,KAAK,SAAS,EAAE;wBAClD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,CAA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AAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,IAAI,CAAC,YAAY,iBACd,iCAAiC,GAC/B,CACjB,CAAC;IACJ,CAAC;CACF;AArHD,kDAqHC;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,0CAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,mBAAmB,OAAG,CAAC;IACjC,CAAC;CACF;AAJD,kEAIC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,OAAO,EAAE,2BAA2B,EAAE,oCAAmB,CAAC,aAAa,CAAC,CAAC;AAChI,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,2BAA2B,EAAE,oCAAmB,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./ImageCheckBoxEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport {\n ImageCheckBoxParams, PropertyEditorParams, PropertyEditorParamTypes, PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\nimport { ImageCheckBox } from \"@itwin/core-react\";\n\n// cSpell:ignore imagecheckbox\n\n/** @internal */\ninterface ImageCheckBoxEditorState {\n /** Image for the \"checked\" state */\n imageOn: string;\n /** Image for the \"unchecked\" (default) state */\n imageOff: string;\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n/** [[ImageCheckBoxEditor]]\n * Boolean editor that renders with an image instead of checkbox\n * @public\n */\nexport class ImageCheckBoxEditor extends React.PureComponent<PropertyEditorProps, ImageCheckBoxEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n\n /** @internal */\n public override readonly state: Readonly<ImageCheckBoxEditorState> = {\n imageOff: \"\",\n imageOn: \"\",\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps();\n }\n }\n\n private setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let imageOn = \"\";\n let imageOff = \"\";\n let isDisabled = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n if (propertyRecord && propertyRecord.property && propertyRecord.property.editor && propertyRecord.property.editor.params) {\n const imageCheckBoxParams = propertyRecord.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.CheckBoxImages) as ImageCheckBoxParams;\n // istanbul ignore else\n if (imageCheckBoxParams) {\n imageOn = imageCheckBoxParams.imageOn;\n imageOff = imageCheckBoxParams.imageOff;\n }\n }\n this.setState({ imageOn, imageOff, checkboxValue, isDisabled });\n }\n\n private _handleClick = (checked: boolean) => {\n this.setState({\n checkboxValue: checked,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (this._isMounted && propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n };\n\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-imagecheckbox-editor\", this.props.className);\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <ImageCheckBox\n inputRef={this._inputElement}\n imageOff={this.state.imageOff}\n imageOn={this.state.imageOn}\n className={className}\n border={true}\n style={this.props.style}\n checked={checked}\n disabled={isDisabled}\n onClick={this._handleClick}\n data-testid=\"components-imagecheckbox-editor\">\n </ImageCheckBox>\n );\n }\n}\n\n/** ImageCheckBox Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[ImageCheckBoxEditor]] React component.\n * @public\n */\nexport class ImageCheckBoxPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <ImageCheckBoxEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Boolean, ImageCheckBoxPropertyEditor, StandardEditorNames.ImageCheckBox);\nPropertyEditorManager.registerEditor(StandardTypeNames.Bool, ImageCheckBoxPropertyEditor, StandardEditorNames.ImageCheckBox);\n"]}
@@ -19,7 +19,7 @@ interface NumericInputEditorState {
19
19
  precision?: number;
20
20
  }
21
21
  /** NumericInputEditor React component that is a property editor with numeric input & up/down buttons
22
- * @beta
22
+ * @public
23
23
  */
24
24
  export declare class NumericInputEditor extends React.PureComponent<PropertyEditorProps, NumericInputEditorState> implements TypeEditor {
25
25
  private _isMounted;
@@ -43,7 +43,7 @@ export declare class NumericInputEditor extends React.PureComponent<PropertyEdit
43
43
  }
44
44
  /** Numeric Input Property Editor registered for the "number" type name and "numeric-input" editor name.
45
45
  * It uses the [[NumericInputEditor]] React component.
46
- * @beta
46
+ * @public
47
47
  */
48
48
  export declare class NumericInputPropertyEditor extends PropertyEditorBase {
49
49
  get reactNode(): React.ReactNode;
@@ -37,7 +37,7 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
37
37
  const core_react_1 = require("@itwin/core-react");
38
38
  const PropertyEditorManager_1 = require("./PropertyEditorManager");
39
39
  /** NumericInputEditor React component that is a property editor with numeric input & up/down buttons
40
- * @beta
40
+ * @public
41
41
  */
42
42
  class NumericInputEditor extends React.PureComponent {
43
43
  constructor() {
@@ -150,7 +150,7 @@ class NumericInputEditor extends React.PureComponent {
150
150
  exports.NumericInputEditor = NumericInputEditor;
151
151
  /** Numeric Input Property Editor registered for the "number" type name and "numeric-input" editor name.
152
152
  * It uses the [[NumericInputEditor]] React component.
153
- * @beta
153
+ * @public
154
154
  */
155
155
  class NumericInputPropertyEditor extends PropertyEditorManager_1.PropertyEditorBase {
156
156
  get reactNode() {
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAgD;AAEhD,mEAAoF;AAgBpF;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK,CAAC,aAA2D;IAAzG;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QACtE,aAAQ,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;AARD,gEAQC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC;AAC7H,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,GAAG,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC;AAC1H,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,KAAK,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC;AAC5H,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport {\n InputEditorSizeParams, PropertyEditorParams, PropertyEditorParamTypes, PropertyValue, PropertyValueFormat, RangeEditorParams,\n StandardEditorNames, StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @beta\n */\nexport class NumericInputEditor extends React.PureComponent<PropertyEditorProps, NumericInputEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n /** @internal */\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n };\n\n private _updateValue = (value: number | undefined, _stringValue: string): void => {\n const newValue = value !== undefined ? value : /* istanbul ignore next */ 0;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: newValue,\n }, async () => {\n await this._handleCommit();\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly = record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (record && record.property && record.property.editor && record.property.editor.params) {\n const editorSizeParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.InputEditorSize) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size)\n size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength)\n maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.Range) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ value: initialValue, readonly, size, maxLength, isDisabled, min, max, step, precision });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\"components-cell-editor\", \"components-numeric-input-editor\", this.props.className);\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n\n return (\n <NumberInput\n ref={this._inputElement}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.state.readonly}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n setFocus={this.props.setFocus && !this.state.isDisabled}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @beta\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean { // let input editor process enter key\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Number, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\nPropertyEditorManager.registerEditor(StandardTypeNames.Int, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\nPropertyEditorManager.registerEditor(StandardTypeNames.Float, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\nPropertyEditorManager.registerEditor(StandardTypeNames.Double, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\n"]}
1
+ {"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAgD;AAEhD,mEAAoF;AAgBpF;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK,CAAC,aAA2D;IAAzG;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QACtE,aAAQ,GAAG,KAAK,CAAC,CAAC,gDAAgD;QAEzE,gBAAgB;QACS,UAAK,GAAsC;YAClE,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,KAAK;SAChB,CAAC;QAsBM,kBAAa,GAAG,KAAK,IAAmB,EAAE;YAChD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACpD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpD,uBAAuB;gBACvB,IAAI,aAAa,KAAK,SAAS,EAAE;oBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;iBAC7F;aACF;QACH,CAAC,CAAC;QAEM,iBAAY,GAAG,CAAC,KAAyB,EAAE,YAAoB,EAAQ,EAAE;YAC/E,MAAM,QAAQ,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KA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EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GACvD,CACH,CAAC;IACJ,CAAC;CACF;AA/ID,gDA+IC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,0CAAkB;IAChE,IAAW,SAAS;QAClB,OAAO,oBAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;IACD,uBAAuB;IACvB,IAAoB,qBAAqB;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,gEAQC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC;AAC7H,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,GAAG,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC;AAC1H,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,KAAK,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC;AAC5H,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,MAAM,EAAE,0BAA0B,EAAE,oCAAmB,CAAC,YAAY,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport {\n InputEditorSizeParams, PropertyEditorParams, PropertyEditorParamTypes, PropertyValue, PropertyValueFormat, RangeEditorParams,\n StandardEditorNames, StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class NumericInputEditor extends React.PureComponent<PropertyEditorProps, NumericInputEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n /** @internal */\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n };\n\n private _updateValue = (value: number | undefined, _stringValue: string): void => {\n const newValue = value !== undefined ? value : /* istanbul ignore next */ 0;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: newValue,\n }, async () => {\n await this._handleCommit();\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly = record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (record && record.property && record.property.editor && record.property.editor.params) {\n const editorSizeParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.InputEditorSize) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size)\n size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength)\n maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.Range) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ value: initialValue, readonly, size, maxLength, isDisabled, min, max, step, precision });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\"components-cell-editor\", \"components-numeric-input-editor\", this.props.className);\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n\n return (\n <NumberInput\n ref={this._inputElement}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.state.readonly}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n setFocus={this.props.setFocus && !this.state.isDisabled}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @public\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean { // let input editor process enter key\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Number, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\nPropertyEditorManager.registerEditor(StandardTypeNames.Int, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\nPropertyEditorManager.registerEditor(StandardTypeNames.Float, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\nPropertyEditorManager.registerEditor(StandardTypeNames.Double, NumericInputPropertyEditor, StandardEditorNames.NumericInput);\n"]}