@itwin/grouping-mapping-widget 0.18.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/grouping-mapping-widget.d.ts +3 -1
- package/lib/cjs/grouping-mapping-widget.js +7 -3
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +9 -5
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/cjs/widget/components/GroupItem.d.ts +2 -2
- package/lib/cjs/widget/components/GroupItem.js.map +1 -1
- package/lib/cjs/widget/components/GroupMenuActions.d.ts +2 -2
- package/lib/cjs/widget/components/GroupMenuActions.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContext.js +6 -0
- package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/widget/components/Groups.d.ts +16 -0
- package/lib/cjs/widget/components/Groups.js +46 -0
- package/lib/cjs/widget/components/Groups.js.map +1 -0
- package/lib/cjs/widget/components/GroupsView.d.ts +31 -0
- package/lib/cjs/widget/components/GroupsView.js +37 -0
- package/lib/cjs/widget/components/GroupsView.js.map +1 -0
- package/lib/{esm/widget/components/Grouping.scss → cjs/widget/components/GroupsView.scss} +4 -8
- package/lib/cjs/widget/components/GroupsVisualization.d.ts +2 -2
- package/lib/cjs/widget/components/GroupsVisualization.js +21 -23
- package/lib/cjs/widget/components/GroupsVisualization.js.map +1 -1
- package/lib/cjs/widget/components/hooks/useGroupsOperations.d.ts +20 -0
- package/lib/cjs/widget/components/hooks/useGroupsOperations.js +67 -0
- package/lib/cjs/widget/components/hooks/useGroupsOperations.js.map +1 -0
- package/lib/cjs/widget/components/utils.d.ts +1 -0
- package/lib/cjs/widget/components/utils.js +6 -1
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/viewerUtils.js +2 -5
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +3 -1
- package/lib/esm/grouping-mapping-widget.js +3 -1
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +10 -6
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/widget/components/GroupItem.d.ts +2 -2
- package/lib/esm/widget/components/GroupItem.js.map +1 -1
- package/lib/esm/widget/components/GroupMenuActions.d.ts +2 -2
- package/lib/esm/widget/components/GroupMenuActions.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContext.js +6 -0
- package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/widget/components/Groups.d.ts +16 -0
- package/lib/esm/widget/components/Groups.js +23 -0
- package/lib/esm/widget/components/Groups.js.map +1 -0
- package/lib/esm/widget/components/GroupsView.d.ts +31 -0
- package/lib/esm/widget/components/GroupsView.js +30 -0
- package/lib/esm/widget/components/GroupsView.js.map +1 -0
- package/lib/{cjs/widget/components/Grouping.scss → esm/widget/components/GroupsView.scss} +4 -8
- package/lib/esm/widget/components/GroupsVisualization.d.ts +2 -2
- package/lib/esm/widget/components/GroupsVisualization.js +22 -24
- package/lib/esm/widget/components/GroupsVisualization.js.map +1 -1
- package/lib/esm/widget/components/hooks/useGroupsOperations.d.ts +20 -0
- package/lib/esm/widget/components/hooks/useGroupsOperations.js +63 -0
- package/lib/esm/widget/components/hooks/useGroupsOperations.js.map +1 -0
- package/lib/esm/widget/components/utils.d.ts +1 -0
- package/lib/esm/widget/components/utils.js +4 -0
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/viewerUtils.js +3 -6
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/widget/components/Grouping.d.ts +0 -22
- package/lib/cjs/widget/components/Grouping.js +0 -96
- package/lib/cjs/widget/components/Grouping.js.map +0 -1
- package/lib/esm/widget/components/Grouping.d.ts +0 -22
- package/lib/esm/widget/components/Grouping.js +0 -70
- package/lib/esm/widget/components/Grouping.js.map +0 -1
|
@@ -9,8 +9,10 @@ export { Mappings, MappingsProps } from "./widget/components/Mappings";
|
|
|
9
9
|
export { useMappingsOperations, MappingsOperationsProps } from "./widget/components/hooks/useMappingsOperations";
|
|
10
10
|
export { MappingAction, MappingActionProps } from "./widget/components/MappingAction";
|
|
11
11
|
export { MappingsView, MappingsViewProps } from "./widget/components/MappingsView";
|
|
12
|
+
export { useGroupsOperations, GroupsOperationsProps } from "./widget/components/hooks/useGroupsOperations";
|
|
13
|
+
export { GroupsView, GroupsViewProps } from "./widget/components/GroupsView";
|
|
12
14
|
export { GroupingMappingContext, GroupingMappingContextProps } from "./widget/components/GroupingMappingContext";
|
|
13
|
-
export {
|
|
15
|
+
export { Groups, GroupsProps } from "./widget/components/Groups";
|
|
14
16
|
export { GroupsVisualization, GroupsVisualizationProps } from "./widget/components/GroupsVisualization";
|
|
15
17
|
export { GroupAction, GroupActionProps } from "./widget/components/GroupAction";
|
|
16
18
|
export { PropertyMenu, PropertyMenuProps } from "./widget/components/PropertyMenu";
|
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.resolveFormulaDataType = exports.GroupingMappingCustomUIType = exports.GroupQueryBuilderCustomUI = exports.ManualGroupingCustomUI = exports.SearchGroupingCustomUI = exports.CustomCalculationAction = exports.CalculatedPropertyActionWithVisuals = exports.CalculatedPropertyAction = exports.GroupPropertyAction = exports.PropertyMenuWithVisualization = exports.PropertyMenu = exports.GroupAction = exports.GroupsVisualization = exports.
|
|
13
|
+
exports.resolveFormulaDataType = exports.GroupingMappingCustomUIType = exports.GroupQueryBuilderCustomUI = exports.ManualGroupingCustomUI = exports.SearchGroupingCustomUI = exports.CustomCalculationAction = exports.CalculatedPropertyActionWithVisuals = exports.CalculatedPropertyAction = exports.GroupPropertyAction = exports.PropertyMenuWithVisualization = exports.PropertyMenu = exports.GroupAction = exports.GroupsVisualization = exports.Groups = exports.GroupingMappingContext = exports.GroupsView = exports.useGroupsOperations = exports.MappingsView = exports.MappingAction = exports.useMappingsOperations = exports.Mappings = exports.useGroupingMappingApiConfig = exports.GroupingMappingApiConfigContext = exports.useMappingClient = exports.MappingClientContext = exports.createMappingClient = exports.createDefaultMappingClient = void 0;
|
|
14
14
|
/*---------------------------------------------------------------------------------------------
|
|
15
15
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
16
16
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -36,10 +36,14 @@ var MappingAction_1 = require("./widget/components/MappingAction");
|
|
|
36
36
|
Object.defineProperty(exports, "MappingAction", { enumerable: true, get: function () { return MappingAction_1.MappingAction; } });
|
|
37
37
|
var MappingsView_1 = require("./widget/components/MappingsView");
|
|
38
38
|
Object.defineProperty(exports, "MappingsView", { enumerable: true, get: function () { return MappingsView_1.MappingsView; } });
|
|
39
|
+
var useGroupsOperations_1 = require("./widget/components/hooks/useGroupsOperations");
|
|
40
|
+
Object.defineProperty(exports, "useGroupsOperations", { enumerable: true, get: function () { return useGroupsOperations_1.useGroupsOperations; } });
|
|
41
|
+
var GroupsView_1 = require("./widget/components/GroupsView");
|
|
42
|
+
Object.defineProperty(exports, "GroupsView", { enumerable: true, get: function () { return GroupsView_1.GroupsView; } });
|
|
39
43
|
var GroupingMappingContext_1 = require("./widget/components/GroupingMappingContext");
|
|
40
44
|
Object.defineProperty(exports, "GroupingMappingContext", { enumerable: true, get: function () { return GroupingMappingContext_1.GroupingMappingContext; } });
|
|
41
|
-
var
|
|
42
|
-
Object.defineProperty(exports, "
|
|
45
|
+
var Groups_1 = require("./widget/components/Groups");
|
|
46
|
+
Object.defineProperty(exports, "Groups", { enumerable: true, get: function () { return Groups_1.Groups; } });
|
|
43
47
|
var GroupsVisualization_1 = require("./widget/components/GroupsVisualization");
|
|
44
48
|
Object.defineProperty(exports, "GroupsVisualization", { enumerable: true, get: function () { return GroupsVisualization_1.GroupsVisualization; } });
|
|
45
49
|
var GroupAction_1 = require("./widget/components/GroupAction");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouping-mapping-widget.js","sourceRoot":"","sources":["../../src/grouping-mapping-widget.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAAgD;AAChD,iEAA+C;AAE/C,0EAA0E;AAC1E,yFAA2J;AAAlJ,kIAAA,0BAA0B,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AAAE,wHAAA,gBAAgB,OAAA;AAChG,iGAA8L;AAA3H,2IAAA,+BAA+B,OAAA;AAAE,uIAAA,2BAA2B,OAAA;AAC/H,yDAAuC;AAEvC,yCAAyC;AACzC,yDAAuE;AAA9D,oGAAA,QAAQ,OAAA;AACjB,yFAAiH;AAAxG,8HAAA,qBAAqB,OAAA;AAC9B,mEAAsF;AAA7E,8GAAA,aAAa,OAAA;AACtB,iEAAmF;AAA1E,4GAAA,YAAY,OAAA;AACrB,qFAAiH;AAAxG,gIAAA,sBAAsB,OAAA;AAC/B,
|
|
1
|
+
{"version":3,"file":"grouping-mapping-widget.js","sourceRoot":"","sources":["../../src/grouping-mapping-widget.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAAgD;AAChD,iEAA+C;AAE/C,0EAA0E;AAC1E,yFAA2J;AAAlJ,kIAAA,0BAA0B,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AAAE,wHAAA,gBAAgB,OAAA;AAChG,iGAA8L;AAA3H,2IAAA,+BAA+B,OAAA;AAAE,uIAAA,2BAA2B,OAAA;AAC/H,yDAAuC;AAEvC,yCAAyC;AACzC,yDAAuE;AAA9D,oGAAA,QAAQ,OAAA;AACjB,yFAAiH;AAAxG,8HAAA,qBAAqB,OAAA;AAC9B,mEAAsF;AAA7E,8GAAA,aAAa,OAAA;AACtB,iEAAmF;AAA1E,4GAAA,YAAY,OAAA;AACrB,qFAA2G;AAAlG,0HAAA,mBAAmB,OAAA;AAC5B,6DAA6E;AAApE,wGAAA,UAAU,OAAA;AACnB,qFAAiH;AAAxG,gIAAA,sBAAsB,OAAA;AAC/B,qDAAiE;AAAxD,gGAAA,MAAM,OAAA;AACf,+EAAwG;AAA/F,0HAAA,mBAAmB,OAAA;AAC5B,+DAAgF;AAAvE,0GAAA,WAAW,OAAA;AACpB,iEAAmF;AAA1E,4GAAA,YAAY,OAAA;AACrB,mGAAsI;AAA7H,8IAAA,6BAA6B,OAAA;AACtC,+EAAwG;AAA/F,0HAAA,mBAAmB,OAAA;AAC5B,yFAAuH;AAA9G,oIAAA,wBAAwB,OAAA;AACjC,+GAAwJ;AAA/I,0JAAA,mCAAmC,OAAA;AAC5C,uFAAoH;AAA3G,kIAAA,uBAAuB,OAAA;AAChC,8FAA6F;AAApF,gIAAA,sBAAsB,OAAA;AAC/B,8FAA6F;AAApF,gIAAA,sBAAsB,OAAA;AAC/B,oGAAmG;AAA1F,sIAAA,yBAAyB,OAAA;AAClC,gGAA4M;AAA1K,sIAAA,2BAA2B,OAAA;AAE7D,gCAAgC;AAChC,6EAA2E;AAAlE,iIAAA,sBAAsB,OAAA","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*--------------------------------------------------------------------------------------------*/\n/** UI Provider for iTwin Viewer Applications */\nexport * from \"./widget/GroupingMappingWidget\";\n\n/** Interfaces for providing custom MappingClient and API configuration */\nexport { createDefaultMappingClient, createMappingClient, MappingClientContext, useMappingClient } from \"./widget/components/context/MappingClientContext\";\nexport { ClientPrefix, GetAccessTokenFn, GroupingMappingApiConfig, GroupingMappingApiConfigContext, useGroupingMappingApiConfig } from \"./widget/components/context/GroupingApiConfigContext\";\nexport * from \"@itwin/insights-client\";\n\n/** Internal components for custom UIs */\nexport { Mappings, MappingsProps } from \"./widget/components/Mappings\";\nexport { useMappingsOperations, MappingsOperationsProps } from \"./widget/components/hooks/useMappingsOperations\";\nexport { MappingAction, MappingActionProps } from \"./widget/components/MappingAction\";\nexport { MappingsView, MappingsViewProps } from \"./widget/components/MappingsView\";\nexport { useGroupsOperations, GroupsOperationsProps } from \"./widget/components/hooks/useGroupsOperations\";\nexport { GroupsView, GroupsViewProps } from \"./widget/components/GroupsView\";\nexport { GroupingMappingContext, GroupingMappingContextProps } from \"./widget/components/GroupingMappingContext\";\nexport { Groups, GroupsProps } from \"./widget/components/Groups\";\nexport { GroupsVisualization, GroupsVisualizationProps } from \"./widget/components/GroupsVisualization\";\nexport { GroupAction, GroupActionProps } from \"./widget/components/GroupAction\";\nexport { PropertyMenu, PropertyMenuProps } from \"./widget/components/PropertyMenu\";\nexport { PropertyMenuWithVisualization, PropertyMenuWithVisualizationProps } from \"./widget/components/PropertyMenuWithVisualization\";\nexport { GroupPropertyAction, GroupPropertyActionProps } from \"./widget/components/GroupPropertyAction\";\nexport { CalculatedPropertyAction, CalculatedPropertyActionProps } from \"./widget/components/CalculatedPropertyAction\";\nexport { CalculatedPropertyActionWithVisuals, CalculatedPropertyActionWithVisualsProps } from \"./widget/components/CalculatedPropertyActionWithVisuals\";\nexport { CustomCalculationAction, CustomCalculationActionProps } from \"./widget/components/CustomCalculationAction\";\nexport { SearchGroupingCustomUI } from \"./widget/components/customUI/SearchGroupingCustomUI\";\nexport { ManualGroupingCustomUI } from \"./widget/components/customUI/ManualGroupingCustomUI\";\nexport { GroupQueryBuilderCustomUI } from \"./widget/components/customUI/GroupQueryBuilderCustomUI\";\nexport { GroupingMappingCustomUI, GroupingMappingCustomUIType, ContextCustomUI, GroupingCustomUI, GroupingCustomUIProps, ContextCustomUIProps } from \"./widget/components/customUI/GroupingMappingCustomUI\";\n\n/** Formula DataType resolver */\nexport { resolveFormulaDataType } from \"./formula/FormulaDataTypeResolver\";\nexport { DataType, PropertyMap } from \"./formula/Types\";\nexport { IResult } from \"./formula/IResult\";\n"]}
|
|
@@ -90,8 +90,12 @@ jest.mock("../widget/components/context/MappingClientContext", () => ({
|
|
|
90
90
|
...jest.requireActual("../widget/components/context/MappingClientContext"),
|
|
91
91
|
useMappingClient: () => mappingClientMock.object,
|
|
92
92
|
}));
|
|
93
|
+
jest.mock("../widget/components/utils", () => ({
|
|
94
|
+
...jest.requireActual("../widget/components/utils"),
|
|
95
|
+
enableExperimentalFeatures: jest.fn,
|
|
96
|
+
}));
|
|
93
97
|
const mockGroups = groupsFactory();
|
|
94
|
-
describe("
|
|
98
|
+
describe("Groups View", () => {
|
|
95
99
|
beforeEach(async () => {
|
|
96
100
|
connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);
|
|
97
101
|
connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);
|
|
@@ -108,7 +112,7 @@ describe("Groupings View", () => {
|
|
|
108
112
|
// Arange
|
|
109
113
|
// Act
|
|
110
114
|
const user = user_event_1.default.setup();
|
|
111
|
-
(0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.
|
|
115
|
+
(0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.Groups, { mapping: mockMapping, onClickAddGroup: jest.fn(), onClickGroupModify: jest.fn(), onClickGroupTitle: jest.fn, onClickRenderContextCustomUI: jest.fn() }));
|
|
112
116
|
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
113
117
|
// Assert
|
|
114
118
|
// Should have the correct random mockGroups.groups count listed
|
|
@@ -139,7 +143,7 @@ describe("Groupings View", () => {
|
|
|
139
143
|
};
|
|
140
144
|
const groupingMappingCustomUIMock = [mockGroupingUI];
|
|
141
145
|
// Act
|
|
142
|
-
const { user } = (0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.
|
|
146
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.Groups, { mapping: mockMapping, onClickAddGroup: jest.fn(), onClickGroupModify: jest.fn(), onClickGroupTitle: jest.fn, onClickRenderContextCustomUI: jest.fn() }), groupingMappingCustomUIMock);
|
|
143
147
|
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
144
148
|
// Assert
|
|
145
149
|
const addButton = test_utils_1.screen.getAllByTestId("gmw-add-group-button");
|
|
@@ -183,7 +187,7 @@ describe("Groupings View", () => {
|
|
|
183
187
|
const groupingMappingCustomUIMock = [mockContextUI];
|
|
184
188
|
const onClickRenderContextCustomUIMock = jest.fn();
|
|
185
189
|
// Act
|
|
186
|
-
const { user } = (0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.
|
|
190
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.Groups, { mapping: mockMapping, onClickAddGroup: jest.fn(), onClickGroupModify: jest.fn(), onClickGroupTitle: jest.fn, onClickRenderContextCustomUI: onClickRenderContextCustomUIMock }), groupingMappingCustomUIMock);
|
|
187
191
|
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
188
192
|
// Assert
|
|
189
193
|
// Should have the right group number
|
|
@@ -223,7 +227,7 @@ describe("Groupings View", () => {
|
|
|
223
227
|
const onClickAddGroup = jest.fn();
|
|
224
228
|
const onClickRenderContextCustomUIMock = jest.fn();
|
|
225
229
|
// Act
|
|
226
|
-
const { user } = (0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.
|
|
230
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(grouping_mapping_widget_1.Groups, { mapping: mockMapping, onClickAddGroup: onClickAddGroup, onClickGroupModify: jest.fn(), onClickGroupTitle: jest.fn, onClickRenderContextCustomUI: onClickRenderContextCustomUIMock }), groupingMappingCustomUIMock);
|
|
227
231
|
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
228
232
|
// Assert
|
|
229
233
|
const addButton = test_utils_1.screen.getAllByTestId("gmw-add-group-button");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,2CAAwC;AACxC,wEAAoF;AAEpF,6CAA+B;AAG/B,6EAAoD;AACpD,mDAAuF;AAEvF,MAAM,WAAW,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC3C,MAAM,aAAa,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC5C,MAAM,WAAW,GAAY;IAC3B,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yBAAyB;IACtC,SAAS,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAC/B,SAAS,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC3C,UAAU,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAChC,UAAU,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC5C,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAAI,EAAE,EAAE;SACT;KACF;CACF,CAAC;AAEF,MAAM,aAAa,GAAG,GAAoB,EAAE,CAAC,CAAC;IAC5C,MAAM,EAAE,KAAK,CAAC,IAAI,CAChB,EAAE,MAAM,EAAE,aAAK,CAAC,QAAQ,CAA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M,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACtI,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport \"@testing-library/jest-dom\";\nimport { faker } from \"@faker-js/faker\";\nimport { GroupingMappingCustomUIType, Groupings } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection, ViewManager } from \"@itwin/core-frontend\";\nimport type { ContextCustomUIProps, GroupingCustomUIProps, GroupingMappingCustomUI } from \"../grouping-mapping-widget\";\nimport userEvent from \"@testing-library/user-event\";\nimport { render, screen, waitForElementToBeRemoved, within } from \"../test/test-utils\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled: false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst viewManagerMock = moq.Mock.ofType<ViewManager>();\nconst mappingClientMock = moq.Mock.ofType<IMappingsClient>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\njest.mock(\"@itwin/core-frontend\", () => ({\n ...jest.requireActual(\"@itwin/core-frontend\"),\n IModelApp: {\n viewManager: {},\n },\n}));\n\njest.mock(\"../widget/components/context/MappingClientContext\", () => ({\n ...jest.requireActual(\"../widget/components/context/MappingClientContext\"),\n useMappingClient: () => mappingClientMock.object,\n}));\n\nconst mockGroups = groupsFactory();\n\ndescribe(\"Groupings View\", () => {\n beforeEach(async () => {\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n mappingClientMock\n .setup(async (x) => x.getGroups(moq.It.isAny(), moq.It.isAny(), moq.It.isAny()))\n .returns(async () => Promise.resolve(mockGroups.groups));\n });\n\n afterEach(() => {\n connectionMock.reset();\n mappingClientMock.reset();\n viewManagerMock.reset();\n });\n\n it(\"List all groups\", async () => {\n // Arange\n\n // Act\n const user = userEvent.setup();\n render(\n <Groupings\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the correct random mockGroups.groups count listed\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should only have the permanent delete context item.\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(1);\n expect(contextMenuItems[0]).toHaveTextContent(\"Remove\");\n });\n\n it(\"Set up grouping custom UI\", async () => {\n // Arange\n const mockedUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockGroupingUI];\n\n // Act\n const { user } = render(\n <Groupings\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Each group should have a more icon button\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n expect(moreButton.length).toBeGreaterThan(0);\n\n // Click on first more icon\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have exactly 1 sub menu item\n const editCustom = screen.getAllByTestId(`gmw-edit-0`);\n expect(editCustom).toHaveLength(1);\n expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Click on the edit custom UI\n await user.click(editCustom[0]);\n\n const groupName = screen.getAllByText(mockGroups.groups[0].groupName);\n expect(groupName).toHaveLength(1);\n });\n\n it(\"Set up context custom UI - should have add context menu\", async () => {\n // Arange\n const mockedUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI];\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groupings\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[1]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n\n it(\"Set up both grouping and context custom UI\", async () => {\n // Arange\n const mockedGroupingUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockedContextUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedGroupingUIComponent,\n };\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedContextUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI, mockGroupingUI];\n const onClickAddGroup = jest.fn();\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groupings\n mapping={mockMapping}\n onClickAddGroup={onClickAddGroup}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n await user.click(addCustom[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickAddGroup).toBeCalledWith(mockGroupingUI.name);\n\n // Check the group tile number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[1]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedContextUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,2CAAwC;AACxC,wEAAiF;AAEjF,6CAA+B;AAG/B,6EAAoD;AACpD,mDAAuF;AAEvF,MAAM,WAAW,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC3C,MAAM,aAAa,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC5C,MAAM,WAAW,GAAY;IAC3B,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yBAAyB;IACtC,SAAS,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAC/B,SAAS,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC3C,UAAU,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAChC,UAAU,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC5C,iBAAiB,EAAE,KAAK;IACxB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C,CAAC;QACtD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC1E,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAExD,0BAA0B;QAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,2DAA2D;QAC3D,MAAM,CAAC,gCAAgC,CAAC,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACtI,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport \"@testing-library/jest-dom\";\nimport { faker } from \"@faker-js/faker\";\nimport { GroupingMappingCustomUIType, Groups } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection, ViewManager } from \"@itwin/core-frontend\";\nimport type { ContextCustomUIProps, GroupingCustomUIProps, GroupingMappingCustomUI } from \"../grouping-mapping-widget\";\nimport userEvent from \"@testing-library/user-event\";\nimport { render, screen, waitForElementToBeRemoved, within } from \"../test/test-utils\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled: false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst viewManagerMock = moq.Mock.ofType<ViewManager>();\nconst mappingClientMock = moq.Mock.ofType<IMappingsClient>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\njest.mock(\"@itwin/core-frontend\", () => ({\n ...jest.requireActual(\"@itwin/core-frontend\"),\n IModelApp: {\n viewManager: {},\n },\n}));\n\njest.mock(\"../widget/components/context/MappingClientContext\", () => ({\n ...jest.requireActual(\"../widget/components/context/MappingClientContext\"),\n useMappingClient: () => mappingClientMock.object,\n}));\n\njest.mock(\"../widget/components/utils\", () => ({\n ...jest.requireActual(\"../widget/components/utils\"),\n enableExperimentalFeatures: jest.fn,\n}));\n\nconst mockGroups = groupsFactory();\n\ndescribe(\"Groups View\", () => {\n beforeEach(async () => {\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n mappingClientMock\n .setup(async (x) => x.getGroups(moq.It.isAny(), moq.It.isAny(), moq.It.isAny()))\n .returns(async () => Promise.resolve(mockGroups.groups));\n });\n\n afterEach(() => {\n connectionMock.reset();\n mappingClientMock.reset();\n viewManagerMock.reset();\n });\n\n it(\"List all groups\", async () => {\n // Arange\n\n // Act\n const user = userEvent.setup();\n render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the correct random mockGroups.groups count listed\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should only have the permanent delete context item.\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(1);\n expect(contextMenuItems[0]).toHaveTextContent(\"Remove\");\n });\n\n it(\"Set up grouping custom UI\", async () => {\n // Arange\n const mockedUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockGroupingUI];\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Each group should have a more icon button\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n expect(moreButton.length).toBeGreaterThan(0);\n\n // Click on first more icon\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have exactly 1 sub menu item\n const editCustom = screen.getAllByTestId(`gmw-edit-0`);\n expect(editCustom).toHaveLength(1);\n expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Click on the edit custom UI\n await user.click(editCustom[0]);\n\n const groupName = screen.getAllByText(mockGroups.groups[0].groupName);\n expect(groupName).toHaveLength(1);\n });\n\n it(\"Set up context custom UI - should have add context menu\", async () => {\n // Arange\n const mockedUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI];\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[1]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n\n it(\"Set up both grouping and context custom UI\", async () => {\n // Arange\n const mockedGroupingUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockedContextUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedGroupingUIComponent,\n };\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedContextUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI, mockGroupingUI];\n const onClickAddGroup = jest.fn();\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={onClickAddGroup}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n await user.click(addCustom[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickAddGroup).toBeCalledWith(mockGroupingUI.name);\n\n // Check the group tile number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[1]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedContextUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n});\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Group } from "@itwin/insights-client";
|
|
3
3
|
import type { ContextCustomUI, GroupingCustomUI } from "./customUI/GroupingMappingCustomUI";
|
|
4
|
-
import type {
|
|
5
|
-
export interface GroupItemProps extends Omit<
|
|
4
|
+
import type { GroupsProps } from "./Groups";
|
|
5
|
+
export interface GroupItemProps extends Omit<GroupsProps, "onClickAddGroup"> {
|
|
6
6
|
group: Group;
|
|
7
7
|
groupUIs: GroupingCustomUI[];
|
|
8
8
|
contextUIs: ContextCustomUI[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupItem.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupItem.tsx"],"names":[],"mappings":";;;;;;AAKA,kDAA0B;AAC1B,qDAAkD;AAGlD,yDAAsD;AAS/C,MAAM,SAAS,GAAG,CAAC,EACxB,iBAAiB,EACjB,cAAc,EACd,KAAK,EACL,GAAG,IAAI,EACQ,EAAE,EAAE;IAEnB,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,IAAI,iBAAiB,EAAE;YACrB,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,+BAAc,IACb,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,OAAO,EAAE,KAAK,CAAC,WAAW,EAC1B,WAAW,EACT,8BAAC,mCAAgB,IACf,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,KAC1B,IAAI,GACR,EAEJ,YAAY,EAAE,iBAAiB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,GAC7E,CACH,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,SAAS,aA2BpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { Group } from \"@itwin/insights-client\";\nimport React from \"react\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport type { ContextCustomUI, GroupingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type {
|
|
1
|
+
{"version":3,"file":"GroupItem.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupItem.tsx"],"names":[],"mappings":";;;;;;AAKA,kDAA0B;AAC1B,qDAAkD;AAGlD,yDAAsD;AAS/C,MAAM,SAAS,GAAG,CAAC,EACxB,iBAAiB,EACjB,cAAc,EACd,KAAK,EACL,GAAG,IAAI,EACQ,EAAE,EAAE;IAEnB,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,IAAI,iBAAiB,EAAE;YACrB,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,+BAAc,IACb,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,OAAO,EAAE,KAAK,CAAC,WAAW,EAC1B,WAAW,EACT,8BAAC,mCAAgB,IACf,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,KAC1B,IAAI,GACR,EAEJ,YAAY,EAAE,iBAAiB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,GAC7E,CACH,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,SAAS,aA2BpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { Group } from \"@itwin/insights-client\";\nimport React from \"react\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport type { ContextCustomUI, GroupingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { GroupsProps } from \"./Groups\";\nimport { GroupMenuActions } from \"./GroupMenuActions\";\n\nexport interface GroupItemProps extends Omit<GroupsProps, \"onClickAddGroup\"> {\n group: Group;\n groupUIs: GroupingCustomUI[];\n contextUIs: ContextCustomUI[];\n setShowDeleteModal: (showDeleteModal: Group) => void;\n}\n\nexport const GroupItem = ({\n onClickGroupTitle,\n disableActions,\n group,\n ...rest\n}: GroupItemProps) => {\n\n const onTitleClick = () => {\n if (onClickGroupTitle) {\n onClickGroupTitle(group);\n }\n };\n\n return (\n <HorizontalTile\n title={group.groupName}\n subText={group.description}\n actionGroup={\n <GroupMenuActions\n group={group}\n disableActions={disableActions}\n {...rest}\n />\n }\n onClickTitle={onClickGroupTitle && !disableActions ? onTitleClick : undefined}\n />\n );\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Group } from "@itwin/insights-client";
|
|
3
3
|
import type { ContextCustomUI, GroupingCustomUI } from "./customUI/GroupingMappingCustomUI";
|
|
4
|
-
import type {
|
|
4
|
+
import type { GroupsProps } from "./Groups";
|
|
5
5
|
import "./GroupMenuActions.scss";
|
|
6
|
-
export interface GroupMenuActionsProps extends Omit<
|
|
6
|
+
export interface GroupMenuActionsProps extends Omit<GroupsProps, "onClickAddGroup" | "onClickGroupTitle"> {
|
|
7
7
|
group: Group;
|
|
8
8
|
groupUIs: GroupingCustomUI[];
|
|
9
9
|
contextUIs: ContextCustomUI[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupMenuActions.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupMenuActions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,oEAAyE;AACzE,wDAA0E;AAC1E,+CAA2C;AAG3C,iFAAiF;AACjF,mCAAiC;AAS1B,MAAM,gBAAgB,GAAG,CAAC,EAC/B,OAAO,EACP,KAAK,EACL,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,QAAQ,EACR,UAAU,EACV,cAAc,EACd,kBAAkB,GACI,EAAE,EAAE;IAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,sDAA2B,GAAE,CAAC;IAEnD,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAAC,KAAK,EAAE,KAAY,EAAE,IAAY,EAAE,EAAE;QAChE,IAAI,CAAC,kBAAkB;YAAE,OAAO;QAChC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,uCAAK,SAAS,EAAC,aAAa;QACzB,qBAAqB;YACpB,qBAAqB,CAAC,GAAG,CAAC,CAAC,YAAY,EA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CAAC,CAAC,OAAO,EAAE;gCACb,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;6BACrC;4BACD,KAAK,EAAE,CAAC;wBACV,CAAC,EACD,IAAI,EAAE,CAAC,CAAC,IAAI,iBACA,uBAAuB,IAElC,CAAC,CAAC,YAAY,CACN,CACZ,CAAC;gBACJ,CAAC,CAAC;gBACF,8BAAC,wBAAQ,IACP,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,GAAG,EAAE;wBACZ,kBAAkB,CAAC,KAAK,CAAC,CAAC;wBAC1B,KAAK,EAAE,CAAC;oBACV,CAAC,EACD,IAAI,EAAE,8BAAC,+BAAS,OAAG,iBACP,uBAAuB,aAG1B;aACZ;YAED,8BAAC,0BAAU,IACT,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAC,YAAY,iBACV,iBAAiB,EAC7B,KAAK,EAAC,eAAe;gBAErB,8BAAC,6BAAO,OAAG,CACA,CACA,CACX,CACP,CAAC;AACJ,CAAC,CAAC;AAzGW,QAAA,gBAAgB,oBAyG3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { Group } from \"@itwin/insights-client\";\nimport { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { ContextCustomUI, GroupingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type {
|
|
1
|
+
{"version":3,"file":"GroupMenuActions.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupMenuActions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,oEAAyE;AACzE,wDAA0E;AAC1E,+CAA2C;AAG3C,iFAAiF;AACjF,mCAAiC;AAS1B,MAAM,gBAA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*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { Group } from \"@itwin/insights-client\";\nimport { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { ContextCustomUI, GroupingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { GroupsProps } from \"./Groups\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport \"./GroupMenuActions.scss\";\n\nexport interface GroupMenuActionsProps extends Omit<GroupsProps, \"onClickAddGroup\" | \"onClickGroupTitle\"> {\n group: Group;\n groupUIs: GroupingCustomUI[];\n contextUIs: ContextCustomUI[];\n setShowDeleteModal: (showDeleteModal: Group) => void;\n}\n\nexport const GroupMenuActions = ({\n mapping,\n group,\n actionButtonRenderers,\n onClickGroupModify,\n onClickRenderContextCustomUI,\n groupUIs,\n contextUIs,\n disableActions,\n setShowDeleteModal,\n}: GroupMenuActionsProps) => {\n const { iModelId } = useGroupingMappingApiConfig();\n\n const onModify = useCallback(async (group: Group, type: string) => {\n if (!onClickGroupModify) return;\n onClickGroupModify(group, type);\n }, [onClickGroupModify]);\n\n return (\n <div className=\"gmw-actions\">\n {actionButtonRenderers &&\n actionButtonRenderers.map((actionButton, index) =>\n <React.Fragment key={index}>{actionButton({ group })}</React.Fragment>\n )}\n <DropdownMenu\n className=\"gmw-action-dropdown\"\n disabled={disableActions}\n menuItems={(close: () => void) => [\n ...(groupUIs.length > 0 && onClickGroupModify\n ? [\n <MenuItem\n key={0}\n icon={<SvgEdit />}\n disabled={disableActions}\n data-testid=\"gmw-context-menu-item\"\n subMenuItems={groupUIs.map((p, index) => (\n <MenuItem\n key={p.name}\n className=\"gmw-menu-item\"\n data-testid={`gmw-edit-${index}`}\n onClick={async () => {\n await onModify(group, p.name);\n close();\n }}\n icon={p.icon}\n >\n {p.displayLabel}\n </MenuItem>\n ))}\n >\n Edit\n </MenuItem>,\n ]\n : []),\n ...contextUIs.map((p) => {\n return (\n <MenuItem\n key={p.name}\n onClick={async () => {\n if (\n p.uiComponent &&\n onClickRenderContextCustomUI\n ) {\n onClickRenderContextCustomUI(\n p.uiComponent,\n group,\n p.displayLabel\n );\n }\n if (p.onClick) {\n p.onClick(group, mapping, iModelId);\n }\n close();\n }}\n icon={p.icon}\n data-testid=\"gmw-context-menu-item\"\n >\n {p.displayLabel}\n </MenuItem>\n );\n }),\n <MenuItem\n key={2}\n onClick={() => {\n setShowDeleteModal(group);\n close();\n }}\n icon={<SvgDelete />}\n data-testid=\"gmw-context-menu-item\"\n >\n Remove\n </MenuItem>,\n ]}\n >\n <IconButton\n disabled={disableActions}\n styleType=\"borderless\"\n data-testid=\"gmw-more-button\"\n title='Group Options'\n >\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n </div>\n );\n};\n"]}
|
|
@@ -33,6 +33,7 @@ const GroupingMappingCustomUIContext_1 = require("./context/GroupingMappingCusto
|
|
|
33
33
|
const GroupHilitedElementsContext_1 = require("./context/GroupHilitedElementsContext");
|
|
34
34
|
const PropertiesContext_1 = require("./context/PropertiesContext");
|
|
35
35
|
const appui_react_1 = require("@itwin/appui-react");
|
|
36
|
+
const utils_1 = require("./utils");
|
|
36
37
|
const authorizationClientGetAccessToken = async () => (await core_frontend_1.IModelApp.authorizationClient?.getAccessToken()) ?? "";
|
|
37
38
|
const GroupingMappingContext = (props) => {
|
|
38
39
|
const activeIModelConntextion = (0, appui_react_1.useActiveIModelConnection)();
|
|
@@ -61,6 +62,11 @@ const GroupingMappingContext = (props) => {
|
|
|
61
62
|
iModelConnection: props.iModelConnection ?? activeIModelConntextion,
|
|
62
63
|
}));
|
|
63
64
|
}, [activeIModelConntextion, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);
|
|
65
|
+
(0, react_1.useEffect)(() => {
|
|
66
|
+
if (!apiConfig.iModelConnection)
|
|
67
|
+
return;
|
|
68
|
+
void (0, utils_1.enableExperimentalFeatures)(apiConfig.iModelConnection);
|
|
69
|
+
}, [apiConfig.iModelConnection]);
|
|
64
70
|
(0, react_1.useEffect)(() => {
|
|
65
71
|
setMappingClient((0, MappingClientContext_1.createMappingClient)(clientProp));
|
|
66
72
|
}, [clientProp]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupingMappingContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+CAAoE;AACpE,kCAAgC;AAEhC,wDAAiD;AAMjD,iFAAqF;AACrF,yEAGwC;AAExC,6FAAyH;AAGzH,uFAAoF;AACpF,mEAAgE;AAChE,oDAA+D;
|
|
1
|
+
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupingMappingContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+CAAoE;AACpE,kCAAgC;AAEhC,wDAAiD;AAMjD,iFAAqF;AACrF,yEAGwC;AAExC,6FAAyH;AAGzH,uFAAoF;AACpF,mEAAgE;AAChE,oDAA+D;AAC/D,mCAAqD;AA+BrD,MAAM,iCAAiC,GAAG,KAAK,IAAI,EAAE,CACnD,CAAC,MAAM,yBAAS,CAAC,mBAAmB,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC;AAEzD,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAE,EAAE;IAC3E,MAAM,uBAAuB,GAAG,IAAA,uCAAyB,GAAE,CAAC;IAC5D,MAAM,UAAU,GAAmC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;IAChF,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAkB,IAAA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AAA,eAAO,EACpC,GAAG,EAAE,CAAC,CAAC;QACL,cAAc,EAAE,mBAAmB;QACnC,iBAAiB,EAAE,sBAAsB;QACzC,eAAe;QACf,kBAAkB;QAClB,oBAAoB;QACpB,uBAAuB;QACvB,2BAA2B;QAC3B,8BAA8B;KAC/B,CAAC,EACF,CAAC,oBAAoB,EAAE,2BAA2B,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAC1F,CAAC;IAEF,MAAM,oBAAoB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,SAAS;QACT,YAAY;KACb,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,8BAAC,0DAA+B,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS;QACxD,8BAAC,2CAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa;YACjD,8BAAC,+DAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;gBAClE,8BAAC,yDAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;oBACtE,8BAAC,qCAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IACtD,KAAK,CAAC,QAAQ,CACY,CACQ,CACC,CACZ,CACS,CAC5C,CAAC;AACJ,CAAC,CAAC;AA3FW,QAAA,sBAAsB,0BA2FjC","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, { useEffect, useMemo, useRef, useState } from \"react\";\nimport \"./GroupingMapping.scss\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type {\n ClientPrefix,\n GetAccessTokenFn,\n GroupingMappingApiConfig,\n} from \"./context/GroupingApiConfigContext\";\nimport { GroupingMappingApiConfigContext } from \"./context/GroupingApiConfigContext\";\nimport {\n createMappingClient,\n MappingClientContext,\n} from \"./context/MappingClientContext\";\nimport type { CalculatedProperty, CustomCalculation, Group, GroupProperty, IMappingsClient } from \"@itwin/insights-client\";\nimport { createGroupingMappingCustomUI, GroupingMappingCustomUIContext } from \"./context/GroupingMappingCustomUIContext\";\nimport type { GroupingMappingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { QueryCacheItem } from \"./context/GroupHilitedElementsContext\";\nimport { GroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { PropertiesContext } from \"./context/PropertiesContext\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { enableExperimentalFeatures } from \"./utils\";\n\nexport interface GroupingMappingContextProps {\n /**\n * Custom callback to retrieve access token.\n */\n getAccessToken?: GetAccessTokenFn;\n /**\n * The iTwin iModel Id.\n */\n iModelId: string;\n /**\n * Used for iTwin and iModel APIs.\n * Also used for Mapping API if a custom {@link client} is not provided.\n */\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n client?: IMappingsClient;\n /**\n * Custom UI to add and update groups or provide additional group context capabilities.\n */\n customUIs?: GroupingMappingCustomUI[];\n /**\n * A custom iModelConnection to use instead of the active iModelConnection from UiFramework.\n */\n iModelConnection?: IModelConnection;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () =>\n (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConntextion = useActiveIModelConnection();\n const clientProp: IMappingsClient | ClientPrefix = props.client ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(clientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(\n createGroupingMappingCustomUI(props.customUIs),\n );\n const [apiConfig, setApiConfig] = useState<GroupingMappingApiConfig>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelId: props.iModelId,\n prefix: props.prefix,\n });\n const hilitedElementsQueryCache = useRef<Map<string, QueryCacheItem>>(new Map());\n const [hiddenGroupsIds, setHiddenGroupsIds] = useState<Set<string>>(new Set());\n const [showGroupColor, setShowGroupColor] = useState<boolean>(false);\n const [propertiesShowGroup, setPropertiesShowGroup] = useState<boolean>(false);\n const [groups, setGroups] = useState<Group[]>([]);\n const [groupProperties, setGroupProperties] = useState<GroupProperty[]>([]);\n const [calculatedProperties, setCalculatedProperties] = useState<CalculatedProperty[]>([]);\n const [customCalculationProperties, setCustomCalculationProperties] = useState<CustomCalculation[]>([]);\n const [numberOfVisualizedGroups, setNumberOfVisualizedGroups] = useState(0);\n\n useEffect(() => {\n setApiConfig(() => ({\n prefix: props.prefix,\n iModelId: props.iModelId,\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelConnection: props.iModelConnection ?? activeIModelConntextion,\n }));\n }, [activeIModelConntextion, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n if (!apiConfig.iModelConnection) return;\n void enableExperimentalFeatures(apiConfig.iModelConnection);\n }, [apiConfig.iModelConnection]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(clientProp));\n }, [clientProp]);\n\n useEffect(() => {\n setCustomUIs(createGroupingMappingCustomUI(props.customUIs));\n }, [props.customUIs]);\n\n const hilitedElementsContextValue = useMemo(\n () => ({\n showGroupColor,\n setShowGroupColor,\n hiddenGroupsIds,\n setHiddenGroupsIds,\n hilitedElementsQueryCache,\n groups,\n setGroups,\n numberOfVisualizedGroups,\n setNumberOfVisualizedGroups,\n }),\n [groups, hiddenGroupsIds, showGroupColor, numberOfVisualizedGroups]\n );\n\n const propertiesContextValue = useMemo(\n () => ({\n showGroupColor: propertiesShowGroup,\n setShowGroupColor: setPropertiesShowGroup,\n groupProperties,\n setGroupProperties,\n calculatedProperties,\n setCalculatedProperties,\n customCalculationProperties,\n setCustomCalculationProperties,\n }),\n [calculatedProperties, customCalculationProperties, groupProperties, propertiesShowGroup]\n );\n\n const customUIContextValue = useMemo(() => ({\n customUIs,\n setCustomUIs,\n }), [customUIs]);\n\n return (\n <GroupingMappingApiConfigContext.Provider value={apiConfig}>\n <MappingClientContext.Provider value={mappingClient}>\n <GroupingMappingCustomUIContext.Provider value={customUIContextValue}>\n <GroupHilitedElementsContext.Provider value={hilitedElementsContextValue}>\n <PropertiesContext.Provider value={propertiesContextValue}>\n {props.children}\n </PropertiesContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n );\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Group, Mapping } from "@itwin/insights-client";
|
|
3
|
+
import type { ContextCustomUI } from "./customUI/GroupingMappingCustomUI";
|
|
4
|
+
import type { ActionButtonRenderer } from "./GroupsView";
|
|
5
|
+
export interface GroupsProps {
|
|
6
|
+
mapping: Mapping;
|
|
7
|
+
actionButtonRenderers?: ActionButtonRenderer[];
|
|
8
|
+
onClickAddGroup?: (queryGenerationType: string) => void;
|
|
9
|
+
onClickGroupTitle?: (group: Group) => void;
|
|
10
|
+
onClickGroupModify?: (group: Group, queryGenerationType: string) => void;
|
|
11
|
+
onClickRenderContextCustomUI?: (contextCustomUI: Exclude<ContextCustomUI["uiComponent"], undefined>, group: Group, displayLabel: string) => void;
|
|
12
|
+
disableActions?: boolean;
|
|
13
|
+
isVisualizing?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const Groups: ({ mapping, actionButtonRenderers, onClickAddGroup, onClickGroupTitle, onClickGroupModify, onClickRenderContextCustomUI, disableActions, isVisualizing, }: GroupsProps) => JSX.Element;
|
|
16
|
+
//# sourceMappingURL=Groups.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.Groups = void 0;
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const GroupsView_1 = require("./GroupsView");
|
|
29
|
+
const useGroupsOperations_1 = require("./hooks/useGroupsOperations");
|
|
30
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
31
|
+
const Groups = ({ mapping, actionButtonRenderers, onClickAddGroup, onClickGroupTitle, onClickGroupModify, onClickRenderContextCustomUI, disableActions, isVisualizing, }) => {
|
|
32
|
+
const { groups, isLoading, refresh, onDeleteGroup, setShowDeleteModal, showDeleteModal, groupUIs, contextUIs, numberOfVisualizedGroups, errorMessage, setErrorMessage, } = (0, useGroupsOperations_1.useGroupsOperations)({ mappingId: mapping.id });
|
|
33
|
+
const addGroup = (0, react_1.useCallback)((type) => {
|
|
34
|
+
if (!onClickAddGroup)
|
|
35
|
+
return;
|
|
36
|
+
onClickAddGroup(type);
|
|
37
|
+
}, [onClickAddGroup]);
|
|
38
|
+
const renderAlert = (0, react_1.useCallback)(() => {
|
|
39
|
+
if (!errorMessage)
|
|
40
|
+
return;
|
|
41
|
+
return (react_1.default.createElement(itwinui_react_1.Alert, { type: "negative", onClose: () => setErrorMessage(undefined) }, errorMessage));
|
|
42
|
+
}, [errorMessage, setErrorMessage]);
|
|
43
|
+
return (react_1.default.createElement(GroupsView_1.GroupsView, { mapping: mapping, groups: groups, isLoading: isLoading, onRefresh: refresh, groupUIs: groupUIs, actionButtonRenderers: actionButtonRenderers, onClickAddGroup: addGroup, onClickGroupTitle: onClickGroupTitle, onClickGroupModify: onClickGroupModify, onClickRenderContextCustomUI: onClickRenderContextCustomUI, disableActions: disableActions, selectedGroupForDeletion: showDeleteModal, setSelectedGroupForDeletion: setShowDeleteModal, onDeleteGroup: onDeleteGroup, onCloseDeleteModal: () => setShowDeleteModal(undefined), contextUIs: contextUIs, numberOfVisualizedGroups: isVisualizing ? numberOfVisualizedGroups : undefined, alert: renderAlert() }));
|
|
44
|
+
};
|
|
45
|
+
exports.Groups = Groups;
|
|
46
|
+
//# sourceMappingURL=Groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Groups.js","sourceRoot":"","sources":["../../../../src/widget/components/Groups.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+CAA2C;AAM3C,6CAA0C;AAC1C,qEAAkE;AAClE,wDAA6C;AAiBtC,MAAM,MAAM,GAAG,CAAC,EACrB,OAAO,EACP,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,4BAA4B,EAC5B,cAAc,EACd,aAAa,GACD,EAAE,EAAE;IAChB,MAAM,EACJ,MAAM,EACN,SAAS,EACT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CAAC,CAAC,SAAS,EAC9E,KAAK,EAAE,WAAW,EAAE,GACpB,CACH,CAAC;AACJ,CAAC,CAAC;AA5DW,QAAA,MAAM,UA4DjB","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, { useCallback } from \"react\";\nimport type { Group, Mapping } from \"@itwin/insights-client\";\nimport type {\n ContextCustomUI,\n} from \"./customUI/GroupingMappingCustomUI\";\nimport type { ActionButtonRenderer } from \"./GroupsView\";\nimport { GroupsView } from \"./GroupsView\";\nimport { useGroupsOperations } from \"./hooks/useGroupsOperations\";\nimport { Alert } from \"@itwin/itwinui-react\";\n\nexport interface GroupsProps {\n mapping: Mapping;\n actionButtonRenderers?: ActionButtonRenderer[];\n onClickAddGroup?: (queryGenerationType: string) => void;\n onClickGroupTitle?: (group: Group) => void;\n onClickGroupModify?: (group: Group, queryGenerationType: string) => void;\n onClickRenderContextCustomUI?: (\n contextCustomUI: Exclude<ContextCustomUI[\"uiComponent\"], undefined>,\n group: Group,\n displayLabel: string,\n ) => void;\n disableActions?: boolean;\n isVisualizing?: boolean;\n}\n\nexport const Groups = ({\n mapping,\n actionButtonRenderers,\n onClickAddGroup,\n onClickGroupTitle,\n onClickGroupModify,\n onClickRenderContextCustomUI,\n disableActions,\n isVisualizing,\n}: GroupsProps) => {\n const {\n groups,\n isLoading,\n refresh,\n onDeleteGroup,\n setShowDeleteModal,\n showDeleteModal,\n groupUIs,\n contextUIs,\n numberOfVisualizedGroups,\n errorMessage,\n setErrorMessage,\n } = useGroupsOperations({ mappingId: mapping.id });\n\n const addGroup = useCallback((type: string) => {\n if (!onClickAddGroup) return;\n onClickAddGroup(type);\n }, [onClickAddGroup]);\n\n const renderAlert = useCallback(() => {\n if (!errorMessage) return;\n return (\n <Alert type=\"negative\" onClose={() => setErrorMessage(undefined)}>\n {errorMessage}\n </Alert>\n );\n }, [errorMessage, setErrorMessage]);\n\n return (\n <GroupsView\n mapping={mapping}\n groups={groups}\n isLoading={isLoading}\n onRefresh={refresh}\n groupUIs={groupUIs}\n actionButtonRenderers={actionButtonRenderers}\n onClickAddGroup={addGroup}\n onClickGroupTitle={onClickGroupTitle}\n onClickGroupModify={onClickGroupModify}\n onClickRenderContextCustomUI={onClickRenderContextCustomUI}\n disableActions={disableActions}\n selectedGroupForDeletion={showDeleteModal}\n setSelectedGroupForDeletion={setShowDeleteModal}\n onDeleteGroup={onDeleteGroup}\n onCloseDeleteModal={() => setShowDeleteModal(undefined)}\n contextUIs={contextUIs}\n numberOfVisualizedGroups={isVisualizing ? numberOfVisualizedGroups : undefined}\n alert={renderAlert()}\n />\n );\n};\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Alert } from "@itwin/itwinui-react";
|
|
3
|
+
import "./GroupsView.scss";
|
|
4
|
+
import type { Group, Mapping } from "@itwin/insights-client";
|
|
5
|
+
import type { ContextCustomUI, GroupingCustomUI } from "./customUI/GroupingMappingCustomUI";
|
|
6
|
+
export interface ActionButtonRendererProps {
|
|
7
|
+
group: Group;
|
|
8
|
+
}
|
|
9
|
+
export declare type ActionButtonRenderer = (props: ActionButtonRendererProps) => React.ReactNode;
|
|
10
|
+
export interface GroupsViewProps {
|
|
11
|
+
mapping: Mapping;
|
|
12
|
+
groups: Group[];
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
onRefresh: () => Promise<void>;
|
|
15
|
+
groupUIs: GroupingCustomUI[];
|
|
16
|
+
actionButtonRenderers?: ActionButtonRenderer[];
|
|
17
|
+
contextUIs: ContextCustomUI[];
|
|
18
|
+
onClickAddGroup?: (queryGenerationType: string) => void;
|
|
19
|
+
onClickGroupTitle?: (group: Group) => void;
|
|
20
|
+
onClickGroupModify?: (group: Group, queryGenerationType: string) => void;
|
|
21
|
+
onClickRenderContextCustomUI?: (contextCustomUI: Exclude<ContextCustomUI["uiComponent"], undefined>, group: Group, displayLabel: string) => void;
|
|
22
|
+
disableActions?: boolean;
|
|
23
|
+
selectedGroupForDeletion?: Group;
|
|
24
|
+
setSelectedGroupForDeletion: (group: Group) => void;
|
|
25
|
+
onDeleteGroup: (group: Group) => Promise<void>;
|
|
26
|
+
onCloseDeleteModal: () => void;
|
|
27
|
+
numberOfVisualizedGroups?: number;
|
|
28
|
+
alert?: React.ReactElement<typeof Alert>;
|
|
29
|
+
}
|
|
30
|
+
export declare const GroupsView: ({ mapping, groups, isLoading, onRefresh, groupUIs, actionButtonRenderers, onClickAddGroup, onClickGroupTitle, onClickGroupModify, onClickRenderContextCustomUI, disableActions, selectedGroupForDeletion, onDeleteGroup, onCloseDeleteModal, setSelectedGroupForDeletion, contextUIs, numberOfVisualizedGroups, alert, }: GroupsViewProps) => JSX.Element;
|
|
31
|
+
//# sourceMappingURL=GroupsView.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GroupsView = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
13
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
14
|
+
const DeleteModal_1 = __importDefault(require("./DeleteModal"));
|
|
15
|
+
require("./GroupsView.scss");
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
const GroupItem_1 = require("./GroupItem");
|
|
18
|
+
const GroupsAddButton_1 = require("./GroupsAddButton");
|
|
19
|
+
const GroupsView = ({ mapping, groups, isLoading, onRefresh, groupUIs, actionButtonRenderers, onClickAddGroup, onClickGroupTitle, onClickGroupModify, onClickRenderContextCustomUI, disableActions, selectedGroupForDeletion, onDeleteGroup, onCloseDeleteModal, setSelectedGroupForDeletion, contextUIs, numberOfVisualizedGroups, alert, }) => {
|
|
20
|
+
return (react_1.default.createElement("div", { className: "gmw-groups-container" },
|
|
21
|
+
react_1.default.createElement("div", { className: "gmw-toolbar" },
|
|
22
|
+
onClickAddGroup && groupUIs.length > 0 && (react_1.default.createElement(GroupsAddButton_1.GroupsAddButton, { disabled: disableActions, groupUIs: groupUIs, onClickAddGroup: onClickAddGroup })),
|
|
23
|
+
react_1.default.createElement(itwinui_react_1.ButtonGroup, { className: "gmw-toolbar-buttons" },
|
|
24
|
+
react_1.default.createElement(itwinui_react_1.IconButton, { title: "Refresh", onClick: onRefresh, disabled: isLoading || disableActions, styleType: "borderless" },
|
|
25
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgRefresh, null)))),
|
|
26
|
+
alert,
|
|
27
|
+
react_1.default.createElement("div", { className: 'gmw-groups-border' }),
|
|
28
|
+
!!numberOfVisualizedGroups &&
|
|
29
|
+
react_1.default.createElement("div", { className: "gmw-group-progress-bar" },
|
|
30
|
+
react_1.default.createElement(itwinui_react_1.ProgressLinear, { value: 25 + (numberOfVisualizedGroups / groups.length * 65) })),
|
|
31
|
+
isLoading ? (react_1.default.createElement(utils_1.LoadingOverlay, null)) : groups.length === 0 ? (react_1.default.createElement(utils_1.EmptyMessage, { message: "No Groups available." })) : (react_1.default.createElement("div", { className: "gmw-group-list" }, groups.map((group) => (react_1.default.createElement(GroupItem_1.GroupItem, { key: group.id, mapping: mapping, group: group, groupUIs: groupUIs, actionButtonRenderers: actionButtonRenderers, onClickGroupTitle: onClickGroupTitle, onClickGroupModify: onClickGroupModify, onClickRenderContextCustomUI: onClickRenderContextCustomUI, disableActions: disableActions, setShowDeleteModal: setSelectedGroupForDeletion, contextUIs: contextUIs }))))),
|
|
32
|
+
selectedGroupForDeletion && (react_1.default.createElement(DeleteModal_1.default, { entityName: selectedGroupForDeletion.groupName, onClose: onCloseDeleteModal, onDelete: async () => {
|
|
33
|
+
await onDeleteGroup(selectedGroupForDeletion);
|
|
34
|
+
}, refresh: onRefresh }))));
|
|
35
|
+
};
|
|
36
|
+
exports.GroupsView = GroupsView;
|
|
37
|
+
//# sourceMappingURL=GroupsView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupsView.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupsView.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAI1B,wDAI8B;AAC9B,oEAEoC;AACpC,gEAAwC;AACxC,6BAA2B;AAC3B,mCAAuD;AAEvD,2CAAwC;AAExC,uDAAoD;AAmC7C,MAAM,UAAU,GAAG,CAAC,EACzB,OAAO,EACP,MAAM,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,4BAA4B,EAC5B,cAAc,EACd,wBAAwB,EACxB,aAAa,EACb,kBAAkB,EAClB,2BAA2B,EAC3B,UAAU,EACV,wBAAwB,EACxB,KAAK,GACW,EAAE,EAAE;IACpB,OAAO,CACL,uCAAK,SAAS,EAAC,sBAAsB;QACnC,uCAAK,SAAS,EAAC,aAAa;YACzB,eAAe,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACzC,8BAAC,iCAAe,IACd,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,GAChC,CACH;YACD,8BAAC,2BAAW,IAAC,SAAS,EAAC,qBAAqB;gBAC1C,8BAAC,0BAAU,IACT,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,SAAS,IAAI,cAAc,EAC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AoFrB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport type {\n Alert,\n} from \"@itwin/itwinui-react\";\nimport {\n ButtonGroup,\n IconButton,\n ProgressLinear,\n} from \"@itwin/itwinui-react\";\nimport {\n SvgRefresh,\n} from \"@itwin/itwinui-icons-react\";\nimport DeleteModal from \"./DeleteModal\";\nimport \"./GroupsView.scss\";\nimport { EmptyMessage, LoadingOverlay } from \"./utils\";\nimport type { Group, Mapping } from \"@itwin/insights-client\";\nimport { GroupItem } from \"./GroupItem\";\nimport type { ContextCustomUI, GroupingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport { GroupsAddButton } from \"./GroupsAddButton\";\n\nexport interface ActionButtonRendererProps {\n group: Group;\n}\n\nexport type ActionButtonRenderer = (\n props: ActionButtonRendererProps\n) => React.ReactNode;\n\nexport interface GroupsViewProps {\n mapping: Mapping;\n groups: Group[];\n isLoading: boolean;\n onRefresh: () => Promise<void>;\n groupUIs: GroupingCustomUI[];\n actionButtonRenderers?: ActionButtonRenderer[];\n contextUIs: ContextCustomUI[];\n onClickAddGroup?: (queryGenerationType: string) => void;\n onClickGroupTitle?: (group: Group) => void;\n onClickGroupModify?: (group: Group, queryGenerationType: string) => void;\n onClickRenderContextCustomUI?: (\n contextCustomUI: Exclude<ContextCustomUI[\"uiComponent\"], undefined>,\n group: Group,\n displayLabel: string,\n ) => void;\n disableActions?: boolean;\n selectedGroupForDeletion?: Group;\n setSelectedGroupForDeletion: (group: Group) => void;\n onDeleteGroup: (group: Group) => Promise<void>;\n onCloseDeleteModal: () => void;\n numberOfVisualizedGroups?: number;\n alert?: React.ReactElement<typeof Alert>;\n}\n\nexport const GroupsView = ({\n mapping,\n groups,\n isLoading,\n onRefresh,\n groupUIs,\n actionButtonRenderers,\n onClickAddGroup,\n onClickGroupTitle,\n onClickGroupModify,\n onClickRenderContextCustomUI,\n disableActions,\n selectedGroupForDeletion,\n onDeleteGroup,\n onCloseDeleteModal,\n setSelectedGroupForDeletion,\n contextUIs,\n numberOfVisualizedGroups,\n alert,\n}: GroupsViewProps) => {\n return (\n <div className=\"gmw-groups-container\">\n <div className=\"gmw-toolbar\">\n {onClickAddGroup && groupUIs.length > 0 && (\n <GroupsAddButton\n disabled={disableActions}\n groupUIs={groupUIs}\n onClickAddGroup={onClickAddGroup}\n />\n )}\n <ButtonGroup className=\"gmw-toolbar-buttons\">\n <IconButton\n title=\"Refresh\"\n onClick={onRefresh}\n disabled={isLoading || disableActions}\n styleType=\"borderless\"\n >\n <SvgRefresh />\n </IconButton>\n </ButtonGroup>\n </div>\n {alert}\n <div className='gmw-groups-border' />\n {!!numberOfVisualizedGroups &&\n <div className=\"gmw-group-progress-bar\">\n <ProgressLinear\n value={25 + (numberOfVisualizedGroups / groups.length * 65)}\n />\n </div>}\n {isLoading ? (\n <LoadingOverlay />\n ) : groups.length === 0 ? (\n <EmptyMessage message=\"No Groups available.\" />\n ) : (\n <div className=\"gmw-group-list\">\n {groups.map((group) => (\n <GroupItem\n key={group.id}\n mapping={mapping}\n group={group}\n groupUIs={groupUIs}\n actionButtonRenderers={actionButtonRenderers}\n onClickGroupTitle={onClickGroupTitle}\n onClickGroupModify={onClickGroupModify}\n onClickRenderContextCustomUI={onClickRenderContextCustomUI}\n disableActions={disableActions}\n setShowDeleteModal={setSelectedGroupForDeletion}\n contextUIs={contextUIs}\n />\n ))}\n </div>\n )}\n {selectedGroupForDeletion && (\n <DeleteModal\n entityName={selectedGroupForDeletion.groupName}\n onClose={onCloseDeleteModal}\n onDelete={async () => {\n await onDeleteGroup(selectedGroupForDeletion);\n }}\n refresh={onRefresh}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
display: flex;
|
|
14
14
|
justify-content: space-between;
|
|
15
15
|
gap: var(--iui-size-xs);
|
|
16
|
-
border-bottom: 1px solid var(--iui-color-border-subtle);
|
|
17
16
|
padding-bottom: var(--iui-size-s);
|
|
18
17
|
flex-wrap: wrap;
|
|
19
18
|
|
|
@@ -28,6 +27,10 @@
|
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
.gmw-groups-border {
|
|
31
|
+
border-bottom: 1px solid var(--iui-color-border-subtle);
|
|
32
|
+
}
|
|
33
|
+
|
|
31
34
|
.gmw-group-progress-bar {
|
|
32
35
|
height: 1px;
|
|
33
36
|
}
|
|
@@ -44,10 +47,3 @@
|
|
|
44
47
|
padding-left: var(--iui-size-s);
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
.gmw-nest-menu-item {
|
|
49
|
-
width: 100%;
|
|
50
|
-
justify-content: flex-start;
|
|
51
|
-
padding: 0 var(--iui-size-s);
|
|
52
|
-
gap: var(--iui-size-xs);
|
|
53
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { GroupsProps } from "./Groups";
|
|
3
3
|
import "./GroupsVisualization.scss";
|
|
4
|
-
export interface GroupsVisualizationProps extends
|
|
4
|
+
export interface GroupsVisualizationProps extends GroupsProps {
|
|
5
5
|
isNonEmphasizedSelectable?: boolean;
|
|
6
6
|
emphasizeElements?: boolean;
|
|
7
7
|
}
|