@itwin/grouping-mapping-widget 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/widget/components/GroupAction.js +1 -1
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.js +4 -6
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +7 -0
- package/lib/cjs/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/cjs/widget/components/{GroupTile.js → HorizontalTile.js} +6 -6
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -0
- package/lib/{esm/widget/components/GroupTile.scss → cjs/widget/components/HorizontalTile.scss} +2 -2
- package/lib/cjs/widget/components/Mapping.js +37 -57
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.scss +21 -7
- package/lib/cjs/widget/components/SelectProject.js +28 -20
- package/lib/cjs/widget/components/SelectProject.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +12 -12
- package/lib/cjs/widget/components/property-grid/PropertyList.js +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.js +5 -5
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +13 -62
- package/lib/esm/widget/components/GroupAction.js +1 -1
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/Grouping.js +4 -6
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +7 -0
- package/lib/esm/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/esm/widget/components/{GroupTile.js → HorizontalTile.js} +4 -4
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -0
- package/lib/{cjs/widget/components/GroupTile.scss → esm/widget/components/HorizontalTile.scss} +2 -2
- package/lib/esm/widget/components/Mapping.js +40 -60
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.scss +21 -7
- package/lib/esm/widget/components/SelectProject.js +30 -22
- package/lib/esm/widget/components/SelectProject.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +12 -12
- package/lib/esm/widget/components/property-grid/PropertyList.js +1 -1
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.js +5 -5
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.scss +13 -62
- package/package.json +1 -1
- package/lib/cjs/widget/components/GroupTile.d.ts +0 -13
- package/lib/cjs/widget/components/GroupTile.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +0 -16
- package/lib/esm/widget/components/GroupTile.d.ts +0 -13
- package/lib/esm/widget/components/GroupTile.js.map +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +0 -16
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalTile.js","sourceRoot":"","sources":["../../../../src/widget/components/HorizontalTile.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,uBAAuB,CAAC;AAW/B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAsB,EAAE,EAAE;IAEhI,OAAO,CACL,6BAAK,SAAS,EAAC,+BAA+B,iBAAa,qBAAqB;QAC9E,6BAAK,SAAS,EAAC,MAAM;YACnB,oBAAC,IAAI,IAAC,SAAS,EAAE,aAAa,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,YAAY,IAAG,KAAK,CAAQ;YAC1I,OAAO,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAC,WAAW,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAC,OAAO,IAAE,OAAO,CAAQ,CAC1G;QACN,6BAAK,SAAS,EAAC,eAAe,iBAAa,oBAAoB,IAC5D,WAAW,CACR,CACF,CACP,CAAC;AAEJ,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 { ReactNode } from \"react\";\nimport React from \"react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport \"./HorizontalTile.scss\";\n\ninterface HorizontalTileProps {\n title: string;\n actionGroup: ReactNode;\n subText?: string;\n onClickTitle?: () => void;\n titleTooltip?: string;\n subtextToolTip?: string;\n}\n\nexport const HorizontalTile = ({ title, subText, onClickTitle, titleTooltip, subtextToolTip, actionGroup}: HorizontalTileProps) => {\n\n return (\n <div className=\"gmw-horizontal-tile-container\" data-testid=\"gmw-horizontal-tile\">\n <div className=\"body\">\n <Text className={`body-text ${onClickTitle ? \"iui-anchor\" : \"\"}`} onClick={onClickTitle} variant=\"body\" title={titleTooltip}>{title}</Text>\n {subText && <Text className=\"body-text\" isMuted={true} title={subtextToolTip} variant=\"small\">{subText}</Text>}\n </div>\n <div className=\"action-button\" data-testid=\"tile-action-button\">\n {actionGroup}\n </div>\n </div>\n );\n\n};\n"]}
|
package/lib/{cjs/widget/components/GroupTile.scss → esm/widget/components/HorizontalTile.scss}
RENAMED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import '~@itwin/itwinui-css/scss/variables';
|
|
6
6
|
|
|
7
|
-
.gmw-
|
|
7
|
+
.gmw-horizontal-tile-container {
|
|
8
8
|
display: flex;
|
|
9
9
|
justify-content: space-between;
|
|
10
10
|
border-radius: 5px;
|
|
11
11
|
background-color: var(--iui-color-background-2);
|
|
12
12
|
height: $iui-baseline * 4;
|
|
13
|
-
padding: 5.5px
|
|
13
|
+
padding: 5.5px $iui-s;
|
|
14
14
|
.body {
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { Presentation } from "@itwin/presentation-frontend";
|
|
6
6
|
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
7
7
|
import { SvgAdd, SvgDelete, SvgEdit, SvgImport, SvgMore, SvgProcess, } from "@itwin/itwinui-icons-react";
|
|
8
|
-
import { Button,
|
|
9
|
-
import React, { useCallback, useEffect,
|
|
10
|
-
import { handleError, onSelectionChanged, WidgetHeader } from "./utils";
|
|
8
|
+
import { Button, DropdownMenu, IconButton, MenuItem, Surface, } from "@itwin/itwinui-react";
|
|
9
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
10
|
+
import { EmptyMessage, handleError, LoadingOverlay, onSelectionChanged, WidgetHeader } from "./utils";
|
|
11
11
|
import "./Mapping.scss";
|
|
12
12
|
import DeleteModal from "./DeleteModal";
|
|
13
13
|
import { Groupings } from "./Grouping";
|
|
@@ -15,6 +15,7 @@ import MappingAction from "./MappingAction";
|
|
|
15
15
|
import { MappingImportWizardModal } from "./MappingImportWizardModal";
|
|
16
16
|
import { useMappingClient } from "./context/MappingClientContext";
|
|
17
17
|
import { BlockingOverlay } from "./BlockingOverlay";
|
|
18
|
+
import { HorizontalTile } from "./HorizontalTile";
|
|
18
19
|
import { clearAll } from "./viewerUtils";
|
|
19
20
|
import { useGroupingMappingApiConfig } from "./context/GroupingApiConfigContext";
|
|
20
21
|
var MappingView;
|
|
@@ -81,58 +82,6 @@ export const Mappings = () => {
|
|
|
81
82
|
const addMapping = async () => {
|
|
82
83
|
setMappingView(MappingView.ADDING);
|
|
83
84
|
};
|
|
84
|
-
const mappingsColumns = useMemo(() => [
|
|
85
|
-
{
|
|
86
|
-
Header: "Table",
|
|
87
|
-
columns: [
|
|
88
|
-
{
|
|
89
|
-
id: "mappingName",
|
|
90
|
-
Header: "Mapping Name",
|
|
91
|
-
accessor: "mappingName",
|
|
92
|
-
Cell: (value) => (React.createElement("div", { className: "iui-anchor", onClick: () => {
|
|
93
|
-
setSelectedMapping(value.row.original);
|
|
94
|
-
setMappingView(MappingView.GROUPS);
|
|
95
|
-
} }, value.row.original.mappingName)),
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: "description",
|
|
99
|
-
Header: "Description",
|
|
100
|
-
accessor: "description",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: "dropdown",
|
|
104
|
-
Header: "",
|
|
105
|
-
width: 80,
|
|
106
|
-
Cell: (value) => {
|
|
107
|
-
return (React.createElement(DropdownMenu, { menuItems: (close) => [
|
|
108
|
-
React.createElement(MenuItem, { key: 0, onClick: () => {
|
|
109
|
-
setSelectedMapping(value.row.original);
|
|
110
|
-
setMappingView(MappingView.MODIFYING);
|
|
111
|
-
}, icon: React.createElement(SvgEdit, null) }, "Modify"),
|
|
112
|
-
React.createElement(MenuItem, { key: 1, onClick: async () => {
|
|
113
|
-
setSelectedMapping(value.row.original);
|
|
114
|
-
setShowBlockingOverlay(true);
|
|
115
|
-
close();
|
|
116
|
-
await toggleExtraction(getAccessToken, mappingClient, iModelId, value.row.original);
|
|
117
|
-
await refresh();
|
|
118
|
-
setShowBlockingOverlay(false);
|
|
119
|
-
}, icon: React.createElement(SvgProcess, null) }, value.row.original.extractionEnabled ? "Disable extraction" : "Enable extraction"),
|
|
120
|
-
React.createElement(MenuItem, { key: 2, onClick: () => {
|
|
121
|
-
setSelectedMapping(value.row.original);
|
|
122
|
-
setShowDeleteModal(true);
|
|
123
|
-
close();
|
|
124
|
-
}, icon: React.createElement(SvgDelete, null) }, "Remove"),
|
|
125
|
-
] },
|
|
126
|
-
React.createElement(IconButton, { styleType: "borderless" },
|
|
127
|
-
React.createElement(SvgMore, { style: {
|
|
128
|
-
width: "16px",
|
|
129
|
-
height: "16px",
|
|
130
|
-
} }))));
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
},
|
|
135
|
-
], [getAccessToken, mappingClient, iModelId, refresh]);
|
|
136
85
|
switch (mappingView) {
|
|
137
86
|
case MappingView.ADDING:
|
|
138
87
|
return React.createElement(MappingAction, { iModelId: iModelId, returnFn: refresh });
|
|
@@ -144,13 +93,44 @@ export const Mappings = () => {
|
|
|
144
93
|
return (React.createElement(React.Fragment, null,
|
|
145
94
|
React.createElement(BlockingOverlay, { isVisible: showBlockingOverlay }),
|
|
146
95
|
React.createElement(WidgetHeader, { title: "Mappings" }),
|
|
147
|
-
React.createElement(
|
|
96
|
+
React.createElement(Surface, { className: "gmw-mappings-container" },
|
|
148
97
|
React.createElement("div", { className: "table-toolbar" },
|
|
149
|
-
React.createElement(
|
|
150
|
-
|
|
151
|
-
React.createElement(IconButton, { title: "Import Mappings" },
|
|
98
|
+
React.createElement("div", { className: "gmw-button-spacing" },
|
|
99
|
+
React.createElement(Button, { startIcon: React.createElement(SvgAdd, null), onClick: async () => addMapping(), styleType: "high-visibility" }, "New"),
|
|
100
|
+
React.createElement(IconButton, { title: "Import Mappings", onClick: () => setShowImportModal(true) },
|
|
152
101
|
React.createElement(SvgImport, null)))),
|
|
153
|
-
React.createElement(
|
|
102
|
+
isLoading ? (React.createElement(LoadingOverlay, null)) : mappings.length === 0 ? (React.createElement(EmptyMessage, { message: "No Mappings available." })) : (React.createElement("div", { className: "mappings-list" }, mappings
|
|
103
|
+
.sort((a, b) => { var _a, _b, _c; return (_c = (_a = a.mappingName) === null || _a === void 0 ? void 0 : _a.localeCompare((_b = b.mappingName) !== null && _b !== void 0 ? _b : "")) !== null && _c !== void 0 ? _c : 1; })
|
|
104
|
+
.map((mapping) => {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
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: () => {
|
|
107
|
+
setSelectedMapping(mapping);
|
|
108
|
+
setMappingView(MappingView.GROUPS);
|
|
109
|
+
}, actionGroup: React.createElement(DropdownMenu, { menuItems: (close) => [
|
|
110
|
+
React.createElement(MenuItem, { key: 0, onClick: () => {
|
|
111
|
+
setSelectedMapping(mapping);
|
|
112
|
+
setMappingView(MappingView.MODIFYING);
|
|
113
|
+
}, icon: React.createElement(SvgEdit, null) }, "Modify"),
|
|
114
|
+
React.createElement(MenuItem, { key: 1, onClick: async () => {
|
|
115
|
+
setSelectedMapping(mapping);
|
|
116
|
+
setShowBlockingOverlay(true);
|
|
117
|
+
close();
|
|
118
|
+
await toggleExtraction(getAccessToken, mappingClient, iModelId, mapping);
|
|
119
|
+
await refresh();
|
|
120
|
+
setShowBlockingOverlay(false);
|
|
121
|
+
}, icon: React.createElement(SvgProcess, null) }, mapping.extractionEnabled ? "Disable extraction" : "Enable extraction"),
|
|
122
|
+
React.createElement(MenuItem, { key: 2, onClick: () => {
|
|
123
|
+
setSelectedMapping(mapping);
|
|
124
|
+
setShowDeleteModal(true);
|
|
125
|
+
close();
|
|
126
|
+
}, icon: React.createElement(SvgDelete, null) }, "Remove"),
|
|
127
|
+
] },
|
|
128
|
+
React.createElement(IconButton, { styleType: "borderless" },
|
|
129
|
+
React.createElement(SvgMore, { style: {
|
|
130
|
+
width: "16px",
|
|
131
|
+
height: "16px",
|
|
132
|
+
} }))) }));
|
|
133
|
+
})))),
|
|
154
134
|
React.createElement(DeleteModal, { entityName: (_b = selectedMapping === null || selectedMapping === void 0 ? void 0 : selectedMapping.mappingName) !== null && _b !== void 0 ? _b : "", show: showDeleteModal, setShow: setShowDeleteModal, onDelete: async () => {
|
|
155
135
|
var _a;
|
|
156
136
|
const accessToken = await getAccessToken();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../../src/widget/components/Mapping.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,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,KAAK,GACN,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,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,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OA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;gBACN,oBAAC,WAAW,IACV,UAAU,EAAE,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,mCAAI,EAAE,EAC9C,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,KAAK,IAAI,EAAE;;wBACnB,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;wBAC3C,MAAM,aAAa,CAAC,aAAa,CAC/B,WAAW,EACX,QAAQ,EACR,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,mCAAI,EAAE,CAC1B,CAAC;oBACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB;gBACF,oBAAC,wBAAwB,IACvB,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,OAAO,GACjB,CACD,CACJ,CAAC;KACL;AACH,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 {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgImport,\n SvgMore,\n SvgProcess,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n ButtonGroup,\n DropdownMenu,\n IconButton,\n MenuItem,\n Table,\n} from \"@itwin/itwinui-react\";\nimport type { CellProps } from \"react-table\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../utils\";\nimport { handleError, onSelectionChanged, WidgetHeader } from \"./utils\";\nimport \"./Mapping.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport { Groupings } from \"./Grouping\";\nimport MappingAction from \"./MappingAction\";\nimport { MappingImportWizardModal } from \"./MappingImportWizardModal\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport { clearAll } from \"./viewerUtils\";\nimport type { IMappingClient } from \"../IMappingClient\";\nimport type { GetAccessTokenFn } from \"./context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nexport type MappingType = CreateTypeFromInterface<Mapping>;\n\nenum MappingView {\n MAPPINGS = \"mappings\",\n GROUPS = \"groups\",\n ADDING = \"adding\",\n MODIFYING = \"modifying\",\n IMPORT = \"import\",\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 mappingClient: IMappingClient,\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const mappings = await mappingClient.getMappings(accessToken, iModelId);\n setMappings(mappings);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nconst toggleExtraction = async (\n getAccessToken: GetAccessTokenFn,\n mappingClient: IMappingClient,\n iModelId: string,\n mapping: Mapping\n) => {\n try {\n const newState = !mapping?.extractionEnabled;\n const accessToken = await getAccessToken();\n await mappingClient.updateMapping(\n accessToken,\n iModelId,\n mapping?.id ?? \"\",\n { extractionEnabled: newState }\n );\n } catch (error: any) {\n handleError(error.status);\n }\n};\n\nexport const Mappings = () => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const iModelId = useActiveIModelConnection()?.iModelId as string;\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [showImportModal, setShowImportModal] = useState<boolean>(false);\n const [showBlockingOverlay, setShowBlockingOverlay] = useState<boolean>(false);\n const [mappingView, setMappingView] = useState<MappingView>(\n MappingView.MAPPINGS\n );\n const [selectedMapping, setSelectedMapping] = useState<Mapping | undefined>(undefined);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings, setMappings] = useState<Mapping[]>([]);\n\n useEffect(() => {\n void fetchMappings(setMappings, iModelId, setIsLoading, getAccessToken, mappingClient);\n }, [getAccessToken, mappingClient, iModelId, setIsLoading]);\n\n useEffect(() => {\n const removeListener =\n Presentation.selection.selectionChange.addListener(onSelectionChanged);\n return () => {\n removeListener();\n };\n }, []);\n\n const refresh = useCallback(async () => {\n clearAll();\n setMappingView(MappingView.MAPPINGS);\n setSelectedMapping(undefined);\n setMappings([]);\n await fetchMappings(setMappings, iModelId, setIsLoading, getAccessToken, mappingClient);\n }, [getAccessToken, mappingClient, iModelId, setMappings]);\n\n const addMapping = async () => {\n setMappingView(MappingView.ADDING);\n };\n\n const mappingsColumns = useMemo(\n () => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"mappingName\",\n Header: \"Mapping Name\",\n accessor: \"mappingName\",\n Cell: (value: CellProps<{ mappingName: string }>) => (\n <div\n className=\"iui-anchor\"\n onClick={() => {\n setSelectedMapping(value.row.original);\n setMappingView(MappingView.GROUPS);\n }}\n >\n {value.row.original.mappingName}\n </div>\n ),\n },\n {\n id: \"description\",\n Header: \"Description\",\n accessor: \"description\",\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<MappingType>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) => [\n <MenuItem\n key={0}\n onClick={() => {\n setSelectedMapping(value.row.original);\n setMappingView(MappingView.MODIFYING);\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n\n <MenuItem\n key={1}\n onClick={async () => {\n setSelectedMapping(value.row.original);\n setShowBlockingOverlay(true);\n close();\n await toggleExtraction(getAccessToken, mappingClient, iModelId, value.row.original);\n await refresh();\n setShowBlockingOverlay(false);\n }}\n icon={<SvgProcess />}\n >\n {value.row.original.extractionEnabled ? \"Disable extraction\" : \"Enable extraction\"}\n </MenuItem>,\n\n <MenuItem\n key={2}\n onClick={() => {\n setSelectedMapping(value.row.original);\n setShowDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ]}\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 ],\n },\n ],\n [getAccessToken, mappingClient, iModelId, refresh]\n );\n\n switch (mappingView) {\n case MappingView.ADDING:\n return <MappingAction iModelId={iModelId} returnFn={refresh} />;\n case MappingView.MODIFYING:\n return (\n <MappingAction\n iModelId={iModelId}\n mapping={selectedMapping}\n returnFn={refresh}\n />\n );\n case MappingView.GROUPS:\n return (\n <Groupings\n mapping={selectedMapping as Mapping}\n goBack={refresh}\n />\n );\n default:\n return (\n <>\n <BlockingOverlay isVisible={showBlockingOverlay} />\n <WidgetHeader title=\"Mappings\" />\n <div className=\"mappings-container\">\n <div className=\"table-toolbar\">\n <Button\n startIcon={<SvgAdd />}\n onClick={async () => addMapping()}\n styleType=\"high-visibility\"\n >\n New\n </Button>\n <ButtonGroup onClick={() => setShowImportModal(true)}>\n <IconButton title=\"Import Mappings\">\n <SvgImport />\n </IconButton>\n </ButtonGroup>\n </div>\n <Table<MappingType>\n data={mappings}\n density=\"extra-condensed\"\n columns={mappingsColumns}\n emptyTableContent=\"No Mappings available.\"\n isSortable\n isLoading={isLoading}\n />\n </div>\n <DeleteModal\n entityName={selectedMapping?.mappingName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteMapping(\n accessToken,\n iModelId,\n selectedMapping?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n <MappingImportWizardModal\n show={showImportModal}\n setShow={setShowImportModal}\n onFinish={refresh}\n />\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,EAA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I,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,OAAO,GACjB,CACD,CACJ,CAAC;KACL;AACH,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 {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgImport,\n SvgMore,\n SvgProcess,\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 type { CreateTypeFromInterface } from \"../utils\";\nimport { EmptyMessage, handleError, LoadingOverlay, onSelectionChanged, WidgetHeader } from \"./utils\";\nimport \"./Mapping.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport { Groupings } from \"./Grouping\";\nimport MappingAction from \"./MappingAction\";\nimport { MappingImportWizardModal } from \"./MappingImportWizardModal\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport { clearAll } from \"./viewerUtils\";\nimport type { IMappingClient } from \"../IMappingClient\";\nimport type { GetAccessTokenFn } from \"./context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nexport type MappingType = CreateTypeFromInterface<Mapping>;\n\nenum MappingView {\n MAPPINGS = \"mappings\",\n GROUPS = \"groups\",\n ADDING = \"adding\",\n MODIFYING = \"modifying\",\n IMPORT = \"import\",\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 mappingClient: IMappingClient,\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const mappings = await mappingClient.getMappings(accessToken, iModelId);\n setMappings(mappings);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nconst toggleExtraction = async (\n getAccessToken: GetAccessTokenFn,\n mappingClient: IMappingClient,\n iModelId: string,\n mapping: Mapping\n) => {\n try {\n const newState = !mapping?.extractionEnabled;\n const accessToken = await getAccessToken();\n await mappingClient.updateMapping(\n accessToken,\n iModelId,\n mapping?.id ?? \"\",\n { extractionEnabled: newState }\n );\n } catch (error: any) {\n handleError(error.status);\n }\n};\n\nexport const Mappings = () => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const iModelId = useActiveIModelConnection()?.iModelId as string;\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [showImportModal, setShowImportModal] = useState<boolean>(false);\n const [showBlockingOverlay, setShowBlockingOverlay] = useState<boolean>(false);\n const [mappingView, setMappingView] = useState<MappingView>(\n MappingView.MAPPINGS\n );\n const [selectedMapping, setSelectedMapping] = useState<Mapping | undefined>(undefined);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings, setMappings] = useState<Mapping[]>([]);\n\n useEffect(() => {\n void fetchMappings(setMappings, iModelId, setIsLoading, getAccessToken, mappingClient);\n }, [getAccessToken, mappingClient, iModelId, setIsLoading]);\n\n useEffect(() => {\n const removeListener =\n Presentation.selection.selectionChange.addListener(onSelectionChanged);\n return () => {\n removeListener();\n };\n }, []);\n\n const refresh = useCallback(async () => {\n clearAll();\n setMappingView(MappingView.MAPPINGS);\n setSelectedMapping(undefined);\n setMappings([]);\n await fetchMappings(setMappings, iModelId, setIsLoading, getAccessToken, mappingClient);\n }, [getAccessToken, mappingClient, iModelId, setMappings]);\n\n const addMapping = async () => {\n setMappingView(MappingView.ADDING);\n };\n\n switch (mappingView) {\n case MappingView.ADDING:\n return <MappingAction iModelId={iModelId} returnFn={refresh} />;\n case MappingView.MODIFYING:\n return (\n <MappingAction\n iModelId={iModelId}\n mapping={selectedMapping}\n returnFn={refresh}\n />\n );\n case MappingView.GROUPS:\n return (\n <Groupings\n mapping={selectedMapping as Mapping}\n goBack={refresh}\n />\n );\n default:\n return (\n <>\n <BlockingOverlay isVisible={showBlockingOverlay} />\n <WidgetHeader title=\"Mappings\" />\n <Surface className=\"gmw-mappings-container\">\n <div className=\"table-toolbar\">\n <div className = \"gmw-button-spacing\">\n <Button\n startIcon={<SvgAdd />}\n onClick={async () => addMapping()}\n styleType=\"high-visibility\"\n >\n New\n </Button>\n <IconButton title=\"Import Mappings\"\n onClick={() => setShowImportModal(true)}>\n <SvgImport />\n </IconButton>\n </div>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : mappings.length === 0 ? (\n <EmptyMessage message=\"No Mappings available.\" />\n ) : (\n <div className = \"mappings-list\">\n {mappings\n .sort((a, b) => a.mappingName?.localeCompare(b.mappingName ?? \"\") ?? 1)\n .map((mapping) => (\n <HorizontalTile\n key = {mapping.id}\n title = {mapping.mappingName ? mapping.mappingName: \"Untitled\"}\n subText = {mapping.description ?? \"\"}\n subtextToolTip = {mapping.description ?? \"\"}\n titleTooltip={mapping.mappingName}\n onClickTitle={() => {\n setSelectedMapping(mapping);\n setMappingView(MappingView.GROUPS);\n }}\n actionGroup = {\n <DropdownMenu\n menuItems={(close: () => void) => [\n <MenuItem\n key={0}\n onClick={() => {\n setSelectedMapping(mapping);\n setMappingView(MappingView.MODIFYING);\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n <MenuItem\n key={1}\n onClick={async () => {\n setSelectedMapping(mapping);\n setShowBlockingOverlay(true);\n close();\n await toggleExtraction(getAccessToken, mappingClient, iModelId, mapping);\n await refresh();\n setShowBlockingOverlay(false);\n }}\n icon={<SvgProcess />}\n >\n {mapping.extractionEnabled ? \"Disable extraction\" : \"Enable extraction\"}\n </MenuItem>,\n <MenuItem\n key={2}\n onClick={() => {\n setSelectedMapping(mapping);\n setShowDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ]}\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={selectedMapping?.mappingName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteMapping(\n accessToken,\n iModelId,\n selectedMapping?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n <MappingImportWizardModal\n show={showImportModal}\n setShow={setShowImportModal}\n onFinish={refresh}\n />\n </>\n );\n }\n};\n"]}
|
|
@@ -4,23 +4,37 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import '~@itwin/itwinui-css/scss/variables';
|
|
6
6
|
|
|
7
|
-
.mappings-container {
|
|
7
|
+
.gmw-mappings-container {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
|
-
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
padding: $iui-baseline $iui-m;
|
|
12
|
+
min-height: 0;;
|
|
11
13
|
|
|
12
14
|
.table-toolbar {
|
|
13
15
|
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
14
17
|
gap: $iui-s;
|
|
18
|
+
border-bottom: 1px solid var(--iui-color-background-4);
|
|
19
|
+
padding-bottom: $iui-baseline;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
|
|
22
|
+
.gmw-button-spacing {
|
|
23
|
+
display: flex;
|
|
24
|
+
gap: $iui-s;
|
|
25
|
+
}
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
button {
|
|
18
29
|
align-self: flex-start;
|
|
19
30
|
}
|
|
20
|
-
}
|
|
21
31
|
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
.mappings-list {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
overflow-y: overlay;
|
|
36
|
+
gap: 7.5px;
|
|
37
|
+
margin-top: 7.5px;
|
|
38
|
+
}
|
|
26
39
|
}
|
|
40
|
+
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ProjectGrid
|
|
2
|
-
import { SvgCalendar, SvgList, SvgSearch, SvgStarHollow, } from "@itwin/itwinui-icons-react";
|
|
1
|
+
import { ProjectGrid } from "@itwin/imodel-browser-react";
|
|
2
|
+
import { SvgCalendar, SvgClose, SvgList, SvgSearch, SvgStarHollow, } from "@itwin/itwinui-icons-react";
|
|
3
3
|
import { Button, HorizontalTabs, IconButton, LabeledInput, Tab, } from "@itwin/itwinui-react";
|
|
4
4
|
import React, { useCallback, useEffect, useState } from "react";
|
|
5
5
|
import { useGroupingMappingApiConfig } from "./context/GroupingApiConfigContext";
|
|
6
6
|
import "./SelectProject.scss";
|
|
7
7
|
const tabsWithIcons = [
|
|
8
|
-
React.createElement(Tab, { key:
|
|
9
|
-
React.createElement(Tab, { key:
|
|
10
|
-
React.createElement(Tab, { key:
|
|
8
|
+
React.createElement(Tab, { key: "favorite", label: "Favorite projects", startIcon: React.createElement(SvgStarHollow, null) }),
|
|
9
|
+
React.createElement(Tab, { key: "recents", label: "Recent projects", startIcon: React.createElement(SvgCalendar, null) }),
|
|
10
|
+
React.createElement(Tab, { key: "all", label: "My projects", startIcon: React.createElement(SvgList, null) }),
|
|
11
11
|
];
|
|
12
12
|
const SelectProject = ({ onSelect, onCancel }) => {
|
|
13
13
|
const { getAccessToken, prefix } = useGroupingMappingApiConfig();
|
|
@@ -15,7 +15,10 @@ const SelectProject = ({ onSelect, onCancel }) => {
|
|
|
15
15
|
const [searchInput, setSearchInput] = useState("");
|
|
16
16
|
const [activeSearchInput, setActiveSearchInput] = useState("");
|
|
17
17
|
const [accessToken, setAccessToken] = useState();
|
|
18
|
-
const [apiOverrides, setApiOverrides] = useState({
|
|
18
|
+
const [apiOverrides, setApiOverrides] = useState({
|
|
19
|
+
serverEnvironmentPrefix: prefix,
|
|
20
|
+
});
|
|
21
|
+
const [searched, setSearched] = useState(false);
|
|
19
22
|
useEffect(() => setApiOverrides({ serverEnvironmentPrefix: prefix }), [prefix]);
|
|
20
23
|
useEffect(() => {
|
|
21
24
|
const fetchAccessToken = async () => {
|
|
@@ -26,29 +29,34 @@ const SelectProject = ({ onSelect, onCancel }) => {
|
|
|
26
29
|
}, [getAccessToken]);
|
|
27
30
|
const startSearch = useCallback(() => {
|
|
28
31
|
setActiveSearchInput(searchInput);
|
|
32
|
+
setSearched(true);
|
|
29
33
|
}, [searchInput]);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
const clearSearch = useCallback(() => {
|
|
35
|
+
setSearchInput("");
|
|
36
|
+
setActiveSearchInput("");
|
|
37
|
+
setSearched(false);
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (searchInput.length === 0) {
|
|
41
|
+
setSearched(false);
|
|
42
|
+
clearSearch();
|
|
43
|
+
}
|
|
44
|
+
}, [searchInput, setSearched, clearSearch]);
|
|
45
|
+
return (React.createElement("div", { className: "select-project-grid-container" },
|
|
46
|
+
React.createElement(HorizontalTabs, { labels: tabsWithIcons, onTabSelected: setProjectType, activeIndex: projectType, type: "borderless", contentClassName: "grid-holding-tab" },
|
|
47
|
+
React.createElement(LabeledInput, { displayStyle: "inline", iconDisplayStyle: "inline", className: "search-input", label: "Search", value: searchInput, placeholder: "Search....", onChange: (event) => {
|
|
33
48
|
const { target: { value }, } = event;
|
|
34
49
|
setSearchInput(value);
|
|
35
50
|
}, onKeyDown: (event) => {
|
|
36
51
|
if (event.key === "Enter") {
|
|
37
52
|
startSearch();
|
|
38
53
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
React.createElement("div", { className: 'project-grid' },
|
|
46
|
-
React.createElement(ProjectGrid, { onThumbnailClick: onSelect, accessToken: accessToken, apiOverrides: apiOverrides, filterOptions: activeSearchInput, requestType: projectType === 0
|
|
47
|
-
? "favorites"
|
|
48
|
-
: projectType === 1
|
|
49
|
-
? "recents"
|
|
50
|
-
: "" })),
|
|
51
|
-
React.createElement("div", { className: 'select-project-action-panel' },
|
|
54
|
+
}, svgIcon: searched ? (React.createElement(IconButton, { onClick: clearSearch, styleType: "borderless" },
|
|
55
|
+
React.createElement(SvgClose, null))) : (React.createElement(IconButton, { onClick: startSearch, styleType: "borderless" },
|
|
56
|
+
React.createElement(SvgSearch, null))) })),
|
|
57
|
+
React.createElement("div", { className: "project-grid" },
|
|
58
|
+
React.createElement(ProjectGrid, { onThumbnailClick: onSelect, accessToken: accessToken, apiOverrides: apiOverrides, filterOptions: activeSearchInput, requestType: projectType === 0 ? "favorites" : projectType === 1 ? "recents" : "" })),
|
|
59
|
+
React.createElement("div", { className: "select-project-action-panel" },
|
|
52
60
|
React.createElement(Button, { onClick: onCancel }, "Cancel"))));
|
|
53
61
|
};
|
|
54
62
|
export default SelectProject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectProject.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectProject.tsx"],"names":[],"mappings":"AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectProject.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectProject.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,cAAc,EACd,UAAU,EACV,YAAY,EACZ,GAAG,GACJ,MAAM,sBAAsB,CAAC;AA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AK,EAAE,WAAW,EAClB,WAAW,EAAC,YAAY,EACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,MAAM,EACJ,MAAM,EAAE,EAAE,KAAK,EAAE,GAClB,GAAG,KAAK,CAAC;oBACV,cAAc,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC,EACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;oBACnB,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;wBACzB,WAAW,EAAE,CAAC;qBACf;gBACH,CAAC,EACD,OAAO,EACL,QAAQ,CAAC,CAAC,CAAC,CACT,oBAAC,UAAU,IAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAC,YAAY;oBACtD,oBAAC,QAAQ,OAAG,CACD,CACd,CAAC,CAAC,CAAC,CACF,oBAAC,UAAU,IAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAC,YAAY;oBACtD,oBAAC,SAAS,OAAG,CACF,CACd,GAEH,CACa;QACjB,6BAAK,SAAS,EAAC,cAAc;YAC3B,oBAAC,WAAW,IACV,gBAAgB,EAAE,QAAQ,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,iBAAiB,EAChC,WAAW,EACT,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAEtE,CACE;QACN,6BAAK,SAAS,EAAC,6BAA6B;YAC1C,oBAAC,MAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,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 {\n ApiOverrides,\n IModelFull,\n ProjectFull,\n} from \"@itwin/imodel-browser-react\";\nimport { ProjectGrid } from \"@itwin/imodel-browser-react\";\nimport {\n SvgCalendar,\n SvgClose,\n SvgList,\n SvgSearch,\n SvgStarHollow,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n HorizontalTabs,\n IconButton,\n LabeledInput,\n Tab,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport \"./SelectProject.scss\";\n\nconst tabsWithIcons = [\n <Tab\n key=\"favorite\"\n label=\"Favorite projects\"\n startIcon={<SvgStarHollow />}\n />,\n <Tab key=\"recents\" label=\"Recent projects\" startIcon={<SvgCalendar />} />,\n <Tab key=\"all\" label=\"My projects\" startIcon={<SvgList />} />,\n];\ninterface SelectProjectProps {\n onSelect: (project: ProjectFull) => void;\n onCancel: () => void;\n}\nconst SelectProject = ({ onSelect, onCancel }: SelectProjectProps) => {\n const { getAccessToken, prefix } = useGroupingMappingApiConfig();\n const [projectType, setProjectType] = useState<number>(0);\n const [searchInput, setSearchInput] = useState<string>(\"\");\n const [activeSearchInput, setActiveSearchInput] = useState<string>(\"\");\n const [accessToken, setAccessToken] = useState<AccessToken>();\n const [apiOverrides, setApiOverrides] = useState<ApiOverrides<IModelFull[]>>({\n serverEnvironmentPrefix: prefix,\n });\n const [searched, setSearched] = useState<boolean>(false);\n\n useEffect(\n () => setApiOverrides({ serverEnvironmentPrefix: prefix }),\n [prefix]\n );\n\n useEffect(() => {\n const fetchAccessToken = async () => {\n const accessToken = await getAccessToken();\n setAccessToken(accessToken);\n };\n void fetchAccessToken();\n }, [getAccessToken]);\n\n const startSearch = useCallback(() => {\n setActiveSearchInput(searchInput);\n setSearched(true);\n }, [searchInput]);\n\n const clearSearch = useCallback(() => {\n setSearchInput(\"\");\n setActiveSearchInput(\"\");\n setSearched(false);\n }, []);\n\n useEffect(() => {\n if (searchInput.length === 0) {\n setSearched(false);\n clearSearch();\n }\n }, [searchInput, setSearched, clearSearch]);\n\n return (\n <div className=\"select-project-grid-container\">\n <HorizontalTabs\n labels={tabsWithIcons}\n onTabSelected={setProjectType}\n activeIndex={projectType}\n type={\"borderless\"}\n contentClassName=\"grid-holding-tab\"\n >\n <LabeledInput\n displayStyle=\"inline\"\n iconDisplayStyle=\"inline\"\n className=\"search-input\"\n label=\"Search\"\n value={searchInput}\n placeholder=\"Search....\"\n onChange={(event) => {\n const {\n target: { value },\n } = event;\n setSearchInput(value);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n startSearch();\n }\n }}\n svgIcon={\n searched ? (\n <IconButton onClick={clearSearch} styleType=\"borderless\">\n <SvgClose />\n </IconButton>\n ) : (\n <IconButton onClick={startSearch} styleType=\"borderless\">\n <SvgSearch />\n </IconButton>\n )\n }\n />\n </HorizontalTabs>\n <div className=\"project-grid\">\n <ProjectGrid\n onThumbnailClick={onSelect}\n accessToken={accessToken}\n apiOverrides={apiOverrides}\n filterOptions={activeSearchInput}\n requestType={\n projectType === 0 ? \"favorites\" : projectType === 1 ? \"recents\" : \"\"\n }\n />\n </div>\n <div className=\"select-project-action-panel\">\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectProject;\n"]}
|
|
@@ -138,13 +138,13 @@ export class PropertyGrid extends React.Component {
|
|
|
138
138
|
render() {
|
|
139
139
|
var _a, _b;
|
|
140
140
|
if (this.state.loadStart) {
|
|
141
|
-
return (React.createElement("div", { className: "
|
|
141
|
+
return (React.createElement("div", { className: "gmw-components-property-grid-loader" },
|
|
142
142
|
React.createElement(ProgressRadial, { indeterminate: true })));
|
|
143
143
|
}
|
|
144
|
-
return (React.createElement("div", { className: "table-box-inner" },
|
|
145
|
-
React.createElement(PropertyGridEventsRelatedPropsSupplier, { isPropertySelectionEnabled: (_a = this.props.isPropertySelectionEnabled) !== null && _a !== void 0 ? _a : false, isPropertySelectionOnRightClickEnabled: this.props.isPropertySelectionOnRightClickEnabled, isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, isPropertyHoverEnabled: (_b = this.props.isPropertyHoverEnabled) !== null && _b !== void 0 ? _b : false, onPropertyContextMenu: this.props.onPropertyContextMenu, onPropertyUpdated: this.props.onPropertyUpdated, onPropertySelectionChanged: this.props.onPropertySelectionChanged }, (selectionContext) => (React.createElement("div", { className: classnames("components-property-grid-wrapper", this.props.className), style: this.props.style },
|
|
146
|
-
React.createElement("div", { className: classnames("components-property-grid", "components-smallEditor-host") },
|
|
147
|
-
React.createElement("div", { className: "property-categories" }, this.state.categories.map((categorizedRecords) => (React.createElement(NestedCategoryBlock, { ...selectionContext, key: categorizedRecords.category.name, categorizedRecords: categorizedRecords, onCategoryExpansionToggled: this._onCategoryExpansionToggled, orientation: this.state.orientation, propertyValueRendererManager: this.props.propertyValueRendererManager, actionButtonRenderers: this.props.actionButtonRenderers }))))),
|
|
144
|
+
return (React.createElement("div", { className: "gmw-table-box-inner" },
|
|
145
|
+
React.createElement(PropertyGridEventsRelatedPropsSupplier, { isPropertySelectionEnabled: (_a = this.props.isPropertySelectionEnabled) !== null && _a !== void 0 ? _a : false, isPropertySelectionOnRightClickEnabled: this.props.isPropertySelectionOnRightClickEnabled, isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, isPropertyHoverEnabled: (_b = this.props.isPropertyHoverEnabled) !== null && _b !== void 0 ? _b : false, onPropertyContextMenu: this.props.onPropertyContextMenu, onPropertyUpdated: this.props.onPropertyUpdated, onPropertySelectionChanged: this.props.onPropertySelectionChanged }, (selectionContext) => (React.createElement("div", { className: classnames("gmw-components-property-grid-wrapper", this.props.className), style: this.props.style },
|
|
146
|
+
React.createElement("div", { className: classnames("gmw-components-property-grid", "components-smallEditor-host") },
|
|
147
|
+
React.createElement("div", { className: "gmw-property-categories" }, this.state.categories.map((categorizedRecords) => (React.createElement(NestedCategoryBlock, { ...selectionContext, key: categorizedRecords.category.name, categorizedRecords: categorizedRecords, onCategoryExpansionToggled: this._onCategoryExpansionToggled, orientation: this.state.orientation, propertyValueRendererManager: this.props.propertyValueRendererManager, actionButtonRenderers: this.props.actionButtonRenderers }))))),
|
|
148
148
|
React.createElement(ResizableContainerObserver, { onResize: this._onResize }))))));
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -167,6 +167,6 @@ const NestedCategoryBlock = (props) => {
|
|
|
167
167
|
const [width, setWidth] = React.useState(1);
|
|
168
168
|
return (React.createElement(PropertyCategoryBlock, { category: props.categorizedRecords.category, onExpansionToggled: props.onCategoryExpansionToggled },
|
|
169
169
|
props.categorizedRecords.records.length ? (React.createElement(ColumnResizingPropertyListPropsSupplier, { orientation: props.orientation, width: width }, (partialListProps) => (React.createElement(PropertyList, { ...partialListProps, orientation: props.orientation, category: props.categorizedRecords.category, properties: props.categorizedRecords.records, selectedPropertyKey: props.selectedPropertyKey, onPropertyClicked: props.onPropertyClicked, onPropertyRightClicked: props.onPropertyRightClicked, onPropertyContextMenu: props.onPropertyContextMenu, propertyValueRendererManager: props.propertyValueRendererManager, editingPropertyKey: props.editingPropertyKey, onEditCommit: props.onEditCommit, onEditCancel: props.onEditCancel, isPropertyHoverEnabled: props.isPropertyHoverEnabled, isPropertySelectionEnabled: props.isPropertySelectionEnabled, isPropertyRightClickSelectionEnabled: props.isPropertyRightClickSelectionEnabled, actionButtonRenderers: props.actionButtonRenderers, setWidth: setWidth, width: width })))) : undefined,
|
|
170
|
-
props.categorizedRecords.children.length ? (React.createElement("div", { className: "property-categories" }, props.categorizedRecords.children.map((categorizedChildRecords) => (React.createElement(NestedCategoryBlock, { ...props, key: categorizedChildRecords.category.name, categorizedRecords: categorizedChildRecords }))))) : undefined));
|
|
170
|
+
props.categorizedRecords.children.length ? (React.createElement("div", { className: "gmw-property-categories" }, props.categorizedRecords.children.map((categorizedChildRecords) => (React.createElement(NestedCategoryBlock, { ...props, key: categorizedChildRecords.category.name, categorizedRecords: categorizedChildRecords }))))) : undefined));
|
|
171
171
|
};
|
|
172
172
|
//# sourceMappingURL=PropertyGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sCAAsC,GACvC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uCAAuC,EAAE,MAAM,iHAAiH,CAAC;AAC1K,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAwCtD;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK,CAAC,SAGvC;IAQC,gBAAgB;IAChB,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QARP,eAAU,GAAG,KAAK,CAAC;QACnB,qBAAgB,GAAG,KAAK,CAAC;QACzB,2BAAsB,GAAG,KAAK,CAAC;QA2D/B,2BAAsB,GAAG,GAAG,EAAE;YACpC,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACzB,CAAC,CAAC;QAqEM,cAAS,GAAG,CAAC,KAAa,EAAE,EAAE;YACpC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC;QAEM,gCAA2B,GAAG,CAAC,YAAoB,EAAE,EAAE;YAC7D,IAAI,CAAC,QAAQ,CAAC,CA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,kBAAkB,EAAE,uBAAuB,GAC3C,CACH,CAAC,CACE,CACP,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,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 classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { DisposeFunc } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n CommonPropertyGridProps,\n PropertyCategory,\n PropertyData,\n} from \"@itwin/components-react\";\nimport {\n PropertyCategoryBlock,\n PropertyGridCommons,\n PropertyGridEventsRelatedPropsSupplier,\n} from \"@itwin/components-react\";\nimport type { ColumnResizeRelatedPropertyListProps } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport type { PropertyListProps } from \"./PropertyList\";\nimport { PropertyList } from \"./PropertyList\";\nimport \"./PropertyGrid.scss\";\n\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: PresentationPropertyDataProvider;\n}\n\n/** Property Category in the [[PropertyGrid]] state\n * @public\n * @deprecated This was part of [[PropertyGrid]] internal state and should've never been public. The component is not using it anymore.\n */\nexport interface PropertyGridCategory {\n propertyCategory: PropertyCategory;\n propertyCount: number;\n properties: PropertyRecord[];\n}\n\ninterface CategorizedPropertyGridRecords {\n category: PropertyCategory;\n records: PropertyRecord[];\n children: CategorizedPropertyGridRecords[];\n}\n\n/** State of [[PropertyGrid]] React component\n * @internal\n */\ninterface PropertyGridState {\n /** List of PropertyGrid categories */\n categories: CategorizedPropertyGridRecords[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** If property grid currently loading data, the loading start time */\n loadStart?: Date;\n /** Width of PropertyGrid */\n width: number;\n}\n\n/** PropertyGrid React component.\n * @public\n */\nexport class PropertyGrid extends React.Component<\nPropertyGridProps,\nPropertyGridState\n> {\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n static override contextType = GroupQueryBuilderContext;\n\n /** @internal */\n constructor(props: PropertyGridProps) {\n super(props);\n this.state = {\n categories: [],\n orientation: this.getPreferredOrientation(),\n width: 0,\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = undefined;\n }\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyGridProps) {\n if (this.props.dataProvider !== prevProps.dataProvider) {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n }\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth\n ) {\n this.updateOrientation(this.state.width);\n }\n }\n\n private _onPropertyDataChanged = () => {\n void this.gatherData();\n };\n\n private async gatherData(): Promise<void> {\n if (this._isInDataRequest) {\n this._hasPendingDataRequest = true;\n return;\n }\n\n this.setState((prev) =>\n prev.loadStart ? null : { loadStart: new Date() }\n );\n\n this._isInDataRequest = true;\n let propertyData: PropertyData;\n try {\n propertyData = await this.props.dataProvider.getData();\n } finally {\n this._isInDataRequest = false;\n }\n\n if (!this._isMounted) {\n return;\n }\n\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (\n newCategories: PropertyCategory[],\n stateCategories: CategorizedPropertyGridRecords[] | undefined\n ) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(\n stateCategories ?? [],\n category.name,\n false\n );\n return {\n category: {\n ...category,\n expand:\n matchingStateCategory?.category?.expand ?? category.expand,\n },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(\n category.childCategories ?? [],\n matchingStateCategory?.children\n ),\n };\n });\n return {\n categories: buildCategoriesHierarchy(\n propertyData.categories,\n prevState.categories\n ),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return this.props.orientation !== undefined\n ? this.props.orientation\n : Orientation.Horizontal;\n }\n\n private _onResize = (width: number) => {\n this.updateOrientation(width);\n };\n\n private _onCategoryExpansionToggled = (categoryName: string) => {\n this.setState((state) => {\n return produce(state, (draft) => {\n const records = findCategory(draft.categories, categoryName, true);\n // istanbul ignore else\n if (records) {\n const category = records.category;\n category.expand = !category.expand;\n }\n });\n });\n };\n\n private updateOrientation(width: number): void {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (\n currentOrientation !== this.state.orientation ||\n width !== this.state.width\n ) {\n this.setState({ orientation: currentOrientation, width });\n }\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"gm-components-property-grid-loader\">\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className=\"table-box-inner\">\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n >\n {(selectionContext) => (\n <div\n className={classnames(\n \"components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className=\"property-categories\">\n {this.state.categories.map(\n (categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={\n this._onCategoryExpansionToggled\n }\n orientation={this.state.orientation}\n propertyValueRendererManager={\n this.props.propertyValueRendererManager\n }\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n )\n )}\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n </div>\n );\n }\n}\n\nfunction findCategory(\n categories: CategorizedPropertyGridRecords[],\n lookupName: string,\n recurseIntoChildren: boolean\n): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName) {\n return category;\n }\n if (recurseIntoChildren) {\n const matchingChild = findCategory(\n category.children,\n lookupName,\n recurseIntoChildren\n );\n if (matchingChild) {\n return matchingChild;\n }\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps\n extends Omit<\n PropertyListProps,\n keyof ColumnResizeRelatedPropertyListProps | \"properties\"\n > {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nconst NestedCategoryBlock = (props: NestedCategoryBlockProps) => {\n const [width, setWidth] = React.useState(1);\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier\n orientation={props.orientation}\n width={width}\n >\n {(partialListProps: ColumnResizeRelatedPropertyListProps) => (\n <PropertyList\n {...partialListProps}\n orientation={props.orientation}\n category={props.categorizedRecords.category}\n properties={props.categorizedRecords.records}\n selectedPropertyKey={props.selectedPropertyKey}\n onPropertyClicked={props.onPropertyClicked}\n onPropertyRightClicked={props.onPropertyRightClicked}\n onPropertyContextMenu={props.onPropertyContextMenu}\n propertyValueRendererManager={props.propertyValueRendererManager}\n editingPropertyKey={props.editingPropertyKey}\n onEditCommit={props.onEditCommit}\n onEditCancel={props.onEditCancel}\n isPropertyHoverEnabled={props.isPropertyHoverEnabled}\n isPropertySelectionEnabled={props.isPropertySelectionEnabled}\n isPropertyRightClickSelectionEnabled={\n props.isPropertyRightClickSelectionEnabled\n }\n actionButtonRenderers={props.actionButtonRenderers}\n setWidth={setWidth}\n width={width}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"property-categories\">\n {props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock\n {...props}\n key={categorizedChildRecords.category.name}\n categorizedRecords={categorizedChildRecords}\n />\n ))}\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO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AAgB,EACpB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAC3C,UAAU,EAAE,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAC5C,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,4BAA4B,EAAE,KAAK,CAAC,4BAA4B,EAChE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,oCAAoC,EAClC,KAAK,CAAC,oCAAoC,EAE5C,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,GACZ,CACH,CACuC,CAC3C,CAAC,CAAC,CAAC,SAAS;QACZ,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1C,6BAAK,SAAS,EAAC,yBAAyB,IACrC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAClE,oBAAC,mBAAmB,OACd,KAAK,EACT,GAAG,EAAE,uBAAuB,CAAC,QAAQ,CAAC,IAAI,EAC1C,kBAAkB,EAAE,uBAAuB,GAC3C,CACH,CAAC,CACE,CACP,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,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 classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { DisposeFunc } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n CommonPropertyGridProps,\n PropertyCategory,\n PropertyData,\n} from \"@itwin/components-react\";\nimport {\n PropertyCategoryBlock,\n PropertyGridCommons,\n PropertyGridEventsRelatedPropsSupplier,\n} from \"@itwin/components-react\";\nimport type { ColumnResizeRelatedPropertyListProps } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport type { PropertyListProps } from \"./PropertyList\";\nimport { PropertyList } from \"./PropertyList\";\nimport \"./PropertyGrid.scss\";\n\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: PresentationPropertyDataProvider;\n}\n\n/** Property Category in the [[PropertyGrid]] state\n * @public\n * @deprecated This was part of [[PropertyGrid]] internal state and should've never been public. The component is not using it anymore.\n */\nexport interface PropertyGridCategory {\n propertyCategory: PropertyCategory;\n propertyCount: number;\n properties: PropertyRecord[];\n}\n\ninterface CategorizedPropertyGridRecords {\n category: PropertyCategory;\n records: PropertyRecord[];\n children: CategorizedPropertyGridRecords[];\n}\n\n/** State of [[PropertyGrid]] React component\n * @internal\n */\ninterface PropertyGridState {\n /** List of PropertyGrid categories */\n categories: CategorizedPropertyGridRecords[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** If property grid currently loading data, the loading start time */\n loadStart?: Date;\n /** Width of PropertyGrid */\n width: number;\n}\n\n/** PropertyGrid React component.\n * @public\n */\nexport class PropertyGrid extends React.Component<\nPropertyGridProps,\nPropertyGridState\n> {\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n static override contextType = GroupQueryBuilderContext;\n\n /** @internal */\n constructor(props: PropertyGridProps) {\n super(props);\n this.state = {\n categories: [],\n orientation: this.getPreferredOrientation(),\n width: 0,\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = undefined;\n }\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyGridProps) {\n if (this.props.dataProvider !== prevProps.dataProvider) {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n }\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth\n ) {\n this.updateOrientation(this.state.width);\n }\n }\n\n private _onPropertyDataChanged = () => {\n void this.gatherData();\n };\n\n private async gatherData(): Promise<void> {\n if (this._isInDataRequest) {\n this._hasPendingDataRequest = true;\n return;\n }\n\n this.setState((prev) =>\n prev.loadStart ? null : { loadStart: new Date() }\n );\n\n this._isInDataRequest = true;\n let propertyData: PropertyData;\n try {\n propertyData = await this.props.dataProvider.getData();\n } finally {\n this._isInDataRequest = false;\n }\n\n if (!this._isMounted) {\n return;\n }\n\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (\n newCategories: PropertyCategory[],\n stateCategories: CategorizedPropertyGridRecords[] | undefined\n ) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(\n stateCategories ?? [],\n category.name,\n false\n );\n return {\n category: {\n ...category,\n expand:\n matchingStateCategory?.category?.expand ?? category.expand,\n },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(\n category.childCategories ?? [],\n matchingStateCategory?.children\n ),\n };\n });\n return {\n categories: buildCategoriesHierarchy(\n propertyData.categories,\n prevState.categories\n ),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return this.props.orientation !== undefined\n ? this.props.orientation\n : Orientation.Horizontal;\n }\n\n private _onResize = (width: number) => {\n this.updateOrientation(width);\n };\n\n private _onCategoryExpansionToggled = (categoryName: string) => {\n this.setState((state) => {\n return produce(state, (draft) => {\n const records = findCategory(draft.categories, categoryName, true);\n // istanbul ignore else\n if (records) {\n const category = records.category;\n category.expand = !category.expand;\n }\n });\n });\n };\n\n private updateOrientation(width: number): void {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (\n currentOrientation !== this.state.orientation ||\n width !== this.state.width\n ) {\n this.setState({ orientation: currentOrientation, width });\n }\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"gmw-components-property-grid-loader\">\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className=\"gmw-table-box-inner\">\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n >\n {(selectionContext) => (\n <div\n className={classnames(\n \"gmw-components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"gmw-components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className= \"gmw-property-categories\">\n {this.state.categories.map(\n (categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={\n this._onCategoryExpansionToggled\n }\n orientation={this.state.orientation}\n propertyValueRendererManager={\n this.props.propertyValueRendererManager\n }\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n )\n )}\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n </div>\n );\n }\n}\n\nfunction findCategory(\n categories: CategorizedPropertyGridRecords[],\n lookupName: string,\n recurseIntoChildren: boolean\n): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName) {\n return category;\n }\n if (recurseIntoChildren) {\n const matchingChild = findCategory(\n category.children,\n lookupName,\n recurseIntoChildren\n );\n if (matchingChild) {\n return matchingChild;\n }\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps\n extends Omit<\n PropertyListProps,\n keyof ColumnResizeRelatedPropertyListProps | \"properties\"\n > {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nconst NestedCategoryBlock = (props: NestedCategoryBlockProps) => {\n const [width, setWidth] = React.useState(1);\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier\n orientation={props.orientation}\n width={width}\n >\n {(partialListProps: ColumnResizeRelatedPropertyListProps) => (\n <PropertyList\n {...partialListProps}\n orientation={props.orientation}\n category={props.categorizedRecords.category}\n properties={props.categorizedRecords.records}\n selectedPropertyKey={props.selectedPropertyKey}\n onPropertyClicked={props.onPropertyClicked}\n onPropertyRightClicked={props.onPropertyRightClicked}\n onPropertyContextMenu={props.onPropertyContextMenu}\n propertyValueRendererManager={props.propertyValueRendererManager}\n editingPropertyKey={props.editingPropertyKey}\n onEditCommit={props.onEditCommit}\n onEditCancel={props.onEditCancel}\n isPropertyHoverEnabled={props.isPropertyHoverEnabled}\n isPropertySelectionEnabled={props.isPropertySelectionEnabled}\n isPropertyRightClickSelectionEnabled={\n props.isPropertyRightClickSelectionEnabled\n }\n actionButtonRenderers={props.actionButtonRenderers}\n setWidth={setWidth}\n width={width}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"gmw-property-categories\">\n {props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock\n {...props}\n key={categorizedChildRecords.category.name}\n categorizedRecords={categorizedChildRecords}\n />\n ))}\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n};\n"]}
|