@itwin/components-react 4.16.5 → 4.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/lib/cjs/components-react/common/HighlightedText.d.ts +1 -0
  3. package/lib/cjs/components-react/common/HighlightedText.d.ts.map +1 -1
  4. package/lib/cjs/components-react/common/HighlightedText.js +1 -0
  5. package/lib/cjs/components-react/common/HighlightedText.js.map +1 -1
  6. package/lib/cjs/components-react/editors/EditorContainer.d.ts +1 -0
  7. package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
  8. package/lib/cjs/components-react/editors/EditorContainer.js +1 -0
  9. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  10. package/lib/cjs/components-react/editors/PopupButton.d.ts +1 -0
  11. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  12. package/lib/cjs/components-react/editors/PopupButton.js +1 -0
  13. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  14. package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts +1 -0
  15. package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
  16. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +1 -0
  17. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  18. package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +2 -0
  19. package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
  20. package/lib/cjs/components-react/filter-builder/FilterBuilder.js +2 -2
  21. package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
  22. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
  23. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
  24. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +2 -2
  25. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
  26. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
  27. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
  28. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +4 -4
  29. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  30. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
  31. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
  32. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +37 -34
  33. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  34. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
  35. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
  36. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +50 -27
  37. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  38. package/lib/cjs/components-react/inputs/ParsedInput.d.ts +1 -0
  39. package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
  40. package/lib/cjs/components-react/inputs/ParsedInput.js +1 -0
  41. package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
  42. package/lib/cjs/components-react/properties/LinkHandler.d.ts +1 -0
  43. package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
  44. package/lib/cjs/components-react/properties/LinkHandler.js +1 -0
  45. package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
  46. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
  47. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  48. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js +47 -60
  49. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  50. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
  51. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  52. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +30 -2
  53. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
  54. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
  55. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
  56. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
  57. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
  58. package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts +2 -0
  59. package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
  60. package/lib/cjs/components-react/selectable-content/SelectableContent.js +4 -1
  61. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  62. package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
  63. package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
  64. package/lib/cjs/components-react/tree/controlled/component/NodeContent.js +1 -0
  65. package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  66. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
  67. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  68. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
  69. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  70. package/lib/esm/components-react/common/HighlightedText.d.ts +1 -0
  71. package/lib/esm/components-react/common/HighlightedText.d.ts.map +1 -1
  72. package/lib/esm/components-react/common/HighlightedText.js +1 -0
  73. package/lib/esm/components-react/common/HighlightedText.js.map +1 -1
  74. package/lib/esm/components-react/editors/EditorContainer.d.ts +1 -0
  75. package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
  76. package/lib/esm/components-react/editors/EditorContainer.js +1 -0
  77. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  78. package/lib/esm/components-react/editors/PopupButton.d.ts +1 -0
  79. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  80. package/lib/esm/components-react/editors/PopupButton.js +1 -0
  81. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  82. package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts +1 -0
  83. package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
  84. package/lib/esm/components-react/favorite/FavoritePropertyList.js +1 -0
  85. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  86. package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +2 -0
  87. package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
  88. package/lib/esm/components-react/filter-builder/FilterBuilder.js +2 -2
  89. package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
  90. package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
  91. package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
  92. package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +2 -2
  93. package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
  94. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
  95. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
  96. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +4 -4
  97. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  98. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
  99. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
  100. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +36 -32
  101. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  102. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
  103. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
  104. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +48 -26
  105. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  106. package/lib/esm/components-react/inputs/ParsedInput.d.ts +1 -0
  107. package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
  108. package/lib/esm/components-react/inputs/ParsedInput.js +1 -0
  109. package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
  110. package/lib/esm/components-react/properties/LinkHandler.d.ts +1 -0
  111. package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
  112. package/lib/esm/components-react/properties/LinkHandler.js +1 -0
  113. package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
  114. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
  115. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  116. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js +47 -60
  117. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  118. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
  119. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  120. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +7 -2
  121. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
  122. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
  123. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
  124. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
  125. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
  126. package/lib/esm/components-react/selectable-content/SelectableContent.d.ts +2 -0
  127. package/lib/esm/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
  128. package/lib/esm/components-react/selectable-content/SelectableContent.js +4 -1
  129. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  130. package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
  131. package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
  132. package/lib/esm/components-react/tree/controlled/component/NodeContent.js +1 -0
  133. package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  134. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
  135. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  136. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
  137. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  138. package/package.json +3 -3
