@optimiser/common 1.0.273 → 1.0.274

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.
@@ -2039,7 +2039,7 @@ function FilterConditions(condition, match, fields) {
2039
2039
  if (["lookup", "multilookup"].includes(field.Schema.UIDataType)) {
2040
2040
  fldName += '_SearchValue';
2041
2041
  }
2042
- //added by nirbhay on 25.04.22 to add dropdown in any type of fields for filter
2042
+ //added by nirbhay on 25.04.22 to add dropdown and multiselect in any type of fields for filter
2043
2043
  if (field.Schema.SearchType) {
2044
2044
  fldName = field.UniqueID;
2045
2045
  if (field.Schema.SearchType == 'dropdown') {
@@ -2047,6 +2047,13 @@ function FilterConditions(condition, match, fields) {
2047
2047
  obj.Value = new mongodb_1.ObjectId(obj.Value);
2048
2048
  }
2049
2049
  }
2050
+ else if (field.Schema.SearchType == 'multiselect') {
2051
+ if (field.Schema.LookupObject && obj.Value && obj.Value.length && (field.Schema.SelectKeyType == undefined || field.Schema.SelectKeyType == 'objectid')) {
2052
+ for (var j = 0; j < obj.Value.length; j++) {
2053
+ obj.Value[j] = new mongodb_1.ObjectId(obj.Value[j]);
2054
+ }
2055
+ }
2056
+ }
2050
2057
  }
2051
2058
  switch (field.Schema.UIDataType) {
2052
2059
  case "int":
@@ -2085,7 +2092,7 @@ function FilterConditions(condition, match, fields) {
2085
2092
  case "CONTAINS":
2086
2093
  if (obj.Value === '')
2087
2094
  matchValue = { '$in': [null, ''] };
2088
- else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType)) {
2095
+ else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType) || field.Schema.SearchType == 'multiselect') {
2089
2096
  matchValue = { '$in': obj.Value };
2090
2097
  }
2091
2098
  else
@@ -2094,7 +2101,7 @@ function FilterConditions(condition, match, fields) {
2094
2101
  case "NOT_CONTAINS":
2095
2102
  if (obj.Value === '')
2096
2103
  matchValue = { '$nin': [null, ''] };
2097
- else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType)) {
2104
+ else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType) || field.Schema.SearchType == 'multiselect') {
2098
2105
  matchValue = { '$nin': obj.Value };
2099
2106
  }
2100
2107
  else
@@ -2203,6 +2210,9 @@ function GirdHeaderFilters(filters, fields) {
2203
2210
  if (field.Schema.SearchType == 'dropdown') {
2204
2211
  matchValue = { '$eq': bson_1.EJSON.parse(JSON.stringify(obj.Value)) };
2205
2212
  }
2213
+ else if (field.Schema.SearchType == 'multiselect') {
2214
+ matchValue = { '$in': bson_1.EJSON.parse(JSON.stringify(obj.Value)) };
2215
+ }
2206
2216
  else if (["lookup", "multilookup"].includes(field.Schema.UIDataType)) {
2207
2217
  fldName += '_SearchValue';
2208
2218
  matchValue = { '$regex': obj.Value.trim().replace(/[-[\]{}()*+?.,\\/^$|#\s]/g, "\\$&"), '$options': 'i' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.273",
3
+ "version": "1.0.274",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {