@finos/legend-extension-dsl-data-quality 2.1.34 → 2.1.35
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/components/DSL_DataQuality_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js +45 -13
- package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/components/DataQualityCustomSelector.d.ts +16 -1
- package/lib/components/DataQualityCustomSelector.d.ts.map +1 -1
- package/lib/components/DataQualityCustomSelector.js +29 -4
- package/lib/components/DataQualityCustomSelector.js.map +1 -1
- package/lib/components/DataQualityRelationComparisonEditor.d.ts +19 -0
- package/lib/components/DataQualityRelationComparisonEditor.d.ts.map +1 -0
- package/lib/components/DataQualityRelationComparisonEditor.js +239 -0
- package/lib/components/DataQualityRelationComparisonEditor.js.map +1 -0
- package/lib/components/DataQualityRelationGridResult.d.ts +3 -0
- package/lib/components/DataQualityRelationGridResult.d.ts.map +1 -1
- package/lib/components/DataQualityRelationGridResult.js +1 -1
- package/lib/components/DataQualityRelationGridResult.js.map +1 -1
- package/lib/components/DataQualityRelationLambdaGUIDataTypeHandlers.d.ts +0 -10
- package/lib/components/DataQualityRelationLambdaGUIDataTypeHandlers.d.ts.map +1 -1
- package/lib/components/DataQualityRelationLambdaGUIDataTypeHandlers.js +11 -24
- package/lib/components/DataQualityRelationLambdaGUIDataTypeHandlers.js.map +1 -1
- package/lib/components/DataQualityRelationLambdaGUIValidationEditor.d.ts.map +1 -1
- package/lib/components/DataQualityRelationLambdaGUIValidationEditor.js +6 -4
- package/lib/components/DataQualityRelationLambdaGUIValidationEditor.js.map +1 -1
- package/lib/components/states/DataQualityRelationComparisonConfigurationState.d.ts +111 -0
- package/lib/components/states/DataQualityRelationComparisonConfigurationState.d.ts.map +1 -0
- package/lib/components/states/DataQualityRelationComparisonConfigurationState.js +495 -0
- package/lib/components/states/DataQualityRelationComparisonConfigurationState.js.map +1 -0
- package/lib/data-quality-custom-selector.css +2 -2
- package/lib/data-quality-custom-selector.css.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts +3 -1
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js +2 -0
- package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.d.ts.map +1 -1
- package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js +2 -1
- package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts +35 -0
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js +37 -0
- package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts +2 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js +2 -1
- package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts +7 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js +18 -0
- package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.d.ts.map +1 -1
- package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js +5 -2
- package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js.map +1 -1
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts +3 -1
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts.map +1 -1
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js +28 -1
- package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts +4 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.js.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js +33 -5
- package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts +26 -2
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js +107 -3
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.d.ts +19 -0
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.js +37 -0
- package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts +2 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js +26 -3
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts +3 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js +29 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts +4 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js +37 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +7 -7
- package/src/components/DSL_DataQuality_LegendStudioApplicationPlugin.tsx +64 -12
- package/src/components/DataQualityCustomSelector.tsx +111 -6
- package/src/components/DataQualityRelationComparisonEditor.tsx +795 -0
- package/src/components/DataQualityRelationGridResult.tsx +1 -1
- package/src/components/DataQualityRelationLambdaGUIDataTypeHandlers.tsx +9 -87
- package/src/components/DataQualityRelationLambdaGUIValidationEditor.tsx +16 -6
- package/src/components/states/DataQualityRelationComparisonConfigurationState.ts +747 -0
- package/src/graph/metamodel/DSL_DataQuality_HashUtils.ts +2 -0
- package/src/graph/metamodel/DSL_DataQuality_PureGraphPlugin.ts +2 -0
- package/src/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.ts +66 -0
- package/src/graph-manager/DSL_DataQuality_GraphManagerHelper.ts +13 -0
- package/src/graph-manager/DSL_DataQuality_GraphModifierHelper.ts +57 -0
- package/src/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.ts +8 -0
- package/src/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.ts +42 -0
- package/src/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.ts +16 -0
- package/src/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.ts +65 -0
- package/src/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.ts +171 -1
- package/src/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.ts +49 -0
- package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.ts +39 -0
- package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.ts +50 -0
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.ts +71 -0
- package/style/_data-quality-relation-comparison-editor.scss +361 -0
- package/style/data-quality-custom-selector.scss +23 -0
- package/style/index.scss +74 -0
- package/tsconfig.json +2 -0
|
@@ -38,8 +38,11 @@ import {
|
|
|
38
38
|
DataQualityServiceValidationConfiguration,
|
|
39
39
|
DataQualityRelationValidationConfiguration,
|
|
40
40
|
DataQualityValidationConfiguration,
|
|
41
|
+
DataQualityRelationComparisonConfiguration,
|
|
42
|
+
DataQualityRelationQueryLambda,
|
|
43
|
+
MD5HashStrategy,
|
|
41
44
|
} from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
|
|
42
|
-
import { EyeIcon } from '@finos/legend-art';
|
|
45
|
+
import { CompareIcon, EyeIcon } from '@finos/legend-art';
|
|
43
46
|
import { DataQualityClassValidationEditor } from './DataQualityClassValidationEditor.js';
|
|
44
47
|
import { DataQuality_ElementDriver } from './DSL_DataQuality_ElementDriver.js';
|
|
45
48
|
import { DataQualityServiceValidationEditor } from './DataQualityServiceValidationEditor.js';
|
|
@@ -49,9 +52,16 @@ import { DataQualityServiceValidationState } from './states/DataQualityServiceVa
|
|
|
49
52
|
import { DataQualityRelationValidationConfigurationState } from './states/DataQualityRelationValidationConfigurationState.js';
|
|
50
53
|
import { DataQualityRelationValidationConfigurationEditor } from './DataQualityRelationValidationConfigurationEditor.js';
|
|
51
54
|
import { DSL_DATA_QUALITY_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../__lib__/studio/DSL_DataQuality_LegendStudioApplicationNavigationContext.js';
|
|
55
|
+
import { DataQualityRelationComparisonConfigurationState } from './states/DataQualityRelationComparisonConfigurationState.js';
|
|
56
|
+
import { DataQualityRelationComparisonEditor } from './DataQualityRelationComparisonEditor.js';
|
|
52
57
|
|
|
53
|
-
const
|
|
54
|
-
const
|
|
58
|
+
const DATA_QUALITY_VALIDATION_ELEMENT_TYPE = 'DATAQUALITYVALIDATION';
|
|
59
|
+
const DATA_QUALITY_VALIDATION_ELEMENT_TYPE_LABEL = 'Data Quality Validation';
|
|
60
|
+
|
|
61
|
+
const DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE =
|
|
62
|
+
'DATAQUALITYRELATIONCOMPARISON';
|
|
63
|
+
const DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE_LABEL =
|
|
64
|
+
'Data Quality Relation Comparison';
|
|
55
65
|
|
|
56
66
|
export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
57
67
|
extends LegendStudioApplicationPlugin
|
|
@@ -62,13 +72,17 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
getExtraSupportedElementTypes(): string[] {
|
|
65
|
-
return [
|
|
75
|
+
return [
|
|
76
|
+
DATA_QUALITY_VALIDATION_ELEMENT_TYPE,
|
|
77
|
+
DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE,
|
|
78
|
+
];
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
getExtraSupportedElementTypesWithCategory(): Map<string, string[]> {
|
|
69
82
|
const elementTypeswithCategory = new Map<string, string[]>();
|
|
70
83
|
elementTypeswithCategory.set(PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.OTHER, [
|
|
71
|
-
|
|
84
|
+
DATA_QUALITY_VALIDATION_ELEMENT_TYPE,
|
|
85
|
+
DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE,
|
|
72
86
|
]);
|
|
73
87
|
return elementTypeswithCategory;
|
|
74
88
|
}
|
|
@@ -77,7 +91,10 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
77
91
|
return [
|
|
78
92
|
(element: PackageableElement): string | undefined => {
|
|
79
93
|
if (element instanceof DataQualityValidationConfiguration) {
|
|
80
|
-
return
|
|
94
|
+
return DATA_QUALITY_VALIDATION_ELEMENT_TYPE;
|
|
95
|
+
}
|
|
96
|
+
if (element instanceof DataQualityRelationComparisonConfiguration) {
|
|
97
|
+
return DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE;
|
|
81
98
|
}
|
|
82
99
|
return undefined;
|
|
83
100
|
},
|
|
@@ -87,12 +104,18 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
87
104
|
getExtraElementIconGetters(): ElementIconGetter[] {
|
|
88
105
|
return [
|
|
89
106
|
(type: string): React.ReactNode | undefined => {
|
|
90
|
-
if (type ===
|
|
107
|
+
if (type === DATA_QUALITY_VALIDATION_ELEMENT_TYPE) {
|
|
91
108
|
return (
|
|
92
109
|
<div className="icon icon--dataQuality">
|
|
93
110
|
<EyeIcon />
|
|
94
111
|
</div>
|
|
95
112
|
);
|
|
113
|
+
} else if (type === DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE) {
|
|
114
|
+
return (
|
|
115
|
+
<div className="icon icon--dataQuality">
|
|
116
|
+
<CompareIcon />
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
96
119
|
}
|
|
97
120
|
return undefined;
|
|
98
121
|
},
|
|
@@ -102,8 +125,11 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
102
125
|
getExtraElementTypeLabelGetters(): ElementTypeLabelGetter[] {
|
|
103
126
|
return [
|
|
104
127
|
(type: string): string | undefined => {
|
|
105
|
-
if (type ===
|
|
106
|
-
return
|
|
128
|
+
if (type === DATA_QUALITY_VALIDATION_ELEMENT_TYPE) {
|
|
129
|
+
return DATA_QUALITY_VALIDATION_ELEMENT_TYPE_LABEL;
|
|
130
|
+
}
|
|
131
|
+
if (type === DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE) {
|
|
132
|
+
return DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE_LABEL;
|
|
107
133
|
}
|
|
108
134
|
return undefined;
|
|
109
135
|
},
|
|
@@ -117,11 +143,21 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
117
143
|
name: string,
|
|
118
144
|
state: NewElementState,
|
|
119
145
|
): PackageableElement | undefined => {
|
|
120
|
-
if (type ===
|
|
146
|
+
if (type === DATA_QUALITY_VALIDATION_ELEMENT_TYPE) {
|
|
121
147
|
return state
|
|
122
148
|
.getNewElementDriver(DataQuality_ElementDriver)
|
|
123
149
|
.createElement(name);
|
|
124
150
|
}
|
|
151
|
+
if (type === DATA_QUALITY_RELATION_COMPARISON_ELEMENT_TYPE) {
|
|
152
|
+
const comparison = new DataQualityRelationComparisonConfiguration(
|
|
153
|
+
name,
|
|
154
|
+
);
|
|
155
|
+
comparison.source = new DataQualityRelationQueryLambda();
|
|
156
|
+
comparison.target = new DataQualityRelationQueryLambda();
|
|
157
|
+
// default currently
|
|
158
|
+
comparison.strategy = new MD5HashStrategy();
|
|
159
|
+
return comparison;
|
|
160
|
+
}
|
|
125
161
|
return undefined;
|
|
126
162
|
},
|
|
127
163
|
];
|
|
@@ -150,6 +186,16 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
150
186
|
/>
|
|
151
187
|
);
|
|
152
188
|
}
|
|
189
|
+
if (
|
|
190
|
+
elementEditorState instanceof
|
|
191
|
+
DataQualityRelationComparisonConfigurationState
|
|
192
|
+
) {
|
|
193
|
+
return (
|
|
194
|
+
<DataQualityRelationComparisonEditor
|
|
195
|
+
key={elementEditorState.uuid}
|
|
196
|
+
/>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
153
199
|
return undefined;
|
|
154
200
|
},
|
|
155
201
|
];
|
|
@@ -173,6 +219,12 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
173
219
|
element,
|
|
174
220
|
);
|
|
175
221
|
}
|
|
222
|
+
if (element instanceof DataQualityRelationComparisonConfiguration) {
|
|
223
|
+
return new DataQualityRelationComparisonConfigurationState(
|
|
224
|
+
editorStore,
|
|
225
|
+
element,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
176
228
|
return undefined;
|
|
177
229
|
},
|
|
178
230
|
];
|
|
@@ -181,7 +233,7 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
181
233
|
getExtraNewElementDriverEditorRenderers(): NewElementDriverEditorRenderer[] {
|
|
182
234
|
return [
|
|
183
235
|
(type: string): React.ReactNode | undefined => {
|
|
184
|
-
if (type ===
|
|
236
|
+
if (type === DATA_QUALITY_VALIDATION_ELEMENT_TYPE) {
|
|
185
237
|
return <NewDataQualityValidationElementEditor />;
|
|
186
238
|
}
|
|
187
239
|
return undefined;
|
|
@@ -195,7 +247,7 @@ export class DSL_DataQuality_LegendStudioApplicationPlugin
|
|
|
195
247
|
editorStore: EditorStore,
|
|
196
248
|
type: string,
|
|
197
249
|
): NewElementDriver<PackageableElement> | undefined => {
|
|
198
|
-
if (type ===
|
|
250
|
+
if (type === DATA_QUALITY_VALIDATION_ELEMENT_TYPE) {
|
|
199
251
|
return new DataQuality_ElementDriver(editorStore);
|
|
200
252
|
}
|
|
201
253
|
return undefined;
|
|
@@ -15,24 +15,29 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
|
+
BaseMenuItem,
|
|
18
19
|
CaretDownIcon,
|
|
20
|
+
Checkbox,
|
|
19
21
|
ControlledDropdownMenu,
|
|
22
|
+
CustomSelectorInput,
|
|
20
23
|
MenuContent,
|
|
21
24
|
MenuContentItem,
|
|
25
|
+
TimesIcon,
|
|
22
26
|
} from '@finos/legend-art';
|
|
23
|
-
import type { ReactNode } from 'react';
|
|
27
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
24
28
|
|
|
25
29
|
export type Option<T = string> = { value: T; label: string };
|
|
26
30
|
|
|
27
31
|
export interface DataQualityCustomSelectorProps<T> {
|
|
28
32
|
value?: T | undefined;
|
|
29
33
|
options: T[];
|
|
30
|
-
onChange: (value: T) => void;
|
|
34
|
+
onChange: (value: T | undefined) => void;
|
|
31
35
|
disabled?: boolean;
|
|
32
36
|
placeholder?: string;
|
|
33
37
|
className?: string;
|
|
34
38
|
title?: string;
|
|
35
39
|
renderLabel?: (option: T) => ReactNode;
|
|
40
|
+
clearable?: boolean;
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
export const DataQualityCustomSelector = <
|
|
@@ -48,9 +53,14 @@ export const DataQualityCustomSelector = <
|
|
|
48
53
|
placeholder = 'Choose option...',
|
|
49
54
|
className,
|
|
50
55
|
title = 'Choose option...',
|
|
56
|
+
renderLabel,
|
|
57
|
+
clearable = false,
|
|
51
58
|
} = props;
|
|
52
59
|
|
|
53
60
|
const selectedOption = options.find((opt) => opt.value === value?.value);
|
|
61
|
+
const selectedLabel = selectedOption
|
|
62
|
+
? (renderLabel?.(selectedOption) ?? selectedOption.label)
|
|
63
|
+
: placeholder;
|
|
54
64
|
|
|
55
65
|
return (
|
|
56
66
|
<ControlledDropdownMenu
|
|
@@ -65,7 +75,7 @@ export const DataQualityCustomSelector = <
|
|
|
65
75
|
className="data-quality-custom-selector__dropdown__option"
|
|
66
76
|
onClick={() => onChange(opt)}
|
|
67
77
|
>
|
|
68
|
-
{opt.label}
|
|
78
|
+
{renderLabel?.(opt) ?? opt.label}
|
|
69
79
|
</MenuContentItem>
|
|
70
80
|
))}
|
|
71
81
|
</MenuContent>
|
|
@@ -76,12 +86,107 @@ export const DataQualityCustomSelector = <
|
|
|
76
86
|
elevation: 7,
|
|
77
87
|
}}
|
|
78
88
|
>
|
|
79
|
-
<div className="data-quality-custom-selector__label">
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
<div className="data-quality-custom-selector__label">{selectedLabel}</div>
|
|
90
|
+
{clearable && selectedOption && (
|
|
91
|
+
<button
|
|
92
|
+
className="data-quality-custom-selector__clear"
|
|
93
|
+
onClick={(e: MouseEvent) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
onChange(undefined);
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<TimesIcon />
|
|
99
|
+
</button>
|
|
100
|
+
)}
|
|
82
101
|
<div className="data-quality-custom-selector__dropdown__trigger">
|
|
83
102
|
<CaretDownIcon />
|
|
84
103
|
</div>
|
|
85
104
|
</ControlledDropdownMenu>
|
|
86
105
|
);
|
|
87
106
|
};
|
|
107
|
+
|
|
108
|
+
export interface DataQualityMultiCustomSelectorProps<T> {
|
|
109
|
+
value?: T[] | undefined;
|
|
110
|
+
options: T[];
|
|
111
|
+
onChange: (value: T[]) => void;
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
placeholder?: string;
|
|
114
|
+
className?: string;
|
|
115
|
+
darkMode: boolean;
|
|
116
|
+
renderLabel?: (option: T) => ReactNode;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const DataQualityMultiCustomSelector = <
|
|
120
|
+
T extends { value: string; label: string },
|
|
121
|
+
>(
|
|
122
|
+
props: DataQualityMultiCustomSelectorProps<T>,
|
|
123
|
+
): React.ReactElement => {
|
|
124
|
+
const {
|
|
125
|
+
value = [],
|
|
126
|
+
onChange,
|
|
127
|
+
options = [],
|
|
128
|
+
placeholder = 'Select options',
|
|
129
|
+
darkMode,
|
|
130
|
+
disabled,
|
|
131
|
+
renderLabel,
|
|
132
|
+
} = props;
|
|
133
|
+
|
|
134
|
+
const CustomOption = ({
|
|
135
|
+
children,
|
|
136
|
+
...optionProps
|
|
137
|
+
}: {
|
|
138
|
+
children: ReactNode;
|
|
139
|
+
data: T;
|
|
140
|
+
isSelected: boolean;
|
|
141
|
+
isFocused: boolean;
|
|
142
|
+
selectOption: (option: T) => void;
|
|
143
|
+
}) => {
|
|
144
|
+
const { data, isSelected, selectOption } = optionProps;
|
|
145
|
+
|
|
146
|
+
const handleClick = (event: MouseEvent) => {
|
|
147
|
+
event.preventDefault();
|
|
148
|
+
selectOption(data);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<BaseMenuItem
|
|
153
|
+
onClick={handleClick}
|
|
154
|
+
className="data-quality-validation-gui-editor__column-list-item"
|
|
155
|
+
dense={true}
|
|
156
|
+
>
|
|
157
|
+
<Checkbox size="small" checked={isSelected} onClick={handleClick} />
|
|
158
|
+
<div>{children}</div>
|
|
159
|
+
</BaseMenuItem>
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<CustomSelectorInput<T, true>
|
|
165
|
+
value={value}
|
|
166
|
+
placeholder={placeholder}
|
|
167
|
+
isMulti={true}
|
|
168
|
+
options={options}
|
|
169
|
+
hideSelectedOptions={false}
|
|
170
|
+
closeMenuOnSelect={false}
|
|
171
|
+
formatOptionLabel={(option: T) => renderLabel?.(option) ?? option.label}
|
|
172
|
+
components={{
|
|
173
|
+
Option: CustomOption,
|
|
174
|
+
MultiValueContainer: ({ children }: { children: ReactNode }) => {
|
|
175
|
+
return (
|
|
176
|
+
<div className="data-quality-validation-gui-editor__column-list-item">
|
|
177
|
+
{children}
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
MultiValueLabel: ({ data }: { data: T }) =>
|
|
182
|
+
renderLabel?.(data) ?? data.label,
|
|
183
|
+
MultiValueRemove: () => null,
|
|
184
|
+
}}
|
|
185
|
+
onChange={(newValue: readonly T[] | null) =>
|
|
186
|
+
onChange(newValue ? [...newValue] : [])
|
|
187
|
+
}
|
|
188
|
+
darkMode={darkMode}
|
|
189
|
+
disabled={disabled}
|
|
190
|
+
/>
|
|
191
|
+
);
|
|
192
|
+
};
|