@itwin/grouping-mapping-widget 0.26.1 → 0.28.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/WidgetShell/GroupingMapping.d.ts +3 -1
- package/lib/cjs/WidgetShell/GroupingMapping.js +1 -1
- package/lib/cjs/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/cjs/WidgetShell/GroupingMappingContent.d.ts +2 -1
- package/lib/cjs/WidgetShell/GroupingMappingContent.js +2 -2
- package/lib/cjs/WidgetShell/GroupingMappingContent.js.map +1 -1
- package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.d.ts +2 -1
- package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js +5 -19
- package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
- package/lib/cjs/components/Groups/Groups.d.ts +2 -1
- package/lib/cjs/components/Groups/Groups.js +2 -2
- package/lib/cjs/components/Groups/Groups.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsView.d.ts +2 -1
- package/lib/cjs/components/Groups/GroupsView.js +5 -5
- package/lib/cjs/components/Groups/GroupsView.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsVisualization.d.ts +3 -1
- package/lib/cjs/components/Groups/GroupsVisualization.js +8 -3
- package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsVisualizationActions.d.ts +2 -1
- package/lib/cjs/components/Groups/GroupsVisualizationActions.js +36 -9
- package/lib/cjs/components/Groups/GroupsVisualizationActions.js.map +1 -1
- package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.d.ts +1 -1
- package/lib/cjs/components/Mappings/MappingViewActionGroup.d.ts +1 -1
- package/lib/cjs/components/Mappings/MappingViewActionGroup.js +1 -2
- package/lib/cjs/components/Mappings/MappingViewActionGroup.js.map +1 -1
- package/lib/cjs/components/Mappings/Mappings.d.ts +1 -0
- package/lib/cjs/components/Mappings/Mappings.js.map +1 -1
- package/lib/cjs/components/Mappings/MappingsView.d.ts +2 -1
- package/lib/cjs/components/Mappings/MappingsView.js +4 -4
- package/lib/cjs/components/Mappings/MappingsView.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +2 -0
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +2 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +7 -8
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +21 -61
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.d.ts +5 -9
- package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +3 -12
- package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +8 -9
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +17 -164
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.scss +4 -3
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +76 -19
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.scss +3 -2
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.d.ts +2 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +12 -4
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenu.d.ts +2 -1
- package/lib/cjs/components/Properties/PropertyMenu.js +2 -7
- package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.d.ts +1 -1
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js +2 -2
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyTable.d.ts +2 -1
- package/lib/cjs/components/Properties/PropertyTable.js +2 -2
- package/lib/cjs/components/Properties/PropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyTableToolbar.d.ts +2 -1
- package/lib/cjs/components/Properties/PropertyTableToolbar.js +3 -3
- package/lib/cjs/components/Properties/PropertyTableToolbar.js.map +1 -1
- package/lib/cjs/components/Properties/ScrollableExpandableBlock.d.ts +11 -0
- package/lib/cjs/components/Properties/ScrollableExpandableBlock.js +55 -0
- package/lib/cjs/components/Properties/ScrollableExpandableBlock.js.map +1 -0
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.d.ts +6 -3
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.js +59 -13
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.js.map +1 -1
- package/lib/cjs/components/Properties/hooks/useForwardRef.d.ts +3 -0
- package/lib/cjs/components/Properties/hooks/useForwardRef.js +20 -0
- package/lib/cjs/components/Properties/hooks/useForwardRef.js.map +1 -0
- package/lib/cjs/components/SharedComponents/ActionPanel.d.ts +3 -1
- package/lib/cjs/components/SharedComponents/ActionPanel.js +3 -3
- package/lib/cjs/components/SharedComponents/ActionPanel.js.map +1 -1
- package/lib/cjs/formula/FormulaDataTypeResolver.d.ts +3 -2
- package/lib/cjs/formula/FormulaDataTypeResolver.js +10 -6
- package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/cjs/grouping-mapping-widget.d.ts +0 -2
- package/lib/cjs/grouping-mapping-widget.js +1 -5
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMapping.d.ts +3 -1
- package/lib/esm/WidgetShell/GroupingMapping.js +1 -1
- package/lib/esm/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMappingContent.d.ts +2 -1
- package/lib/esm/WidgetShell/GroupingMappingContent.js +2 -2
- package/lib/esm/WidgetShell/GroupingMappingContent.js.map +1 -1
- package/lib/esm/WidgetShell/Router/GroupingMappingRouter.d.ts +2 -1
- package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js +5 -19
- package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
- package/lib/esm/components/Groups/Groups.d.ts +2 -1
- package/lib/esm/components/Groups/Groups.js +2 -2
- package/lib/esm/components/Groups/Groups.js.map +1 -1
- package/lib/esm/components/Groups/GroupsView.d.ts +2 -1
- package/lib/esm/components/Groups/GroupsView.js +5 -5
- package/lib/esm/components/Groups/GroupsView.js.map +1 -1
- package/lib/esm/components/Groups/GroupsVisualization.d.ts +3 -1
- package/lib/esm/components/Groups/GroupsVisualization.js +8 -3
- package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/esm/components/Groups/GroupsVisualizationActions.d.ts +2 -1
- package/lib/esm/components/Groups/GroupsVisualizationActions.js +14 -7
- package/lib/esm/components/Groups/GroupsVisualizationActions.js.map +1 -1
- package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.d.ts +1 -1
- package/lib/esm/components/Mappings/MappingViewActionGroup.d.ts +1 -1
- package/lib/esm/components/Mappings/MappingViewActionGroup.js +1 -2
- package/lib/esm/components/Mappings/MappingViewActionGroup.js.map +1 -1
- package/lib/esm/components/Mappings/Mappings.d.ts +1 -0
- package/lib/esm/components/Mappings/Mappings.js.map +1 -1
- package/lib/esm/components/Mappings/MappingsView.d.ts +2 -1
- package/lib/esm/components/Mappings/MappingsView.js +4 -4
- package/lib/esm/components/Mappings/MappingsView.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +2 -0
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +2 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +7 -8
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +23 -60
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.d.ts +5 -9
- package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +4 -13
- package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +8 -9
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +18 -142
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.scss +4 -3
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +79 -22
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.scss +3 -2
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.d.ts +2 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +14 -6
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenu.d.ts +2 -1
- package/lib/esm/components/Properties/PropertyMenu.js +2 -7
- package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.d.ts +1 -1
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.js +2 -2
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/esm/components/Properties/PropertyTable.d.ts +2 -1
- package/lib/esm/components/Properties/PropertyTable.js +2 -2
- package/lib/esm/components/Properties/PropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/PropertyTableToolbar.d.ts +2 -1
- package/lib/esm/components/Properties/PropertyTableToolbar.js +3 -3
- package/lib/esm/components/Properties/PropertyTableToolbar.js.map +1 -1
- package/lib/esm/components/Properties/ScrollableExpandableBlock.d.ts +11 -0
- package/lib/esm/components/Properties/ScrollableExpandableBlock.js +29 -0
- package/lib/esm/components/Properties/ScrollableExpandableBlock.js.map +1 -0
- package/lib/esm/components/Properties/hooks/useFormulaValidation.d.ts +6 -3
- package/lib/esm/components/Properties/hooks/useFormulaValidation.js +57 -12
- package/lib/esm/components/Properties/hooks/useFormulaValidation.js.map +1 -1
- package/lib/esm/components/Properties/hooks/useForwardRef.d.ts +3 -0
- package/lib/esm/components/Properties/hooks/useForwardRef.js +16 -0
- package/lib/esm/components/Properties/hooks/useForwardRef.js.map +1 -0
- package/lib/esm/components/SharedComponents/ActionPanel.d.ts +3 -1
- package/lib/esm/components/SharedComponents/ActionPanel.js +3 -3
- package/lib/esm/components/SharedComponents/ActionPanel.js.map +1 -1
- package/lib/esm/formula/FormulaDataTypeResolver.d.ts +3 -2
- package/lib/esm/formula/FormulaDataTypeResolver.js +10 -6
- package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +0 -2
- package/lib/esm/grouping-mapping-widget.js +0 -2
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +0 -14
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +0 -87
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +0 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.scss +0 -9
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +0 -13
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +0 -91
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js.map +0 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +0 -14
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +0 -60
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +0 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.scss +0 -9
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +0 -13
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +0 -64
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js.map +0 -1
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
1
|
import { splitFormula } from "./FormulaSplitter";
|
|
6
2
|
import { resolveTokensDataType } from "./FormulaTokensDataTypeResolver";
|
|
7
3
|
import { convertInfixToPostfix } from "./InfixToPostfixConverter";
|
|
8
4
|
import { ParenthesisState, validateParenthesis } from "./ParenthesisValidator";
|
|
5
|
+
import { inferToPropertyDataType } from "../components/Properties/hooks/useFormulaValidation";
|
|
9
6
|
/**
|
|
10
7
|
* Resolves DataType of the given formula.
|
|
11
8
|
* @param formulaName Name of the current formula. Expected to be lowercase.
|
|
@@ -15,7 +12,7 @@ import { ParenthesisState, validateParenthesis } from "./ParenthesisValidator";
|
|
|
15
12
|
* @returns `dataType` if formula is valid. `errorMessage` otherwise.
|
|
16
13
|
* @public
|
|
17
14
|
*/
|
|
18
|
-
export function resolveFormulaDataType(formulaName, formula, properties) {
|
|
15
|
+
export function resolveFormulaDataType(formulaName, formula, properties, providedDataType) {
|
|
19
16
|
const parenthesisState = validateParenthesis(formula);
|
|
20
17
|
if (ParenthesisState.NotClosed === parenthesisState) {
|
|
21
18
|
return { errorMessage: "Opened but not closed parenthesis found." };
|
|
@@ -41,6 +38,13 @@ export function resolveFormulaDataType(formulaName, formula, properties) {
|
|
|
41
38
|
if (undefined === postfixFormulaTokens.value) {
|
|
42
39
|
return { errorMessage: postfixFormulaTokens.errorMessage ?? "Unknown error." };
|
|
43
40
|
}
|
|
44
|
-
|
|
41
|
+
const tokensDataType = resolveTokensDataType(formulaName, postfixFormulaTokens.value, properties);
|
|
42
|
+
if (providedDataType && !tokensDataType.errorMessage) {
|
|
43
|
+
const formulaDataType = inferToPropertyDataType(tokensDataType.value);
|
|
44
|
+
if (providedDataType !== formulaDataType) {
|
|
45
|
+
return { errorMessage: `The formula result data type ${formulaDataType} does not match the provided data type ${providedDataType}` };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return tokensDataType;
|
|
45
49
|
}
|
|
46
50
|
//# sourceMappingURL=FormulaDataTypeResolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormulaDataTypeResolver.js","sourceRoot":"","sources":["../../../src/formula/FormulaDataTypeResolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormulaDataTypeResolver.js","sourceRoot":"","sources":["../../../src/formula/FormulaDataTypeResolver.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAE9F;;;;;;;;GAQG;AAEH,MAAM,UAAU,sBAAsB,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB,EAAE,gBAA2B;IAC/H,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,gBAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QACnD,OAAO,EAAE,YAAY,EAAE,0CAA0C,EAAE,CAAC;KACrE;SAAM,IAAI,gBAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QAC1D,OAAO,EAAE,YAAY,EAAE,0CAA0C,EAAE,CAAC;KACrE;IAED,IAAI,kBAAkB,CAAC;IACvB,IAAI;QACF,kBAAkB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;KAC5C;IAAC,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,YAAY,KAAK,EAAE;YACvB,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC;SACrC;aAAM;YACL,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YACpC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;SAC3C;KACF;IAED,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;IAEvE,IAAI,SAAS,KAAK,oBAAoB,CAAC,KAAK,EAAE;QAC5C,OAAO,EAAE,YAAY,EAAE,oBAAoB,CAAC,YAAY,IAAI,gBAAgB,EAAE,CAAC;KAChF;IAED,MAAM,cAAc,GAAG,qBAAqB,CAAC,WAAW,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAElG,IAAI,gBAAgB,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE;QACpD,MAAM,eAAe,GAAG,uBAAuB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACtE,IAAI,gBAAgB,KAAK,eAAe,EAAE;YACxC,OAAO,EAAE,YAAY,EAAE,gCAAgC,eAAe,0CAA0C,gBAAgB,EAAE,EAAE,CAAC;SACtI;KACF;IAED,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { DataType } from \"@itwin/insights-client\";\nimport { splitFormula } from \"./FormulaSplitter\";\nimport { resolveTokensDataType } from \"./FormulaTokensDataTypeResolver\";\nimport { convertInfixToPostfix } from \"./InfixToPostfixConverter\";\nimport type { IResult } from \"./IResult\";\nimport { ParenthesisState, validateParenthesis } from \"./ParenthesisValidator\";\nimport type { DataType as FormulaDataType, PropertyMap } from \"./Types\";\nimport { inferToPropertyDataType } from \"../components/Properties/hooks/useFormulaValidation\";\n\n/**\n * Resolves DataType of the given formula.\n * @param formulaName Name of the current formula. Expected to be lowercase.\n * @param formula The formula itself.\n * @param properties All available properties or variables with their data types\n * that could be used in formula. Names are expected to be lowercase.\n * @returns `dataType` if formula is valid. `errorMessage` otherwise.\n * @public\n */\n\nexport function resolveFormulaDataType(formulaName: string, formula: string, properties: PropertyMap, providedDataType?: DataType): IResult<FormulaDataType> {\n const parenthesisState = validateParenthesis(formula);\n if (ParenthesisState.NotClosed === parenthesisState) {\n return { errorMessage: \"Opened but not closed parenthesis found.\" };\n } else if (ParenthesisState.NotOpened === parenthesisState) {\n return { errorMessage: \"Closed but not opened parenthesis found.\" };\n }\n\n let infixFormulaTokens;\n try {\n infixFormulaTokens = splitFormula(formula);\n } catch (ex) {\n if (ex instanceof Error) {\n return { errorMessage: ex.message };\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Unknown error.\", ex);\n return { errorMessage: \"Unknown error.\" };\n }\n }\n\n const postfixFormulaTokens = convertInfixToPostfix(infixFormulaTokens);\n\n if (undefined === postfixFormulaTokens.value) {\n return { errorMessage: postfixFormulaTokens.errorMessage ?? \"Unknown error.\" };\n }\n\n const tokensDataType = resolveTokensDataType(formulaName, postfixFormulaTokens.value, properties);\n\n if (providedDataType && !tokensDataType.errorMessage) {\n const formulaDataType = inferToPropertyDataType(tokensDataType.value);\n if (providedDataType !== formulaDataType) {\n return { errorMessage: `The formula result data type ${formulaDataType} does not match the provided data type ${providedDataType}` };\n }\n }\n\n return tokensDataType;\n}\n"]}
|
|
@@ -21,8 +21,6 @@ export { PropertyMenu, PropertyMenuProps } from "./components/Properties/Propert
|
|
|
21
21
|
export { PropertyMenuWithVisualization, PropertyMenuWithVisualizationProps } from "./components/Properties/PropertyMenuWithVisualization";
|
|
22
22
|
export { GroupPropertyAction, GroupPropertyActionProps } from "./components/Properties/GroupProperties/GroupPropertyAction";
|
|
23
23
|
export { CalculatedPropertyAction, CalculatedPropertyActionProps } from "./components/Properties/CalculatedProperties/CalculatedPropertyAction";
|
|
24
|
-
export { CalculatedPropertyActionWithVisuals, CalculatedPropertyActionWithVisualsProps, } from "./components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals";
|
|
25
|
-
export { CustomCalculationAction, CustomCalculationActionProps } from "./components/Properties/CustomCalculations/CustomCalculationAction";
|
|
26
24
|
export { SearchGroupingCustomUI } from "./components/customUI/SearchGroupingCustomUI";
|
|
27
25
|
export { ManualGroupingCustomUI } from "./components/customUI/ManualGroupingCustomUI";
|
|
28
26
|
export { GroupQueryBuilderCustomUI } from "./components/customUI/GroupQueryBuilderCustomUI";
|
|
@@ -25,8 +25,6 @@ export { PropertyMenu } from "./components/Properties/PropertyMenu";
|
|
|
25
25
|
export { PropertyMenuWithVisualization } from "./components/Properties/PropertyMenuWithVisualization";
|
|
26
26
|
export { GroupPropertyAction } from "./components/Properties/GroupProperties/GroupPropertyAction";
|
|
27
27
|
export { CalculatedPropertyAction } from "./components/Properties/CalculatedProperties/CalculatedPropertyAction";
|
|
28
|
-
export { CalculatedPropertyActionWithVisuals, } from "./components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals";
|
|
29
|
-
export { CustomCalculationAction } from "./components/Properties/CustomCalculations/CustomCalculationAction";
|
|
30
28
|
export { SearchGroupingCustomUI } from "./components/customUI/SearchGroupingCustomUI";
|
|
31
29
|
export { ManualGroupingCustomUI } from "./components/customUI/ManualGroupingCustomUI";
|
|
32
30
|
export { GroupQueryBuilderCustomUI } from "./components/customUI/GroupQueryBuilderCustomUI";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouping-mapping-widget.js","sourceRoot":"","sources":["../../src/grouping-mapping-widget.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,gDAAgD;AAChD,cAAc,qCAAqC,CAAC;AAEpD,0EAA0E;AAC1E,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AACpJ,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC/I,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAIL,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,+CAA+C,CAAC;AACvD,cAAc,wBAAwB,CAAC;AAEvC,yCAAyC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAA2B,MAAM,mDAAmD,CAAC;AACnH,OAAO,EAAE,aAAa,EAAsB,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAAE,YAAY,EAAqB,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAyB,MAAM,+CAA+C,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAmB,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAA+B,MAAM,qCAAqC,CAAC;AAC1G,OAAO,EAAE,MAAM,EAAe,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAA4B,MAAM,yCAAyC,CAAC;AACxG,OAAO,EAAE,WAAW,EAAoB,MAAM,yCAAyC,CAAC;AACxF,OAAO,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AmB,EAA4B,MAAM,yCAAyC,CAAC;AACxG,OAAO,EAAE,WAAW,EAAoB,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAqB,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAsC,MAAM,uDAAuD,CAAC;AAC1I,OAAO,EAAE,mBAAmB,EAA4B,MAAM,6DAA6D,CAAC;AAC5H,OAAO,EAAE,wBAAwB,EAAiC,MAAM,uEAAuE,CAAC;AAChJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAEL,2BAA2B,GAK5B,MAAM,+CAA+C,CAAC;AAEvD,gCAAgC;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,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 *--------------------------------------------------------------------------------------------*/\n/** UI Provider for iTwin Viewer Applications */\nexport * from \"./WidgetShell/GroupingMappingWidget\";\n\n/** Interfaces for providing custom MappingClient and API configuration */\nexport { createDefaultMappingClient, createMappingClient, MappingClientContext, useMappingClient } from \"./components/context/MappingClientContext\";\nexport { createDefaultGroupsClient, createGroupsClient, GroupsClientContext, useGroupsClient } from \"./components/context/GroupsClientContext\";\nexport {\n createDefaultPropertiesClient,\n createPropertiesClient,\n PropertiesClientContext,\n usePropertiesClient,\n} from \"./components/context/PropertiesClientContext\";\nexport {\n ClientPrefix,\n GetAccessTokenFn,\n GroupingMappingApiConfig,\n GroupingMappingApiConfigContext,\n useGroupingMappingApiConfig,\n} from \"./components/context/GroupingApiConfigContext\";\nexport * from \"@itwin/insights-client\";\n\n/** Internal components for custom UIs */\nexport { Mappings, MappingsProps } from \"./components/Mappings/Mappings\";\nexport { useMappingsOperations, MappingsOperationsProps } from \"./components/Mappings/hooks/useMappingsOperations\";\nexport { MappingAction, MappingActionProps } from \"./components/Mappings/Editing/MappingAction\";\nexport { MappingsView, MappingsViewProps } from \"./components/Mappings/MappingsView\";\nexport { useGroupsOperations, GroupsOperationsProps } from \"./components/Groups/hooks/useGroupsOperations\";\nexport { GroupsView, GroupsViewProps } from \"./components/Groups/GroupsView\";\nexport { GroupingMappingContext, GroupingMappingContextProps } from \"./components/GroupingMappingContext\";\nexport { Groups, GroupsProps } from \"./components/Groups/Groups\";\nexport { GroupsVisualization, GroupsVisualizationProps } from \"./components/Groups/GroupsVisualization\";\nexport { GroupAction, GroupActionProps } from \"./components/Groups/Editing/GroupAction\";\nexport { PropertyMenu, PropertyMenuProps } from \"./components/Properties/PropertyMenu\";\nexport { PropertyMenuWithVisualization, PropertyMenuWithVisualizationProps } from \"./components/Properties/PropertyMenuWithVisualization\";\nexport { GroupPropertyAction, GroupPropertyActionProps } from \"./components/Properties/GroupProperties/GroupPropertyAction\";\nexport { CalculatedPropertyAction, CalculatedPropertyActionProps } from \"./components/Properties/CalculatedProperties/CalculatedPropertyAction\";\nexport { SearchGroupingCustomUI } from \"./components/customUI/SearchGroupingCustomUI\";\nexport { ManualGroupingCustomUI } from \"./components/customUI/ManualGroupingCustomUI\";\nexport { GroupQueryBuilderCustomUI } from \"./components/customUI/GroupQueryBuilderCustomUI\";\nexport {\n GroupingMappingCustomUI,\n GroupingMappingCustomUIType,\n ContextCustomUI,\n GroupingCustomUI,\n GroupingCustomUIProps,\n ContextCustomUIProps,\n} from \"./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"]}
|
package/package.json
CHANGED
|
@@ -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,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,GAAG,IAAA,4BAAc,GAAE,CAAC;IAErC,MAAM,cAAc,GAAG,IAAA,mBAAW,EAChC,CAAC,qBAAgD,EAAsB,EAAE,CAAC;QACxE;YACE,EAAE,EAAE,cAAc;YAClB,MAAM,EAAE,qBAAqB;YAC7B,QAAQ,EAAE,cAAc;YACxB,IAAI,EAAE,CAAC,KAA0B,EAAE,EAAE,CAAC,8BAAC,mCAAgB,IAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,GAAI;SACvH;QACD;YACE,EAAE,EAAE,UAAU;YACd,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,CAAC,KAA0B,EAAE,EAAE;gBACnC,OAAO,CACL,8BAAC,4BAAY,IACX,SAAS,EAAE,CAAC,KAAiB,EAAE,EAAE,CAC/B;wBACE,aAAa;4BACX,CAAC,CAAC;gCACE,8BAAC,wBAAQ,IACP,GAAG,EAAE,CAAC,E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E,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":";;;;;;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,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,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,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MA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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 { 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,4BAA4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AC,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"]}
|