@finos/legend-query-builder 4.16.20 → 4.16.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts +23 -1
  2. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  3. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +16 -2
  4. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
  5. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +1 -1
  6. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  7. package/lib/components/filter/QueryBuilderFilterPanel.js +1 -1
  8. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  9. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +162 -4
  10. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  11. package/lib/components/shared/BasicValueSpecificationEditor.js +253 -172
  12. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  13. package/lib/components/shared/CustomDatePicker.d.ts +8 -55
  14. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  15. package/lib/components/shared/CustomDatePicker.js +33 -417
  16. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  17. package/lib/components/shared/CustomDatePickerHelper.d.ts +145 -0
  18. package/lib/components/shared/CustomDatePickerHelper.d.ts.map +1 -0
  19. package/lib/components/shared/CustomDatePickerHelper.js +517 -0
  20. package/lib/components/shared/CustomDatePickerHelper.js.map +1 -0
  21. package/lib/components/shared/QueryBuilderVariableSelector.js +1 -1
  22. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
  23. package/lib/components/shared/V1_BasicValueSpecificationEditor.d.ts +38 -0
  24. package/lib/components/shared/V1_BasicValueSpecificationEditor.d.ts.map +1 -0
  25. package/lib/components/shared/V1_BasicValueSpecificationEditor.js +166 -0
  26. package/lib/components/shared/V1_BasicValueSpecificationEditor.js.map +1 -0
  27. package/lib/index.css +2 -2
  28. package/lib/index.css.map +1 -1
  29. package/lib/index.d.ts +4 -0
  30. package/lib/index.d.ts.map +1 -1
  31. package/lib/index.js +4 -0
  32. package/lib/index.js.map +1 -1
  33. package/lib/package.json +1 -1
  34. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.d.ts +23 -0
  35. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.d.ts.map +1 -0
  36. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.js +83 -0
  37. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.js.map +1 -0
  38. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.d.ts +20 -0
  39. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.d.ts.map +1 -0
  40. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.js +38 -0
  41. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.js.map +1 -0
  42. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +4 -1
  43. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  44. package/lib/stores/shared/ValueSpecificationEditorHelper.js +23 -2
  45. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  46. package/package.json +10 -10
  47. package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +103 -12
  48. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +1 -1
  49. package/src/components/filter/QueryBuilderFilterPanel.tsx +1 -1
  50. package/src/components/shared/BasicValueSpecificationEditor.tsx +1477 -1088
  51. package/src/components/shared/CustomDatePicker.tsx +146 -905
  52. package/src/components/shared/CustomDatePickerHelper.ts +984 -0
  53. package/src/components/shared/QueryBuilderVariableSelector.tsx +1 -1
  54. package/src/components/shared/V1_BasicValueSpecificationEditor.tsx +409 -0
  55. package/src/index.ts +7 -0
  56. package/src/stores/shared/V1_ValueSpecificationEditorHelper.ts +131 -0
  57. package/src/stores/shared/V1_ValueSpecificationModifierHelper.ts +76 -0
  58. package/src/stores/shared/ValueSpecificationEditorHelper.ts +71 -2
  59. package/tsconfig.json +4 -0
@@ -15,394 +15,19 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
15
15
  * limitations under the License.
16
16
  */
17
17
  import { BasePopover, BaseRadioGroup, CustomSelectorInput, clsx, } from '@finos/legend-art';
18
- import { PRIMITIVE_TYPE, SimpleFunctionExpression, InstanceValue, GenericType, PrimitiveInstanceValue, GenericTypeExplicitReference, EnumValueExplicitReference, EnumValueInstanceValue, matchFunctionName, PrimitiveType, } from '@finos/legend-graph';
19
- import { assertErrorThrown, guaranteeNonNullable, parseNumber, returnUndefOnError, UnsupportedOperationError, } from '@finos/legend-shared';
18
+ import { PRIMITIVE_TYPE } from '@finos/legend-graph';
19
+ import { guaranteeNonNullable, parseNumber, returnUndefOnError, } from '@finos/legend-shared';
20
20
  import { useEffect, useRef, useState } from 'react';