@@ -15,6 +15,7 @@ export declare const withLinks: (stringValue: string, links?: LinkElementsInfo,
15
15
  /**
16
16
  * Properties for [[LinksRenderer]] component.
17
17
  * @public
18
+ * @deprecated in 4.17.0. Use `React.ComponentProps<typeof LinksRenderer>`
18
19
  */
19
20
  export interface LinksRendererProps {
20
21
  value: string;
@@ -1 +1 @@
1
- {"version":3,"file":"LinkHandler.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA2F9D;;GAEG;AACH,eAAO,MAAM,WAAW,SAChB,MAAM,SACL,gBAAgB,sBACJ,MAAM,KAAK,MAAM,SAAS,kBAC5C,MAAM,SAER,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,gBACP,MAAM,UACX,gBAAgB,sBACL,MAAM,KAAK,MAAM,SAAS,kBAC5C,MAAM,SAIR,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAEtD"}
1
+ {"version":3,"file":"LinkHandler.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA2F9D;;GAEG;AACH,eAAO,MAAM,WAAW,SAChB,MAAM,SACL,gBAAgB,sBACJ,MAAM,KAAK,MAAM,SAAS,kBAC5C,MAAM,SAER,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,gBACP,MAAM,UACX,gBAAgB,sBACL,MAAM,KAAK,MAAM,SAAS,kBAC5C,MAAM,SAIR,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CACjD;AAED;;;GAGG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAEtD"}
@@ -76,6 +76,7 @@ export const withLinks = (stringValue, links, highlight) => {
76
76
  * React component for rendering string with links.
77
77
  * @public
78
78
  */
79
+ // eslint-disable-next-line deprecation/deprecation
79
80
  export function LinksRenderer(props) {
80
81
  return React.createElement(React.Fragment, null, withLinks(props.value, props.links, props.highlighter));
81
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,iCAAiC;AACjC,SAAS,SAAS,CAChB,IAAY,EACZ,KAAuB,EACvB,SAA6C;IAE7C,OAAO;IACL,mDAAmD;IACnD,oBAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,IAEA,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAClB,CACpB,CAAC;AACJ,CAAC;AAOD,SAAS,eAAe,CAAC,MAAa,EAAE,MAAa;IACnD,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CACrB,IAAY,EACZ,SAA6C;IAE7C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,SAAS,UAAU,CACjB,IAAY,EACZ,KAAuB,EACvB,SAA6C;IAE7C,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC,IAAI,EAAE,K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O,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAAY,EACZ,KAAuB,EACvB,SAA6C,EAC5B,EAAE;IACnB,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,WAAmB,EACnB,KAAwB,EACxB,SAA6C,EAC5B,EAAE;IACnB,IAAI,KAAK;QAAE,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7D,IAAI,SAAS;QAAE,OAAO,iBAAiB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAChE,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAYF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,0CAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAI,CAAC;AACvE,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 Properties\n */\n\nimport * as React from \"react\";\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport type { LinkElementsInfo } from \"@itwin/appui-abstract\";\nimport { UnderlinedButton } from \"@itwin/core-react\";\n\n/** Render a single anchor tag */\nfunction renderTag(\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n) {\n return (\n // eslint-disable-next-line deprecation/deprecation\n <UnderlinedButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n links.onClick(text);\n }}\n >\n {highlight ? highlight(text) : text}\n </UnderlinedButton>\n );\n}\n\ninterface Match {\n start: number;\n end: number;\n}\n\nfunction matchComparison(matchA: Match, matchB: Match) {\n if (matchA.start > matchB.start) return 1;\n if (matchB.start > matchA.start) return -1;\n return 0;\n}\n\nfunction renderTextPart(\n text: string,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode {\n return highlight ? highlight(text) : text;\n}\n\nfunction renderText(\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode {\n const { matcher } = links;\n\n if (!matcher) return renderTag(text, links, highlight);\n\n const matches = matcher(text);\n\n // Sort just to be sure\n matches.sort(matchComparison);\n\n const parts: React.ReactNode[] = [];\n let lastIndex = 0;\n for (const match of matches) {\n // If matches overlap there must be something wrong with the matcher\n if (lastIndex > match.start)\n throw new BentleyError(\n BentleyStatus.ERROR,\n \"renderText: matcher returned overlapping matches\"\n );\n\n if (lastIndex < match.start)\n parts.push(\n renderTextPart(text.substring(lastIndex, match.start), highlight)\n );\n\n const anchorText = text.substring(match.start, match.end);\n parts.push(renderTag(anchorText, links, highlight));\n\n lastIndex = match.end;\n }\n if (text.length > lastIndex)\n parts.push(renderTextPart(text.substring(lastIndex), highlight));\n\n // Need to map, because React complains about the lack of keys\n return parts.map((part, index) => (\n <React.Fragment key={index}>{part}</React.Fragment>\n ));\n}\n\nfunction renderHighlighted(\n text: string,\n highlight: (text: string) => React.ReactNode\n) {\n return highlight(text);\n}\n\n/** Renders anchor tag by wrapping or splitting provided text\n * @public\n */\nexport const renderLinks = (\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode => {\n return renderText(text, links, highlight);\n};\n\n/** If record has links, wraps stringValue in them, otherwise returns unchanged stringValue\n * Optionally it can highlight text\n * @public\n */\nexport const withLinks = (\n stringValue: string,\n links?: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode => {\n if (links) return renderLinks(stringValue, links, highlight);\n if (highlight) return renderHighlighted(stringValue, highlight);\n return stringValue;\n};\n\n/**\n * Properties for [[LinksRenderer]] component.\n * @public\n */\nexport interface LinksRendererProps {\n value: string;\n links?: LinkElementsInfo;\n highlighter?: (text: string) => React.ReactNode;\n}\n\n/**\n * React component for rendering string with links.\n * @public\n */\nexport function LinksRenderer(props: LinksRendererProps) {\n return <>{withLinks(props.value, props.links, props.highlighter)}</>;\n}\n"]}
1
+ {"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,iCAAiC;AACjC,SAAS,SAAS,CAChB,IAAY,EACZ,KAAuB,EACvB,SAA6C;IAE7C,OAAO;IACL,mDAAmD;IACnD,oBAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,IAEA,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAClB,CACpB,CAAC;AACJ,CAAC;AAOD,SAAS,eAAe,CAAC,MAAa,EAAE,MAAa;IACnD,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CACrB,IAAY,EACZ,SAA6C;IAE7C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CA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GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,KAAK,IAAG,IAAI,CAAkB,CACpD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAY,EACZ,SAA4C;IAE5C,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAAY,EACZ,KAAuB,EACvB,SAA6C,EAC5B,EAAE;IACnB,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,WAAmB,EACnB,KAAwB,EACxB,SAA6C,EAC5B,EAAE;IACnB,IAAI,KAAK;QAAE,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7D,IAAI,SAAS;QAAE,OAAO,iBAAiB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAChE,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAaF;;;GAGG;AACH,mDAAmD;AACnD,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,0CAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAI,CAAC;AACvE,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 Properties\n */\n\nimport * as React from \"react\";\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport type { LinkElementsInfo } from \"@itwin/appui-abstract\";\nimport { UnderlinedButton } from \"@itwin/core-react\";\n\n/** Render a single anchor tag */\nfunction renderTag(\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n) {\n return (\n // eslint-disable-next-line deprecation/deprecation\n <UnderlinedButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n links.onClick(text);\n }}\n >\n {highlight ? highlight(text) : text}\n </UnderlinedButton>\n );\n}\n\ninterface Match {\n start: number;\n end: number;\n}\n\nfunction matchComparison(matchA: Match, matchB: Match) {\n if (matchA.start > matchB.start) return 1;\n if (matchB.start > matchA.start) return -1;\n return 0;\n}\n\nfunction renderTextPart(\n text: string,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode {\n return highlight ? highlight(text) : text;\n}\n\nfunction renderText(\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode {\n const { matcher } = links;\n\n if (!matcher) return renderTag(text, links, highlight);\n\n const matches = matcher(text);\n\n // Sort just to be sure\n matches.sort(matchComparison);\n\n const parts: React.ReactNode[] = [];\n let lastIndex = 0;\n for (const match of matches) {\n // If matches overlap there must be something wrong with the matcher\n if (lastIndex > match.start)\n throw new BentleyError(\n BentleyStatus.ERROR,\n \"renderText: matcher returned overlapping matches\"\n );\n\n if (lastIndex < match.start)\n parts.push(\n renderTextPart(text.substring(lastIndex, match.start), highlight)\n );\n\n const anchorText = text.substring(match.start, match.end);\n parts.push(renderTag(anchorText, links, highlight));\n\n lastIndex = match.end;\n }\n if (text.length > lastIndex)\n parts.push(renderTextPart(text.substring(lastIndex), highlight));\n\n // Need to map, because React complains about the lack of keys\n return parts.map((part, index) => (\n <React.Fragment key={index}>{part}</React.Fragment>\n ));\n}\n\nfunction renderHighlighted(\n text: string,\n highlight: (text: string) => React.ReactNode\n) {\n return highlight(text);\n}\n\n/** Renders anchor tag by wrapping or splitting provided text\n * @public\n */\nexport const renderLinks = (\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode => {\n return renderText(text, links, highlight);\n};\n\n/** If record has links, wraps stringValue in them, otherwise returns unchanged stringValue\n * Optionally it can highlight text\n * @public\n */\nexport const withLinks = (\n stringValue: string,\n links?: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode => {\n if (links) return renderLinks(stringValue, links, highlight);\n if (highlight) return renderHighlighted(stringValue, highlight);\n return stringValue;\n};\n\n/**\n * Properties for [[LinksRenderer]] component.\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof LinksRenderer>`\n */\nexport interface LinksRendererProps {\n value: string;\n links?: LinkElementsInfo;\n highlighter?: (text: string) => React.ReactNode;\n}\n\n/**\n * React component for rendering string with links.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function LinksRenderer(props: LinksRendererProps) {\n return <>{withLinks(props.value, props.links, props.highlighter)}</>;\n}\n"]}
@@ -69,28 +69,11 @@ export interface PropertyRendererProps extends SharedRendererProps {
69
69
  /** Props used for highlighting. */
70
70
  highlight?: HighlightingComponentProps;
71
71
  }
72
- /** State of [[PropertyRenderer]] React component
73
- * @internal
74
- */
75
- interface PropertyRendererState {
76
- /** Currently loaded property value */
77
- displayValue?: React.ReactNode;
78
- }
79
72
  /** A React component that renders properties
80
73
  * @public
81
74
  */
82
- export declare class PropertyRenderer extends React.Component<PropertyRendererProps, PropertyRendererState> {
83
- readonly state: Readonly<PropertyRendererState>;
84
- constructor(props: PropertyRendererProps);
85
- static getLabelOffset(indentation?: number, orientation?: Orientation, width?: number, columnRatio?: number, minColumnLabelWidth?: number): number;
86
- private updateDisplayValue;
87
- private _onEditCommit;
88
- private _onEditCancel;
89
- /** Display property record value in an editor */
90
- updateDisplayValueAsEditor(props: PropertyRendererProps): void;
91
- componentDidMount(): void;
92
- componentDidUpdate(prevProps: PropertyRendererProps): void;
93
- render(): React.JSX.Element;
94
- }
95
- export {};
75
+ export declare const PropertyRenderer: {
76
+ (props: PropertyRendererProps): React.JSX.Element;
77
+ getLabelOffset(indentation?: number, orientation?: Orientation, width?: number, columnRatio?: number, minColumnLabelWidth?: number): number;
78
+ };
96
79
  //# sourceMappingURL=PropertyRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,qHAAqH;IACrH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,2FAA2F;IAC3F,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,mDAAmD;IACnD,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAA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SAAS,CAAC;CAChC;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,SAAS,CACnD,qBAAqB,EACrB,qBAAqB,CACtB;IACC,SAAyB,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAE7D;gBAEU,KAAK,EAAE,qBAAqB;WAI1B,cAAc,CAC1B,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,WAAW,EACzB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM;IAUT,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,aAAa,CAEnB;IAEF,iDAAiD;IAC1C,0BAA0B,CAAC,KAAK,EAAE,qBAAqB;IAa9C,iBAAiB;IAIjB,kBAAkB,CAAC,SAAS,EAAE,qBAAqB;IASnD,MAAM;CAmCvB"}
1
+ {"version":3,"file":"PropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IA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B,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,4BAA4B;IAC5B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnD,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mCAAmC;IACnC,SAAS,CAAC,EAAE,0BAA0B,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;YAAW,qBAAqB;iCAyF7C,MAAM,gBACN,WAAW,UACjB,MAAM,gBACA,MAAM,wBACE,MAAM;CAP7B,CAAC"}
@@ -8,74 +8,61 @@
8
8
  import * as React from "react";
9
9
  import { PropertyValueFormat } from "@itwin/appui-abstract";
10
10
  import { EditorContainer } from "../../editors/EditorContainer";
11
- import { UiComponents } from "../../UiComponents";
12
11
  import { CommonPropertyRenderer } from "./CommonPropertyRenderer";
13
12
  import { NonPrimitivePropertyRenderer } from "./NonPrimitivePropertyRenderer";
14
13
  import { PrimitivePropertyRenderer } from "./PrimitivePropertyRenderer";
14
+ import { useTranslation } from "../../l10n/useTranslation";
15
15
  /** A React component that renders properties
16
16
  * @public
17
17
  */
18
- export class PropertyRenderer extends React.Component {
19
- constructor(props) {
20
- super(props);
21
- this.state = {
22
- displayValue: UiComponents.translate("general.loading"),
23
- };
24
- this._onEditCommit = (args) => {
25
- if (this.props.onEditCommit)
26
- this.props.onEditCommit(args);
27
- };
28
- this._onEditCancel = () => {
29
- if (this.props.onEditCancel)
30
- this.props.onEditCancel();
31
- };
32
- }
33
- static getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth) {
34
- return CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);
35
- }
36
- updateDisplayValue(props) {
37
- if (props.isEditing) {
38
- this.updateDisplayValueAsEditor(props);
18
+ export const PropertyRenderer = (props) => {
19
+ const { translate } = useTranslation();
20
+ const [displayValue, setDisplayValue] = React.useState(() => translate("general.loading"));
21
+ const { isEditing, orientation, propertyRecord, indentation, propertyValueRendererManager, onEditCommit, onEditCancel, ...restProps } = props;
22
+ const onCommit = React.useCallback((args) => {
23
+ if (onEditCommit)
24
+ onEditCommit(args);
25
+ }, [onEditCommit]);
26
+ const onCancel = React.useCallback(() => {
27
+ if (onEditCancel)
28
+ onEditCancel();
29
+ }, [onEditCancel]);
30
+ React.useEffect(() => {
31
+ if (isEditing) {
32
+ setDisplayValue(React.createElement(EditorContainer, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, setFocus: true }));
39
33
  return;
40
34
  }
41
- const displayValue = CommonPropertyRenderer.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);
42
- this.setState({ displayValue });
43
- }
44
- /** Display property record value in an editor */
45
- updateDisplayValueAsEditor(props) {
46
- this.setState({
47
- displayValue: (React.createElement(EditorContainer, { propertyRecord: props.propertyRecord, onCommit: this._onEditCommit, onCancel: this._onEditCancel, setFocus: true })),
48
- });
49
- }
50
- componentDidMount() {
51
- this.updateDisplayValue(this.props);
52
- }
53
- componentDidUpdate(prevProps) {
54
- if (prevProps.propertyRecord !== this.props.propertyRecord ||
55
- prevProps.isEditing !== this.props.isEditing ||
56
- prevProps.orientation !== this.props.orientation)
57
- this.updateDisplayValue(this.props);
58
- }
59
- render() {
60
- const { propertyValueRendererManager, isEditing, onEditCommit, onEditCancel, ...props } = this.props;
61
- const primitiveRendererProps = {
62
- ...props,
63
- valueElement: this.state.displayValue,
64
- indentation: this.props.indentation,
65
- };
66
- switch (this.props.propertyRecord.value.valueFormat) {
67
- case PropertyValueFormat.Primitive:
35
+ setDisplayValue(CommonPropertyRenderer.createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager));
36
+ }, [
37
+ orientation,
38
+ propertyRecord,
39
+ indentation,
40
+ propertyValueRendererManager,
41
+ onCommit,
42
+ onCancel,
43
+ isEditing,
44
+ ]);
45
+ const primitiveRendererProps = {
46
+ ...restProps,
47
+ propertyRecord,
48
+ orientation,
49
+ indentation,
50
+ valueElement: displayValue,
51
+ };
52
+ switch (props.propertyRecord.value.valueFormat) {
53
+ case PropertyValueFormat.Primitive:
54
+ return React.createElement(PrimitivePropertyRenderer, { ...primitiveRendererProps });
55
+ case PropertyValueFormat.Array:
56
+ // If array is empty, render it as a primitive property
57
+ if (props.propertyRecord.value.valueFormat === PropertyValueFormat.Array &&
58
+ props.propertyRecord.value.items.length === 0)
68
59
  return React.createElement(PrimitivePropertyRenderer, { ...primitiveRendererProps });
69
- case PropertyValueFormat.Array:
70
- // If array is empty, render it as a primitive property
71
- if (this.props.propertyRecord.value.valueFormat ===
72
- PropertyValueFormat.Array &&
73
- this.props.propertyRecord.value.items.length === 0)
74
- return React.createElement(PrimitivePropertyRenderer, { ...primitiveRendererProps });
75
- // eslint-disable-next-line no-fallthrough
76
- case PropertyValueFormat.Struct:
77
- return (React.createElement(NonPrimitivePropertyRenderer, { isCollapsible: true, ...primitiveRendererProps }));
78
- }
60
+ // eslint-disable-next-line no-fallthrough
61
+ case PropertyValueFormat.Struct:
62
+ return (React.createElement(NonPrimitivePropertyRenderer, { isCollapsible: true, ...primitiveRendererProps }));
79
63
  }
