@itwin/grouping-mapping-widget 0.2.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/LICENSE.md +9 -0
- package/README.md +26 -0
- package/lib/cjs/api/GroupQueryBuilderApi.d.ts +15 -0
- package/lib/cjs/api/GroupQueryBuilderApi.js +27 -0
- package/lib/cjs/api/GroupQueryBuilderApi.js.map +1 -0
- package/lib/cjs/api/generated/api.d.ts +3222 -0
- package/lib/cjs/api/generated/api.js +5291 -0
- package/lib/cjs/api/generated/api.js.map +1 -0
- package/lib/cjs/api/generated/configuration.d.ts +56 -0
- package/lib/cjs/api/generated/configuration.js +30 -0
- package/lib/cjs/api/generated/configuration.js.map +1 -0
- package/lib/cjs/api/generated/index.d.ts +14 -0
- package/lib/cjs/api/generated/index.js +31 -0
- package/lib/cjs/api/generated/index.js.map +1 -0
- package/lib/cjs/api/reportingClient.d.ts +34 -0
- package/lib/cjs/api/reportingClient.js +177 -0
- package/lib/cjs/api/reportingClient.js.map +1 -0
- package/lib/cjs/decorators/BboxDimensionsDecorator.d.ts +82 -0
- package/lib/cjs/decorators/BboxDimensionsDecorator.js +418 -0
- package/lib/cjs/decorators/BboxDimensionsDecorator.js.map +1 -0
- package/lib/cjs/grouping-mapping-widget.d.ts +7 -0
- package/lib/cjs/grouping-mapping-widget.js +27 -0
- package/lib/cjs/grouping-mapping-widget.js.map +1 -0
- package/lib/cjs/widget/GroupingMappingWidget.d.ts +7 -0
- package/lib/cjs/widget/GroupingMappingWidget.js +51 -0
- package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -0
- package/lib/cjs/widget/components/ActionPanel.d.ts +11 -0
- package/lib/cjs/widget/components/ActionPanel.js +37 -0
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/ActionPanel.scss +12 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +14 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +160 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.scss +27 -0
- package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +18 -0
- package/lib/cjs/widget/components/CalculatedPropertyTable.js +109 -0
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.d.ts +16 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +112 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.scss +84 -0
- package/lib/cjs/widget/components/CustomCalculationAction.d.ts +14 -0
- package/lib/cjs/widget/components/CustomCalculationAction.js +103 -0
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -0
- package/lib/cjs/widget/components/CustomCalculationAction.scss +16 -0
- package/lib/cjs/widget/components/CustomCalculationTable.d.ts +18 -0
- package/lib/cjs/widget/components/CustomCalculationTable.js +114 -0
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -0
- package/lib/cjs/widget/components/DeleteModal.d.ts +12 -0
- package/lib/cjs/widget/components/DeleteModal.js +64 -0
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -0
- package/lib/cjs/widget/components/DeleteModal.scss +12 -0
- package/lib/cjs/widget/components/GroupAction.d.ts +12 -0
- package/lib/cjs/widget/components/GroupAction.js +166 -0
- package/lib/cjs/widget/components/GroupAction.js.map +1 -0
- package/lib/cjs/widget/components/GroupAction.scss +19 -0
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +17 -0
- package/lib/cjs/widget/components/GroupPropertyAction.js +372 -0
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -0
- package/lib/cjs/widget/components/GroupPropertyAction.scss +36 -0
- package/lib/cjs/widget/components/GroupPropertyTable.d.ts +18 -0
- package/lib/cjs/widget/components/GroupPropertyTable.js +109 -0
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -0
- package/lib/cjs/widget/components/GroupQueryBuilder.scss +24 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +4 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +66 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContext.d.ts +13 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContext.js +37 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +1 -0
- package/lib/cjs/widget/components/Grouping.d.ts +12 -0
- package/lib/cjs/widget/components/Grouping.js +214 -0
- package/lib/cjs/widget/components/Grouping.js.map +1 -0
- package/lib/cjs/widget/components/Grouping.scss +15 -0
- package/lib/cjs/widget/components/GroupingMapping.d.ts +5 -0
- package/lib/cjs/widget/components/GroupingMapping.js +34 -0
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -0
- package/lib/cjs/widget/components/GroupingMapping.scss +24 -0
- package/lib/cjs/widget/components/Mapping.d.ts +7 -0
- package/lib/cjs/widget/components/Mapping.js +162 -0
- package/lib/cjs/widget/components/Mapping.js.map +1 -0
- package/lib/cjs/widget/components/Mapping.scss +26 -0
- package/lib/cjs/widget/components/MappingAction.d.ts +11 -0
- package/lib/cjs/widget/components/MappingAction.js +98 -0
- package/lib/cjs/widget/components/MappingAction.js.map +1 -0
- package/lib/cjs/widget/components/MappingAction.scss +16 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.d.ts +10 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.js +102 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.scss +21 -0
- package/lib/cjs/widget/components/PropertyMenu.d.ts +24 -0
- package/lib/cjs/widget/components/PropertyMenu.js +141 -0
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -0
- package/lib/cjs/widget/components/PropertyMenu.scss +48 -0
- package/lib/cjs/widget/components/QueryBuilder.d.ts +39 -0
- package/lib/cjs/widget/components/QueryBuilder.js +345 -0
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -0
- package/lib/cjs/widget/components/SelectIModel.d.ts +12 -0
- package/lib/cjs/widget/components/SelectIModel.js +42 -0
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -0
- package/lib/cjs/widget/components/SelectIModel.scss +20 -0
- package/lib/cjs/widget/components/SelectMapping.scss +17 -0
- package/lib/cjs/widget/components/SelectMappings.d.ts +12 -0
- package/lib/cjs/widget/components/SelectMappings.js +82 -0
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -0
- package/lib/cjs/widget/components/SelectProject.d.ts +10 -0
- package/lib/cjs/widget/components/SelectProject.js +71 -0
- package/lib/cjs/widget/components/SelectProject.js.map +1 -0
- package/lib/cjs/widget/components/SelectProject.scss +38 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +33 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +92 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +16 -0
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +26 -0
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +58 -0
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +67 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +198 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +71 -0
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +17 -0
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +67 -0
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +69 -0
- package/lib/cjs/widget/components/property-grid/PropertyList.js +87 -0
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +92 -0
- package/lib/cjs/widget/components/property-grid/PropertyRender.js +111 -0
- package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +20 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.js +218 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +111 -0
- package/lib/cjs/widget/components/utils.d.ts +14 -0
- package/lib/cjs/widget/components/utils.js +82 -0
- package/lib/cjs/widget/components/utils.js.map +1 -0
- package/lib/cjs/widget/components/utils.scss +36 -0
- package/lib/cjs/widget/components/viewerUtils.d.ts +9 -0
- package/lib/cjs/widget/components/viewerUtils.js +115 -0
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -0
- package/lib/cjs/widget/hooks/useFetchAccessToken.d.ts +3 -0
- package/lib/cjs/widget/hooks/useFetchAccessToken.js +22 -0
- package/lib/cjs/widget/hooks/useFetchAccessToken.js.map +1 -0
- package/lib/cjs/widget/hooks/useValidator.d.ts +45 -0
- package/lib/cjs/widget/hooks/useValidator.js +53 -0
- package/lib/cjs/widget/hooks/useValidator.js.map +1 -0
- package/lib/cjs/widget/icons/DatabaseInfo.d.ts +5 -0
- package/lib/cjs/widget/icons/DatabaseInfo.js +19 -0
- package/lib/cjs/widget/icons/DatabaseInfo.js.map +1 -0
- package/lib/cjs/widget/icons/DatabaseInfo.scss +12 -0
- package/lib/cjs/widget/utils.d.ts +4 -0
- package/lib/cjs/widget/utils.js +3 -0
- package/lib/cjs/widget/utils.js.map +1 -0
- package/lib/esm/api/GroupQueryBuilderApi.d.ts +15 -0
- package/lib/esm/api/GroupQueryBuilderApi.js +23 -0
- package/lib/esm/api/GroupQueryBuilderApi.js.map +1 -0
- package/lib/esm/api/generated/api.d.ts +3222 -0
- package/lib/esm/api/generated/api.js +5248 -0
- package/lib/esm/api/generated/api.js.map +1 -0
- package/lib/esm/api/generated/configuration.d.ts +56 -0
- package/lib/esm/api/generated/configuration.js +26 -0
- package/lib/esm/api/generated/configuration.js.map +1 -0
- package/lib/esm/api/generated/index.d.ts +14 -0
- package/lib/esm/api/generated/index.js +19 -0
- package/lib/esm/api/generated/index.js.map +1 -0
- package/lib/esm/api/reportingClient.d.ts +34 -0
- package/lib/esm/api/reportingClient.js +173 -0
- package/lib/esm/api/reportingClient.js.map +1 -0
- package/lib/esm/decorators/BboxDimensionsDecorator.d.ts +82 -0
- package/lib/esm/decorators/BboxDimensionsDecorator.js +414 -0
- package/lib/esm/decorators/BboxDimensionsDecorator.js.map +1 -0
- package/lib/esm/grouping-mapping-widget.d.ts +7 -0
- package/lib/esm/grouping-mapping-widget.js +11 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -0
- package/lib/esm/widget/GroupingMappingWidget.d.ts +7 -0
- package/lib/esm/widget/GroupingMappingWidget.js +25 -0
- package/lib/esm/widget/GroupingMappingWidget.js.map +1 -0
- package/lib/esm/widget/components/ActionPanel.d.ts +11 -0
- package/lib/esm/widget/components/ActionPanel.js +16 -0
- package/lib/esm/widget/components/ActionPanel.js.map +1 -0
- package/lib/esm/widget/components/ActionPanel.scss +12 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +14 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.js +136 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.scss +27 -0
- package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +18 -0
- package/lib/esm/widget/components/CalculatedPropertyTable.js +85 -0
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.d.ts +16 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.js +91 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.scss +84 -0
- package/lib/esm/widget/components/CustomCalculationAction.d.ts +14 -0
- package/lib/esm/widget/components/CustomCalculationAction.js +79 -0
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -0
- package/lib/esm/widget/components/CustomCalculationAction.scss +16 -0
- package/lib/esm/widget/components/CustomCalculationTable.d.ts +18 -0
- package/lib/esm/widget/components/CustomCalculationTable.js +90 -0
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -0
- package/lib/esm/widget/components/DeleteModal.d.ts +12 -0
- package/lib/esm/widget/components/DeleteModal.js +41 -0
- package/lib/esm/widget/components/DeleteModal.js.map +1 -0
- package/lib/esm/widget/components/DeleteModal.scss +12 -0
- package/lib/esm/widget/components/GroupAction.d.ts +12 -0
- package/lib/esm/widget/components/GroupAction.js +142 -0
- package/lib/esm/widget/components/GroupAction.js.map +1 -0
- package/lib/esm/widget/components/GroupAction.scss +19 -0
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +17 -0
- package/lib/esm/widget/components/GroupPropertyAction.js +347 -0
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -0
- package/lib/esm/widget/components/GroupPropertyAction.scss +36 -0
- package/lib/esm/widget/components/GroupPropertyTable.d.ts +18 -0
- package/lib/esm/widget/components/GroupPropertyTable.js +85 -0
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -0
- package/lib/esm/widget/components/GroupQueryBuilder.scss +24 -0
- package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +4 -0
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js +43 -0
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -0
- package/lib/esm/widget/components/GroupQueryBuilderContext.d.ts +13 -0
- package/lib/esm/widget/components/GroupQueryBuilderContext.js +15 -0
- package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +1 -0
- package/lib/esm/widget/components/Grouping.d.ts +12 -0
- package/lib/esm/widget/components/Grouping.js +188 -0
- package/lib/esm/widget/components/Grouping.js.map +1 -0
- package/lib/esm/widget/components/Grouping.scss +15 -0
- package/lib/esm/widget/components/GroupingMapping.d.ts +5 -0
- package/lib/esm/widget/components/GroupingMapping.js +13 -0
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -0
- package/lib/esm/widget/components/GroupingMapping.scss +24 -0
- package/lib/esm/widget/components/Mapping.d.ts +7 -0
- package/lib/esm/widget/components/Mapping.js +136 -0
- package/lib/esm/widget/components/Mapping.js.map +1 -0
- package/lib/esm/widget/components/Mapping.scss +26 -0
- package/lib/esm/widget/components/MappingAction.d.ts +11 -0
- package/lib/esm/widget/components/MappingAction.js +74 -0
- package/lib/esm/widget/components/MappingAction.js.map +1 -0
- package/lib/esm/widget/components/MappingAction.scss +16 -0
- package/lib/esm/widget/components/MappingImportWizardModal.d.ts +10 -0
- package/lib/esm/widget/components/MappingImportWizardModal.js +76 -0
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -0
- package/lib/esm/widget/components/MappingImportWizardModal.scss +21 -0
- package/lib/esm/widget/components/PropertyMenu.d.ts +24 -0
- package/lib/esm/widget/components/PropertyMenu.js +115 -0
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -0
- package/lib/esm/widget/components/PropertyMenu.scss +48 -0
- package/lib/esm/widget/components/QueryBuilder.d.ts +39 -0
- package/lib/esm/widget/components/QueryBuilder.js +341 -0
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -0
- package/lib/esm/widget/components/SelectIModel.d.ts +12 -0
- package/lib/esm/widget/components/SelectIModel.js +18 -0
- package/lib/esm/widget/components/SelectIModel.js.map +1 -0
- package/lib/esm/widget/components/SelectIModel.scss +20 -0
- package/lib/esm/widget/components/SelectMapping.scss +17 -0
- package/lib/esm/widget/components/SelectMappings.d.ts +12 -0
- package/lib/esm/widget/components/SelectMappings.js +61 -0
- package/lib/esm/widget/components/SelectMappings.js.map +1 -0
- package/lib/esm/widget/components/SelectProject.d.ts +10 -0
- package/lib/esm/widget/components/SelectProject.js +47 -0
- package/lib/esm/widget/components/SelectProject.js.map +1 -0
- package/lib/esm/widget/components/SelectProject.scss +38 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +33 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +69 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +16 -0
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +26 -0
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +35 -0
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +67 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +172 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +71 -0
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +17 -0
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +44 -0
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyList.d.ts +69 -0
- package/lib/esm/widget/components/property-grid/PropertyList.js +60 -0
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +92 -0
- package/lib/esm/widget/components/property-grid/PropertyRender.js +88 -0
- package/lib/esm/widget/components/property-grid/PropertyRender.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyView.d.ts +20 -0
- package/lib/esm/widget/components/property-grid/PropertyView.js +195 -0
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyView.scss +111 -0
- package/lib/esm/widget/components/utils.d.ts +14 -0
- package/lib/esm/widget/components/utils.js +72 -0
- package/lib/esm/widget/components/utils.js.map +1 -0
- package/lib/esm/widget/components/utils.scss +36 -0
- package/lib/esm/widget/components/viewerUtils.d.ts +9 -0
- package/lib/esm/widget/components/viewerUtils.js +106 -0
- package/lib/esm/widget/components/viewerUtils.js.map +1 -0
- package/lib/esm/widget/hooks/useFetchAccessToken.d.ts +3 -0
- package/lib/esm/widget/hooks/useFetchAccessToken.js +20 -0
- package/lib/esm/widget/hooks/useFetchAccessToken.js.map +1 -0
- package/lib/esm/widget/hooks/useValidator.d.ts +45 -0
- package/lib/esm/widget/hooks/useValidator.js +47 -0
- package/lib/esm/widget/hooks/useValidator.js.map +1 -0
- package/lib/esm/widget/icons/DatabaseInfo.d.ts +5 -0
- package/lib/esm/widget/icons/DatabaseInfo.js +14 -0
- package/lib/esm/widget/icons/DatabaseInfo.js.map +1 -0
- package/lib/esm/widget/icons/DatabaseInfo.scss +12 -0
- package/lib/esm/widget/utils.d.ts +4 -0
- package/lib/esm/widget/utils.js +2 -0
- package/lib/esm/widget/utils.js.map +1 -0
- package/package.json +116 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
3
|
+
import type { Orientation, RatioChangeResult } from "@itwin/core-react";
|
|
4
|
+
import type { ActionButtonRenderer, PropertyUpdatedArgs, PropertyValueRendererManager } from "@itwin/components-react";
|
|
5
|
+
import type { PropertyGridColumnInfo } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns";
|
|
6
|
+
import type { HighlightingComponentProps } from "@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps";
|
|
7
|
+
/** Properties shared by all renderers and PropertyView
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface SharedRendererProps {
|
|
11
|
+
/** PropertyRecord to render */
|
|
12
|
+
propertyRecord: PropertyRecord;
|
|
13
|
+
/** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */
|
|
14
|
+
uniqueKey?: string;
|
|
15
|
+
/** Orientation to use for displaying the property */
|
|
16
|
+
orientation: Orientation;
|
|
17
|
+
/** Controls component selection */
|
|
18
|
+
isSelected?: boolean;
|
|
19
|
+
/** Called when property gets clicked. If undefined, clicking is disabled */
|
|
20
|
+
onClick?: (property: PropertyRecord, key?: string) => void;
|
|
21
|
+
/** Called when property gets right clicked. If undefined, right clicking is not working */
|
|
22
|
+
onRightClick?: (property: PropertyRecord, key?: string) => void;
|
|
23
|
+
/** Called to show a context menu for properties */
|
|
24
|
+
onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;
|
|
25
|
+
/** Ratio between label and value cells */
|
|
26
|
+
columnRatio?: number;
|
|
27
|
+
/** Callback to column ratio changed event */
|
|
28
|
+
onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;
|
|
29
|
+
/** Indicates that properties have *hover* effect */
|
|
30
|
+
isHoverable?: boolean;
|
|
31
|
+
/** Indicates that properties can be selected */
|
|
32
|
+
isSelectable?: boolean;
|
|
33
|
+
/** Width of the whole property element */
|
|
34
|
+
width?: number;
|
|
35
|
+
/** Array of action button renderers @beta */
|
|
36
|
+
actionButtonRenderers?: ActionButtonRenderer[];
|
|
37
|
+
/** Is resize handle hovered */
|
|
38
|
+
isResizeHandleHovered?: boolean;
|
|
39
|
+
/** Callback to hover event change */
|
|
40
|
+
onResizeHandleHoverChanged?: (isHovered: boolean) => void;
|
|
41
|
+
/** Is resize handle being dragged */
|
|
42
|
+
isResizeHandleBeingDragged?: boolean;
|
|
43
|
+
/** Callback to drag event change */
|
|
44
|
+
onResizeHandleDragChanged?: (isDragStarted: boolean) => void;
|
|
45
|
+
/** Information for styling property grid columns */
|
|
46
|
+
columnInfo?: PropertyGridColumnInfo;
|
|
47
|
+
}
|
|
48
|
+
/** Properties of [[PropertyRenderer]] React component
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export interface PropertyRendererProps extends SharedRendererProps {
|
|
52
|
+
/** Custom value renderer */
|
|
53
|
+
propertyValueRendererManager?: PropertyValueRendererManager;
|
|
54
|
+
/** Multiplier of how much the property is indented to the right */
|
|
55
|
+
indentation?: number;
|
|
56
|
+
/** Indicates property is being edited @beta */
|
|
57
|
+
isEditing?: boolean;
|
|
58
|
+
/** Called when property edit is committed. @beta */
|
|
59
|
+
onEditCommit?: (args: PropertyUpdatedArgs) => void;
|
|
60
|
+
/** Called when property edit is cancelled. @beta */
|
|
61
|
+
onEditCancel?: () => void;
|
|
62
|
+
/** Props used for highlighting. @beta */
|
|
63
|
+
highlight?: HighlightingComponentProps;
|
|
64
|
+
}
|
|
65
|
+
/** State of [[PropertyRenderer]] React component
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
interface PropertyRendererState {
|
|
69
|
+
/** Currently loaded property value */
|
|
70
|
+
displayValue?: React.ReactNode;
|
|
71
|
+
}
|
|
72
|
+
/** A React component that renders properties
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export declare class PropertyRenderer extends React.Component<PropertyRendererProps, PropertyRendererState> {
|
|
76
|
+
/** @internal */
|
|
77
|
+
readonly state: Readonly<PropertyRendererState>;
|
|
78
|
+
static getLabelOffset(indentation?: number, orientation?: Orientation, width?: number, columnRatio?: number, minColumnLabelWidth?: number): number;
|
|
79
|
+
private updateDisplayValue;
|
|
80
|
+
private _onEditCommit;
|
|
81
|
+
private _onEditCancel;
|
|
82
|
+
/** Display property record value in an editor */
|
|
83
|
+
updateDisplayValueAsEditor(props: PropertyRendererProps): void;
|
|
84
|
+
/** @internal */
|
|
85
|
+
componentDidMount(): void;
|
|
86
|
+
/** @internal */
|
|
87
|
+
componentDidUpdate(prevProps: PropertyRendererProps): void;
|
|
88
|
+
/** @internal */
|
|
89
|
+
render(): JSX.Element | undefined;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=PropertyRender.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.PropertyRenderer = void 0;
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
const React = __importStar(require("react"));
|
|
28
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
29
|
+
const components_react_1 = require("@itwin/components-react");
|
|
30
|
+
const NonPrimitivePropertyRenderer_1 = require("./NonPrimitivePropertyRenderer");
|
|
31
|
+
const PrimitivePropertyRenderer_1 = require("./PrimitivePropertyRenderer");
|
|
32
|
+
const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer");
|
|
33
|
+
/** A React component that renders properties
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
class PropertyRenderer extends React.Component {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
/** @internal */
|
|
40
|
+
this.state = {
|
|
41
|
+
displayValue: components_react_1.UiComponents.translate("general.loading"),
|
|
42
|
+
};
|
|
43
|
+
this._onEditCommit = (args) => {
|
|
44
|
+
// istanbul ignore else
|
|
45
|
+
if (this.props.onEditCommit) {
|
|
46
|
+
this.props.onEditCommit(args);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this._onEditCancel = () => {
|
|
50
|
+
// istanbul ignore else
|
|
51
|
+
if (this.props.onEditCancel) {
|
|
52
|
+
this.props.onEditCancel();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
static getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth) {
|
|
57
|
+
return CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);
|
|
58
|
+
}
|
|
59
|
+
updateDisplayValue(props) {
|
|
60
|
+
if (props.isEditing) {
|
|
61
|
+
this.updateDisplayValueAsEditor(props);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const displayValue = CommonPropertyRenderer_1.CommonPropertyRenderer.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);
|
|
65
|
+
this.setState({ displayValue });
|
|
66
|
+
}
|
|
67
|
+
/** Display property record value in an editor */
|
|
68
|
+
updateDisplayValueAsEditor(props) {
|
|
69
|
+
this.setState({
|
|
70
|
+
displayValue: (React.createElement(components_react_1.EditorContainer, { propertyRecord: props.propertyRecord, onCommit: this._onEditCommit, onCancel: this._onEditCancel, setFocus: true })),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** @internal */
|
|
74
|
+
componentDidMount() {
|
|
75
|
+
this.updateDisplayValue(this.props);
|
|
76
|
+
}
|
|
77
|
+
/** @internal */
|
|
78
|
+
componentDidUpdate(prevProps) {
|
|
79
|
+
if (prevProps.propertyRecord !== this.props.propertyRecord ||
|
|
80
|
+
prevProps.isEditing !== this.props.isEditing ||
|
|
81
|
+
prevProps.orientation !== this.props.orientation) {
|
|
82
|
+
this.updateDisplayValue(this.props);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** @internal */
|
|
86
|
+
render() {
|
|
87
|
+
const { ...props } = this.props;
|
|
88
|
+
const primitiveRendererProps = {
|
|
89
|
+
...props,
|
|
90
|
+
valueElement: this.state.displayValue,
|
|
91
|
+
indentation: this.props.indentation,
|
|
92
|
+
};
|
|
93
|
+
switch (this.props.propertyRecord.value.valueFormat) {
|
|
94
|
+
case appui_abstract_1.PropertyValueFormat.Primitive:
|
|
95
|
+
return React.createElement(PrimitivePropertyRenderer_1.PrimitivePropertyRenderer, { ...primitiveRendererProps });
|
|
96
|
+
case appui_abstract_1.PropertyValueFormat.Array:
|
|
97
|
+
// If array is empty, render it as a primitive property
|
|
98
|
+
if (this.props.propertyRecord.value.valueFormat ===
|
|
99
|
+
appui_abstract_1.PropertyValueFormat.Array &&
|
|
100
|
+
this.props.propertyRecord.value.items.length === 0) {
|
|
101
|
+
return React.createElement(PrimitivePropertyRenderer_1.PrimitivePropertyRenderer, { ...primitiveRendererProps });
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case appui_abstract_1.PropertyValueFormat.Struct:
|
|
105
|
+
return (React.createElement(NonPrimitivePropertyRenderer_1.NonPrimitivePropertyRenderer, { isCollapsible: true, ...primitiveRendererProps }));
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.PropertyRenderer = PropertyRenderer;
|
|
111
|
+
//# sourceMappingURL=PropertyRender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Property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;gBAC5B,uDAAuD;gBACvD,IACE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW;oBAC3C,oCAAmB,CAAC,KAAK;oBACzB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAClD;oBACA,OAAO,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAAC;iBAClE;gBACD,MAAM;YACR,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,2DAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;SACL;QACD,OAAO;IACT,CAAC;CACF;AApHD,4CAoHC","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 * as React from \"react\";\nimport type { PropertyRecord} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport type {\n ActionButtonRenderer,\n PrimitiveRendererProps,\n PropertyUpdatedArgs,\n PropertyValueRendererManager} from \"@itwin/components-react\";\nimport {\n EditorContainer,\n UiComponents,\n} from \"@itwin/components-react\";\n\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport type { HighlightingComponentProps } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\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 | RatioChangeResult;\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 @beta */\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 @beta */\n isEditing?: boolean;\n /** Called when property edit is committed. @beta */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. @beta */\n onEditCancel?: () => void;\n /** Props used for highlighting. @beta */\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<\nPropertyRendererProps,\nPropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\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 // istanbul ignore else\n if (this.props.onEditCommit) {\n this.props.onEditCommit(args);\n }\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) {\n this.props.onEditCancel();\n }\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 /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\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\n /** @internal */\n public override render() {\n const { ...props } = 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 }\n break;\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n return;\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import "./PropertyView.scss";
|
|
3
|
+
import type { SharedRendererProps } from "./PropertyRender";
|
|
4
|
+
/** Properties of [[PropertyView]] React component
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface PropertyViewProps extends SharedRendererProps {
|
|
8
|
+
/** Property label as a React element */
|
|
9
|
+
labelElement: React.ReactNode;
|
|
10
|
+
/** Property value as a React element */
|
|
11
|
+
valueElement?: React.ReactNode;
|
|
12
|
+
/** Render callback for property value. If specified, `valueElement` is ignored. */
|
|
13
|
+
valueElementRenderer?: () => React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A React component that renders property as label/value pair
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare const PropertyView: (props: PropertyViewProps) => JSX.Element;
|
|
20
|
+
//# sourceMappingURL=PropertyView.d.ts.map
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.PropertyView = void 0;
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
const React = __importStar(require("react"));
|
|
28
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
29
|
+
const core_react_1 = require("@itwin/core-react");
|
|
30
|
+
const components_react_1 = require("@itwin/components-react");
|
|
31
|
+
require("./PropertyView.scss");
|
|
32
|
+
const GroupQueryBuilderContext_1 = require("../GroupQueryBuilderContext");
|
|
33
|
+
const react_1 = require("react");
|
|
34
|
+
const PropertyGridColumns_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns");
|
|
35
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
36
|
+
/**
|
|
37
|
+
* A React component that renders property as label/value pair
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
const PropertyView = (props) => {
|
|
41
|
+
const context = React.useContext(GroupQueryBuilderContext_1.GroupQueryBuilderContext);
|
|
42
|
+
const _validatePropertySelection = () => {
|
|
43
|
+
if (context.currentPropertyList.includes(props.propertyRecord)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
// Check if all subproperties are selected
|
|
47
|
+
if (!_validateNestedPropertiesSelection(props.propertyRecord)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
};
|
|
52
|
+
const _validateNestedPropertiesSelection = (prop) => {
|
|
53
|
+
switch (prop.value.valueFormat) {
|
|
54
|
+
case appui_abstract_1.PropertyValueFormat.Primitive:
|
|
55
|
+
if (!context.currentPropertyList.includes(prop)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
case appui_abstract_1.PropertyValueFormat.Array:
|
|
60
|
+
if (prop.value.items.length === 0) {
|
|
61
|
+
if (!context.currentPropertyList.includes(prop)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
case appui_abstract_1.PropertyValueFormat.Struct:
|
|
67
|
+
for (const subPropName in prop.value.members) {
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(prop.value.members, subPropName)) {
|
|
69
|
+
if (!_validateNestedPropertiesSelection(prop.value.members[subPropName])) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
};
|
|
77
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
78
|
+
const [isPropertySelected, setIsPropertySelected] = React.useState(_validatePropertySelection());
|
|
79
|
+
const _addSelectedProperty = react_1.useCallback(async (prop) => {
|
|
80
|
+
// TODO: roof selected item/category value is an object but format is primitive(needs further exploration)
|
|
81
|
+
if (!context.currentPropertyList.includes(prop) &&
|
|
82
|
+
prop.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
83
|
+
context.setCurrentPropertyList(context.currentPropertyList.concat(prop));
|
|
84
|
+
await context.queryBuilder.addProperty(prop);
|
|
85
|
+
context.setQuery(context.queryBuilder.buildQueryString());
|
|
86
|
+
}
|
|
87
|
+
}, [context]);
|
|
88
|
+
const _addNestedProperties = react_1.useCallback((prop) => {
|
|
89
|
+
switch (prop.value.valueFormat) {
|
|
90
|
+
case appui_abstract_1.PropertyValueFormat.Primitive:
|
|
91
|
+
void _addSelectedProperty(prop);
|
|
92
|
+
break;
|
|
93
|
+
case appui_abstract_1.PropertyValueFormat.Array:
|
|
94
|
+
if (prop.value.items.length === 0) {
|
|
95
|
+
void _addSelectedProperty(prop);
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case appui_abstract_1.PropertyValueFormat.Struct:
|
|
99
|
+
for (const subPropName in prop.value.members) {
|
|
100
|
+
if (Object.prototype.hasOwnProperty.call(prop.value.members, subPropName)) {
|
|
101
|
+
_addNestedProperties(prop.value.members[subPropName]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, [_addSelectedProperty]);
|
|
106
|
+
const _removeSelectedProperty = react_1.useCallback(async (prop) => {
|
|
107
|
+
if (context.currentPropertyList.includes(prop)) {
|
|
108
|
+
context.setCurrentPropertyList(context.currentPropertyList.filter((x) => x !== prop));
|
|
109
|
+
await context.queryBuilder.removeProperty(prop);
|
|
110
|
+
context.setQuery(context.queryBuilder.buildQueryString());
|
|
111
|
+
}
|
|
112
|
+
}, [context]);
|
|
113
|
+
const _removeNestedProperties = react_1.useCallback((prop) => {
|
|
114
|
+
switch (prop.value.valueFormat) {
|
|
115
|
+
case appui_abstract_1.PropertyValueFormat.Primitive:
|
|
116
|
+
void _removeSelectedProperty(prop);
|
|
117
|
+
break;
|
|
118
|
+
case appui_abstract_1.PropertyValueFormat.Array:
|
|
119
|
+
if (prop.value.items.length === 0) {
|
|
120
|
+
void _removeSelectedProperty(prop);
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
case appui_abstract_1.PropertyValueFormat.Struct:
|
|
124
|
+
for (const subPropName in prop.value.members) {
|
|
125
|
+
if (Object.prototype.hasOwnProperty.call(prop.value.members, subPropName)) {
|
|
126
|
+
_removeNestedProperties(prop.value.members[subPropName]);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, [_removeSelectedProperty]);
|
|
131
|
+
React.useEffect(() => {
|
|
132
|
+
if (props === null || props === void 0 ? void 0 : props.propertyRecord) {
|
|
133
|
+
if (isPropertySelected) {
|
|
134
|
+
_addNestedProperties(props.propertyRecord);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
_removeNestedProperties(props.propertyRecord);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, [
|
|
141
|
+
_addNestedProperties,
|
|
142
|
+
_removeNestedProperties,
|
|
143
|
+
isPropertySelected,
|
|
144
|
+
props.propertyRecord,
|
|
145
|
+
]);
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
if (props === null || props === void 0 ? void 0 : props.propertyRecord) {
|
|
148
|
+
if (context.currentPropertyList.includes(props.propertyRecord)) {
|
|
149
|
+
setIsPropertySelected(true);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
setIsPropertySelected(false);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, [context.currentPropertyList, props.propertyRecord]);
|
|
156
|
+
const _onPropertySelectionChanged = () => {
|
|
157
|
+
setIsPropertySelected(!isPropertySelected);
|
|
158
|
+
};
|
|
159
|
+
const _onClick = () => {
|
|
160
|
+
if (props.onClick) {
|
|
161
|
+
props.onClick(props.propertyRecord, props.uniqueKey);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const _onMouseEnter = () => {
|
|
165
|
+
if (props.isHoverable) {
|
|
166
|
+
setIsHovered(true);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const _onMouseLeave = () => {
|
|
170
|
+
if (props.isHoverable) {
|
|
171
|
+
setIsHovered(false);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const _onContextMenu = (e) => {
|
|
175
|
+
if (props.onContextMenu) {
|
|
176
|
+
props.onContextMenu(props.propertyRecord, e);
|
|
177
|
+
}
|
|
178
|
+
if (props.onRightClick) {
|
|
179
|
+
props.onRightClick(props.propertyRecord, props.uniqueKey);
|
|
180
|
+
}
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
return false;
|
|
183
|
+
};
|
|
184
|
+
const getClassName = (viewProps) => {
|
|
185
|
+
let propertyRecordClassName = viewProps.orientation === core_react_1.Orientation.Horizontal
|
|
186
|
+
? "components-property-record--horizontal"
|
|
187
|
+
: "components-property-record--vertical";
|
|
188
|
+
if (viewProps.isSelected) {
|
|
189
|
+
propertyRecordClassName += " components--selected";
|
|
190
|
+
}
|
|
191
|
+
if (viewProps.onClick) {
|
|
192
|
+
propertyRecordClassName += " components--clickable";
|
|
193
|
+
}
|
|
194
|
+
if (viewProps.isHoverable) {
|
|
195
|
+
propertyRecordClassName += " components--hoverable";
|
|
196
|
+
}
|
|
197
|
+
return propertyRecordClassName;
|
|
198
|
+
};
|
|
199
|
+
const ratio = props.columnRatio ? props.columnRatio : 0.25;
|
|
200
|
+
const needElementSeparator = props.orientation === core_react_1.Orientation.Horizontal &&
|
|
201
|
+
!!props.onColumnRatioChanged;
|
|
202
|
+
const needActionButtons = !!props.actionButtonRenderers;
|
|
203
|
+
const columnsStyleProvider = new PropertyGridColumns_1.PropertyGridColumnStyleProvider(props.columnInfo);
|
|
204
|
+
return (React.createElement("div", { style: columnsStyleProvider.getStyle(props.orientation, needActionButtons, ratio, needElementSeparator), className: getClassName(props), onClick: _onClick, onContextMenu: _onContextMenu, onMouseEnter: _onMouseEnter, onMouseLeave: _onMouseLeave, role: 'presentation' },
|
|
205
|
+
React.createElement("div", { className: 'components-property-record-label' },
|
|
206
|
+
props.propertyRecord.value.valueFormat ===
|
|
207
|
+
appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { className: 'components-property-selection-checkbox', checked: isPropertySelected, onChange: _onPropertySelectionChanged })),
|
|
208
|
+
props.labelElement),
|
|
209
|
+
needElementSeparator ? (React.createElement(core_react_1.ElementSeparator, { movableArea: props.width, onRatioChanged: props.onColumnRatioChanged, ratio: ratio, orientation: props.orientation, isResizeHandleHovered: props.isResizeHandleHovered, onResizeHandleHoverChanged: props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: props.isResizeHandleBeingDragged, onResizeHandleDragChanged: props.onResizeHandleDragChanged })) : undefined,
|
|
210
|
+
props.propertyRecord.value.valueFormat ===
|
|
211
|
+
appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className: 'components-property-record-value' },
|
|
212
|
+
React.createElement("span", null, props.valueElementRenderer
|
|
213
|
+
? props.valueElementRenderer()
|
|
214
|
+
: props.valueElement))) : undefined,
|
|
215
|
+
props.actionButtonRenderers ? (React.createElement(components_react_1.ActionButtonList, { orientation: props.orientation, property: props.propertyRecord, isPropertyHovered: isHovered, actionButtonRenderers: props.actionButtonRenderers })) : undefined));
|
|
216
|
+
};
|
|
217
|
+
exports.PropertyView = PropertyView;
|
|
218
|
+
//# sourceMappingURL=PropertyView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyView.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAE/B,0DAA4D;AAC5D,kDAAkE;AAClE,8DAA2D;AAE3D,+BAA6B;AAE7B,0EAAuE;AACvE,iCAAoC;AACpC,mIAA4I;AAC5I,wDAAgD;AAchD;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,mDAAwB,CAAC,CAAC;IAE3D,MAAM,0BAA0B,GAAG,GAAG,EAAE;QACtC,IAAI,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YAC9D,OA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AY,CACjB,CACH,CACP,CAAC,CAAC,CAAC,SAAS;QACd,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAC7B,oBAAC,mCAAgB,IACf,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,iBAAiB,EAAE,SAAS,EAC5B,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,GAClD,CACH,CAAC,CAAC,CAAC,SAAS,CACT,CACP,CAAC;AACJ,CAAC,CAAC;AAxRW,QAAA,YAAY,gBAwRvB","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 * as React from \"react\";\nimport type { PropertyRecord} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { ElementSeparator, Orientation } from \"@itwin/core-react\";\nimport { ActionButtonList } from \"@itwin/components-react\";\n\nimport \"./PropertyView.scss\";\nimport type { SharedRendererProps } from \"./PropertyRender\";\nimport { GroupQueryBuilderContext } from \"../GroupQueryBuilderContext\";\nimport { useCallback } from \"react\";\nimport { PropertyGridColumnStyleProvider } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\n\n/** Properties of [[PropertyView]] React component\n * @public\n */\nexport interface PropertyViewProps extends SharedRendererProps {\n /** Property label as a React element */\n labelElement: React.ReactNode;\n /** Property value as a React element */\n valueElement?: React.ReactNode;\n /** Render callback for property value. If specified, `valueElement` is ignored. */\n valueElementRenderer?: () => React.ReactNode;\n}\n\n/**\n * A React component that renders property as label/value pair\n * @public\n */\nexport const PropertyView = (props: PropertyViewProps) => {\n const context = React.useContext(GroupQueryBuilderContext);\n\n const _validatePropertySelection = () => {\n if (context.currentPropertyList.includes(props.propertyRecord)) {\n return true;\n }\n // Check if all subproperties are selected\n if (!_validateNestedPropertiesSelection(props.propertyRecord)) {\n return false;\n }\n return true;\n };\n\n const _validateNestedPropertiesSelection = (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n if (!context.currentPropertyList.includes(prop)) {\n return false;\n }\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n if (!context.currentPropertyList.includes(prop)) {\n return false;\n }\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n if (\n !_validateNestedPropertiesSelection(\n prop.value.members[subPropName]\n )\n ) {\n return false;\n }\n }\n }\n }\n return true;\n };\n\n const [isHovered, setIsHovered] = React.useState<boolean>(false);\n const [isPropertySelected, setIsPropertySelected] = React.useState<boolean>(\n _validatePropertySelection()\n );\n\n const _addSelectedProperty = useCallback(\n async (prop: PropertyRecord) => {\n // TODO: roof selected item/category value is an object but format is primitive(needs further exploration)\n if (\n !context.currentPropertyList.includes(prop) &&\n prop.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n context.setCurrentPropertyList(\n context.currentPropertyList.concat(prop)\n );\n await context.queryBuilder.addProperty(prop);\n context.setQuery(context.queryBuilder.buildQueryString());\n }\n },\n [context]\n );\n\n const _addNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _addSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _addSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _addNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_addSelectedProperty]\n );\n\n const _removeSelectedProperty = useCallback(\n async (prop: PropertyRecord): Promise<void> => {\n if (context.currentPropertyList.includes(prop)) {\n context.setCurrentPropertyList(\n context.currentPropertyList.filter((x: PropertyRecord) => x !== prop)\n );\n await context.queryBuilder.removeProperty(prop);\n context.setQuery(context.queryBuilder.buildQueryString());\n }\n },\n [context]\n );\n\n const _removeNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _removeSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _removeSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _removeNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_removeSelectedProperty]\n );\n\n React.useEffect(() => {\n if (props?.propertyRecord) {\n if (isPropertySelected) {\n _addNestedProperties(props.propertyRecord);\n } else {\n _removeNestedProperties(props.propertyRecord);\n }\n }\n }, [\n _addNestedProperties,\n _removeNestedProperties,\n isPropertySelected,\n props.propertyRecord,\n ]);\n\n React.useEffect(() => {\n if (props?.propertyRecord) {\n if (context.currentPropertyList.includes(props.propertyRecord)) {\n setIsPropertySelected(true);\n } else {\n setIsPropertySelected(false);\n }\n }\n }, [context.currentPropertyList, props.propertyRecord]);\n\n const _onPropertySelectionChanged = () => {\n setIsPropertySelected(!isPropertySelected);\n };\n\n const _onClick = () => {\n if (props.onClick) {\n props.onClick(props.propertyRecord, props.uniqueKey);\n }\n };\n\n const _onMouseEnter = () => {\n if (props.isHoverable) {\n setIsHovered(true);\n }\n };\n\n const _onMouseLeave = () => {\n if (props.isHoverable) {\n setIsHovered(false);\n }\n };\n\n const _onContextMenu = (e: React.MouseEvent) => {\n if (props.onContextMenu) {\n props.onContextMenu(props.propertyRecord, e);\n }\n if (props.onRightClick) {\n props.onRightClick(props.propertyRecord, props.uniqueKey);\n }\n e.preventDefault();\n return false;\n };\n\n const getClassName = (viewProps: PropertyViewProps) => {\n let propertyRecordClassName =\n viewProps.orientation === Orientation.Horizontal\n ? \"components-property-record--horizontal\"\n : \"components-property-record--vertical\";\n if (viewProps.isSelected) {\n propertyRecordClassName += \" components--selected\";\n }\n if (viewProps.onClick) {\n propertyRecordClassName += \" components--clickable\";\n }\n if (viewProps.isHoverable) {\n propertyRecordClassName += \" components--hoverable\";\n }\n return propertyRecordClassName;\n };\n\n const ratio = props.columnRatio ? props.columnRatio : 0.25;\n const needElementSeparator =\n props.orientation === Orientation.Horizontal &&\n !!props.onColumnRatioChanged;\n const needActionButtons = !!props.actionButtonRenderers;\n const columnsStyleProvider = new PropertyGridColumnStyleProvider(\n props.columnInfo\n );\n\n return (\n <div\n style={columnsStyleProvider.getStyle(\n props.orientation,\n needActionButtons,\n ratio,\n needElementSeparator\n )}\n className={getClassName(props)}\n onClick={_onClick}\n onContextMenu={_onContextMenu}\n onMouseEnter={_onMouseEnter}\n onMouseLeave={_onMouseLeave}\n role='presentation'\n >\n <div className='components-property-record-label'>\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive && (\n <Checkbox\n className='components-property-selection-checkbox'\n checked={isPropertySelected}\n onChange={_onPropertySelectionChanged}\n />\n )}\n {props.labelElement}\n </div>\n {needElementSeparator ? (\n <ElementSeparator\n movableArea={props.width}\n onRatioChanged={props.onColumnRatioChanged}\n ratio={ratio}\n orientation={props.orientation}\n isResizeHandleHovered={props.isResizeHandleHovered}\n onResizeHandleHoverChanged={props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={props.onResizeHandleDragChanged}\n />\n ) : undefined}\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive ? (\n <div className='components-property-record-value'>\n <span>\n {props.valueElementRenderer\n ? props.valueElementRenderer()\n : props.valueElement}\n </span>\n </div>\n ) : undefined}\n {props.actionButtonRenderers ? (\n <ActionButtonList\n orientation={props.orientation}\n property={props.propertyRecord}\n isPropertyHovered={isHovered}\n actionButtonRenderers={props.actionButtonRenderers}\n />\n ) : undefined}\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
|
|
6
|
+
@import "~@itwin/itwinui-css/scss/style/typography";
|
|
7
|
+
@import "~@itwin/itwinui-css/scss/variables";
|
|
8
|
+
|
|
9
|
+
$text-font-size: $iui-font-size;
|
|
10
|
+
$text-font-color: $buic-text-color;
|
|
11
|
+
|
|
12
|
+
.components-property-record--horizontal {
|
|
13
|
+
height: 100%;
|
|
14
|
+
display: grid;
|
|
15
|
+
padding: 0 8px;
|
|
16
|
+
|
|
17
|
+
.components-property-record-label {
|
|
18
|
+
font-size: $iui-font-size-small;
|
|
19
|
+
color: $buic-foreground-muted;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.components-property-record-value {
|
|
23
|
+
min-height: 24px;
|
|
24
|
+
font-size: $text-font-size;
|
|
25
|
+
color: $text-font-color;
|
|
26
|
+
padding: 0px 5px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.components-property-record--vertical {
|
|
31
|
+
height: 100%;
|
|
32
|
+
padding: 0 8px;
|
|
33
|
+
display: grid;
|
|
34
|
+
align-content: center;
|
|
35
|
+
|
|
36
|
+
.components-property-record-label {
|
|
37
|
+
font-size: $iui-font-size-small;
|
|
38
|
+
color: $buic-foreground-muted;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.components-property-record-value {
|
|
42
|
+
min-height: 22px;
|
|
43
|
+
font-size: $text-font-size;
|
|
44
|
+
color: $text-font-color;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@mixin record-cell {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.components-property-record-label {
|
|
54
|
+
@include record-cell;
|
|
55
|
+
.components-property-selection-checkbox {
|
|
56
|
+
margin-right: $iui-s;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.components-property-record-value {
|
|
61
|
+
@include record-cell;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
|
|
64
|
+
span {
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
width: 100%;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.core-underlined-button {
|
|
72
|
+
// Offset by 2px, because value is centered vertically
|
|
73
|
+
// and the button has an underline which offsets it's content,
|
|
74
|
+
// which in turn makes it not in line with the rest of text
|
|
75
|
+
margin-top: 2px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.multiline {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: baseline;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.expanded {
|
|
84
|
+
white-space: pre-wrap;
|
|
85
|
+
margin-top: 4px;
|
|
86
|
+
margin-bottom: 4px;
|
|
87
|
+
|
|
88
|
+
.expand-toggle {
|
|
89
|
+
float: right;
|
|
90
|
+
margin-top: 2px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.expand-toggle {
|
|
95
|
+
padding: 0;
|
|
96
|
+
white-space: nowrap;
|
|
97
|
+
border: none;
|
|
98
|
+
background: none;
|
|
99
|
+
color: var(--buic-foreground-primary);
|
|
100
|
+
font-size: 12px;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
|
|
103
|
+
&:hover {
|
|
104
|
+
text-decoration: underline;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:active {
|
|
108
|
+
outline: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./utils.scss";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ISelectionProvider, SelectionChangeEventArgs } from "@itwin/presentation-frontend";
|
|
4
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
5
|
+
export declare const onSelectionChanged: (evt: SelectionChangeEventArgs, selectionProvider: ISelectionProvider) => void;
|
|
6
|
+
export interface WidgetHeaderProps {
|
|
7
|
+
title: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
returnFn?: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const WidgetHeader: ({ title, disabled, returnFn, }: WidgetHeaderProps) => JSX.Element;
|
|
12
|
+
export declare const handleInputChange: <T>(e: React.ChangeEvent<HTMLInputElement>, values: T, setValues: React.Dispatch<React.SetStateAction<T>>) => void;
|
|
13
|
+
export declare const fetchIdsFromQuery: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
|
|
14
|
+
//# sourceMappingURL=utils.d.ts.map
|