@itwin/grouping-mapping-widget 0.5.4 → 0.5.7
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/ActionPanel.js +2 -2
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.scss +1 -1
- package/lib/cjs/widget/components/BlockingOverlay.js +2 -2
- package/lib/cjs/widget/components/BlockingOverlay.js.map +1 -1
- package/lib/cjs/widget/components/BlockingOverlay.scss +3 -3
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +5 -5
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyAction.scss +4 -4
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +12 -12
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.scss +10 -10
- package/lib/cjs/widget/components/CustomCalculationAction.js +3 -3
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationAction.scss +2 -2
- package/lib/cjs/widget/components/DeleteModal.js +2 -2
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +2 -2
- package/lib/cjs/widget/components/GroupAction.js +9 -10
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +6 -6
- package/lib/cjs/widget/components/GroupPropertyAction.js +6 -6
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.scss +6 -10
- package/lib/cjs/widget/components/GroupQueryBuilder.scss +4 -4
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +3 -3
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.js +23 -28
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +8 -7
- package/lib/cjs/widget/components/GroupingMapping.js +1 -1
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMapping.scss +3 -6
- package/lib/cjs/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/cjs/widget/components/HorizontalTile.js +18 -0
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -0
- package/lib/{esm/widget/components/GroupTile.scss → cjs/widget/components/HorizontalTile.scss} +4 -4
- package/lib/cjs/widget/components/Mapping.js +38 -58
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.scss +22 -8
- package/lib/cjs/widget/components/MappingAction.js +3 -3
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.scss +2 -2
- package/lib/cjs/widget/components/MappingImportWizardModal.js +2 -2
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.scss +3 -3
- package/lib/cjs/widget/components/PropertyMenu.js +13 -12
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.scss +7 -7
- package/lib/cjs/widget/components/SelectIModel.js +3 -3
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +2 -6
- package/lib/cjs/widget/components/SelectMapping.scss +2 -2
- package/lib/cjs/widget/components/SelectMappings.js +3 -3
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.js +28 -20
- package/lib/cjs/widget/components/SelectProject.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.scss +5 -5
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +12 -12
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.js +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.js +5 -5
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +13 -62
- package/lib/cjs/widget/components/utils.js +6 -6
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +6 -6
- package/lib/cjs/widget/components/viewerUtils.d.ts +7 -7
- package/lib/cjs/widget/components/viewerUtils.js +32 -51
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.js +2 -2
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.scss +1 -1
- package/lib/esm/widget/components/BlockingOverlay.js +2 -2
- package/lib/esm/widget/components/BlockingOverlay.js.map +1 -1
- package/lib/esm/widget/components/BlockingOverlay.scss +3 -3
- package/lib/esm/widget/components/CalculatedPropertyAction.js +5 -5
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.scss +4 -4
- package/lib/esm/widget/components/ConfirmMappingsImport.js +12 -12
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.scss +10 -10
- package/lib/esm/widget/components/CustomCalculationAction.js +3 -3
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationAction.scss +2 -2
- package/lib/esm/widget/components/DeleteModal.js +2 -2
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +2 -2
- package/lib/esm/widget/components/GroupAction.js +11 -12
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +6 -6
- package/lib/esm/widget/components/GroupPropertyAction.js +6 -6
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.scss +6 -10
- package/lib/esm/widget/components/GroupQueryBuilder.scss +4 -4
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js +3 -3
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/esm/widget/components/Grouping.js +25 -30
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +8 -7
- package/lib/esm/widget/components/GroupingMapping.js +1 -1
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMapping.scss +3 -6
- package/lib/esm/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/esm/widget/components/HorizontalTile.js +11 -0
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -0
- package/lib/{cjs/widget/components/GroupTile.scss → esm/widget/components/HorizontalTile.scss} +4 -4
- package/lib/esm/widget/components/Mapping.js +41 -61
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.scss +22 -8
- package/lib/esm/widget/components/MappingAction.js +3 -3
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.scss +2 -2
- package/lib/esm/widget/components/MappingImportWizardModal.js +2 -2
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.scss +3 -3
- package/lib/esm/widget/components/PropertyMenu.js +14 -13
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.scss +7 -7
- package/lib/esm/widget/components/SelectIModel.js +3 -3
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.scss +2 -6
- package/lib/esm/widget/components/SelectMapping.scss +2 -2
- package/lib/esm/widget/components/SelectMappings.js +3 -3
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.js +30 -22
- package/lib/esm/widget/components/SelectProject.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.scss +5 -5
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +12 -12
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyList.js +1 -1
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.js +5 -5
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.scss +13 -62
- package/lib/esm/widget/components/utils.js +6 -6
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +6 -6
- package/lib/esm/widget/components/viewerUtils.d.ts +7 -7
- package/lib/esm/widget/components/viewerUtils.js +27 -46
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/package.json +2 -1
- package/lib/cjs/widget/components/GroupTile.d.ts +0 -13
- package/lib/cjs/widget/components/GroupTile.js +0 -18
- package/lib/cjs/widget/components/GroupTile.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +0 -16
- package/lib/esm/widget/components/GroupTile.d.ts +0 -13
- package/lib/esm/widget/components/GroupTile.js +0 -11
- package/lib/esm/widget/components/GroupTile.js.map +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +0 -16
|
@@ -194,8 +194,8 @@ const PropertyView = (props) => {
|
|
|
194
194
|
};
|
|
195
195
|
const getClassName = (viewProps) => {
|
|
196
196
|
let propertyRecordClassName = viewProps.orientation === core_react_1.Orientation.Horizontal
|
|
197
|
-
? "components-property-record--horizontal"
|
|
198
|
-
: "components-property-record--vertical";
|
|
197
|
+
? "gmw-components-property-record--horizontal"
|
|
198
|
+
: "gmw-components-property-record--vertical";
|
|
199
199
|
if (viewProps.isSelected) {
|
|
200
200
|
propertyRecordClassName += " components--selected";
|
|
201
201
|
}
|
|
@@ -214,15 +214,15 @@ const PropertyView = (props) => {
|
|
|
214
214
|
const columnsStyleProvider = new PropertyGridColumns_1.PropertyGridColumnStyleProvider(props.columnInfo);
|
|
215
215
|
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(props.indentation, props.orientation, props.width, props.columnRatio, (_a = props.columnInfo) === null || _a === void 0 ? void 0 : _a.minLabelWidth);
|
|
216
216
|
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" },
|
|
217
|
-
React.createElement("div", { className: "components-property-record-label" },
|
|
217
|
+
React.createElement("div", { className: "gmw-components-property-record-label" },
|
|
218
218
|
props.propertyRecord.value.valueFormat ===
|
|
219
|
-
appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: context.isLoading ||
|
|
219
|
+
appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "gmw-components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: context.isLoading ||
|
|
220
220
|
context.isRendering ||
|
|
221
221
|
props.propertyRecord.value.value === undefined, isLoading: isCheckboxLoading })),
|
|
222
222
|
props.labelElement),
|
|
223
223
|
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,
|
|
224
224
|
props.propertyRecord.value.valueFormat ===
|
|
225
|
-
appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className: "components-property-record-value" },
|
|
225
|
+
appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className: "gmw-components-property-record-value" },
|
|
226
226
|
React.createElement("span", null, props.valueElementRenderer
|
|
227
227
|
? props.valueElementRenderer()
|
|
228
228
|
: props.valueElement))) : undefined,
|
|
@@ -1 +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,kFAA+E;AAC/E,iCAAoC;AACpC,mIAA4I;AAC5I,wDAAgD;AAChD,yIAAsI;AAgBtI;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,mDAAwB,CAAC,CAAC;IAC3D,MAAM,CA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AAlTW,QAAA,YAAY,gBAkTvB","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 \"../context/GroupQueryBuilderContext\";\nimport { useCallback } from \"react\";\nimport { PropertyGridColumnStyleProvider } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\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 /** Multiplier of how much the property is indented to the right */\n indentation?: number;\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 const [isCheckboxLoading, setIsCheckboxLoading] = React.useState(false);\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 if (!(await context.queryBuilder.addProperty(prop))) {\n setIsCheckboxLoading(false);\n setIsPropertySelected(false);\n return;\n }\n context.setCurrentPropertyList(\n context.currentPropertyList.concat(prop)\n );\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 (!context.currentPropertyList.includes(props.propertyRecord)) {\n setIsPropertySelected(false);\n }\n }, [context.currentPropertyList, props.propertyRecord]);\n\n React.useEffect(() => {\n if (props?.propertyRecord) {\n if (isPropertySelected) {\n if (context.isRendering) {\n setIsCheckboxLoading(true);\n }\n _addNestedProperties(props.propertyRecord);\n } else {\n _removeNestedProperties(props.propertyRecord);\n }\n }\n }, [\n _addNestedProperties,\n _removeNestedProperties,\n isPropertySelected,\n props.propertyRecord,\n context.isRendering,\n ]);\n\n React.useEffect(() => {\n if (!context.isRendering) {\n setIsCheckboxLoading(false);\n }\n }, [context.isRendering]);\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 const offset = CommonPropertyRenderer.getLabelOffset(\n props.indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth\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 style={{ marginLeft: offset }}\n className=\"components-property-selection-checkbox\"\n checked={isPropertySelected}\n onChange={_onPropertySelectionChanged}\n disabled={\n context.isLoading ||\n context.isRendering ||\n props.propertyRecord.value.value === undefined\n }\n isLoading={isCheckboxLoading}\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"]}
|
|
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,kFAA+E;AAC/E,iCAAoC;AACpC,mIAA4I;AAC5I,wDAAgD;AAChD,yIAAsI;AAgBtI;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,mDAAwB,CAAC,CAAC;IAC3D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExE,MAAM,0BAA0B,GAAG,GAAG,EAAE;QACtC,IAAI,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YAC9D,OAAO,IAAI,CAAC;SACb;QACD,0CAA0C;QAC1C,IAAI,CAAC,kCAAkC,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YAC7D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,kCAAkC,GAAG,CAAC,IAAoB,EAAE,EAAE;QAClE,QAAQ,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9B,KAAK,oCAAmB,CAAC,SAAS;gBAChC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI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C,0BAA0B,EAC5D,yBAAyB,EAAE,KAAK,CAAC,yBAAyB,GAC1D,CACH,CAAC,CAAC,CAAC,SAAS;QACZ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW;YACrC,oCAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAC9B,6BAAK,SAAS,EAAC,sCAAsC;YACnD,kCACG,KAAK,CAAC,oBAAoB;gBACzB,CAAC,CAAC,KAAK,CAAC,oBAAoB,EAAE;gBAC9B,CAAC,CAAC,KAAK,CAAC,YAAY,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;AAlTW,QAAA,YAAY,gBAkTvB","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 \"../context/GroupQueryBuilderContext\";\nimport { useCallback } from \"react\";\nimport { PropertyGridColumnStyleProvider } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\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 /** Multiplier of how much the property is indented to the right */\n indentation?: number;\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 const [isCheckboxLoading, setIsCheckboxLoading] = React.useState(false);\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 if (!(await context.queryBuilder.addProperty(prop))) {\n setIsCheckboxLoading(false);\n setIsPropertySelected(false);\n return;\n }\n context.setCurrentPropertyList(\n context.currentPropertyList.concat(prop)\n );\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 (!context.currentPropertyList.includes(props.propertyRecord)) {\n setIsPropertySelected(false);\n }\n }, [context.currentPropertyList, props.propertyRecord]);\n\n React.useEffect(() => {\n if (props?.propertyRecord) {\n if (isPropertySelected) {\n if (context.isRendering) {\n setIsCheckboxLoading(true);\n }\n _addNestedProperties(props.propertyRecord);\n } else {\n _removeNestedProperties(props.propertyRecord);\n }\n }\n }, [\n _addNestedProperties,\n _removeNestedProperties,\n isPropertySelected,\n props.propertyRecord,\n context.isRendering,\n ]);\n\n React.useEffect(() => {\n if (!context.isRendering) {\n setIsCheckboxLoading(false);\n }\n }, [context.isRendering]);\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 ? \"gmw-components-property-record--horizontal\"\n : \"gmw-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 const offset = CommonPropertyRenderer.getLabelOffset(\n props.indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth\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=\"gmw-components-property-record-label\">\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive && (\n <Checkbox\n style={{ marginLeft: offset }}\n className=\"gmw-components-property-selection-checkbox\"\n checked={isPropertySelected}\n onChange={_onPropertySelectionChanged}\n disabled={\n context.isLoading ||\n context.isRendering ||\n props.propertyRecord.value.value === undefined\n }\n isLoading={isCheckboxLoading}\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=\"gmw-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"]}
|
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
$text-font-size: $iui-font-size;
|
|
10
10
|
$text-font-color: $buic-text-color;
|
|
11
11
|
|
|
12
|
-
.components-property-record--horizontal {
|
|
12
|
+
.gmw-components-property-record--horizontal {
|
|
13
13
|
height: 100%;
|
|
14
14
|
display: grid;
|
|
15
15
|
padding: 0 8px;
|
|
16
16
|
|
|
17
|
-
.components-property-record-label {
|
|
17
|
+
.gmw-components-property-record-label {
|
|
18
18
|
font-size: $iui-font-size-small;
|
|
19
19
|
color: $buic-foreground-muted;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.components-property-record-value {
|
|
22
|
+
.gmw-components-property-record-value {
|
|
23
23
|
min-height: 24px;
|
|
24
24
|
font-size: $text-font-size;
|
|
25
25
|
color: $text-font-color;
|
|
@@ -27,53 +27,45 @@ $text-font-color: $buic-text-color;
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.components-property-record--vertical {
|
|
30
|
+
.gmw-components-property-record--vertical {
|
|
31
31
|
height: 100%;
|
|
32
32
|
padding: 0 8px;
|
|
33
33
|
display: grid;
|
|
34
34
|
align-content: center;
|
|
35
35
|
|
|
36
|
-
.components-property-record-label {
|
|
36
|
+
.gmw-components-property-record-label {
|
|
37
37
|
font-size: $iui-font-size-small;
|
|
38
38
|
color: $buic-foreground-muted;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.components-property-record-value
|
|
41
|
+
.gmw-components-property-record-value {
|
|
42
42
|
min-height: 22px;
|
|
43
43
|
font-size: $text-font-size;
|
|
44
44
|
color: $text-font-color;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
@mixin record-cell {
|
|
48
|
+
@mixin gmw-record-cell {
|
|
49
49
|
display: flex;
|
|
50
50
|
align-items: center;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.components-property-record-label {
|
|
54
|
-
@include record-cell;
|
|
53
|
+
.gmw-components-property-record-label {
|
|
54
|
+
@include gmw-record-cell;
|
|
55
55
|
position: relative;
|
|
56
|
-
.components-property-selection-checkbox {
|
|
56
|
+
.gmw-components-property-selection-checkbox {
|
|
57
57
|
flex-shrink: 0;
|
|
58
58
|
position: absolute;
|
|
59
59
|
z-index: 1;
|
|
60
60
|
}
|
|
61
61
|
// Radial does not respect checkbox positioning, have to force it.
|
|
62
|
-
> .iui-progress-indicator-radial {
|
|
62
|
+
> .gmw-iui-progress-indicator-radial {
|
|
63
63
|
position: absolute;
|
|
64
64
|
}
|
|
65
|
-
.components-property-selection-loading {
|
|
66
|
-
display: flex;
|
|
67
|
-
width: $iui-m;
|
|
68
|
-
height: $iui-m;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
flex-shrink: 0;
|
|
72
|
-
}
|
|
73
65
|
}
|
|
74
66
|
|
|
75
|
-
.components-property-record-value {
|
|
76
|
-
@include record-cell;
|
|
67
|
+
.gmw-components-property-record-value {
|
|
68
|
+
@include gmw-record-cell;
|
|
77
69
|
overflow: hidden;
|
|
78
70
|
|
|
79
71
|
span {
|
|
@@ -82,45 +74,4 @@ $text-font-color: $buic-text-color;
|
|
|
82
74
|
text-overflow: ellipsis;
|
|
83
75
|
width: 100%;
|
|
84
76
|
}
|
|
85
|
-
|
|
86
|
-
.core-underlined-button {
|
|
87
|
-
// Offset by 2px, because value is centered vertically
|
|
88
|
-
// and the button has an underline which offsets it's content,
|
|
89
|
-
// which in turn makes it not in line with the rest of text
|
|
90
|
-
margin-top: 2px;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.multiline {
|
|
94
|
-
display: flex;
|
|
95
|
-
align-items: baseline;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.expanded {
|
|
99
|
-
white-space: pre-wrap;
|
|
100
|
-
margin-top: 4px;
|
|
101
|
-
margin-bottom: 4px;
|
|
102
|
-
|
|
103
|
-
.expand-toggle {
|
|
104
|
-
float: right;
|
|
105
|
-
margin-top: 2px;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.expand-toggle {
|
|
110
|
-
padding: 0;
|
|
111
|
-
white-space: nowrap;
|
|
112
|
-
border: none;
|
|
113
|
-
background: none;
|
|
114
|
-
color: var(--buic-foreground-primary);
|
|
115
|
-
font-size: 12px;
|
|
116
|
-
cursor: pointer;
|
|
117
|
-
|
|
118
|
-
&:hover {
|
|
119
|
-
text-decoration: underline;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&:active {
|
|
123
|
-
outline: none;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
77
|
}
|
|
@@ -39,10 +39,10 @@ const onSelectionChanged = (evt, selectionProvider) => {
|
|
|
39
39
|
};
|
|
40
40
|
exports.onSelectionChanged = onSelectionChanged;
|
|
41
41
|
const WidgetHeader = ({ title, disabled = false, returnFn, }) => {
|
|
42
|
-
return (react_1.default.createElement("div", { className: 'widget-header-container' },
|
|
43
|
-
returnFn && (react_1.default.createElement("div", { className: disabled ? "chevron-disabled" : "chevron", onClick: disabled ? undefined : returnFn },
|
|
42
|
+
return (react_1.default.createElement("div", { className: 'gmw-widget-header-container' },
|
|
43
|
+
returnFn && (react_1.default.createElement("div", { className: disabled ? "gmw-chevron-disabled" : "gmw-chevron", onClick: disabled ? undefined : returnFn },
|
|
44
44
|
react_1.default.createElement(itwinui_icons_react_1.SvgChevronLeft, null))),
|
|
45
|
-
react_1.default.createElement(itwinui_react_1.Text, { className: 'title', variant: 'title' }, title)));
|
|
45
|
+
react_1.default.createElement(itwinui_react_1.Text, { className: 'gmw-title', variant: 'title' }, title)));
|
|
46
46
|
};
|
|
47
47
|
exports.WidgetHeader = WidgetHeader;
|
|
48
48
|
const handleInputChange = (e, values, setValues) => {
|
|
@@ -115,16 +115,16 @@ const handleError = (errorStatus) => {
|
|
|
115
115
|
itwinui_react_1.toaster.negative(errorMessage);
|
|
116
116
|
};
|
|
117
117
|
exports.handleError = handleError;
|
|
118
|
-
const LoadingOverlay = () => (react_1.default.createElement("div", { className: '
|
|
118
|
+
const LoadingOverlay = () => (react_1.default.createElement("div", { className: 'gmw-center-overlay' },
|
|
119
119
|
react_1.default.createElement(itwinui_react_1.Text, null, "Loading"),
|
|
120
120
|
react_1.default.createElement(itwinui_react_1.ProgressRadial, { indeterminate: true }),
|
|
121
121
|
react_1.default.createElement(itwinui_react_1.Text, null, "Please wait...")));
|
|
122
122
|
exports.LoadingOverlay = LoadingOverlay;
|
|
123
|
-
const EmptyMessage = ({ message }) => (react_1.default.createElement("div", { className: '
|
|
123
|
+
const EmptyMessage = ({ message }) => (react_1.default.createElement("div", { className: 'gmw-center-overlay' },
|
|
124
124
|
react_1.default.createElement(itwinui_react_1.Text, null, message)));
|
|
125
125
|
exports.EmptyMessage = EmptyMessage;
|
|
126
126
|
const LoadingSpinner = () => {
|
|
127
|
-
return (react_1.default.createElement("div", { className: "
|
|
127
|
+
return (react_1.default.createElement("div", { className: "gmw-loading-spinner" },
|
|
128
128
|
react_1.default.createElement(itwinui_react_1.ProgressRadial, { size: "small", indeterminate: true })));
|
|
129
129
|
};
|
|
130
130
|
exports.LoadingSpinner = LoadingSpinner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/widget/components/utils.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,oEAA4D;AAC5D,wDAAqE;AACrE,wBAAsB;AACtB,kDAA0B;AAM1B,oDAAoD;AAE7C,MAAM,kBAAkB,GAAG,CAChC,GAA6B,EAC7B,iBAAqC,EACrC,EAAE;IACF,+BAA+B;IAC/B,MAAM,SAAS,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACxE,IAAI,SAAS,CAAC,OAAO,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;KACxD;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;QACvD,IAAI,SAAS,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE;YACrC,0DAA0D;YAC1D,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;gBAC9C,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CA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,IAAI,EAAC,OAAO,EAAC,aAAa,SAAG,CACzC,CACP,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","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 { SvgChevronLeft } from \"@itwin/itwinui-icons-react\";\nimport { ProgressRadial, Text, toaster } from \"@itwin/itwinui-react\";\nimport \"./utils.scss\";\nimport React from \"react\";\nimport type {\n ISelectionProvider,\n SelectionChangeEventArgs,\n} from \"@itwin/presentation-frontend\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\n\nexport const onSelectionChanged = (\n evt: SelectionChangeEventArgs,\n selectionProvider: ISelectionProvider,\n) => {\n /* eslint-disable no-console */\n const selection = selectionProvider.getSelection(evt.imodel, evt.level);\n if (selection.isEmpty) {\n console.log(\"========== Selection cleared ==========\");\n } else {\n console.log(\"========== Selection change ===========\");\n if (selection.instanceKeys.size !== 0) {\n // log all selected ECInstance ids grouped by ECClass name\n console.log(\"ECInstances:\");\n selection.instanceKeys.forEach((ids, ecclass) => {\n console.log(`${ecclass}: [${[...ids].join(\",\")}]`);\n });\n }\n if (selection.nodeKeys.size !== 0) {\n // log all selected node keys\n console.log(\"Nodes:\");\n selection.nodeKeys.forEach((key) => console.log(JSON.stringify(key)));\n }\n console.log(\"=======================================\");\n }\n /* eslint-enable no-console */\n};\n\nexport interface WidgetHeaderProps {\n title: string;\n disabled?: boolean;\n returnFn?: () => Promise<void>;\n}\n\nexport const WidgetHeader = ({\n title,\n disabled = false,\n returnFn,\n}: WidgetHeaderProps) => {\n return (\n <div className='gmw-widget-header-container'>\n {returnFn && (\n <div\n className={disabled ? \"gmw-chevron-disabled\" : \"gmw-chevron\"}\n onClick={disabled ? undefined : returnFn}\n >\n <SvgChevronLeft />\n </div>\n )}\n <Text className='gmw-title' variant='title'>\n {title}\n </Text>\n </div>\n );\n};\n\nexport const handleInputChange = <T,>(\n e: React.ChangeEvent<HTMLInputElement>,\n values: T,\n setValues: React.Dispatch<React.SetStateAction<T>>,\n) => {\n const { name, value } = e.target;\n\n setValues({\n ...values,\n [name]: value,\n });\n};\n\nexport const fetchIdsFromQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (query === \"\") {\n return [];\n }\n const ids: string[] = [];\n const rowIterator = iModelConnection.query(query, undefined, {\n rowFormat: QueryRowFormat.UseJsPropertyNames,\n });\n while (true) {\n const { done, value } = await rowIterator.next();\n if (done) {\n break;\n }\n if (Object.keys(value).includes(\"id\")) {\n ids.push(value.id);\n } else if (Object.keys(value).includes(\"element.id\")) {\n ids.push(value[\"element.id\"]);\n } else if (Object.keys(value).includes(\"eCInstanceId\")) {\n ids.push(value.eCInstanceId);\n }\n }\n return ids;\n};\n\nexport const handleError = (errorStatus: number) => {\n let errorMessage = \"Error! \";\n switch (errorStatus) {\n case 401:\n errorMessage += `You are unauthorized to do this operation.`;\n break;\n case 403:\n errorMessage += `You don't have permission to access the requested resource.`;\n break;\n case 404:\n errorMessage += `The requested resource was not found.`;\n break;\n case 409:\n errorMessage += `This property name is already being used.`;\n break;\n case 422:\n errorMessage += `Unable to process the request.`;\n break;\n case 429:\n errorMessage += `Too many requests.`;\n break;\n case 500:\n errorMessage += `Internal server error.`;\n break;\n case 502:\n errorMessage += `Bad gateway.`;\n break;\n case 503:\n errorMessage += `Service unavailable.`;\n break;\n default:\n errorMessage += `Something went wrong!`;\n }\n toaster.negative(errorMessage);\n\n};\n\nexport const LoadingOverlay = () => (\n <div className='gmw-center-overlay'>\n <Text>Loading</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n);\n\ninterface EmptyMessageProps {\n message: string;\n}\n\nexport const EmptyMessage = ({ message }: EmptyMessageProps) => (\n <div className='gmw-center-overlay'>\n <Text>{message}</Text>\n </div>\n);\n\nexport const LoadingSpinner = () => {\n return (\n <div className=\"gmw-loading-spinner\">\n <ProgressRadial size=\"small\" indeterminate />\n </div>\n );\n};\n"]}
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
@import "~@itwin/itwinui-css/scss/icon/index";
|
|
7
7
|
@import "~@itwin/itwinui-css/scss/button/index";
|
|
8
8
|
|
|
9
|
-
.widget-header-container {
|
|
9
|
+
.gmw-widget-header-container {
|
|
10
10
|
display: flex;
|
|
11
11
|
margin-bottom: $iui-baseline * 3;
|
|
12
12
|
|
|
13
|
-
.chevron {
|
|
13
|
+
.gmw-chevron {
|
|
14
14
|
@include iui-icons-large();
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
align-self: center;
|
|
17
17
|
margin-right: $iui-s;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.chevron-disabled {
|
|
20
|
+
.gmw-chevron-disabled {
|
|
21
21
|
@include iui-icons-large();
|
|
22
22
|
@include themed {
|
|
23
23
|
fill: t(iui-icons-color-actionable-disabled);
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
margin-right: $iui-s;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.title {
|
|
31
|
+
.gmw-title {
|
|
32
32
|
overflow: hidden;
|
|
33
33
|
white-space: nowrap;
|
|
34
34
|
text-overflow: ellipsis;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.gmw-loading-spinner {
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.
|
|
43
|
+
.gmw-center-overlay {
|
|
44
44
|
display: flex;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
align-items: center;
|
|
@@ -3,25 +3,25 @@ import type { FeatureAppearance } from "@itwin/core-common";
|
|
|
3
3
|
import { FeatureOverrideType } from "@itwin/core-common";
|
|
4
4
|
import { KeySet } from "@itwin/presentation-common";
|
|
5
5
|
export declare const isolateElementsByKeys: (keySet: KeySet, replace?: boolean) => Promise<string[]>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const isolateElementsByQuery: (query: string, iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
|
|
7
7
|
export declare const isolateElements: (hilitedIds: string[], replace?: boolean) => void;
|
|
8
8
|
export declare const clearIsolatedElements: () => void;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const hideElementsByQuery: (query: string, iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
|
|
10
10
|
export declare const hideElements: (hilitedIds: string[], replace?: boolean) => void;
|
|
11
11
|
export declare const clearHiddenElements: () => void;
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const overrideElementsByQuery: (iModelConnection: IModelConnection, query: string, color: string, overrideType?: FeatureOverrideType) => Promise<string[]>;
|
|
13
13
|
export declare const overrideElements: (hilitedIds: string[], color: string, overrideType?: FeatureOverrideType) => void;
|
|
14
14
|
export declare const clearOverriddenElements: () => void;
|
|
15
15
|
export declare const emphasizeElements: (hilitedIds: string[], defaultAppearance?: FeatureAppearance | undefined, replace?: boolean) => void;
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const emphasisElementsByQuery: (iModelConnection: IModelConnection, query: string, defaultAppearance?: FeatureAppearance | undefined, replace?: boolean) => Promise<string[]>;
|
|
17
17
|
export declare const emphasizeElementsByKeys: (keySet: KeySet, defaultAppearance?: FeatureAppearance | undefined, replace?: boolean) => Promise<string[]>;
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const visualizeElementsByQuery: (query: string, color: string, iModelConnection: IModelConnection, replace?: boolean, wantEmphasis?: boolean) => Promise<string[]>;
|
|
19
19
|
export declare const visualizeElementsByKeys: (keySet: KeySet, color: string, replace?: boolean, wantEmphasis?: boolean) => Promise<string[]>;
|
|
20
20
|
export declare const visualizeElements: (elementIds: string[], color: string, replace?: boolean, wantEmphasis?: boolean) => void;
|
|
21
21
|
export declare const transparentOverriddenElements: () => void;
|
|
22
22
|
export declare const zoomToElements: (elementIds: string[]) => Promise<void>;
|
|
23
|
-
export declare const getHiliteIds: (
|
|
24
|
-
export declare const manufactureKeys: (
|
|
23
|
+
export declare const getHiliteIds: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
|
|
24
|
+
export declare const manufactureKeys: (query: string, iModelConnection: IModelConnection) => Promise<KeySet>;
|
|
25
25
|
export declare const clearEmphasizedElements: () => void;
|
|
26
26
|
export declare const clearEmphasizedOverriddenElements: () => void;
|
|
27
27
|
export declare const clearAll: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clearAll = exports.clearEmphasizedOverriddenElements = exports.clearEmphasizedElements = exports.manufactureKeys = exports.getHiliteIds = exports.zoomToElements = exports.transparentOverriddenElements = exports.visualizeElements = exports.visualizeElementsByKeys = exports.
|
|
3
|
+
exports.clearAll = exports.clearEmphasizedOverriddenElements = exports.clearEmphasizedElements = exports.manufactureKeys = exports.getHiliteIds = exports.zoomToElements = exports.transparentOverriddenElements = exports.visualizeElements = exports.visualizeElementsByKeys = exports.visualizeElementsByQuery = exports.emphasizeElementsByKeys = exports.emphasisElementsByQuery = exports.emphasizeElements = exports.clearOverriddenElements = exports.overrideElements = exports.overrideElementsByQuery = exports.clearHiddenElements = exports.hideElements = exports.hideElementsByQuery = exports.clearIsolatedElements = exports.isolateElements = exports.isolateElementsByQuery = exports.isolateElementsByKeys = void 0;
|
|
4
4
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
5
5
|
const core_common_1 = require("@itwin/core-common");
|
|
6
6
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
@@ -22,12 +22,12 @@ const isolateElementsByKeys = async (keySet, replace = false) => {
|
|
|
22
22
|
return [];
|
|
23
23
|
};
|
|
24
24
|
exports.isolateElementsByKeys = isolateElementsByKeys;
|
|
25
|
-
const
|
|
25
|
+
const isolateElementsByQuery = async (query, iModelConnection, replace = false) => {
|
|
26
26
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
27
27
|
return [];
|
|
28
28
|
}
|
|
29
29
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
30
|
-
const keySet = await exports.manufactureKeys(
|
|
30
|
+
const keySet = await exports.manufactureKeys(query, iModelConnection);
|
|
31
31
|
const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
|
|
32
32
|
imodel: vp.iModel,
|
|
33
33
|
});
|
|
@@ -39,7 +39,7 @@ const isolateElementsById = async (elementIds, iModelConnection, replace = false
|
|
|
39
39
|
}
|
|
40
40
|
return [];
|
|
41
41
|
};
|
|
42
|
-
exports.
|
|
42
|
+
exports.isolateElementsByQuery = isolateElementsByQuery;
|
|
43
43
|
const isolateElements = (hilitedIds, replace = false) => {
|
|
44
44
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
45
45
|
return;
|
|
@@ -58,12 +58,12 @@ const clearIsolatedElements = () => {
|
|
|
58
58
|
emph.clearIsolatedElements(vp);
|
|
59
59
|
};
|
|
60
60
|
exports.clearIsolatedElements = clearIsolatedElements;
|
|
61
|
-
const
|
|
61
|
+
const hideElementsByQuery = async (query, iModelConnection, replace = false) => {
|
|
62
62
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
63
63
|
return [];
|
|
64
64
|
}
|
|
65
65
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
66
|
-
const keySet = await exports.manufactureKeys(
|
|
66
|
+
const keySet = await exports.manufactureKeys(query, iModelConnection);
|
|
67
67
|
const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
|
|
68
68
|
imodel: vp.iModel,
|
|
69
69
|
});
|
|
@@ -75,7 +75,7 @@ const hideElementsById = async (elementIds, iModelConnection, replace = false) =
|
|
|
75
75
|
}
|
|
76
76
|
return [];
|
|
77
77
|
};
|
|
78
|
-
exports.
|
|
78
|
+
exports.hideElementsByQuery = hideElementsByQuery;
|
|
79
79
|
const hideElements = (hilitedIds, replace = false) => {
|
|
80
80
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
81
81
|
return;
|
|
@@ -94,12 +94,12 @@ const clearHiddenElements = () => {
|
|
|
94
94
|
emph.clearHiddenElements(vp);
|
|
95
95
|
};
|
|
96
96
|
exports.clearHiddenElements = clearHiddenElements;
|
|
97
|
-
const
|
|
97
|
+
const overrideElementsByQuery = async (iModelConnection, query, color, overrideType = core_common_1.FeatureOverrideType.ColorOnly) => {
|
|
98
98
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
99
99
|
return [];
|
|
100
100
|
}
|
|
101
101
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
102
|
-
const keySet = await exports.manufactureKeys(
|
|
102
|
+
const keySet = await exports.manufactureKeys(query, iModelConnection);
|
|
103
103
|
const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
|
|
104
104
|
imodel: vp.iModel,
|
|
105
105
|
});
|
|
@@ -111,7 +111,7 @@ const overrideElementsById = async (iModelConnection, elementIds, color, overrid
|
|
|
111
111
|
}
|
|
112
112
|
return [];
|
|
113
113
|
};
|
|
114
|
-
exports.
|
|
114
|
+
exports.overrideElementsByQuery = overrideElementsByQuery;
|
|
115
115
|
const overrideElements = (hilitedIds, color, overrideType = core_common_1.FeatureOverrideType.ColorOnly) => {
|
|
116
116
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
117
117
|
return;
|
|
@@ -140,12 +140,12 @@ const emphasizeElements = (hilitedIds, defaultAppearance = undefined, replace =
|
|
|
140
140
|
emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);
|
|
141
141
|
};
|
|
142
142
|
exports.emphasizeElements = emphasizeElements;
|
|
143
|
-
const
|
|
143
|
+
const emphasisElementsByQuery = async (iModelConnection, query, defaultAppearance = undefined, replace = false) => {
|
|
144
144
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
145
145
|
return [];
|
|
146
146
|
}
|
|
147
147
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
148
|
-
const keySet = await exports.manufactureKeys(
|
|
148
|
+
const keySet = await exports.manufactureKeys(query, iModelConnection);
|
|
149
149
|
const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
|
|
150
150
|
imodel: vp.iModel,
|
|
151
151
|
});
|
|
@@ -157,7 +157,7 @@ const emphasisElementsById = async (iModelConnection, elementIds, defaultAppeara
|
|
|
157
157
|
}
|
|
158
158
|
return [];
|
|
159
159
|
};
|
|
160
|
-
exports.
|
|
160
|
+
exports.emphasisElementsByQuery = emphasisElementsByQuery;
|
|
161
161
|
const emphasizeElementsByKeys = async (keySet, defaultAppearance = undefined, replace = false) => {
|
|
162
162
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
163
163
|
return [];
|
|
@@ -175,12 +175,12 @@ const emphasizeElementsByKeys = async (keySet, defaultAppearance = undefined, re
|
|
|
175
175
|
return [];
|
|
176
176
|
};
|
|
177
177
|
exports.emphasizeElementsByKeys = emphasizeElementsByKeys;
|
|
178
|
-
const
|
|
178
|
+
const visualizeElementsByQuery = async (query, color, iModelConnection, replace = false, wantEmphasis = true) => {
|
|
179
179
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
180
180
|
return [];
|
|
181
181
|
}
|
|
182
182
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
183
|
-
const keySet = await exports.manufactureKeys(
|
|
183
|
+
const keySet = await exports.manufactureKeys(query, iModelConnection);
|
|
184
184
|
const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
|
|
185
185
|
imodel: vp.iModel,
|
|
186
186
|
});
|
|
@@ -192,7 +192,7 @@ const visualizeElementsById = async (elementIds, color, iModelConnection, replac
|
|
|
192
192
|
}
|
|
193
193
|
return [];
|
|
194
194
|
};
|
|
195
|
-
exports.
|
|
195
|
+
exports.visualizeElementsByQuery = visualizeElementsByQuery;
|
|
196
196
|
const visualizeElementsByKeys = async (keySet, color, replace = false, wantEmphasis = true) => {
|
|
197
197
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
198
198
|
return [];
|
|
@@ -251,12 +251,12 @@ const zoomToElements = async (elementIds) => {
|
|
|
251
251
|
await vp.zoomToElements(elementIds, { ...viewChangeOpts });
|
|
252
252
|
};
|
|
253
253
|
exports.zoomToElements = zoomToElements;
|
|
254
|
-
const getHiliteIds = async (
|
|
254
|
+
const getHiliteIds = async (query, iModelConnection) => {
|
|
255
255
|
if (!core_frontend_1.IModelApp.viewManager.selectedView) {
|
|
256
256
|
return [];
|
|
257
257
|
}
|
|
258
258
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
259
|
-
const keySet = await exports.manufactureKeys(
|
|
259
|
+
const keySet = await exports.manufactureKeys(query, iModelConnection);
|
|
260
260
|
const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
|
|
261
261
|
imodel: vp.iModel,
|
|
262
262
|
});
|
|
@@ -267,39 +267,20 @@ const getHiliteIds = async (elementIds, iModelConnection) => {
|
|
|
267
267
|
return [];
|
|
268
268
|
};
|
|
269
269
|
exports.getHiliteIds = getHiliteIds;
|
|
270
|
-
const manufactureKeys = async (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
if (currBatch.length > 0 && currBatch.length <= batchSize) {
|
|
285
|
-
batches.push(currBatch);
|
|
286
|
-
}
|
|
287
|
-
// retrieve element properties in batches
|
|
288
|
-
let elemProps = [];
|
|
289
|
-
for (const batch of batches) {
|
|
290
|
-
const props = await iModelConnection.elements.getProps(batch);
|
|
291
|
-
elemProps = elemProps.concat(props);
|
|
292
|
-
}
|
|
293
|
-
const isElementId = (elem) => {
|
|
294
|
-
return elem.id !== undefined;
|
|
295
|
-
};
|
|
296
|
-
// create keyset from the element properties
|
|
297
|
-
const keys = elemProps
|
|
298
|
-
.map((elem) => ({
|
|
299
|
-
id: elem.id,
|
|
300
|
-
className: elem.classFullName,
|
|
301
|
-
}))
|
|
302
|
-
.filter(isElementId);
|
|
270
|
+
const manufactureKeys = async (query, iModelConnection) => {
|
|
271
|
+
query;
|
|
272
|
+
iModelConnection;
|
|
273
|
+
if (query === "") {
|
|
274
|
+
new presentation_common_1.KeySet();
|
|
275
|
+
}
|
|
276
|
+
const queryWithIdAndECClassName = `SELECT q.ECInstanceId, ec_classname(e.ECClassId) FROM (${query}) q JOIN BisCore.Element e on e.ECInstanceId = q.ECInstanceId`;
|
|
277
|
+
const rowIterator = iModelConnection.query(queryWithIdAndECClassName, undefined, {
|
|
278
|
+
rowFormat: core_common_1.QueryRowFormat.UseECSqlPropertyIndexes,
|
|
279
|
+
});
|
|
280
|
+
const keys = [];
|
|
281
|
+
for await (const value of rowIterator) {
|
|
282
|
+
keys.push({ id: value[0], className: value[1] });
|
|
283
|
+
}
|
|
303
284
|
return new presentation_common_1.KeySet(keys);
|
|
304
285
|
};
|
|
305
286
|
exports.manufactureKeys = manufactureKeys;
|