21
- import { buildPrimitiveInstanceValue, createSupportedFunctionExpression, } from '../../stores/shared/ValueSpecificationEditorHelper.js';
22
- import { functionExpression_addParameterValue, instanceValue_setValue, instanceValue_setValues, valueSpecification_setGenericType, } from '../../stores/shared/ValueSpecificationModifierHelper.js';
23
- import { QUERY_BUILDER_PURE_PATH, QUERY_BUILDER_SUPPORTED_FUNCTIONS, } from '../../graph/QueryBuilderMetaModelConst.js';
24
- import { useApplicationStore, } from '@finos/legend-application';
25
- export var CUSTOM_DATE_PICKER_OPTION;
26
- (function (CUSTOM_DATE_PICKER_OPTION) {
27
- CUSTOM_DATE_PICKER_OPTION["ABSOLUTE_DATE"] = "Absolute Date";
28
- CUSTOM_DATE_PICKER_OPTION["ABSOLUTE_TIME"] = "Absolute Time";
29
- CUSTOM_DATE_PICKER_OPTION["TODAY"] = "Today";
30
- CUSTOM_DATE_PICKER_OPTION["NOW"] = "Now";
31
- CUSTOM_DATE_PICKER_OPTION["YESTERDAY"] = "Yesterday";
32
- CUSTOM_DATE_PICKER_OPTION["ONE_YEAR_AGO"] = "One Year Ago";
33
- CUSTOM_DATE_PICKER_OPTION["ONE_MONTH_AGO"] = "One Month Ago";
34
- CUSTOM_DATE_PICKER_OPTION["ONE_WEEK_AGO"] = "One Week Ago";
35
- CUSTOM_DATE_PICKER_OPTION["CUSTOM_DATE"] = "Custom Date";
36
- CUSTOM_DATE_PICKER_OPTION["PREVIOUS_DAY_OF_WEEK"] = "Previous ... of Week";
37
- CUSTOM_DATE_PICKER_OPTION["FIRST_DAY_OF"] = "First day of...";
38
- CUSTOM_DATE_PICKER_OPTION["LATEST_DATE"] = "Latest Date";
39
- })(CUSTOM_DATE_PICKER_OPTION || (CUSTOM_DATE_PICKER_OPTION = {}));
40
- var CUSTOM_DATE_OPTION_UNIT;
41
- (function (CUSTOM_DATE_OPTION_UNIT) {
42
- CUSTOM_DATE_OPTION_UNIT["DAYS"] = "Day(s)";
43
- CUSTOM_DATE_OPTION_UNIT["WEEKS"] = "Week(s)";
44
- CUSTOM_DATE_OPTION_UNIT["MONTHS"] = "Month(s)";
45
- CUSTOM_DATE_OPTION_UNIT["YEARS"] = "Year(s)";
46
- })(CUSTOM_DATE_OPTION_UNIT || (CUSTOM_DATE_OPTION_UNIT = {}));
47
- var CUSTOM_DATE_FIRST_DAY_OF_UNIT;
48
- (function (CUSTOM_DATE_FIRST_DAY_OF_UNIT) {
49
- CUSTOM_DATE_FIRST_DAY_OF_UNIT["WEEK"] = "Week";
50
- CUSTOM_DATE_FIRST_DAY_OF_UNIT["MONTH"] = "Month";
51
- CUSTOM_DATE_FIRST_DAY_OF_UNIT["QUARTER"] = "Quarter";
52
- CUSTOM_DATE_FIRST_DAY_OF_UNIT["YEAR"] = "Year";
53
- })(CUSTOM_DATE_FIRST_DAY_OF_UNIT || (CUSTOM_DATE_FIRST_DAY_OF_UNIT = {}));
54
- var CUSTOM_DATE_DAY_OF_WEEK;
55
- (function (CUSTOM_DATE_DAY_OF_WEEK) {
56
- CUSTOM_DATE_DAY_OF_WEEK["MONDAY"] = "Monday";
57
- CUSTOM_DATE_DAY_OF_WEEK["TUESDAY"] = "Tuesday";
58
- CUSTOM_DATE_DAY_OF_WEEK["WENDNESDAY"] = "Wednesday";
59
- CUSTOM_DATE_DAY_OF_WEEK["THURSDAY"] = "Thursday";
60
- CUSTOM_DATE_DAY_OF_WEEK["FRIDAY"] = "Friday";
61
- CUSTOM_DATE_DAY_OF_WEEK["SATURDAY"] = "Saturday";
62
- CUSTOM_DATE_DAY_OF_WEEK["SUNDAY"] = "Sunday";
63
- })(CUSTOM_DATE_DAY_OF_WEEK || (CUSTOM_DATE_DAY_OF_WEEK = {}));
64
- var CUSTOM_DATE_OPTION_DIRECTION;
65
- (function (CUSTOM_DATE_OPTION_DIRECTION) {
66
- CUSTOM_DATE_OPTION_DIRECTION["BEFORE"] = "Before";
67
- CUSTOM_DATE_OPTION_DIRECTION["AFTER"] = "After";
68
- })(CUSTOM_DATE_OPTION_DIRECTION || (CUSTOM_DATE_OPTION_DIRECTION = {}));
69
- var CUSTOM_DATE_OPTION_REFERENCE_MOMENT;
70
- (function (CUSTOM_DATE_OPTION_REFERENCE_MOMENT) {
71
- CUSTOM_DATE_OPTION_REFERENCE_MOMENT["TODAY"] = "Today";
72
- CUSTOM_DATE_OPTION_REFERENCE_MOMENT["NOW"] = "Now";
73
- CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_THIS_YEAR"] = "Start of Year";
74
- CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_QUARTER"] = "Start of Quarter";
75
- CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_MONTH"] = "Start of Month";
76
- CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_WEEK"] = "Start of Week";
77
- CUSTOM_DATE_OPTION_REFERENCE_MOMENT["PERVIOUS_DAY_OF_WEEK"] = "Previous Day of Week";
78
- })(CUSTOM_DATE_OPTION_REFERENCE_MOMENT || (CUSTOM_DATE_OPTION_REFERENCE_MOMENT = {}));
79
- /**
80
- * DatePickerOption is the base class being used to display and generate the corresponding pure date function.
81
- */
82
- class DatePickerOption {
83
- /**
84
- * label is the text that shows up in the valueSpecification box.
85
- */
86
- label;
87
- /**
88
- * value is the selected date option in date-dropdown.
89
- */
90
- value;
91
- constructor(label, value) {
92
- this.label = label;
93
- this.value = value;
94
- }
95
- }
96
- class CustomDateOption extends DatePickerOption {
97
- /**
98
- * duration is the amount of time span that will be adjusted.
99
- */
100
- duration;
101
- /**
102
- * unit represents the time duration unit, e.g. year, week, etc.
103
- */
104
- unit;
105
- /**
106
- * direction means the direction in which time adjustment will go to.
107
- */
108
- direction;
109
- /**
110
- * referenceMoment is the date which adjustment starts from.
111
- */
112
- referenceMoment;
113
- constructor(label, value, duration, unit, direction, referenceMoment) {
114
- super(label, value);
115
- this.duration = duration;
116
- this.unit = unit;
117
- this.direction = direction;
118
- this.referenceMoment = referenceMoment;
119
- }
120
- generateDisplayLabel() {
121
- return [
122
- this.duration,
123
- this.unit,
124
- this.direction,
125
- this.referenceMoment,
126
- ].join(' ');
127
- }
128
- updateLabel() {
129
- this.label = this.generateDisplayLabel();
130
- }
131
- }
132
- class CustomFirstDayOfOption extends DatePickerOption {
133
- /**
134
- * unit: time unit, e.g. Week, Month, etc.
135
- */
136
- unit;
137
- constructor(label, unit) {
138
- super(label, CUSTOM_DATE_PICKER_OPTION.FIRST_DAY_OF);
139
- this.unit = unit;
140
- }
141
- }
142
- class CustomPreviousDayOfWeekOption extends DatePickerOption {
143
- /**
144
- * day: which day in the week will be selected.
145
- */
146
- day;
147
- constructor(label, day) {
148
- super(label, CUSTOM_DATE_PICKER_OPTION.PREVIOUS_DAY_OF_WEEK);
149
- this.day = day;
150
- }
151
- }
152
- const reservedCustomDateOptions = [
153
- new CustomDateOption('Yesterday', CUSTOM_DATE_PICKER_OPTION.YESTERDAY, 1, CUSTOM_DATE_OPTION_UNIT.DAYS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
154
- new CustomDateOption('One Week Ago', CUSTOM_DATE_PICKER_OPTION.ONE_WEEK_AGO, 1, CUSTOM_DATE_OPTION_UNIT.WEEKS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
155
- new CustomDateOption('One Month Ago', CUSTOM_DATE_PICKER_OPTION.ONE_MONTH_AGO, 1, CUSTOM_DATE_OPTION_UNIT.MONTHS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
156
- new CustomDateOption('One Year Ago', CUSTOM_DATE_PICKER_OPTION.ONE_YEAR_AGO, 1, CUSTOM_DATE_OPTION_UNIT.YEARS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
157
- ];
158
- const getSupportedDateFunctionFullPath = (functionName) => Object.values(QUERY_BUILDER_SUPPORTED_FUNCTIONS).find((_func) => matchFunctionName(functionName, _func));
159
- /**
160
- * Generate pure date functions based on the DatePickerOption.
161
- */
162
- const buildPureDateFunctionExpression = (datePickerOption, graph, observerContext) => {
163
- if (datePickerOption instanceof CustomPreviousDayOfWeekOption) {
164
- const previousFridaySFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.PREVIOUS_DAY_OF_WEEK);
165
- valueSpecification_setGenericType(previousFridaySFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
166
- const dayOfWeekEnumIntanceValue = new EnumValueInstanceValue(GenericTypeExplicitReference.create(new GenericType(graph.getType(QUERY_BUILDER_PURE_PATH.DAY_OF_WEEK))));
167
- instanceValue_setValues(dayOfWeekEnumIntanceValue, [
168
- ...dayOfWeekEnumIntanceValue.values,
169
- EnumValueExplicitReference.create(guaranteeNonNullable(graph
170
- .getEnumeration(QUERY_BUILDER_PURE_PATH.DAY_OF_WEEK)
171
- .values.filter((e) => e.name === datePickerOption.day)[0])),
172
- ], observerContext);
173
- functionExpression_addParameterValue(previousFridaySFE, dayOfWeekEnumIntanceValue, observerContext);
174
- return previousFridaySFE;
175
- }
176
- else if (datePickerOption instanceof CustomFirstDayOfOption) {
177
- switch (datePickerOption.unit) {
178
- case CUSTOM_DATE_FIRST_DAY_OF_UNIT.YEAR: {
179
- const firstDayOfThisYearSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_YEAR);
180
- valueSpecification_setGenericType(firstDayOfThisYearSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
181
- return firstDayOfThisYearSFE;
182
- }
183
- case CUSTOM_DATE_FIRST_DAY_OF_UNIT.QUARTER: {
184
- const firstDayOfQuarterSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER);
185
- valueSpecification_setGenericType(firstDayOfQuarterSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.STRICTDATE)));
186
- return firstDayOfQuarterSFE;
187
- }
188
- case CUSTOM_DATE_FIRST_DAY_OF_UNIT.MONTH: {
189
- const firstDayOfMonthSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_MONTH);
190
- valueSpecification_setGenericType(firstDayOfMonthSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
191
- return firstDayOfMonthSFE;
192
- }
193
- case CUSTOM_DATE_FIRST_DAY_OF_UNIT.WEEK: {
194
- const firstDayOfWeekSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK);
195
- valueSpecification_setGenericType(firstDayOfWeekSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
196
- return firstDayOfWeekSFE;
197
- }
198
- default:
199
- throw new UnsupportedOperationError(`Can't build expression for 'First Day Of ...' date picker option for unit '${datePickerOption.unit}'`);
200
- }
201
- }
202
- else {
203
- switch (datePickerOption.value) {
204
- case CUSTOM_DATE_PICKER_OPTION.TODAY: {
205
- return createSupportedFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.TODAY, PrimitiveType.STRICTDATE);
206
- }
207
- case CUSTOM_DATE_PICKER_OPTION.NOW: {
208
- return createSupportedFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.NOW, PrimitiveType.DATETIME);
209
- }
210
- case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_THIS_YEAR: {
211
- const firstDayOfYearSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_YEAR);
212
- valueSpecification_setGenericType(firstDayOfYearSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
213
- return firstDayOfYearSFE;
214
- }
215
- case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_QUARTER: {
216
- const firstDayOfQuarterSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER);
217
- valueSpecification_setGenericType(firstDayOfQuarterSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.STRICTDATE)));
218
- return firstDayOfQuarterSFE;
219
- }
220
- case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_MONTH: {
221
- const firstDayOfMonthSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_MONTH);
222
- valueSpecification_setGenericType(firstDayOfMonthSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
223
- return firstDayOfMonthSFE;
224
- }
225
- case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_WEEK: {
226
- const firstDayOfWeekSFE = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK);
227
- valueSpecification_setGenericType(firstDayOfWeekSFE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
228
- return firstDayOfWeekSFE;
229
- }
230
- default:
231
- throw new UnsupportedOperationError(`Can't build expression for date picker option '${datePickerOption.value}'`);
232
- }
233
- }
234
- };
235
- /**
236
- * Generate the enum value of type Pure Enum, DURATION_UNIT, based on the input string.
237
- */
238
- const buildPureDurationEnumValue = (unitString, graph) => {
239
- const durationUnitEnum = graph.getEnumeration(QUERY_BUILDER_PURE_PATH.DURATION_UNIT);
240
- const targetPureDurationEnumValue = durationUnitEnum.values.filter((e) => e.name ===
241
- Object.keys(CUSTOM_DATE_OPTION_UNIT).filter((key) => CUSTOM_DATE_OPTION_UNIT[key] === unitString)[0])[0];
242
- return (targetPureDurationEnumValue ??
243
- guaranteeNonNullable(durationUnitEnum.values[0]));
244
- };
245
- /**
246
- * Generate the pure date adjust() function based on the CustomDateOption.
247
- */
248
- const buildPureAdjustDateFunction = (customDateOption, graph, observerContext) => {
249
- const dateAdjustSimpleFunctionExpression = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.ADJUST);
250
- functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, buildPureDateFunctionExpression(new DatePickerOption(guaranteeNonNullable(customDateOption.referenceMoment), guaranteeNonNullable(customDateOption.referenceMoment)), graph, observerContext), observerContext);
251
- if (customDateOption.direction === CUSTOM_DATE_OPTION_DIRECTION.BEFORE) {
252
- const minusFunc = new SimpleFunctionExpression(QUERY_BUILDER_SUPPORTED_FUNCTIONS.MINUS);
253
- functionExpression_addParameterValue(minusFunc, buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.INTEGER, customDateOption.duration, observerContext), observerContext);
254
- functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, minusFunc, observerContext);
255
- }
256
- else {
257
- functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.INTEGER, customDateOption.duration, observerContext), observerContext);
258
- }
259
- const durationUnitEnumIntanceValue = new EnumValueInstanceValue(GenericTypeExplicitReference.create(new GenericType(graph.getType(QUERY_BUILDER_PURE_PATH.DURATION_UNIT))));
260
- instanceValue_setValues(durationUnitEnumIntanceValue, [
261
- ...durationUnitEnumIntanceValue.values,
262
- EnumValueExplicitReference.create(guaranteeNonNullable(buildPureDurationEnumValue(guaranteeNonNullable(customDateOption.unit), graph))),
263
- ], observerContext);
264
- functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, durationUnitEnumIntanceValue, observerContext);
265
- valueSpecification_setGenericType(dateAdjustSimpleFunctionExpression, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)));
266
- return dateAdjustSimpleFunctionExpression;
267
- };
268
- /**
269
- * Generate the value of CustomDateOption.duration from the pure date adjust() function.
270
- */
271
- const buildCustomDateOptionDurationValue = (pureDateAdjustFunction) => {
272
- const durationParam = pureDateAdjustFunction.parametersValues[1];
273
- return durationParam instanceof PrimitiveInstanceValue
274
- ? durationParam.values[0]
275
- : durationParam instanceof SimpleFunctionExpression &&
276
- matchFunctionName(durationParam.functionName, QUERY_BUILDER_SUPPORTED_FUNCTIONS.MINUS)
277
- ? durationParam.parametersValues[0] instanceof PrimitiveInstanceValue
278
- ? durationParam.parametersValues[0].values[0]
279
- : 0
280
- : 0;
281
- };
282
- /**
283
- * Generate the value of CustomDateOption.direction from the pure date adjust() function.
284
- */
285
- const buildCustomDateOptionDirectionValue = (pureDateAdjustFunction) => pureDateAdjustFunction.parametersValues[1] instanceof
286
- SimpleFunctionExpression &&
287
- matchFunctionName(pureDateAdjustFunction.parametersValues[1].functionName, QUERY_BUILDER_SUPPORTED_FUNCTIONS.MINUS)
288
- ? CUSTOM_DATE_OPTION_DIRECTION.BEFORE
289
- : CUSTOM_DATE_OPTION_DIRECTION.AFTER;
290
- /**
291
- * Generate the value of CustomDateOption.unit from the pure date adjust() function.
292
- */
293
- const buildCustomDateOptionUnitValue = (valueSpecification) => guaranteeNonNullable(Object.keys(CUSTOM_DATE_OPTION_UNIT)
294
- .filter((key) => key ===
295
- valueSpecification.parametersValues[2]
296
- .values[0]?.value.name)
297
- .map((key) => CUSTOM_DATE_OPTION_UNIT[key])[0]);
298
- /**
299
- * Generate the value of CustomDateOption.moment from the pure date adjust() function.
300
- */
301
- const buildCustomDateOptionReferenceMomentValue = (pureDateAjustFunction) => {
302
- const funcName = pureDateAjustFunction.parametersValues[0].functionName;
303
- switch (getSupportedDateFunctionFullPath(funcName)) {
304
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.TODAY:
305
- return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY;
306
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.NOW:
307
- return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.NOW;
308
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_YEAR:
309
- return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_THIS_YEAR;
310
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER:
311
- return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_QUARTER;
312
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_MONTH:
313
- return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_MONTH;
314
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK:
315
- return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_WEEK;
316
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.PREVIOUS_DAY_OF_WEEK:
317
- return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.PERVIOUS_DAY_OF_WEEK;
318
- default:
319
- throw new UnsupportedOperationError(`Can't build custom date option reference moment '${funcName}'`);
320
- }
321
- };
322
- /**
323
- * Build CustomDateOption based on the pure date adjust() function.
324
- * Transform CustomDateOption if it matches any preserved custom adjust date functions. e.g. One Month Ago..
325
- */
326
- const buildCustomDateOption = (valueSpecification, applicationStore) => {
327
- if (valueSpecification instanceof SimpleFunctionExpression &&
328
- matchFunctionName(valueSpecification.functionName, QUERY_BUILDER_SUPPORTED_FUNCTIONS.ADJUST)) {
329
- try {
330
- const customDateOption = new CustomDateOption('', CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE, buildCustomDateOptionDurationValue(valueSpecification), buildCustomDateOptionUnitValue(valueSpecification), buildCustomDateOptionDirectionValue(valueSpecification), buildCustomDateOptionReferenceMomentValue(valueSpecification));
331
- const matchedPreservedCustomAdjustDates = reservedCustomDateOptions.filter((t) => t.generateDisplayLabel() ===
332
- customDateOption.generateDisplayLabel());
333
- if (matchedPreservedCustomAdjustDates.length > 0) {
334
- customDateOption.label = guaranteeNonNullable(matchedPreservedCustomAdjustDates[0]?.label);
335
- customDateOption.value = guaranteeNonNullable(matchedPreservedCustomAdjustDates[0]?.value);
336
- return customDateOption;
337
- }
338
- customDateOption.updateLabel();
339
- return customDateOption;
340
- }
341
- catch (error) {
342
- assertErrorThrown(error);
343
- applicationStore.notificationService.notifyError(error);
344
- }
345
- }
346
- return new CustomDateOption('', '', 0, undefined, undefined, undefined);
347
- };
348
- /**
349
- * Build DatePickerOption from pure date functions or PrimitiveInstanceValue
350
- */
351
- export const buildDatePickerOption = (valueSpecification, applicationStore) => {
352
- if (valueSpecification instanceof SimpleFunctionExpression) {
353
- switch (getSupportedDateFunctionFullPath(valueSpecification.functionName)) {
354
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.TODAY:
355
- return new DatePickerOption(CUSTOM_DATE_PICKER_OPTION.TODAY, CUSTOM_DATE_PICKER_OPTION.TODAY);
356
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.NOW:
357
- return new DatePickerOption(CUSTOM_DATE_PICKER_OPTION.NOW, CUSTOM_DATE_PICKER_OPTION.NOW);
358
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_YEAR:
359
- return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_THIS_YEAR, CUSTOM_DATE_FIRST_DAY_OF_UNIT.YEAR);
360
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER:
361
- return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_QUARTER, CUSTOM_DATE_FIRST_DAY_OF_UNIT.QUARTER);
362
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_THIS_MONTH:
363
- return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_MONTH, CUSTOM_DATE_FIRST_DAY_OF_UNIT.MONTH);
364
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK:
365
- return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_WEEK, CUSTOM_DATE_FIRST_DAY_OF_UNIT.WEEK);
366
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.PREVIOUS_DAY_OF_WEEK:
367
- return new CustomPreviousDayOfWeekOption(`Previous ${valueSpecification.parametersValues[0]
368
- .values[0]?.value.name}`, valueSpecification.parametersValues[0]
369
- .values[0]?.value.name);
370
- case QUERY_BUILDER_SUPPORTED_FUNCTIONS.ADJUST:
371
- return buildCustomDateOption(valueSpecification, applicationStore);
372
- default:
373
- return new DatePickerOption('', '');
374
- }
375
- }
376
- else {
377
- return valueSpecification.genericType.value.rawType.path ===
378
- PRIMITIVE_TYPE.LATESTDATE
379
- ? new DatePickerOption(CUSTOM_DATE_PICKER_OPTION.LATEST_DATE, CUSTOM_DATE_PICKER_OPTION.LATEST_DATE)
380
- : new DatePickerOption((valueSpecification.values[0] ?? ''), valueSpecification.values[0] === null
381
- ? ''
382
- : valueSpecification.genericType.value.rawType.path ===
383
- PRIMITIVE_TYPE.DATETIME
384
- ? CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME
385
- : CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_DATE);
386
- }
387
- };
21
+ import { useApplicationStore } from '@finos/legend-application';
22
+ import { buildCustomDateOption, buildDatePickerOption, CUSTOM_DATE_DAY_OF_WEEK, CUSTOM_DATE_FIRST_DAY_OF_UNIT, CUSTOM_DATE_OPTION_DIRECTION, CUSTOM_DATE_OPTION_REFERENCE_MOMENT, CUSTOM_DATE_OPTION_UNIT, CUSTOM_DATE_PICKER_OPTION, CustomDateOption, CustomFirstDayOfOption, CustomPreviousDayOfWeekOption, DatePickerOption, reservedCustomDateOptions, } from './CustomDatePickerHelper.js';
388
23
  const AbsoluteDateValueSpecificationEditor = (props) => {
389
- const { valueSpecification, graph, setValueSpecification, setDatePickerOption, observerContext, } = props;
24
+ const { valueSpecification, valueSelector, updateValueSpecification, setDatePickerOption, } = props;
390
25
  const inputRef = useRef(null);
391
- const absoluteDateValue = valueSpecification instanceof SimpleFunctionExpression
392
- ? ''
393
- : valueSpecification.values[0];
26
+ const absoluteDateValue = valueSelector(valueSpecification);
394
27
  const updateAbsoluteDateValue = (event) => {
395
- if (valueSpecification instanceof SimpleFunctionExpression) {
396
- setValueSpecification(buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.STRICTDATE, event.target.value, observerContext));
397
- }
398
- else if (valueSpecification instanceof InstanceValue) {
399
- instanceValue_setValue(valueSpecification, event.target.value, 0, observerContext);
400
- if (valueSpecification.genericType.value.rawType.path !==
401
- PRIMITIVE_TYPE.STRICTDATE) {
402
- valueSpecification_setGenericType(valueSpecification, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.STRICTDATE)));
403
- }
404
- setValueSpecification(valueSpecification);
405
- }
28
+ updateValueSpecification(valueSpecification, event.target.value, {
29
+ primitiveTypeEnum: PRIMITIVE_TYPE.STRICTDATE,
30
+ });
406
31
  setDatePickerOption(new DatePickerOption(event.target.value, CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_DATE));
