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

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.
@@ -2,7 +2,8 @@
2
2
  * Xử lý các thao tác số học và toán học một cách tiện lợi.
3
3
  * Hỗ trợ các phép toán phức tạp hoặc tối ưu hóa các logic tính toán thường dùng.
4
4
  */
5
- export type Locale = 'vi' | 'en' | 'ja' | 'th' | 'id';
5
+ /** Danh sách các nước */
6
+ export type Locale = 'vi' | 'en' | 'ja' | 'th' | 'id' | 'fil';
6
7
  export declare function formatNumberByLocale(value?: number | bigint, lang?: string, locale?: string): string;
7
8
  export declare function roundDecimalNumber(number: any): string | null;
8
9
  export declare function WMAPEcalculator(data: any): number | "∞";
@@ -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
@@ -44697,7 +44697,8 @@ function formatNumberByLocale(value, lang, locale) {
44697
44697
  en: 'en-US',
44698
44698
  ja: 'ja-JP',
44699
44699
  th: 'th-TH',
44700
- id: 'id-ID'
44700
+ id: 'id-ID',
44701
+ fil: 'fil-PH'
44701
44702
  };
44702
44703
  const currentLang = lang || localStorage.getItem('i18nextLng');
44703
44704
  if (value === undefined) return '';else if (currentLang && lodashExports.keysIn(localesMap).includes(currentLang)) return new Intl.NumberFormat(localesMap[currentLang]).format(value);else return new Intl.NumberFormat(locale).format(value);
@@ -44801,6 +44802,7 @@ var FilterOperationType;
44801
44802
  FilterOperationType["NE"] = "ne";
44802
44803
  FilterOperationType["NOTCONTAINS"] = "notcontains";
44803
44804
  FilterOperationType["NOTIN"] = "notin";
44805
+ FilterOperationType["ISEMPTY"] = "isempty";
44804
44806
  FilterOperationType["CUSTOM"] = "custom";
44805
44807
  })(FilterOperationType || (FilterOperationType = {}));
