awing-library 2.1.2-dev.95 → 2.1.2-dev.96

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.
@@ -15,6 +15,7 @@ export declare enum FilterOperationType {
15
15
  NE = "ne",// Not equal
16
16
  NOTCONTAINS = "notcontains",// Does not contain substring
17
17
  NOTIN = "notin",// Not in array
18
+ ISEMPTY = "isempty",// Check if the field is empty (null, undefined or empty string)
18
19
  CUSTOM = "custom"
19
20
  }
20
21
  /**
@@ -158,4 +159,23 @@ export declare function convertFilterExpressionToCondition(filterExpression: Fil
158
159
  * // params: ["1,2", "name1,name2"]
159
160
  * // }
160
161
  * ```
162
+ *
163
+ * Example with ISEMPTY check:
164
+ * ```typescript
165
+ * const complexFilter: FilterGroup = {
166
+ * operator: LogicalOperatorType.AND,
167
+ * filters: [
168
+ * {
169
+ * operator: LogicalOperatorType.OR,
170
+ * filters: [
171
+ * { key: 'apControllerCode', value: 'aerohive', type: FilterOperationType.CONTAINS },
172
+ * { key: 'apControllerCode', type: FilterOperationType.ISEMPTY }
173
+ * ]
174
+ * },
175
+ * { key: 'authenticationMethodCode', value: 'standard', type: FilterOperationType.CONTAINS }
176
+ * ]
177
+ * };
178
+ * const result = convertFilterExpressionToCondition(complexFilter);
179
+ * // Returns: { condition: '(apControllerCode.Contains("aerohive") || apControllerCode == string.Empty) && authenticationMethodCode.Contains("standard")' }
180
+ * ```
161
181
  */
package/dist/esm/index.js CHANGED
@@ -44801,6 +44801,7 @@ var FilterOperationType;
44801
44801
  FilterOperationType["NE"] = "ne";
44802
44802
  FilterOperationType["NOTCONTAINS"] = "notcontains";
44803
44803
  FilterOperationType["NOTIN"] = "notin";
44804
+ FilterOperationType["ISEMPTY"] = "isempty";
44804
44805
  FilterOperationType["CUSTOM"] = "custom";
44805
44806
  })(FilterOperationType || (FilterOperationType = {}));
44806
44807
  /**
@@ -44833,12 +44834,12 @@ function convertArrayFiltersToCondition(filters) {
44833
44834
  type,
44834
44835
  isArray
44835
44836
  } = _ref;
44836
- // Skip this filter if value is empty or undefined
44837
- if (value === undefined || value === '' || value === null) {
44837
+ // Skip this filter if value is empty or undefined, except for ISEMPTY type which doesn't need a value
44838
+ const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44839
+ if (typeStr !== FilterOperationType.ISEMPTY && (value === undefined || value === '' || value === null)) {
44838
44840
  return;
44839
44841
  }
44840
44842
  let condition;
44841
- const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44842
44843
  // Handle isArray flag - if true, use Contains with parameter reference
44843
44844
  if (isArray === true) {
44844
44845
  // Format the value as a comma-separated string if it's an array
@@ -44874,6 +44875,10 @@ function convertArrayFiltersToCondition(filters) {
44874
44875
  case FilterOperationType.LTE:
44875
44876
  condition = "".concat(key, "<=").concat(value);
44876
44877
  break;
44878
+ case FilterOperationType.ISEMPTY:
44879
+ // Special handling for empty string/null checking
44880
+ condition = "".concat(key, " == string.Empty");
44881
+ break;
44877
44882
  case FilterOperationType.IN:
44878
44883
  // For array values
44879
44884
  if (Array.isArray(value)) {
@@ -44972,16 +44977,17 @@ function processFilterExpression(expression) {
44972
44977
  }
44973
44978
  // It's a simple filter item
44974
44979
  const item = expression;
44975
- // Skip this filter if value is empty or undefined
44976
- if (item.value === undefined || item.value === '' || item.value === null) {
44977
- return '';
44978
- }
44979
44980
  const {
44980
44981
  key,
44981
44982
  value,
44982
44983
  type,
44983
44984
  isArray
44984
44985
  } = item;
44986
+ // Skip this filter if value is empty or undefined, except for ISEMPTY type which doesn't need a value
44987
+ const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44988
+ if (typeStr !== FilterOperationType.ISEMPTY && (value === undefined || value === '' || value === null)) {
44989
+ return '';
44990
+ }
44985
44991
  // Handle isArray flag - if true, use Contains with parameter reference
44986
44992
  if (isArray === true) {
44987
44993
  // Format the value as a comma-separated string if it's an array
@@ -44990,7 +44996,6 @@ function processFilterExpression(expression) {
44990
44996
  params.push(paramValue);
44991
44997
  return "@".concat(params.length - 1, ".Contains(").concat(key, ")");
44992
44998
  }
44993
- const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44994
44999
  switch (typeStr) {
44995
45000
  case FilterOperationType.EQ:
44996
45001
  return "".concat(key, "=\"").concat(value, "\"");
@@ -45008,6 +45013,8 @@ function processFilterExpression(expression) {
45008
45013
  return "".concat(key, "<").concat(value);
45009
45014
  case FilterOperationType.LTE:
45010
45015
  return "".concat(key, "<=").concat(value);
45016
+ case FilterOperationType.ISEMPTY:
45017
+ return "".concat(key, " == string.Empty");
45011
45018
  case FilterOperationType.IN:
45012
45019
  if (Array.isArray(value)) {
45013
45020
  return "".concat(key, " IN (").concat(value.map(v => typeof v === 'string' ? "\"".concat(v, "\"") : v).join(', '), ")");
@@ -45150,6 +45157,25 @@ function convertFilterExpressionToCondition(filterExpression) {
45150
45157
  * // params: ["1,2", "name1,name2"]
45151
45158
  * // }
45152
45159
  * ```
45160
+ *
45161
+ * Example with ISEMPTY check:
45162
+ * ```typescript
45163
+ * const complexFilter: FilterGroup = {
45164
+ * operator: LogicalOperatorType.AND,
45165
+ * filters: [
45166
+ * {
45167
+ * operator: LogicalOperatorType.OR,
45168
+ * filters: [
45169
+ * { key: 'apControllerCode', value: 'aerohive', type: FilterOperationType.CONTAINS },
45170
+ * { key: 'apControllerCode', type: FilterOperationType.ISEMPTY }
45171
+ * ]
45172
+ * },
45173
+ * { key: 'authenticationMethodCode', value: 'standard', type: FilterOperationType.CONTAINS }
45174
+ * ]
45175
+ * };
45176
+ * const result = convertFilterExpressionToCondition(complexFilter);
45177
+ * // Returns: { condition: '(apControllerCode.Contains("aerohive") || apControllerCode == string.Empty) && authenticationMethodCode.Contains("standard")' }
45178
+ * ```
45153
45179
  */
45154
45180
 
45155
45181
  const HeaderBar = styled('header')({
package/dist/index.d.ts CHANGED
@@ -3385,6 +3385,7 @@ declare enum FilterOperationType {
3385
3385
  NE = "ne",// Not equal
3386
3386
  NOTCONTAINS = "notcontains",// Does not contain substring
3387
3387
  NOTIN = "notin",// Not in array
3388
+ ISEMPTY = "isempty",// Check if the field is empty (null, undefined or empty string)
3388
3389
  CUSTOM = "custom"
3389
3390
  }
3390
3391
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.2-dev.95",
3
+ "version": "2.1.2-dev.96",
4
4
  "main": "dist/esm/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",