407
32
  };
408
33
  useEffect(() => {
@@ -411,27 +36,16 @@ const AbsoluteDateValueSpecificationEditor = (props) => {
411
36
  return (_jsx("div", { className: "value-spec-editor__date-picker__absolute-date", children: _jsx("input", { ref: inputRef, className: "panel__content__form__section__input value-spec-editor__date-picker__absolute-date__input input--dark", type: "date", spellCheck: false, value: absoluteDateValue ?? '', onChange: updateAbsoluteDateValue }) }));
412
37
  };
413
38
  const AbsoluteTimeValueSpecificationEditor = (props) => {
414
- const { valueSpecification, graph, setValueSpecification, setDatePickerOption, observerContext, } = props;
39
+ const { valueSpecification, valueSelector, updateValueSpecification, setDatePickerOption, } = props;
415
40
  const inputRef = useRef(null);
416
- const absoluteTimeValue = valueSpecification instanceof SimpleFunctionExpression
417
- ? ''
418
- : valueSpecification.values[0];
41
+ const absoluteTimeValue = valueSelector(valueSpecification);
419
42
  const updateAbsoluteTimeValue = (event) => {
420
- //
421
43
  const value = new Date(event.target.value).getUTCSeconds()
422
44
  ? event.target.value
423
45
  : `${event.target.value}:00`;
424
- if (valueSpecification instanceof SimpleFunctionExpression) {
425
- setValueSpecification(buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.DATETIME, value, observerContext));
426
- }
427
- else {
428
- instanceValue_setValue(valueSpecification, value, 0, observerContext);
429
- if (valueSpecification.genericType.value.rawType.path !==
430
- PRIMITIVE_TYPE.DATETIME) {
431
- valueSpecification_setGenericType(valueSpecification, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATETIME)));
432
- }
433
- setValueSpecification(valueSpecification);
434
- }
46
+ updateValueSpecification(valueSpecification, value, {
47
+ primitiveTypeEnum: PRIMITIVE_TYPE.DATETIME,
48
+ });
435
49
  setDatePickerOption(new DatePickerOption(event.target.value, CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME));
436
50
  };
