@itwin/grouping-mapping-widget 0.12.0 → 0.13.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/lib/cjs/widget/components/ConfirmMappingsImport.js +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.js +50 -66
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +0 -18
- package/lib/cjs/widget/components/GroupDetails.d.ts +13 -0
- package/lib/cjs/widget/components/GroupDetails.js +34 -0
- package/lib/cjs/widget/components/GroupDetails.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.d.ts +8 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.js +19 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsStep.d.ts +13 -0
- package/lib/cjs/widget/components/GroupDetailsStep.js +25 -0
- package/lib/cjs/widget/components/GroupDetailsStep.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsStep.scss +11 -0
- package/lib/cjs/widget/components/Grouping.js +1 -2
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMapping.js +1 -1
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingHeader.d.ts +1 -2
- package/lib/cjs/widget/components/GroupingMappingHeader.js +9 -2
- package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.js +2 -3
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.js +1 -1
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/PropertyAction.d.ts +8 -0
- package/lib/cjs/widget/components/PropertyAction.js +100 -0
- package/lib/cjs/widget/components/PropertyAction.js.map +1 -0
- package/lib/cjs/widget/components/PropertyAction.scss +9 -0
- package/lib/cjs/widget/components/QueryBuilder.d.ts +1 -1
- package/lib/cjs/widget/components/QueryBuilder.js +4 -4
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilderActionPanel.d.ts +6 -0
- package/lib/cjs/widget/components/QueryBuilderActionPanel.js +17 -0
- package/lib/cjs/widget/components/QueryBuilderActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.d.ts +11 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js +27 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderStep.d.ts +16 -0
- package/lib/cjs/widget/components/QueryBuilderStep.js +30 -0
- package/lib/cjs/widget/components/QueryBuilderStep.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderStep.scss +18 -0
- package/lib/cjs/widget/components/SelectMappings.js +1 -1
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/StatusIcon.d.ts +15 -0
- package/lib/cjs/widget/components/StatusIcon.js +26 -0
- package/lib/cjs/widget/components/StatusIcon.js.map +1 -0
- package/lib/cjs/widget/components/StatusIcon.scss +26 -0
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js +0 -2
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js +51 -32
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +1 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
- package/lib/cjs/widget/components/utils.d.ts +1 -1
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.js +53 -69
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +0 -18
- package/lib/esm/widget/components/GroupDetails.d.ts +13 -0
- package/lib/esm/widget/components/GroupDetails.js +27 -0
- package/lib/esm/widget/components/GroupDetails.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.d.ts +8 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.js +12 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsStep.d.ts +13 -0
- package/lib/esm/widget/components/GroupDetailsStep.js +18 -0
- package/lib/esm/widget/components/GroupDetailsStep.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsStep.scss +11 -0
- package/lib/esm/widget/components/Grouping.js +1 -2
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMapping.js +1 -1
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingHeader.d.ts +1 -2
- package/lib/esm/widget/components/GroupingMappingHeader.js +9 -2
- package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/esm/widget/components/Mapping.js +2 -3
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.js +1 -1
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/PropertyAction.d.ts +8 -0
- package/lib/esm/widget/components/PropertyAction.js +77 -0
- package/lib/esm/widget/components/PropertyAction.js.map +1 -0
- package/lib/esm/widget/components/PropertyAction.scss +9 -0
- package/lib/esm/widget/components/QueryBuilder.d.ts +1 -1
- package/lib/esm/widget/components/QueryBuilder.js +4 -4
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilderActionPanel.d.ts +6 -0
- package/lib/esm/widget/components/QueryBuilderActionPanel.js +10 -0
- package/lib/esm/widget/components/QueryBuilderActionPanel.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.d.ts +11 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.js +20 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderStep.d.ts +16 -0
- package/lib/esm/widget/components/QueryBuilderStep.js +23 -0
- package/lib/esm/widget/components/QueryBuilderStep.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderStep.scss +18 -0
- package/lib/esm/widget/components/SelectMappings.js +1 -1
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/StatusIcon.d.ts +15 -0
- package/lib/esm/widget/components/StatusIcon.js +19 -0
- package/lib/esm/widget/components/StatusIcon.js.map +1 -0
- package/lib/esm/widget/components/StatusIcon.scss +26 -0
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.js +0 -2
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js +53 -34
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
- package/lib/esm/widget/components/utils.d.ts +1 -1
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -91
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -62
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +0 -67
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +0 -198
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +0 -71
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +0 -77
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +0 -69
- package/lib/cjs/widget/components/property-grid/PropertyList.js +0 -87
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +0 -92
- package/lib/cjs/widget/components/property-grid/PropertyRender.js +0 -109
- package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +0 -22
- package/lib/cjs/widget/components/property-grid/PropertyView.js +0 -232
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +0 -77
- package/lib/cjs/widget/components/property-grid/countMatchesInString.d.ts +0 -8
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js +0 -32
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js +0 -65
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -68
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -39
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +0 -67
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +0 -172
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +0 -71
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +0 -54
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyList.d.ts +0 -69
- package/lib/esm/widget/components/property-grid/PropertyList.js +0 -60
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +0 -92
- package/lib/esm/widget/components/property-grid/PropertyRender.js +0 -86
- package/lib/esm/widget/components/property-grid/PropertyRender.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyView.d.ts +0 -22
- package/lib/esm/widget/components/property-grid/PropertyView.js +0 -209
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyView.scss +0 -77
- package/lib/esm/widget/components/property-grid/countMatchesInString.d.ts +0 -8
- package/lib/esm/widget/components/property-grid/countMatchesInString.js +0 -28
- package/lib/esm/widget/components/property-grid/countMatchesInString.js.map +0 -1
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js +0 -42
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { HighlightedText, PropertyContainerType, PropertyValueRendererManager } from "@itwin/components-react";
|
|
2
|
-
import { CommonPropertyRenderer } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer";
|
|
3
|
-
import { Orientation } from "@itwin/core-react";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import { countMatchesInString } from "./countMatchesInString";
|
|
6
|
-
function createHighlightCallback(highlight, propertyRecord) {
|
|
7
|
-
var _a;
|
|
8
|
-
const activeMatch = highlight.activeHighlight;
|
|
9
|
-
const propertyName = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightedItemIdentifier;
|
|
10
|
-
const matchIndex = (_a = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightIndex) !== null && _a !== void 0 ? _a : 0;
|
|
11
|
-
let labelMatches;
|
|
12
|
-
if (highlight.applyOnLabel) {
|
|
13
|
-
labelMatches = countMatchesInString(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
labelMatches = 0;
|
|
17
|
-
}
|
|
18
|
-
const activeMatchIndex = (propertyRecord.property.name === propertyName) && ((matchIndex - labelMatches) >= 0) ? (matchIndex - labelMatches) : undefined;
|
|
19
|
-
const highlightCallback = (text) => (React.createElement(HighlightedText, { text: text, activeMatchIndex: activeMatchIndex, searchText: highlight.highlightedText }));
|
|
20
|
-
return highlightCallback;
|
|
21
|
-
}
|
|
22
|
-
export function createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager, isExpanded, onExpansionToggled, onHeightChanged, highlight) {
|
|
23
|
-
const highlightCallback = (highlight === null || highlight === void 0 ? void 0 : highlight.applyOnValue) ? (createHighlightCallback(highlight, propertyRecord)) : undefined;
|
|
24
|
-
const rendererContext = {
|
|
25
|
-
orientation,
|
|
26
|
-
containerType: PropertyContainerType.PropertyPane,
|
|
27
|
-
isExpanded,
|
|
28
|
-
onExpansionToggled,
|
|
29
|
-
onHeightChanged,
|
|
30
|
-
textHighlighter: highlightCallback,
|
|
31
|
-
};
|
|
32
|
-
let displayValue;
|
|
33
|
-
if (propertyValueRendererManager)
|
|
34
|
-
displayValue = propertyValueRendererManager.render(propertyRecord, rendererContext);
|
|
35
|
-
else
|
|
36
|
-
displayValue = PropertyValueRendererManager.defaultManager.render(propertyRecord, rendererContext);
|
|
37
|
-
// Align value with label if orientation is vertical
|
|
38
|
-
if (orientation === Orientation.Vertical)
|
|
39
|
-
displayValue = React.createElement("span", { style: { paddingLeft: CommonPropertyRenderer.getLabelOffset(indentation, orientation) } }, displayValue);
|
|
40
|
-
return displayValue;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=createNewDisplayValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createNewDisplayValue.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/createNewDisplayValue.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,MAAM,8FAA8F,CAAC;AACtI,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,SAAS,uBAAuB,CAAC,SAAiE,EAAE,cAA8B;;IAChI,MAAM,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC;IAC9C,MAAM,YAAY,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yBAAyB,CAAC;IAC5D,MAAM,UAAU,GAAG,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,mCAAI,CAAC,CAAC;IACpD,IAAI,YAAoB,CAAC;IAEzB,IAAI,SAAS,CAAC,YAAY,EAAE;QAC1B,YAAY,GAAG,oBAAoB,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;KACpH;SAAM;QACL,YAAY,GAAG,CAAC,CAAC;KAClB;IAED,MAAM,gBAAgB,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzJ,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,oBAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,CAAC,eAAe,GAAI,CAAC,CAAC;IAEzJ,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,WAAwB,EACxB,cAA8B,EAC9B,WAAoB,EACpB,4BAA2D,EAC3D,UAAoB,EACpB,kBAA+B,EAC/B,eAA6C,EAC7C,SAAyF;IAEzF,MAAM,iBAAiB,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,YAAY,EAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrH,MAAM,eAAe,GAAiC;QACpD,WAAW;QACX,aAAa,EAAE,qBAAqB,CAAC,YAAY;QACjD,UAAU;QACV,kBAAkB;QAClB,eAAe;QACf,eAAe,EAAE,iBAAiB;KACnC,CAAC;IAEF,IAAI,YAAyC,CAAC;IAC9C,IAAI,4BAA4B;QAC9B,YAAY,GAAG,4BAA4B,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;;QAEpF,YAAY,GAAG,4BAA4B,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAErG,oDAAoD;IACpD,IAAI,WAAW,KAAK,WAAW,CAAC,QAAQ;QACtC,YAAY,GAAG,8BAAM,KAAK,EAAE,EAAE,WAAW,EAAE,sBAAsB,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,IAAG,YAAY,CAAQ,CAAC;IAEtI,OAAO,YAAY,CAAC;AACtB,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*--------------------------------------------------------------------------------------------*/\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { HighlightingComponentProps, PropertyValueRendererContext } from \"@itwin/components-react\";\nimport { HighlightedText, PropertyContainerType, PropertyValueRendererManager } from \"@itwin/components-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { Orientation } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport { countMatchesInString } from \"./countMatchesInString\";\n\nfunction createHighlightCallback(highlight: HighlightingComponentProps & { applyOnLabel: boolean }, propertyRecord: PropertyRecord) {\n const activeMatch = highlight.activeHighlight;\n const propertyName = activeMatch?.highlightedItemIdentifier;\n const matchIndex = activeMatch?.highlightIndex ?? 0;\n let labelMatches: number;\n\n if (highlight.applyOnLabel) {\n labelMatches = countMatchesInString(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);\n } else {\n labelMatches = 0;\n }\n\n const activeMatchIndex = (propertyRecord.property.name === propertyName) && ((matchIndex - labelMatches) >= 0) ? (matchIndex - labelMatches) : undefined;\n const highlightCallback = (text: string) => (<HighlightedText text={text} activeMatchIndex={activeMatchIndex} searchText={highlight.highlightedText} />);\n\n return highlightCallback;\n}\n\nexport function createNewDisplayValue(\n orientation: Orientation,\n propertyRecord: PropertyRecord,\n indentation?: number,\n propertyValueRendererManager?: PropertyValueRendererManager,\n isExpanded?: boolean,\n onExpansionToggled?: () => void,\n onHeightChanged?: (newHeight: number) => void,\n highlight?: HighlightingComponentProps & { applyOnLabel: boolean, applyOnValue: boolean }\n) {\n const highlightCallback = highlight?.applyOnValue ? (createHighlightCallback(highlight, propertyRecord)) : undefined;\n const rendererContext: PropertyValueRendererContext = {\n orientation,\n containerType: PropertyContainerType.PropertyPane,\n isExpanded,\n onExpansionToggled,\n onHeightChanged,\n textHighlighter: highlightCallback,\n };\n\n let displayValue: React.ReactNode | undefined;\n if (propertyValueRendererManager)\n displayValue = propertyValueRendererManager.render(propertyRecord, rendererContext);\n else\n displayValue = PropertyValueRendererManager.defaultManager.render(propertyRecord, rendererContext);\n\n // Align value with label if orientation is vertical\n if (orientation === Orientation.Vertical)\n displayValue = <span style={{ paddingLeft: CommonPropertyRenderer.getLabelOffset(indentation, orientation) }}>{displayValue}</span>;\n\n return displayValue;\n}\n"]}
|