80
- }
64
+ };
65
+ PropertyRenderer.getLabelOffset = (indentation, orientation, width, columnRatio, minColumnLabelWidth) => {
66
+ return CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);
67
+ };
81
68
  //# sourceMappingURL=PropertyRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AACh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C,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACpD,KAAK,mBAAmB,CAAC,SAAS;gBAChC,OAAO,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAAC;YACnE,KAAK,mBAAmB,CAAC,KAAK;gBAC5B,uDAAuD;gBACvD,IACE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW;oBACzC,mBAAmB,CAAC,KAAK;oBAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBAElD,OAAO,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAAC;YACrE,0CAA0C;YAC1C,KAAK,mBAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,4BAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;QACN,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../editors/EditorContainer\";\nimport { UiComponents } from \"../../UiComponents\";\nimport type { PropertyValueRendererManager } from \"../ValueRendererManager\";\nimport type { ActionButtonRenderer } from \"./ActionButtonRenderer\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"./PropertyGridColumns\";\nimport type { Orientation } from \"../../common/Orientation\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | {\n ratio: number;\n };\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Props used for highlighting. */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\n PropertyRendererProps,\n PropertyRendererState\n> {\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n constructor(props: PropertyRendererProps) {\n super(props);\n }\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n if (this.props.onEditCommit) this.props.onEditCommit(args);\n };\n\n private _onEditCancel = () => {\n if (this.props.onEditCancel) this.props.onEditCancel();\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n )\n this.updateDisplayValue(this.props);\n }\n\n public override render() {\n const {\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n ...props\n } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (\n this.props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Array &&\n this.props.propertyRecord.value.items.length === 0\n )\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAgE3D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAkB,GAAG,EAAE,CAC3E,SAAS,CAAC,iBAAiB,CAAC,CAC7B,CAAC;IAEF,MAAM,EACJ,SAAS,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,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,KAAK;gBACpE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;gBAE7C,OAAO,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAAC;QACrE,0CAA0C;QAC1C,KAAK,mBAAmB,CAAC,MAAM;YAC7B,OAAO,CACL,oBAAC,4BAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;IACN,CAAC;AACH,CAAC,CAAC;AAEF,gBAAgB,CAAC,cAAc,GAAG,CAChC,WAAoB,EACpB,WAAyB,EACzB,KAAc,EACd,WAAoB,EACpB,mBAA4B,EAC5B,EAAE;IACF,OAAO,sBAAsB,CAAC,cAAc,CAC1C,WAAW,EACX,WAAW,EACX,KAAK,EACL,WAAW,EACX,mBAAmB,CACpB,CAAC;AACJ,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../editors/EditorContainer\";\nimport type { PropertyValueRendererManager } from \"../ValueRendererManager\";\nimport type { ActionButtonRenderer } from \"./ActionButtonRenderer\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"./PropertyGridColumns\";\nimport type { Orientation } from \"../../common/Orientation\";\nimport { useTranslation } from \"../../l10n/useTranslation\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | {\n ratio: number;\n };\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Props used for highlighting. */\n highlight?: HighlightingComponentProps;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport const PropertyRenderer = (props: PropertyRendererProps) => {\n const { translate } = useTranslation();\n const [displayValue, setDisplayValue] = React.useState<React.ReactNode>(() =>\n translate(\"general.loading\")\n );\n\n const {\n isEditing,\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager,\n onEditCommit,\n onEditCancel,\n ...restProps\n } = props;\n\n const onCommit = React.useCallback(\n (args: PropertyUpdatedArgs) => {\n if (onEditCommit) onEditCommit(args);\n },\n [onEditCommit]\n );\n\n const onCancel = React.useCallback(() => {\n if (onEditCancel) onEditCancel();\n }, [onEditCancel]);\n\n React.useEffect(() => {\n if (isEditing) {\n setDisplayValue(\n <EditorContainer\n propertyRecord={propertyRecord}\n onCommit={onCommit}\n onCancel={onCancel}\n setFocus={true}\n />\n );\n return;\n }\n\n setDisplayValue(\n CommonPropertyRenderer.createNewDisplayValue(\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager\n )\n );\n }, [\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager,\n onCommit,\n onCancel,\n isEditing,\n ]);\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...restProps,\n propertyRecord,\n orientation,\n indentation,\n valueElement: displayValue,\n };\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (\n props.propertyRecord.value.valueFormat === PropertyValueFormat.Array &&\n props.propertyRecord.value.items.length === 0\n )\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n};\n\nPropertyRenderer.getLabelOffset = (\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n) => {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n );\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Properties