437
51
  useEffect(() => {
@@ -446,7 +60,7 @@ const AbsoluteTimeValueSpecificationEditor = (props) => {
446
60
  step: "1", spellCheck: false, value: absoluteTimeValue ?? '', onChange: updateAbsoluteTimeValue }) }));
447
61
  };
448
62
  const CustomDateInstanceValueEditor = (props) => {
449
- const { customDateOptionValue, graph, setValueSpecification, setDatePickerOption, observerContext, } = props;
63
+ const { customDateOptionValue, updateValueSpecification, setDatePickerOption, } = props;
450
64
  const applicationStore = useApplicationStore();
451
65
  const inputRef = useRef(null);
452
66
  const [durationValue, setDurationValue] = useState(customDateOptionValue.duration);
@@ -460,7 +74,7 @@ const CustomDateInstanceValueEditor = (props) => {
460
74
  latestDirectionValue !== '' &&
461
75
  latestReferenceMomentValue !== '') {
462
76
  const dateOption = new CustomDateOption(CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE, CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE, latestDurationValue, latestUnitValue, latestDirectionValue, latestReferenceMomentValue);
463
- setValueSpecification(buildPureAdjustDateFunction(dateOption, graph, observerContext));
77
+ updateValueSpecification(undefined, dateOption);
464
78
  const matchedPreservedCustomAdjustDates = reservedCustomDateOptions.filter((t) => t.generateDisplayLabel() === dateOption.generateDisplayLabel());
465
79
  if (matchedPreservedCustomAdjustDates.length > 0) {
466
80
  dateOption.label = guaranteeNonNullable(matchedPreservedCustomAdjustDates[0]?.label);
@@ -503,7 +117,7 @@ const CustomDateInstanceValueEditor = (props) => {
503
117
  }, value: { value: referenceMomentValue, label: referenceMomentValue }, darkMode: !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled }) })] }));
