@itwin/components-react 4.16.4 → 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.
- package/CHANGELOG.md +14 -1
- package/lib/cjs/components-react/common/HighlightedText.d.ts +1 -0
- package/lib/cjs/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/cjs/components-react/common/HighlightedText.js +1 -0
- package/lib/cjs/components-react/common/HighlightedText.js.map +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.d.ts +1 -0
- package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.js +1 -0
- package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.d.ts +1 -0
- package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js +1 -0
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts +1 -0
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js +1 -0
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +2 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +2 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +4 -4
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +37 -34
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +50 -27
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts +1 -0
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.js +1 -0
- package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts +1 -0
- package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.js +1 -0
- package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js +47 -60
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +30 -2
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts +2 -0
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js +4 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.js +1 -0
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.d.ts +1 -0
- package/lib/esm/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.js +1 -0
- package/lib/esm/components-react/common/HighlightedText.js.map +1 -1
- package/lib/esm/components-react/editors/EditorContainer.d.ts +1 -0
- package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/esm/components-react/editors/EditorContainer.js +1 -0
- package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.d.ts +1 -0
- package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js +1 -0
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts +1 -0
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.js +1 -0
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +2 -2
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +2 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +4 -4
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +36 -32
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +48 -26
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.d.ts +1 -0
- package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.js +1 -0
- package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts +1 -0
- package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.js +1 -0
- package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js +47 -60
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +7 -2
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts +2 -0
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js +4 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.js +1 -0
- package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParsedInput.js","sourceRoot":"","sources":["../../../../src/components-react/inputs/ParsedInput.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,6CAAkC;AAClC,wDAA6C;AAG7C,8BAA4B;
|
|
1
|
+
{"version":3,"file":"ParsedInput.js","sourceRoot":"","sources":["../../../../src/components-react/inputs/ParsedInput.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,6CAAkC;AAClC,wDAA6C;AAG7C,8BAA4B;AAsB5B,MAAM,qBAAqB,GAAG,KAAK,CAAC,UAAU,CAI5C,SAAS,qBAAqB,CAC9B,EACE,YAAY,EACZ,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EACD,GAAG;IAEH,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,qBAAqB,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;IACtE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CACx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C,OAAO,CAAC,CAAC,CAAC;YACxD,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,CAAC;IACH,CAAC,EACD,CAAC,WAAW,EAAE,qBAAqB,CAAC,CACrC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,oBAAU,EAC3B,SAAS,EACT,yBAAyB,EACzB,WAAW,IAAI,mCAAmC,CACnD,CAAC;IAEF,OAAO,CACL,oBAAC,qBAAK,mBACQ,yBAAyB,EACrC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,mDAAmD;AACtC,QAAA,WAAW,GACtB,qBAAqB,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 Inputs\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { ParseResults } from \"@itwin/appui-abstract\";\nimport \"./ParsedInput.scss\";\n\n/** Props for [[ParsedInput]] control\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ParsedInput>`\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface ParsedInputProps extends CommonProps {\n /** InitialValue which is used to restore input field if ESC is pressed */\n initialValue: number;\n /** Function used to format the value */\n formatValue: (value: number) => string;\n /** Function used to parse user input into a value */\n parseString: (stringValue: string) => ParseResults;\n /** Function to call when value is changed */\n onChange?: (newValue: number) => void;\n /** if readonly then only the formatValue function is used. */\n readonly?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\nconst ForwardRefParsedInput = React.forwardRef<\n HTMLInputElement,\n /* eslint-disable-next-line deprecation/deprecation */\n ParsedInputProps\n>(function ForwardRefParsedInput(\n {\n initialValue,\n formatValue,\n parseString,\n readonly,\n className,\n style,\n onChange,\n },\n ref\n) {\n const currentValueRef = React.useRef(initialValue);\n const isMountedRef = React.useRef(false);\n const lastFormattedValueRef = React.useRef(formatValue(initialValue));\n const [formattedValue, setFormattedValue] = React.useState(\n () => lastFormattedValueRef.current\n );\n const [hasBadInput, setHasBadInput] = React.useState(false);\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = initialValue;\n const currentFormattedValue = formatValue(currentValueRef.current);\n if (currentFormattedValue !== lastFormattedValueRef.current) {\n lastFormattedValueRef.current = currentFormattedValue;\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }, [formatValue, initialValue]);\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setFormattedValue(event.currentTarget.value);\n },\n []\n );\n\n const updateValueFromString = React.useCallback(\n (strVal: string) => {\n if (lastFormattedValueRef.current === strVal) return;\n\n const parseResults = parseString(strVal);\n if (!parseResults.parseError) {\n if (\n undefined !== parseResults.value &&\n typeof parseResults.value === \"number\"\n ) {\n const currentValue = parseResults.value;\n if (currentValue !== currentValueRef.current) {\n currentValueRef.current = currentValue;\n onChange && onChange(currentValueRef.current);\n }\n if (isMountedRef.current) {\n lastFormattedValueRef.current = formatValue(currentValue);\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }\n } else {\n setHasBadInput(true);\n }\n },\n [formatValue, onChange, parseString]\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n updateValueFromString(event.target.value);\n },\n [updateValueFromString]\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === Key.Enter.valueOf()) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n }\n if (event.key === Key.Escape.valueOf()) {\n setFormattedValue(formatValue(currentValueRef.current));\n setHasBadInput(false);\n event.preventDefault();\n }\n },\n [formatValue, updateValueFromString]\n );\n\n const classNames = classnames(\n className,\n \"components-parsed-input\",\n hasBadInput && \"components-parsed-input-has-error\"\n );\n\n return (\n <Input\n data-testid=\"components-parsed-input\"\n ref={ref}\n style={style}\n className={classNames}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n onChange={handleChange}\n value={formattedValue}\n disabled={readonly}\n size=\"small\"\n />\n );\n});\n\n/** Generic Input component that requires formatting and parsing functions to be passed in as props.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const ParsedInput: (props: ParsedInputProps) => React.ReactNode =\n ForwardRefParsedInput;\n"]}
|
|
@@ -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
|
|
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"}
|
|
@@ -104,6 +104,7 @@ exports.withLinks = withLinks;
|
|
|
104
104
|
* React component for rendering string with links.
|
|
105
105
|
* @public
|
|
106
106
|
*/
|
|
107
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
107
108
|
function LinksRenderer(props) {
|
|
108
109
|
return React.createElement(React.Fragment, null, (0, exports.withLinks)(props.value, props.links, props.highlighter));
|
|
109
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/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AAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB;AAEF;;;GAGG;AACI,MAAM,SAAS,GAAG,CACvB,WAAmB,EACnB,KAAwB,EACxB,SAA6C,EAC5B,EAAE;IACnB,IAAI,KAAK;QAAE,OAAO,IAAA,mBAAW,EAAC,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;AARW,QAAA,SAAS,aAQpB;
|
|
1
|
+
{"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,sDAAkE;AAElE,kDAAqD;AAErD,iCAAiC;AACjC,SAAS,SAAS,CAChB,IAAY,EACZ,KAAuB,EACvB,SAA6C;IAE7C,OAAO;IACL,mDAAmD;IACnD,oBAAC,6BAAgB,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;I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CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAEnE,8DAA8D;IAC9D,OAAO,KAAK,CAAC,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;AACI,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;AANW,QAAA,WAAW,eAMtB;AAEF;;;GAGG;AACI,MAAM,SAAS,GAAG,CACvB,WAAmB,EACnB,KAAwB,EACxB,SAA6C,EAC5B,EAAE;IACnB,IAAI,KAAK;QAAE,OAAO,IAAA,mBAAW,EAAC,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;AARW,QAAA,SAAS,aAQpB;AAaF;;;GAGG;AACH,mDAAmD;AACnD,SAAgB,aAAa,CAAC,KAAyB;IACrD,OAAO,0CAAG,IAAA,iBAAS,EAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAI,CAAC;AACvE,CAAC;AAFD,sCAEC","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
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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;
|
|
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,MAA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;IACrC,oCAAoC;IACpC,yBAAyB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,oDAAoD;IACpD,UAAU,CAAC,EAAE,sBAAsB,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"}
|
|
@@ -34,75 +34,62 @@ exports.PropertyRenderer = void 0;
|
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
35
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
36
36
|
const EditorContainer_1 = require("../../editors/EditorContainer");
|
|
37
|
-
const UiComponents_1 = require("../../UiComponents");
|
|
38
37
|
const CommonPropertyRenderer_1 = require("./CommonPropertyRenderer");
|
|
39
38
|
const NonPrimitivePropertyRenderer_1 = require("./NonPrimitivePropertyRenderer");
|
|
40
39
|
const PrimitivePropertyRenderer_1 = require("./PrimitivePropertyRenderer");
|
|
40
|
+
const useTranslation_1 = require("../../l10n/useTranslation");
|
|
41
41
|
/** A React component that renders properties
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
static getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth) {
|
|
60
|
-
return CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);
|
|
61
|
-
}
|
|
62
|
-
updateDisplayValue(props) {
|
|
63
|
-
if (props.isEditing) {
|
|
64
|
-
this.updateDisplayValueAsEditor(props);
|
|
44
|
+
const PropertyRenderer = (props) => {
|
|
45
|
+
const { translate } = (0, useTranslation_1.useTranslation)();
|
|
46
|
+
const [displayValue, setDisplayValue] = React.useState(() => translate("general.loading"));
|
|
47
|
+
const { isEditing, orientation, propertyRecord, indentation, propertyValueRendererManager, onEditCommit, onEditCancel, ...restProps } = props;
|
|
48
|
+
const onCommit = React.useCallback((args) => {
|
|
49
|
+
if (onEditCommit)
|
|
50
|
+
onEditCommit(args);
|
|
51
|
+
}, [onEditCommit]);
|
|
52
|
+
const onCancel = React.useCallback(() => {
|
|
53
|
+
if (onEditCancel)
|
|
54
|
+
onEditCancel();
|
|
55
|
+
}, [onEditCancel]);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (isEditing) {
|
|
58
|
+
setDisplayValue(React.createElement(EditorContainer_1.EditorContainer, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, setFocus: true }));
|
|
65
59
|
return;
|
|
66
60
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
};
|
|
92
|
-
switch (this.props.propertyRecord.value.valueFormat) {
|
|
93
|
-
case appui_abstract_1.PropertyValueFormat.Primitive:
|
|
61
|
+
setDisplayValue(CommonPropertyRenderer_1.CommonPropertyRenderer.createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager));
|
|
62
|
+
}, [
|
|
63
|
+
orientation,
|
|
64
|
+
propertyRecord,
|
|
65
|
+
indentation,
|
|
66
|
+
propertyValueRendererManager,
|
|
67
|
+
onCommit,
|
|
68
|
+
onCancel,
|
|
69
|
+
isEditing,
|
|
70
|
+
]);
|
|
71
|
+
const primitiveRendererProps = {
|
|
72
|
+
...restProps,
|
|
73
|
+
propertyRecord,
|
|
74
|
+
orientation,
|
|
75
|
+
indentation,
|
|
76
|
+
valueElement: displayValue,
|
|
77
|
+
};
|
|
78
|
+
switch (props.propertyRecord.value.valueFormat) {
|
|
79
|
+
case appui_abstract_1.PropertyValueFormat.Primitive:
|
|
80
|
+
return React.createElement(PrimitivePropertyRenderer_1.PrimitivePropertyRenderer, { ...primitiveRendererProps });
|
|
81
|
+
case appui_abstract_1.PropertyValueFormat.Array:
|
|
82
|
+
// If array is empty, render it as a primitive property
|
|
83
|
+
if (props.propertyRecord.value.valueFormat === appui_abstract_1.PropertyValueFormat.Array &&
|
|
84
|
+
props.propertyRecord.value.items.length === 0)
|
|
94
85
|
return React.createElement(PrimitivePropertyRenderer_1.PrimitivePropertyRenderer, { ...primitiveRendererProps });
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
appui_abstract_1.PropertyValueFormat.Array &&
|
|
99
|
-
this.props.propertyRecord.value.items.length === 0)
|
|
100
|
-
return React.createElement(PrimitivePropertyRenderer_1.PrimitivePropertyRenderer, { ...primitiveRendererProps });
|
|
101
|
-
// eslint-disable-next-line no-fallthrough
|
|
102
|
-
case appui_abstract_1.PropertyValueFormat.Struct:
|
|
103
|
-
return (React.createElement(NonPrimitivePropertyRenderer_1.NonPrimitivePropertyRenderer, { isCollapsible: true, ...primitiveRendererProps }));
|
|
104
|
-
}
|
|
86
|
+
// eslint-disable-next-line no-fallthrough
|
|
87
|
+
case appui_abstract_1.PropertyValueFormat.Struct:
|
|
88
|
+
return (React.createElement(NonPrimitivePropertyRenderer_1.NonPrimitivePropertyRenderer, { isCollapsible: true, ...primitiveRendererProps }));
|
|
105
89
|
}
|
|
106
|
-
}
|
|
90
|
+
};
|
|
107
91
|
exports.PropertyRenderer = PropertyRenderer;
|
|
92
|
+
exports.PropertyRenderer.getLabelOffset = (indentation, orientation, width, columnRatio, minColumnLabelWidth) => {
|
|
93
|
+
return CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);
|
|
94
|
+
};
|
|
108
95
|
//# 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;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4D;AAG5D,mEAAgE;AAChE,qDAAkD;AAGlD,qEAAkE;AAClE,iFAA8E;AAE9E,2EAAwE;AA0ExE;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK,CAAC,SAG3C;IAKC,YAAY,KAA4B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QALU,UAAK,GAAoC;YAChE,YAAY,EAAE,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC;SACxD,CAAC;QAqCM,kBAAa,GAAG,CAAC,IAAyB,EAAE,EAAE;YACpD,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY;gBAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC,CAAC;QAEM,kBAAa,GAAG,GAAG,EAAE;YAC3B,I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C,SAAS,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW;YAEhD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAEe,MAAM;QACpB,MAAM,EACJ,4BAA4B,EAC5B,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,GAAG,KAAK,EACT,GAAG,IAAI,CAAC,KAAK,CAAC;QACf,MAAM,sBAAsB,GAA2B;YACrD,GAAG,KAAK;YACR,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;SACpC,CAAC;QAEF,QAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACpD,KAAK,oCAAmB,CAAC,SAAS;gBAChC,OAAO,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAAC;YACnE,KAAK,oCAAmB,CAAC,KAAK;gBAC5B,uDAAuD;gBACvD,IACE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW;oBACzC,oCAAmB,CAAC,KAAK;oBAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBAElD,OAAO,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAAC;YACrE,0CAA0C;YAC1C,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,2DAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;QACN,CAAC;IACH,CAAC;CACF;AAjHD,4CAiHC","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,6CAA+B;AAE/B,0DAA4D;AAG5D,mEAAgE;AAGhE,qEAAkE;AAClE,iFAA8E;AAE9E,2EAAwE;AAGxE,8DAA2D;AAgE3D;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC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AY,EAAE,YAAY;KAC3B,CAAC;IAEF,QAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC/C,KAAK,oCAAmB,CAAC,SAAS;YAChC,OAAO,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAAC;QACnE,KAAK,oCAAmB,CAAC,KAAK;YAC5B,uDAAuD;YACvD,IACE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,KAAK;gBACpE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;gBAE7C,OAAO,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAAC;QACrE,0CAA0C;QAC1C,KAAK,oCAAmB,CAAC,MAAM;YAC7B,OAAO,CACL,oBAAC,2DAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;IACN,CAAC;AACH,CAAC,CAAC;AAtFW,QAAA,gBAAgB,oBAsF3B;AAEF,wBAAgB,CAAC,cAAc,GAAG,CAChC,WAAoB,EACpB,WAAyB,EACzB,KAAc,EACd,WAAoB,EACpB,mBAA4B,EAC5B,EAAE;IACF,OAAO,+CAAsB,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"]}
|
package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts
CHANGED
|
@@ -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<
|
|
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
|
package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
|
@@ -6,11 +6,35 @@
|
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module Properties
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
9
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
33
|
exports.MergedPropertyValueRenderer = void 0;
|
|
34
|
+
const React = __importStar(require("react"));
|
|
11
35
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
12
|
-
const UiComponents_1 = require("../../../UiComponents");
|
|
13
36
|
const WithContextStyle_1 = require("./WithContextStyle");
|
|
37
|
+
const useTranslation_1 = require("../../../l10n/useTranslation");
|
|
14
38
|
/** Default Merged Property Renderer
|
|
15
39
|
* @public
|
|
16
40
|
*/
|
|
@@ -22,8 +46,12 @@ class MergedPropertyValueRenderer {
|
|
|
22
46
|
}
|
|
23
47
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
24
48
|
render(_record, context) {
|
|
25
|
-
return (0, WithContextStyle_1.withContextStyle)(
|
|
49
|
+
return (0, WithContextStyle_1.withContextStyle)(React.createElement(VariesRenderer, null), context);
|
|
26
50
|
}
|
|
27
51
|
}
|
|
28
52
|
exports.MergedPropertyValueRenderer = MergedPropertyValueRenderer;
|
|
53
|
+
function VariesRenderer() {
|
|
54
|
+
const { translate } = (0, useTranslation_1.useTranslation)();
|
|
55
|
+
return React.createElement(React.Fragment, null, translate("property.varies"));
|
|
56
|
+
}
|
|
29
57
|
//# sourceMappingURL=MergedPropertyValueRenderer.js.map
|
package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MergedPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG
|
|
1
|
+
{"version":3,"file":"MergedPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4D;AAK5D,yDAAsD;AACtD,iEAA8D;AAE9D;;GAEG;AACH,MAAa,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,CAAC,CAAC,MAAM,CAAC,QAAQ;YACjB,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAC3D,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,OAAuB,EACvB,OAAsC;QAEtC,OAAO,IAAA,mCAAgB,EAAC,oBAAC,cAAc,OAAG,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AAhBD,kEAgBC;AAED,SAAS,cAAc;IACrB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+BAAc,GAAE,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"]}
|
package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts
CHANGED
|
@@ -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
|
|
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"}
|
package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js
CHANGED
|
@@ -40,7 +40,9 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
40
40
|
* sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
function VirtualizedPropertyGridWithDataProvider(
|
|
43
|
+
function VirtualizedPropertyGridWithDataProvider(
|
|
44
|
+
/* eslint-disable-next-line deprecation/deprecation */
|
|
45
|
+
props) {
|
|
44
46
|
const { modelSource, inProgress } = (0, PropertyGridHooks_1.useTrackedPropertyGridModelSource)({
|
|
45
47
|
dataProvider: props.dataProvider,
|
|
46
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhG;;GAEG;AAEH,+CAAmD;AACnD,qEAIuC;AAOvC,uEAAoE;AACpE,wDAAsD;
|
|
1
|
+
{"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhG;;GAEG;AAEH,+CAAmD;AACnD,qEAIuC;AAOvC,uEAAoE;AACpE,wDAAsD;AAoBtD;;;;GAIG;AACH,SAAgB,uCAAuC;AACrD,sDAAsD;AACtD,KAAmD;IAEnD,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAA,qDAAiC,EAAC;QACpE,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,IAAA,wCAAoB,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,IAAA,+CAA2B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAElE,OAAO,CACL,8BAAC,qBAAqB,IAAC,kBAAkB,EAAE,UAAU,IAAI,CAAC,KAAK,IAC5D,KAAK,IAAI,CACR,8BAAC,iDAAuB,OAClB,KAAK,EACT,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,GAC1B,CACH,CACqB,CACzB,CAAC;AACJ,CAAC;AAtBD,0FAsBC;AAMD,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,kBAAkB,GACkC;IACpD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,kBAAkB,CAAC,CAAC;IACnE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,cAAc,CAAC,kBAAkB,CAAC,CAAC;YACnC,OAAO;QACT,CAAC;QAED,8DAA8D;QAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,cAAc,CAAC,kBAAkB,CAAC,CAAC;QACrC,CAAC,EAAE,GAAG,CAAC,CAAC;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,8DAAG,QAAQ,CAAI,CAChB,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAC,6CAA6C;QAC1D,8BAAC,8BAAc,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
|
|
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"}
|
|
@@ -40,7 +40,9 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
40
40
|
* should be rendered at the bottom.
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
function ControlledSelectableContent(
|
|
43
|
+
function ControlledSelectableContent(
|
|
44
|
+
/* eslint-disable-next-line deprecation/deprecation */
|
|
45
|
+
props) {
|
|
44
46
|
const { onSelectedContentIdChanged, disabled } = props;
|
|
45
47
|
const onContentIdSelected = React.useCallback((newValue) => {
|
|
46
48
|
onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);
|
|
@@ -63,6 +65,7 @@ exports.ControlledSelectableContent = ControlledSelectableContent;
|
|
|
63
65
|
* should be rendered at the bottom.
|
|
64
66
|
* @public
|
|
65
67
|
*/
|
|
68
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
66
69
|
function SelectableContent(props) {
|
|
67
70
|
const [selectedContentId, setSelectedContentId] = React.useState(props.defaultSelectedContentId);
|
|
68
71
|
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,oCAAkC;AAClC,6CAA+B;AAE/B,wDAA8C;
|
|
1
|
+
{"version":3,"file":"SelectableContent.js","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oCAAkC;AAClC,6CAA+B;AAE/B,wDAA8C;AA0B9C;;;;;GAKG;AACH,SAAgB,2BAA2B;AACzC,sDAAsD;AACtD,KAAuC;IAEvC,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEvD,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAC3C,CAAC,QAAgB,EAAQ,EAAE;QACzB,0BAA0B,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC,EACD,CAAC,0BAA0B,CAAC,CAC7B,CAAC;IAEF,MAAM,eAAe,GACnB,KAAK,CAAC,QAAQ,CAAC,IAAI,CACjB,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,KAAK,CAAC,iBAAiB,CAC1D,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YAC3C,KAAK,EAAE,YAAY,CAAC,KAAK;YACzB,KAAK,EAAE,YAAY,CAAC,EAAE;SACvB,CAAC,CAA2B,CAAC;IAChC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,+BAA+B;QAC5C,6BAAK,SAAS,EAAC,sCAAsC,IAClD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,oBAAC,sBAAM,IACL,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,wCAAwC,gBACtC,KAAK,CAAC,eAAe,EACjC,KAAK,EAAE,eAAe,CAAC,EAAE,EACzB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,GAClB,CACH,CACG;QACN,6BAAK,SAAS,EAAC,uCAAuC,IACnD,eAAe,EAAE,MAAM,EAAE,CACtB,CACF,CACP,CAAC;AACJ,CAAC;AA5CD,kEA4CC;AAcD;;;;;GAKG;AACH,mDAAmD;AACnD,SAAgB,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;AAjBD,8CAiBC","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
|
|
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"}
|
|
@@ -47,6 +47,7 @@ const TreeNodeEditor_1 = require("./TreeNodeEditor");
|
|
|
47
47
|
* React component for displaying [[TreeNode]] label
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
50
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
50
51
|
function TreeNodeContent(props) {
|
|
51
52
|
const { node, onLabelRendered, highlightProps } = props;
|
|
52
53
|
const label = React.useMemo(
|