@itwin/grouping-mapping-widget 0.11.0 → 0.12.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 +4 -1
- package/lib/cjs/grouping-mapping-widget.js +7 -1
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/WidgetHeader.test.js +3 -3
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +7 -9
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +49 -24
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +9 -16
- package/lib/cjs/widget/components/CalculatedPropertyTable.js +29 -31
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.scss +9 -0
- package/lib/cjs/widget/components/CustomCalculationAction.d.ts +6 -9
- package/lib/cjs/widget/components/CustomCalculationAction.js +79 -9
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationTable.d.ts +8 -16
- package/lib/cjs/widget/components/CustomCalculationTable.js +22 -29
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
- package/lib/cjs/widget/components/DeleteModal.js +9 -13
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.js +1 -0
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupInformationPanel.d.ts +10 -0
- package/lib/cjs/widget/components/GroupInformationPanel.js +23 -0
- package/lib/cjs/widget/components/GroupInformationPanel.js.map +1 -0
- package/lib/cjs/widget/components/GroupInformationPanel.scss +13 -0
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +6 -9
- package/lib/cjs/widget/components/GroupPropertyAction.js +26 -15
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyTable.d.ts +8 -15
- package/lib/cjs/widget/components/GroupPropertyTable.js +23 -28
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.d.ts +2 -1
- package/lib/cjs/widget/components/Grouping.js +12 -15
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +2 -9
- package/lib/cjs/widget/components/GroupingMapping.js +1 -2
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContent.js +8 -4
- package/lib/cjs/widget/components/GroupingMappingContent.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContext.js +17 -1
- package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingHeader.js +2 -2
- package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingRouter.js +23 -2
- package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/cjs/widget/components/GroupsAddButton.d.ts +9 -0
- package/lib/cjs/widget/components/GroupsAddButton.js +17 -0
- package/lib/cjs/widget/components/GroupsAddButton.js.map +1 -0
- package/lib/cjs/widget/components/GroupsAddButton.scss +7 -0
- package/lib/cjs/widget/components/Mapping.js +5 -11
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.d.ts +12 -17
- package/lib/cjs/widget/components/PropertyMenu.js +52 -155
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.scss +4 -28
- package/lib/cjs/widget/components/PropertyNameCell.d.ts +11 -0
- package/lib/cjs/widget/components/PropertyNameCell.js +15 -0
- package/lib/cjs/widget/components/PropertyNameCell.js.map +1 -0
- package/lib/cjs/widget/components/PropertyTable.d.ts +18 -0
- package/lib/cjs/widget/components/PropertyTable.js +54 -0
- package/lib/cjs/widget/components/PropertyTable.js.map +1 -0
- package/lib/cjs/widget/components/PropertyTable.scss +11 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.d.ts +10 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.js +23 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.js.map +1 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.scss +12 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.d.ts +9 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.js +16 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.js.map +1 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.scss +9 -0
- package/lib/cjs/widget/components/WidgetHeader.d.ts +9 -0
- package/lib/cjs/widget/components/WidgetHeader.js +22 -0
- package/lib/cjs/widget/components/WidgetHeader.js.map +1 -0
- package/lib/cjs/widget/components/WidgetHeader.scss +36 -0
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/lib/cjs/widget/components/context/PropertiesContext.d.ts +15 -0
- package/lib/cjs/widget/components/context/PropertiesContext.js +43 -0
- package/lib/cjs/widget/components/context/PropertiesContext.js.map +1 -0
- package/lib/cjs/widget/components/groupsHelpers.d.ts +6 -3
- package/lib/cjs/widget/components/groupsHelpers.js +43 -40
- package/lib/cjs/widget/components/groupsHelpers.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyRender.js +2 -1
- package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/countMatchesInString.d.ts +8 -0
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js +32 -0
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.d.ts +10 -0
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js +65 -0
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js.map +1 -0
- package/lib/cjs/widget/components/utils.d.ts +0 -6
- package/lib/cjs/widget/components/utils.js +1 -9
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +0 -29
- package/lib/cjs/widget/components/viewerUtils.d.ts +4 -2
- package/lib/cjs/widget/components/viewerUtils.js +4 -22
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/cjs/widget/hooks/useFetchData.d.ts +3 -5
- package/lib/cjs/widget/hooks/useFetchData.js +9 -7
- package/lib/cjs/widget/hooks/useFetchData.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +4 -1
- package/lib/esm/grouping-mapping-widget.js +3 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/WidgetHeader.test.js +1 -1
- package/lib/esm/test/WidgetHeader.test.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +7 -9
- package/lib/esm/widget/components/CalculatedPropertyAction.js +50 -27
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +9 -16
- package/lib/esm/widget/components/CalculatedPropertyTable.js +30 -31
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.scss +9 -0
- package/lib/esm/widget/components/CustomCalculationAction.d.ts +6 -9
- package/lib/esm/widget/components/CustomCalculationAction.js +79 -11
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationTable.d.ts +8 -16
- package/lib/esm/widget/components/CustomCalculationTable.js +23 -29
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
- package/lib/esm/widget/components/DeleteModal.js +9 -13
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.js +1 -0
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupInformationPanel.d.ts +10 -0
- package/lib/esm/widget/components/GroupInformationPanel.js +16 -0
- package/lib/esm/widget/components/GroupInformationPanel.js.map +1 -0
- package/lib/esm/widget/components/GroupInformationPanel.scss +13 -0
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +6 -9
- package/lib/esm/widget/components/GroupPropertyAction.js +25 -15
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyTable.d.ts +8 -15
- package/lib/esm/widget/components/GroupPropertyTable.js +24 -28
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/Grouping.d.ts +2 -1
- package/lib/esm/widget/components/Grouping.js +14 -17
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +2 -9
- package/lib/esm/widget/components/GroupingMapping.js +1 -2
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContent.js +9 -5
- package/lib/esm/widget/components/GroupingMappingContent.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContext.js +17 -1
- package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingHeader.js +1 -1
- package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingRouter.js +23 -2
- package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/esm/widget/components/GroupsAddButton.d.ts +9 -0
- package/lib/esm/widget/components/GroupsAddButton.js +10 -0
- package/lib/esm/widget/components/GroupsAddButton.js.map +1 -0
- package/lib/esm/widget/components/GroupsAddButton.scss +7 -0
- package/lib/esm/widget/components/Mapping.js +5 -11
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.d.ts +12 -17
- package/lib/esm/widget/components/PropertyMenu.js +54 -154
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.scss +4 -28
- package/lib/esm/widget/components/PropertyNameCell.d.ts +11 -0
- package/lib/esm/widget/components/PropertyNameCell.js +8 -0
- package/lib/esm/widget/components/PropertyNameCell.js.map +1 -0
- package/lib/esm/widget/components/PropertyTable.d.ts +18 -0
- package/lib/esm/widget/components/PropertyTable.js +28 -0
- package/lib/esm/widget/components/PropertyTable.js.map +1 -0
- package/lib/esm/widget/components/PropertyTable.scss +11 -0
- package/lib/esm/widget/components/PropertyTableToolbar.d.ts +10 -0
- package/lib/esm/widget/components/PropertyTableToolbar.js +16 -0
- package/lib/esm/widget/components/PropertyTableToolbar.js.map +1 -0
- package/lib/esm/widget/components/PropertyTableToolbar.scss +12 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.d.ts +9 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.js +9 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.js.map +1 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.scss +9 -0
- package/lib/esm/widget/components/WidgetHeader.d.ts +9 -0
- package/lib/esm/widget/components/WidgetHeader.js +15 -0
- package/lib/esm/widget/components/WidgetHeader.js.map +1 -0
- package/lib/esm/widget/components/WidgetHeader.scss +36 -0
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/lib/esm/widget/components/context/PropertiesContext.d.ts +15 -0
- package/lib/esm/widget/components/context/PropertiesContext.js +20 -0
- package/lib/esm/widget/components/context/PropertiesContext.js.map +1 -0
- package/lib/esm/widget/components/groupsHelpers.d.ts +6 -3
- package/lib/esm/widget/components/groupsHelpers.js +41 -40
- package/lib/esm/widget/components/groupsHelpers.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyRender.js +2 -1
- package/lib/esm/widget/components/property-grid/PropertyRender.js.map +1 -1
- package/lib/esm/widget/components/property-grid/countMatchesInString.d.ts +8 -0
- package/lib/esm/widget/components/property-grid/countMatchesInString.js +28 -0
- package/lib/esm/widget/components/property-grid/countMatchesInString.js.map +1 -0
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.d.ts +10 -0
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js +42 -0
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js.map +1 -0
- package/lib/esm/widget/components/utils.d.ts +0 -6
- package/lib/esm/widget/components/utils.js +0 -7
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +0 -29
- package/lib/esm/widget/components/viewerUtils.d.ts +4 -2
- package/lib/esm/widget/components/viewerUtils.js +3 -20
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/widget/hooks/useFetchData.d.ts +3 -5
- package/lib/esm/widget/hooks/useFetchData.js +9 -7
- package/lib/esm/widget/hooks/useFetchData.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PropertyNameCellProps<T extends {
|
|
3
|
+
propertyName: string;
|
|
4
|
+
}> {
|
|
5
|
+
property: T;
|
|
6
|
+
onClickModify?: (value: T) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const PropertyNameCell: <T extends {
|
|
9
|
+
propertyName: string;
|
|
10
|
+
}>({ property, onClickModify, }: PropertyNameCellProps<T>) => JSX.Element;
|
|
11
|
+
//# sourceMappingURL=PropertyNameCell.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
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 from "react";
|
|
6
|
+
import { Text } from "@itwin/itwinui-react";
|
|
7
|
+
export const PropertyNameCell = ({ property, onClickModify, }) => onClickModify ? (React.createElement("div", { className: "iui-anchor", onClick: () => onClickModify(property) }, property.propertyName)) : (React.createElement(Text, null, property.propertyName));
|
|
8
|
+
//# sourceMappingURL=PropertyNameCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyNameCell.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyNameCell.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAO5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAsC,EACpE,QAAQ,EACR,aAAa,GACY,EAAE,EAAE,CAC7B,aAAa,CAAC,CAAC,CAAC,CACd,6BAAK,SAAS,EAAC,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,IAC/D,QAAQ,CAAC,YAAY,CAClB,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,QAAE,QAAQ,CAAC,YAAY,CAAQ,CACrC,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 { Text } from \"@itwin/itwinui-react\";\n\nexport interface PropertyNameCellProps<T extends { propertyName: string }> {\n property: T;\n onClickModify?: (value: T) => void;\n}\n\nexport const PropertyNameCell = <T extends { propertyName: string },>({\n property,\n onClickModify,\n}: PropertyNameCellProps<T>) =>\n onClickModify ? (\n <div className=\"iui-anchor\" onClick={() => onClickModify(property)}>\n {property.propertyName}\n </div>\n ) : (\n <Text>{property.propertyName}</Text>\n );\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Column } from "react-table";
|
|
3
|
+
import "./PropertyTable.scss";
|
|
4
|
+
export interface PropertyTableItem {
|
|
5
|
+
propertyName: string;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PropertyTableProps<T extends PropertyTableItem> {
|
|
9
|
+
propertyType: string;
|
|
10
|
+
columnsFactory: (handleShowDeleteModal: (value: T) => void) => ReadonlyArray<Column<T>>;
|
|
11
|
+
data: T[];
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
onClickAdd?: () => void;
|
|
14
|
+
refreshProperties: () => Promise<void>;
|
|
15
|
+
deleteProperty: (propertyId: string) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare const PropertyTable: <T extends PropertyTableItem>({ propertyType, columnsFactory, data, isLoading, onClickAdd, refreshProperties, deleteProperty, }: PropertyTableProps<T>) => JSX.Element;
|
|
18
|
+
//# sourceMappingURL=PropertyTable.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { Table } from "@itwin/itwinui-react";
|
|
6
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
7
|
+
import DeleteModal from "./DeleteModal";
|
|
8
|
+
import { PropertyTableToolbar } from "./PropertyTableToolbar";
|
|
9
|
+
import "./PropertyTable.scss";
|
|
10
|
+
export const PropertyTable = ({ propertyType, columnsFactory, data, isLoading, onClickAdd, refreshProperties, deleteProperty, }) => {
|
|
11
|
+
const [showDeleteModal, setShowDeleteModal] = useState(undefined);
|
|
12
|
+
const handleDeleteProperty = useCallback(async () => {
|
|
13
|
+
var _a;
|
|
14
|
+
await deleteProperty((_a = showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.id) !== null && _a !== void 0 ? _a : "");
|
|
15
|
+
}, [deleteProperty, showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.id]);
|
|
16
|
+
const handleShowDeleteModal = useCallback((property) => {
|
|
17
|
+
setShowDeleteModal(property);
|
|
18
|
+
}, []);
|
|
19
|
+
const handleCloseDeleteModal = () => {
|
|
20
|
+
setShowDeleteModal(undefined);
|
|
21
|
+
};
|
|
22
|
+
const memoizedColumns = useMemo(() => columnsFactory(handleShowDeleteModal), [columnsFactory, handleShowDeleteModal]);
|
|
23
|
+
return (React.createElement("div", { className: "gmw-property-table-container" },
|
|
24
|
+
React.createElement(PropertyTableToolbar, { propertyType: propertyType, onClickAddProperty: onClickAdd, refreshProperties: refreshProperties, isLoading: isLoading }),
|
|
25
|
+
React.createElement(Table, { data: isLoading ? [] : data, density: 'extra-condensed', columns: memoizedColumns, emptyTableContent: `No ${propertyType} Properties`, isSortable: true, isLoading: isLoading }),
|
|
26
|
+
React.createElement(DeleteModal, { entityName: showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.propertyName, onClose: handleCloseDeleteModal, onDelete: handleDeleteProperty, refresh: refreshProperties })));
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=PropertyTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyTable.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyTable.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9D,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,sBAAsB,CAAC;AAiB9B,MAAM,CAAC,MAAM,aAAa,GAAG,CAA8B,EACzD,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,UAAU,EACV,iBAAiB,E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sBAAsB,EAC/B,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,iBAAiB,GAC1B,CACE,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 { Table } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport type { Column } from \"react-table\";\nimport type { CreateTypeFromInterface } from \"../utils\";\nimport DeleteModal from \"./DeleteModal\";\nimport { PropertyTableToolbar } from \"./PropertyTableToolbar\";\nimport \"./PropertyTable.scss\";\n\nexport interface PropertyTableItem {\n propertyName: string;\n id: string;\n}\n\nexport interface PropertyTableProps<T extends PropertyTableItem> {\n propertyType: string;\n columnsFactory: (handleShowDeleteModal: (value: T) => void) => ReadonlyArray<Column<T>>;\n data: T[];\n isLoading: boolean;\n onClickAdd?: () => void;\n refreshProperties: () => Promise<void>;\n deleteProperty: (propertyId: string) => Promise<void>;\n}\n\nexport const PropertyTable = <T extends PropertyTableItem>({\n propertyType,\n columnsFactory,\n data,\n isLoading,\n onClickAdd,\n refreshProperties,\n deleteProperty,\n}: PropertyTableProps<T>) => {\n\n const [showDeleteModal, setShowDeleteModal] = useState<T | undefined>(undefined);\n\n const handleDeleteProperty = useCallback(async () => {\n await deleteProperty(showDeleteModal?.id ?? \"\");\n }, [deleteProperty, showDeleteModal?.id]);\n\n const handleShowDeleteModal = useCallback((property: T) => {\n setShowDeleteModal(property);\n }, []);\n\n const handleCloseDeleteModal = () => {\n setShowDeleteModal(undefined);\n };\n\n const memoizedColumns = useMemo(() =>\n columnsFactory(handleShowDeleteModal), [columnsFactory, handleShowDeleteModal]);\n\n return (\n <div className=\"gmw-property-table-container\">\n <PropertyTableToolbar\n propertyType={propertyType}\n onClickAddProperty={onClickAdd}\n refreshProperties={refreshProperties}\n isLoading={isLoading}\n />\n <Table<CreateTypeFromInterface<T>>\n data={isLoading ? [] : data}\n density='extra-condensed'\n columns={memoizedColumns}\n emptyTableContent={`No ${propertyType} Properties`}\n isSortable\n isLoading={isLoading}\n />\n <DeleteModal\n entityName={showDeleteModal?.propertyName}\n onClose={handleCloseDeleteModal}\n onDelete={handleDeleteProperty}\n refresh={refreshProperties}\n />\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
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-table-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: $iui-baseline;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./PropertyTableToolbar.scss";
|
|
3
|
+
export interface PropertyTableToolbarProps {
|
|
4
|
+
propertyType: string;
|
|
5
|
+
onClickAddProperty?: () => void;
|
|
6
|
+
refreshProperties: () => void;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const PropertyTableToolbar: ({ propertyType, onClickAddProperty, refreshProperties, isLoading, }: PropertyTableToolbarProps) => JSX.Element;
|
|
10
|
+
//# sourceMappingURL=PropertyTableToolbar.d.ts.map
|
|
@@ -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 React from "react";
|
|
6
|
+
import { SvgAdd, SvgRefresh } from "@itwin/itwinui-icons-react";
|
|
7
|
+
import { Button, IconButton } from "@itwin/itwinui-react";
|
|
8
|
+
import "./PropertyTableToolbar.scss";
|
|
9
|
+
export const PropertyTableToolbar = ({ propertyType, onClickAddProperty, refreshProperties, isLoading, }) => (React.createElement("div", { className: "gmw-property-table-toolbar" },
|
|
10
|
+
onClickAddProperty && (React.createElement(Button, { startIcon: React.createElement(SvgAdd, null), styleType: "high-visibility", onClick: onClickAddProperty },
|
|
11
|
+
"Add ",
|
|
12
|
+
propertyType,
|
|
13
|
+
" Property")),
|
|
14
|
+
React.createElement(IconButton, { title: "Refresh", className: "gmw-property-table-refresh-button", onClick: refreshProperties, disabled: isLoading, styleType: "borderless" },
|
|
15
|
+
React.createElement(SvgRefresh, null))));
|
|
16
|
+
//# sourceMappingURL=PropertyTableToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyTableToolbar.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyTableToolbar.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,6BAA6B,CAAC;AASrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,GACiB,EAAE,EAAE,CAAC,CAC/B,6BAAK,SAAS,EAAC,4BAA4B;IACxC,kBAAkB,IAAI,CACrB,oBAAC,MAAM,IACL,SAAS,EAAE,oBAAC,MAAM,OAAG,EACrB,SAAS,EAAC,iBAAiB,EAC3B,OAAO,EAAE,kBAAkB;;QAEtB,YAAY;oBACV,CACV;IACD,oBAAC,UAAU,IACT,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,mCAAmC,EAC7C,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,YAAY;QAEtB,oBAAC,UAAU,OAAG,CACH,CACT,CACP,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 { SvgAdd, SvgRefresh } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton } from \"@itwin/itwinui-react\";\nimport \"./PropertyTableToolbar.scss\";\n\nexport interface PropertyTableToolbarProps {\n propertyType: string;\n onClickAddProperty?: () => void;\n refreshProperties: () => void;\n isLoading: boolean;\n}\n\nexport const PropertyTableToolbar = ({\n propertyType,\n onClickAddProperty,\n refreshProperties,\n isLoading,\n}: PropertyTableToolbarProps) => (\n <div className=\"gmw-property-table-toolbar\">\n {onClickAddProperty && (\n <Button\n startIcon={<SvgAdd />}\n styleType=\"high-visibility\"\n onClick={onClickAddProperty}\n >\n Add {propertyType} Property\n </Button>\n )}\n <IconButton\n title=\"Refresh\"\n className=\"gmw-property-table-refresh-button\"\n onClick={refreshProperties}\n disabled={isLoading}\n styleType=\"borderless\"\n >\n <SvgRefresh />\n </IconButton>\n </div>\n);\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
|
|
6
|
+
.gmw-property-table-toolbar {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
.gmw-property-table-refresh-button {
|
|
10
|
+
margin-left: auto;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./ToggleGroupVisibility.scss";
|
|
3
|
+
export interface ToggleGroupVisibilityProps {
|
|
4
|
+
isLoadingQuery: boolean;
|
|
5
|
+
showGroupColor: boolean;
|
|
6
|
+
setShowGroupColor: (value: ((prevState: boolean) => boolean) | boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ToggleGroupVisibility: ({ isLoadingQuery, showGroupColor, setShowGroupColor }: ToggleGroupVisibilityProps) => JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ToggleGroupVisibility.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
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 { ToggleSwitch } from "@itwin/itwinui-react";
|
|
6
|
+
import "./ToggleGroupVisibility.scss";
|
|
7
|
+
import React from "react";
|
|
8
|
+
export const ToggleGroupVisibility = ({ isLoadingQuery, showGroupColor, setShowGroupColor }) => (React.createElement(ToggleSwitch, { label: "Color by Group", labelPosition: "left", className: "gmw-toggle", disabled: isLoadingQuery, checked: showGroupColor, onChange: () => setShowGroupColor((b) => !b) }));
|
|
9
|
+
//# sourceMappingURL=ToggleGroupVisibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleGroupVisibility.js","sourceRoot":"","sources":["../../../../src/widget/components/ToggleGroupVisibility.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAA8B,EAAE,EAAE,CAAC,CAC1H,oBAAC,YAAY,IACX,KAAK,EAAC,gBAAgB,EACtB,aAAa,EAAC,MAAM,EACpB,SAAS,EAAC,YAAY,EACtB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAC5C,CACH,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 { ToggleSwitch } from \"@itwin/itwinui-react\";\nimport \"./ToggleGroupVisibility.scss\";\nimport React from \"react\";\n\nexport interface ToggleGroupVisibilityProps {\n isLoadingQuery: boolean;\n showGroupColor: boolean;\n setShowGroupColor: (value: ((prevState: boolean) => boolean) | boolean) => void;\n}\n\nexport const ToggleGroupVisibility = ({ isLoadingQuery, showGroupColor, setShowGroupColor }: ToggleGroupVisibilityProps) => (\n <ToggleSwitch\n label=\"Color by Group\"\n labelPosition=\"left\"\n className=\"gmw-toggle\"\n disabled={isLoadingQuery}\n checked={showGroupColor}\n onChange={() => setShowGroupColor((b) => !b)}\n />\n);\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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-toggle {
|
|
8
|
+
margin-right: $iui-xs;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./WidgetHeader.scss";
|
|
3
|
+
export interface WidgetHeaderProps {
|
|
4
|
+
title: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
returnFn?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const WidgetHeader: ({ title, disabled, returnFn, }: WidgetHeaderProps) => JSX.Element;
|
|
9
|
+
//# sourceMappingURL=WidgetHeader.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
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 { SvgChevronLeft } from "@itwin/itwinui-icons-react";
|
|
6
|
+
import { Text } from "@itwin/itwinui-react";
|
|
7
|
+
import "./WidgetHeader.scss";
|
|
8
|
+
import React from "react";
|
|
9
|
+
export const WidgetHeader = ({ title, disabled = false, returnFn, }) => {
|
|
10
|
+
return (React.createElement("div", { className: 'gmw-widget-header-container' },
|
|
11
|
+
returnFn && (React.createElement("div", { className: disabled ? "gmw-chevron-disabled" : "gmw-chevron", onClick: disabled ? undefined : returnFn },
|
|
12
|
+
React.createElement(SvgChevronLeft, null))),
|
|
13
|
+
React.createElement(Text, { className: 'gmw-title', variant: 'title' }, title)));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=WidgetHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WidgetHeader.js","sourceRoot":"","sources":["../../../../src/widget/components/WidgetHeader.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,QAAQ,GACU,EAAE,EAAE;IACtB,OAAO,CACL,6BAAK,SAAS,EAAC,6BAA6B;QACzC,QAAQ,IAAI,CACX,6BACE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,aAAa,EAC5D,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YAExC,oBAAC,cAAc,OAAG,CACd,CACP;QACD,oBAAC,IAAI,IAAC,SAAS,EAAC,WAAW,EAAC,OAAO,EAAC,OAAO,IACxC,KAAK,CACD,CACH,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 { SvgChevronLeft } from \"@itwin/itwinui-icons-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport \"./WidgetHeader.scss\";\nimport React from \"react\";\n\nexport interface WidgetHeaderProps {\n title: string;\n disabled?: boolean;\n returnFn?: () => void;\n}\n\nexport const WidgetHeader = ({\n title,\n disabled = false,\n returnFn,\n}: WidgetHeaderProps) => {\n return (\n <div className='gmw-widget-header-container'>\n {returnFn && (\n <div\n className={disabled ? \"gmw-chevron-disabled\" : \"gmw-chevron\"}\n onClick={disabled ? undefined : returnFn}\n >\n <SvgChevronLeft />\n </div>\n )}\n <Text className='gmw-title' variant='title'>\n {title}\n </Text>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
@import "~@itwin/itwinui-css/scss/icon/index";
|
|
7
|
+
@import "~@itwin/itwinui-css/scss/button/index";
|
|
8
|
+
|
|
9
|
+
.gmw-widget-header-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
margin-bottom: $iui-baseline * 2;
|
|
12
|
+
|
|
13
|
+
.gmw-chevron {
|
|
14
|
+
@include iui-icons-large();
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
align-self: center;
|
|
17
|
+
margin-right: $iui-s;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.gmw-chevron-disabled {
|
|
21
|
+
@include iui-icons-large();
|
|
22
|
+
@include themed {
|
|
23
|
+
fill: t(iui-icons-color-actionable-disabled);
|
|
24
|
+
}
|
|
25
|
+
cursor: not-allowed;
|
|
26
|
+
|
|
27
|
+
align-self: center;
|
|
28
|
+
margin-right: $iui-s;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.gmw-title {
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { MutableRefObject } from "react";
|
|
3
3
|
import type { Group } from "@itwin/insights-client";
|
|
4
|
+
import type { KeySet } from "@itwin/presentation-common";
|
|
5
|
+
export interface QueryCacheItem {
|
|
6
|
+
keySet: KeySet;
|
|
7
|
+
ids: string[];
|
|
8
|
+
}
|
|
4
9
|
export interface GroupHilitedElements {
|
|
5
|
-
hilitedElementsQueryCache: MutableRefObject<Map<string,
|
|
10
|
+
hilitedElementsQueryCache: MutableRefObject<Map<string, QueryCacheItem>>;
|
|
6
11
|
hiddenGroupsIds: string[];
|
|
7
12
|
showGroupColor: boolean;
|
|
8
13
|
groups: Group[];
|
|
@@ -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;
|
|
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;IACnB,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: string[];\n showGroupColor: boolean;\n groups: Group[];\n setGroups: (groups: Group[]) => void;\n setHiddenGroupsIds: (hiddenGroupIds: 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: [],\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"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { CalculatedProperty, CustomCalculation, GroupProperty } from "@itwin/insights-client";
|
|
3
|
+
export interface Properties {
|
|
4
|
+
showGroupColor: boolean;
|
|
5
|
+
groupProperties?: GroupProperty[];
|
|
6
|
+
calculatedProperties?: CalculatedProperty[];
|
|
7
|
+
customCalculationProperties?: CustomCalculation[];
|
|
8
|
+
setGroupProperties: (groupProperties: GroupProperty[]) => void;
|
|
9
|
+
setCalculatedProperties: (calculatedProperties: CalculatedProperty[]) => void;
|
|
10
|
+
setCustomCalculationProperties: (customCalculationProperties: CustomCalculation[]) => void;
|
|
11
|
+
setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const PropertiesContext: React.Context<Properties>;
|
|
14
|
+
export declare const usePropertiesContext: () => Properties;
|
|
15
|
+
//# sourceMappingURL=PropertiesContext.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
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 * as React from "react";
|
|
6
|
+
export const PropertiesContext = React.createContext({
|
|
7
|
+
showGroupColor: false,
|
|
8
|
+
setGroupProperties: () => { },
|
|
9
|
+
setCalculatedProperties: () => { },
|
|
10
|
+
setCustomCalculationProperties: () => { },
|
|
11
|
+
setShowGroupColor: () => { },
|
|
12
|
+
});
|
|
13
|
+
export const usePropertiesContext = () => {
|
|
14
|
+
const context = React.useContext(PropertiesContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error("usePropertiesContext should be used within a PropertiesContext provider");
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=PropertiesContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertiesContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/PropertiesContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAa;IAC/D,cAAc,EAAE,KAAK;IACrB,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,uBAAuB,EAAE,GAAG,EAAE,GAAG,CAAC;IAClC,8BAA8B,EAAE,GAAG,EAAE,GAAG,CAAC;IACzC,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAe,EAAE;IACnD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,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 { CalculatedProperty, CustomCalculation, GroupProperty } from \"@itwin/insights-client\";\n\nexport interface Properties {\n showGroupColor: boolean;\n groupProperties?: GroupProperty[];\n calculatedProperties?: CalculatedProperty[];\n customCalculationProperties?: CustomCalculation[];\n setGroupProperties: (groupProperties: GroupProperty[]) => void;\n setCalculatedProperties: (calculatedProperties: CalculatedProperty[]) => void;\n setCustomCalculationProperties: (customCalculationProperties: CustomCalculation[]) => void;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n}\n\nexport const PropertiesContext = React.createContext<Properties>({\n showGroupColor: false,\n setGroupProperties: () => { },\n setCalculatedProperties: () => { },\n setCustomCalculationProperties: () => { },\n setShowGroupColor: () => { },\n});\n\nexport const usePropertiesContext = (): Properties => {\n const context = React.useContext(PropertiesContext);\n if (!context) {\n throw new Error(\n \"usePropertiesContext should be used within a PropertiesContext provider\"\n );\n }\n return context;\n};\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
2
|
import type { Group } from "@itwin/insights-client";
|
|
3
|
+
import type { QueryCacheItem } from "./context/GroupHilitedElementsContext";
|
|
3
4
|
export declare const getGroupColor: (index: number) => string;
|
|
4
|
-
export declare const getHiliteIdsFromGroups: (iModelConnection: IModelConnection, groups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string,
|
|
5
|
-
export declare const hideGroups: (iModelConnection: IModelConnection, viewGroups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string,
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const getHiliteIdsFromGroups: (iModelConnection: IModelConnection, groups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<string[]>;
|
|
6
|
+
export declare const hideGroups: (iModelConnection: IModelConnection, viewGroups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<void>;
|
|
7
|
+
export declare const hideGroup: (iModelConnection: IModelConnection, viewGroup: Group, hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<void>;
|
|
8
|
+
export declare const visualizeGroupColors: (iModelConnection: IModelConnection, groups: Group[], viewGroups: Group[], hiddenGroupsIds: string[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>, doEmphasizeElements?: boolean) => Promise<void>;
|
|
9
|
+
export declare const getHiliteIdsAndKeysetFromGroup: (iModelConnection: IModelConnection, group: Group, hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<QueryCacheItem>;
|
|
7
10
|
//# sourceMappingURL=groupsHelpers.d.ts.map
|
|
@@ -4,59 +4,39 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { FeatureOverrideType } from "@itwin/core-common";
|
|
6
6
|
import { toaster } from "@itwin/itwinui-react";
|
|
7
|
-
import {
|
|
7
|
+
import { KeySet } from "@itwin/presentation-common";
|
|
8
|
+
import { clearEmphasizedOverriddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements, zoomToElements } from "./viewerUtils";
|
|
8
9
|
const goldenAngle = 180 * (3 - Math.sqrt(5));
|
|
9
10
|
export const getGroupColor = function (index) {
|
|
10
11
|
return `hsl(${index * goldenAngle + 60}, 100%, 50%)`;
|
|
11
12
|
};
|
|
12
13
|
export const getHiliteIdsFromGroups = async (iModelConnection, groups, hilitedElementsQueryCache) => {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const distinctQueries = new Set();
|
|
15
|
+
const promises = [];
|
|
15
16
|
for (const group of groups) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
currentIds = (_a = hilitedElementsQueryCache.current.get(query)) !== null && _a !== void 0 ? _a : [];
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
try {
|
|
23
|
-
const queryRowCount = await iModelConnection.queryRowCount(query);
|
|
24
|
-
if (queryRowCount === 0) {
|
|
25
|
-
toaster.warning(`${group.groupName}'s query is valid but produced no results.`);
|
|
26
|
-
}
|
|
27
|
-
currentIds = await getHiliteIds(query, iModelConnection);
|
|
28
|
-
hilitedElementsQueryCache.current.set(query, currentIds);
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
toaster.negative(`Could not hide/show ${group.groupName}. Query could not be resolved.`);
|
|
32
|
-
}
|
|
17
|
+
if (!distinctQueries.has(group.query)) {
|
|
18
|
+
distinctQueries.add(group.query);
|
|
19
|
+
promises.push(getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache));
|
|
33
20
|
}
|
|
34
|
-
allIds = allIds.concat(currentIds);
|
|
35
21
|
}
|
|
22
|
+
const results = await Promise.all(promises);
|
|
23
|
+
const allIds = results.flatMap((result) => result.ids);
|
|
36
24
|
return allIds;
|
|
37
25
|
};
|
|
38
26
|
export const hideGroups = async (iModelConnection, viewGroups, hilitedElementsQueryCache) => {
|
|
39
|
-
|
|
27
|
+
const distinctQueries = new Set();
|
|
28
|
+
const promises = [];
|
|
40
29
|
for (const viewGroup of viewGroups) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
hideElements(hilitedIds);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
try {
|
|
48
|
-
const queryRowCount = await iModelConnection.queryRowCount(query);
|
|
49
|
-
if (queryRowCount === 0) {
|
|
50
|
-
toaster.warning(`${viewGroup.groupName}'s query is valid but produced no results.`);
|
|
51
|
-
}
|
|
52
|
-
const hiliteIds = await hideElementsByQuery(query, iModelConnection, false);
|
|
53
|
-
hilitedElementsQueryCache.current.set(query, hiliteIds);
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
toaster.negative(`Could not hide/show ${viewGroup.groupName}. Query could not be resolved.`);
|
|
57
|
-
}
|
|
30
|
+
if (!distinctQueries.has(viewGroup.query)) {
|
|
31
|
+
distinctQueries.add(viewGroup.query);
|
|
32
|
+
promises.push(hideGroup(iModelConnection, viewGroup, hilitedElementsQueryCache));
|
|
58
33
|
}
|
|
59
34
|
}
|
|
35
|
+
await Promise.all(promises);
|
|
36
|
+
};
|
|
37
|
+
export const hideGroup = async (iModelConnection, viewGroup, hilitedElementsQueryCache) => {
|
|
38
|
+
const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, viewGroup, hilitedElementsQueryCache);
|
|
39
|
+
hideElements(result.ids);
|
|
60
40
|
};
|
|
61
41
|
export const visualizeGroupColors = async (iModelConnection, groups, viewGroups, hiddenGroupsIds, hilitedElementsQueryCache, doEmphasizeElements = true) => {
|
|
62
42
|
clearEmphasizedOverriddenElements();
|
|
@@ -65,7 +45,8 @@ export const visualizeGroupColors = async (iModelConnection, groups, viewGroups,
|
|
|
65
45
|
const index = viewGroups.length > groups.length
|
|
66
46
|
? viewGroups.findIndex((g) => g.id === group.id)
|
|
67
47
|
: groups.findIndex((g) => g.id === group.id);
|
|
68
|
-
const
|
|
48
|
+
const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);
|
|
49
|
+
const hilitedIds = result.ids;
|
|
69
50
|
overrideElements(hilitedIds, getGroupColor(index), FeatureOverrideType.ColorAndAlpha);
|
|
70
51
|
doEmphasizeElements && emphasizeElements(hilitedIds, undefined);
|
|
71
52
|
if (!hiddenGroupsIds.includes(group.id)) {
|
|
@@ -74,4 +55,24 @@ export const visualizeGroupColors = async (iModelConnection, groups, viewGroups,
|
|
|
74
55
|
}
|
|
75
56
|
await zoomToElements(allIds);
|
|
76
57
|
};
|
|
58
|
+
export const getHiliteIdsAndKeysetFromGroup = async (iModelConnection, group, hilitedElementsQueryCache) => {
|
|
59
|
+
var _a;
|
|
60
|
+
const query = group.query;
|
|
61
|
+
if (hilitedElementsQueryCache.current.has(query)) {
|
|
62
|
+
return (_a = hilitedElementsQueryCache.current.get(query)) !== null && _a !== void 0 ? _a : ({ keySet: new KeySet(), ids: [] });
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const queryRowCount = await iModelConnection.queryRowCount(query);
|
|
66
|
+
if (queryRowCount === 0) {
|
|
67
|
+
toaster.warning(`${group.groupName}'s query is valid but produced no results.`);
|
|
68
|
+
}
|
|
69
|
+
const result = await getHiliteIds(query, iModelConnection);
|
|
70
|
+
hilitedElementsQueryCache.current.set(query, result);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
toaster.negative(`Query could not be resolved.`);
|
|
75
|
+
return ({ keySet: new KeySet(), ids: [] });
|
|
76
|
+
}
|
|
77
|
+
};
|
|
77
78
|
//# sourceMappingURL=groupsHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/widget/components/groupsHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/widget/components/groupsHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnJ,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,KAAa;IAClD,OAAO,OAAO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AC,EAAE,CAAC,EAAE;YACvC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SACpC;KACF;IAED,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EACjD,gBAAkC,EAClC,KAAY,EACZ,yBAA8E,EAC9E,EAAE;;IACF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,IAAI,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAChD,OAAO,MAAA,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,mCAAI,CAAC,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;KAC5F;IACD,IAAI;QACF,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,aAAa,KAAK,CAAC,EAAE;YACvB,OAAO,CAAC,OAAO,CACb,GAAG,KAAK,CAAC,SAAS,4CAA4C,CAC/D,CAAC;SACH;QACD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAC3D,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;KACf;IAAC,MAAM;QACN,OAAO,CAAC,QAAQ,CACd,8BAA8B,CAC/B,CAAC;QACF,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;KAC5C;AAEH,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport type { QueryCacheItem } from \"./context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements, zoomToElements } from \"./viewerUtils\";\n\nconst goldenAngle = 180 * (3 - Math.sqrt(5));\n\nexport const getGroupColor = function (index: number) {\n return `hsl(${index * goldenAngle + 60}, 100%, 50%)`;\n};\n\nexport const getHiliteIdsFromGroups = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const distinctQueries = new Set<string>();\n const promises: Promise<{ ids: string[] }>[] = [];\n for (const group of groups) {\n if (!distinctQueries.has(group.query)) {\n distinctQueries.add(group.query);\n promises.push(getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache));\n }\n }\n const results = await Promise.all(promises);\n const allIds = results.flatMap((result) => result.ids);\n return allIds;\n};\n\nexport const hideGroups = async (\n iModelConnection: IModelConnection,\n viewGroups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const distinctQueries = new Set<string>();\n const promises: Promise<void>[] = [];\n\n for (const viewGroup of viewGroups) {\n if (!distinctQueries.has(viewGroup.query)) {\n distinctQueries.add(viewGroup.query);\n promises.push(hideGroup(iModelConnection, viewGroup, hilitedElementsQueryCache));\n }\n }\n await Promise.all(promises);\n};\n\nexport const hideGroup = async (\n iModelConnection: IModelConnection,\n viewGroup: Group,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, viewGroup, hilitedElementsQueryCache);\n hideElements(result.ids);\n};\n\nexport const visualizeGroupColors = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n viewGroups: Group[],\n hiddenGroupsIds: string[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>,\n doEmphasizeElements: boolean = true\n) => {\n clearEmphasizedOverriddenElements();\n let allIds: string[] = [];\n for (const group of viewGroups) {\n const index =\n viewGroups.length > groups.length\n ? viewGroups.findIndex((g) => g.id === group.id)\n : groups.findIndex((g) => g.id === group.id);\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);\n const hilitedIds = result.ids;\n overrideElements(\n hilitedIds,\n getGroupColor(index),\n FeatureOverrideType.ColorAndAlpha,\n );\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n if (!hiddenGroupsIds.includes(group.id)) {\n allIds = allIds.concat(hilitedIds);\n }\n }\n\n await zoomToElements(allIds);\n};\n\nexport const getHiliteIdsAndKeysetFromGroup = async (\n iModelConnection: IModelConnection,\n group: Group,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const query = group.query;\n if (hilitedElementsQueryCache.current.has(query)) {\n return hilitedElementsQueryCache.current.get(query) ?? ({ keySet: new KeySet(), ids: [] });\n }\n try {\n const queryRowCount = await iModelConnection.queryRowCount(query);\n if (queryRowCount === 0) {\n toaster.warning(\n `${group.groupName}'s query is valid but produced no results.`\n );\n }\n const result = await getHiliteIds(query, iModelConnection);\n hilitedElementsQueryCache.current.set(query, result);\n return result;\n } catch {\n toaster.negative(\n `Query could not be resolved.`\n );\n return ({ keySet: new KeySet(), ids: [] });\n }\n\n};\n"]}
|
|
@@ -8,6 +8,7 @@ import { EditorContainer, UiComponents, } from "@itwin/components-react";
|
|
|
8
8
|
import { NonPrimitivePropertyRenderer } from "./NonPrimitivePropertyRenderer";
|
|
9
9
|
import { PrimitivePropertyRenderer } from "./PrimitivePropertyRenderer";
|
|
10
10
|
import { CommonPropertyRenderer } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer";
|
|
11
|
+
import { createNewDisplayValue } from "./createNewDisplayValue";
|
|
11
12
|
/** A React component that renders properties
|
|
12
13
|
* @public
|
|
13
14
|
*/
|
|
@@ -39,7 +40,7 @@ export class PropertyRenderer extends React.Component {
|
|
|
39
40
|
this.updateDisplayValueAsEditor(props);
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
|
-
const displayValue =
|
|
43
|
+
const displayValue = createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);
|
|
43
44
|
this.setState({ displayValue });
|
|
44
45
|
}
|
|
45
46
|
/** Display property record value in an editor */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRender.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyRender.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAQ5D,OAAO,EACL,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8FAA8F,CAAC;AAsEtI;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK,CAAC,SAG3C;IAHD;;QAIE,gBAAgB;QACS,UAAK,GAAoC;YAChE,YAAY,EAAE,YAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC;SACxD,CAAC;QAiCM,kBAAa,GAAG,CAAC,IAAyB,EAAE,EAAE;YACpD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;gBAC3B,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC;QAEM,kBAAa,GAAG,GAAG,EA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S,CAAC,SAAS,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;YAC5C,SAAS,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,EAChD;YACA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;IACH,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,MAAM,sBAAsB,GAA2B;YACrD,GAAG,KAAK;YACR,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;SACpC,CAAC;QAEF,QAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,KAAK,mBAAmB,CAAC,SAAS;gBAChC,OAAO,CACL,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAC1D,CAAC;YACJ,KAAK,mBAAmB,CAAC,KAAK;gBAC5B,uDAAuD;gBACvD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,KAAK;uBACxE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBACrD,OAAO,CACL,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAC1D,CAAC;YACN,0CAA0C;YAC1C,KAAK,mBAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,4BAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;SACL;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport type {\n ActionButtonRenderer,\n PrimitiveRendererProps,\n PropertyUpdatedArgs,\n PropertyValueRendererManager,\n} from \"@itwin/components-react\";\nimport {\n EditorContainer,\n UiComponents,\n} from \"@itwin/components-react\";\n\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport type { HighlightingComponentProps } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers @beta */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited @beta */\n isEditing?: boolean;\n /** Called when property edit is committed. @beta */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. @beta */\n onEditCancel?: () => void;\n /** Props used for highlighting. @beta */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\nPropertyRendererProps,\nPropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number,\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth,\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit) {\n this.props.onEditCommit(args);\n }\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) {\n this.props.onEditCancel();\n }\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n ) {\n this.updateDisplayValue(this.props);\n }\n }\n\n /** @internal */\n public override render() {\n const { ...props } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n && this.props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyRender.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyRender.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAQ5D,OAAO,EACL,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,4B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AAuD;gBACvD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,KAAK;uBACxE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBACrD,OAAO,CACL,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAC1D,CAAC;YACN,0CAA0C;YAC1C,KAAK,mBAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,4BAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;SACL;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport type {\n ActionButtonRenderer,\n PrimitiveRendererProps,\n PropertyUpdatedArgs,\n PropertyValueRendererManager,\n} from \"@itwin/components-react\";\nimport {\n EditorContainer,\n UiComponents,\n} from \"@itwin/components-react\";\n\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport type { HighlightingComponentProps } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { createNewDisplayValue } from \"./createNewDisplayValue\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers @beta */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited @beta */\n isEditing?: boolean;\n /** Called when property edit is committed. @beta */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. @beta */\n onEditCancel?: () => void;\n /** Props used for highlighting. @beta */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\nPropertyRendererProps,\nPropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number,\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth,\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit) {\n this.props.onEditCommit(args);\n }\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) {\n this.props.onEditCancel();\n }\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n ) {\n this.updateDisplayValue(this.props);\n }\n }\n\n /** @internal */\n public override render() {\n const { ...props } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n && this.props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Common
|
|
3
|
+
*/
|
|
4
|
+
/** Counts how many times string 'lookup' is repeated in string 'str'.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function countMatchesInString(str: string, lookup: string): number;
|
|
8
|
+
//# sourceMappingURL=countMatchesInString.d.ts.map
|