504
118
  };
505
119
  const CustomFirstDayOfValueSpecificationEditor = (props) => {
506
- const { customDateAdjustOptionValue, graph, observerContext, setValueSpecification, setDatePickerOption, } = props;
120
+ const { customDateAdjustOptionValue, updateValueSpecification, setDatePickerOption, } = props;
507
121
  const applicationStore = useApplicationStore();
508
122
  const selectorRef = useRef(null);
509
123
  const [unitValue, setUnitValue] = useState(customDateAdjustOptionValue instanceof CustomFirstDayOfOption
@@ -515,7 +129,7 @@ const CustomFirstDayOfValueSpecificationEditor = (props) => {
515
129
  const startDayOfDateOption = targetUnitValue.length > 0
516
130
  ? new CustomFirstDayOfOption(guaranteeNonNullable(targetUnitValue[0]?.toString()), latestUnitValue)
517
131
  : new CustomFirstDayOfOption('', undefined);
518
- setValueSpecification(buildPureDateFunctionExpression(startDayOfDateOption, graph, observerContext));
132
+ updateValueSpecification(undefined, startDayOfDateOption);
519
133
  setDatePickerOption(startDayOfDateOption);
520
134
  }
521
135
  };
@@ -533,7 +147,7 @@ const CustomFirstDayOfValueSpecificationEditor = (props) => {
533
147
  }, value: unitValue ? { value: unitValue, label: unitValue } : null, darkMode: !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled }) }) }));
