@itwin/grouping-mapping-widget 0.16.1 → 0.17.1
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/decorators/BboxDimensionsDecorator.js +14 -17
- package/lib/cjs/decorators/BboxDimensionsDecorator.js.map +1 -1
- package/lib/cjs/formula/FormulaDataTypeResolver.js +1 -2
- package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/cjs/formula/FormulaFunctionProvider.js +2 -3
- package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +1 -2
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/cjs/test/PropertyFieldsHelpers.js +4 -7
- package/lib/cjs/test/PropertyFieldsHelpers.js.map +1 -1
- package/lib/cjs/test/QueryBuilder.test.js +3 -4
- package/lib/cjs/test/QueryBuilder.test.js.map +1 -1
- package/lib/cjs/widget/GroupingMappingWidget.d.ts +2 -2
- package/lib/cjs/widget/GroupingMappingWidget.js +1 -3
- package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.scss +2 -3
- package/lib/cjs/widget/components/BlockingOverlay.scss +4 -5
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +3 -4
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyAction.scss +1 -2
- package/lib/cjs/widget/components/CalculatedPropertyActionWithVisuals.js +6 -8
- package/lib/cjs/widget/components/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyActionWithVisuals.scss +1 -2
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +4 -5
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.scss +7 -8
- package/lib/cjs/widget/components/CustomCalculationAction.js +10 -14
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationAction.scss +1 -2
- package/lib/cjs/widget/components/DeleteModal.js +1 -1
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +1 -2
- package/lib/cjs/widget/components/GroupAction.js +5 -7
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +0 -1
- package/lib/cjs/widget/components/GroupColorLegend.scss +2 -1
- package/lib/cjs/widget/components/GroupColorToggle.d.ts +2 -2
- package/lib/cjs/widget/components/GroupColorToggle.js.map +1 -1
- package/lib/cjs/widget/components/GroupDetails.js +1 -1
- package/lib/cjs/widget/components/GroupDetails.js.map +1 -1
- package/lib/cjs/widget/components/GroupDetailsStep.scss +1 -2
- package/lib/cjs/widget/components/GroupMenuActions.scss +1 -2
- package/lib/cjs/widget/components/GroupPropertyAction.js +23 -8
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.scss +13 -16
- package/lib/cjs/widget/components/GroupPropertyUtils.js +2 -3
- package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.js +3 -4
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +9 -11
- package/lib/cjs/widget/components/GroupingMapping.js +16 -20
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMapping.scss +2 -3
- package/lib/cjs/widget/components/GroupingMappingContext.js +9 -13
- package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingRouter.js +5 -5
- package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/cjs/widget/components/GroupsAddButton.js +2 -1
- package/lib/cjs/widget/components/GroupsAddButton.js.map +1 -1
- package/lib/cjs/widget/components/GroupsAddButton.scss +1 -2
- package/lib/cjs/widget/components/GroupsVisualization.scss +1 -2
- package/lib/cjs/widget/components/GroupsVisualizationActions.scss +0 -1
- package/lib/cjs/widget/components/HorizontalTile.js +4 -1
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.scss +16 -15
- package/lib/cjs/widget/components/Mapping.js +28 -32
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.scss +6 -12
- package/lib/cjs/widget/components/MappingAction.js +7 -9
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.scss +1 -2
- package/lib/cjs/widget/components/MappingImportWizardModal.js +3 -2
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.scss +4 -5
- package/lib/cjs/widget/components/PropertyAction.js +4 -5
- package/lib/cjs/widget/components/PropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.js +3 -3
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.scss +1 -2
- package/lib/cjs/widget/components/PropertyMenuWithVisualization.scss +1 -2
- package/lib/cjs/widget/components/PropertyTable.d.ts +1 -1
- package/lib/cjs/widget/components/PropertyTable.js +3 -4
- package/lib/cjs/widget/components/PropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/PropertyTable.scss +1 -2
- package/lib/cjs/widget/components/QueryBuilder.js +19 -29
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js +1 -1
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilderStep.scss +1 -2
- package/lib/cjs/widget/components/SaveModal.d.ts +8 -0
- package/lib/cjs/widget/components/SaveModal.js +22 -0
- package/lib/cjs/widget/components/SaveModal.js.map +1 -0
- package/lib/cjs/widget/components/SelectIModel.scss +0 -1
- package/lib/cjs/widget/components/SelectITwin.js +1 -1
- package/lib/cjs/widget/components/SelectITwin.js.map +1 -1
- package/lib/cjs/widget/components/SelectITwin.scss +1 -2
- package/lib/cjs/widget/components/SelectMapping.scss +0 -1
- package/lib/cjs/widget/components/SortableHorizontalTile.js +2 -1
- package/lib/cjs/widget/components/SortableHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/StatusIcon.d.ts +5 -6
- package/lib/cjs/widget/components/StatusIcon.scss +4 -8
- package/lib/cjs/widget/components/ToggleGroupVisibility.scss +1 -2
- package/lib/cjs/widget/components/WidgetHeader.js +1 -1
- package/lib/cjs/widget/components/WidgetHeader.js.map +1 -1
- package/lib/cjs/widget/components/WidgetHeader.scss +4 -12
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js +1 -1
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js +2 -2
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.scss +1 -2
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +2 -3
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +2 -3
- package/lib/cjs/widget/components/groupsHelpers.js +1 -2
- package/lib/cjs/widget/components/groupsHelpers.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +1 -4
- package/lib/cjs/widget/components/viewerUtils.js +1 -2
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/cjs/widget/hooks/useFetchData.js +1 -1
- package/lib/cjs/widget/hooks/useFetchData.js.map +1 -1
- package/lib/cjs/widget/hooks/useFormulaValidation.js +1 -2
- package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -1
- package/lib/esm/decorators/BboxDimensionsDecorator.js +14 -17
- package/lib/esm/decorators/BboxDimensionsDecorator.js.map +1 -1
- package/lib/esm/formula/FormulaDataTypeResolver.js +1 -2
- package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/esm/formula/FormulaFunctionProvider.js +2 -3
- package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +1 -2
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/test/PropertyFieldsHelpers.js +4 -7
- package/lib/esm/test/PropertyFieldsHelpers.js.map +1 -1
- package/lib/esm/test/QueryBuilder.test.js +3 -4
- package/lib/esm/test/QueryBuilder.test.js.map +1 -1
- package/lib/esm/widget/GroupingMappingWidget.d.ts +2 -2
- package/lib/esm/widget/GroupingMappingWidget.js +1 -3
- package/lib/esm/widget/GroupingMappingWidget.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.scss +2 -3
- package/lib/esm/widget/components/BlockingOverlay.scss +4 -5
- package/lib/esm/widget/components/CalculatedPropertyAction.js +4 -5
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.scss +1 -2
- package/lib/esm/widget/components/CalculatedPropertyActionWithVisuals.js +7 -9
- package/lib/esm/widget/components/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyActionWithVisuals.scss +1 -2
- package/lib/esm/widget/components/ConfirmMappingsImport.js +4 -5
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.scss +7 -8
- package/lib/esm/widget/components/CustomCalculationAction.js +11 -15
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationAction.scss +1 -2
- package/lib/esm/widget/components/DeleteModal.js +2 -2
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +1 -2
- package/lib/esm/widget/components/GroupAction.js +5 -7
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +0 -1
- package/lib/esm/widget/components/GroupColorLegend.scss +2 -1
- package/lib/esm/widget/components/GroupColorToggle.d.ts +2 -2
- package/lib/esm/widget/components/GroupColorToggle.js.map +1 -1
- package/lib/esm/widget/components/GroupDetails.js +2 -2
- package/lib/esm/widget/components/GroupDetails.js.map +1 -1
- package/lib/esm/widget/components/GroupDetailsStep.scss +1 -2
- package/lib/esm/widget/components/GroupMenuActions.scss +1 -2
- package/lib/esm/widget/components/GroupPropertyAction.js +24 -9
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.scss +13 -16
- package/lib/esm/widget/components/GroupPropertyUtils.js +2 -3
- package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/esm/widget/components/Grouping.js +4 -5
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +9 -11
- package/lib/esm/widget/components/GroupingMapping.js +16 -20
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMapping.scss +2 -3
- package/lib/esm/widget/components/GroupingMappingContext.js +9 -13
- package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingRouter.js +5 -5
- package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/esm/widget/components/GroupsAddButton.js +2 -1
- package/lib/esm/widget/components/GroupsAddButton.js.map +1 -1
- package/lib/esm/widget/components/GroupsAddButton.scss +1 -2
- package/lib/esm/widget/components/GroupsVisualization.scss +1 -2
- package/lib/esm/widget/components/GroupsVisualizationActions.scss +0 -1
- package/lib/esm/widget/components/HorizontalTile.js +5 -2
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.scss +16 -15
- package/lib/esm/widget/components/Mapping.js +29 -33
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.scss +6 -12
- package/lib/esm/widget/components/MappingAction.js +8 -10
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.scss +1 -2
- package/lib/esm/widget/components/MappingImportWizardModal.js +3 -2
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.scss +4 -5
- package/lib/esm/widget/components/PropertyAction.js +4 -5
- package/lib/esm/widget/components/PropertyAction.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.js +3 -3
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.scss +1 -2
- package/lib/esm/widget/components/PropertyMenuWithVisualization.scss +1 -2
- package/lib/esm/widget/components/PropertyTable.d.ts +1 -1
- package/lib/esm/widget/components/PropertyTable.js +3 -4
- package/lib/esm/widget/components/PropertyTable.js.map +1 -1
- package/lib/esm/widget/components/PropertyTable.scss +1 -2
- package/lib/esm/widget/components/QueryBuilder.js +19 -29
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilderCustomUI.js +1 -1
- package/lib/esm/widget/components/QueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilderStep.scss +1 -2
- package/lib/esm/widget/components/SaveModal.d.ts +8 -0
- package/lib/esm/widget/components/SaveModal.js +15 -0
- package/lib/esm/widget/components/SaveModal.js.map +1 -0
- package/lib/esm/widget/components/SelectIModel.scss +0 -1
- package/lib/esm/widget/components/SelectITwin.js +2 -2
- package/lib/esm/widget/components/SelectITwin.js.map +1 -1
- package/lib/esm/widget/components/SelectITwin.scss +1 -2
- package/lib/esm/widget/components/SelectMapping.scss +0 -1
- package/lib/esm/widget/components/SortableHorizontalTile.js +2 -1
- package/lib/esm/widget/components/SortableHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/StatusIcon.d.ts +5 -6
- package/lib/esm/widget/components/StatusIcon.scss +4 -8
- package/lib/esm/widget/components/ToggleGroupVisibility.scss +1 -2
- package/lib/esm/widget/components/WidgetHeader.js +2 -2
- package/lib/esm/widget/components/WidgetHeader.js.map +1 -1
- package/lib/esm/widget/components/WidgetHeader.scss +4 -12
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js +1 -1
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.scss +1 -2
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +2 -3
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +2 -3
- package/lib/esm/widget/components/groupsHelpers.js +1 -2
- package/lib/esm/widget/components/groupsHelpers.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +1 -4
- package/lib/esm/widget/components/viewerUtils.js +1 -2
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/widget/hooks/useFetchData.js +1 -1
- package/lib/esm/widget/hooks/useFetchData.js.map +1 -1
- package/lib/esm/widget/hooks/useFormulaValidation.js +1 -2
- package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -1
- package/package.json +32 -30
|
@@ -39,19 +39,17 @@ const defaultDisplayStrings = {
|
|
|
39
39
|
mappingDetails: "Mapping Details",
|
|
40
40
|
};
|
|
41
41
|
const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displayStrings: userDisplayStrings }) => {
|
|
42
|
-
var _a, _b, _c;
|
|
43
42
|
const { getAccessToken, iModelId } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
|
|
44
43
|
const mappingClient = MappingClientContext_1.useMappingClient();
|
|
45
44
|
const [values, setValues] = react_1.useState({
|
|
46
|
-
name:
|
|
47
|
-
description:
|
|
48
|
-
extractionEnabled:
|
|
45
|
+
name: mapping?.mappingName ?? "",
|
|
46
|
+
description: mapping?.description ?? "",
|
|
47
|
+
extractionEnabled: mapping?.extractionEnabled ?? true,
|
|
49
48
|
});
|
|
50
49
|
const [validator, showValidationMessage] = useValidator_1.default();
|
|
51
50
|
const [isLoading, setIsLoading] = react_1.useState(false);
|
|
52
51
|
const displayStrings = react_1.default.useMemo(() => ({ ...defaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);
|
|
53
52
|
const onSave = async () => {
|
|
54
|
-
var _a, _b, _c;
|
|
55
53
|
try {
|
|
56
54
|
if (!validator.allValid()) {
|
|
57
55
|
showValidationMessage(true);
|
|
@@ -71,9 +69,9 @@ const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displayStrings:
|
|
|
71
69
|
extractionEnabled: values.extractionEnabled,
|
|
72
70
|
});
|
|
73
71
|
setValues({
|
|
74
|
-
name:
|
|
75
|
-
description:
|
|
76
|
-
extractionEnabled:
|
|
72
|
+
name: mapping?.mappingName ?? "",
|
|
73
|
+
description: mapping?.description ?? "",
|
|
74
|
+
extractionEnabled: mapping?.extractionEnabled ?? true,
|
|
77
75
|
});
|
|
78
76
|
onSaveSuccess();
|
|
79
77
|
}
|
|
@@ -87,7 +85,7 @@ const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displayStrings:
|
|
|
87
85
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
88
86
|
react_1.default.createElement("div", { className: 'gmw-details-form-container' },
|
|
89
87
|
react_1.default.createElement(itwinui_react_1.Fieldset, { legend: displayStrings.mappingDetails, className: 'gmw-details-form' },
|
|
90
|
-
react_1.default.createElement(itwinui_react_1.
|
|
88
|
+
react_1.default.createElement(itwinui_react_1.Text, { variant: 'small', as: 'small', className: 'gmw-field-legend' }, "Asterisk * indicates mandatory fields."),
|
|
91
89
|
react_1.default.createElement(itwinui_react_1.LabeledInput, { id: 'name', name: 'name', label: 'Name', value: values.name, required: true, onChange: (event) => {
|
|
92
90
|
utils_1.handleInputChange(event, values, setValues);
|
|
93
91
|
validator.showMessageFor("name");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingAction.js","sourceRoot":"","sources":["../../../../src/widget/components/MappingAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,
|
|
1
|
+
{"version":3,"file":"MappingAction.js","sourceRoot":"","sources":["../../../../src/widget/components/MappingAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAkF;AAClF,+CAAwC;AACxC,gEAAwC;AACxC,sEAAwE;AACxE,mCAAyD;AACzD,gCAA8B;AAC9B,yEAAkE;AAElE,iFAAiF;AAEjF,MAAM,qBAAqB,GAAG;IAC5B,cAAc,EAAE,iBAAiB;CAClC,CAAC;AASK,MAAM,aAAa,GAAG,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAsB,EAAE,EAAE;IACjI,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,sDAA2B,EAAE,CAAC;IACnE,MAAM,aAAa,GAAG,uCAAgB,EAAE,CAAC;IACzC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAQ,CAAC;QACnC,IAAI,EAAE,OAAO,EAAE,WAAW,IAAI,EAAE;QAChC,WAAW,EAAE,OAAO,EAAE,WAAW,IAAI,EAAE;QACvC,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,IAAI,IAAI;KACtD,CAAC,CAAC;IACH,MAAM,CAAC,SAAS,EAAE,qBAAqB,CAAC,GAAG,sBAA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B,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;wBAClB,yBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;oBAC9C,CAAC,GACD;gBACF,8BAAC,4BAAY,IACX,EAAE,EAAC,mBAAmB,EACtB,IAAI,EAAC,mBAAmB,EACxB,KAAK,EAAC,0BAA0B,EAChC,aAAa,EAAC,OAAO,EACrB,OAAO,EAAE,MAAM,CAAC,iBAAiB,EACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;wBAClB,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC3E,CAAC,GACD,CACO,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,CAAC,MAAM,CAAC,IAAI,EAC9B,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AA5GW,QAAA,aAAa,iBA4GxB","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 { Fieldset, LabeledInput, Text, ToggleSwitch } from \"@itwin/itwinui-react\";\nimport React, { useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError, handleInputChange } from \"./utils\";\nimport \"./MappingAction.scss\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nconst defaultDisplayStrings = {\n mappingDetails: \"Mapping Details\",\n};\n\nexport interface MappingActionProps {\n mapping?: Mapping;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nexport const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displayStrings: userDisplayStrings }: MappingActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [values, setValues] = useState({\n name: mapping?.mappingName ?? \"\",\n description: mapping?.description ?? \"\",\n extractionEnabled: mapping?.extractionEnabled ?? true,\n });\n const [validator, showValidationMessage] = useValidator();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const onSave = async () => {\n try {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n setIsLoading(true);\n const accessToken = await getAccessToken();\n mapping\n ? await mappingClient.updateMapping(accessToken, iModelId, mapping.id, {\n mappingName: values.name,\n description: values.description,\n extractionEnabled: values.extractionEnabled,\n })\n : await mappingClient.createMapping(accessToken, iModelId, {\n mappingName: values.name,\n description: values.description,\n extractionEnabled: values.extractionEnabled,\n });\n setValues({\n name: mapping?.mappingName ?? \"\",\n description: mapping?.description ?? \"\",\n extractionEnabled: mapping?.extractionEnabled ?? true,\n });\n onSaveSuccess();\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <>\n <div className='gmw-details-form-container'>\n <Fieldset legend={displayStrings.mappingDetails} className='gmw-details-form'>\n <Text variant='small' as='small' className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Text>\n <LabeledInput\n id='name'\n name='name'\n label='Name'\n value={values.name}\n required\n onChange={(event) => {\n handleInputChange(event, values, setValues);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", values.name, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", values.name, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n handleInputChange(event, values, setValues);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledInput\n id='description'\n name='description'\n label='Description'\n value={values.description}\n onChange={(event) => {\n handleInputChange(event, values, setValues);\n }}\n />\n <ToggleSwitch\n id='extractionEnabled'\n name='extractionEnabled'\n label='Extract data from iModel'\n labelPosition=\"right\"\n checked={values.extractionEnabled}\n onChange={(event) => {\n setValues({ ...values, extractionEnabled: event.currentTarget.checked });\n }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={onClickCancel}\n isSavingDisabled={!values.name}\n isLoading={isLoading}\n />\n </>\n );\n};\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import '~@itwin/itwinui-css/scss/variables';
|
|
6
5
|
|
|
7
6
|
.gmw-details-form-container {
|
|
8
7
|
overflow-x: auto;
|
|
@@ -11,6 +10,6 @@
|
|
|
11
10
|
.gmw-details-form {
|
|
12
11
|
display: flex;
|
|
13
12
|
flex-direction: column;
|
|
14
|
-
gap:
|
|
13
|
+
gap: var(--iui-size-s);
|
|
15
14
|
}
|
|
16
15
|
}
|
|
@@ -24,6 +24,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.MappingImportWizardModal = void 0;
|
|
26
26
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
27
|
+
const itwinui_react_2 = require("@itwin/itwinui-react");
|
|
27
28
|
const react_1 = __importStar(require("react"));
|
|
28
29
|
const ConfirmMappingsImport_1 = __importDefault(require("./ConfirmMappingsImport"));
|
|
29
30
|
require("./MappingImportWizardModal.scss");
|
|
@@ -81,11 +82,11 @@ const MappingImportWizardModal = ({ show, setShow, onFinish, displayStrings: use
|
|
|
81
82
|
setCurrentStep(0);
|
|
82
83
|
await onFinish();
|
|
83
84
|
};
|
|
84
|
-
return (react_1.default.createElement(
|
|
85
|
+
return (react_1.default.createElement(itwinui_react_2.Modal, { title: `Import ${displayStrings.mappings}`, modalRootId: 'grouping-mapping-widget', isOpen: show, closeOnEsc: false, closeOnExternalClick: false, isDismissible: !importing, styleType: 'fullPage', onClose: async () => {
|
|
85
86
|
await onClose();
|
|
86
87
|
} },
|
|
87
88
|
react_1.default.createElement("div", { className: 'gmw-import-wizard-body-container' },
|
|
88
|
-
react_1.default.createElement(itwinui_react_1.
|
|
89
|
+
react_1.default.createElement(itwinui_react_1.Stepper, { currentStep: currentStep, steps: steps.current, onStepClick: importing ? undefined : (index) => setCurrentStep(index) }),
|
|
89
90
|
(() => {
|
|
90
91
|
switch (currentStep) {
|
|
91
92
|
case 0:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingImportWizardModal.js","sourceRoot":"","sources":["../../../../src/widget/components/MappingImportWizardModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wDAAqD;AACrD,+CAA2D;AAC3D,oFAA2D;AAE3D,2CAAyC;AACzC,kEAA0C;AAC1C,gEAAwC;AACxC,sEAA8C;AAC9C,iFAAiF;AACjF,yEAA2F;AAC3F,uEAAwF;AAExF,MAAM,qBAAqB,GAAG;IAC5B,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,QAAQ;IACrB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,MAAM;IAClB,iBAAiB,EAAE,aAAa;CACjC,CAAC;AAQK,MAAM,wBAAwB,GAAG,CAAC,EACvC,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,cAAc,EAAE,kBAAkB,GACJ,EAAE,EAAE;IAClC,MAAM,EAAE,MAAM,EAAE,G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AAgB,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAC7C,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,KAAK,IAAI,EAAE;oCACnB,MAAM,OAAO,EAAE,CAAC;oCAChB,YAAY,CAAC,KAAK,CAAC,CAAC;gCACtB,CAAC,EACD,cAAc,EAAE,cAAc,GAC9B,CACH,CACA,CACJ,CAAC;oBACJ;wBACE,OAAO,IAAI,CAAC;iBACf;YACH,CAAC,CAAC,EAAE,CACA,CACA,CACT,CAAC;AACJ,CAAC,CAAC;AA1JW,QAAA,wBAAwB,4BA0JnC","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 { IModelsClient } from \"@itwin/imodels-client-management\";\nimport type { ITwinsAccessClient } from \"@itwin/itwins-client\";\nimport type { StepProperties } from \"@itwin/itwinui-react\";\nimport { Modal, Wizard } from \"@itwin/itwinui-react\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport ConfirmMappingImport from \"./ConfirmMappingsImport\";\nimport type { IMappingTyped } from \"./Mapping\";\nimport \"./MappingImportWizardModal.scss\";\nimport SelectIModel from \"./SelectIModel\";\nimport SelectITwin from \"./SelectITwin\";\nimport SelectMappings from \"./SelectMappings\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { createIModelsClient, IModelsClientContext } from \"./context/IModelsClientContext\";\nimport { createITwinsClient, ITwinsClientContext } from \"./context/ITwinsClientContext\";\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n iTwins: \"iTwins\",\n iTwinNumber: \"Number\",\n iTwinName: \"Name\",\n iTwinStatus: \"Status\",\n iModels: \"iModels\",\n iModelName: \"Name\",\n iModelDescription: \"Description\",\n};\ninterface MappingImportWizardModalProps {\n show: boolean;\n setShow: React.Dispatch<React.SetStateAction<boolean>>;\n onFinish: () => Promise<void>;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nexport const MappingImportWizardModal = ({\n show,\n setShow,\n onFinish,\n displayStrings: userDisplayStrings,\n}: MappingImportWizardModalProps) => {\n const { prefix } = useGroupingMappingApiConfig();\n const [currentStep, setCurrentStep] = useState<number>(0);\n const [iTwinType, setITwinType] = useState<number>(0);\n const [selectedITwinId, setSelectedITwinId] = useState<string>(\"\");\n const [selectedIModelId, setSelectedIModelId] = useState<string>(\"\");\n const [selectedMappings, setSelectedMappings] = useState<IMappingTyped[]>([]);\n const [importing, setImporting] = useState<boolean>(false);\n const [iTwinsClient, setITwinsClient] = useState<ITwinsAccessClient>(createITwinsClient(prefix));\n const [iModelsClient, setIModelsClient] = useState<IModelsClient>(createIModelsClient(prefix));\n\n useEffect(() => {\n setITwinsClient(createITwinsClient(prefix));\n setIModelsClient(createIModelsClient(prefix));\n }, [prefix]);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const steps = useRef<StepProperties[]>([\n {\n name: \"Select iTwin\",\n description: `Select the source iTwin to bring your ${displayStrings.mappings} from.`,\n },\n {\n name: \"Select iModel\",\n description: \"Select an iModel within the iTwin you have selected.\",\n },\n {\n name: `Select ${displayStrings.mappings}`,\n description: `Select one or more ${displayStrings.mappings} to import.`,\n },\n {\n name: \"Rename & Confirm\",\n description:\n \"Rename and confirm your selections. Click import when finished.\",\n },\n ]);\n\n const onClose = async () => {\n setShow(false);\n setCurrentStep(0);\n await onFinish();\n };\n\n return (\n <Modal\n title={`Import ${displayStrings.mappings}`}\n modalRootId='grouping-mapping-widget'\n isOpen={show}\n closeOnEsc={false}\n closeOnExternalClick={false}\n isDismissible={!importing}\n styleType='fullPage'\n onClose={async () => {\n await onClose();\n }}\n >\n <div className='gmw-import-wizard-body-container'>\n <Wizard\n currentStep={currentStep}\n steps={steps.current}\n onStepClick={\n importing ? undefined : (index: number) => setCurrentStep(index)\n }\n />\n\n {(() => {\n switch (currentStep) {\n case 0:\n return (\n <ITwinsClientContext.Provider value={iTwinsClient}>\n <div className=\"gmw-table-container\">\n <SelectITwin\n onSelect={(iTwinId) => {\n setSelectedITwinId(iTwinId);\n setCurrentStep(1);\n }}\n onCancel={onClose}\n onChangeITwinType={setITwinType}\n displayStrings={displayStrings}\n defaultITwinType={iTwinType}\n />\n </div>\n </ITwinsClientContext.Provider>\n );\n case 1:\n return (\n <IModelsClientContext.Provider value={iModelsClient}>\n <div className=\"gmw-table-container\">\n <SelectIModel\n iTwinId={selectedITwinId}\n onSelect={(iModelId) => {\n setSelectedIModelId(iModelId);\n setCurrentStep(2);\n }}\n backFn={() => setCurrentStep(currentStep - 1)}\n onCancel={onClose}\n />\n </div>\n </IModelsClientContext.Provider>\n );\n case 2:\n case 3:\n // Preserve table state within Select Mappings\n return (\n <>\n <div\n style={{ display: currentStep === 2 ? \"flex\" : \"none\" }}\n className=\"gmw-mapping-container\"\n >\n <SelectMappings\n iModelId={selectedIModelId}\n onSelect={(selectedMappings) => {\n setSelectedMappings(selectedMappings);\n setCurrentStep(3);\n }}\n onCancel={onClose}\n backFn={() => setCurrentStep(currentStep - 1)}\n displayStrings={displayStrings}\n />\n </div>\n {currentStep === 3 && (\n <ConfirmMappingImport\n sourceiModelId={selectedIModelId}\n selectedMappings={selectedMappings}\n importing={importing}\n setImporting={setImporting}\n setSelectedMappings={setSelectedMappings}\n backFn={() => setCurrentStep(currentStep - 1)}\n onCancel={onClose}\n onFinish={async () => {\n await onClose();\n setImporting(false);\n }}\n displayStrings={displayStrings}\n />\n )}\n </>\n );\n default:\n return null;\n }\n })()}\n </div>\n </Modal>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"MappingImportWizardModal.js","sourceRoot":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ACwB,CACjC,CAAC;oBACJ,KAAK,CAAC,CAAC;oBACP,KAAK,CAAC;wBACJ,8CAA8C;wBAC9C,OAAO,CACL;4BACE,uCACE,KAAK,EAAE,EAAE,OAAO,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EACvD,SAAS,EAAC,uBAAuB;gCAEjC,8BAAC,wBAAc,IACb,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,CAAC,gBAAgB,EAAE,EAAE;wCAC7B,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;wCACtC,cAAc,CAAC,CAAC,CAAC,CAAC;oCACpB,CAAC,EACD,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAC7C,cAAc,EAAE,cAAc,GAC9B,CACE;4BACL,WAAW,KAAK,CAAC,IAAI,CACpB,8BAAC,+BAAoB,IACnB,cAAc,EAAE,gBAAgB,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAC7C,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,KAAK,IAAI,EAAE;oCACnB,MAAM,OAAO,EAAE,CAAC;oCAChB,YAAY,CAAC,KAAK,CAAC,CAAC;gCACtB,CAAC,EACD,cAAc,EAAE,cAAc,GAC9B,CACH,CACA,CACJ,CAAC;oBACJ;wBACE,OAAO,IAAI,CAAC;iBACf;YACH,CAAC,CAAC,EAAE,CACA,CACA,CACT,CAAC;AACJ,CAAC,CAAC;AA1JW,QAAA,wBAAwB,4BA0JnC","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 { IModelsClient } from \"@itwin/imodels-client-management\";\nimport type { ITwinsAccessClient } from \"@itwin/itwins-client\";\nimport type { StepProperties } from \"@itwin/itwinui-react\";\nimport { Stepper } from \"@itwin/itwinui-react\";\nimport { Modal } from \"@itwin/itwinui-react\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport ConfirmMappingImport from \"./ConfirmMappingsImport\";\nimport type { IMappingTyped } from \"./Mapping\";\nimport \"./MappingImportWizardModal.scss\";\nimport SelectIModel from \"./SelectIModel\";\nimport SelectITwin from \"./SelectITwin\";\nimport SelectMappings from \"./SelectMappings\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { createIModelsClient, IModelsClientContext } from \"./context/IModelsClientContext\";\nimport { createITwinsClient, ITwinsClientContext } from \"./context/ITwinsClientContext\";\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n iTwins: \"iTwins\",\n iTwinNumber: \"Number\",\n iTwinName: \"Name\",\n iTwinStatus: \"Status\",\n iModels: \"iModels\",\n iModelName: \"Name\",\n iModelDescription: \"Description\",\n};\ninterface MappingImportWizardModalProps {\n show: boolean;\n setShow: React.Dispatch<React.SetStateAction<boolean>>;\n onFinish: () => Promise<void>;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nexport const MappingImportWizardModal = ({\n show,\n setShow,\n onFinish,\n displayStrings: userDisplayStrings,\n}: MappingImportWizardModalProps) => {\n const { prefix } = useGroupingMappingApiConfig();\n const [currentStep, setCurrentStep] = useState<number>(0);\n const [iTwinType, setITwinType] = useState<number>(0);\n const [selectedITwinId, setSelectedITwinId] = useState<string>(\"\");\n const [selectedIModelId, setSelectedIModelId] = useState<string>(\"\");\n const [selectedMappings, setSelectedMappings] = useState<IMappingTyped[]>([]);\n const [importing, setImporting] = useState<boolean>(false);\n const [iTwinsClient, setITwinsClient] = useState<ITwinsAccessClient>(createITwinsClient(prefix));\n const [iModelsClient, setIModelsClient] = useState<IModelsClient>(createIModelsClient(prefix));\n\n useEffect(() => {\n setITwinsClient(createITwinsClient(prefix));\n setIModelsClient(createIModelsClient(prefix));\n }, [prefix]);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const steps = useRef<StepProperties[]>([\n {\n name: \"Select iTwin\",\n description: `Select the source iTwin to bring your ${displayStrings.mappings} from.`,\n },\n {\n name: \"Select iModel\",\n description: \"Select an iModel within the iTwin you have selected.\",\n },\n {\n name: `Select ${displayStrings.mappings}`,\n description: `Select one or more ${displayStrings.mappings} to import.`,\n },\n {\n name: \"Rename & Confirm\",\n description:\n \"Rename and confirm your selections. Click import when finished.\",\n },\n ]);\n\n const onClose = async () => {\n setShow(false);\n setCurrentStep(0);\n await onFinish();\n };\n\n return (\n <Modal\n title={`Import ${displayStrings.mappings}`}\n modalRootId='grouping-mapping-widget'\n isOpen={show}\n closeOnEsc={false}\n closeOnExternalClick={false}\n isDismissible={!importing}\n styleType='fullPage'\n onClose={async () => {\n await onClose();\n }}\n >\n <div className='gmw-import-wizard-body-container'>\n <Stepper\n currentStep={currentStep}\n steps={steps.current}\n onStepClick={\n importing ? undefined : (index: number) => setCurrentStep(index)\n }\n />\n\n {(() => {\n switch (currentStep) {\n case 0:\n return (\n <ITwinsClientContext.Provider value={iTwinsClient}>\n <div className=\"gmw-table-container\">\n <SelectITwin\n onSelect={(iTwinId) => {\n setSelectedITwinId(iTwinId);\n setCurrentStep(1);\n }}\n onCancel={onClose}\n onChangeITwinType={setITwinType}\n displayStrings={displayStrings}\n defaultITwinType={iTwinType}\n />\n </div>\n </ITwinsClientContext.Provider>\n );\n case 1:\n return (\n <IModelsClientContext.Provider value={iModelsClient}>\n <div className=\"gmw-table-container\">\n <SelectIModel\n iTwinId={selectedITwinId}\n onSelect={(iModelId) => {\n setSelectedIModelId(iModelId);\n setCurrentStep(2);\n }}\n backFn={() => setCurrentStep(currentStep - 1)}\n onCancel={onClose}\n />\n </div>\n </IModelsClientContext.Provider>\n );\n case 2:\n case 3:\n // Preserve table state within Select Mappings\n return (\n <>\n <div\n style={{ display: currentStep === 2 ? \"flex\" : \"none\" }}\n className=\"gmw-mapping-container\"\n >\n <SelectMappings\n iModelId={selectedIModelId}\n onSelect={(selectedMappings) => {\n setSelectedMappings(selectedMappings);\n setCurrentStep(3);\n }}\n onCancel={onClose}\n backFn={() => setCurrentStep(currentStep - 1)}\n displayStrings={displayStrings}\n />\n </div>\n {currentStep === 3 && (\n <ConfirmMappingImport\n sourceiModelId={selectedIModelId}\n selectedMappings={selectedMappings}\n importing={importing}\n setImporting={setImporting}\n setSelectedMappings={setSelectedMappings}\n backFn={() => setCurrentStep(currentStep - 1)}\n onCancel={onClose}\n onFinish={async () => {\n await onClose();\n setImporting(false);\n }}\n displayStrings={displayStrings}\n />\n )}\n </>\n );\n default:\n return null;\n }\n })()}\n </div>\n </Modal>\n );\n};\n"]}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import '~@itwin/itwinui-css/scss/variables';
|
|
6
5
|
|
|
7
6
|
.gmw-import-wizard-body-container {
|
|
8
7
|
display: flex;
|
|
9
8
|
flex-direction: column;
|
|
10
|
-
gap:
|
|
11
|
-
margin-top:
|
|
9
|
+
gap: calc(var(--iui-size-s) * 2);
|
|
10
|
+
margin-top: calc(var(--iui-size-s) * 2);
|
|
12
11
|
flex-grow: 1;
|
|
13
12
|
min-height: 0;
|
|
14
13
|
|
|
@@ -27,6 +26,6 @@
|
|
|
27
26
|
.gmw-import-action-panel {
|
|
28
27
|
display: flex;
|
|
29
28
|
justify-content: center;
|
|
30
|
-
padding:
|
|
31
|
-
gap:
|
|
29
|
+
padding: calc(var(--iui-size-s) * 2) var(--iui-size-m) var(--iui-size-s);
|
|
30
|
+
gap: var(--iui-size-xs);
|
|
32
31
|
}
|
|
@@ -45,7 +45,7 @@ const usePropertySelection = (property, currentPropertyList, queryBuilder) => {
|
|
|
45
45
|
const addProperty = react_1.useCallback(async (prop) => {
|
|
46
46
|
if (prop.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive &&
|
|
47
47
|
!currentPropertyList.includes(prop) &&
|
|
48
|
-
(await
|
|
48
|
+
(await queryBuilder?.addProperty(prop))) {
|
|
49
49
|
setIsCheckboxLoading(false);
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
@@ -53,7 +53,7 @@ const usePropertySelection = (property, currentPropertyList, queryBuilder) => {
|
|
|
53
53
|
}, [currentPropertyList, queryBuilder]);
|
|
54
54
|
const removeProperty = react_1.useCallback(async (prop) => {
|
|
55
55
|
if (currentPropertyList.includes(prop)) {
|
|
56
|
-
await
|
|
56
|
+
await queryBuilder?.removeProperty(prop);
|
|
57
57
|
setIsCheckboxLoading(false);
|
|
58
58
|
}
|
|
59
59
|
}, [currentPropertyList, queryBuilder]);
|
|
@@ -72,16 +72,15 @@ const PropertyAction = ({ property }) => {
|
|
|
72
72
|
setIsCheckboxLoading(isPropertySelected && isUpdating);
|
|
73
73
|
}, [isPropertySelected, isUpdating, setIsCheckboxLoading]);
|
|
74
74
|
const onPropertySelectionChanged = react_1.useCallback(async () => {
|
|
75
|
-
var _a, _b;
|
|
76
75
|
if (isPropertySelected) {
|
|
77
76
|
await removeProperty(property);
|
|
78
77
|
setCurrentPropertyList((prevList) => prevList.filter((x) => x !== property));
|
|
79
|
-
setQuery(
|
|
78
|
+
setQuery(queryBuilder?.buildQueryString() ?? "");
|
|
80
79
|
}
|
|
81
80
|
else {
|
|
82
81
|
if (await addProperty(property)) {
|
|
83
82
|
setCurrentPropertyList((prevList) => prevList.concat(property));
|
|
84
|
-
setQuery(
|
|
83
|
+
setQuery(queryBuilder?.buildQueryString() ?? "");
|
|
85
84
|
}
|
|
86
85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AAG,mBAAW,CAAC,KAAK,IAAI,EAAE;QACxD,IAAI,kBAAkB,EAAE;YACtB,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC/B,sBAAsB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAClC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CACvC,CAAC;YACF,QAAQ,CAAC,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;SAClD;aAAM;YACL,IAAI,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE;gBAC/B,sBAAsB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAChE,QAAQ,CAAC,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;aAClD;SACF;IACH,CAAC,EAAE;QACD,WAAW;QACX,kBAAkB;QAClB,QAAQ;QACR,cAAc;QACd,YAAY;QACZ,sBAAsB;QACtB,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO,CACL,uCAAK,SAAS,EAAC,iCAAiC,IAC7C,QAAQ,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;QAC3D,QAAQ,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,CACtC,8BAAC,wBAAQ,IACP,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,0BAA0B,EACpC,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,iBAAiB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,cAAc,kBAyDzB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { usePropertyGridWrapper } from \"./context/PropertyGridWrapperContext\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport \"./PropertyAction.scss\";\nimport type { QueryBuilder } from \"./QueryBuilder\";\n\nexport interface PropertyActionProps {\n property: PropertyRecord;\n}\n\nconst usePropertySelection = (\n property: PropertyRecord,\n currentPropertyList: PropertyRecord[],\n queryBuilder: QueryBuilder | undefined\n) => {\n const [isCheckboxLoading, setIsCheckboxLoading] = useState(false);\n\n const checkIfPropertyIsSelected = useCallback(\n (property: PropertyRecord): boolean => {\n if (property.value.valueFormat === PropertyValueFormat.Primitive) {\n return currentPropertyList.includes(property);\n }\n\n if (property.value.valueFormat === PropertyValueFormat.Array) {\n return (\n property.value.items.length === 0 &&\n currentPropertyList.includes(property)\n );\n }\n return Object.values(property.value.members).every(\n (subProp: PropertyRecord) => checkIfPropertyIsSelected(subProp)\n );\n },\n [currentPropertyList]\n );\n\n const isPropertySelected = checkIfPropertyIsSelected(property);\n\n const addProperty = useCallback(\n async (prop: PropertyRecord) => {\n if (\n prop.value.valueFormat === PropertyValueFormat.Primitive &&\n !currentPropertyList.includes(prop) &&\n (await queryBuilder?.addProperty(prop))\n ) {\n setIsCheckboxLoading(false);\n return true;\n }\n return false;\n },\n [currentPropertyList, queryBuilder]\n );\n\n const removeProperty = useCallback(\n async (prop: PropertyRecord) => {\n if (currentPropertyList.includes(prop)) {\n await queryBuilder?.removeProperty(prop);\n setIsCheckboxLoading(false);\n }\n },\n [currentPropertyList, queryBuilder]\n );\n\n return {\n isPropertySelected,\n addProperty,\n removeProperty,\n isCheckboxLoading,\n setIsCheckboxLoading,\n };\n};\n\nexport const PropertyAction = ({ property }: PropertyActionProps) => {\n const {\n currentPropertyList,\n queryBuilder,\n setCurrentPropertyList,\n setQuery,\n isUpdating,\n } = usePropertyGridWrapper();\n\n const {\n isPropertySelected,\n addProperty,\n removeProperty,\n isCheckboxLoading,\n setIsCheckboxLoading,\n } = usePropertySelection(property, currentPropertyList, queryBuilder);\n\n useEffect(() => {\n setIsCheckboxLoading(isPropertySelected && isUpdating);\n }, [isPropertySelected, isUpdating, setIsCheckboxLoading]);\n\n const onPropertySelectionChanged = useCallback(async () => {\n if (isPropertySelected) {\n await removeProperty(property);\n setCurrentPropertyList((prevList) =>\n prevList.filter((x) => x !== property)\n );\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n } else {\n if (await addProperty(property)) {\n setCurrentPropertyList((prevList) => prevList.concat(property));\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n }\n }\n }, [\n addProperty,\n isPropertySelected,\n property,\n removeProperty,\n queryBuilder,\n setCurrentPropertyList,\n setQuery,\n ]);\n\n return (\n <div className=\"gmw-property-selection-checkbox\">\n {property.value.valueFormat === PropertyValueFormat.Primitive &&\n property.value.value !== undefined && (\n <Checkbox\n checked={isPropertySelected}\n onChange={onPropertySelectionChanged}\n disabled={isUpdating}\n isLoading={isCheckboxLoading}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -52,9 +52,9 @@ const PropertyMenu = ({ mapping, group, onClickAddGroupProperty, onClickModifyGr
|
|
|
52
52
|
}, [getAccessToken, mappingClient, iModelId, mappingId, groupId]);
|
|
53
53
|
const { isLoading: isLoadingCustomCalculations, refreshData: refreshCustomCalculations } = useFetchData_1.useCombinedFetchRefresh(fetchCustomCalculations, setCustomCalculationProperties);
|
|
54
54
|
return (react_1.default.createElement("div", { className: 'gmw-property-menu-wrapper' },
|
|
55
|
-
!hideGroupProps && (react_1.default.createElement(GroupPropertyTable_1.GroupPropertyTable, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddGroupProperty, onClickModify: onClickModifyGroupProperty, isLoading: isLoadingGroupProperties, groupProperties: groupProperties
|
|
56
|
-
!hideCalculatedProps && (react_1.default.createElement(CalculatedPropertyTable_1.CalculatedPropertyTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCalculatedProperty, onClickModify: onClickModifyCalculatedProperty, isLoading: isLoadingCalculatedProperties, calculatedProperties: calculatedProperties
|
|
57
|
-
!hideCustomCalculationProps && (react_1.default.createElement(CustomCalculationTable_1.CustomCalculationTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCustomCalculationProperty, onClickModify: onClickModifyCustomCalculation, isLoading: isLoadingCustomCalculations, customCalculations: customCalculationProperties
|
|
55
|
+
!hideGroupProps && (react_1.default.createElement(GroupPropertyTable_1.GroupPropertyTable, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddGroupProperty, onClickModify: onClickModifyGroupProperty, isLoading: isLoadingGroupProperties, groupProperties: groupProperties ?? [], refresh: refreshGroupProperties })),
|
|
56
|
+
!hideCalculatedProps && (react_1.default.createElement(CalculatedPropertyTable_1.CalculatedPropertyTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCalculatedProperty, onClickModify: onClickModifyCalculatedProperty, isLoading: isLoadingCalculatedProperties, calculatedProperties: calculatedProperties ?? [], refresh: refreshCalculatedProperties })),
|
|
57
|
+
!hideCustomCalculationProps && (react_1.default.createElement(CustomCalculationTable_1.CustomCalculationTable, { mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddCustomCalculationProperty, onClickModify: onClickModifyCustomCalculation, isLoading: isLoadingCustomCalculations, customCalculations: customCalculationProperties ?? [], refresh: refreshCustomCalculations }))));
|
|
58
58
|
};
|
|
59
59
|
exports.PropertyMenu = PropertyMenu;
|
|
60
60
|
//# sourceMappingURL=PropertyMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyMenu.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+CAAuC;AACvC,+BAA6B;AAC7B,6DAA0D;AAC1D,wDAAgE;AAChE,yEAAkE;AAClE,iFAAiF;AAEj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A2B,EACtC,kBAAkB,EAAE,2BAA2B,IAAI,EAAE,EACrD,OAAO,EAAE,yBAAyB,GAClC,CACH,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AA3FW,QAAA,YAAY,gBA2FvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useMemo } from \"react\";\nimport \"./PropertyMenu.scss\";\nimport { GroupPropertyTable } from \"./GroupPropertyTable\";\nimport { useCombinedFetchRefresh } from \"../hooks/useFetchData\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CalculatedProperty, CustomCalculation, Group, GroupProperty, Mapping } from \"@itwin/insights-client\";\nimport { usePropertiesContext } from \"./context/PropertiesContext\";\nimport { CalculatedPropertyTable } from \"./CalculatedPropertyTable\";\nimport { CustomCalculationTable } from \"./CustomCalculationTable\";\n\nexport interface PropertyMenuProps {\n mapping: Mapping;\n group: Group;\n onClickAddGroupProperty?: () => void;\n onClickModifyGroupProperty?: (groupProperty: GroupProperty) => void;\n onClickAddCalculatedProperty?: () => void;\n onClickModifyCalculatedProperty?: (calculatedProperty: CalculatedProperty) => void;\n onClickAddCustomCalculationProperty?: () => void;\n onClickModifyCustomCalculation?: (customCalculation: CustomCalculation) => void;\n hideGroupProps?: boolean;\n hideCalculatedProps?: boolean;\n hideCustomCalculationProps?: boolean;\n}\n\nexport const PropertyMenu = ({\n mapping,\n group,\n onClickAddGroupProperty,\n onClickModifyGroupProperty,\n onClickAddCalculatedProperty,\n onClickModifyCalculatedProperty,\n onClickAddCustomCalculationProperty,\n onClickModifyCustomCalculation,\n hideGroupProps = false,\n hideCalculatedProps = false,\n hideCustomCalculationProps = false,\n}: PropertyMenuProps) => {\n const groupId = group.id;\n const mappingId = mapping.id;\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const {\n groupProperties,\n setGroupProperties,\n calculatedProperties,\n setCalculatedProperties,\n customCalculationProperties,\n setCustomCalculationProperties,\n } = usePropertiesContext();\n\n const fetchGroupProperties = useMemo(\n () => {\n return async () => mappingClient.getGroupProperties(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingGroupProperties, refreshData: refreshGroupProperties } =\n useCombinedFetchRefresh<GroupProperty>(fetchGroupProperties, setGroupProperties);\n\n const fetchCalculatedProperties = useMemo(\n () => {\n return async () => mappingClient.getCalculatedProperties(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCalculatedProperties, refreshData: refreshCalculatedProperties } =\n useCombinedFetchRefresh<CalculatedProperty>(fetchCalculatedProperties, setCalculatedProperties);\n\n const fetchCustomCalculations = useMemo(\n () => {\n return async () => mappingClient.getCustomCalculations(await getAccessToken(), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCustomCalculations, refreshData: refreshCustomCalculations } =\n useCombinedFetchRefresh<CustomCalculation>(fetchCustomCalculations, setCustomCalculationProperties);\n\n return (\n <div className='gmw-property-menu-wrapper'>\n {!hideGroupProps && (\n <GroupPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddGroupProperty}\n onClickModify={onClickModifyGroupProperty}\n isLoading={isLoadingGroupProperties}\n groupProperties={groupProperties ?? []}\n refresh={refreshGroupProperties}\n />\n )}\n {!hideCalculatedProps && (\n <CalculatedPropertyTable\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddCalculatedProperty}\n onClickModify={onClickModifyCalculatedProperty}\n isLoading={isLoadingCalculatedProperties}\n calculatedProperties={calculatedProperties ?? []}\n refresh={refreshCalculatedProperties}\n />\n )}\n {!hideCustomCalculationProps && (\n <CustomCalculationTable\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddCustomCalculationProperty}\n onClickModify={onClickModifyCustomCalculation}\n isLoading={isLoadingCustomCalculations}\n customCalculations={customCalculationProperties ?? []}\n refresh={refreshCustomCalculations}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
5
|
|
|
7
6
|
.gmw-property-menu-wrapper {
|
|
8
7
|
display: flex;
|
|
9
8
|
flex-direction: column;
|
|
10
9
|
flex-grow: 1;
|
|
11
|
-
gap:
|
|
10
|
+
gap: calc(var(--iui-size-s) * 2);
|
|
12
11
|
overflow: auto;
|
|
13
12
|
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
5
|
|
|
7
6
|
.gmw-property-menu-vis-wrapper {
|
|
8
7
|
display: flex;
|
|
9
8
|
flex-direction: column;
|
|
10
|
-
gap:
|
|
9
|
+
gap: var(--iui-size-s);
|
|
11
10
|
flex-grow: 1;
|
|
12
11
|
.gmw-property-menu-vis-toolbar {
|
|
13
12
|
display: flex;
|
|
@@ -7,7 +7,7 @@ export interface PropertyTableItem {
|
|
|
7
7
|
}
|
|
8
8
|
export interface PropertyTableProps<T extends PropertyTableItem> {
|
|
9
9
|
propertyType: string;
|
|
10
|
-
columnsFactory: (handleShowDeleteModal: (value: T) => void) =>
|
|
10
|
+
columnsFactory: (handleShowDeleteModal: (value: T) => void) => Array<Column<T>>;
|
|
11
11
|
data: T[];
|
|
12
12
|
isLoading: boolean;
|
|
13
13
|
onClickAdd?: () => void;
|
|
@@ -35,9 +35,8 @@ require("./PropertyTable.scss");
|
|
|
35
35
|
const PropertyTable = ({ propertyType, columnsFactory, data, isLoading, onClickAdd, refreshProperties, deleteProperty, }) => {
|
|
36
36
|
const [showDeleteModal, setShowDeleteModal] = react_1.useState(undefined);
|
|
37
37
|
const handleDeleteProperty = react_1.useCallback(async () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}, [deleteProperty, showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.id]);
|
|
38
|
+
await deleteProperty(showDeleteModal?.id ?? "");
|
|
39
|
+
}, [deleteProperty, showDeleteModal?.id]);
|
|
41
40
|
const handleShowDeleteModal = react_1.useCallback((property) => {
|
|
42
41
|
setShowDeleteModal(property);
|
|
43
42
|
}, []);
|
|
@@ -48,7 +47,7 @@ const PropertyTable = ({ propertyType, columnsFactory, data, isLoading, onClickA
|
|
|
48
47
|
return (react_1.default.createElement("div", { className: "gmw-property-table-container" },
|
|
49
48
|
react_1.default.createElement(PropertyTableToolbar_1.PropertyTableToolbar, { propertyType: propertyType, onClickAddProperty: onClickAdd, refreshProperties: refreshProperties, isLoading: isLoading }),
|
|
50
49
|
react_1.default.createElement(itwinui_react_1.Table, { data: isLoading ? [] : data, density: 'extra-condensed', columns: memoizedColumns, emptyTableContent: `No ${propertyType} Properties`, isSortable: true, isLoading: isLoading }),
|
|
51
|
-
react_1.default.createElement(DeleteModal_1.default, { entityName: showDeleteModal
|
|
50
|
+
react_1.default.createElement(DeleteModal_1.default, { entityName: showDeleteModal?.propertyName, onClose: handleCloseDeleteModal, onDelete: handleDeleteProperty, refresh: refreshProperties })));
|
|
52
51
|
};
|
|
53
52
|
exports.PropertyTable = PropertyTable;
|
|
54
53
|
//# sourceMappingURL=PropertyTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyTable.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAA6C;AAC7C,+CAA8D;AAG9D,gEAAwC;AACxC,iEAA8D;AAC9D,gCAA8B;AAiBvB,MAAM,aAAa,GAAG,CAA8B,EACzD,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,GACQ,EAAE,EAAE;IAE1B,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,gBAAQ,CAAgB,SAAS,CAAC,CAAC;IAEjF,MAAM,oBAAoB,GAAG,mBAAW,CAAC,KAAK,IAAI,EAAE
|
|
1
|
+
{"version":3,"file":"PropertyTable.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAA6C;AAC7C,+CAA8D;AAG9D,gEAAwC;AACxC,iEAA8D;AAC9D,gCAA8B;AAiBvB,MAAM,aAAa,GAAG,CAA8B,EACzD,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,GACQ,EAAE,EAAE;IAE1B,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,gBAAQ,CAAgB,SAAS,CAAC,CAAC;IAEjF,MAAM,oBAAoB,GAAG,mBAAW,CAAC,KAAK,IAAI,EAAE;QAClD,MAAM,cAAc,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;IAE1C,MAAM,qBAAqB,GAAG,mBAAW,CAAC,CAAC,QAAW,EAAE,EAAE;QACxD,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,sBAAsB,GAAG,GAAG,EAAE;QAClC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,eAAO,CAAC,GAAG,EAAE,CACnC,cAAc,CAAC,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAElF,OAAO,CACL,uCAAK,SAAS,EAAC,8BAA8B;QAC3C,8BAAC,2CAAoB,IACnB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,UAAU,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,SAAS,GACpB;QACF,8BAAC,qBAAK,IACJ,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAC3B,OAAO,EAAC,iBAAiB,EACzB,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,YAAY,aAAa,EAClD,UAAU,QACV,SAAS,EAAE,SAAS,GACpB;QACF,8BAAC,qBAAW,IACV,UAAU,EAAE,eAAe,EAAE,YAAY,EACzC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,iBAAiB,GAC1B,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAnDW,QAAA,aAAa,iBAmDxB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Table } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport type { Column } from \"react-table\";\nimport type { CreateTypeFromInterface } from \"../utils\";\nimport DeleteModal from \"./DeleteModal\";\nimport { PropertyTableToolbar } from \"./PropertyTableToolbar\";\nimport \"./PropertyTable.scss\";\n\nexport interface PropertyTableItem {\n propertyName: string;\n id: string;\n}\n\nexport interface PropertyTableProps<T extends PropertyTableItem> {\n propertyType: string;\n columnsFactory: (handleShowDeleteModal: (value: T) => void) => Array<Column<T>>;\n data: T[];\n isLoading: boolean;\n onClickAdd?: () => void;\n refreshProperties: () => Promise<void>;\n deleteProperty: (propertyId: string) => Promise<void>;\n}\n\nexport const PropertyTable = <T extends PropertyTableItem>({\n propertyType,\n columnsFactory,\n data,\n isLoading,\n onClickAdd,\n refreshProperties,\n deleteProperty,\n}: PropertyTableProps<T>) => {\n\n const [showDeleteModal, setShowDeleteModal] = useState<T | undefined>(undefined);\n\n const handleDeleteProperty = useCallback(async () => {\n await deleteProperty(showDeleteModal?.id ?? \"\");\n }, [deleteProperty, showDeleteModal?.id]);\n\n const handleShowDeleteModal = useCallback((property: T) => {\n setShowDeleteModal(property);\n }, []);\n\n const handleCloseDeleteModal = () => {\n setShowDeleteModal(undefined);\n };\n\n const memoizedColumns = useMemo(() =>\n columnsFactory(handleShowDeleteModal), [columnsFactory, handleShowDeleteModal]);\n\n return (\n <div className=\"gmw-property-table-container\">\n <PropertyTableToolbar\n propertyType={propertyType}\n onClickAddProperty={onClickAdd}\n refreshProperties={refreshProperties}\n isLoading={isLoading}\n />\n <Table<CreateTypeFromInterface<T>>\n data={isLoading ? [] : data}\n density='extra-condensed'\n columns={memoizedColumns}\n emptyTableContent={`No ${propertyType} Properties`}\n isSortable\n isLoading={isLoading}\n />\n <DeleteModal\n entityName={showDeleteModal?.propertyName}\n onClose={handleCloseDeleteModal}\n onDelete={handleDeleteProperty}\n refresh={refreshProperties}\n />\n </div>\n );\n};\n"]}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
5
|
|
|
7
6
|
.gmw-property-table-container {
|
|
8
7
|
display: flex;
|
|
9
8
|
flex-direction: column;
|
|
10
|
-
gap:
|
|
9
|
+
gap: var(--iui-size-s);
|
|
11
10
|
}
|
|
@@ -17,11 +17,10 @@ class QueryBuilder {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
this.relationalJoinSegments = (classes, querySegments) => {
|
|
20
|
-
var _a;
|
|
21
20
|
for (const queryClass of classes) {
|
|
22
21
|
for (const classJoin of queryClass.classJoins) {
|
|
23
22
|
const querySegment = [
|
|
24
|
-
...
|
|
23
|
+
...querySegments.get(classJoin.joinClassName) ?? [],
|
|
25
24
|
`${queryClass.className}.${classJoin.classProperty} = ${classJoin.joinClassName}.${classJoin.joinClassProperty}`,
|
|
26
25
|
];
|
|
27
26
|
querySegments.set(classJoin.joinClassName, querySegment);
|
|
@@ -40,14 +39,12 @@ class QueryBuilder {
|
|
|
40
39
|
this.dataProvider = provider;
|
|
41
40
|
}
|
|
42
41
|
isCategory(propertyField) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return (classInfo === null || classInfo === void 0 ? void 0 : classInfo.name) === "BisCore:GeometricElement3dIsInCategory";
|
|
42
|
+
const classInfo = propertyField.properties[0].property.navigationPropertyInfo?.classInfo;
|
|
43
|
+
return classInfo?.name === "BisCore:GeometricElement3dIsInCategory";
|
|
46
44
|
}
|
|
47
45
|
async addProperty(prop) {
|
|
48
|
-
var _a;
|
|
49
46
|
// TODO: only handle primitive properties now
|
|
50
|
-
if (
|
|
47
|
+
if (prop.value?.valueFormat !== appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
51
48
|
itwinui_react_1.toaster.warning("Only primitive types are supported for now.");
|
|
52
49
|
return false;
|
|
53
50
|
}
|
|
@@ -67,8 +64,7 @@ class QueryBuilder {
|
|
|
67
64
|
this._propertyMap.delete(JSON.stringify(propertyField.getFieldDescriptor()));
|
|
68
65
|
}
|
|
69
66
|
buildProperty(prop, propertiesField) {
|
|
70
|
-
|
|
71
|
-
if (((_a = prop.value) === null || _a === void 0 ? void 0 : _a.valueFormat) !== appui_abstract_1.PropertyValueFormat.Primitive || prop.value.value === undefined) {
|
|
67
|
+
if (prop.value?.valueFormat !== appui_abstract_1.PropertyValueFormat.Primitive || prop.value.value === undefined) {
|
|
72
68
|
itwinui_react_1.toaster.negative("Error. An unexpected error has occured while building a query.");
|
|
73
69
|
return;
|
|
74
70
|
}
|
|
@@ -81,16 +77,13 @@ class QueryBuilder {
|
|
|
81
77
|
String(prop.value.value).indexOf("'") >= 0) {
|
|
82
78
|
prop.value.value = replaceAll(prop.value.value.toString(), "'", "''");
|
|
83
79
|
}
|
|
84
|
-
const pathToPrimaryClass =
|
|
80
|
+
const pathToPrimaryClass = propertiesField.parent?.pathToPrimaryClass;
|
|
85
81
|
// get the special cases
|
|
86
82
|
const isNavigation = prop.property.typename.toLowerCase() === "navigation";
|
|
87
83
|
const isCategory = isNavigation && this.isCategory(propertiesField);
|
|
88
|
-
const isAspect =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS ||
|
|
92
|
-
((_b = a.relationshipInfo) === null || _b === void 0 ? void 0 : _b.name) === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS;
|
|
93
|
-
})) !== undefined;
|
|
84
|
+
const isAspect = pathToPrimaryClass?.find((a) => a.relationshipInfo?.name ===
|
|
85
|
+
QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS ||
|
|
86
|
+
a.relationshipInfo?.name === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS) !== undefined;
|
|
94
87
|
for (let i = 0; i < propertiesField.properties.length; i++) {
|
|
95
88
|
const property = propertiesField.properties[i].property;
|
|
96
89
|
const className = property.classInfo.name.replace(":", ".");
|
|
@@ -101,7 +94,7 @@ class QueryBuilder {
|
|
|
101
94
|
: property.name;
|
|
102
95
|
const propertyValue = isNavigation
|
|
103
96
|
? isCategory
|
|
104
|
-
?
|
|
97
|
+
? prop.value.displayValue ?? ""
|
|
105
98
|
: prop.value.value.id
|
|
106
99
|
: prop.value.value;
|
|
107
100
|
if (!isAspect &&
|
|
@@ -121,13 +114,11 @@ class QueryBuilder {
|
|
|
121
114
|
return "string" === typeName || "uri" === typeName;
|
|
122
115
|
}
|
|
123
116
|
addRelatedToQuery(unionIndex, propertyField, propertyName, propertyValue) {
|
|
124
|
-
|
|
125
|
-
const paths = [...((_b = (_a = propertyField.parent) === null || _a === void 0 ? void 0 : _a.pathToPrimaryClass) !== null && _b !== void 0 ? _b : [])];
|
|
117
|
+
const paths = [...(propertyField.parent?.pathToPrimaryClass ?? [])];
|
|
126
118
|
paths.reverse().forEach((path) => {
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
const relClassName = (_c = path.relationshipInfo) === null || _c === void 0 ? void 0 : _c.name.replace(":", ".");
|
|
119
|
+
const sourceClassName = path.sourceClassInfo?.name.replace(":", ".");
|
|
120
|
+
const targetClassName = path.targetClassInfo?.name.replace(":", ".");
|
|
121
|
+
const relClassName = path.relationshipInfo?.name.replace(":", ".");
|
|
131
122
|
const relClassProperty = path.isForwardRelationship
|
|
132
123
|
? `SourceECInstanceId`
|
|
133
124
|
: `TargetECInstanceId`;
|
|
@@ -136,8 +127,8 @@ class QueryBuilder {
|
|
|
136
127
|
: `SourceECInstanceId`;
|
|
137
128
|
this.addClassToQuery(unionIndex, targetClassName, `ECInstanceId`, relClassName, relPropertyValue);
|
|
138
129
|
this.addClassToQuery(unionIndex, relClassName, relClassProperty, sourceClassName, `ECInstanceId`);
|
|
139
|
-
if (
|
|
140
|
-
===
|
|
130
|
+
if (path.sourceClassInfo?.name
|
|
131
|
+
=== propertyField.parent?.contentClassInfo.name) {
|
|
141
132
|
this.addPropertyToQuery(unionIndex, sourceClassName, propertyName, propertyValue, this.needsQuote(propertyField), false, false);
|
|
142
133
|
}
|
|
143
134
|
});
|
|
@@ -195,7 +186,7 @@ class QueryBuilder {
|
|
|
195
186
|
}
|
|
196
187
|
const foundPropertyClass = this.query.unions[unionIndex].properties.find((p) => p.className === className);
|
|
197
188
|
if (foundPropertyClass) {
|
|
198
|
-
const foundJoin = foundPropertyClass
|
|
189
|
+
const foundJoin = foundPropertyClass?.classProperties.find((join) => join.name === propertyName);
|
|
199
190
|
if (foundJoin) {
|
|
200
191
|
foundJoin.value = propertyValue;
|
|
201
192
|
return;
|
|
@@ -206,7 +197,6 @@ class QueryBuilder {
|
|
|
206
197
|
this.query.unions[unionIndex].properties.push(queryProperty);
|
|
207
198
|
}
|
|
208
199
|
buildQueryString() {
|
|
209
|
-
var _a;
|
|
210
200
|
this.regenerateQuery();
|
|
211
201
|
if (this.query === undefined ||
|
|
212
202
|
(this.query.unions.find((u) => u.classes.length === 0 && u.properties.length === 0))) {
|
|
@@ -216,7 +206,7 @@ class QueryBuilder {
|
|
|
216
206
|
for (const union of this.query.unions) {
|
|
217
207
|
const baseClass = union.classes[0];
|
|
218
208
|
const baseProperty = union.properties[0];
|
|
219
|
-
const baseClassName = baseClass ? baseClass.className : baseProperty
|
|
209
|
+
const baseClassName = baseClass ? baseClass.className : baseProperty?.className;
|
|
220
210
|
const baseIdName = `${baseClassName}.ECInstanceId`;
|
|
221
211
|
const selectClause = this.selectClause(baseProperty, baseClass);
|
|
222
212
|
let querySegments = new Map();
|
|
@@ -241,7 +231,7 @@ class QueryBuilder {
|
|
|
241
231
|
}
|
|
242
232
|
const joinClauses = [];
|
|
243
233
|
for (const key of querySegments.keys()) {
|
|
244
|
-
joinClauses.push(`JOIN ${key} ON ${
|
|
234
|
+
joinClauses.push(`JOIN ${key} ON ${querySegments.get(key)?.join(" AND ")}`);
|
|
245
235
|
}
|
|
246
236
|
const whereClause = `WHERE ${whereSegments.join(" AND ")}`;
|
|
247
237
|
unionSegments.push([selectClause, ...joinClauses, whereClause].join(" "));
|