openchs-models 1.31.86 → 1.31.88
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/dist/CustomFilter.js
CHANGED
|
@@ -128,7 +128,7 @@ class GroupSubjectTypeFilter {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
exports.GroupSubjectTypeFilter = GroupSubjectTypeFilter;
|
|
131
|
-
const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFilter.default.type.EnrolmentDate, _CustomFilter.default.type.EncounterDate, _CustomFilter.default.type.ProgramEncounterDate];
|
|
131
|
+
const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFilter.default.type.EnrolmentDate, _CustomFilter.default.type.EncounterDate, _CustomFilter.default.type.ProgramEncounterDate, _CustomFilter.default.type.AsOnDate];
|
|
132
132
|
const entityTypes = {
|
|
133
133
|
[_CustomFilter.default.type.Gender]: _Gender.default.schema.name,
|
|
134
134
|
[_CustomFilter.default.type.Address]: _AddressLevel.default.schema.name,
|
|
@@ -163,7 +163,7 @@ class DashboardFilterConfig {
|
|
|
163
163
|
toDisplayText() {
|
|
164
164
|
let s = `Type: ${this.type}.`;
|
|
165
165
|
|
|
166
|
-
if (this.
|
|
166
|
+
if (this.isRangeWidget()) {
|
|
167
167
|
s += ` Widget: ${this.widget}.`;
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -174,14 +174,18 @@ class DashboardFilterConfig {
|
|
|
174
174
|
return s;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
isRangeWidget() {
|
|
178
|
+
return this.widget === _CustomFilter.default.widget.Range;
|
|
179
|
+
}
|
|
180
|
+
|
|
177
181
|
getInputDataType() {
|
|
178
182
|
if (this.isConceptTypeFilter()) {
|
|
179
183
|
return this.observationBasedFilter.concept.datatype;
|
|
180
184
|
} else if ([_CustomFilter.default.type.Gender, _CustomFilter.default.type.Address, _CustomFilter.default.type.GroupSubject].includes(this.type)) {
|
|
181
185
|
return DashboardFilterConfig.dataTypes.array;
|
|
182
|
-
} else if (dateFilterTypes.includes(this.type) && this.
|
|
186
|
+
} else if (dateFilterTypes.includes(this.type) && !this.isRangeWidget()) {
|
|
183
187
|
return _Concept.default.dataType.Date;
|
|
184
|
-
} else if (dateFilterTypes.includes(this.type) && this.
|
|
188
|
+
} else if (dateFilterTypes.includes(this.type) && this.isRangeWidget()) {
|
|
185
189
|
return _Range.default.DateRange;
|
|
186
190
|
} else if (this.type === _CustomFilter.default.type.SubjectType) {
|
|
187
191
|
return DashboardFilterConfig.dataTypes.formMetaData;
|
|
@@ -191,31 +195,31 @@ class DashboardFilterConfig {
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
isDateFilterType() {
|
|
194
|
-
return isDateDataType(this) && this.
|
|
198
|
+
return isDateDataType(this) && !this.isRangeWidget();
|
|
195
199
|
}
|
|
196
200
|
|
|
197
201
|
isDateRangeFilterType() {
|
|
198
|
-
return isDateDataType(this) && this.
|
|
202
|
+
return isDateDataType(this) && this.isRangeWidget();
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
isDateTimeFilterType() {
|
|
202
|
-
return isDateTimeDataType(this) && this.
|
|
206
|
+
return isDateTimeDataType(this) && !this.isRangeWidget();
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
isDateTimeRangeFilterType() {
|
|
206
|
-
return isDateTimeDataType(this) && this.
|
|
210
|
+
return isDateTimeDataType(this) && this.isRangeWidget();
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
isTimeFilterType() {
|
|
210
|
-
return isTimeDataType(this) && this.
|
|
214
|
+
return isTimeDataType(this) && !this.isRangeWidget();
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
isTimeRangeFilterType() {
|
|
214
|
-
return isTimeDataType(this) && this.
|
|
218
|
+
return isTimeDataType(this) && this.isRangeWidget();
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
isNumericRangeFilterType() {
|
|
218
|
-
return this.isConceptTypeFilter() && this.observationBasedFilter.concept.datatype === _Concept.default.dataType.Numeric && this.
|
|
222
|
+
return this.isConceptTypeFilter() && this.observationBasedFilter.concept.datatype === _Concept.default.dataType.Numeric && this.isRangeWidget();
|
|
219
223
|
}
|
|
220
224
|
|
|
221
225
|
isDateLikeFilterType() {
|
|
@@ -250,8 +254,8 @@ class DashboardFilterConfig {
|
|
|
250
254
|
return this.type === _CustomFilter.default.type.GroupSubject;
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
|
|
254
|
-
return
|
|
257
|
+
requiresSpecificSubjectType() {
|
|
258
|
+
return ![_CustomFilter.default.type.SubjectType, _CustomFilter.default.type.AsOnDate].includes(this.type);
|
|
255
259
|
}
|
|
256
260
|
|
|
257
261
|
isValid() {
|
|
@@ -305,8 +309,6 @@ class DashboardFilterConfig {
|
|
|
305
309
|
}
|
|
306
310
|
|
|
307
311
|
validate(filterValue) {
|
|
308
|
-
const inputDataType = this.getInputDataType();
|
|
309
|
-
|
|
310
312
|
if (this.isDateRangeFilterType()) {
|
|
311
313
|
return _DateTimeUtil.default.validateDateRange(filterValue.minValue, filterValue.maxValue);
|
|
312
314
|
}
|