@sankhyalabs/sankhyablocks 6.5.0 → 6.6.1

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 (185) hide show
  1. package/dist/cjs/{PersonalizedFilterUtils-7d959e91.js → PersonalizedFilterUtils-cfcd9af2.js} +47 -10
  2. package/dist/cjs/{SnkMessageBuilder-aec46b5d.js → SnkMessageBuilder-ba6d4ade.js} +4 -1
  3. package/dist/cjs/SnkMultiSelectionListDataSource-804ff4c7.js +34 -0
  4. package/dist/cjs/{index-614af008.js → index-0e663819.js} +0 -36
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  7. package/dist/cjs/snk-actions-button.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  10. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  12. package/dist/cjs/{snk-data-unit-ba0c368c.js → snk-data-unit-5f434275.js} +1 -1
  13. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
  15. package/dist/cjs/snk-expression-group.cjs.entry.js +21 -17
  16. package/dist/cjs/snk-expression-item_3.cjs.entry.js +21 -31
  17. package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -16
  18. package/dist/cjs/snk-filter-detail.cjs.entry.js +11 -7
  19. package/dist/cjs/snk-filter-item.cjs.entry.js +16 -7
  20. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +10 -8
  21. package/dist/cjs/snk-filter-modal.cjs.entry.js +13 -7
  22. package/dist/cjs/snk-grid.cjs.entry.js +4 -32
  23. package/dist/cjs/{snk-guides-viewer-7bedfa91.js → snk-guides-viewer-27586701.js} +2 -2
  24. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  25. package/dist/cjs/{snk-filter-personalized.cjs.entry.js → snk-personalized-filter-editor.cjs.entry.js} +35 -12
  26. package/dist/cjs/snk-personalized-filter.cjs.entry.js +24 -13
  27. package/dist/cjs/snk-simple-crud.cjs.entry.js +44 -15
  28. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
  29. package/dist/cjs/{taskbar-elements-7f91f4cd.js → taskbar-elements-b98dd6e9.js} +1 -1
  30. package/dist/collection/collection-manifest.json +1 -1
  31. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +1 -1
  32. package/dist/collection/components/snk-filter-bar/filter-item/editors/{snk-filter-personalized/snk-filter-personalized.js → snk-personalized-filter-editor/snk-personalized-filter-editor.js} +36 -13
  33. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +9 -5
  34. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +16 -7
  35. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +11 -5
  36. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +10 -8
  37. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +4 -5
  38. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +2 -12
  39. package/dist/collection/components/snk-personalized-filter/interfaces/index.js +39 -0
  40. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +24 -12
  41. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +25 -21
  42. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +7 -7
  43. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +3 -3
  44. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +6 -6
  45. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +10 -2
  46. package/dist/collection/lib/@types/index.js +0 -36
  47. package/dist/collection/lib/dataUnit/InMemoryLoader.js +25 -4
  48. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +4 -1
  49. package/dist/components/PersonalizedFilterUtils.js +49 -7
  50. package/dist/components/SnkMessageBuilder.js +4 -1
  51. package/dist/components/{taskbar-processor.js → SnkMultiSelectionListDataSource.js} +32 -1
  52. package/dist/components/index.d.ts +1 -1
  53. package/dist/components/index.js +1 -1
  54. package/dist/components/index2.js +1 -37
  55. package/dist/components/snk-detail-view2.js +1 -1
  56. package/dist/components/snk-expression-group2.js +22 -23
  57. package/dist/components/snk-expression-item2.js +4 -4
  58. package/dist/components/snk-filter-bar2.js +5 -7
  59. package/dist/components/snk-filter-detail2.js +9 -5
  60. package/dist/components/snk-filter-field-search2.js +2 -12
  61. package/dist/components/snk-filter-item2.js +16 -7
  62. package/dist/components/snk-filter-modal-item2.js +10 -8
  63. package/dist/components/snk-filter-modal.js +11 -5
  64. package/dist/components/snk-filter-param-config2.js +1 -2
  65. package/dist/components/snk-grid2.js +4 -33
  66. package/dist/components/snk-personalized-filter-editor.d.ts +11 -0
  67. package/dist/components/{snk-filter-personalized.js → snk-personalized-filter-editor.js} +42 -19
  68. package/dist/components/snk-personalized-filter2.js +25 -13
  69. package/dist/components/snk-simple-crud2.js +34 -6
  70. package/dist/esm/{PersonalizedFilterUtils-202cd721.js → PersonalizedFilterUtils-1a167d89.js} +44 -7
  71. package/dist/esm/{SnkMessageBuilder-a4f7d858.js → SnkMessageBuilder-9d2becfb.js} +4 -1
  72. package/dist/esm/SnkMultiSelectionListDataSource-892f37f9.js +32 -0
  73. package/dist/esm/index-1564817d.js +33 -0
  74. package/dist/esm/loader.js +1 -1
  75. package/dist/esm/sankhyablocks.js +1 -1
  76. package/dist/esm/snk-actions-button.entry.js +1 -1
  77. package/dist/esm/snk-application.entry.js +1 -1
  78. package/dist/esm/snk-attach.entry.js +2 -2
  79. package/dist/esm/snk-crud.entry.js +2 -2
  80. package/dist/esm/snk-data-exporter.entry.js +3 -3
  81. package/dist/esm/{snk-data-unit-3ecaf52c.js → snk-data-unit-ca4bcba6.js} +1 -1
  82. package/dist/esm/snk-data-unit.entry.js +2 -2
  83. package/dist/esm/snk-detail-view.entry.js +4 -4
  84. package/dist/esm/snk-expression-group.entry.js +21 -17
  85. package/dist/esm/snk-expression-item_3.entry.js +7 -17
  86. package/dist/esm/snk-filter-bar.entry.js +6 -7
  87. package/dist/esm/snk-filter-detail.entry.js +11 -7
  88. package/dist/esm/snk-filter-item.entry.js +16 -7
  89. package/dist/esm/snk-filter-modal-item.entry.js +10 -8
  90. package/dist/esm/snk-filter-modal.entry.js +13 -7
  91. package/dist/esm/snk-grid.entry.js +6 -34
  92. package/dist/esm/{snk-guides-viewer-9240c017.js → snk-guides-viewer-950dd3b5.js} +2 -2
  93. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  94. package/dist/esm/{snk-filter-personalized.entry.js → snk-personalized-filter-editor.entry.js} +35 -12
  95. package/dist/esm/snk-personalized-filter.entry.js +24 -13
  96. package/dist/esm/snk-simple-crud.entry.js +36 -7
  97. package/dist/esm/snk-taskbar.entry.js +2 -2
  98. package/dist/esm/{taskbar-elements-139b1058.js → taskbar-elements-2c761819.js} +1 -1
  99. package/dist/sankhyablocks/{p-ab33e180.js → p-01070d6d.js} +1 -1
  100. package/dist/sankhyablocks/p-18de3bbd.entry.js +1 -0
  101. package/dist/sankhyablocks/p-25df01a1.entry.js +1 -0
  102. package/dist/sankhyablocks/p-30134b16.entry.js +1 -0
  103. package/dist/sankhyablocks/{p-09f33525.entry.js → p-402db136.entry.js} +1 -1
  104. package/dist/sankhyablocks/p-40a5d35e.entry.js +1 -0
  105. package/dist/sankhyablocks/p-4c8d0516.entry.js +1 -0
  106. package/dist/sankhyablocks/p-5534e08c.js +1 -0
  107. package/dist/sankhyablocks/{p-257aeea4.entry.js → p-5e06e139.entry.js} +1 -1
  108. package/dist/sankhyablocks/{p-43485c54.js → p-602dfb9e.js} +1 -1
  109. package/dist/sankhyablocks/{p-78a226a1.js → p-6f4f88ef.js} +1 -1
  110. package/dist/sankhyablocks/p-775e60f5.entry.js +1 -0
  111. package/dist/sankhyablocks/{p-aa4e880f.entry.js → p-7c10486f.entry.js} +1 -1
  112. package/dist/sankhyablocks/p-7d68a43a.js +1 -0
  113. package/dist/sankhyablocks/p-86e10ecc.entry.js +1 -0
  114. package/dist/sankhyablocks/p-88a40b96.entry.js +1 -0
  115. package/dist/sankhyablocks/{p-f1edaec0.js → p-a2493d11.js} +1 -1
  116. package/dist/sankhyablocks/p-b6f9f702.entry.js +1 -0
  117. package/dist/sankhyablocks/{p-6564f621.entry.js → p-c2d3e4fb.entry.js} +1 -1
  118. package/dist/sankhyablocks/{p-2adb4481.entry.js → p-c6380ea2.entry.js} +1 -1
  119. package/dist/sankhyablocks/{p-0d670404.entry.js → p-c7c4ed56.entry.js} +1 -1
  120. package/dist/sankhyablocks/{p-e8be0aae.entry.js → p-ca29b093.entry.js} +1 -1
  121. package/dist/sankhyablocks/p-d881cab2.entry.js +1 -0
  122. package/dist/sankhyablocks/p-d9586ead.entry.js +1 -0
  123. package/dist/sankhyablocks/p-f8ce17d3.entry.js +1 -0
  124. package/dist/sankhyablocks/p-fa9d3f73.js +1 -0
  125. package/dist/sankhyablocks/{p-cea58f8b.entry.js → p-fdc262aa.entry.js} +1 -1
  126. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  127. package/dist/types/components/snk-filter-bar/filter-item/editors/{snk-filter-personalized/snk-filter-personalized.d.ts → snk-personalized-filter-editor/snk-personalized-filter-editor.d.ts} +8 -25
  128. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
  129. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +3 -0
  130. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +2 -1
  131. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +3 -1
  132. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
  133. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +0 -1
  134. package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionItem.d.ts +1 -1
  135. package/dist/types/components/snk-personalized-filter/interfaces/IParameter.d.ts +37 -0
  136. package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IUserFilterConfig.d.ts +1 -1
  137. package/dist/types/components/snk-personalized-filter/interfaces/index.d.ts +35 -0
  138. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +3 -1
  139. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +5 -2
  140. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +1 -1
  141. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +2 -1
  142. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +1 -1
  143. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +2 -2
  144. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +3 -0
  145. package/dist/types/components.d.ts +62 -62
  146. package/dist/types/lib/@types/index.d.ts +0 -32
  147. package/dist/types/lib/configs/ConfigStorage.d.ts +1 -1
  148. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +3 -1
  149. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +1 -1
  150. package/package.json +1 -1
  151. package/react/components.d.ts +1 -1
  152. package/react/components.js +1 -1
  153. package/react/components.js.map +1 -1
  154. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/index.js +0 -3
  155. package/dist/components/snk-filter-personalized.d.ts +0 -11
  156. package/dist/esm/index-a255b326.js +0 -69
  157. package/dist/sankhyablocks/p-0364abc8.entry.js +0 -1
  158. package/dist/sankhyablocks/p-18e3a2b7.entry.js +0 -1
  159. package/dist/sankhyablocks/p-36ecb6ab.js +0 -1
  160. package/dist/sankhyablocks/p-4374cc15.entry.js +0 -1
  161. package/dist/sankhyablocks/p-50c3700f.entry.js +0 -1
  162. package/dist/sankhyablocks/p-6ce48ae3.entry.js +0 -1
  163. package/dist/sankhyablocks/p-7add855c.entry.js +0 -1
  164. package/dist/sankhyablocks/p-a1cab141.entry.js +0 -1
  165. package/dist/sankhyablocks/p-abc4ae66.entry.js +0 -1
  166. package/dist/sankhyablocks/p-c7dd701c.entry.js +0 -1
  167. package/dist/sankhyablocks/p-d5a25c7d.entry.js +0 -1
  168. package/dist/sankhyablocks/p-e962ce72.entry.js +0 -1
  169. package/dist/sankhyablocks/p-eb90de43.js +0 -1
  170. package/dist/sankhyablocks/p-f75dceb1.entry.js +0 -1
  171. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IParameter.d.ts +0 -21
  172. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/index.d.ts +0 -3
  173. /package/dist/cjs/{IExpressionItem-1090c3fd.js → IExpressionItem-0e32ebb7.js} +0 -0
  174. /package/dist/collection/components/snk-filter-bar/filter-item/editors/{snk-filter-personalized/snk-filter-personalized.css → snk-personalized-filter-editor/snk-personalized-filter-editor.css} +0 -0
  175. /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionGroup.js +0 -0
  176. /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionItem.js +0 -0
  177. /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IParameter.js +0 -0
  178. /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IPersonalizedFilter.js +0 -0
  179. /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/ISystemFilterConfig.js +0 -0
  180. /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IUserFilterConfig.js +0 -0
  181. /package/dist/esm/{IExpressionItem-2e922b2c.js → IExpressionItem-21f225bf.js} +0 -0
  182. /package/dist/sankhyablocks/{p-c6bf66e0.js → p-63bff2a8.js} +0 -0
  183. /package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionGroup.d.ts +0 -0
  184. /package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IPersonalizedFilter.d.ts +0 -0
  185. /package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/ISystemFilterConfig.d.ts +0 -0
@@ -1,7 +1,49 @@
1
1
  import { DataType, NumberUtils, DateUtils, UserInterface } from '@sankhyalabs/core';
2
- import { F as FilterOperand } from './index2.js';
3
2
  import { F as FilterItemType } from './filter-item-type.enum.js';
4
3
 
4
+ var FilterGroupCondition;
5
+ (function (FilterGroupCondition) {
6
+ FilterGroupCondition["AND"] = "AND";
7
+ FilterGroupCondition["OR"] = "OR";
8
+ })(FilterGroupCondition || (FilterGroupCondition = {}));
9
+
10
+ var FilterConfigType;
11
+ (function (FilterConfigType) {
12
+ FilterConfigType["SYSTEM_CONFIG"] = "S";
13
+ FilterConfigType["USER_CONFIG"] = "E";
14
+ })(FilterConfigType || (FilterConfigType = {}));
15
+ var FilterUserConfigTypes;
16
+ (function (FilterUserConfigTypes) {
17
+ FilterUserConfigTypes["DATE"] = "D";
18
+ FilterUserConfigTypes["HORA"] = "H";
19
+ FilterUserConfigTypes["TEXT"] = "S";
20
+ FilterUserConfigTypes["INTEGER"] = "I";
21
+ FilterUserConfigTypes["DECIMAL"] = "F";
22
+ FilterUserConfigTypes["NUMBER"] = "NUMBER";
23
+ })(FilterUserConfigTypes || (FilterUserConfigTypes = {}));
24
+ var FilterOperand;
25
+ (function (FilterOperand) {
26
+ FilterOperand["AND"] = "AND";
27
+ FilterOperand["OR"] = "OR";
28
+ FilterOperand["IN"] = "IN";
29
+ FilterOperand["DIFFERENT"] = "<>";
30
+ FilterOperand["LIKE"] = "LIKE";
31
+ FilterOperand["START_WITH"] = "LIKE_START";
32
+ FilterOperand["FINISHED_WITH"] = "LIKE_END";
33
+ FilterOperand["NULL"] = "NULL";
34
+ FilterOperand["NOT_NULL"] = "NOT NULL";
35
+ FilterOperand["EQUAL"] = "=";
36
+ FilterOperand["LARGER"] = ">";
37
+ FilterOperand["LARGER_EQUAL"] = ">=";
38
+ FilterOperand["SMALLER"] = "<";
39
+ FilterOperand["SMALLER_EQUAL"] = "<=";
40
+ })(FilterOperand || (FilterOperand = {}));
41
+ var FilterEntities;
42
+ (function (FilterEntities) {
43
+ FilterEntities["FIELD"] = "Campo";
44
+ FilterEntities["INSTANCE"] = "Instancia";
45
+ })(FilterEntities || (FilterEntities = {}));
46
+
5
47
  class PersonalizedFilterUtils {
6
48
  /**
7
49
  * Cria uma expressão de filtro a partir de um IExpressionItem.
@@ -30,16 +72,16 @@ class PersonalizedFilterUtils {
30
72
  expression += ` IS ${FilterOperand[expressionItem.operand]}`;
31
73
  break;
32
74
  case "LIKE":
33
- expression += ` LIKE ${commas}%${value}%${commas}`;
75
+ expression += ` LIKE '%${value}%'`;
34
76
  break;
35
77
  case "START_WITH":
36
- expression += ` LIKE ${commas}${value}%${commas}`;
78
+ expression += ` LIKE '${value}%'`;
37
79
  break;
38
80
  case "FINISHED_WITH":
39
- expression += ` LIKE ${commas}%${value}${commas}`;
81
+ expression += ` LIKE '%${value}'`;
40
82
  break;
41
83
  default:
42
- value = isNaN(value) ? `${commas}${value}${commas}` : value;
84
+ value = typeof value === 'string' ? `${commas}${value}${commas}` : value;
43
85
  expression += ` ${FilterOperand[expressionItem.operand]} ${value}`;
44
86
  }
45
87
  return expression;
@@ -151,7 +193,7 @@ class PersonalizedFilterUtils {
151
193
  value: (value, byPassValue) => {
152
194
  if (byPassValue)
153
195
  return true;
154
- return !!value;
196
+ return value != undefined;
155
197
  },
156
198
  operand: (value) => !!value
157
199
  };
@@ -224,4 +266,4 @@ class PersonalizedFilterUtils {
224
266
  }
225
267
  }
226
268
 
227
- export { PersonalizedFilterUtils as P };
269
+ export { FilterGroupCondition as F, PersonalizedFilterUtils as P, FilterOperand as a, FilterConfigType as b, FilterEntities as c, FilterUserConfigTypes as d };
@@ -361,7 +361,10 @@ const snkPersonalizedFilterMessages = {
361
361
  labelNameFilter: "Nome do filtro",
362
362
  labelExpression: "Expressão SQL",
363
363
  badgeVariable: "variável",
364
- noDataFound: "Nenhum filtro encontrado"
364
+ noDataFound: "Nenhum filtro encontrado",
365
+ condition: "Condição",
366
+ addGroup: "Adicionar grupo",
367
+ applyExpression: "Expressão a ser aplicada:"
365
368
  },
366
369
  confirmExpression: {
367
370
  title: "Aviso",
@@ -1,3 +1,5 @@
1
+ import { UserInterface, DateUtils } from '@sankhyalabs/core';
2
+
1
3
  class TaskbarProcessor {
2
4
  constructor(defaultButtons) {
3
5
  this._defaultButtons = defaultButtons;
@@ -44,4 +46,33 @@ class TaskbarProcessor {
44
46
  }
45
47
  }
46
48
 
47
- export { TaskbarProcessor as T };
49
+ class SnkMultiSelectionListDataSource {
50
+ setDataUnit(dataUnit) {
51
+ this._dataUnit = dataUnit;
52
+ }
53
+ setApplication(application) {
54
+ this._application = application;
55
+ }
56
+ formatLabel(fieldName, value) {
57
+ const { userInterface } = this._dataUnit.getField(fieldName);
58
+ if (userInterface === UserInterface.DATETIME) {
59
+ return DateUtils.formatDate(this._dataUnit.valueFromString(fieldName, value));
60
+ }
61
+ return String(this._dataUnit.getFormattedValue(fieldName, value));
62
+ }
63
+ fetchData(filterTerm, fieldName) {
64
+ return new Promise(resolve => {
65
+ this._application.executeSelectDistinct(this._dataUnit, fieldName, filterTerm).then(result => {
66
+ resolve(result.map(item => {
67
+ const field = this._dataUnit.getField(fieldName);
68
+ if (field.userInterface === UserInterface.SEARCH) {
69
+ return Object.assign(Object.assign({}, JSON.parse(item)), { check: true });
70
+ }
71
+ return { value: item, label: this.formatLabel(fieldName, item), check: true };
72
+ }));
73
+ });
74
+ });
75
+ }
76
+ }
77
+
78
+ export { SnkMultiSelectionListDataSource as S, TaskbarProcessor as T };
@@ -27,7 +27,6 @@ export { SnkFilterMultiSelect as SnkFilterMultiSelect } from '../types/component
27
27
  export { SnkFilterPeriod as SnkFilterNumber } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-number';
28
28
  export { SnkFilterParamConfig as SnkFilterParamConfig } from '../types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config';
29
29
  export { SnkFilterPeriod as SnkFilterPeriod } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-period';
30
- export { SnkFilterPersonalized as SnkFilterPersonalized } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized/snk-filter-personalized';
31
30
  export { SnkFilterSearch as SnkFilterSearch } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-search';
32
31
  export { SnkFilterText as SnkFilterText } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-text';
33
32
  export { SnkForm as SnkForm } from '../types/components/snk-form/snk-form';
@@ -38,6 +37,7 @@ export { SnkGrid as SnkGrid } from '../types/components/snk-grid/snk-grid';
38
37
  export { SnkGridConfig as SnkGridConfig } from '../types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config';
39
38
  export { SnkGuidesViewer as SnkGuidesViewer } from '../types/components/snk-crud/subcomponents/snk-guides-viewer';
40
39
  export { SnkPersonalizedFilter as SnkPersonalizedFilter } from '../types/components/snk-personalized-filter/snk-personalized-filter';
40
+ export { SnkFilterPersonalized as SnkPersonalizedFilterEditor } from '../types/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor';
41
41
  export { SnkPesquisa as SnkPesquisa } from '../types/components/snk-pesquisa/snk-pesquisa';
42
42
  export { SelectBox as SnkSelectBox } from '../types/components/snk-grid/subcomponents/snk-select-box/snk-select-box';
43
43
  export { SnkSimpleBar as SnkSimpleBar } from '../types/components/snk-simple-bar/snk-simple-bar';
@@ -27,7 +27,6 @@ export { SnkFilterMultiSelect, defineCustomElement as defineCustomElementSnkFilt
27
27
  export { SnkFilterNumber, defineCustomElement as defineCustomElementSnkFilterNumber } from './snk-filter-number.js';
28
28
  export { SnkFilterParamConfig, defineCustomElement as defineCustomElementSnkFilterParamConfig } from './snk-filter-param-config.js';
29
29
  export { SnkFilterPeriod, defineCustomElement as defineCustomElementSnkFilterPeriod } from './snk-filter-period.js';
30
- export { SnkFilterPersonalized, defineCustomElement as defineCustomElementSnkFilterPersonalized } from './snk-filter-personalized.js';
31
30
  export { SnkFilterSearch, defineCustomElement as defineCustomElementSnkFilterSearch } from './snk-filter-search.js';
32
31
  export { SnkFilterText, defineCustomElement as defineCustomElementSnkFilterText } from './snk-filter-text.js';
33
32
  export { SnkForm, defineCustomElement as defineCustomElementSnkForm } from './snk-form.js';
@@ -38,6 +37,7 @@ export { SnkGrid, defineCustomElement as defineCustomElementSnkGrid } from './sn
38
37
  export { SnkGridConfig, defineCustomElement as defineCustomElementSnkGridConfig } from './snk-grid-config.js';
39
38
  export { SnkGuidesViewer, defineCustomElement as defineCustomElementSnkGuidesViewer } from './snk-guides-viewer.js';
40
39
  export { SnkPersonalizedFilter, defineCustomElement as defineCustomElementSnkPersonalizedFilter } from './snk-personalized-filter.js';
40
+ export { SnkPersonalizedFilterEditor, defineCustomElement as defineCustomElementSnkPersonalizedFilterEditor } from './snk-personalized-filter-editor.js';
41
41
  export { SnkPesquisa, defineCustomElement as defineCustomElementSnkPesquisa } from './snk-pesquisa.js';
42
42
  export { SnkSelectBox, defineCustomElement as defineCustomElementSnkSelectBox } from './snk-select-box.js';
43
43
  export { SnkSimpleBar, defineCustomElement as defineCustomElementSnkSimpleBar } from './snk-simple-bar.js';
@@ -29,41 +29,5 @@ var DataExporterType;
29
29
  DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
30
30
  DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
31
31
  })(DataExporterType || (DataExporterType = {}));
32
- var FilterConfigType;
33
- (function (FilterConfigType) {
34
- FilterConfigType["SYSTEM_CONFIG"] = "S";
35
- FilterConfigType["USER_CONFIG"] = "E";
36
- })(FilterConfigType || (FilterConfigType = {}));
37
- var FilterUserConfigTypes;
38
- (function (FilterUserConfigTypes) {
39
- FilterUserConfigTypes["DATE"] = "D";
40
- FilterUserConfigTypes["HORA"] = "H";
41
- FilterUserConfigTypes["TEXT"] = "S";
42
- FilterUserConfigTypes["INTEGER"] = "I";
43
- FilterUserConfigTypes["DECIMAL"] = "F";
44
- FilterUserConfigTypes["NUMBER"] = "NUMBER";
45
- })(FilterUserConfigTypes || (FilterUserConfigTypes = {}));
46
- var FilterOperand;
47
- (function (FilterOperand) {
48
- FilterOperand["AND"] = "AND";
49
- FilterOperand["OR"] = "OR";
50
- FilterOperand["IN"] = "IN";
51
- FilterOperand["DIFFERENT"] = "<>";
52
- FilterOperand["LIKE"] = "LIKE";
53
- FilterOperand["START_WITH"] = "LIKE_START";
54
- FilterOperand["FINISHED_WITH"] = "LIKE_END";
55
- FilterOperand["NULL"] = "NULL";
56
- FilterOperand["NOT_NULL"] = "NOT NULL";
57
- FilterOperand["EQUAL"] = "=";
58
- FilterOperand["LARGER"] = ">";
59
- FilterOperand["LARGER_EQUAL"] = ">=";
60
- FilterOperand["SMALLER"] = "<";
61
- FilterOperand["SMALLER_EQUAL"] = "<=";
62
- })(FilterOperand || (FilterOperand = {}));
63
- var FilterEntities;
64
- (function (FilterEntities) {
65
- FilterEntities["FIELD"] = "Campo";
66
- FilterEntities["INSTANCE"] = "Instancia";
67
- })(FilterEntities || (FilterEntities = {}));
68
32
 
69
- export { DataExporterOption as D, FilterOperand as F, PresentationMode as P, DataExporterFormat as a, DataExporterType as b, FilterConfigType as c, FilterEntities as d, FilterUserConfigTypes as e };
33
+ export { DataExporterOption as D, PresentationMode as P, DataExporterFormat as a, DataExporterType as b };
@@ -7,7 +7,7 @@ import { ElementIDUtils } from '@sankhyalabs/core';
7
7
  import { P as PresentationMode } from './index2.js';
8
8
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
9
9
  import { V as VIEW_MODE } from './constants.js';
10
- import { T as TaskbarProcessor } from './taskbar-processor.js';
10
+ import { T as TaskbarProcessor } from './SnkMultiSelectionListDataSource.js';
11
11
  import { d as defineCustomElement$r } from './snk-actions-button2.js';
12
12
  import { d as defineCustomElement$q } from './snk-attach2.js';
13
13
  import { d as defineCustomElement$p } from './snk-config-options2.js';
@@ -1,19 +1,13 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, forceUpdate, Host } from '@stencil/core/internal/client';
2
+ import { F as FilterGroupCondition } from './PersonalizedFilterUtils.js';
2
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
3
4
  import { ApplicationContext, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
4
5
  import { d as defineCustomElement$3 } from './snk-expression-item2.js';
5
6
  import { d as defineCustomElement$2 } from './snk-filter-field-search2.js';
6
7
  import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';
7
8
 
8
- var FilterGroupCondition;
9
- (function (FilterGroupCondition) {
10
- FilterGroupCondition["AND"] = "AND";
11
- FilterGroupCondition["OR"] = "OR";
12
- })(FilterGroupCondition || (FilterGroupCondition = {}));
13
-
14
9
  const snkExpressionGroupCss = ".sc-snk-expression-group-h{display:block;--snk-expression-group--container-condition--width:184px;--snk-expression-group--container-condition--height:38px;--snk-expression-group--container-condition--border-radius:var(--border--radius-medium, 12px);--snk-expression-group--container-option--width:85px;--snk-expression-group__container-condition--background-and:#66B6A0;--snk-expression-group__container-condition--background-or:#EBC65E;--snk-expression-group__container-expression--padding-left:26px;--snk-expression-group__background-color-dashed:var(--background--body, #fafcff)}.snk-expression-group__container-condition.sc-snk-expression-group{width:var(--snk-expression-group--container-condition--width);height:var(--snk-expression-group--container-condition--height);border-radius:var(--snk-expression-group--container-condition--border-radius);z-index:var(--more-visible--2x, 3)}.snk-expression-group__container-option.sc-snk-expression-group{width:var(--snk-expression-group--container-option--width)}.snk-expression-group__container-condition[data-condition=\"AND\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-and)}.snk-expression-group__container-condition[data-condition=\"OR\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-or)}.snk-expression-group__container-expression.sc-snk-expression-group{padding-left:var(--snk-expression-group__container-expression--padding-left)}.dashes.sc-snk-expression-group{z-index:var(--visible, 1);background:var(--snk-expression-group__background-color-dashed);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:58px;margin-left:-15px;margin-top:-36.5px}.horizontal-dashes.sc-snk-expression-group{z-index:var(--more-visible, 2);border-bottom:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:54px;margin-left:-15px;margin-top:-33.5px}.hidden.sc-snk-expression-group{display:none}";
15
10
 
16
- const LIMIT_GROUP_LEVEL = 4;
17
11
  const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
18
12
  constructor() {
19
13
  super();
@@ -22,6 +16,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
22
16
  this.ezFilterGroupRemove = createEvent(this, "ezFilterGroupRemove", 7);
23
17
  this.ezExpressionGroupLayoutChanged = createEvent(this, "ezExpressionLayoutChanged", 7);
24
18
  this.FIRST_LEVEL = "0";
19
+ this.LIMIT_GROUP_LEVEL = 4;
25
20
  this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
26
21
  this._conditionOperator = FilterGroupCondition.AND;
27
22
  this._group = undefined;
@@ -48,11 +43,11 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
48
43
  }
49
44
  watchGroup(newValue) {
50
45
  this._group = newValue;
51
- this._conditionOperator = !this._group.operand ? FilterGroupCondition.AND : this._group.operand;
46
+ this._conditionOperator = this.getOperand();
52
47
  }
53
48
  componentWillLoad() {
54
49
  this._group = this.group;
55
- this._conditionOperator = !this._group.operand ? FilterGroupCondition.AND : this._group.operand;
50
+ this._conditionOperator = this.getOperand();
56
51
  if (!this.getDataGroupLevel()) {
57
52
  this._element.setAttribute('data-group-level', this.FIRST_LEVEL);
58
53
  }
@@ -78,6 +73,9 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
78
73
  getDashedHeight() {
79
74
  return this._selfTop - this.parentTop;
80
75
  }
76
+ getOperand() {
77
+ return !this._group.operand ? FilterGroupCondition.AND : this._group.operand;
78
+ }
81
79
  getMessage(key, params) {
82
80
  return this.application.messagesBuilder.getMessage(key, params);
83
81
  }
@@ -111,18 +109,19 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
111
109
  this.changeHandler();
112
110
  this.canAddExpression = true;
113
111
  }
112
+ isFilledItem(item) {
113
+ if (!item.fieldName || !item.operand)
114
+ return false;
115
+ if (item.operand === 'NULL' || item.operand === 'NOT_NULL') {
116
+ return true;
117
+ }
118
+ else {
119
+ return item.paramVariable || (item.userInterface === 'SWITCH') ? true : !!item.value;
120
+ }
121
+ }
114
122
  handleFilterItemChange() {
115
123
  this.ezFilterGroupChange.emit(this._group);
116
- this.canAddExpression = this.group.items.every(item => {
117
- if (!item.fieldName || !item.operand)
118
- return false;
119
- if (item.operand === 'NULL' || item.operand === 'NOT_NULL') {
120
- return true;
121
- }
122
- else {
123
- return item.paramVariable || (item.userInterface === 'SWITCH') ? true : !!item.value;
124
- }
125
- });
124
+ this.canAddExpression = this.group.items.every(this.isFilledItem);
126
125
  }
127
126
  handleAddExpression() {
128
127
  const newItem = {
@@ -211,7 +210,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
211
210
  }
212
211
  canAddGroup() {
213
212
  const dataGroupLevel = Number(this.getDataGroupLevel() || this.FIRST_LEVEL);
214
- return dataGroupLevel < LIMIT_GROUP_LEVEL;
213
+ return dataGroupLevel < this.LIMIT_GROUP_LEVEL;
215
214
  }
216
215
  isFirstLevel() {
217
216
  return Boolean(this.getDataGroupLevel() === this.FIRST_LEVEL);
@@ -220,7 +219,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
220
219
  evt.preventDefault();
221
220
  evt.stopPropagation();
222
221
  }
223
- handleMessageAddTooltip() {
222
+ getMessageAddTooltip() {
224
223
  if (this.isFirstLevel()) {
225
224
  const allValidItems = this.group.items.every(item => {
226
225
  if (!item.fieldName || !item.operand)
@@ -239,7 +238,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
239
238
  }
240
239
  render() {
241
240
  const canAddGroup = this.canAddGroup();
242
- return (h(Host, null, h("div", { class: !this.isFirstLevel() && this._showDashes ? 'dashes' : 'hidden', style: this.buildGroupStyle() }), h("div", { class: !this.isFirstLevel() && this._showDashes ? 'horizontal-dashes' : 'hidden' }), h("div", { class: 'ez-flex ez-flex--align-items-center' }, h("div", { class: 'snk-expression-group__container-condition ez-flex ez-flex-item--align-center ez-flex--align-items-center', "data-condition": this._conditionOperator, title: this.getTooltipMessageForOperator() }, h("label", { class: "ez-label ez-padding-right--medium ez-padding-left--medium ez-title--primary" }, "Condi\u00E7\u00E3o:"), h("div", null, h("ez-combo-box", Object.assign({ class: "snk-expression-group__container-option", canShowError: false, mode: "slim", suppressEmptyOption: true, enabled: this.canChangeGroupCondition(), value: this._conditionOperator, onEzChange: (evt) => this.handleConditionOperatorChange(evt.detail.value) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxConditions_level_${this.getDataGroupLevel()}` }), h("option", { value: FilterGroupCondition.AND }, "E"), h("option", { value: FilterGroupCondition.OR }, "OU")))), h("ez-button", { class: "ez-padding-right--medium ez-padding-left--medium", mode: "icon", iconName: "plus", size: "small", enabled: this.canAddExpression, title: this.handleMessageAddTooltip(), onClick: () => this.handleAddExpression() }), h("ez-button", { label: "Adicionar grupo", size: "small", enabled: canAddGroup, title: !canAddGroup ? this.getMessage('snkPersonalizedFilter.info.labelDisabledAddGroupButton', { LIMIT_GROUP_LEVEL: LIMIT_GROUP_LEVEL + 1 }) : '', onClick: () => this.handleAddGroup() }, h("ez-icon", { slot: "leftIcon", iconName: "plus" })), !this.isFirstLevel() && h("ez-button", { title: this.getMessage("snkPersonalizedFilter.info.labelDeleteExpression"), class: "ez-padding-left--medium", mode: "icon", iconName: "delete", size: "small", onClick: (evt) => this.confirmRemoveGroup(evt) })), h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, h("div", { class: "ez-padding-top--small" }, this.renderExpressionItems())), h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, h("div", { class: "ez-padding-top--small" }, this.renderGroups()))));
241
+ return (h(Host, null, h("div", { class: !this.isFirstLevel() && this._showDashes ? 'dashes' : 'hidden', style: this.buildGroupStyle() }), h("div", { class: !this.isFirstLevel() && this._showDashes ? 'horizontal-dashes' : 'hidden' }), h("div", { class: 'ez-flex ez-flex--align-items-center' }, h("div", { class: 'snk-expression-group__container-condition ez-flex ez-flex-item--align-center ez-flex--align-items-center', "data-condition": this._conditionOperator, title: this.getTooltipMessageForOperator() }, h("label", { class: "ez-label ez-padding-right--medium ez-padding-left--medium ez-title--primary" }, this.getMessage("snkPersonalizedFilter.info.condition")), h("div", null, h("ez-combo-box", Object.assign({ class: "snk-expression-group__container-option", canShowError: false, mode: "slim", suppressEmptyOption: true, enabled: this.canChangeGroupCondition(), value: this._conditionOperator, onEzChange: (evt) => this.handleConditionOperatorChange(evt.detail.value) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxConditions_level_${this.getDataGroupLevel()}` }), h("option", { value: FilterGroupCondition.AND }, "E"), h("option", { value: FilterGroupCondition.OR }, "OU")))), h("ez-button", { class: "ez-padding-right--medium ez-padding-left--medium", mode: "icon", iconName: "plus", size: "small", enabled: this.canAddExpression, title: this.getMessageAddTooltip(), onClick: () => this.handleAddExpression() }), h("ez-button", { label: this.getMessage("snkPersonalizedFilter.info.addGroup"), size: "small", enabled: canAddGroup, title: !canAddGroup ? this.getMessage('snkPersonalizedFilter.info.labelDisabledAddGroupButton', { LIMIT_GROUP_LEVEL: this.LIMIT_GROUP_LEVEL + 1 }) : '', onClick: () => this.handleAddGroup() }, h("ez-icon", { slot: "leftIcon", iconName: "plus" })), !this.isFirstLevel() && h("ez-button", { title: this.getMessage("snkPersonalizedFilter.info.labelDeleteExpression"), class: "ez-padding-left--medium", mode: "icon", iconName: "delete", size: "small", onClick: (evt) => this.confirmRemoveGroup(evt) })), h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, h("div", { class: "ez-padding-top--small" }, this.renderExpressionItems())), h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, h("div", { class: "ez-padding-top--small" }, this.renderGroups()))));
243
242
  }
244
243
  get _element() { return this; }
245
244
  static get watchers() { return {
@@ -293,4 +292,4 @@ function defineCustomElement() {
293
292
  } });
294
293
  }
295
294
 
296
- export { FilterGroupCondition as F, SnkExpressionGroup as S, defineCustomElement as d };
295
+ export { SnkExpressionGroup as S, defineCustomElement as d };
@@ -3,7 +3,7 @@ import { UserInterface, ApplicationContext, ElementIDUtils } from '@sankhyalabs/
3
3
  import { a as SelectedItemType, d as defineCustomElement$2 } from './snk-filter-field-search2.js';
4
4
  import { ApplicationUtils, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { fieldBuilder } from '@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder';
6
- import { F as FilterOperand } from './index2.js';
6
+ import { a as FilterOperand } from './PersonalizedFilterUtils.js';
7
7
  import { s as store } from './index3.js';
8
8
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
9
9
  import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';
@@ -36,7 +36,6 @@ const FIELD_TYPE_SEARCH_AND_TEXT = [
36
36
 
37
37
  const snkExpressionItemCss = ".sc-snk-expression-item-h{display:flex;width:100%;--snk-expression-item--background-color:var(--background--xlight, #fff);--snk-expression-item__itens--padding:var(--space--small, 6px);--snk-expression-item__width--input-operator:220px;--snk-expression-item__width--input-value:240px;--snk-expression-item__width--input-value-variable:176px;--snk-expression-item--border-radius:var(--border--radius-medium, 12px);--snk-expression-item--border-color:var(--color--strokes, #DCE0E8);--snk-expression-item--border-style:var(--border--small, 1px solid);--snk-expression-item__background-color-dashed:var(--background--body, #fafcff)}.box.sc-snk-expression-item{width:100%;height:56px;background:var(--snk-expression-item--background-color);border:var(--snk-expression-item--border-color) var(--snk-expression-item--border-style);border-radius:var(--snk-expression-item--border-radius)}.box__container.sc-snk-expression-item{display:flex;align-items:center;justify-content:space-between;white-space:nowrap;margin:var(--space--small, 6px)}.box__container--input-filter.sc-snk-expression-item{width:100%}.box__container--input-operator.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-operator);min-width:var(--snk-expression-item__width--input-operator)}.box__container--input-value.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value);min-width:var(--snk-expression-item__width--input-value)}.box__container--input-value-variable.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value-variable);min-width:var(--snk-expression-item__width--input-value-variable)}.box__container--button-delete.sc-snk-expression-item{display:flex}.box__container.sc-snk-expression-item>div.sc-snk-expression-item{padding-left:var(--snk-expression-item__itens--padding);padding-right:var(--snk-expression-item__itens--padding)}.box__container--button-delete--icon.sc-snk-expression-item{width:42px;min-width:42px}.box__container--input-value-variable--icon.sc-snk-expression-item{cursor:pointer}.dashes.sc-snk-expression-item{z-index:var(--more-visible, 2);background:var(--snk-expression-item__background-color-dashed);border-bottom:2px dashed var(--text-secondary, #A2ABB9);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:62px;margin-left:-15px;margin-top:-33.5px}";
38
38
 
39
- const DEFAULT_FIELD_NAME = 'NOT_DEFINED';
40
39
  const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
41
40
  constructor() {
42
41
  super();
@@ -46,6 +45,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
46
45
  this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
47
46
  this.filterOperandDefault = FilterOperandDefault;
48
47
  this.filterOperandTypeTextSearch = FilterOperandTypeTextSearch;
48
+ this.DEFAULT_FIELD_NAME = 'NOT_DEFINED';
49
49
  this._showValueVariable = false;
50
50
  this._fieldSelected = undefined;
51
51
  this._optionNotNull = false;
@@ -230,7 +230,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
230
230
  if (this._optionNotNull && inputFieldData || ((_b = this._elValueVariable) === null || _b === void 0 ? void 0 : _b.value) && inputFieldData || this.expression.paramVariable || this._showValueVariable || !((_c = this._fieldSelected) === null || _c === void 0 ? void 0 : _c.dataType)) {
231
231
  inputFieldData.$attrs$.enabled = false;
232
232
  }
233
- if (this.expression.value) {
233
+ if (this.expression.value != undefined) {
234
234
  inputFieldData.$attrs$.value = this.getExpressiontValue(this.expression);
235
235
  }
236
236
  inputFieldData.$attrs$.onEzChange = (event) => {
@@ -285,7 +285,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
285
285
  }
286
286
  render() {
287
287
  var _a;
288
- return (h(Host, null, h("div", { class: "dashes" }), h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", Object.assign({ ref: ref => this._elFilterInput = ref, value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `expressionFilterInput_${this.expression.fieldName || DEFAULT_FIELD_NAME}` })), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", Object.assign({ label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), value: this.expression.operand, canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => { var _a; return this.handleChangeOperator((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, suppressEmptyOption: true }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxOperand_${this.expression.fieldName || DEFAULT_FIELD_NAME}` }))), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
288
+ return (h(Host, null, h("div", { class: "dashes" }), h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", Object.assign({ ref: ref => this._elFilterInput = ref, value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `expressionFilterInput_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` })), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", Object.assign({ label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), value: this.expression.operand, canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => { var _a; return this.handleChangeOperator((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, suppressEmptyOption: true }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxOperand_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` }))), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
289
289
  h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
290
290
  this.buildFieldByType()), h("div", { class: "box__container--input-value-variable" }, !this._optionNotNull &&
291
291
  h("ez-check", { ref: ref => this._elValueVariable = ref, value: this.expression.paramVariable, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
@@ -4,9 +4,8 @@ import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/
4
4
  import { C as ConfigStorage } from './ConfigStorage.js';
5
5
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
6
6
  import { F as FilterItemType } from './filter-item-type.enum.js';
7
- import { F as FilterOperand } from './index2.js';
7
+ import { a as FilterOperand, P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
8
8
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
9
- import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
10
9
  import { d as defineCustomElement$8 } from './snk-expression-group2.js';
11
10
  import { d as defineCustomElement$7 } from './snk-expression-item2.js';
12
11
  import { d as defineCustomElement$6 } from './snk-filter-detail2.js';
@@ -271,13 +270,12 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
271
270
  this.processAfterUpdateConfig();
272
271
  }
273
272
  }
273
+ getPersonalizedFilterItem() {
274
+ return this.filterConfig.find(item => item.type === FilterItemType.PERSONALIZED);
275
+ }
274
276
  async processAfterUpdateConfig() {
275
277
  if (this._loadingPending) {
276
- const personalizedFilter = this.filterConfig.find(item => {
277
- if (item.type === FilterItemType.PERSONALIZED) {
278
- return true;
279
- }
280
- });
278
+ const personalizedFilter = this.getPersonalizedFilterItem();
281
279
  this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
282
280
  if (this._pendingVariables) {
283
281
  return;
@@ -51,12 +51,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
51
51
  return { tag: "snk-filter-number" };
52
52
  case FilterItemType.PERSONALIZED:
53
53
  const snkFilterPersonalizedProps = {
54
- tag: "snk-filter-personalized", props: {
54
+ tag: "snk-personalized-filter-editor", props: {
55
55
  presentationMode: EPresentationMode.CHIP,
56
- onValueChanged: ({ detail }) => {
57
- const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
58
- this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
59
- }
56
+ onValueChanged: evt => this.handleValueChanged(evt),
60
57
  }
61
58
  };
62
59
  return snkFilterPersonalizedProps;
@@ -65,6 +62,10 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
65
62
  }
66
63
  return { tag: "snk-filter-text" };
67
64
  }
65
+ handleValueChanged({ detail }) {
66
+ const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
67
+ this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
68
+ }
68
69
  removeItem() {
69
70
  const hasMultiValues = this.config.type === FilterItemType.MULTI_LIST && Array.isArray(this.config.value);
70
71
  const newValue = hasMultiValues ? this.config.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
@@ -74,6 +75,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
74
75
  }
75
76
  this.changeConfig(removedConfig);
76
77
  }
78
+ removeItemFromGroup(item) {
79
+ return Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined });
80
+ }
77
81
  getPopUpHeaderButtons() {
78
82
  return (h(Fragment, null, !this.config.removalBlocked && this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), !this.config.hardFixed && this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))));
79
83
  }
@@ -39,7 +39,6 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
39
39
  super();
40
40
  this.__registerHost();
41
41
  this.ezSelectFilterItem = createEvent(this, "ezSelectFilterItem", 7);
42
- this._filterMetadataStorage = new Map();
43
42
  this._currentMetadata = null;
44
43
  this._filterText = "";
45
44
  this._isLoading = false;
@@ -82,15 +81,8 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
82
81
  async loadData() {
83
82
  var _a, _b;
84
83
  this._isLoading = true;
85
- let metadata;
86
- if (this._currentLink != undefined) {
87
- metadata = this._filterMetadataStorage.get(this._currentLink.uri);
88
- }
89
- if (!metadata) {
90
- metadata = await this.fieldsDataSource.fetchData(this._currentLink);
91
- this._currentLink = metadata.currentLink;
92
- this._filterMetadataStorage.set(this._currentLink.uri, metadata);
93
- }
84
+ let metadata = await this.fieldsDataSource.fetchData(this._currentLink);
85
+ this._currentLink = metadata.currentLink;
94
86
  const { fields, links } = metadata || {};
95
87
  if (!Array.isArray(fields) || !Array.isArray(links))
96
88
  throw new Error('Invalid metadata');
@@ -143,7 +135,6 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
143
135
  if (this._isLoading)
144
136
  return;
145
137
  const breadcrumbByIndex = this.breadcrumbItems.findIndex(breadcrumbItem => breadcrumbItem.id === item.id);
146
- item.cache = this._filterMetadataStorage.has(item.uri);
147
138
  if (breadcrumbByIndex > -1) {
148
139
  this.breadcrumbItems = this.breadcrumbItems.slice(0, (breadcrumbByIndex + 1));
149
140
  }
@@ -195,7 +186,6 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
195
186
  }
196
187
  disconnectedCallback() {
197
188
  var _a;
198
- this._filterMetadataStorage.clear();
199
189
  (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
200
190
  }
201
191
  render() {
@@ -183,11 +183,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
183
183
  return `${label}: ${value.value} - ${value.label}`;
184
184
  }
185
185
  if (type === FilterItemType.PERSONALIZED) {
186
- const activeCount = groupedItems.reduce((total, item) => {
187
- if (!!item.visible)
188
- return total + 1;
189
- return total;
190
- }, 0);
186
+ const activeCount = this.calculateActiveCount(groupedItems);
191
187
  if (activeCount <= 0)
192
188
  return label;
193
189
  return `${label}: ${this.getMessage('snkFilterBar.personalizedCount', { activeCount })}`;
@@ -211,6 +207,13 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
211
207
  }
212
208
  return label;
213
209
  }
210
+ calculateActiveCount(groupedItems) {
211
+ return groupedItems.reduce((total, item) => {
212
+ if (!!item.visible)
213
+ return total + 1;
214
+ return total;
215
+ }, 0);
216
+ }
214
217
  applyTooltip() {
215
218
  if (!this.config.value)
216
219
  return undefined;
@@ -259,13 +262,19 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
259
262
  }
260
263
  return undefined;
261
264
  }
265
+ hasActiveElements(value) {
266
+ var _a, _b, _c;
267
+ return ((_c = (_b = ((_a = value === null || value === void 0 ? void 0 : value.elements) !== null && _a !== void 0 ? _a : value)) === null || _b === void 0 ? void 0 : _b.filter(val => val === null || val === void 0 ? void 0 : val.check)) === null || _c === void 0 ? void 0 : _c.length) > 0;
268
+ }
269
+ hasActiveValue(config) {
270
+ return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
271
+ }
262
272
  getEnabledChip() {
263
- var _a, _b, _c, _d;
264
273
  if (this.config.type === FilterItemType.PERSONALIZED) {
265
274
  const { groupedItems = [] } = this.config;
266
275
  return groupedItems.some(item => item.visible);
267
276
  }
268
- return (FilterItemType.MULTI_LIST != this.config.type && this.config.value != undefined) || (((_d = (_c = ((_b = (_a = this.config.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : this.config.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) > 0);
277
+ return this.hasActiveValue(this.config);
269
278
  }
270
279
  render() {
271
280
  const leftIcon = this.getLeftIconName();
@@ -46,19 +46,21 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
46
46
  case FilterItemType.NUMBER:
47
47
  return { tag: "snk-filter-number" };
48
48
  case FilterItemType.PERSONALIZED:
49
- const snkFilterPersonalizedProps = {
50
- tag: "snk-filter-personalized", props: {
51
- onDeleteFilter: (event) => this.handleDeleteFilter(event.detail, FilterItemType.PERSONALIZED),
52
- onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
53
- onAddFilter: () => this.addPersonalizedFilter.emit(),
54
- }
55
- };
56
- return snkFilterPersonalizedProps;
49
+ return this.buildSnkFilterPersonalizedProps();
57
50
  case FilterItemType.MULTI_LIST:
58
51
  return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
59
52
  }
60
53
  return { tag: "snk-filter-text" };
61
54
  }
55
+ buildSnkFilterPersonalizedProps() {
56
+ return {
57
+ tag: "snk-personalized-filter-editor", props: {
58
+ onDeleteFilter: (event) => this.handleDeleteFilter(event.detail, FilterItemType.PERSONALIZED),
59
+ onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
60
+ onAddFilter: () => this.addPersonalizedFilter.emit(),
61
+ }
62
+ };
63
+ }
62
64
  isVisible(newValue) {
63
65
  return !this.filterItem.visible ? newValue !== undefined : true;
64
66
  }
@@ -71,7 +71,7 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
71
71
  });
72
72
  }
73
73
  handleClose() {
74
- const hasChangesToSave = JSON.stringify(this.filters) !== JSON.stringify(this._originalFilterConfig);
74
+ const hasChangesToSave = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this._originalFilterConfig);
75
75
  if (!hasChangesToSave) {
76
76
  this.closeModal();
77
77
  return;
@@ -81,13 +81,19 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
81
81
  this.closeModal();
82
82
  });
83
83
  }
84
- validatePersonalizedFilter() {
84
+ handleApplyFilters() {
85
85
  const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER);
86
+ if (this.isValidCustomFilter(filterPersonalized)) {
87
+ this.applyFilters(this.filters);
88
+ }
89
+ }
90
+ isValidCustomFilter(filterPersonalized) {
86
91
  const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
87
92
  if (!isValid) {
88
- return ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
93
+ ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
94
+ return false;
89
95
  }
90
- this.applyFilters(this.filters);
96
+ return true;
91
97
  }
92
98
  modalActionListener(evt) {
93
99
  const modalAction = evt.detail;
@@ -96,7 +102,7 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
96
102
  this.handleClearAll();
97
103
  break;
98
104
  case ModalAction.OK:
99
- this.validatePersonalizedFilter();
105
+ this.handleApplyFilters();
100
106
  break;
101
107
  case ModalAction.CLOSE:
102
108
  this.handleClose();