534
148
  };
535
149
  const CustomPreviousDayOfWeekValueSpecificationEditor = (props) => {
536
- const { customDateAdjustOptionValue, graph, observerContext, setValueSpecification, setDatePickerOption, } = props;
150
+ const { customDateAdjustOptionValue, updateValueSpecification, setDatePickerOption, } = props;
537
151
  const applicationStore = useApplicationStore();
538
152
  const selectorRef = useRef(null);
539
153
  const [dayOfWeekValue, setDayOfWeekValue] = useState(customDateAdjustOptionValue instanceof CustomPreviousDayOfWeekOption
@@ -542,7 +156,7 @@ const CustomPreviousDayOfWeekValueSpecificationEditor = (props) => {
542
156
  const changeValue = (latestDurationUnitValue) => {
543
157
  if (latestDurationUnitValue !== '') {
544
158
  const previousDayOfWeekDateOption = new CustomPreviousDayOfWeekOption(`Previous ${latestDurationUnitValue}`, latestDurationUnitValue);
545
- setValueSpecification(buildPureDateFunctionExpression(previousDayOfWeekDateOption, graph, observerContext));
159
+ updateValueSpecification(undefined, previousDayOfWeekDateOption);
546
160
  setDatePickerOption(previousDayOfWeekDateOption);
547
161
  }
548
162
  };
@@ -562,7 +176,7 @@ const CustomPreviousDayOfWeekValueSpecificationEditor = (props) => {
562
176
  : null, darkMode: !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled }) }) }));