44806
44808
  /**
@@ -44833,12 +44835,12 @@ function convertArrayFiltersToCondition(filters) {
44833
44835
  type,
44834
44836
  isArray
44835
44837
  } = _ref;
44836
- // Skip this filter if value is empty or undefined
44837
- if (value === undefined || value === '' || value === null) {
44838
+ // Skip this filter if value is empty or undefined, except for ISEMPTY type which doesn't need a value
44839
+ const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44840
+ if (typeStr !== FilterOperationType.ISEMPTY && (value === undefined || value === '' || value === null)) {
44838
44841
  return;
44839
44842
  }
44840
44843
  let condition;
44841
- const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44842
44844
  // Handle isArray flag - if true, use Contains with parameter reference
44843
44845
  if (isArray === true) {
44844
44846
  // Format the value as a comma-separated string if it's an array
@@ -44874,6 +44876,10 @@ function convertArrayFiltersToCondition(filters) {
44874
44876
  case FilterOperationType.LTE:
44875
44877
  condition = "".concat(key, "<=").concat(value);
44876
44878
  break;
44879
+ case FilterOperationType.ISEMPTY:
44880
+ // Special handling for empty string/null checking
44881
+ condition = "".concat(key, " == string.Empty");
44882
+ break;
44877
44883
  case FilterOperationType.IN:
44878
44884
  // For array values
44879
44885
  if (Array.isArray(value)) {
@@ -44972,16 +44978,17 @@ function processFilterExpression(expression) {
44972
44978
  }
44973
44979
  // It's a simple filter item
44974
44980
  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
44981
  const {
44980
44982
  key,
44981
44983
  value,
44982
44984
  type,
44983
44985
  isArray
44984
44986
  } = item;
44987
+ // Skip this filter if value is empty or undefined, except for ISEMPTY type which doesn't need a value
44988
+ const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44989
+ if (typeStr !== FilterOperationType.ISEMPTY && (value === undefined || value === '' || value === null)) {
44990
+ return '';
44991
+ }
44985
44992
  // Handle isArray flag - if true, use Contains with parameter reference
44986
44993
  if (isArray === true) {
44987
44994
  // Format the value as a comma-separated string if it's an array
@@ -44990,7 +44997,6 @@ function processFilterExpression(expression) {
44990
44997
  params.push(paramValue);
44991
44998
  return "@".concat(params.length - 1, ".Contains(").concat(key, ")");
44992
44999
  }
44993
- const typeStr = typeof type === 'string' ? type.toLowerCase() : type;
44994
45000
  switch (typeStr) {
44995
45001
  case FilterOperationType.EQ:
44996
45002
  return "".concat(key, "=\"").concat(value, "\"");
@@ -45008,6 +45014,8 @@ function processFilterExpression(expression) {
45008
45014
  return "".concat(key, "<").concat(value);
45009
45015
  case FilterOperationType.LTE:
45010
45016
  return "".concat(key, "<=").concat(value);
45017
+ case FilterOperationType.ISEMPTY:
45018
+ return "".concat(key, " == string.Empty");
45011
45019
  case FilterOperationType.IN:
45012
45020
  if (Array.isArray(value)) {
45013
45021
  return "".concat(key, " IN (").concat(value.map(v => typeof v === 'string' ? "\"".concat(v, "\"") : v).join(', '), ")");
@@ -45150,6 +45158,25 @@ function convertFilterExpressionToCondition(filterExpression) {
45150
45158
  * // params: ["1,2", "name1,name2"]
45151
45159
  * // }
45152
45160
  * ```
45161
+ *
45162
+ * Example with ISEMPTY check:
45163
+ * ```typescript
45164
+ * const complexFilter: FilterGroup = {
45165
+ * operator: LogicalOperatorType.AND,
45166
+ * filters: [
45167
+ * {
45168
+ * operator: LogicalOperatorType.OR,
45169
+ * filters: [
45170
+ * { key: 'apControllerCode', value: 'aerohive', type: FilterOperationType.CONTAINS },
45171
+ * { key: 'apControllerCode', type: FilterOperationType.ISEMPTY }
45172
+ * ]
45173
+ * },
45174
+ * { key: 'authenticationMethodCode', value: 'standard', type: FilterOperationType.CONTAINS }
45175
+ * ]
45176
+ * };
45177
+ * const result = convertFilterExpressionToCondition(complexFilter);
45178
+ * // Returns: { condition: '(apControllerCode.Contains("aerohive") || apControllerCode == string.Empty) && authenticationMethodCode.Contains("standard")' }
45179
+ * ```
45153
45180
  */
45154
45181
 
45155
45182
  const HeaderBar = styled('header')({
package/dist/index.d.ts CHANGED
@@ -3341,7 +3341,8 @@ declare function parseJSON(str: string): any;
3341
3341
  * Xử lý các thao tác số học và toán học một cách tiện lợi.
3342
3342
  * Hỗ trợ các phép toán phức tạp hoặc tối ưu hóa các logic tính toán thường dùng.
3343
3343
  */
3344
- type Locale = 'vi' | 'en' | 'ja' | 'th' | 'id';
3344
+ /** Danh sách các nước */
3345
+ type Locale = 'vi' | 'en' | 'ja' | 'th' | 'id' | 'fil';
3345
3346
  declare function formatNumberByLocale(value?: number | bigint, lang?: string, locale?: string): string;
3346
3347
  declare function roundDecimalNumber(number: any): string | null;
3347
3348
  declare function WMAPEcalculator(data: any): number | "∞";
@@ -3385,6 +3386,7 @@ declare enum FilterOperationType {
3385
3386
  NE = "ne",// Not equal
3386
3387
  NOTCONTAINS = "notcontains",// Does not contain substring
3387
3388
  NOTIN = "notin",// Not in array
3389
+ ISEMPTY = "isempty",// Check if the field is empty (null, undefined or empty string)
3388
3390
  CUSTOM = "custom"
3389
3391
  }
3390
3392
  /**
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.97",
4
4
  "main": "dist/esm/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",