@itwin/grouping-mapping-widget 0.13.0 → 0.15.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 +152 -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.d.ts +1 -0
- package/lib/cjs/widget/components/GroupAction.js +37 -71
- 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/GroupPropertyAction.js +1 -3
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- 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.d.ts +5 -0
- package/lib/cjs/widget/components/GroupingMappingContext.js +6 -3
- package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingRouter.js +21 -22
- 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 +133 -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/Mapping.js +1 -1
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- 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/QueryBuilderStep.d.ts +2 -1
- package/lib/cjs/widget/components/QueryBuilderStep.js +2 -1
- package/lib/cjs/widget/components/QueryBuilderStep.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/context/GroupingApiConfigContext.d.ts +2 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js +1 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js +2 -2
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.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/customUI/ManualGroupingCustomUI.scss +0 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +0 -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/cjs/widget/hooks/useVisualization.d.ts +11 -0
- package/lib/cjs/widget/hooks/useVisualization.js +68 -0
- package/lib/cjs/widget/hooks/useVisualization.js.map +1 -0
- 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 +126 -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.d.ts +1 -0
- package/lib/esm/widget/components/GroupAction.js +37 -71
- 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/GroupPropertyAction.js +1 -3
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- 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.d.ts +5 -0
- package/lib/esm/widget/components/GroupingMappingContext.js +6 -3
- package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingRouter.js +21 -22
- 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 +110 -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/Mapping.js +1 -1
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- 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/QueryBuilderStep.d.ts +2 -1
- package/lib/esm/widget/components/QueryBuilderStep.js +3 -2
- package/lib/esm/widget/components/QueryBuilderStep.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/context/GroupingApiConfigContext.d.ts +2 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js +1 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.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/customUI/ManualGroupingCustomUI.scss +0 -1
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +0 -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/lib/esm/widget/hooks/useVisualization.d.ts +11 -0
- package/lib/esm/widget/hooks/useVisualization.js +64 -0
- package/lib/esm/widget/hooks/useVisualization.js.map +1 -0
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ export const Mappings = ({ onClickAddMapping, onClickMappingTitle, onClickMappin
|
|
|
72
72
|
isLoading ? (React.createElement(LoadingOverlay, null)) : mappings.length === 0 ? (React.createElement(EmptyMessage, { message: `No ${displayStrings.mappings} available.` })) : (React.createElement("div", { className: "gmw-mappings-list" }, mappings
|
|
73
73
|
.map((mapping) => {
|
|
74
74
|
var _a, _b;
|
|
75
|
-
return (React.createElement(HorizontalTile, { key: mapping.id, title: mapping.mappingName ? mapping.mappingName : "Untitled", subText: (_a = mapping.description) !== null && _a !== void 0 ? _a : "", subtextToolTip: (_b = mapping.description) !== null && _b !== void 0 ? _b : "", titleTooltip: mapping.mappingName, onClickTitle: () => onClickMappingTitle
|
|
75
|
+
return (React.createElement(HorizontalTile, { key: mapping.id, title: mapping.mappingName ? mapping.mappingName : "Untitled", subText: (_a = mapping.description) !== null && _a !== void 0 ? _a : "", subtextToolTip: (_b = mapping.description) !== null && _b !== void 0 ? _b : "", titleTooltip: mapping.mappingName, onClickTitle: onClickMappingTitle ? () => onClickMappingTitle(mapping) : undefined, actionGroup: React.createElement(DropdownMenu, { menuItems: (close) => [
|
|
76
76
|
onClickMappingModify ? (React.createElement(MenuItem, { key: 0, onClick: () => {
|
|
77
77
|
onClickMappingModify(mapping);
|
|
78
78
|
close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../../src/widget/components/Mapping.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,GACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAKjF,MAAM,qBAAqB,GAAG;IAC5B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CACH,CAAA;aAAA,CAAC,CACA,CACP,CACO;QACV,oBAAC,WAAW,IACV,UAAU,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAC5C,QAAQ,EAAE,KAAK,IAAI,EAAE;;gBACnB,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;gBAC3C,MAAM,aAAa,CAAC,aAAa,CAC/B,WAAW,EACX,QAAQ,EACR,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,mCAAI,EAAE,CAC1B,CAAC;YACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB;QACF,oBAAC,wBAAwB,IACvB,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,OAAO,EACjB,cAAc,EAAE,cAAc,GAC9B,CACD,CACJ,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 {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgImport,\n SvgMore,\n SvgProcess,\n SvgRefresh,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n MenuItem,\n Surface,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport {\n EmptyMessage,\n handleError,\n LoadingOverlay,\n} from \"./utils\";\nimport \"./Mapping.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport { MappingImportWizardModal } from \"./MappingImportWizardModal\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport type { GetAccessTokenFn } from \"./context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CreateTypeFromInterface } from \"../utils\";\n\nexport type IMappingTyped = CreateTypeFromInterface<Mapping>;\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n};\nexport interface MappingsProps {\n onClickAddMapping?: () => void;\n onClickMappingTitle?: (mapping: Mapping) => void;\n onClickMappingModify?: (mapping: Mapping) => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nconst fetchMappings = async (\n setMappings: React.Dispatch<React.SetStateAction<Mapping[]>>,\n iModelId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const mappings = await mappingsClient.getMappings(accessToken, iModelId);\n setMappings(mappings.sort((a, b) => a.mappingName.localeCompare(b.mappingName)));\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nconst toggleExtraction = async (\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient,\n iModelId: string,\n mapping: Mapping\n) => {\n try {\n const newState = mapping.extractionEnabled;\n const accessToken = await getAccessToken();\n await mappingsClient.updateMapping(accessToken, iModelId, mapping.id, {\n extractionEnabled: newState,\n });\n } catch (error: any) {\n handleError(error.status);\n }\n};\n\nexport const Mappings = ({\n onClickAddMapping,\n onClickMappingTitle,\n onClickMappingModify,\n displayStrings: userDisplayStrings,\n}: MappingsProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [showDeleteModal, setShowDeleteModal] = useState<Mapping | undefined>(undefined);\n const [showImportModal, setShowImportModal] = useState<boolean>(false);\n const [showBlockingOverlay, setShowBlockingOverlay] =\n useState<boolean>(false);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings, setMappings] = useState<Mapping[]>([]);\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n useEffect(() => {\n void fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setIsLoading]);\n\n const refresh = useCallback(async () => {\n setMappings([]);\n await fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setMappings]);\n\n return (\n <>\n <BlockingOverlay isVisible={showBlockingOverlay} />\n <Surface className=\"gmw-mappings-container\">\n <div className=\"gmw-table-toolbar\">\n <div className=\"gmw-button-spacing\">\n {onClickAddMapping &&\n <Button\n startIcon={<SvgAdd />}\n onClick={onClickAddMapping}\n styleType=\"high-visibility\"\n >\n New\n </Button>\n }\n <IconButton\n title={`Import ${displayStrings.mappings}`}\n onClick={() => setShowImportModal(true)}\n >\n <SvgImport />\n </IconButton>\n </div>\n <IconButton\n title=\"Refresh\"\n onClick={refresh}\n disabled={isLoading}\n styleType='borderless'\n >\n <SvgRefresh />\n </IconButton>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : mappings.length === 0 ? (\n <EmptyMessage message={`No ${displayStrings.mappings} available.`} />\n ) : (\n <div className=\"gmw-mappings-list\">\n {mappings\n .map((mapping) => (\n <HorizontalTile\n key={mapping.id}\n title={\n mapping.mappingName ? mapping.mappingName : \"Untitled\"\n }\n subText={mapping.description ?? \"\"}\n subtextToolTip={mapping.description ?? \"\"}\n titleTooltip={mapping.mappingName}\n onClickTitle={() => onClickMappingTitle ? onClickMappingTitle(mapping) : undefined}\n actionGroup={\n <DropdownMenu\n menuItems={(close: () => void) => [\n onClickMappingModify ? (\n <MenuItem\n key={0}\n onClick={() => {\n onClickMappingModify(mapping);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>\n ) : [],\n <MenuItem\n key={1}\n onClick={async () => {\n setShowBlockingOverlay(true);\n close();\n await toggleExtraction(\n getAccessToken,\n mappingClient,\n iModelId,\n mapping\n );\n await refresh();\n setShowBlockingOverlay(false);\n }}\n icon={<SvgProcess />}\n >\n {mapping.extractionEnabled\n ? \"Disable extraction\"\n : \"Enable extraction\"}\n </MenuItem>,\n <MenuItem\n key={2}\n onClick={() => {\n setShowDeleteModal(mapping);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((m) => m)}\n >\n <IconButton styleType=\"borderless\">\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n }\n />\n ))}\n </div>\n )}\n </Surface>\n <DeleteModal\n entityName={showDeleteModal?.mappingName}\n onClose={() => setShowDeleteModal(undefined)}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteMapping(\n accessToken,\n iModelId,\n showDeleteModal?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n <MappingImportWizardModal\n show={showImportModal}\n setShow={setShowImportModal}\n onFinish={refresh}\n displayStrings={displayStrings}\n />\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../../src/widget/components/Mapping.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,GACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OA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AAC;gCACV,CAAC,EACD,IAAI,EAAE,oBAAC,SAAS,OAAG,aAGV;yBACZ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;wBAEnB,oBAAC,UAAU,IAAC,SAAS,EAAC,YAAY;4BAChC,oBAAC,OAAO,IACN,KAAK,EAAE;oCACL,KAAK,EAAE,MAAM;oCACb,MAAM,EAAE,MAAM;iCACf,GACD,CACS,CACA,GAEjB,CACH,CAAA;aAAA,CAAC,CACA,CACP,CACO;QACV,oBAAC,WAAW,IACV,UAAU,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAC5C,QAAQ,EAAE,KAAK,IAAI,EAAE;;gBACnB,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;gBAC3C,MAAM,aAAa,CAAC,aAAa,CAC/B,WAAW,EACX,QAAQ,EACR,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,mCAAI,EAAE,CAC1B,CAAC;YACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB;QACF,oBAAC,wBAAwB,IACvB,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,OAAO,EACjB,cAAc,EAAE,cAAc,GAC9B,CACD,CACJ,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 {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgImport,\n SvgMore,\n SvgProcess,\n SvgRefresh,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n MenuItem,\n Surface,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport {\n EmptyMessage,\n handleError,\n LoadingOverlay,\n} from \"./utils\";\nimport \"./Mapping.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport { MappingImportWizardModal } from \"./MappingImportWizardModal\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport type { GetAccessTokenFn } from \"./context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CreateTypeFromInterface } from \"../utils\";\n\nexport type IMappingTyped = CreateTypeFromInterface<Mapping>;\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n};\nexport interface MappingsProps {\n onClickAddMapping?: () => void;\n onClickMappingTitle?: (mapping: Mapping) => void;\n onClickMappingModify?: (mapping: Mapping) => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nconst fetchMappings = async (\n setMappings: React.Dispatch<React.SetStateAction<Mapping[]>>,\n iModelId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const mappings = await mappingsClient.getMappings(accessToken, iModelId);\n setMappings(mappings.sort((a, b) => a.mappingName.localeCompare(b.mappingName)));\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nconst toggleExtraction = async (\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient,\n iModelId: string,\n mapping: Mapping\n) => {\n try {\n const newState = mapping.extractionEnabled;\n const accessToken = await getAccessToken();\n await mappingsClient.updateMapping(accessToken, iModelId, mapping.id, {\n extractionEnabled: newState,\n });\n } catch (error: any) {\n handleError(error.status);\n }\n};\n\nexport const Mappings = ({\n onClickAddMapping,\n onClickMappingTitle,\n onClickMappingModify,\n displayStrings: userDisplayStrings,\n}: MappingsProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [showDeleteModal, setShowDeleteModal] = useState<Mapping | undefined>(undefined);\n const [showImportModal, setShowImportModal] = useState<boolean>(false);\n const [showBlockingOverlay, setShowBlockingOverlay] =\n useState<boolean>(false);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings, setMappings] = useState<Mapping[]>([]);\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n useEffect(() => {\n void fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setIsLoading]);\n\n const refresh = useCallback(async () => {\n setMappings([]);\n await fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setMappings]);\n\n return (\n <>\n <BlockingOverlay isVisible={showBlockingOverlay} />\n <Surface className=\"gmw-mappings-container\">\n <div className=\"gmw-table-toolbar\">\n <div className=\"gmw-button-spacing\">\n {onClickAddMapping &&\n <Button\n startIcon={<SvgAdd />}\n onClick={onClickAddMapping}\n styleType=\"high-visibility\"\n >\n New\n </Button>\n }\n <IconButton\n title={`Import ${displayStrings.mappings}`}\n onClick={() => setShowImportModal(true)}\n >\n <SvgImport />\n </IconButton>\n </div>\n <IconButton\n title=\"Refresh\"\n onClick={refresh}\n disabled={isLoading}\n styleType='borderless'\n >\n <SvgRefresh />\n </IconButton>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : mappings.length === 0 ? (\n <EmptyMessage message={`No ${displayStrings.mappings} available.`} />\n ) : (\n <div className=\"gmw-mappings-list\">\n {mappings\n .map((mapping) => (\n <HorizontalTile\n key={mapping.id}\n title={\n mapping.mappingName ? mapping.mappingName : \"Untitled\"\n }\n subText={mapping.description ?? \"\"}\n subtextToolTip={mapping.description ?? \"\"}\n titleTooltip={mapping.mappingName}\n onClickTitle={onClickMappingTitle ? () => onClickMappingTitle(mapping) : undefined}\n actionGroup={\n <DropdownMenu\n menuItems={(close: () => void) => [\n onClickMappingModify ? (\n <MenuItem\n key={0}\n onClick={() => {\n onClickMappingModify(mapping);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>\n ) : [],\n <MenuItem\n key={1}\n onClick={async () => {\n setShowBlockingOverlay(true);\n close();\n await toggleExtraction(\n getAccessToken,\n mappingClient,\n iModelId,\n mapping\n );\n await refresh();\n setShowBlockingOverlay(false);\n }}\n icon={<SvgProcess />}\n >\n {mapping.extractionEnabled\n ? \"Disable extraction\"\n : \"Enable extraction\"}\n </MenuItem>,\n <MenuItem\n key={2}\n onClick={() => {\n setShowDeleteModal(mapping);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((m) => m)}\n >\n <IconButton styleType=\"borderless\">\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n }\n />\n ))}\n </div>\n )}\n </Surface>\n <DeleteModal\n entityName={showDeleteModal?.mappingName}\n onClose={() => setShowDeleteModal(undefined)}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteMapping(\n accessToken,\n iModelId,\n showDeleteModal?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n <MappingImportWizardModal\n show={showImportModal}\n setShow={setShowImportModal}\n onFinish={refresh}\n displayStrings={displayStrings}\n />\n </>\n );\n};\n"]}
|
|
@@ -4,7 +4,6 @@ import type { CalculatedProperty, CustomCalculation, Group, GroupProperty, Mappi
|
|
|
4
4
|
export interface PropertyMenuProps {
|
|
5
5
|
mapping: Mapping;
|
|
6
6
|
group: Group;
|
|
7
|
-
color: string;
|
|
8
7
|
onClickAddGroupProperty?: () => void;
|
|
9
8
|
onClickModifyGroupProperty?: (groupProperty: GroupProperty) => void;
|
|
10
9
|
onClickAddCalculatedProperty?: () => void;
|
|
@@ -15,5 +14,5 @@ export interface PropertyMenuProps {
|
|
|
15
14
|
hideCalculatedProps?: boolean;
|
|
16
15
|
hideCustomCalculationProps?: boolean;
|
|
17
16
|
}
|
|
18
|
-
export declare const PropertyMenu: ({ mapping, group,
|
|
17
|
+
export declare const PropertyMenu: ({ mapping, group, onClickAddGroupProperty, onClickModifyGroupProperty, onClickAddCalculatedProperty, onClickModifyCalculatedProperty, onClickAddCustomCalculationProperty, onClickModifyCustomCalculation, hideGroupProps, hideCalculatedProps, hideCustomCalculationProps, }: PropertyMenuProps) => JSX.Element;
|
|
19
18
|
//# sourceMappingURL=PropertyMenu.d.ts.map
|
|
@@ -2,33 +2,21 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import {
|
|
6
|
-
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
7
|
-
import React, { useEffect, useMemo, useState } from "react";
|
|
8
|
-
import { clearEmphasizedOverriddenElements, visualizeElements, zoomToElements, } from "./viewerUtils";
|
|
5
|
+
import React, { useMemo } from "react";
|
|
9
6
|
import "./PropertyMenu.scss";
|
|
10
7
|
import { GroupPropertyTable } from "./GroupPropertyTable";
|
|
11
|
-
import { IconButton, InformationPanelWrapper, toaster, ToggleSwitch, } from "@itwin/itwinui-react";
|
|
12
8
|
import { useCombinedFetchRefresh } from "../hooks/useFetchData";
|
|
13
9
|
import { useMappingClient } from "./context/MappingClientContext";
|
|
14
10
|
import { useGroupingMappingApiConfig } from "./context/GroupingApiConfigContext";
|
|
15
|
-
import { getHiliteIdsAndKeysetFromGroup } from "./groupsHelpers";
|
|
16
|
-
import { useGroupHilitedElementsContext } from "./context/GroupHilitedElementsContext";
|
|
17
11
|
import { usePropertiesContext } from "./context/PropertiesContext";
|
|
18
12
|
import { CalculatedPropertyTable } from "./CalculatedPropertyTable";
|
|
19
13
|
import { CustomCalculationTable } from "./CustomCalculationTable";
|
|
20
|
-
|
|
21
|
-
import { GroupInformationPanel } from "./GroupInformationPanel";
|
|
22
|
-
export const PropertyMenu = ({ mapping, group, color, onClickAddGroupProperty, onClickModifyGroupProperty, onClickAddCalculatedProperty, onClickModifyCalculatedProperty, onClickAddCustomCalculationProperty, onClickModifyCustomCalculation, hideGroupProps = false, hideCalculatedProps = false, hideCustomCalculationProps = false, }) => {
|
|
14
|
+
export const PropertyMenu = ({ mapping, group, onClickAddGroupProperty, onClickModifyGroupProperty, onClickAddCalculatedProperty, onClickModifyCalculatedProperty, onClickAddCustomCalculationProperty, onClickModifyCustomCalculation, hideGroupProps = false, hideCalculatedProps = false, hideCustomCalculationProps = false, }) => {
|
|
23
15
|
const groupId = group.id;
|
|
24
16
|
const mappingId = mapping.id;
|
|
25
17
|
const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
|
|
26
|
-
const { hilitedElementsQueryCache } = useGroupHilitedElementsContext();
|
|
27
18
|
const mappingClient = useMappingClient();
|
|
28
|
-
const
|
|
29
|
-
const { showGroupColor, setShowGroupColor, groupProperties, setGroupProperties, calculatedProperties, setCalculatedProperties, customCalculationProperties, setCustomCalculationProperties, } = usePropertiesContext();
|
|
30
|
-
const [isInformationPanelOpen, setIsInformationPanelOpen] = useState(false);
|
|
31
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
19
|
+
const { groupProperties, setGroupProperties, calculatedProperties, setCalculatedProperties, customCalculationProperties, setCustomCalculationProperties, } = usePropertiesContext();
|
|
32
20
|
const fetchGroupProperties = useMemo(() => {
|
|
33
21
|
return async () => mappingClient.getGroupProperties(await getAccessToken(), iModelId, mappingId, groupId);
|
|
34
22
|
}, [getAccessToken, mappingClient, iModelId, mappingId, groupId]);
|
|
@@ -41,40 +29,9 @@ export const PropertyMenu = ({ mapping, group, color, onClickAddGroupProperty, o
|
|
|
41
29
|
return async () => mappingClient.getCustomCalculations(await getAccessToken(), iModelId, mappingId, groupId);
|
|
42
30
|
}, [getAccessToken, mappingClient, iModelId, mappingId, groupId]);
|
|
43
31
|
const { isLoading: isLoadingCustomCalculations, refreshData: refreshCustomCalculations } = useCombinedFetchRefresh(fetchCustomCalculations, setCustomCalculationProperties);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
setIsLoading(true);
|
|
50
|
-
clearEmphasizedOverriddenElements();
|
|
51
|
-
if (showGroupColor) {
|
|
52
|
-
const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);
|
|
53
|
-
Presentation.selection.clearSelection("GroupingMappingWidget", iModelConnection);
|
|
54
|
-
visualizeElements(result.ids, color);
|
|
55
|
-
await zoomToElements(result.ids);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
toaster.negative("There was an error visualizing group.");
|
|
60
|
-
/* eslint-disable no-console */
|
|
61
|
-
console.error(error);
|
|
62
|
-
}
|
|
63
|
-
finally {
|
|
64
|
-
setIsLoading(false);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
void initialize();
|
|
68
|
-
}, [iModelConnection, group.query, group.groupName, group, hilitedElementsQueryCache, showGroupColor, color]);
|
|
69
|
-
return (React.createElement(InformationPanelWrapper, { className: 'gmw-property-menu-wrapper' },
|
|
70
|
-
React.createElement("div", { className: 'gmw-property-menu-container' },
|
|
71
|
-
React.createElement("div", { className: "gmw-property-menu-toolbar" },
|
|
72
|
-
React.createElement(ToggleSwitch, { label: 'Color Group', labelPosition: 'left', disabled: isLoading, checked: showGroupColor, onChange: () => setShowGroupColor((b) => !b) }),
|
|
73
|
-
React.createElement(IconButton, { styleType: 'borderless', onClick: () => setIsInformationPanelOpen(true) },
|
|
74
|
-
React.createElement(SvgProperties, null))),
|
|
75
|
-
!hideGroupProps && (React.createElement(GroupPropertyTable, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddGroupProperty, onClickModify: onClickModifyGroupProperty, isLoading: isLoadingGroupProperties, groupProperties: groupProperties !== null && groupProperties !== void 0 ? groupProperties : [], refresh: refreshGroupProperties })),
|
|
76
|
-
!hideCalculatedProps && (React.createElement(CalculatedPropertyTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCalculatedProperty, onClickModify: onClickModifyCalculatedProperty, isLoading: isLoadingCalculatedProperties, calculatedProperties: calculatedProperties !== null && calculatedProperties !== void 0 ? calculatedProperties : [], refresh: refreshCalculatedProperties })),
|
|
77
|
-
!hideCustomCalculationProps && (React.createElement(CustomCalculationTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCustomCalculationProperty, onClickModify: onClickModifyCustomCalculation, isLoading: isLoadingCustomCalculations, customCalculations: customCalculationProperties !== null && customCalculationProperties !== void 0 ? customCalculationProperties : [], refresh: refreshCustomCalculations }))),
|
|
78
|
-
React.createElement(GroupInformationPanel, { isOpen: isInformationPanelOpen, onClose: () => setIsInformationPanelOpen(false), query: group.query, groupName: group.groupName })));
|
|
32
|
+
return (React.createElement("div", { className: 'gmw-property-menu-wrapper' },
|
|
33
|
+
!hideGroupProps && (React.createElement(GroupPropertyTable, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddGroupProperty, onClickModify: onClickModifyGroupProperty, isLoading: isLoadingGroupProperties, groupProperties: groupProperties !== null && groupProperties !== void 0 ? groupProperties : [], refresh: refreshGroupProperties })),
|
|
34
|
+
!hideCalculatedProps && (React.createElement(CalculatedPropertyTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCalculatedProperty, onClickModify: onClickModifyCalculatedProperty, isLoading: isLoadingCalculatedProperties, calculatedProperties: calculatedProperties !== null && calculatedProperties !== void 0 ? calculatedProperties : [], refresh: refreshCalculatedProperties })),
|
|
35
|
+
!hideCustomCalculationProps && (React.createElement(CustomCalculationTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCustomCalculationProperty, onClickModify: onClickModifyCustomCalculation, isLoading: isLoadingCustomCalculations, customCalculations: customCalculationProperties !== null && customCalculationProperties !== void 0 ? customCalculationProperties : [], refresh: refreshCustomCalculations }))));
|
|
79
36
|
};
|
|
80
37
|
//# sourceMappingURL=PropertyMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyMenu.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyMenu.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EACL,iCAAiC,EACjC,iBAAiB,EACjB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,OAAO,EACP,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,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AE,OAAO,EAChB,UAAU,EAAE,uBAAuB,EACnC,aAAa,EAAE,0BAA0B,EACzC,SAAS,EAAE,wBAAwB,EACnC,eAAe,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,EACtC,OAAO,EAAE,sBAAsB,GAC/B,CACH;YACA,CAAC,mBAAmB,IAAI,CACvB,oBAAC,uBAAuB,IACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,4BAA4B,EACxC,aAAa,EAAE,+BAA+B,EAC9C,SAAS,EAAE,6BAA6B,EACxC,oBAAoB,EAAE,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,EAAE,EAChD,OAAO,EAAE,2BAA2B,GACpC,CACH;YACA,CAAC,0BAA0B,IAAI,CAC9B,oBAAC,sBAAsB,IACrB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,mCAAmC,EAC/C,aAAa,EAAE,8BAA8B,EAC7C,SAAS,EAAE,2BAA2B,EACtC,kBAAkB,EAAE,2BAA2B,aAA3B,2BAA2B,cAA3B,2BAA2B,GAAI,EAAE,EACrD,OAAO,EAAE,yBAAyB,GAClC,CACH,CACG;QACN,oBAAC,qBAAqB,IACpB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAC/C,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,GAC1B,CACsB,CAC3B,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 { Presentation } from \"@itwin/presentation-frontend\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport React, { useEffect, useMemo, useState } from \"react\";\n\nimport {\n clearEmphasizedOverriddenElements,\n visualizeElements,\n zoomToElements,\n} from \"./viewerUtils\";\nimport \"./PropertyMenu.scss\";\nimport { GroupPropertyTable } from \"./GroupPropertyTable\";\nimport {\n IconButton,\n InformationPanelWrapper,\n toaster,\n ToggleSwitch,\n} from \"@itwin/itwinui-react\";\nimport { useCombinedFetchRefresh } from \"../hooks/useFetchData\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CalculatedProperty, CustomCalculation, Group, GroupProperty, Mapping } from \"@itwin/insights-client\";\nimport { getHiliteIdsAndKeysetFromGroup } from \"./groupsHelpers\";\nimport { useGroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { usePropertiesContext } from \"./context/PropertiesContext\";\nimport { CalculatedPropertyTable } from \"./CalculatedPropertyTable\";\nimport { CustomCalculationTable } from \"./CustomCalculationTable\";\nimport { SvgProperties } from \"@itwin/itwinui-icons-react\";\nimport { GroupInformationPanel } from \"./GroupInformationPanel\";\n\nexport interface PropertyMenuProps {\n mapping: Mapping;\n group: Group;\n color: string;\n onClickAddGroupProperty?: () => void;\n onClickModifyGroupProperty?: (groupProperty: GroupProperty) => void;\n onClickAddCalculatedProperty?: () => void;\n onClickModifyCalculatedProperty?: (calculatedProperty: CalculatedProperty) => void;\n onClickAddCustomCalculationProperty?: () => void;\n onClickModifyCustomCalculation?: (customCalculation: CustomCalculation) => void;\n hideGroupProps?: boolean;\n hideCalculatedProps?: boolean;\n hideCustomCalculationProps?: boolean;\n}\n\nexport const PropertyMenu = ({\n mapping,\n group,\n color,\n onClickAddGroupProperty,\n onClickModifyGroupProperty,\n onClickAddCalculatedProperty,\n onClickModifyCalculatedProperty,\n onClickAddCustomCalculationProperty,\n onClickModifyCustomCalculation,\n hideGroupProps = false,\n hideCalculatedProps = false,\n hideCustomCalculationProps = false,\n}: PropertyMenuProps) => {\n const groupId = group.id;\n const mappingId = mapping.id;\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const { hilitedElementsQueryCache } = useGroupHilitedElementsContext();\n const mappingClient = useMappingClient();\n const iModelConnection = useActiveIModelConnection();\n const {\n showGroupColor,\n setShowGroupColor,\n groupProperties,\n setGroupProperties,\n calculatedProperties,\n setCalculatedProperties,\n customCalculationProperties,\n setCustomCalculationProperties,\n } = usePropertiesContext();\n const [isInformationPanelOpen, setIsInformationPanelOpen] =\n useState<boolean>(false);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n const fetchGroupProperties = useMemo(\n () => {\n return async () => mappingClient.getGroupProperties(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingGroupProperties, refreshData: refreshGroupProperties } =\n useCombinedFetchRefresh<GroupProperty>(fetchGroupProperties, setGroupProperties);\n\n const fetchCalculatedProperties = useMemo(\n () => {\n return async () => mappingClient.getCalculatedProperties(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCalculatedProperties, refreshData: refreshCalculatedProperties } =\n useCombinedFetchRefresh<CalculatedProperty>(fetchCalculatedProperties, setCalculatedProperties);\n\n const fetchCustomCalculations = useMemo(\n () => {\n return async () => mappingClient.getCustomCalculations(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCustomCalculations, refreshData: refreshCustomCalculations } =\n useCombinedFetchRefresh<CustomCalculation>(fetchCustomCalculations, setCustomCalculationProperties);\n\n useEffect(() => {\n const initialize = async () => {\n if (!iModelConnection) return;\n try {\n setIsLoading(true);\n clearEmphasizedOverriddenElements();\n if (showGroupColor) {\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);\n Presentation.selection.clearSelection(\n \"GroupingMappingWidget\",\n iModelConnection,\n );\n visualizeElements(result.ids, color);\n await zoomToElements(result.ids);\n }\n } catch (error) {\n toaster.negative(\"There was an error visualizing group.\");\n /* eslint-disable no-console */\n console.error(error);\n } finally {\n setIsLoading(false);\n }\n };\n void initialize();\n }, [iModelConnection, group.query, group.groupName, group, hilitedElementsQueryCache, showGroupColor, color]);\n\n return (\n <InformationPanelWrapper className='gmw-property-menu-wrapper'>\n <div className='gmw-property-menu-container'>\n <div className=\"gmw-property-menu-toolbar\">\n <ToggleSwitch\n label='Color Group'\n labelPosition='left'\n disabled={isLoading}\n checked={showGroupColor}\n onChange={() => setShowGroupColor((b) => !b)}\n ></ToggleSwitch>\n <IconButton\n styleType='borderless'\n onClick={() => setIsInformationPanelOpen(true)}\n >\n <SvgProperties />\n </IconButton>\n </div>\n {!hideGroupProps && (\n <GroupPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddGroupProperty}\n onClickModify={onClickModifyGroupProperty}\n isLoading={isLoadingGroupProperties}\n groupProperties={groupProperties ?? []}\n refresh={refreshGroupProperties}\n />\n )}\n {!hideCalculatedProps && (\n <CalculatedPropertyTable\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddCalculatedProperty}\n onClickModify={onClickModifyCalculatedProperty}\n isLoading={isLoadingCalculatedProperties}\n calculatedProperties={calculatedProperties ?? []}\n refresh={refreshCalculatedProperties}\n />\n )}\n {!hideCustomCalculationProps && (\n <CustomCalculationTable\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddCustomCalculationProperty}\n onClickModify={onClickModifyCustomCalculation}\n isLoading={isLoadingCustomCalculations}\n customCalculations={customCalculationProperties ?? []}\n refresh={refreshCustomCalculations}\n />\n )}\n </div>\n <GroupInformationPanel\n isOpen={isInformationPanelOpen}\n onClose={() => setIsInformationPanelOpen(false)}\n query={group.query}\n groupName={group.groupName}\n />\n </InformationPanelWrapper>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyMenu.js","sourceRoot":"","sources":["../../../../src/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AS,EACpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,uBAAuB,EACnC,aAAa,EAAE,0BAA0B,EACzC,SAAS,EAAE,wBAAwB,EACnC,eAAe,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,EACtC,OAAO,EAAE,sBAAsB,GAC/B,CACH;QACA,CAAC,mBAAmB,IAAI,CACvB,oBAAC,uBAAuB,IACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,4BAA4B,EACxC,aAAa,EAAE,+BAA+B,EAC9C,SAAS,EAAE,6BAA6B,EACxC,oBAAoB,EAAE,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,EAAE,EAChD,OAAO,EAAE,2BAA2B,GACpC,CACH;QACA,CAAC,0BAA0B,IAAI,CAC9B,oBAAC,sBAAsB,IACrB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,mCAAmC,EAC/C,aAAa,EAAE,8BAA8B,EAC7C,SAAS,EAAE,2BAA2B,EACtC,kBAAkB,EAAE,2BAA2B,aAA3B,2BAA2B,cAA3B,2BAA2B,GAAI,EAAE,EACrD,OAAO,EAAE,yBAAyB,GAClC,CACH,CACG,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, { useMemo } from \"react\";\nimport \"./PropertyMenu.scss\";\nimport { GroupPropertyTable } from \"./GroupPropertyTable\";\nimport { useCombinedFetchRefresh } from \"../hooks/useFetchData\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CalculatedProperty, CustomCalculation, Group, GroupProperty, Mapping } from \"@itwin/insights-client\";\nimport { usePropertiesContext } from \"./context/PropertiesContext\";\nimport { CalculatedPropertyTable } from \"./CalculatedPropertyTable\";\nimport { CustomCalculationTable } from \"./CustomCalculationTable\";\n\nexport interface PropertyMenuProps {\n mapping: Mapping;\n group: Group;\n onClickAddGroupProperty?: () => void;\n onClickModifyGroupProperty?: (groupProperty: GroupProperty) => void;\n onClickAddCalculatedProperty?: () => void;\n onClickModifyCalculatedProperty?: (calculatedProperty: CalculatedProperty) => void;\n onClickAddCustomCalculationProperty?: () => void;\n onClickModifyCustomCalculation?: (customCalculation: CustomCalculation) => void;\n hideGroupProps?: boolean;\n hideCalculatedProps?: boolean;\n hideCustomCalculationProps?: boolean;\n}\n\nexport const PropertyMenu = ({\n mapping,\n group,\n onClickAddGroupProperty,\n onClickModifyGroupProperty,\n onClickAddCalculatedProperty,\n onClickModifyCalculatedProperty,\n onClickAddCustomCalculationProperty,\n onClickModifyCustomCalculation,\n hideGroupProps = false,\n hideCalculatedProps = false,\n hideCustomCalculationProps = false,\n}: PropertyMenuProps) => {\n const groupId = group.id;\n const mappingId = mapping.id;\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const {\n groupProperties,\n setGroupProperties,\n calculatedProperties,\n setCalculatedProperties,\n customCalculationProperties,\n setCustomCalculationProperties,\n } = usePropertiesContext();\n\n const fetchGroupProperties = useMemo(\n () => {\n return async () => mappingClient.getGroupProperties(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingGroupProperties, refreshData: refreshGroupProperties } =\n useCombinedFetchRefresh<GroupProperty>(fetchGroupProperties, setGroupProperties);\n\n const fetchCalculatedProperties = useMemo(\n () => {\n return async () => mappingClient.getCalculatedProperties(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCalculatedProperties, refreshData: refreshCalculatedProperties } =\n useCombinedFetchRefresh<CalculatedProperty>(fetchCalculatedProperties, setCalculatedProperties);\n\n const fetchCustomCalculations = useMemo(\n () => {\n return async () => mappingClient.getCustomCalculations(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCustomCalculations, refreshData: refreshCustomCalculations } =\n useCombinedFetchRefresh<CustomCalculation>(fetchCustomCalculations, setCustomCalculationProperties);\n\n return (\n <div className='gmw-property-menu-wrapper'>\n {!hideGroupProps && (\n <GroupPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddGroupProperty}\n onClickModify={onClickModifyGroupProperty}\n isLoading={isLoadingGroupProperties}\n groupProperties={groupProperties ?? []}\n refresh={refreshGroupProperties}\n />\n )}\n {!hideCalculatedProps && (\n <CalculatedPropertyTable\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddCalculatedProperty}\n onClickModify={onClickModifyCalculatedProperty}\n isLoading={isLoadingCalculatedProperties}\n calculatedProperties={calculatedProperties ?? []}\n refresh={refreshCalculatedProperties}\n />\n )}\n {!hideCustomCalculationProps && (\n <CustomCalculationTable\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddCustomCalculationProperty}\n onClickModify={onClickModifyCustomCalculation}\n isLoading={isLoadingCustomCalculations}\n customCalculations={customCalculationProperties ?? []}\n refresh={refreshCustomCalculations}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -7,21 +7,6 @@
|
|
|
7
7
|
.gmw-property-menu-wrapper {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.gmw-property-header {
|
|
13
|
-
display: flex;
|
|
14
|
-
justify-content: space-between;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.gmw-property-menu-container {
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
overflow: auto;
|
|
21
|
-
gap: $iui-baseline * 2;
|
|
22
|
-
.gmw-property-menu-toolbar {
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: space-between;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
gap: $iui-baseline * 2;
|
|
27
12
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PropertyMenuProps } from "./PropertyMenu";
|
|
3
|
+
import "./PropertyMenuWithVisualization.scss";
|
|
4
|
+
export interface PropertyMenuWithVisualizationProps extends PropertyMenuProps {
|
|
5
|
+
color: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const PropertyMenuWithVisualization: ({ group, color, ...rest }: PropertyMenuWithVisualizationProps) => JSX.Element;
|
|
8
|
+
//# sourceMappingURL=PropertyMenuWithVisualization.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React, { useState } from "react";
|
|
6
|
+
import { PropertyMenu } from "./PropertyMenu";
|
|
7
|
+
import { GroupColorToggle } from "./GroupColorToggle";
|
|
8
|
+
import { IconButton, InformationPanelWrapper } from "@itwin/itwinui-react";
|
|
9
|
+
import { GroupInformationPanel } from "./GroupInformationPanel";
|
|
10
|
+
import { SvgProperties } from "@itwin/itwinui-icons-react";
|
|
11
|
+
import "./PropertyMenuWithVisualization.scss";
|
|
12
|
+
export const PropertyMenuWithVisualization = ({ group, color, ...rest }) => {
|
|
13
|
+
const [isInformationPanelOpen, setIsInformationPanelOpen] = useState(false);
|
|
14
|
+
return (React.createElement(InformationPanelWrapper, { className: 'gmw-property-menu-vis-wrapper' },
|
|
15
|
+
React.createElement("div", { className: "gmw-property-menu-vis-toolbar" },
|
|
16
|
+
React.createElement(GroupColorToggle, { group: group, color: color, labelPosition: "left" }),
|
|
17
|
+
React.createElement(IconButton, { styleType: 'borderless', onClick: () => setIsInformationPanelOpen(true) },
|
|
18
|
+
React.createElement(SvgProperties, null))),
|
|
19
|
+
React.createElement(PropertyMenu, { group: group, ...rest }),
|
|
20
|
+
React.createElement(GroupInformationPanel, { isOpen: isInformationPanelOpen, onClose: () => setIsInformationPanelOpen(false), query: group.query, groupName: group.groupName })));
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=PropertyMenuWithVisualization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyMenuWithVisualization.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyMenuWithVisualization.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,sCAAsC,CAAC;AAM9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAC5C,KAAK,EACL,KAAK,EACL,GAAG,IAAI,EAC4B,EAAE,EAAE;IACvC,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAErF,OAAO,CACL,oBAAC,uBAAuB,IAAC,SAAS,EAAC,+BAA+B;QAChE,6BAAK,SAAS,EAAC,+BAA+B;YAC5C,oBAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAC,MAAM,GAAG;YACrE,oBAAC,UAAU,IACT,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC;gBAE9C,oBAAC,aAAa,OAAG,CACN,CACT;QACN,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,KAAM,IAAI,GAAI;QACxC,oBAAC,qBAAqB,IACpB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAC/C,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,GAC1B,CACsB,CAC3B,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, { useState } from \"react\";\nimport type { PropertyMenuProps } from \"./PropertyMenu\";\nimport { PropertyMenu } from \"./PropertyMenu\";\nimport { GroupColorToggle } from \"./GroupColorToggle\";\nimport { IconButton, InformationPanelWrapper } from \"@itwin/itwinui-react\";\nimport { GroupInformationPanel } from \"./GroupInformationPanel\";\nimport { SvgProperties } from \"@itwin/itwinui-icons-react\";\nimport \"./PropertyMenuWithVisualization.scss\";\n\nexport interface PropertyMenuWithVisualizationProps extends PropertyMenuProps {\n color: string;\n}\n\nexport const PropertyMenuWithVisualization = ({\n group,\n color,\n ...rest\n}: PropertyMenuWithVisualizationProps) => {\n const [isInformationPanelOpen, setIsInformationPanelOpen] = useState<boolean>(false);\n\n return (\n <InformationPanelWrapper className='gmw-property-menu-vis-wrapper'>\n <div className=\"gmw-property-menu-vis-toolbar\">\n <GroupColorToggle group={group} color={color} labelPosition=\"left\" />\n <IconButton\n styleType='borderless'\n onClick={() => setIsInformationPanelOpen(true)}\n >\n <SvgProperties />\n </IconButton>\n </div>\n <PropertyMenu group={group} {...rest} />\n <GroupInformationPanel\n isOpen={isInformationPanelOpen}\n onClose={() => setIsInformationPanelOpen(false)}\n query={group.query}\n groupName={group.groupName}\n />\n </InformationPanelWrapper>\n );\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
|
+
|
|
7
|
+
.gmw-property-menu-vis-wrapper {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: $iui-baseline;
|
|
11
|
+
flex-grow: 1;
|
|
12
|
+
.gmw-property-menu-vis-toolbar {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { GroupingCustomUI } from "./customUI/GroupingMappingCustomUI";
|
|
3
|
+
import type { Group } from "@itwin/insights-client";
|
|
3
4
|
export interface QueryBuilderCustomUIProps {
|
|
4
5
|
queryGenerationType: string;
|
|
5
6
|
groupUIs: GroupingCustomUI[];
|
|
6
7
|
isUpdating: boolean;
|
|
7
8
|
resetView: () => Promise<void>;
|
|
8
9
|
setQuery: (query: string) => void;
|
|
10
|
+
group?: Group;
|
|
9
11
|
}
|
|
10
|
-
export declare const QueryBuilderCustomUI: ({ queryGenerationType, groupUIs, isUpdating, resetView, setQuery, }: QueryBuilderCustomUIProps) => JSX.Element;
|
|
12
|
+
export declare const QueryBuilderCustomUI: ({ queryGenerationType, groupUIs, isUpdating, resetView, setQuery, group, }: QueryBuilderCustomUIProps) => JSX.Element;
|
|
11
13
|
//# sourceMappingURL=QueryBuilderCustomUI.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { EmptyMessage } from "./utils";
|
|
7
|
-
export const QueryBuilderCustomUI = ({ queryGenerationType, groupUIs, isUpdating, resetView, setQuery, }) => {
|
|
7
|
+
export const QueryBuilderCustomUI = ({ queryGenerationType, groupUIs, isUpdating, resetView, setQuery, group, }) => {
|
|
8
8
|
if (queryGenerationType && queryGenerationType.length > 0) {
|
|
9
9
|
const selectedCustomUI = groupUIs.find((e) => e.name === queryGenerationType);
|
|
10
10
|
if (selectedCustomUI) {
|
|
@@ -12,6 +12,7 @@ export const QueryBuilderCustomUI = ({ queryGenerationType, groupUIs, isUpdating
|
|
|
12
12
|
updateQuery: setQuery,
|
|
13
13
|
isUpdating,
|
|
14
14
|
resetView,
|
|
15
|
+
initialEditModeQuery: group === null || group === void 0 ? void 0 : group.query,
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBuilderCustomUI.js","sourceRoot":"","sources":["../../../../src/widget/components/QueryBuilderCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"QueryBuilderCustomUI.js","sourceRoot":"","sources":["../../../../src/widget/components/QueryBuilderCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAYvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,QAAQ,EACR,KAAK,GACqB,EAAE,EAAE;IAC9B,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;QACzD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;QAC9E,IAAI,gBAAgB,EAAE;YACpB,OAAO,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,WAAW,EAAE;gBACvD,WAAW,EAAE,QAAQ;gBACrB,UAAU;gBACV,SAAS;gBACT,oBAAoB,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;aACnC,CAAC,CAAC;SACJ;KACF;IACD,OAAO,oBAAC,YAAY,IAAC,OAAO,EAAC,uCAAuC,GAAG,CAAC;AAC1E,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 type { GroupingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport { EmptyMessage } from \"./utils\";\nimport type { Group } from \"@itwin/insights-client\";\n\nexport interface QueryBuilderCustomUIProps {\n queryGenerationType: string;\n groupUIs: GroupingCustomUI[];\n isUpdating: boolean;\n resetView: () => Promise<void>;\n setQuery: (query: string) => void;\n group?: Group;\n}\n\nexport const QueryBuilderCustomUI = ({\n queryGenerationType,\n groupUIs,\n isUpdating,\n resetView,\n setQuery,\n group,\n}: QueryBuilderCustomUIProps) => {\n if (queryGenerationType && queryGenerationType.length > 0) {\n const selectedCustomUI = groupUIs.find((e) => e.name === queryGenerationType);\n if (selectedCustomUI) {\n return React.createElement(selectedCustomUI.uiComponent, {\n updateQuery: setQuery,\n isUpdating,\n resetView,\n initialEditModeQuery: group?.query,\n });\n }\n }\n return <EmptyMessage message=\"No query generation method selected. \" />;\n};\n"]}
|
|
@@ -6,11 +6,12 @@ declare const defaultDisplayStrings: {
|
|
|
6
6
|
groupBy: string;
|
|
7
7
|
};
|
|
8
8
|
export interface QueryBuilderStepProps extends QueryBuilderCustomUIProps {
|
|
9
|
+
queryRowCount: number;
|
|
9
10
|
isHidden: boolean;
|
|
10
11
|
onChange: (value: string) => Promise<void>;
|
|
11
12
|
getOptions: SelectOption<string>[];
|
|
12
13
|
displayStrings?: Partial<typeof defaultDisplayStrings>;
|
|
13
14
|
}
|
|
14
|
-
export declare const QueryBuilderStep: ({ isHidden, onChange, getOptions, displayStrings: userDisplayStrings, ...rest }: QueryBuilderStepProps) => JSX.Element;
|
|
15
|
+
export declare const QueryBuilderStep: ({ queryRowCount, isHidden, onChange, getOptions, displayStrings: userDisplayStrings, ...rest }: QueryBuilderStepProps) => JSX.Element;
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=QueryBuilderStep.d.ts.map
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { ComboBox, Fieldset, Label } from "@itwin/itwinui-react";
|
|
6
|
+
import { ComboBox, Fieldset, Label, Text } from "@itwin/itwinui-react";
|
|
7
7
|
import { QueryBuilderCustomUI } from "./QueryBuilderCustomUI";
|
|
8
8
|
import "./QueryBuilderStep.scss";
|
|
9
9
|
const defaultDisplayStrings = {
|
|
10
10
|
groupBy: "Group By",
|
|
11
11
|
};
|
|
12
|
-
export const QueryBuilderStep = ({ isHidden, onChange, getOptions, displayStrings: userDisplayStrings, ...rest }) => {
|
|
12
|
+
export const QueryBuilderStep = ({ queryRowCount, isHidden, onChange, getOptions, displayStrings: userDisplayStrings, ...rest }) => {
|
|
13
13
|
const containerClassName = isHidden ? "gmw-hide" : "gmw-query-builder-container";
|
|
14
14
|
const displayStrings = React.useMemo(() => ({ ...defaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);
|
|
15
15
|
return (React.createElement(Fieldset, { legend: displayStrings.groupBy, className: containerClassName },
|
|
@@ -18,6 +18,7 @@ export const QueryBuilderStep = ({ isHidden, onChange, getOptions, displayString
|
|
|
18
18
|
React.createElement(ComboBox, { value: rest.queryGenerationType, inputProps: {
|
|
19
19
|
id: "query-combo-input",
|
|
20
20
|
}, options: getOptions, onChange: onChange })),
|
|
21
|
+
React.createElement(Text, null, `Row Count: ${queryRowCount}`),
|
|
21
22
|
React.createElement(QueryBuilderCustomUI, { ...rest })));
|
|
22
23
|
};
|
|
23
24
|
//# sourceMappingURL=QueryBuilderStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBuilderStep.js","sourceRoot":"","sources":["../../../../src/widget/components/QueryBuilderStep.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"QueryBuilderStep.js","sourceRoot":"","sources":["../../../../src/widget/components/QueryBuilderStep.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,yBAAyB,CAAC;AAEjC,MAAM,qBAAqB,GAAG;IAC5B,OAAO,EAAE,UAAU;CACpB,CAAC;AAUF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,IAAI,EAAyB,EAAE,EAAE;IACxJ,MAAM,kBAAkB,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,6BAA6B,CAAC;IAEjF,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAClC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,qBAAqB,EAAE,GAAG,kBAAkB,EAAE,CAAC,EAC3D,CAAC,kBAAkB,CAAC,CACrB,CAAC;IAEF,OAAO,CACL,oBAAC,QAAQ,IAAC,MAAM,EAAE,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,kBAAkB;QACrE;YACE,oBAAC,KAAK,IAAC,OAAO,EAAC,mBAAmB,4BAA8B;YAChE,oBAAC,QAAQ,IACP,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAC/B,UAAU,EAAE;oBACV,EAAE,EAAE,mBAAmB;iBACxB,EACD,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,GAClB,CACG;QACP,oBAAC,IAAI,QAAE,cAAc,aAAa,EAAE,CAAQ;QAC5C,oBAAC,oBAAoB,OACf,IAAI,GACR,CACO,CACZ,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 type { SelectOption } from \"@itwin/itwinui-react\";\nimport { ComboBox, Fieldset, Label, Text } from \"@itwin/itwinui-react\";\nimport type { QueryBuilderCustomUIProps } from \"./QueryBuilderCustomUI\";\nimport { QueryBuilderCustomUI } from \"./QueryBuilderCustomUI\";\nimport \"./QueryBuilderStep.scss\";\n\nconst defaultDisplayStrings = {\n groupBy: \"Group By\",\n};\n\nexport interface QueryBuilderStepProps extends QueryBuilderCustomUIProps {\n queryRowCount: number;\n isHidden: boolean;\n onChange: (value: string) => Promise<void>;\n getOptions: SelectOption<string>[];\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nexport const QueryBuilderStep = ({ queryRowCount, isHidden, onChange, getOptions, displayStrings: userDisplayStrings, ...rest }: QueryBuilderStepProps) => {\n const containerClassName = isHidden ? \"gmw-hide\" : \"gmw-query-builder-container\";\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n return (\n <Fieldset legend={displayStrings.groupBy} className={containerClassName}>\n <span>\n <Label htmlFor='query-combo-input'>Query Generation Tool</Label>\n <ComboBox\n value={rest.queryGenerationType}\n inputProps={{\n id: \"query-combo-input\",\n }}\n options={getOptions}\n onChange={onChange}\n />\n </span>\n <Text>{`Row Count: ${queryRowCount}`}</Text>\n <QueryBuilderCustomUI\n {...rest}\n />\n </Fieldset>\n );\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CalculatedPropertyType } from "@itwin/insights-client";
|
|
3
|
+
import type { SelectOption } from "@itwin/itwinui-react";
|
|
4
|
+
import type SimpleReactValidator from "simple-react-validator";
|
|
5
|
+
interface SharedCalculatedPropertyFormsProps {
|
|
6
|
+
propertyName: string;
|
|
7
|
+
setPropertyName: (value: string) => void;
|
|
8
|
+
type: CalculatedPropertyType | undefined;
|
|
9
|
+
setType: (value: CalculatedPropertyType | undefined) => void;
|
|
10
|
+
validator: SimpleReactValidator;
|
|
11
|
+
itemRenderer?: (option: SelectOption<string>) => JSX.Element;
|
|
12
|
+
selectedItemRenderer?: (option: SelectOption<string>) => JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export declare const SharedCalculatedPropertyForms: ({ propertyName, setPropertyName, type, setType, validator, itemRenderer, selectedItemRenderer, }: SharedCalculatedPropertyFormsProps) => JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=SharedCalculatedPropertyForms.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { CalculatedPropertyType, } from "@itwin/insights-client";
|
|
6
|
+
import React, { useCallback } from "react";
|
|
7
|
+
import { NAME_REQUIREMENTS } from "../hooks/useValidator";
|
|
8
|
+
import { LabeledInput, LabeledSelect } from "@itwin/itwinui-react";
|
|
9
|
+
export const SharedCalculatedPropertyForms = ({ propertyName, setPropertyName, type, setType, validator, itemRenderer, selectedItemRenderer, }) => {
|
|
10
|
+
const generateOptionsFromCalculatedPropertyType = useCallback(() => {
|
|
11
|
+
const options = [];
|
|
12
|
+
const indexableEnum = CalculatedPropertyType;
|
|
13
|
+
for (const key in indexableEnum) {
|
|
14
|
+
if (typeof indexableEnum[key] === "string" && key !== "Undefined") {
|
|
15
|
+
// Generate labels by adding space between capitals
|
|
16
|
+
const label = key
|
|
17
|
+
.replace(/([A-Z])/g, " $1")
|
|
18
|
+
.trim()
|
|
19
|
+
.replace(/^\w/, (c) => c.toUpperCase());
|
|
20
|
+
options.push({ value: indexableEnum[key], label });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return options;
|
|
24
|
+
}, []);
|
|
25
|
+
return (React.createElement(React.Fragment, null,
|
|
26
|
+
React.createElement(LabeledInput, { value: propertyName, required: true, name: "name", label: "Name", onChange: (event) => {
|
|
27
|
+
setPropertyName(event.target.value);
|
|
28
|
+
validator.showMessageFor("name");
|
|
29
|
+
}, message: validator.message("name", propertyName, NAME_REQUIREMENTS), status: validator.message("name", propertyName, NAME_REQUIREMENTS)
|
|
30
|
+
? "negative"
|
|
31
|
+
: undefined, onBlur: () => {
|
|
32
|
+
validator.showMessageFor("name");
|
|
33
|
+
}, onBlurCapture: (event) => {
|
|
34
|
+
setPropertyName(event.target.value);
|
|
35
|
+
validator.showMessageFor("name");
|
|
36
|
+
} }),
|
|
37
|
+
React.createElement(LabeledSelect, { label: "Quantity Type", required: true, options: generateOptionsFromCalculatedPropertyType(), value: type, onChange: setType, itemRenderer: itemRenderer, selectedItemRenderer: selectedItemRenderer, onShow: () => { }, onHide: () => { } })));
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=SharedCalculatedPropertyForms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedCalculatedPropertyForms.js","sourceRoot":"","sources":["../../../../src/widget/components/SharedCalculatedPropertyForms.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EACL,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAanE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAC5C,YAAY,EACZ,eAAe,EACf,IAAI,EACJ,OAAO,EACP,SAAS,EACT,YAAY,EACZ,oBAAoB,GACe,EAAE,EAAE;IAEvC,MAAM,yCAAyC,GAAG,WAAW,CAAC,GAAG,EAAE;QACjE,MAAM,OAAO,GAA2C,EAAE,CAAC;QAE3D,MAAM,aAAa,GAAG,sBAA8D,CAAC;QAErF,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;YAC/B,IAAI,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,KAAK,WAAW,EAAE;gBACjE,mDAAmD;gBACnD,MAAM,KAAK,GAAG,GAAG;qBACd,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;qBAC1B,IAAI,EAAE;qBACN,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC1C,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,GAAG,CAA2B,EAAE,KAAK,EAAE,CAAC,CAAC;aAC9E;SACF;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL;QACE,oBAAC,YAAY,IACX,KAAK,EAAE,YAAY,EACnB,QAAQ,QACR,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAClB,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,EACD,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,EACnE,MAAM,EACJ,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC;gBACxD,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,SAAS,EAEf,MAAM,EAAE,GAAG,EAAE;gBACX,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,GACD;QACF,oBAAC,aAAa,IACZ,KAAK,EAAC,eAAe,EACrB,QAAQ,QACR,OAAO,EAAE,yCAAyC,EAAE,EACpD,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACD,CACJ,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 {\n CalculatedPropertyType,\n} from \"@itwin/insights-client\";\nimport React, { useCallback } from \"react\";\nimport { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { LabeledInput, LabeledSelect } from \"@itwin/itwinui-react\";\nimport type SimpleReactValidator from \"simple-react-validator\";\n\ninterface SharedCalculatedPropertyFormsProps {\n propertyName: string;\n setPropertyName: (value: string) => void;\n type: CalculatedPropertyType | undefined;\n setType: (value: CalculatedPropertyType | undefined) => void;\n validator: SimpleReactValidator;\n itemRenderer?: (option: SelectOption<string>) => JSX.Element;\n selectedItemRenderer?: (option: SelectOption<string>) => JSX.Element;\n}\n\nexport const SharedCalculatedPropertyForms = ({\n propertyName,\n setPropertyName,\n type,\n setType,\n validator,\n itemRenderer,\n selectedItemRenderer,\n}: SharedCalculatedPropertyFormsProps) => {\n\n const generateOptionsFromCalculatedPropertyType = useCallback(() => {\n const options: SelectOption<CalculatedPropertyType>[] = [];\n\n const indexableEnum = CalculatedPropertyType as unknown as { [key: string]: string };\n\n for (const key in indexableEnum) {\n if (typeof indexableEnum[key] === \"string\" && key !== \"Undefined\") {\n // Generate labels by adding space between capitals\n const label = key\n .replace(/([A-Z])/g, \" $1\")\n .trim()\n .replace(/^\\w/, (c) => c.toUpperCase());\n options.push({ value: indexableEnum[key] as CalculatedPropertyType, label });\n }\n }\n return options;\n }, []);\n\n return (\n <>\n <LabeledInput\n value={propertyName}\n required\n name=\"name\"\n label=\"Name\"\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", propertyName, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledSelect<CalculatedPropertyType>\n label=\"Quantity Type\"\n required\n options={generateOptionsFromCalculatedPropertyType()}\n value={type}\n onChange={setType}\n itemRenderer={itemRenderer}\n selectedItemRenderer={selectedItemRenderer}\n onShow={() => { }}\n onHide={() => { }}\n />\n </>\n );\n};\n"]}
|
|
@@ -8,11 +8,11 @@ export interface QueryCacheItem {
|
|
|
8
8
|
}
|
|
9
9
|
export interface GroupHilitedElements {
|
|
10
10
|
hilitedElementsQueryCache: MutableRefObject<Map<string, QueryCacheItem>>;
|
|
11
|
-
hiddenGroupsIds: string
|
|
11
|
+
hiddenGroupsIds: Set<string>;
|
|
12
12
|
showGroupColor: boolean;
|
|
13
13
|
groups: Group[];
|
|
14
14
|
setGroups: (groups: Group[]) => void;
|
|
15
|
-
setHiddenGroupsIds: (hiddenGroupIds: string
|
|
15
|
+
setHiddenGroupsIds: (hiddenGroupIds: Set<string>) => void;
|
|
16
16
|
setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;
|
|
17
17
|
}
|
|
18
18
|
export declare const GroupHilitedElementsContext: React.Context<GroupHilitedElements>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
export const GroupHilitedElementsContext = React.createContext({
|
|
7
7
|
hilitedElementsQueryCache: { current: new Map() },
|
|
8
|
-
hiddenGroupsIds:
|
|
8
|
+
hiddenGroupsIds: new Set(),
|
|
9
9
|
showGroupColor: false,
|
|
10
10
|
groups: [],
|
|
11
11
|
setGroups: () => { },
|
|
@@ -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"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { AccessToken } from "@itwin/core-bentley";
|
|
2
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
export declare type ClientPrefix = "" | "dev" | "qa" | undefined;
|
|
4
5
|
export declare type GetAccessTokenFn = () => Promise<AccessToken>;
|
|
5
6
|
export interface GroupingMappingApiConfig {
|
|
6
7
|
getAccessToken: GetAccessTokenFn;
|
|
7
8
|
iModelId: string;
|
|
9
|
+
iModelConnection?: IModelConnection;
|
|
8
10
|
prefix?: ClientPrefix;
|
|
9
11
|
}
|
|
10
12
|
export declare const GroupingMappingApiConfigContext: React.Context<GroupingMappingApiConfig>;
|
|
@@ -4,6 +4,7 @@ export const GroupingMappingApiConfigContext = createContext({
|
|
|
4
4
|
getAccessToken: async () => "",
|
|
5
5
|
iModelId: "",
|
|
6
6
|
prefix: undefined,
|
|
7
|
+
iModelConnection: undefined,
|
|
7
8
|
});
|
|
8
9
|
export const useGroupingMappingApiConfig = () => {
|
|
9
10
|
const context = React.useContext(GroupingMappingApiConfigContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingApiConfigContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingApiConfigContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GroupingApiConfigContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingApiConfigContext.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAWtC,MAAM,CAAC,MAAM,+BAA+B,GAC1C,aAAa,CAA2B;IACtC,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE;IAC9B,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,SAAS;IACjB,gBAAgB,EAAE,SAAS;CAC5B,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC;IAClE,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,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 type { AccessToken } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport * as React from \"react\";\nimport { createContext } from \"react\";\n\nexport type ClientPrefix = \"\" | \"dev\" | \"qa\" | undefined;\nexport type GetAccessTokenFn = () => Promise<AccessToken>;\nexport interface GroupingMappingApiConfig {\n getAccessToken: GetAccessTokenFn;\n iModelId: string;\n iModelConnection?: IModelConnection;\n prefix?: ClientPrefix;\n}\n\nexport const GroupingMappingApiConfigContext =\n createContext<GroupingMappingApiConfig>({\n getAccessToken: async () => \"\",\n iModelId: \"\",\n prefix: undefined,\n iModelConnection: undefined,\n });\n\nexport const useGroupingMappingApiConfig = () => {\n const context = React.useContext(GroupingMappingApiConfigContext);\n if (!context) {\n throw new Error(\n \"useGroupingMappingApiConfig should be used within a GroupingMappingApiConfigContext provider\"\n );\n }\n return context;\n};\n"]}
|