3
3
  */
4
+ import * as React from "react";
4
5
  import type { PropertyRecord } from "@itwin/appui-abstract";
5
6
  import type { IPropertyValueRenderer, PropertyValueRendererContext } from "../../ValueRendererManager";
6
7
  /** Default Merged Property Renderer
@@ -10,6 +11,6 @@ export declare class MergedPropertyValueRenderer implements IPropertyValueRender
10
11
  /** Checks if the renderer can handle given property */
11
12
  canRender(record: PropertyRecord): boolean;
12
13
  /** Method that returns a JSX representation of PropertyRecord */
13
- render(_record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable<import("react").ReactNode> | import("react").JSX.Element | null | undefined;
14
+ render(_record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
14
15
  }
15
16
  //# sourceMappingURL=MergedPropertyValueRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MergedPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,4BAA4B,CAAC;AAGpC;;GAEG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IACxE,uDAAuD;IAChD,SAAS,CAAC,MAAM,EAAE,cAAc;IAOvC,iEAAiE;IAC1D,MAAM,CACX,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,4BAA4B;CAIzC"}
1
+ {"version":3,"file":"MergedPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,4BAA4B,CAAC;AAIpC;;GAEG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IACxE,uDAAuD;IAChD,SAAS,CAAC,MAAM,EAAE,cAAc;IAOvC,iEAAiE;IAC1D,MAAM,CACX,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,4BAA4B;CAIzC"}
@@ -5,9 +5,10 @@
5
5
  /** @packageDocumentation
6
6
  * @module Properties
7
7
  */
8
+ import * as React from "react";
8
9
  import { PropertyValueFormat } from "@itwin/appui-abstract";
9
- import { UiComponents } from "../../../UiComponents";
10
10
  import { withContextStyle } from "./WithContextStyle";
11
+ import { useTranslation } from "../../../l10n/useTranslation";
11
12
  /** Default Merged Property Renderer
12
13
  * @public
13
14
  */
@@ -19,7 +20,11 @@ export class MergedPropertyValueRenderer {
19
20
  }
20
21
  /** Method that returns a JSX representation of PropertyRecord */
21
22
  render(_record, context) {
22
- return withContextStyle(UiComponents.translate("property.varies"), context);
23
+ return withContextStyle(React.createElement(VariesRenderer, null), context);
23
24
  }
24
25
  }
26
+ function VariesRenderer() {
27
+ const { translate } = useTranslation();
28
+ return React.createElement(React.Fragment, null, translate("property.varies"));
29
+ }
25
30
  //# sourceMappingURL=MergedPropertyValueRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MergedPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAKrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,CAAC,CAAC,MAAM,CAAC,QAAQ;YACjB,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS,CAC3D,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,OAAuB,EACvB,OAAsC;QAEtC,OAAO,gBAAgB,CAAC,YAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Properties\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"../../../UiComponents\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { withContextStyle } from \"./WithContextStyle\";\n\n/** Default Merged Property Renderer\n * @public\n */\nexport class MergedPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n !!record.isMerged &&\n record.value.valueFormat === PropertyValueFormat.Primitive\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n _record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return withContextStyle(UiComponents.translate(\"property.varies\"), context);\n }\n}\n"]}
