@finos/legend-query-builder 4.16.20 → 4.16.21
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/__test-utils__/QueryBuilderComponentTestUtils.d.ts +21 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +16 -2
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts +155 -4
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js +239 -158
- package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
- package/lib/components/shared/CustomDatePicker.d.ts +8 -55
- package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
- package/lib/components/shared/CustomDatePicker.js +31 -415
- package/lib/components/shared/CustomDatePicker.js.map +1 -1
- package/lib/components/shared/CustomDatePickerHelper.d.ts +145 -0
- package/lib/components/shared/CustomDatePickerHelper.d.ts.map +1 -0
- package/lib/components/shared/CustomDatePickerHelper.js +517 -0
- package/lib/components/shared/CustomDatePickerHelper.js.map +1 -0
- package/lib/components/shared/QueryBuilderVariableSelector.js +1 -1
- package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
- package/lib/components/shared/V1_BasicValueSpecificationEditor.d.ts +36 -0
- package/lib/components/shared/V1_BasicValueSpecificationEditor.d.ts.map +1 -0
- package/lib/components/shared/V1_BasicValueSpecificationEditor.js +166 -0
- package/lib/components/shared/V1_BasicValueSpecificationEditor.js.map +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/shared/V1_ValueSpecificationEditorHelper.d.ts +23 -0
- package/lib/stores/shared/V1_ValueSpecificationEditorHelper.d.ts.map +1 -0
- package/lib/stores/shared/V1_ValueSpecificationEditorHelper.js +69 -0
- package/lib/stores/shared/V1_ValueSpecificationEditorHelper.js.map +1 -0
- package/lib/stores/shared/V1_ValueSpecificationModifierHelper.d.ts +20 -0
- package/lib/stores/shared/V1_ValueSpecificationModifierHelper.d.ts.map +1 -0
- package/lib/stores/shared/V1_ValueSpecificationModifierHelper.js +38 -0
- package/lib/stores/shared/V1_ValueSpecificationModifierHelper.js.map +1 -0
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +4 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.js +23 -2
- package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
- package/package.json +5 -5
- package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +101 -12
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +1 -1
- package/src/components/filter/QueryBuilderFilterPanel.tsx +1 -1
- package/src/components/shared/BasicValueSpecificationEditor.tsx +1417 -1085
- package/src/components/shared/CustomDatePicker.tsx +136 -902
- package/src/components/shared/CustomDatePickerHelper.ts +984 -0
- package/src/components/shared/QueryBuilderVariableSelector.tsx +1 -1
- package/src/components/shared/V1_BasicValueSpecificationEditor.tsx +396 -0
- package/src/index.ts +5 -0
- package/src/stores/shared/V1_ValueSpecificationEditorHelper.ts +113 -0
- package/src/stores/shared/V1_ValueSpecificationModifierHelper.ts +76 -0
- package/src/stores/shared/ValueSpecificationEditorHelper.ts +71 -2
- package/tsconfig.json +4 -0
@@ -64,13 +64,13 @@ import {
|
|
64
64
|
QUERY_BUILDER_PURE_PATH,
|
65
65
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS,
|
66
66
|
} from '../../graph/QueryBuilderMetaModelConst.js';
|
67
|
-
import { buildDatePickerOption } from '../../components/shared/CustomDatePicker.js';
|
68
67
|
import type {
|
69
68
|
ApplicationStore,
|
70
69
|
LegendApplicationConfig,
|
71
70
|
LegendApplicationPlugin,
|
72
71
|
LegendApplicationPluginManager,
|
73
72
|
} from '@finos/legend-application';
|
73
|
+
import { buildDatePickerOption } from '../../components/shared/CustomDatePickerHelper.js';
|
74
74
|
|
75
75
|
export const createSupportedFunctionExpression = (
|
76
76
|
supportedFuncName: string,
|
@@ -98,6 +98,71 @@ export const buildPrimitiveInstanceValue = (
|
|
98
98
|
return instance;
|
99
99
|
};
|
100
100
|
|
101
|
+
export const buildEnumInstanceValue = (
|
102
|
+
graph: PureModel,
|
103
|
+
enumPath: string,
|
104
|
+
value: string,
|
105
|
+
observerContext: ObserverContext,
|
106
|
+
): EnumValueInstanceValue => {
|
107
|
+
const enumType = graph.getEnumeration(enumPath);
|
108
|
+
const enumValue = guaranteeNonNullable(
|
109
|
+
enumType.values.find((v) => v.name === value),
|
110
|
+
`Can't find enum value '${value}' in enumeration '${enumType.path}'`,
|
111
|
+
);
|
112
|
+
const instance = new EnumValueInstanceValue(
|
113
|
+
GenericTypeExplicitReference.create(new GenericType(enumType)),
|
114
|
+
);
|
115
|
+
instanceValue_setValues(
|
116
|
+
instance,
|
117
|
+
[EnumValueExplicitReference.create(enumValue)],
|
118
|
+
observerContext,
|
119
|
+
);
|
120
|
+
return instance;
|
121
|
+
};
|
122
|
+
|
123
|
+
export const buildPrimitiveCollectionInstanceValue = (
|
124
|
+
graph: PureModel,
|
125
|
+
type: PRIMITIVE_TYPE,
|
126
|
+
values: unknown[],
|
127
|
+
observerContext: ObserverContext,
|
128
|
+
): CollectionInstanceValue => {
|
129
|
+
const instance = new CollectionInstanceValue(
|
130
|
+
Multiplicity.ZERO_MANY,
|
131
|
+
GenericTypeExplicitReference.create(
|
132
|
+
new GenericType(graph.getPrimitiveType(type)),
|
133
|
+
),
|
134
|
+
);
|
135
|
+
instanceValue_setValues(
|
136
|
+
instance,
|
137
|
+
values.map((value) =>
|
138
|
+
buildPrimitiveInstanceValue(graph, type, value, observerContext),
|
139
|
+
),
|
140
|
+
observerContext,
|
141
|
+
);
|
142
|
+
return instance;
|
143
|
+
};
|
144
|
+
|
145
|
+
export const buildEnumCollectionInstanceValue = (
|
146
|
+
graph: PureModel,
|
147
|
+
enumPath: string,
|
148
|
+
values: string[],
|
149
|
+
observerContext: ObserverContext,
|
150
|
+
): CollectionInstanceValue => {
|
151
|
+
const enumType = graph.getEnumeration(enumPath);
|
152
|
+
const instance = new CollectionInstanceValue(
|
153
|
+
Multiplicity.ZERO_MANY,
|
154
|
+
GenericTypeExplicitReference.create(new GenericType(enumType)),
|
155
|
+
);
|
156
|
+
instanceValue_setValues(
|
157
|
+
instance,
|
158
|
+
values.map((value) =>
|
159
|
+
buildEnumInstanceValue(graph, enumPath, value, observerContext),
|
160
|
+
),
|
161
|
+
observerContext,
|
162
|
+
);
|
163
|
+
return instance;
|
164
|
+
};
|
165
|
+
|
101
166
|
export const cloneValueSpecification = (
|
102
167
|
valueSpecification: ValueSpecification,
|
103
168
|
observerContext: ObserverContext,
|
@@ -431,10 +496,14 @@ export const convertTextToPrimitiveInstanceValue = (
|
|
431
496
|
if (isNaN(Number(value))) {
|
432
497
|
return null;
|
433
498
|
}
|
499
|
+
const formattedNumber =
|
500
|
+
expectedType.path === PRIMITIVE_TYPE.INTEGER
|
501
|
+
? Number.parseInt(Number(value).toString(), 10)
|
502
|
+
: Number(value);
|
434
503
|
result = new PrimitiveInstanceValue(
|
435
504
|
GenericTypeExplicitReference.create(new GenericType(expectedType)),
|
436
505
|
);
|
437
|
-
instanceValue_setValues(result, [
|
506
|
+
instanceValue_setValues(result, [formattedNumber], observerContext);
|
438
507
|
break;
|
439
508
|
}
|
440
509
|
case PRIMITIVE_TYPE.DATE:
|
package/tsconfig.json
CHANGED
@@ -62,6 +62,7 @@
|
|
62
62
|
"./src/components/QueryBuilderComponentElement.ts",
|
63
63
|
"./src/components/QueryBuilder_LegendApplicationPlugin.ts",
|
64
64
|
"./src/components/QuerySetupUtils.ts",
|
65
|
+
"./src/components/shared/CustomDatePickerHelper.ts",
|
65
66
|
"./src/components/shared/QueryBuilderFilterHelper.ts",
|
66
67
|
"./src/graph/QueryBuilderMetaModelConst.ts",
|
67
68
|
"./src/graph-manager/QueryBuilderConfig.ts",
|
@@ -206,6 +207,8 @@
|
|
206
207
|
"./src/stores/query-workflow/QueryBuilderWorkFlowState.ts",
|
207
208
|
"./src/stores/shared/LambdaEditorState.ts",
|
208
209
|
"./src/stores/shared/LambdaParameterState.ts",
|
210
|
+
"./src/stores/shared/V1_ValueSpecificationEditorHelper.ts",
|
211
|
+
"./src/stores/shared/V1_ValueSpecificationModifierHelper.ts",
|
209
212
|
"./src/stores/shared/ValueSpecificationEditorHelper.ts",
|
210
213
|
"./src/stores/shared/ValueSpecificationModifierHelper.ts",
|
211
214
|
"./src/stores/watermark/QueryBuilderWatermarkState.ts",
|
@@ -274,6 +277,7 @@
|
|
274
277
|
"./src/components/shared/QueryBuilderPropertyInfoTooltip.tsx",
|
275
278
|
"./src/components/shared/QueryBuilderRootClassInfoTooltip.tsx",
|
276
279
|
"./src/components/shared/QueryBuilderVariableSelector.tsx",
|
280
|
+
"./src/components/shared/V1_BasicValueSpecificationEditor.tsx",
|
277
281
|
"./src/components/workflows/ClassQueryBuilder.tsx",
|
278
282
|
"./src/components/workflows/MappingQueryBuilder.tsx",
|
279
283
|
"./src/components/workflows/ServiceQueryBuilder.tsx"
|