563
177
  };
564
178
  export const CustomDatePicker = (props) => {
565
- const { valueSpecification, setValueSpecification, graph, observerContext, hasError, typeCheckOption, displayAsEditableValue, handleBlur, } = props;
179
+ const { valueSpecification, valueSelector, updateValueSpecification, hasError, typeCheckOption, displayAsEditableValue, handleBlur, readOnly, } = props;
566
180
  const applicationStore = useApplicationStore();
567
181
  // For some cases where types need to be matched strictly.
568
182
  // Some options need to be filtered out for DateTime.
@@ -588,7 +202,9 @@ export const CustomDatePicker = (props) => {
588
202
  const handleDatePickerOptionChange = (event) => {
589
203
  const chosenDatePickerOption = new DatePickerOption(event.target.value, event.target.value);
590
204
  if (CUSTOM_DATE_PICKER_OPTION.LATEST_DATE === chosenDatePickerOption.value) {
591
- setValueSpecification(buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.LATESTDATE, event.target.value, observerContext));
205
+ updateValueSpecification(undefined, event.target.value, {
206
+ primitiveTypeEnum: PRIMITIVE_TYPE.LATESTDATE,
207
+ });
592
208
  }
593
209
  else if (
594
210
  // Elements in this list will trigger children date components
@@ -601,10 +217,10 @@ export const CustomDatePicker = (props) => {
601
217
  ].includes(chosenDatePickerOption.value)) {
602
218
  const theReservedCustomDateOption = reservedCustomDateOptions.filter((d) => d.value === chosenDatePickerOption.value);
603
219
  if (theReservedCustomDateOption.length > 0) {
604
- setValueSpecification(buildPureAdjustDateFunction(guaranteeNonNullable(theReservedCustomDateOption[0]), graph, observerContext));
220
+ updateValueSpecification(undefined, guaranteeNonNullable(theReservedCustomDateOption[0]));
605
221
  }
606
222
  else {
607
- setValueSpecification(buildPureDateFunctionExpression(chosenDatePickerOption, graph, observerContext));
223
+ updateValueSpecification(undefined, chosenDatePickerOption);
608
224
  }
609
225
  }
610
226
  setDatePickerOption(chosenDatePickerOption);
@@ -612,15 +228,15 @@ export const CustomDatePicker = (props) => {
612
228
  const renderChildrenDateComponents = () => {
613
229
  switch (datePickerOption.value) {
614
230
  case CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_DATE:
615
- return (_jsx(AbsoluteDateValueSpecificationEditor, { graph: graph, valueSpecification: valueSpecification, setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption, observerContext: observerContext }));
231
+ return (_jsx(AbsoluteDateValueSpecificationEditor, { valueSpecification: valueSpecification, valueSelector: valueSelector, updateValueSpecification: updateValueSpecification, setDatePickerOption: setDatePickerOption }));
616
232
  case CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME:
617
- return (_jsx(AbsoluteTimeValueSpecificationEditor, { graph: graph, valueSpecification: valueSpecification, setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption, observerContext: observerContext }));
233
+ return (_jsx(AbsoluteTimeValueSpecificationEditor, { valueSpecification: valueSpecification, valueSelector: valueSelector, updateValueSpecification: updateValueSpecification, setDatePickerOption: setDatePickerOption }));
618
234
  case CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE:
619
- return (_jsx(CustomDateInstanceValueEditor, { graph: graph, observerContext: observerContext, customDateOptionValue: buildCustomDateOption(valueSpecification, applicationStore), setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
235
+ return (_jsx(CustomDateInstanceValueEditor, { customDateOptionValue: buildCustomDateOption(valueSpecification, applicationStore), updateValueSpecification: updateValueSpecification, setDatePickerOption: setDatePickerOption }));
620
236
  case CUSTOM_DATE_PICKER_OPTION.FIRST_DAY_OF:
621
- return (_jsx(CustomFirstDayOfValueSpecificationEditor, { graph: graph, observerContext: observerContext, customDateAdjustOptionValue: buildDatePickerOption(valueSpecification, applicationStore), setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
237
+ return (_jsx(CustomFirstDayOfValueSpecificationEditor, { customDateAdjustOptionValue: buildDatePickerOption(valueSpecification, applicationStore), updateValueSpecification: updateValueSpecification, setDatePickerOption: setDatePickerOption }));
622
238
  case CUSTOM_DATE_PICKER_OPTION.PREVIOUS_DAY_OF_WEEK:
623
- return (_jsx(CustomPreviousDayOfWeekValueSpecificationEditor, { graph: graph, observerContext: observerContext, customDateAdjustOptionValue: buildDatePickerOption(valueSpecification, applicationStore), setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
239
+ return (_jsx(CustomPreviousDayOfWeekValueSpecificationEditor, { customDateAdjustOptionValue: buildDatePickerOption(valueSpecification, applicationStore), updateValueSpecification: updateValueSpecification, setDatePickerOption: setDatePickerOption }));
624
240
  default:
625
241
  return null;
626
242
  }
@@ -631,9 +247,9 @@ export const CustomDatePicker = (props) => {
631
247
  }, [applicationStore, valueSpecification]);
632
248
  return (_jsxs(_Fragment, { children: [displayAsEditableValue ? (_jsx("span", { className: clsx('value-spec-editor__date-picker__editable__display--content editable-value', {
633
249
  'value-spec-editor__date-picker__editable__display--content--error': hasError,
634
- }), title: "Click to edit and pick from more date options", onClick: openCustomDatePickerPopover, children: datePickerOption.label ? (`"${datePickerOption.label}"`) : (_jsx(_Fragment, { children: "\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0" })) })) : (_jsx("button", { className: clsx('value-spec-editor__date-picker__trigger', {
250
+ }), title: readOnly ? '' : 'Click to edit and pick from more date options', onClick: readOnly ? () => { } : openCustomDatePickerPopover, style: { cursor: readOnly ? 'not-allowed' : '' }, children: datePickerOption.label ? (`"${datePickerOption.label}"`) : (_jsx(_Fragment, { children: "\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0" })) })) : (_jsx("button", { className: clsx('value-spec-editor__date-picker__trigger', {
635
251
  'value-spec-editor__date-picker__trigger--error': hasError,
636
- }), title: "Click to edit and pick from more date options", onClick: openCustomDatePickerPopover, children: datePickerOption.label || 'Select value' })), _jsxs(BasePopover, { open: Boolean(anchorEl), TransitionProps: {
252
+ }), title: readOnly ? '' : 'Click to edit and pick from more date options', onClick: openCustomDatePickerPopover, disabled: readOnly, children: datePickerOption.label || 'Select value' })), _jsxs(BasePopover, { open: Boolean(anchorEl), TransitionProps: {
637
253
  onEnter: handleEnter,
638
254
  }, anchorEl: anchorEl, onClose: closeCustomDatePickerPopover, anchorOrigin: {
639
255
  vertical: displayAsEditableValue ? 20 : 'bottom',