1
+ {"version":3,"file":"MergedPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,CAAC,CAAC,MAAM,CAAC,QAAQ;YACjB,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS,CAC3D,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,OAAuB,EACvB,OAAsC;QAEtC,OAAO,gBAAgB,CAAC,oBAAC,cAAc,OAAG,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AAED,SAAS,cAAc;IACrB,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,OAAO,0CAAG,SAAS,CAAC,iBAAiB,CAAC,CAAI,CAAC;AAC7C,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { withContextStyle } from \"./WithContextStyle\";\nimport { useTranslation } from \"../../../l10n/useTranslation\";\n\n/** Default Merged Property Renderer\n * @public\n */\nexport class MergedPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n !!record.isMerged &&\n record.value.valueFormat === PropertyValueFormat.Primitive\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n _record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return withContextStyle(<VariesRenderer />, context);\n }\n}\n\nfunction VariesRenderer() {\n const { translate } = useTranslation();\n return <>{translate(\"property.varies\")}</>;\n}\n"]}
@@ -7,6 +7,7 @@ import type { IPropertyDataProvider } from "../PropertyDataProvider";
7
7
  import type { CommonPropertyGridProps, PropertyGridContentHighlightProps } from "./PropertyGridCommons";
8
8
  /** Properties for [[VirtualizedPropertyGridWithDataProvider]] React component
9
9
  * @public
10
+ * @deprecated in 4.17.0. Use `React.ComponentProps<typeof VirtualizedPropertyGridWithDataProvider>`
10
11
  */
11
12
  export interface VirtualizedPropertyGridWithDataProviderProps extends CommonPropertyGridProps {
12
13
  /** Property data provider used by the property grid */
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedPropertyGridWithDataProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACV,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAI/B;;GAEG;AACH,MAAM,WAAW,4CACf,SAAQ,uBAAuB;IAC/B,uDAAuD;IACvD,YAAY,EAAE,qBAAqB,CAAC;IACpC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,iCAAiC,CAAC;IAC9C,iHAAiH;IACjH,+BAA+B,CAAC,EAAE,+BAA+B,CAAC;IAClE,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,4CAA4C,qBAoBpD"}
1
+ {"version":3,"file":"VirtualizedPropertyGridWithDataProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACV,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAI/B;;;GAGG;AACH,MAAM,WAAW,4CACf,SAAQ,uBAAuB;IAC/B,uDAAuD;IACvD,YAAY,EAAE,qBAAqB,CAAC;IACpC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,iCAAiC,CAAC;IAC9C,iHAAiH;IACjH,+BAA+B,CAAC,EAAE,+BAA+B,CAAC;IAClE,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,uCAAuC,CAErD,KAAK,EAAE,4CAA4C,qBAoBpD"}
@@ -14,7 +14,9 @@ import { ProgressRadial } from "@itwin/itwinui-react";
14
14
  * sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]
15
15
  * @public
16
16
  */
