@itwin/components-react 3.2.0-dev.16 → 3.2.0-dev.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +1 -3
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +2 -2
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +1 -3
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +2 -2
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/package.json +11 -11
package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoublePropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,
|
|
1
|
+
{"version":3,"file":"DoublePropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAE/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG;;GAEG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IAExE,uDAAuD;IAChD,SAAS,CAAC,MAAM,EAAE,cAAc;IAKvC,iEAAiE;IAC1D,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,4BAA4B;CAO7E"}
|
|
@@ -38,7 +38,7 @@ class DoublePropertyValueRenderer {
|
|
|
38
38
|
/** Checks if the renderer can handle given property */
|
|
39
39
|
canRender(record) {
|
|
40
40
|
return record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive
|
|
41
|
-
&& record.property.typename ===
|
|
41
|
+
&& record.property.typename === appui_abstract_1.StandardTypeNames.Double;
|
|
42
42
|
}
|
|
43
43
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
44
44
|
render(record, context) {
|
package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAA+G;AAC/G,mFAAgF;AAEhF,qFAAsF;AAEtF;;GAEG;AACH,MAAa,2BAA2B;IAEtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;eAC5D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,MAAM,CAAC;IAC7D,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,mEAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,GAC5C,CAAC;IACL,CAAC;CACF;AAhBD,kEAgBC;AAED,SAAS,qBAAqB,CAAC,MAAsB;;IACnD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,IAAI,SAAS,CAAC,YAAY;QACxB,OAAO,SAAS,CAAC,YAAY,CAAC;IAChC,OAAO,2CAAoB,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,CAAC,SAAS,0CAAE,IAAI,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAChK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { PrimitiveValue, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/** Default Double Property Renderer\r\n * @public\r\n */\r\nexport class DoublePropertyValueRenderer implements IPropertyValueRenderer {\r\n\r\n /** Checks if the renderer can handle given property */\r\n public canRender(record: PropertyRecord) {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive\r\n && record.property.typename === StandardTypeNames.Double;\r\n }\r\n\r\n /** Method that returns a JSX representation of PropertyRecord */\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\r\n return <PrimitivePropertyValueRendererImpl\r\n record={record}\r\n context={context}\r\n stringValueCalculator={convertRecordToString}\r\n />;\r\n }\r\n}\r\n\r\nfunction convertRecordToString(record: PropertyRecord) {\r\n const primitive = record.value as PrimitiveValue;\r\n if (primitive.displayValue)\r\n return primitive.displayValue;\r\n return TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultilineTextPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAI/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG,gBAAgB;AAChB,qBAAa,kCAAmC,YAAW,sBAAsB;IACxE,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"MultilineTextPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAI/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG,gBAAgB;AAChB,qBAAa,kCAAmC,YAAW,sBAAsB;IACxE,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IAI1C,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,KAAK,CAAC,SAAS;CAG/F;AAwBD,UAAU,qBAAqB;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,gBAAgB;AAChB,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsDjE,CAAC"}
|
package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js
CHANGED
|
@@ -40,9 +40,7 @@ const PrimitivePropertyValueRenderer_1 = require("./PrimitivePropertyValueRender
|
|
|
40
40
|
/** @internal */
|
|
41
41
|
class MultilineTextPropertyValueRenderer {
|
|
42
42
|
canRender(record) {
|
|
43
|
-
|
|
44
|
-
return record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive
|
|
45
|
-
&& ((_a = record.property.renderer) === null || _a === void 0 ? void 0 : _a.name) === "multiline";
|
|
43
|
+
return record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive;
|
|
46
44
|
}
|
|
47
45
|
render(record, context) {
|
|
48
46
|
return React.createElement(MultilineTextPropertyValueRendererImpl, { record: record, context: context });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,gDAAgD;AAChD,iCAAgD;AAChD,sDAA6C;AAC7C,0DAA+G;AAC/G,6DAA0D;AAC1D,mFAAgF;AAChF,wDAAqD;AAErD,qFAA0E;AAE1E,gBAAgB;AAChB,MAAa,kCAAkC;IACtC,SAAS,CAAC,MAAsB
|
|
1
|
+
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,gDAAgD;AAChD,iCAAgD;AAChD,sDAA6C;AAC7C,0DAA+G;AAC/G,6DAA0D;AAC1D,mFAAgF;AAChF,wDAAqD;AAErD,qFAA0E;AAE1E,gBAAgB;AAChB,MAAa,kCAAkC;IACtC,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAAC;IACpE,CAAC;IAEM,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,sCAAsC,IAAC,MAAM,EA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B,IAElC,2BAAY,CAAC,SAAS,CAAC,mBAAmB,CAAC,CACrC,CACJ;QAEL,eAAe,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,UAAU;YACrD,gCAAQ,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,0BAA0B,IAClE,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CACnC,CAEP,CACP,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,qBAAqB,yBAsDhC;AAEF,SAAS,qBAAqB,CAAC,MAAsB;IACnD,OAAO,2CAAoB;SACxB,YAAY,CAAC,kCAAiB,CAAC,IAAI,CAAC;SACpC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAG,MAAM,CAAC,KAAwB,CAAC,KAAK,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/**\r\n * @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { useLayoutEffect, useRef } from \"react\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { PrimitiveValue, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { useRerender } from \"../../../common/UseRerender\";\r\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\r\nimport { UiComponents } from \"../../../UiComponents\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { useRenderedStringValue } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/** @internal */\r\nexport class MultilineTextPropertyValueRenderer implements IPropertyValueRenderer {\r\n public canRender(record: PropertyRecord): boolean {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive;\r\n }\r\n\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext): React.ReactNode {\r\n return <MultilineTextPropertyValueRendererImpl record={record} context={context} />;\r\n }\r\n}\r\n\r\ninterface MultilineTextPropertyValueRendererImplProps {\r\n record: PropertyRecord;\r\n context?: PropertyValueRendererContext;\r\n children?: never;\r\n}\r\n\r\nconst MultilineTextPropertyValueRendererImpl: React.FC<MultilineTextPropertyValueRendererImplProps>\r\n = (props) => {\r\n const { stringValue, element } = useRenderedStringValue(props.record, convertRecordToString, props.context);\r\n return (\r\n <MultilineTextRenderer\r\n style={props.context?.style}\r\n stringValue={stringValue}\r\n isExpanded={props.context?.isExpanded}\r\n onExpansionToggled={props.context?.onExpansionToggled}\r\n onHeightChanged={props.context?.onHeightChanged}\r\n >\r\n {element}\r\n </MultilineTextRenderer>\r\n );\r\n };\r\n\r\ninterface MultilineTextRenderer {\r\n stringValue?: string;\r\n isExpanded?: boolean;\r\n onExpansionToggled?: () => void;\r\n onHeightChanged?: (newHeight: number) => void;\r\n style?: React.CSSProperties;\r\n}\r\n\r\n/** @internal */\r\nexport const MultilineTextRenderer: React.FC<MultilineTextRenderer> = (props) => { // eslint-disable-line @typescript-eslint/no-redeclare\r\n const { rerenderContext, numRerenders, rerender } = useRerender({ contentOverflows: false });\r\n const spanRef = useRef<HTMLSpanElement>(null);\r\n const divRef = useRef<HTMLDivElement>(null);\r\n const previousHeightRef = useRef(0);\r\n useLayoutEffect(() => {\r\n assert(divRef.current !== null && spanRef.current !== null);\r\n\r\n const contentOverflows = spanRef.current.clientWidth < spanRef.current.scrollWidth;\r\n if (numRerenders === 0 && contentOverflows) {\r\n rerender({ contentOverflows });\r\n }\r\n\r\n if (numRerenders === 1 || !contentOverflows) {\r\n const currentHeight = Math.max(divRef.current.offsetHeight, 27);\r\n if (currentHeight !== previousHeightRef.current) {\r\n props.onHeightChanged?.(currentHeight);\r\n previousHeightRef.current = currentHeight;\r\n }\r\n }\r\n });\r\n\r\n const handleExpansionToggleClick = (event: React.MouseEvent) => {\r\n props.onExpansionToggled?.();\r\n event.stopPropagation();\r\n };\r\n\r\n // In order to always trigger onMouseLeave event on PropertyView, collapse button must remain mounted at all times.\r\n // https://github.com/facebook/react/issues/6807\r\n return (\r\n <div ref={divRef} className=\"multiline\">\r\n <span\r\n ref={spanRef}\r\n className={(numRerenders !== 0 && props.isExpanded) ? \"expanded\" : \"\"}\r\n style={props.style}\r\n title={props.isExpanded ? undefined : props.stringValue}\r\n >\r\n {props.children}\r\n <button\r\n className=\"expand-toggle\"\r\n style={{ display: (rerenderContext.contentOverflows && props.isExpanded) ? \"inline-block\" : \"none\" }}\r\n onClick={handleExpansionToggleClick}\r\n >\r\n {UiComponents.translate(\"property.collapse\")}\r\n </button>\r\n </span>\r\n {\r\n rerenderContext.contentOverflows && !props.isExpanded &&\r\n <button className=\"expand-toggle\" onClick={handleExpansionToggleClick}>\r\n {UiComponents.translate(\"property.expand\")}\r\n </button>\r\n }\r\n </div>\r\n );\r\n};\r\n\r\nfunction convertRecordToString(record: PropertyRecord): string | Promise<string> {\r\n return TypeConverterManager\r\n .getConverter(StandardTypeNames.Text)\r\n .convertPropertyToString(record.property, (record.value as PrimitiveValue).value);\r\n}\r\n"]}
|
package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,
|
|
1
|
+
{"version":3,"file":"NavigationPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAE/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG;;GAEG;AACH,qBAAa,+BAAgC,YAAW,sBAAsB;IAE5E,uDAAuD;IAChD,SAAS,CAAC,MAAM,EAAE,cAAc;IAKvC,iEAAiE;IAC1D,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,4BAA4B;CAO7E"}
|
package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js
CHANGED
|
@@ -38,7 +38,7 @@ class NavigationPropertyValueRenderer {
|
|
|
38
38
|
/** Checks if the renderer can handle given property */
|
|
39
39
|
canRender(record) {
|
|
40
40
|
return record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive
|
|
41
|
-
&& record.property.typename ===
|
|
41
|
+
&& record.property.typename === appui_abstract_1.StandardTypeNames.Navigation;
|
|
42
42
|
}
|
|
43
43
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
44
44
|
render(record, context) {
|
package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"NavigationPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAA+G;AAC/G,mFAAgF;AAEhF,qFAAsF;AAEtF;;GAEG;AACH,MAAa,+BAA+B;IAE1C,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;eAC5D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,UAAU,CAAC;IACjE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,mEAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,GAC5C,CAAC;IACL,CAAC;CACF;AAhBD,0EAgBC;AAED,SAAS,qBAAqB,CAAC,MAAsB;;IACnD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,IAAI,SAAS,CAAC,YAAY;QACxB,OAAO,SAAS,CAAC,YAAY,CAAC;IAChC,OAAO,2CAAoB,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,CAAC,SAAS,0CAAE,IAAI,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAChK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { PrimitiveValue, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/** Default Navigation Property Renderer\r\n * @public\r\n */\r\nexport class NavigationPropertyValueRenderer implements IPropertyValueRenderer {\r\n\r\n /** Checks if the renderer can handle given property */\r\n public canRender(record: PropertyRecord) {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive\r\n && record.property.typename === StandardTypeNames.Navigation;\r\n }\r\n\r\n /** Method that returns a JSX representation of PropertyRecord */\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\r\n return <PrimitivePropertyValueRendererImpl\r\n record={record}\r\n context={context}\r\n stringValueCalculator={convertRecordToString}\r\n />;\r\n }\r\n}\r\n\r\nfunction convertRecordToString(record: PropertyRecord) {\r\n const primitive = record.value as PrimitiveValue;\r\n if (primitive.displayValue)\r\n return primitive.displayValue;\r\n return TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);\r\n}\r\n"]}
|
|
@@ -40,7 +40,7 @@ class UrlPropertyValueRenderer {
|
|
|
40
40
|
/** Checks if the renderer can handle given property */
|
|
41
41
|
canRender(record) {
|
|
42
42
|
return record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive
|
|
43
|
-
&&
|
|
43
|
+
&& [appui_abstract_1.StandardTypeNames.URL, appui_abstract_1.StandardTypeNames.String, appui_abstract_1.StandardTypeNames.Text].includes(record.property.typename);
|
|
44
44
|
}
|
|
45
45
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
46
46
|
render(record, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/UrlPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAAiH;AAEjH,qFAAsH;AAEtH;;;;;GAKG;AACH,MAAa,wBAAwB;IAEnC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;eAC5D,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"UrlPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/UrlPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAAiH;AAEjH,qFAAsH;AAEtH;;;;;GAKG;AACH,MAAa,wBAAwB;IAEnC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;eAC5D,CAAC,kCAAiB,CAAC,GAAG,EAAE,kCAAiB,CAAC,MAAM,EAAE,kCAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,QAA6B,CAAC,CAAC;IACzI,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,mEAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,+DAA8B,EACrD,YAAY,EAAE,yBAAyB,GACvC,CAAC;IACL,CAAC;CACF;AAjBD,4DAiBC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtD,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;SAClB;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC/C,IAAI,UAAU;YACZ,UAAU,CAAC,KAAK,EAAE,CAAC;KACtB;AACH,CAAC;AAED,MAAM,yBAAyB,GAAqB;IAClD,OAAO,EAAE,UAAU;CACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { LinkElementsInfo, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { convertPrimitiveRecordToString, PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/**\r\n * URL property value renderer that renders the whole value as a URL without matching it\r\n * against URL regex.\r\n *\r\n * @public\r\n */\r\nexport class UrlPropertyValueRenderer implements IPropertyValueRenderer {\r\n\r\n /** Checks if the renderer can handle given property */\r\n public canRender(record: PropertyRecord) {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive\r\n && [StandardTypeNames.URL, StandardTypeNames.String, StandardTypeNames.Text].includes(record.property.typename as StandardTypeNames);\r\n }\r\n\r\n /** Method that returns a JSX representation of PropertyRecord */\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\r\n return <PrimitivePropertyValueRendererImpl\r\n record={record}\r\n context={context}\r\n stringValueCalculator={convertPrimitiveRecordToString}\r\n linksHandler={URI_PROPERTY_LINK_HANDLER}\r\n />;\r\n }\r\n}\r\n\r\n/**\r\n * Default URI onClick event, sets location.href to the whole URI value without matching it\r\n * against URL regex.\r\n */\r\nfunction urlOnClick(text: string) {\r\n if (text.startsWith(\"mailto:\") || text.startsWith(\"pw:\"))\r\n location.href = text;\r\n else {\r\n const windowOpen = window.open(text, \"_blank\");\r\n if (windowOpen)\r\n windowOpen.focus();\r\n }\r\n}\r\n\r\nconst URI_PROPERTY_LINK_HANDLER: LinkElementsInfo = {\r\n onClick: urlOnClick,\r\n};\r\n"]}
|
package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoublePropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,
|
|
1
|
+
{"version":3,"file":"DoublePropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAE/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG;;GAEG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IAExE,uDAAuD;IAChD,SAAS,CAAC,MAAM,EAAE,cAAc;IAKvC,iEAAiE;IAC1D,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,4BAA4B;CAO7E"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module Properties
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
9
|
+
import { PropertyValueFormat, StandardTypeNames } from "@itwin/appui-abstract";
|
|
10
10
|
import { TypeConverterManager } from "../../../converters/TypeConverterManager";
|
|
11
11
|
import { PrimitivePropertyValueRendererImpl } from "./PrimitivePropertyValueRenderer";
|
|
12
12
|
/** Default Double Property Renderer
|
|
@@ -16,7 +16,7 @@ export class DoublePropertyValueRenderer {
|
|
|
16
16
|
/** Checks if the renderer can handle given property */
|
|
17
17
|
canRender(record) {
|
|
18
18
|
return record.value.valueFormat === PropertyValueFormat.Primitive
|
|
19
|
-
&& record.property.typename ===
|
|
19
|
+
&& record.property.typename === StandardTypeNames.Double;
|
|
20
20
|
}
|
|
21
21
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
22
22
|
render(record, context) {
|
package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkC,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAEhF,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAEtF;;GAEG;AACH,MAAM,OAAO,2BAA2B;IAEtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;eAC5D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,iBAAiB,CAAC,MAAM,CAAC;IAC7D,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,kCAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,GAC5C,CAAC;IACL,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,MAAsB;;IACnD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,IAAI,SAAS,CAAC,YAAY;QACxB,OAAO,SAAS,CAAC,YAAY,CAAC;IAChC,OAAO,oBAAoB,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,CAAC,SAAS,0CAAE,IAAI,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAChK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { PrimitiveValue, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/** Default Double Property Renderer\r\n * @public\r\n */\r\nexport class DoublePropertyValueRenderer implements IPropertyValueRenderer {\r\n\r\n /** Checks if the renderer can handle given property */\r\n public canRender(record: PropertyRecord) {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive\r\n && record.property.typename === StandardTypeNames.Double;\r\n }\r\n\r\n /** Method that returns a JSX representation of PropertyRecord */\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\r\n return <PrimitivePropertyValueRendererImpl\r\n record={record}\r\n context={context}\r\n stringValueCalculator={convertRecordToString}\r\n />;\r\n }\r\n}\r\n\r\nfunction convertRecordToString(record: PropertyRecord) {\r\n const primitive = record.value as PrimitiveValue;\r\n if (primitive.displayValue)\r\n return primitive.displayValue;\r\n return TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultilineTextPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAI/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG,gBAAgB;AAChB,qBAAa,kCAAmC,YAAW,sBAAsB;IACxE,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"MultilineTextPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAI/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG,gBAAgB;AAChB,qBAAa,kCAAmC,YAAW,sBAAsB;IACxE,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IAI1C,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,KAAK,CAAC,SAAS;CAG/F;AAwBD,UAAU,qBAAqB;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,gBAAgB;AAChB,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsDjE,CAAC"}
|
package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js
CHANGED
|
@@ -18,9 +18,7 @@ import { useRenderedStringValue } from "./PrimitivePropertyValueRenderer";
|
|
|
18
18
|
/** @internal */
|
|
19
19
|
export class MultilineTextPropertyValueRenderer {
|
|
20
20
|
canRender(record) {
|
|
21
|
-
|
|
22
|
-
return record.value.valueFormat === PropertyValueFormat.Primitive
|
|
23
|
-
&& ((_a = record.property.renderer) === null || _a === void 0 ? void 0 : _a.name) === "multiline";
|
|
21
|
+
return record.value.valueFormat === PropertyValueFormat.Primitive;
|
|
24
22
|
}
|
|
25
23
|
render(record, context) {
|
|
26
24
|
return React.createElement(MultilineTextPropertyValueRendererImpl, { record: record, context: context });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,gDAAgD;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAkC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,gBAAgB;AAChB,MAAM,OAAO,kCAAkC;IACtC,SAAS,CAAC,MAAsB
|
|
1
|
+
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;;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AC,eAAe,EAAE,CAAC;IAC1B,CAAC,CAAC;IAEF,mHAAmH;IACnH,gDAAgD;IAChD,OAAO,CACL,6BAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAC,WAAW;QACrC,8BACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,CAAC,YAAY,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EACrE,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW;YAEtD,KAAK,CAAC,QAAQ;YACf,gCACE,SAAS,EAAC,eAAe,EACzB,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,eAAe,CAAC,gBAAgB,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,EAAE,EACpG,OAAO,EAAE,0BAA0B,IAElC,YAAY,CAAC,SAAS,CAAC,mBAAmB,CAAC,CACrC,CACJ;QAEL,eAAe,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,UAAU;YACrD,gCAAQ,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,0BAA0B,IAClE,YAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CACnC,CAEP,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,qBAAqB,CAAC,MAAsB;IACnD,OAAO,oBAAoB;SACxB,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC;SACpC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAG,MAAM,CAAC,KAAwB,CAAC,KAAK,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/**\r\n * @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { useLayoutEffect, useRef } from \"react\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { PrimitiveValue, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { useRerender } from \"../../../common/UseRerender\";\r\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\r\nimport { UiComponents } from \"../../../UiComponents\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { useRenderedStringValue } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/** @internal */\r\nexport class MultilineTextPropertyValueRenderer implements IPropertyValueRenderer {\r\n public canRender(record: PropertyRecord): boolean {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive;\r\n }\r\n\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext): React.ReactNode {\r\n return <MultilineTextPropertyValueRendererImpl record={record} context={context} />;\r\n }\r\n}\r\n\r\ninterface MultilineTextPropertyValueRendererImplProps {\r\n record: PropertyRecord;\r\n context?: PropertyValueRendererContext;\r\n children?: never;\r\n}\r\n\r\nconst MultilineTextPropertyValueRendererImpl: React.FC<MultilineTextPropertyValueRendererImplProps>\r\n = (props) => {\r\n const { stringValue, element } = useRenderedStringValue(props.record, convertRecordToString, props.context);\r\n return (\r\n <MultilineTextRenderer\r\n style={props.context?.style}\r\n stringValue={stringValue}\r\n isExpanded={props.context?.isExpanded}\r\n onExpansionToggled={props.context?.onExpansionToggled}\r\n onHeightChanged={props.context?.onHeightChanged}\r\n >\r\n {element}\r\n </MultilineTextRenderer>\r\n );\r\n };\r\n\r\ninterface MultilineTextRenderer {\r\n stringValue?: string;\r\n isExpanded?: boolean;\r\n onExpansionToggled?: () => void;\r\n onHeightChanged?: (newHeight: number) => void;\r\n style?: React.CSSProperties;\r\n}\r\n\r\n/** @internal */\r\nexport const MultilineTextRenderer: React.FC<MultilineTextRenderer> = (props) => { // eslint-disable-line @typescript-eslint/no-redeclare\r\n const { rerenderContext, numRerenders, rerender } = useRerender({ contentOverflows: false });\r\n const spanRef = useRef<HTMLSpanElement>(null);\r\n const divRef = useRef<HTMLDivElement>(null);\r\n const previousHeightRef = useRef(0);\r\n useLayoutEffect(() => {\r\n assert(divRef.current !== null && spanRef.current !== null);\r\n\r\n const contentOverflows = spanRef.current.clientWidth < spanRef.current.scrollWidth;\r\n if (numRerenders === 0 && contentOverflows) {\r\n rerender({ contentOverflows });\r\n }\r\n\r\n if (numRerenders === 1 || !contentOverflows) {\r\n const currentHeight = Math.max(divRef.current.offsetHeight, 27);\r\n if (currentHeight !== previousHeightRef.current) {\r\n props.onHeightChanged?.(currentHeight);\r\n previousHeightRef.current = currentHeight;\r\n }\r\n }\r\n });\r\n\r\n const handleExpansionToggleClick = (event: React.MouseEvent) => {\r\n props.onExpansionToggled?.();\r\n event.stopPropagation();\r\n };\r\n\r\n // In order to always trigger onMouseLeave event on PropertyView, collapse button must remain mounted at all times.\r\n // https://github.com/facebook/react/issues/6807\r\n return (\r\n <div ref={divRef} className=\"multiline\">\r\n <span\r\n ref={spanRef}\r\n className={(numRerenders !== 0 && props.isExpanded) ? \"expanded\" : \"\"}\r\n style={props.style}\r\n title={props.isExpanded ? undefined : props.stringValue}\r\n >\r\n {props.children}\r\n <button\r\n className=\"expand-toggle\"\r\n style={{ display: (rerenderContext.contentOverflows && props.isExpanded) ? \"inline-block\" : \"none\" }}\r\n onClick={handleExpansionToggleClick}\r\n >\r\n {UiComponents.translate(\"property.collapse\")}\r\n </button>\r\n </span>\r\n {\r\n rerenderContext.contentOverflows && !props.isExpanded &&\r\n <button className=\"expand-toggle\" onClick={handleExpansionToggleClick}>\r\n {UiComponents.translate(\"property.expand\")}\r\n </button>\r\n }\r\n </div>\r\n );\r\n};\r\n\r\nfunction convertRecordToString(record: PropertyRecord): string | Promise<string> {\r\n return TypeConverterManager\r\n .getConverter(StandardTypeNames.Text)\r\n .convertPropertyToString(record.property, (record.value as PrimitiveValue).value);\r\n}\r\n"]}
|
package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,
|
|
1
|
+
{"version":3,"file":"NavigationPropertyValueRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAkB,cAAc,EAA0C,MAAM,uBAAuB,CAAC;AAE/G,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAGlG;;GAEG;AACH,qBAAa,+BAAgC,YAAW,sBAAsB;IAE5E,uDAAuD;IAChD,SAAS,CAAC,MAAM,EAAE,cAAc;IAKvC,iEAAiE;IAC1D,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,4BAA4B;CAO7E"}
|
package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module Properties
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
9
|
+
import { PropertyValueFormat, StandardTypeNames } from "@itwin/appui-abstract";
|
|
10
10
|
import { TypeConverterManager } from "../../../converters/TypeConverterManager";
|
|
11
11
|
import { PrimitivePropertyValueRendererImpl } from "./PrimitivePropertyValueRenderer";
|
|
12
12
|
/** Default Navigation Property Renderer
|
|
@@ -16,7 +16,7 @@ export class NavigationPropertyValueRenderer {
|
|
|
16
16
|
/** Checks if the renderer can handle given property */
|
|
17
17
|
canRender(record) {
|
|
18
18
|
return record.value.valueFormat === PropertyValueFormat.Primitive
|
|
19
|
-
&& record.property.typename ===
|
|
19
|
+
&& record.property.typename === StandardTypeNames.Navigation;
|
|
20
20
|
}
|
|
21
21
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
22
22
|
render(record, context) {
|
package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkC,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"NavigationPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAEhF,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAEtF;;GAEG;AACH,MAAM,OAAO,+BAA+B;IAE1C,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;eAC5D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,iBAAiB,CAAC,UAAU,CAAC;IACjE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,kCAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,GAC5C,CAAC;IACL,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,MAAsB;;IACnD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,IAAI,SAAS,CAAC,YAAY;QACxB,OAAO,SAAS,CAAC,YAAY,CAAC;IAChC,OAAO,oBAAoB,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,CAAC,SAAS,0CAAE,IAAI,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAChK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { PrimitiveValue, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/** Default Navigation Property Renderer\r\n * @public\r\n */\r\nexport class NavigationPropertyValueRenderer implements IPropertyValueRenderer {\r\n\r\n /** Checks if the renderer can handle given property */\r\n public canRender(record: PropertyRecord) {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive\r\n && record.property.typename === StandardTypeNames.Navigation;\r\n }\r\n\r\n /** Method that returns a JSX representation of PropertyRecord */\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\r\n return <PrimitivePropertyValueRendererImpl\r\n record={record}\r\n context={context}\r\n stringValueCalculator={convertRecordToString}\r\n />;\r\n }\r\n}\r\n\r\nfunction convertRecordToString(record: PropertyRecord) {\r\n const primitive = record.value as PrimitiveValue;\r\n if (primitive.displayValue)\r\n return primitive.displayValue;\r\n return TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);\r\n}\r\n"]}
|
|
@@ -18,7 +18,7 @@ export class UrlPropertyValueRenderer {
|
|
|
18
18
|
/** Checks if the renderer can handle given property */
|
|
19
19
|
canRender(record) {
|
|
20
20
|
return record.value.valueFormat === PropertyValueFormat.Primitive
|
|
21
|
-
&& record.property.typename
|
|
21
|
+
&& [StandardTypeNames.URL, StandardTypeNames.String, StandardTypeNames.Text].includes(record.property.typename);
|
|
22
22
|
}
|
|
23
23
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
24
24
|
render(record, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/UrlPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAoC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEjH,OAAO,EAAE,8BAA8B,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAEtH;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IAEnC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;eAC5D,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"UrlPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/UrlPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAoC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEjH,OAAO,EAAE,8BAA8B,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAEtH;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IAEnC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;eAC5D,CAAC,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,QAA6B,CAAC,CAAC;IACzI,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,kCAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,8BAA8B,EACrD,YAAY,EAAE,yBAAyB,GACvC,CAAC;IACL,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtD,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;SAClB;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC/C,IAAI,UAAU;YACZ,UAAU,CAAC,KAAK,EAAE,CAAC;KACtB;AACH,CAAC;AAED,MAAM,yBAAyB,GAAqB;IAClD,OAAO,EAAE,UAAU;CACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Properties\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { LinkElementsInfo, PropertyRecord, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\r\nimport { convertPrimitiveRecordToString, PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\r\n\r\n/**\r\n * URL property value renderer that renders the whole value as a URL without matching it\r\n * against URL regex.\r\n *\r\n * @public\r\n */\r\nexport class UrlPropertyValueRenderer implements IPropertyValueRenderer {\r\n\r\n /** Checks if the renderer can handle given property */\r\n public canRender(record: PropertyRecord) {\r\n return record.value.valueFormat === PropertyValueFormat.Primitive\r\n && [StandardTypeNames.URL, StandardTypeNames.String, StandardTypeNames.Text].includes(record.property.typename as StandardTypeNames);\r\n }\r\n\r\n /** Method that returns a JSX representation of PropertyRecord */\r\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\r\n return <PrimitivePropertyValueRendererImpl\r\n record={record}\r\n context={context}\r\n stringValueCalculator={convertPrimitiveRecordToString}\r\n linksHandler={URI_PROPERTY_LINK_HANDLER}\r\n />;\r\n }\r\n}\r\n\r\n/**\r\n * Default URI onClick event, sets location.href to the whole URI value without matching it\r\n * against URL regex.\r\n */\r\nfunction urlOnClick(text: string) {\r\n if (text.startsWith(\"mailto:\") || text.startsWith(\"pw:\"))\r\n location.href = text;\r\n else {\r\n const windowOpen = window.open(text, \"_blank\");\r\n if (windowOpen)\r\n windowOpen.focus();\r\n }\r\n}\r\n\r\nconst URI_PROPERTY_LINK_HANDLER: LinkElementsInfo = {\r\n onClick: urlOnClick,\r\n};\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/components-react",
|
|
3
|
-
"version": "3.2.0-dev.
|
|
3
|
+
"version": "3.2.0-dev.19",
|
|
4
4
|
"description": "iTwin.js UI complex components",
|
|
5
5
|
"main": "lib/cjs/components-react.js",
|
|
6
6
|
"module": "lib/esm/components-react.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"url": "http://www.bentley.com"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@itwin/appui-abstract": "^3.2.0-dev.
|
|
25
|
-
"@itwin/core-bentley": "^3.2.0-dev.
|
|
26
|
-
"@itwin/core-react": "^3.2.0-dev.
|
|
24
|
+
"@itwin/appui-abstract": "^3.2.0-dev.19",
|
|
25
|
+
"@itwin/core-bentley": "^3.2.0-dev.19",
|
|
26
|
+
"@itwin/core-react": "^3.2.0-dev.19",
|
|
27
27
|
"react": "^17.0.0",
|
|
28
28
|
"react-dom": "^17.0.0"
|
|
29
29
|
},
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@itwin/appui-abstract": "3.2.0-dev.
|
|
36
|
-
"@itwin/build-tools": "3.2.0-dev.
|
|
37
|
-
"@itwin/core-bentley": "3.2.0-dev.
|
|
38
|
-
"@itwin/core-common": "3.2.0-dev.
|
|
39
|
-
"@itwin/core-i18n": "3.2.0-dev.
|
|
40
|
-
"@itwin/core-react": "3.2.0-dev.
|
|
41
|
-
"@itwin/eslint-plugin": "3.2.0-dev.
|
|
35
|
+
"@itwin/appui-abstract": "3.2.0-dev.19",
|
|
36
|
+
"@itwin/build-tools": "3.2.0-dev.19",
|
|
37
|
+
"@itwin/core-bentley": "3.2.0-dev.19",
|
|
38
|
+
"@itwin/core-common": "3.2.0-dev.19",
|
|
39
|
+
"@itwin/core-i18n": "3.2.0-dev.19",
|
|
40
|
+
"@itwin/core-react": "3.2.0-dev.19",
|
|
41
|
+
"@itwin/eslint-plugin": "3.2.0-dev.19",
|
|
42
42
|
"@testing-library/react": "^12.0.0",
|
|
43
43
|
"@testing-library/react-hooks": "^7.0.2",
|
|
44
44
|
"@testing-library/user-event": "^13.2.1",
|