@itwin/grouping-mapping-widget 0.26.1 → 0.27.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.
Files changed (109) hide show
  1. package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js +1 -15
  2. package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
  3. package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.d.ts +1 -1
  4. package/lib/cjs/components/Mappings/MappingViewActionGroup.d.ts +1 -1
  5. package/lib/cjs/components/Mappings/MappingViewActionGroup.js +1 -2
  6. package/lib/cjs/components/Mappings/MappingViewActionGroup.js.map +1 -1
  7. package/lib/cjs/components/Mappings/MappingsView.js +1 -1
  8. package/lib/cjs/components/Mappings/MappingsView.js.map +1 -1
  9. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +2 -0
  10. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +2 -1
  11. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  12. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +7 -8
  13. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +21 -61
  14. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  15. package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.d.ts +5 -9
  16. package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +3 -12
  17. package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
  18. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +8 -9
  19. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +17 -164
  20. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  21. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.scss +4 -3
  22. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +76 -19
  23. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  24. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.scss +3 -2
  25. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +10 -2
  26. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  27. package/lib/cjs/components/Properties/PropertyMenu.d.ts +1 -1
  28. package/lib/cjs/components/Properties/PropertyMenu.js +2 -7
  29. package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
  30. package/lib/cjs/components/Properties/ScrollableExpandableBlock.d.ts +11 -0
  31. package/lib/cjs/components/Properties/ScrollableExpandableBlock.js +55 -0
  32. package/lib/cjs/components/Properties/ScrollableExpandableBlock.js.map +1 -0
  33. package/lib/cjs/components/Properties/hooks/useFormulaValidation.d.ts +6 -3
  34. package/lib/cjs/components/Properties/hooks/useFormulaValidation.js +59 -13
  35. package/lib/cjs/components/Properties/hooks/useFormulaValidation.js.map +1 -1
  36. package/lib/cjs/components/Properties/hooks/useForwardRef.d.ts +3 -0
  37. package/lib/cjs/components/Properties/hooks/useForwardRef.js +20 -0
  38. package/lib/cjs/components/Properties/hooks/useForwardRef.js.map +1 -0
  39. package/lib/cjs/components/SharedComponents/ActionPanel.d.ts +3 -1
  40. package/lib/cjs/components/SharedComponents/ActionPanel.js +3 -3
  41. package/lib/cjs/components/SharedComponents/ActionPanel.js.map +1 -1
  42. package/lib/cjs/formula/FormulaDataTypeResolver.d.ts +3 -2
  43. package/lib/cjs/formula/FormulaDataTypeResolver.js +10 -6
  44. package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -1
  45. package/lib/cjs/grouping-mapping-widget.d.ts +0 -2
  46. package/lib/cjs/grouping-mapping-widget.js +1 -5
  47. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  48. package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js +1 -15
  49. package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
  50. package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.d.ts +1 -1
  51. package/lib/esm/components/Mappings/MappingViewActionGroup.d.ts +1 -1
  52. package/lib/esm/components/Mappings/MappingViewActionGroup.js +1 -2
  53. package/lib/esm/components/Mappings/MappingViewActionGroup.js.map +1 -1
  54. package/lib/esm/components/Mappings/MappingsView.js +1 -1
  55. package/lib/esm/components/Mappings/MappingsView.js.map +1 -1
  56. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +2 -0
  57. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +2 -1
  58. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  59. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +7 -8
  60. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +23 -60
  61. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  62. package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.d.ts +5 -9
  63. package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +4 -13
  64. package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
  65. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +8 -9
  66. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +18 -142
  67. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  68. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.scss +4 -3
  69. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +79 -22
  70. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  71. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.scss +3 -2
  72. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +12 -4
  73. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  74. package/lib/esm/components/Properties/PropertyMenu.d.ts +1 -1
  75. package/lib/esm/components/Properties/PropertyMenu.js +2 -7
  76. package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
  77. package/lib/esm/components/Properties/ScrollableExpandableBlock.d.ts +11 -0
  78. package/lib/esm/components/Properties/ScrollableExpandableBlock.js +29 -0
  79. package/lib/esm/components/Properties/ScrollableExpandableBlock.js.map +1 -0
  80. package/lib/esm/components/Properties/hooks/useFormulaValidation.d.ts +6 -3
  81. package/lib/esm/components/Properties/hooks/useFormulaValidation.js +57 -12
  82. package/lib/esm/components/Properties/hooks/useFormulaValidation.js.map +1 -1
  83. package/lib/esm/components/Properties/hooks/useForwardRef.d.ts +3 -0
  84. package/lib/esm/components/Properties/hooks/useForwardRef.js +16 -0
  85. package/lib/esm/components/Properties/hooks/useForwardRef.js.map +1 -0
  86. package/lib/esm/components/SharedComponents/ActionPanel.d.ts +3 -1
  87. package/lib/esm/components/SharedComponents/ActionPanel.js +3 -3
  88. package/lib/esm/components/SharedComponents/ActionPanel.js.map +1 -1
  89. package/lib/esm/formula/FormulaDataTypeResolver.d.ts +3 -2
  90. package/lib/esm/formula/FormulaDataTypeResolver.js +10 -6
  91. package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -1
  92. package/lib/esm/grouping-mapping-widget.d.ts +0 -2
  93. package/lib/esm/grouping-mapping-widget.js +0 -2
  94. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  95. package/package.json +1 -1
  96. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +0 -14
  97. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +0 -87
  98. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +0 -1
  99. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.scss +0 -9
  100. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +0 -13
  101. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +0 -91
  102. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js.map +0 -1
  103. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +0 -14
  104. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +0 -60
  105. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +0 -1
  106. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.scss +0 -9
  107. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +0 -13
  108. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +0 -64
  109. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js.map +0 -1
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.CalculatedPropertyTable = void 0;
27
- /*---------------------------------------------------------------------------------------------
28
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
29
- * See LICENSE.md in the project root for license terms and full copyright notice.
30
- *--------------------------------------------------------------------------------------------*/
31
- const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
32
- const itwinui_react_1 = require("@itwin/itwinui-react");
33
- const react_1 = __importStar(require("react"));
34
- require("./CalculatedPropertyTable.scss");
35
- const PropertyNameCell_1 = require("../PropertyNameCell");
36
- const PropertyTable_1 = require("../PropertyTable");
37
- const GroupingApiConfigContext_1 = require("../../context/GroupingApiConfigContext");
38
- const react_query_1 = require("@tanstack/react-query");
39
- const PropertiesClientContext_1 = require("../../context/PropertiesClientContext");
40
- const CalculatedPropertyTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, calculatedProperties, refresh, }) => {
41
- const propertiesClient = (0, PropertiesClientContext_1.usePropertiesClient)();
42
- const { getAccessToken, iModelId } = (0, GroupingApiConfigContext_1.useGroupingMappingApiConfig)();
43
- const queryClient = (0, react_query_1.useQueryClient)();
44
- const columnsFactory = (0, react_1.useCallback)((handleShowDeleteModal) => [
45
- {
46
- id: "propertyName",
47
- Header: "Calculated Property",
48
- accessor: "propertyName",
49
- Cell: (value) => react_1.default.createElement(PropertyNameCell_1.PropertyNameCell, { property: value.row.original, onClickModify: onClickModify }),
50
- },
51
- {
52
- id: "dropdown",
53
- Header: "",
54
- width: 80,
55
- Cell: (value) => {
56
- return (react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [
57
- onClickModify
58
- ? [
59
- react_1.default.createElement(itwinui_react_1.MenuItem, { key: 0, onClick: () => {
60
- onClickModify(value.row.original);
61
- close();
62
- }, icon: react_1.default.createElement(itwinui_icons_react_1.SvgEdit, null) }, "Modify"),
63
- ]
64
- : [],
65
- react_1.default.createElement(itwinui_react_1.MenuItem, { key: 1, onClick: () => {
66
- handleShowDeleteModal(value.row.original);
67
- close();
68
- }, icon: react_1.default.createElement(itwinui_icons_react_1.SvgDelete, null) }, "Remove"),
69
- ].flatMap((p) => p) },
70
- react_1.default.createElement(itwinui_react_1.IconButton, { styleType: "borderless" },
71
- react_1.default.createElement(itwinui_icons_react_1.SvgMore, null))));
72
- },
73
- },
74
- ], [onClickModify]);
75
- const { mutateAsync: deleteProperty } = (0, react_query_1.useMutation)({
76
- mutationFn: async (propertyId) => {
77
- const accessToken = await getAccessToken();
78
- await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);
79
- },
80
- onSuccess: async () => {
81
- await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, groupId] });
82
- },
83
- });
84
- return (react_1.default.createElement(PropertyTable_1.PropertyTable, { propertyType: "Calculated", columnsFactory: columnsFactory, data: calculatedProperties, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
85
- };
86
- exports.CalculatedPropertyTable = CalculatedPropertyTable;
87
- //# sourceMappingURL=CalculatedPropertyTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalculatedPropertyTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,oEAAyE;AACzE,wDAA0E;AAC1E,+CAA2C;AAG3C,0CAAwC;AACxC,0DAAuD;AACvD,oDAAiD;AACjD,qFAAqF;AACrF,uDAAoE;AACpE,mFAA4E;AAYrE,MAAM,uBAAuB,GAAG,CAAC,EACtC,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,OAAO,GACsB,EAAE,EAAE;IACjC,MAAM,gBAAgB,GAAG,IAAA,6CAAmB,GAAE,CAAC;IAC/C,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,IAAA,sDAA2B,GAAE,CAAC;IACnE,MAAM,WAAW,G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aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAA,yBAAW,EAAC;QAClD,UAAU,EAAE,KAAK,EAAE,UAAkB,EAAE,EAAE;YACvC,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;YAC3C,MAAM,gBAAgB,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACrF,CAAC;QACD,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,MAAM,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAClG,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CACL,8BAAC,6BAAa,IACZ,YAAY,EAAC,YAAY,EACzB,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,oBAAoB,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC;AAzFW,QAAA,uBAAuB,2BAyFlC","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 { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps, Column } from \"react-table\";\nimport type { Property } from \"@itwin/insights-client\";\nimport \"./CalculatedPropertyTable.scss\";\nimport { PropertyNameCell } from \"../PropertyNameCell\";\nimport { PropertyTable } from \"../PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\nexport interface CalculatedPropertyTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: Property) => void;\n isLoading: boolean;\n calculatedProperties: Property[];\n refresh: () => Promise<void>;\n}\n\nexport const CalculatedPropertyTable = ({\n mappingId,\n groupId,\n onClickAdd,\n onClickModify,\n isLoading,\n calculatedProperties,\n refresh,\n}: CalculatedPropertyTableProps) => {\n const propertiesClient = usePropertiesClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const queryClient = useQueryClient();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: Property) => void): Column<Property>[] => [\n {\n id: \"propertyName\",\n Header: \"Calculated Property\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<Property>) => <PropertyNameCell property={value.row.original} onClickModify={onClickModify} />,\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Property>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) =>\n [\n onClickModify\n ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(value.row.original);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n ]\n : [],\n <MenuItem\n key={1}\n onClick={() => {\n handleShowDeleteModal(value.row.original);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((p) => p)\n }\n >\n <IconButton styleType=\"borderless\">\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n [onClickModify],\n );\n\n const { mutateAsync: deleteProperty } = useMutation({\n mutationFn: async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, groupId] });\n },\n });\n\n return (\n <PropertyTable\n propertyType=\"Calculated\"\n columnsFactory={columnsFactory}\n data={calculatedProperties}\n isLoading={isLoading}\n onClickAdd={onClickAdd}\n refreshProperties={refresh}\n deleteProperty={deleteProperty}\n />\n );\n};\n"]}
@@ -1,9 +0,0 @@
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-field-legend-container {
7
- display: flex;
8
- justify-content: space-between;
9
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import type { Property } from "@itwin/insights-client";
3
- export interface CustomCalculationTableProps {
4
- mappingId: string;
5
- groupId: string;
6
- onClickAdd?: () => void;
7
- onClickModify?: (value: Property) => void;
8
- isLoading: boolean;
9
- customCalculations: Property[];
10
- refresh: () => Promise<void>;
11
- }
12
- export declare const CustomCalculationTable: ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }: CustomCalculationTableProps) => JSX.Element;
13
- //# sourceMappingURL=CustomCalculationTable.d.ts.map
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.CustomCalculationTable = void 0;
27
- /*---------------------------------------------------------------------------------------------
28
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
29
- * See LICENSE.md in the project root for license terms and full copyright notice.
30
- *--------------------------------------------------------------------------------------------*/
31
- const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
32
- const itwinui_react_1 = require("@itwin/itwinui-react");
33
- const react_1 = __importStar(require("react"));
34
- const PropertyNameCell_1 = require("../PropertyNameCell");
35
- const PropertyTable_1 = require("../PropertyTable");
36
- const GroupingApiConfigContext_1 = require("../../context/GroupingApiConfigContext");
37
- const react_query_1 = require("@tanstack/react-query");
38
- const PropertiesClientContext_1 = require("../../context/PropertiesClientContext");
39
- const CustomCalculationTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }) => {
40
- const propertiesClient = (0, PropertiesClientContext_1.usePropertiesClient)();
41
- const { getAccessToken, iModelId } = (0, GroupingApiConfigContext_1.useGroupingMappingApiConfig)();
42
- const queryClient = (0, react_query_1.useQueryClient)();
43
- const columnsFactory = (0, react_1.useCallback)((handleShowDeleteModal) => [
44
- {
45
- id: "propertyName",
46
- Header: "Custom Calculation",
47
- accessor: "propertyName",
48
- Cell: (value) => react_1.default.createElement(PropertyNameCell_1.PropertyNameCell, { property: value.row.original, onClickModify: onClickModify }),
49
- },
50
- {
51
- id: "formula",
52
- Header: "Formula",
53
- accessor: "formula",
54
- },
55
- {
56
- id: "dropdown",
57
- Header: "",
58
- width: 80,
59
- Cell: (value) => {
60
- return (react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [
61
- onClickModify
62
- ? [
63
- react_1.default.createElement(itwinui_react_1.MenuItem, { key: 0, onClick: () => {
64
- onClickModify(value.row.original);
65
- close();
66
- }, icon: react_1.default.createElement(itwinui_icons_react_1.SvgEdit, null) }, "Modify"),
67
- ]
68
- : [],
69
- react_1.default.createElement(itwinui_react_1.MenuItem, { key: 1, onClick: () => {
70
- handleShowDeleteModal(value.row.original);
71
- close();
72
- }, icon: react_1.default.createElement(itwinui_icons_react_1.SvgDelete, null) }, "Remove"),
73
- ].flatMap((p) => p) },
74
- react_1.default.createElement(itwinui_react_1.IconButton, { styleType: "borderless" },
75
- react_1.default.createElement(itwinui_icons_react_1.SvgMore, null))));
76
- },
77
- },
78
- ], [onClickModify]);
79
- const { mutateAsync: deleteProperty } = (0, react_query_1.useMutation)({
80
- mutationFn: async (propertyId) => {
81
- const accessToken = await getAccessToken();
82
- await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);
83
- },
84
- onSuccess: async () => {
85
- await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, groupId] });
86
- },
87
- });
88
- return (react_1.default.createElement(PropertyTable_1.PropertyTable, { propertyType: "Custom Calculation", columnsFactory: columnsFactory, data: customCalculations, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
89
- };
90
- exports.CustomCalculationTable = CustomCalculationTable;
91
- //# sourceMappingURL=CustomCalculationTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CustomCalculationTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CustomCalculations/CustomCalculationTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,oEAAyE;AACzE,wDAA0E;AAC1E,+CAA2C;AAG3C,0DAAuD;AACvD,oDAAiD;AACjD,qFAAqF;AACrF,uDAAoE;AACpE,mFAA4E;AAYrE,MAAM,sBAAsB,GAAG,CAAC,EACrC,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,OAAO,GACqB,EAAE,EAAE;IAChC,MAAM,gBAAgB,GAAG,IAAA,6CAAmB,GAAE,CAAC;IAC/C,MAAM,EAAE,cAAc,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EAAE,CAAC,CAAC,CAAC;oBAGrB,8BAAC,0BAAU,IAAC,SAAS,EAAC,YAAY;wBAChC,8BAAC,6BAAO,OAAG,CACA,CACA,CAChB,CAAC;YACJ,CAAC;SACF;KACF,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAA,yBAAW,EAAC;QAClD,UAAU,EAAE,KAAK,EAAE,UAAkB,EAAE,EAAE;YACvC,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;YAC3C,MAAM,gBAAgB,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACrF,CAAC;QACD,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,MAAM,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAClG,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CACL,8BAAC,6BAAa,IACZ,YAAY,EAAC,oBAAoB,EACjC,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC;AA9FW,QAAA,sBAAsB,0BA8FjC","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 { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps, Column } from \"react-table\";\nimport type { Property } from \"@itwin/insights-client\";\nimport { PropertyNameCell } from \"../PropertyNameCell\";\nimport { PropertyTable } from \"../PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\nexport interface CustomCalculationTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: Property) => void;\n isLoading: boolean;\n customCalculations: Property[];\n refresh: () => Promise<void>;\n}\n\nexport const CustomCalculationTable = ({\n mappingId,\n groupId,\n onClickAdd,\n onClickModify,\n isLoading,\n customCalculations,\n refresh,\n}: CustomCalculationTableProps) => {\n const propertiesClient = usePropertiesClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const queryClient = useQueryClient();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: Property) => void): Column<Property>[] => [\n {\n id: \"propertyName\",\n Header: \"Custom Calculation\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<Property>) => <PropertyNameCell property={value.row.original} onClickModify={onClickModify} />,\n },\n {\n id: \"formula\",\n Header: \"Formula\",\n accessor: \"formula\",\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Property>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) =>\n [\n onClickModify\n ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(value.row.original);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n ]\n : [],\n <MenuItem\n key={1}\n onClick={() => {\n handleShowDeleteModal(value.row.original);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((p) => p)\n }\n >\n <IconButton styleType=\"borderless\">\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n [onClickModify],\n );\n\n const { mutateAsync: deleteProperty } = useMutation({\n mutationFn: async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, groupId] });\n },\n });\n\n return (\n <PropertyTable\n propertyType=\"Custom Calculation\"\n columnsFactory={columnsFactory}\n data={customCalculations}\n isLoading={isLoading}\n onClickAdd={onClickAdd}\n refreshProperties={refresh}\n deleteProperty={deleteProperty}\n />\n );\n};\n"]}
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- import type { Property } from "@itwin/insights-client";
3
- import "./CalculatedPropertyTable.scss";
4
- export interface CalculatedPropertyTableProps {
5
- mappingId: string;
6
- groupId: string;
7
- onClickAdd?: () => void;
8
- onClickModify?: (value: Property) => void;
9
- isLoading: boolean;
10
- calculatedProperties: Property[];
11
- refresh: () => Promise<void>;
12
- }
13
- export declare const CalculatedPropertyTable: ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, calculatedProperties, refresh, }: CalculatedPropertyTableProps) => JSX.Element;
14
- //# sourceMappingURL=CalculatedPropertyTable.d.ts.map
@@ -1,60 +0,0 @@
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 { SvgDelete, SvgEdit, SvgMore } from "@itwin/itwinui-icons-react";
6
- import { DropdownMenu, IconButton, MenuItem } from "@itwin/itwinui-react";
7
- import React, { useCallback } from "react";
8
- import "./CalculatedPropertyTable.scss";
9
- import { PropertyNameCell } from "../PropertyNameCell";
10
- import { PropertyTable } from "../PropertyTable";
11
- import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigContext";
12
- import { useMutation, useQueryClient } from "@tanstack/react-query";
13
- import { usePropertiesClient } from "../../context/PropertiesClientContext";
14
- export const CalculatedPropertyTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, calculatedProperties, refresh, }) => {
15
- const propertiesClient = usePropertiesClient();
16
- const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
17
- const queryClient = useQueryClient();
18
- const columnsFactory = useCallback((handleShowDeleteModal) => [
19
- {
20
- id: "propertyName",
21
- Header: "Calculated Property",
22
- accessor: "propertyName",
23
- Cell: (value) => React.createElement(PropertyNameCell, { property: value.row.original, onClickModify: onClickModify }),
24
- },
25
- {
26
- id: "dropdown",
27
- Header: "",
28
- width: 80,
29
- Cell: (value) => {
30
- return (React.createElement(DropdownMenu, { menuItems: (close) => [
31
- onClickModify
32
- ? [
33
- React.createElement(MenuItem, { key: 0, onClick: () => {
34
- onClickModify(value.row.original);
35
- close();
36
- }, icon: React.createElement(SvgEdit, null) }, "Modify"),
37
- ]
38
- : [],
39
- React.createElement(MenuItem, { key: 1, onClick: () => {
40
- handleShowDeleteModal(value.row.original);
41
- close();
42
- }, icon: React.createElement(SvgDelete, null) }, "Remove"),
43
- ].flatMap((p) => p) },
44
- React.createElement(IconButton, { styleType: "borderless" },
45
- React.createElement(SvgMore, null))));
46
- },
47
- },
48
- ], [onClickModify]);
49
- const { mutateAsync: deleteProperty } = useMutation({
50
- mutationFn: async (propertyId) => {
51
- const accessToken = await getAccessToken();
52
- await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);
53
- },
54
- onSuccess: async () => {
55
- await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, groupId] });
56
- },
57
- });
58
- return (React.createElement(PropertyTable, { propertyType: "Calculated", columnsFactory: columnsFactory, data: calculatedProperties, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
59
- };
60
- //# sourceMappingURL=CalculatedPropertyTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalculatedPropertyTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyTable.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,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Y,EAAC,YAAY,EACzB,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,oBAAoB,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,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 { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps, Column } from \"react-table\";\nimport type { Property } from \"@itwin/insights-client\";\nimport \"./CalculatedPropertyTable.scss\";\nimport { PropertyNameCell } from \"../PropertyNameCell\";\nimport { PropertyTable } from \"../PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\nexport interface CalculatedPropertyTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: Property) => void;\n isLoading: boolean;\n calculatedProperties: Property[];\n refresh: () => Promise<void>;\n}\n\nexport const CalculatedPropertyTable = ({\n mappingId,\n groupId,\n onClickAdd,\n onClickModify,\n isLoading,\n calculatedProperties,\n refresh,\n}: CalculatedPropertyTableProps) => {\n const propertiesClient = usePropertiesClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const queryClient = useQueryClient();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: Property) => void): Column<Property>[] => [\n {\n id: \"propertyName\",\n Header: \"Calculated Property\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<Property>) => <PropertyNameCell property={value.row.original} onClickModify={onClickModify} />,\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Property>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) =>\n [\n onClickModify\n ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(value.row.original);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n ]\n : [],\n <MenuItem\n key={1}\n onClick={() => {\n handleShowDeleteModal(value.row.original);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((p) => p)\n }\n >\n <IconButton styleType=\"borderless\">\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n [onClickModify],\n );\n\n const { mutateAsync: deleteProperty } = useMutation({\n mutationFn: async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, groupId] });\n },\n });\n\n return (\n <PropertyTable\n propertyType=\"Calculated\"\n columnsFactory={columnsFactory}\n data={calculatedProperties}\n isLoading={isLoading}\n onClickAdd={onClickAdd}\n refreshProperties={refresh}\n deleteProperty={deleteProperty}\n />\n );\n};\n"]}
@@ -1,9 +0,0 @@
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-field-legend-container {
7
- display: flex;
8
- justify-content: space-between;
9
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import type { Property } from "@itwin/insights-client";
3
- export interface CustomCalculationTableProps {
4
- mappingId: string;
5
- groupId: string;
6
- onClickAdd?: () => void;
7
- onClickModify?: (value: Property) => void;
8
- isLoading: boolean;
9
- customCalculations: Property[];
10
- refresh: () => Promise<void>;
11
- }
12
- export declare const CustomCalculationTable: ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }: CustomCalculationTableProps) => JSX.Element;
13
- //# sourceMappingURL=CustomCalculationTable.d.ts.map
@@ -1,64 +0,0 @@
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 { SvgDelete, SvgEdit, SvgMore } from "@itwin/itwinui-icons-react";
6
- import { DropdownMenu, IconButton, MenuItem } from "@itwin/itwinui-react";
7
- import React, { useCallback } from "react";
8
- import { PropertyNameCell } from "../PropertyNameCell";
9
- import { PropertyTable } from "../PropertyTable";
10
- import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigContext";
11
- import { useMutation, useQueryClient } from "@tanstack/react-query";
12
- import { usePropertiesClient } from "../../context/PropertiesClientContext";
13
- export const CustomCalculationTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }) => {
14
- const propertiesClient = usePropertiesClient();
15
- const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
16
- const queryClient = useQueryClient();
17
- const columnsFactory = useCallback((handleShowDeleteModal) => [
18
- {
19
- id: "propertyName",
20
- Header: "Custom Calculation",
21
- accessor: "propertyName",
22
- Cell: (value) => React.createElement(PropertyNameCell, { property: value.row.original, onClickModify: onClickModify }),
23
- },
24
- {
25
- id: "formula",
26
- Header: "Formula",
27
- accessor: "formula",
28
- },
29
- {
30
- id: "dropdown",
31
- Header: "",
32
- width: 80,
33
- Cell: (value) => {
34
- return (React.createElement(DropdownMenu, { menuItems: (close) => [
35
- onClickModify
36
- ? [
37
- React.createElement(MenuItem, { key: 0, onClick: () => {
38
- onClickModify(value.row.original);
39
- close();
40
- }, icon: React.createElement(SvgEdit, null) }, "Modify"),
41
- ]
42
- : [],
43
- React.createElement(MenuItem, { key: 1, onClick: () => {
44
- handleShowDeleteModal(value.row.original);
45
- close();
46
- }, icon: React.createElement(SvgDelete, null) }, "Remove"),
47
- ].flatMap((p) => p) },
48
- React.createElement(IconButton, { styleType: "borderless" },
49
- React.createElement(SvgMore, null))));
50
- },
51
- },
52
- ], [onClickModify]);
53
- const { mutateAsync: deleteProperty } = useMutation({
54
- mutationFn: async (propertyId) => {
55
- const accessToken = await getAccessToken();
56
- await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);
57
- },
58
- onSuccess: async () => {
59
- await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, groupId] });
60
- },
61
- });
62
- return (React.createElement(PropertyTable, { propertyType: "Custom Calculation", columnsFactory: columnsFactory, data: customCalculations, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
63
- };
64
- //# sourceMappingURL=CustomCalculationTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CustomCalculationTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CustomCalculations/CustomCalculationTable.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAY5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,OA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BAAC,SAAS,OAAG,aAGV;qBACZ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;oBAGrB,oBAAC,UAAU,IAAC,SAAS,EAAC,YAAY;wBAChC,oBAAC,OAAO,OAAG,CACA,CACA,CAChB,CAAC;YACJ,CAAC;SACF;KACF,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,WAAW,CAAC;QAClD,UAAU,EAAE,KAAK,EAAE,UAAkB,EAAE,EAAE;YACvC,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;YAC3C,MAAM,gBAAgB,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACrF,CAAC;QACD,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,MAAM,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAClG,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,aAAa,IACZ,YAAY,EAAC,oBAAoB,EACjC,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,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 { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps, Column } from \"react-table\";\nimport type { Property } from \"@itwin/insights-client\";\nimport { PropertyNameCell } from \"../PropertyNameCell\";\nimport { PropertyTable } from \"../PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\nexport interface CustomCalculationTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: Property) => void;\n isLoading: boolean;\n customCalculations: Property[];\n refresh: () => Promise<void>;\n}\n\nexport const CustomCalculationTable = ({\n mappingId,\n groupId,\n onClickAdd,\n onClickModify,\n isLoading,\n customCalculations,\n refresh,\n}: CustomCalculationTableProps) => {\n const propertiesClient = usePropertiesClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const queryClient = useQueryClient();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: Property) => void): Column<Property>[] => [\n {\n id: \"propertyName\",\n Header: \"Custom Calculation\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<Property>) => <PropertyNameCell property={value.row.original} onClickModify={onClickModify} />,\n },\n {\n id: \"formula\",\n Header: \"Formula\",\n accessor: \"formula\",\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Property>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) =>\n [\n onClickModify\n ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(value.row.original);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n ]\n : [],\n <MenuItem\n key={1}\n onClick={() => {\n handleShowDeleteModal(value.row.original);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((p) => p)\n }\n >\n <IconButton styleType=\"borderless\">\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n [onClickModify],\n );\n\n const { mutateAsync: deleteProperty } = useMutation({\n mutationFn: async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, groupId] });\n },\n });\n\n return (\n <PropertyTable\n propertyType=\"Custom Calculation\"\n columnsFactory={columnsFactory}\n data={customCalculations}\n isLoading={isLoading}\n onClickAdd={onClickAdd}\n refreshProperties={refresh}\n deleteProperty={deleteProperty}\n />\n );\n};\n"]}