17
- export function VirtualizedPropertyGridWithDataProvider(props) {
17
+ export function VirtualizedPropertyGridWithDataProvider(
18
+ /* eslint-disable-next-line deprecation/deprecation */
19
+ props) {
18
20
  const { modelSource, inProgress } = useTrackedPropertyGridModelSource({
19
21
  dataProvider: props.dataProvider,
20
22
  });
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],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AAC;QAER,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,0CAAG,QAAQ,CAAI,CAChB,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,6CAA6C;QAC1D,oBAAC,cAAc,IAAC,aAAa,QAAC,IAAI,EAAE,OAAO,GAAI,CAC3C,CACP,CAAC;AACJ,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\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport React, { useEffect, useState } from \"react\";\nimport {\n usePropertyGridEventHandler,\n usePropertyGridModel,\n useTrackedPropertyGridModelSource,\n} from \"../internal/PropertyGridHooks\";\nimport type { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type { IPropertyDataProvider } from \"../PropertyDataProvider\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { VirtualizedPropertyGrid } from \"./VirtualizedPropertyGrid\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[VirtualizedPropertyGridWithDataProvider]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridWithDataProviderProps\n extends CommonPropertyGridProps {\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/**\n * [[VirtualizedPropertyGrid]] React Component which takes a data provider and\n * sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]\n * @public\n */\nexport function VirtualizedPropertyGridWithDataProvider(\n props: VirtualizedPropertyGridWithDataProviderProps\n) {\n const { modelSource, inProgress } = useTrackedPropertyGridModelSource({\n dataProvider: props.dataProvider,\n });\n\n const model = usePropertyGridModel({ modelSource });\n const eventHandler = usePropertyGridEventHandler({ modelSource });\n\n return (\n <DelayedLoaderRenderer shouldRenderLoader={inProgress || !model}>\n {model && (\n <VirtualizedPropertyGrid\n {...props}\n model={model}\n eventHandler={eventHandler}\n />\n )}\n </DelayedLoaderRenderer>\n );\n}\n\ninterface DelayedLoaderRendererProps {\n shouldRenderLoader: boolean;\n}\n\nfunction DelayedLoaderRenderer({\n children,\n shouldRenderLoader,\n}: React.PropsWithChildren<DelayedLoaderRendererProps>) {\n const [showSpinner, setShowSpinner] = useState(shouldRenderLoader);\n useEffect(() => {\n if (!shouldRenderLoader) {\n setShowSpinner(shouldRenderLoader);\n return;\n }\n\n // only set a timeout when shouldRenderLoader is set to `true`\n const timeout = setTimeout(() => {\n setShowSpinner(shouldRenderLoader);\n }, 250);\n\n return () => clearTimeout(timeout);\n }, [shouldRenderLoader]);\n\n return !showSpinner ? (\n <>{children}</>\n ) : (\n <div className=\"components-virtualized-property-grid-loader\">\n <ProgressRadial indeterminate size={\"large\"} />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,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AC,cAAc,IAAC,aAAa,QAAC,IAAI,EAAE,OAAO,GAAI,CAC3C,CACP,CAAC;AACJ,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\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport React, { useEffect, useState } from \"react\";\nimport {\n usePropertyGridEventHandler,\n usePropertyGridModel,\n useTrackedPropertyGridModelSource,\n} from \"../internal/PropertyGridHooks\";\nimport type { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type { IPropertyDataProvider } from \"../PropertyDataProvider\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { VirtualizedPropertyGrid } from \"./VirtualizedPropertyGrid\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[VirtualizedPropertyGridWithDataProvider]] React component\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof VirtualizedPropertyGridWithDataProvider>`\n */\nexport interface VirtualizedPropertyGridWithDataProviderProps\n extends CommonPropertyGridProps {\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/**\n * [[VirtualizedPropertyGrid]] React Component which takes a data provider and\n * sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]\n * @public\n */\nexport function VirtualizedPropertyGridWithDataProvider(\n /* eslint-disable-next-line deprecation/deprecation */\n props: VirtualizedPropertyGridWithDataProviderProps\n) {\n const { modelSource, inProgress } = useTrackedPropertyGridModelSource({\n dataProvider: props.dataProvider,\n });\n\n const model = usePropertyGridModel({ modelSource });\n const eventHandler = usePropertyGridEventHandler({ modelSource });\n\n return (\n <DelayedLoaderRenderer shouldRenderLoader={inProgress || !model}>\n {model && (\n <VirtualizedPropertyGrid\n {...props}\n model={model}\n eventHandler={eventHandler}\n />\n )}\n </DelayedLoaderRenderer>\n );\n}\n\ninterface DelayedLoaderRendererProps {\n shouldRenderLoader: boolean;\n}\n\nfunction DelayedLoaderRenderer({\n children,\n shouldRenderLoader,\n}: React.PropsWithChildren<DelayedLoaderRendererProps>) {\n const [showSpinner, setShowSpinner] = useState(shouldRenderLoader);\n useEffect(() => {\n if (!shouldRenderLoader) {\n setShowSpinner(shouldRenderLoader);\n return;\n }\n\n // only set a timeout when shouldRenderLoader is set to `true`\n const timeout = setTimeout(() => {\n setShowSpinner(shouldRenderLoader);\n }, 250);\n\n return () => clearTimeout(timeout);\n }, [shouldRenderLoader]);\n\n return !showSpinner ? (\n <>{children}</>\n ) : (\n <div className=\"components-virtualized-property-grid-loader\">\n <ProgressRadial indeterminate size={\"large\"} />\n </div>\n );\n}\n"]}
@@ -16,6 +16,7 @@ export interface SelectableContentDefinition {
16
16
  /**
17
17
  * [[ControlledSelectableContent]] component properties
18
18
  * @public
19
+ * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ControlledSelectableContent>`
19
20
  */
20
21
  export interface ControlledSelectableContentProps {
21
22
  selectedContentId: string;
@@ -34,6 +35,7 @@ export declare function ControlledSelectableContent(props: ControlledSelectableC
34
35
  /**
35
36
  * [[SelectableContent]] component properties
36
37
  * @public
38
+ * @deprecated in 4.17.0. Use `React.ComponentProps<typeof SelectableContent>`
37
39
  */
38
40
  export interface SelectableContentProps {
39
41
  defaultSelectedContentId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectableContent.d.ts","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gCAAgC,qBA0CxC;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB,EAAE,MAAM,CAAC;IACjC,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAiB9D"}
1
+ {"version":3,"file":"SelectableContent.d.ts","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAEzC,KAAK,EAAE,gCAAgC,qBA0CxC;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB,EAAE,MAAM,CAAC;IACjC,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAiB9D"}
@@ -14,7 +14,9 @@ import { Select } from "@itwin/itwinui-react";
14
14
  * should be rendered at the bottom.
15
15
  * @public
16
16
  */
17
- export function ControlledSelectableContent(props) {
17
+ export function ControlledSelectableContent(
18
+ /* eslint-disable-next-line deprecation/deprecation */
19
+ props) {
18
20
  const { onSelectedContentIdChanged, disabled } = props;
19
21
  const onContentIdSelected = React.useCallback((newValue) => {
20
22
  onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);
@@ -36,6 +38,7 @@ export function ControlledSelectableContent(props) {
36
38
  * should be rendered at the bottom.
37
39
  * @public
38
40
  */
41
+ // eslint-disable-next-line deprecation/deprecation
39
42
  export function SelectableContent(props) {
40
43
  const [selectedContentId, setSelectedContentId] = React.useState(props.defaultSelectedContentId);
41
44
  const onSelectedContentIdChanged = React.useCallback((id) => {
@@ -1 +1 @@
1
- {"version":3,"file":"SelectableContent.js","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAA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AAM,EAAE,CACtB,CACF,CACP,CAAC;AACJ,CAAC;AAaD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC9D,KAAK,CAAC,wBAAwB,CAC/B,CAAC;IACF,MAAM,0BAA0B,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAU,EAAE,EAAE;QAClE,oBAAoB,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CACL,oBAAC,2BAA2B,IAC1B,iBAAiB,EAAE,iBAAiB,EACpC,0BAA0B,EAAE,0BAA0B,EACtD,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAEvB,KAAK,CAAC,QAAQ,CACa,CAC/B,CAAC;AACJ,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 SelectableContent\n */\n\nimport \"./SelectableContent.scss\";\nimport * as React from \"react\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\n\n/**\n * A definition for content displayed in [[ControlledSelectableContent]] and\n * [[SelectableContent]] components.\n * @public\n */\nexport interface SelectableContentDefinition {\n id: string;\n label: string;\n render: () => React.ReactNode;\n}\n\n/**\n * [[ControlledSelectableContent]] component properties\n * @public\n */\nexport interface ControlledSelectableContentProps {\n selectedContentId: string;\n onSelectedContentIdChanged?: (contentId: string) => void;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * A fully-controlled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\nexport function ControlledSelectableContent(\n props: ControlledSelectableContentProps\n) {\n const { onSelectedContentIdChanged, disabled } = props;\n\n const onContentIdSelected = React.useCallback(\n (newValue: string): void => {\n onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);\n },\n [onSelectedContentIdChanged]\n );\n\n const selectedContent =\n props.children.find(\n (contentDef) => contentDef.id === props.selectedContentId\n ) ?? props.children[0];\n const options = React.useMemo(() => {\n return props.children.map((componentDef) => ({\n label: componentDef.label,\n value: componentDef.id,\n })) as SelectOption<string>[];\n }, [props.children]);\n\n return (\n <div className=\"components-selectable-content\">\n <div className=\"components-selectable-content-header\">\n {options.length > 0 && (\n <Select\n onChange={onContentIdSelected}\n size=\"small\"\n className=\"components-selectable-content-selector\"\n aria-label={props.selectAriaLabel}\n value={selectedContent.id}\n options={options}\n disabled={disabled}\n />\n )}\n </div>\n <div className=\"components-selectable-content-wrapper\">\n {selectedContent?.render()}\n </div>\n </div>\n );\n}\n\n/**\n * [[SelectableContent]] component properties\n * @public\n */\nexport interface SelectableContentProps {\n defaultSelectedContentId: string;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * An uncontrolled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\nexport function SelectableContent(props: SelectableContentProps) {\n const [selectedContentId, setSelectedContentId] = React.useState(\n props.defaultSelectedContentId\n );\n const onSelectedContentIdChanged = React.useCallback((id: string) => {\n setSelectedContentId(id);\n }, []);\n return (\n <ControlledSelectableContent\n selectedContentId={selectedContentId}\n onSelectedContentIdChanged={onSelectedContentIdChanged}\n selectAriaLabel={props.selectAriaLabel}\n disabled={props.disabled}\n >\n {props.children}\n </ControlledSelectableContent>\n );\n}\n"]}
1
+ {"version":3,"file":"SelectableContent.js","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAA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O,EAChB,QAAQ,EAAE,QAAQ,GAClB,CACH,CACG;QACN,6BAAK,SAAS,EAAC,uCAAuC,IACnD,eAAe,EAAE,MAAM,EAAE,CACtB,CACF,CACP,CAAC;AACJ,CAAC;AAcD;;;;;GAKG;AACH,mDAAmD;AACnD,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC9D,KAAK,CAAC,wBAAwB,CAC/B,CAAC;IACF,MAAM,0BAA0B,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAU,EAAE,EAAE;QAClE,oBAAoB,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CACL,oBAAC,2BAA2B,IAC1B,iBAAiB,EAAE,iBAAiB,EACpC,0BAA0B,EAAE,0BAA0B,EACtD,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAEvB,KAAK,CAAC,QAAQ,CACa,CAC/B,CAAC;AACJ,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 SelectableContent\n */\n\nimport \"./SelectableContent.scss\";\nimport * as React from \"react\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\n\n/**\n * A definition for content displayed in [[ControlledSelectableContent]] and\n * [[SelectableContent]] components.\n * @public\n */\nexport interface SelectableContentDefinition {\n id: string;\n label: string;\n render: () => React.ReactNode;\n}\n\n/**\n * [[ControlledSelectableContent]] component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ControlledSelectableContent>`\n */\nexport interface ControlledSelectableContentProps {\n selectedContentId: string;\n onSelectedContentIdChanged?: (contentId: string) => void;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * A fully-controlled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\nexport function ControlledSelectableContent(\n /* eslint-disable-next-line deprecation/deprecation */\n props: ControlledSelectableContentProps\n) {\n const { onSelectedContentIdChanged, disabled } = props;\n\n const onContentIdSelected = React.useCallback(\n (newValue: string): void => {\n onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);\n },\n [onSelectedContentIdChanged]\n );\n\n const selectedContent =\n props.children.find(\n (contentDef) => contentDef.id === props.selectedContentId\n ) ?? props.children[0];\n const options = React.useMemo(() => {\n return props.children.map((componentDef) => ({\n label: componentDef.label,\n value: componentDef.id,\n })) as SelectOption<string>[];\n }, [props.children]);\n\n return (\n <div className=\"components-selectable-content\">\n <div className=\"components-selectable-content-header\">\n {options.length > 0 && (\n <Select\n onChange={onContentIdSelected}\n size=\"small\"\n className=\"components-selectable-content-selector\"\n aria-label={props.selectAriaLabel}\n value={selectedContent.id}\n options={options}\n disabled={disabled}\n />\n )}\n </div>\n <div className=\"components-selectable-content-wrapper\">\n {selectedContent?.render()}\n </div>\n </div>\n );\n}\n\n/**\n * [[SelectableContent]] component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof SelectableContent>`\n */\nexport interface SelectableContentProps {\n defaultSelectedContentId: string;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * An uncontrolled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function SelectableContent(props: SelectableContentProps) {\n const [selectedContentId, setSelectedContentId] = React.useState(\n props.defaultSelectedContentId\n );\n const onSelectedContentIdChanged = React.useCallback((id: string) => {\n setSelectedContentId(id);\n }, []);\n return (\n <ControlledSelectableContent\n selectedContentId={selectedContentId}\n onSelectedContentIdChanged={onSelectedContentIdChanged}\n selectAriaLabel={props.selectAriaLabel}\n disabled={props.disabled}\n >\n {props.children}\n </ControlledSelectableContent>\n );\n}\n"]}
@@ -10,6 +10,7 @@ import type { TreeNodeEditorRenderer } from "./TreeNodeEditor";
10
10
  /**
11
11
  * Properties for [[TreeNodeContent]] component
12
12
  * @public
13
+ * @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeContent>`
13
14
  */
14
15
  export interface TreeNodeContentProps extends CommonProps {
15
16
  /** Tree node to render label for. */
@@ -1 +1 @@
1
- {"version":3,"file":"NodeContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG/D;;;GAGG;AAEH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,qCAAqC;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oFAAoF;IACpF,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAC5C,sDAAsD;IACtD,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAuD1D"}
1
+ {"version":3,"file":"NodeContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG/D;;;;GAIG;AAEH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,qCAAqC;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oFAAoF;IACpF,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAC5C,sDAAsD;IACtD,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;CAC7C;AAED;;;GAGG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAuD1D"}
@@ -18,6 +18,7 @@ import { TreeNodeEditor } from "./TreeNodeEditor";
18
18
  * React component for displaying [[TreeNode]] label
19
19
  * @public
20
20
  */
21
+ // eslint-disable-next-line deprecation/deprecation
21
22
  export function TreeNodeContent(props) {
22
23
  const { node, onLabelRendered, highlightProps } = props;
23
24
  const label = React.useMemo(
@@ -1 +1 @@
1
- {"version":3,"file":"NodeContent.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,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AAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;QACjD,eAAe,EAAE,iBAAiB;QAClC,YAAY,EAAE;QACZ,mDAAmD;QACnD,oBAAC,mBAAmB,IAAC,KAAK,EAAE,CAAC,iBAAe,wBAAwB,GAAI,CACzE;KACF,CAAC;IAEF,OAAO,4BAA4B,CAAC,cAAc,CAAC,MAAM,CACvD,IAAI,CAAC,IAAI,CAAC,KAAK,EACf,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CACf,KAAiB,EACjB,UAAoB;IAEpB,OAAO,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;AACvE,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 Tree\n */\n\nimport \"./NodeContent.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { TreeNodePlaceholder } from \"@itwin/core-react\";\nimport type { ItemStyle } from \"../../../properties/ItemStyle\";\nimport { ItemStyleProvider } from \"../../../properties/ItemStyle\";\nimport type { PropertyValueRendererContext } from \"../../../properties/ValueRendererManager\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager\";\nimport { PropertyContainerType } from \"../../../properties/ValueRendererManager\";\nimport type { HighlightableTreeNodeProps } from \"../../HighlightingEngine\";\nimport { HighlightingEngine } from \"../../HighlightingEngine\";\nimport type { TreeModelNode } from \"../TreeModel\";\nimport type { TreeNodeEditorRenderer } from \"./TreeNodeEditor\";\nimport { TreeNodeEditor } from \"./TreeNodeEditor\";\n\n/**\n * Properties for [[TreeNodeContent]] component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface TreeNodeContentProps extends CommonProps {\n /** Tree node to render label for. */\n node: TreeModelNode;\n /** Flag that specified whether the description should be shown or not. */\n showDescription?: boolean;\n /** Props for highlighting label parts that matches filter when tree is filtered. */\n highlightProps?: HighlightableTreeNodeProps;\n /** Callback used to detect when label is rendered. */\n onLabelRendered?: (node: TreeModelNode) => void;\n /** Callback to render custom node editor when node is in editing mode. */\n nodeEditorRenderer?: TreeNodeEditorRenderer;\n}\n\n/**\n * React component for displaying [[TreeNode]] label\n * @public\n */\nexport function TreeNodeContent(props: TreeNodeContentProps) {\n const { node, onLabelRendered, highlightProps } = props;\n const label = React.useMemo(\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n () => getLabel(node, highlightProps),\n [node, highlightProps]\n );\n React.useEffect(() => {\n onLabelRendered && onLabelRendered(node);\n }, [label, node, onLabelRendered]);\n\n // handle cell editing\n let editor: React.ReactNode;\n if (props.node.editingInfo) {\n // if cell editing is enabled, return editor instead of the label\n const style = getStyle(props.node.item.style, props.node.isSelected);\n const editorProps = {\n node: props.node,\n onCancel: props.node.editingInfo.onCancel,\n onCommit: props.node.editingInfo.onCommit,\n style,\n };\n editor = props.nodeEditorRenderer ? (\n props.nodeEditorRenderer(editorProps)\n ) : (\n <TreeNodeEditor {...editorProps} />\n );\n }\n\n const isDescriptionEnabled =\n props.node.item.description && props.showDescription;\n\n const containerClassName = classnames(\n \"components-controlledTree-node-content\",\n isDescriptionEnabled ? \"with-description\" : undefined,\n props.className\n );\n\n const descriptionClassName = classnames(\n \"components-controlledTree-node-description\",\n editor ? \"with-editor\" : undefined\n );\n\n return (\n <div className={containerClassName} style={props.style}>\n <>\n {editor ? editor : label}\n {isDescriptionEnabled ? (\n <div className={descriptionClassName}>\n {props.node.item.description}\n </div>\n ) : undefined}\n </>\n </div>\n );\n}\n\nfunction getLabel(\n node: TreeModelNode,\n highlightProps?: HighlightableTreeNodeProps\n): React.ReactNode | Promise<React.ReactNode> {\n // handle filtered matches' highlighting\n const highlightCallback = highlightProps\n ? (text: string) => HighlightingEngine.renderNodeLabel(text, highlightProps)\n : undefined;\n\n // handle custom cell rendering\n const context: PropertyValueRendererContext = {\n containerType: PropertyContainerType.Tree,\n style: getStyle(node.item.style, node.isSelected),\n textHighlighter: highlightCallback,\n defaultValue: (\n // eslint-disable-next-line deprecation/deprecation\n <TreeNodePlaceholder level={0} data-testid={\"node-label-placeholder\"} />\n ),\n };\n\n return PropertyValueRendererManager.defaultManager.render(\n node.item.label,\n context\n );\n}\n\nfunction getStyle(\n style?: ItemStyle,\n isSelected?: boolean\n): React.CSSProperties {\n return ItemStyleProvider.createStyle(style ? style : {}, isSelected);\n}\n"]}
1
+ {"version":3,"file":"NodeContent.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAqBlD;;;GAGG;AACH,mDAAmD;AACnD,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACxD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO;IACzB,qEAAqE;IACrE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,EACpC,CAAC,IAAI,EAAE,cAA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KAAK,EAAE,KAAK,CAAC,KAAK;QACpD;YACG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK;YACvB,oBAAoB,CAAC,CAAC,CAAC,CACtB,6BAAK,SAAS,EAAE,oBAAoB,IACjC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,CACP,CAAC,CAAC,CAAC,SAAS,CACZ,CACC,CACP,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CACf,IAAmB,EACnB,cAA2C;IAE3C,wCAAwC;IACxC,MAAM,iBAAiB,GAAG,cAAc;QACtC,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,kBAAkB,CAAC,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC;QAC5E,CAAC,CAAC,SAAS,CAAC;IAEd,+BAA+B;IAC/B,MAAM,OAAO,GAAiC;QAC5C,aAAa,EAAE,qBAAqB,CAAC,IAAI;QACzC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;QACjD,eAAe,EAAE,iBAAiB;QAClC,YAAY,EAAE;QACZ,mDAAmD;QACnD,oBAAC,mBAAmB,IAAC,KAAK,EAAE,CAAC,iBAAe,wBAAwB,GAAI,CACzE;KACF,CAAC;IAEF,OAAO,4BAA4B,CAAC,cAAc,CAAC,MAAM,CACvD,IAAI,CAAC,IAAI,CAAC,KAAK,EACf,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CACf,KAAiB,EACjB,UAAoB;IAEpB,OAAO,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;AACvE,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 Tree\n */\n\nimport \"./NodeContent.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { TreeNodePlaceholder } from \"@itwin/core-react\";\nimport type { ItemStyle } from \"../../../properties/ItemStyle\";\nimport { ItemStyleProvider } from \"../../../properties/ItemStyle\";\nimport type { PropertyValueRendererContext } from \"../../../properties/ValueRendererManager\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager\";\nimport { PropertyContainerType } from \"../../../properties/ValueRendererManager\";\nimport type { HighlightableTreeNodeProps } from \"../../HighlightingEngine\";\nimport { HighlightingEngine } from \"../../HighlightingEngine\";\nimport type { TreeModelNode } from \"../TreeModel\";\nimport type { TreeNodeEditorRenderer } from \"./TreeNodeEditor\";\nimport { TreeNodeEditor } from \"./TreeNodeEditor\";\n\n/**\n * Properties for [[TreeNodeContent]] component\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeContent>`\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface TreeNodeContentProps extends CommonProps {\n /** Tree node to render label for. */\n node: TreeModelNode;\n /** Flag that specified whether the description should be shown or not. */\n showDescription?: boolean;\n /** Props for highlighting label parts that matches filter when tree is filtered. */\n highlightProps?: HighlightableTreeNodeProps;\n /** Callback used to detect when label is rendered. */\n onLabelRendered?: (node: TreeModelNode) => void;\n /** Callback to render custom node editor when node is in editing mode. */\n nodeEditorRenderer?: TreeNodeEditorRenderer;\n}\n\n/**\n * React component for displaying [[TreeNode]] label\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function TreeNodeContent(props: TreeNodeContentProps) {\n const { node, onLabelRendered, highlightProps } = props;\n const label = React.useMemo(\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n () => getLabel(node, highlightProps),\n [node, highlightProps]\n );\n React.useEffect(() => {\n onLabelRendered && onLabelRendered(node);\n }, [label, node, onLabelRendered]);\n\n // handle cell editing\n let editor: React.ReactNode;\n if (props.node.editingInfo) {\n // if cell editing is enabled, return editor instead of the label\n const style = getStyle(props.node.item.style, props.node.isSelected);\n const editorProps = {\n node: props.node,\n onCancel: props.node.editingInfo.onCancel,\n onCommit: props.node.editingInfo.onCommit,\n style,\n };\n editor = props.nodeEditorRenderer ? (\n props.nodeEditorRenderer(editorProps)\n ) : (\n <TreeNodeEditor {...editorProps} />\n );\n }\n\n const isDescriptionEnabled =\n props.node.item.description && props.showDescription;\n\n const containerClassName = classnames(\n \"components-controlledTree-node-content\",\n isDescriptionEnabled ? \"with-description\" : undefined,\n props.className\n );\n\n const descriptionClassName = classnames(\n \"components-controlledTree-node-description\",\n editor ? \"with-editor\" : undefined\n );\n\n return (\n <div className={containerClassName} style={props.style}>\n <>\n {editor ? editor : label}\n {isDescriptionEnabled ? (\n <div className={descriptionClassName}>\n {props.node.item.description}\n </div>\n ) : undefined}\n </>\n </div>\n );\n}\n\nfunction getLabel(\n node: TreeModelNode,\n highlightProps?: HighlightableTreeNodeProps\n): React.ReactNode | Promise<React.ReactNode> {\n // handle filtered matches' highlighting\n const highlightCallback = highlightProps\n ? (text: string) => HighlightingEngine.renderNodeLabel(text, highlightProps)\n : undefined;\n\n // handle custom cell rendering\n const context: PropertyValueRendererContext = {\n containerType: PropertyContainerType.Tree,\n style: getStyle(node.item.style, node.isSelected),\n textHighlighter: highlightCallback,\n defaultValue: (\n // eslint-disable-next-line deprecation/deprecation\n <TreeNodePlaceholder level={0} data-testid={\"node-label-placeholder\"} />\n ),\n };\n\n return PropertyValueRendererManager.defaultManager.render(\n node.item.label,\n context\n );\n}\n\nfunction getStyle(\n style?: ItemStyle,\n isSelected?: boolean\n): React.CSSProperties {\n return ItemStyleProvider.createStyle(style ? style : {}, isSelected);\n}\n"]}
@@ -51,6 +51,7 @@ export declare const TreeNodeRenderer: React.NamedExoticComponent<TreeNodeRender
51
51
  /**
52
52
  * Props for [[TreeNodeIcon]] component.
53
53
  * @public
54
+ * @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeIcon>`
54
55
  */
55
56
  export interface TreeNodeIconProps {
56
57
  /** Tree node to render icon for. */
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,KAAK,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,QAAQ,CAAC,CAAC;AAErE,KAAK,qBAAqB,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG;IACzE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF;;;GAGG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,2BAA2B;IAC3B,IAAI,EAAE,aAAa,CAAC;IAEpB,sBAAsB;IACtB,WAAW,EAAE,WAAW,CAAC;IAEzB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;IAEhD,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,mCAAmC;IACnC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAE/B,0CAA0C;IAC1C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC;IAErE,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;IAE5C;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAEhD,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAEnE,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,mDAmE3B,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,IAAI,EAAE,aAAa,CAAC;IACpB,gDAAgD;IAChD,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,4BAQpD"}
1
+ {"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAgB,aAAa,E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;IACpC,IAAI,EAAE,aAAa,CAAC;IACpB,gDAAgD;IAChD,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,4BAQpD"}
@@ -44,6 +44,7 @@ export const TreeNodeRenderer = React.memo(function TreeNodeRenderer(props) {
44
44
  * React component that renders icon for [[TreeNode]].
45
45
  * @public
46
46
  */
47
+ // eslint-disable-next-line deprecation/deprecation
47
48
  export function TreeNodeIcon(props) {
48
49
  const { imageLoader, node } = props;
49
50
  const image = imageLoader.load(node.item);