@itwin/grouping-mapping-widget 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/grouping-mapping-widget.d.ts +3 -0
- package/lib/cjs/grouping-mapping-widget.js +7 -1
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +2 -2
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +7 -119
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyAction.scss +1 -12
- package/lib/cjs/widget/components/CalculatedPropertyActionWithVisuals.d.ts +12 -0
- package/lib/cjs/widget/components/CalculatedPropertyActionWithVisuals.js +154 -0
- package/lib/cjs/widget/components/CalculatedPropertyActionWithVisuals.js.map +1 -0
- package/lib/cjs/widget/components/CalculatedPropertyActionWithVisuals.scss +27 -0
- package/lib/cjs/widget/components/GroupAction.js +2 -2
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupColorLegend.d.ts +10 -0
- package/lib/cjs/widget/components/GroupColorLegend.js +20 -0
- package/lib/cjs/widget/components/GroupColorLegend.js.map +1 -0
- package/lib/cjs/widget/components/GroupColorLegend.scss +9 -0
- package/lib/cjs/widget/components/GroupColorToggle.d.ts +9 -0
- package/lib/cjs/widget/components/GroupColorToggle.js +69 -0
- package/lib/cjs/widget/components/GroupColorToggle.js.map +1 -0
- package/lib/cjs/widget/components/GroupItem.d.ts +12 -0
- package/lib/cjs/widget/components/GroupItem.js +19 -0
- package/lib/cjs/widget/components/GroupItem.js.map +1 -0
- package/lib/cjs/widget/components/GroupMenuActions.d.ts +13 -0
- package/lib/cjs/widget/components/GroupMenuActions.js +68 -0
- package/lib/cjs/widget/components/GroupMenuActions.js.map +1 -0
- package/lib/cjs/widget/components/GroupMenuActions.scss +13 -0
- package/lib/cjs/widget/components/Grouping.d.ts +9 -5
- package/lib/cjs/widget/components/Grouping.js +14 -142
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +0 -16
- package/lib/cjs/widget/components/GroupingMapping.js +3 -5
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContent.js +1 -1
- package/lib/cjs/widget/components/GroupingMappingContent.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContext.js +1 -1
- package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingRouter.js +20 -21
- package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/cjs/widget/components/GroupsAddButton.d.ts +3 -2
- package/lib/cjs/widget/components/GroupsAddButton.js +4 -3
- package/lib/cjs/widget/components/GroupsAddButton.js.map +1 -1
- package/lib/cjs/widget/components/GroupsAddButton.scss +2 -0
- package/lib/cjs/widget/components/GroupsShowHideButtons.d.ts +11 -0
- package/lib/cjs/widget/components/GroupsShowHideButtons.js +45 -0
- package/lib/cjs/widget/components/GroupsShowHideButtons.js.map +1 -0
- package/lib/cjs/widget/components/GroupsVisualization.d.ts +9 -0
- package/lib/cjs/widget/components/GroupsVisualization.js +137 -0
- package/lib/cjs/widget/components/GroupsVisualization.js.map +1 -0
- package/lib/cjs/widget/components/GroupsVisualization.scss +12 -0
- package/lib/cjs/widget/components/GroupsVisualizationActions.d.ts +10 -0
- package/lib/cjs/widget/components/GroupsVisualizationActions.js +27 -0
- package/lib/cjs/widget/components/GroupsVisualizationActions.js.map +1 -0
- package/lib/cjs/widget/components/GroupsVisualizationActions.scss +9 -0
- package/lib/cjs/widget/components/PropertyMenu.d.ts +1 -2
- package/lib/cjs/widget/components/PropertyMenu.js +6 -49
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.scss +2 -17
- package/lib/cjs/widget/components/PropertyMenuWithVisualization.d.ts +8 -0
- package/lib/cjs/widget/components/PropertyMenuWithVisualization.js +45 -0
- package/lib/cjs/widget/components/PropertyMenuWithVisualization.js.map +1 -0
- package/lib/cjs/widget/components/PropertyMenuWithVisualization.scss +16 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.d.ts +3 -1
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js +2 -1
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/SharedCalculatedPropertyForms.d.ts +16 -0
- package/lib/cjs/widget/components/SharedCalculatedPropertyForms.js +62 -0
- package/lib/cjs/widget/components/SharedCalculatedPropertyForms.js.map +1 -0
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.d.ts +2 -2
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js +1 -1
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.d.ts +4 -0
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.d.ts +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +2 -2
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/groupsHelpers.d.ts +1 -1
- package/lib/cjs/widget/components/groupsHelpers.js +11 -14
- package/lib/cjs/widget/components/groupsHelpers.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +3 -0
- package/lib/esm/grouping-mapping-widget.js +3 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +2 -2
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.js +9 -121
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.scss +1 -12
- package/lib/esm/widget/components/CalculatedPropertyActionWithVisuals.d.ts +12 -0
- package/lib/esm/widget/components/CalculatedPropertyActionWithVisuals.js +128 -0
- package/lib/esm/widget/components/CalculatedPropertyActionWithVisuals.js.map +1 -0
- package/lib/esm/widget/components/CalculatedPropertyActionWithVisuals.scss +27 -0
- package/lib/esm/widget/components/GroupAction.js +2 -2
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupColorLegend.d.ts +10 -0
- package/lib/esm/widget/components/GroupColorLegend.js +13 -0
- package/lib/esm/widget/components/GroupColorLegend.js.map +1 -0
- package/lib/esm/widget/components/GroupColorLegend.scss +9 -0
- package/lib/esm/widget/components/GroupColorToggle.d.ts +9 -0
- package/lib/esm/widget/components/GroupColorToggle.js +46 -0
- package/lib/esm/widget/components/GroupColorToggle.js.map +1 -0
- package/lib/esm/widget/components/GroupItem.d.ts +12 -0
- package/lib/esm/widget/components/GroupItem.js +12 -0
- package/lib/esm/widget/components/GroupItem.js.map +1 -0
- package/lib/esm/widget/components/GroupMenuActions.d.ts +13 -0
- package/lib/esm/widget/components/GroupMenuActions.js +45 -0
- package/lib/esm/widget/components/GroupMenuActions.js.map +1 -0
- package/lib/esm/widget/components/GroupMenuActions.scss +13 -0
- package/lib/esm/widget/components/Grouping.d.ts +9 -5
- package/lib/esm/widget/components/Grouping.js +17 -145
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +0 -16
- package/lib/esm/widget/components/GroupingMapping.js +3 -5
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContent.js +1 -1
- package/lib/esm/widget/components/GroupingMappingContent.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContext.js +1 -1
- package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingRouter.js +20 -21
- package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/esm/widget/components/GroupsAddButton.d.ts +3 -2
- package/lib/esm/widget/components/GroupsAddButton.js +5 -4
- package/lib/esm/widget/components/GroupsAddButton.js.map +1 -1
- package/lib/esm/widget/components/GroupsAddButton.scss +2 -0
- package/lib/esm/widget/components/GroupsShowHideButtons.d.ts +11 -0
- package/lib/esm/widget/components/GroupsShowHideButtons.js +22 -0
- package/lib/esm/widget/components/GroupsShowHideButtons.js.map +1 -0
- package/lib/esm/widget/components/GroupsVisualization.d.ts +9 -0
- package/lib/esm/widget/components/GroupsVisualization.js +114 -0
- package/lib/esm/widget/components/GroupsVisualization.js.map +1 -0
- package/lib/esm/widget/components/GroupsVisualization.scss +12 -0
- package/lib/esm/widget/components/GroupsVisualizationActions.d.ts +10 -0
- package/lib/esm/widget/components/GroupsVisualizationActions.js +20 -0
- package/lib/esm/widget/components/GroupsVisualizationActions.js.map +1 -0
- package/lib/esm/widget/components/GroupsVisualizationActions.scss +9 -0
- package/lib/esm/widget/components/PropertyMenu.d.ts +1 -2
- package/lib/esm/widget/components/PropertyMenu.js +7 -50
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.scss +2 -17
- package/lib/esm/widget/components/PropertyMenuWithVisualization.d.ts +8 -0
- package/lib/esm/widget/components/PropertyMenuWithVisualization.js +22 -0
- package/lib/esm/widget/components/PropertyMenuWithVisualization.js.map +1 -0
- package/lib/esm/widget/components/PropertyMenuWithVisualization.scss +16 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.d.ts +3 -1
- package/lib/esm/widget/components/QueryBuilderCustomUI.js +2 -1
- package/lib/esm/widget/components/QueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/widget/components/SharedCalculatedPropertyForms.d.ts +16 -0
- package/lib/esm/widget/components/SharedCalculatedPropertyForms.js +39 -0
- package/lib/esm/widget/components/SharedCalculatedPropertyForms.js.map +1 -0
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.d.ts +2 -2
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.js +1 -1
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.d.ts +4 -0
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.d.ts +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/groupsHelpers.d.ts +1 -1
- package/lib/esm/widget/components/groupsHelpers.js +11 -14
- package/lib/esm/widget/components/groupsHelpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupHilitedElementsContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupHilitedElementsContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAuB;IACnF,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE;IACjD,eAAe,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"GroupHilitedElementsContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupHilitedElementsContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAuB;IACnF,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE;IACjD,eAAe,EAAE,IAAI,GAAG,EAAE;IAC1B,cAAc,EAAE,KAAK;IACrB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC;IACpB,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAyB,EAAE;IACvE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { MutableRefObject } from \"react\";\nimport type { Group } from \"@itwin/insights-client\";\nimport type { KeySet } from \"@itwin/presentation-common\";\nexport interface QueryCacheItem {\n keySet: KeySet;\n ids: string[];\n}\nexport interface GroupHilitedElements {\n hilitedElementsQueryCache: MutableRefObject<Map<string, QueryCacheItem>>;\n hiddenGroupsIds: Set<string>;\n showGroupColor: boolean;\n groups: Group[];\n setGroups: (groups: Group[]) => void;\n setHiddenGroupsIds: (hiddenGroupIds: Set<string>) => void;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n}\n\nexport const GroupHilitedElementsContext = React.createContext<GroupHilitedElements>({\n hilitedElementsQueryCache: { current: new Map() },\n hiddenGroupsIds: new Set(),\n showGroupColor: false,\n groups: [],\n setGroups: () => { },\n setHiddenGroupsIds: () => { },\n setShowGroupColor: () => { },\n});\n\nexport const useGroupHilitedElementsContext = (): GroupHilitedElements => {\n const context = React.useContext(GroupHilitedElementsContext);\n if (!context) {\n throw new Error(\n \"useGroupHilitedElementsContext should be used within a GroupHilitedElementsContext provider\"\n );\n }\n return context;\n};\n"]}
|
|
@@ -88,5 +88,9 @@ export interface GroupingCustomUIProps {
|
|
|
88
88
|
* To reset the viewer.
|
|
89
89
|
*/
|
|
90
90
|
resetView?: () => Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* The initial query for the Group being edited.
|
|
93
|
+
*/
|
|
94
|
+
initialEditModeQuery?: string;
|
|
91
95
|
}
|
|
92
96
|
//# sourceMappingURL=GroupingMappingCustomUI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupingMappingCustomUI.ts"],"names":[],"mappings":"AAOA,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,qFAAQ,CAAA;IACR,mFAAO,CAAA;AACT,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { Group, Mapping } from \"@itwin/insights-client\";\nimport type { ReactElement } from \"react\";\n\nexport enum GroupingMappingCustomUIType {\n Grouping,\n Context,\n}\n\nexport type GroupingMappingCustomUI = GroupingCustomUI | ContextCustomUI;\n\n/** Custom UI Definitions. */\n\nexport interface IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType;\n /**\n * Unique identifier of the custom UI.\n */\n name: string;\n /**\n * Display label in the widget.\n */\n displayLabel: string;\n /**\n * Optional icon, will be shown before display label in widget.\n */\n icon?: ReactElement;\n}\n\n/**\n * Context custom UI type definition.\n */\nexport interface ContextCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Context;\n /**\n * User defined component for UI interaction with grouping mapping widget.\n */\n uiComponent?:
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupingMappingCustomUI.ts"],"names":[],"mappings":"AAOA,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,qFAAQ,CAAA;IACR,mFAAO,CAAA;AACT,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { Group, Mapping } from \"@itwin/insights-client\";\nimport type { ReactElement } from \"react\";\n\nexport enum GroupingMappingCustomUIType {\n Grouping,\n Context,\n}\n\nexport type GroupingMappingCustomUI = GroupingCustomUI | ContextCustomUI;\n\n/** Custom UI Definitions. */\n\nexport interface IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType;\n /**\n * Unique identifier of the custom UI.\n */\n name: string;\n /**\n * Display label in the widget.\n */\n displayLabel: string;\n /**\n * Optional icon, will be shown before display label in widget.\n */\n icon?: ReactElement;\n}\n\n/**\n * Context custom UI type definition.\n */\nexport interface ContextCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Context;\n /**\n * User defined component for UI interaction with grouping mapping widget.\n */\n uiComponent?: React.ComponentType<ContextCustomUIProps>;\n /**\n * Callback function for context custom UI menu item click event.\n */\n onClick?: (group: Group, mapping: Mapping, iModelId: string) => void;\n}\n\n/**\n * Group custom UI type definition.\n */\nexport interface GroupingCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Grouping;\n /**\n * Custom UI Component to build query interactively. Refer to SearchGroupingCustomUI/ManualGroupingCustomUI.\n */\n uiComponent: (props: GroupingCustomUIProps) => JSX.Element;\n}\n\n/** Custom UI Component props definitions. */\n\n/**\n * Context custom UI component arguments definition.\n */\nexport interface ContextCustomUIProps {\n /**\n * IModel Id.\n */\n iModelId: string;\n /**\n * Mapping Id.\n */\n mappingId: string;\n /**\n * Group Id.\n */\n groupId: string;\n}\n\n/**\n * Group custom UI component arguments definition.\n */\nexport interface GroupingCustomUIProps {\n /**\n * To validate and update current query.\n */\n updateQuery: (query: string) => void;\n /**\n * To get the query loading status.\n */\n isUpdating?: boolean;\n /**\n * To reset the viewer.\n */\n resetView?: () => Promise<void>;\n /**\n * The initial query for the Group being edited.\n */\n initialEditModeQuery?: string;\n\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./ManualGroupingCustomUI.scss";
|
|
3
3
|
import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
|
|
4
|
-
export declare const ManualGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
|
|
4
|
+
export declare const ManualGroupingCustomUI: ({ updateQuery, isUpdating, resetView, initialEditModeQuery, }: GroupingCustomUIProps) => JSX.Element;
|
|
5
5
|
//# sourceMappingURL=ManualGroupingCustomUI.d.ts.map
|
|
@@ -6,8 +6,8 @@ import React from "react";
|
|
|
6
6
|
import { Alert, Button, LabeledTextarea } from "@itwin/itwinui-react";
|
|
7
7
|
import { LoadingSpinner } from "../utils";
|
|
8
8
|
import "./ManualGroupingCustomUI.scss";
|
|
9
|
-
export const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
10
|
-
const [manualInput, setManualInput] = React.useState("");
|
|
9
|
+
export const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, initialEditModeQuery, }) => {
|
|
10
|
+
const [manualInput, setManualInput] = React.useState(initialEditModeQuery !== null && initialEditModeQuery !== void 0 ? initialEditModeQuery : "");
|
|
11
11
|
return (React.createElement("div", { className: 'gmw-manual-form' },
|
|
12
12
|
React.createElement(Alert, { type: 'informational' }, "Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query."),
|
|
13
13
|
React.createElement(LabeledTextarea, { label: 'Query', required: true, value: manualInput, onChange: (event) => setManualInput(event.target.value), disabled: isUpdating, placeholder: `E.g. "SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement"` }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,
|
|
1
|
+
{"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,EACT,oBAAoB,GACE,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,EAAE,CAAC,CAAC;IAEjF,OAAO,CACL,6BAAK,SAAS,EAAC,iBAAiB;QAC9B,oBAAC,KAAK,IAAC,IAAI,EAAC,eAAe,0GAEnB;QACR,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,oEAAoE,GACjF;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,YAE5D;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { Alert, Button, LabeledTextarea } from \"@itwin/itwinui-react\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./ManualGroupingCustomUI.scss\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nexport const ManualGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n initialEditModeQuery,\n}: GroupingCustomUIProps) => {\n const [manualInput, setManualInput] = React.useState(initialEditModeQuery ?? \"\");\n\n return (\n <div className='gmw-manual-form'>\n <Alert type='informational'>\n Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query.\n </Alert>\n <LabeledTextarea\n label='Query'\n required\n value={manualInput}\n onChange={(event) => setManualInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement\"`}\n />\n <div className='gmw-manual-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button disabled={isUpdating} onClick={() => updateQuery(manualInput)}>\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setManualInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -5,6 +5,6 @@ export declare const getGroupColor: (index: number) => string;
|
|
|
5
5
|
export declare const getHiliteIdsFromGroups: (iModelConnection: IModelConnection, groups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<string[]>;
|
|
6
6
|
export declare const hideGroups: (iModelConnection: IModelConnection, viewGroups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<void>;
|
|
7
7
|
export declare const hideGroup: (iModelConnection: IModelConnection, viewGroup: Group, hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<void>;
|
|
8
|
-
export declare const visualizeGroupColors: (iModelConnection: IModelConnection, groups: Group[],
|
|
8
|
+
export declare const visualizeGroupColors: (iModelConnection: IModelConnection, groups: Group[], hiddenGroupsIds: Set<string>, hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>, doEmphasizeElements?: boolean) => Promise<void>;
|
|
9
9
|
export declare const getHiliteIdsAndKeysetFromGroup: (iModelConnection: IModelConnection, group: Group, hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<QueryCacheItem>;
|
|
10
10
|
//# sourceMappingURL=groupsHelpers.d.ts.map
|
|
@@ -38,21 +38,18 @@ export const hideGroup = async (iModelConnection, viewGroup, hilitedElementsQuer
|
|
|
38
38
|
const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, viewGroup, hilitedElementsQueryCache);
|
|
39
39
|
hideElements(result.ids);
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
const processGroupVisualization = async (iModelConnection, group, hiddenGroupsIds, hilitedElementsQueryCache, doEmphasizeElements, groupColor) => {
|
|
42
|
+
const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);
|
|
43
|
+
const hilitedIds = result.ids;
|
|
44
|
+
overrideElements(hilitedIds, groupColor, FeatureOverrideType.ColorAndAlpha);
|
|
45
|
+
doEmphasizeElements && emphasizeElements(hilitedIds, undefined);
|
|
46
|
+
return hiddenGroupsIds.has(group.id) ? [] : hilitedIds;
|
|
47
|
+
};
|
|
48
|
+
export const visualizeGroupColors = async (iModelConnection, groups, hiddenGroupsIds, hilitedElementsQueryCache, doEmphasizeElements = true) => {
|
|
42
49
|
clearEmphasizedOverriddenElements();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
? viewGroups.findIndex((g) => g.id === group.id)
|
|
47
|
-
: groups.findIndex((g) => g.id === group.id);
|
|
48
|
-
const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);
|
|
49
|
-
const hilitedIds = result.ids;
|
|
50
|
-
overrideElements(hilitedIds, getGroupColor(index), FeatureOverrideType.ColorAndAlpha);
|
|
51
|
-
doEmphasizeElements && emphasizeElements(hilitedIds, undefined);
|
|
52
|
-
if (!hiddenGroupsIds.includes(group.id)) {
|
|
53
|
-
allIds = allIds.concat(hilitedIds);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
50
|
+
const allIdsPromises = groups.map(async (group, index) => processGroupVisualization(iModelConnection, group, hiddenGroupsIds, hilitedElementsQueryCache, doEmphasizeElements, getGroupColor(index)));
|
|
51
|
+
const allIdsArrays = await Promise.all(allIdsPromises);
|
|
52
|
+
const allIds = allIdsArrays.flat();
|
|
56
53
|
await zoomToElements(allIds);
|
|
57
54
|
};
|
|
58
55
|
export const getHiliteIdsAndKeysetFromGroup = async (iModelConnection, group, hilitedElementsQueryCache) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/widget/components/groupsHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnJ,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,KAAa;IAClD,OAAO,OAAO,KAAK,GAAG,WAAW,GAAG,EAAE,cAAc,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,gBAAkC,EAClC,MAAe,EACf,yBAA8E,EAC9E,EAAE;IACF,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAC1C,MAAM,QAAQ,GAAiC,EAAE,CAAC;IAClD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACrC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACjC,QAAQ,CAAC,IAAI,CAAC,8BAA8B,CAAC,gBAAgB,EAAE,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC;SACnG;KACF;IACD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG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;QACN,OAAO,CAAC,QAAQ,CACd,8BAA8B,CAC/B,CAAC;QACF,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;KAC5C;AAEH,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport type { QueryCacheItem } from \"./context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements, zoomToElements } from \"./viewerUtils\";\n\nconst goldenAngle = 180 * (3 - Math.sqrt(5));\n\nexport const getGroupColor = function (index: number) {\n return `hsl(${index * goldenAngle + 60}, 100%, 50%)`;\n};\n\nexport const getHiliteIdsFromGroups = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const distinctQueries = new Set<string>();\n const promises: Promise<{ ids: string[] }>[] = [];\n for (const group of groups) {\n if (!distinctQueries.has(group.query)) {\n distinctQueries.add(group.query);\n promises.push(getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache));\n }\n }\n const results = await Promise.all(promises);\n const allIds = results.flatMap((result) => result.ids);\n return allIds;\n};\n\nexport const hideGroups = async (\n iModelConnection: IModelConnection,\n viewGroups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const distinctQueries = new Set<string>();\n const promises: Promise<void>[] = [];\n\n for (const viewGroup of viewGroups) {\n if (!distinctQueries.has(viewGroup.query)) {\n distinctQueries.add(viewGroup.query);\n promises.push(hideGroup(iModelConnection, viewGroup, hilitedElementsQueryCache));\n }\n }\n await Promise.all(promises);\n};\n\nexport const hideGroup = async (\n iModelConnection: IModelConnection,\n viewGroup: Group,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, viewGroup, hilitedElementsQueryCache);\n hideElements(result.ids);\n};\n\nconst processGroupVisualization = async (\n iModelConnection: IModelConnection,\n group: Group,\n hiddenGroupsIds: Set<string>,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>,\n doEmphasizeElements: boolean,\n groupColor: string\n) => {\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);\n const hilitedIds = result.ids;\n overrideElements(hilitedIds, groupColor, FeatureOverrideType.ColorAndAlpha);\n\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n\n return hiddenGroupsIds.has(group.id) ? [] : hilitedIds;\n};\n\nexport const visualizeGroupColors = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n hiddenGroupsIds: Set<string>,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>,\n doEmphasizeElements: boolean = true\n) => {\n clearEmphasizedOverriddenElements();\n\n const allIdsPromises = groups.map(async (group, index) =>\n processGroupVisualization(\n iModelConnection,\n group,\n hiddenGroupsIds,\n hilitedElementsQueryCache,\n doEmphasizeElements,\n getGroupColor(index)\n )\n );\n\n const allIdsArrays = await Promise.all(allIdsPromises);\n const allIds = allIdsArrays.flat();\n\n await zoomToElements(allIds);\n};\n\nexport const getHiliteIdsAndKeysetFromGroup = async (\n iModelConnection: IModelConnection,\n group: Group,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const query = group.query;\n if (hilitedElementsQueryCache.current.has(query)) {\n return hilitedElementsQueryCache.current.get(query) ?? ({ keySet: new KeySet(), ids: [] });\n }\n try {\n const queryRowCount = await iModelConnection.queryRowCount(query);\n if (queryRowCount === 0) {\n toaster.warning(\n `${group.groupName}'s query is valid but produced no results.`\n );\n }\n const result = await getHiliteIds(query, iModelConnection);\n hilitedElementsQueryCache.current.set(query, result);\n return result;\n } catch {\n toaster.negative(\n `Query could not be resolved.`\n );\n return ({ keySet: new KeySet(), ids: [] });\n }\n\n};\n"]}
|