@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
@@ -31,19 +31,21 @@ export class SnkFilterModalItem {
31
31
  case FilterItemType.NUMBER:
32
32
  return { tag: "snk-filter-number" };
33
33
  case FilterItemType.PERSONALIZED:
34
- const snkFilterPersonalizedProps = {
35
- tag: "snk-filter-personalized", props: {
36
- onDeleteFilter: (event) => this.handleDeleteFilter(event.detail, FilterItemType.PERSONALIZED),
37
- onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
38
- onAddFilter: () => this.addPersonalizedFilter.emit(),
39
- }
40
- };
41
- return snkFilterPersonalizedProps;
34
+ return this.buildSnkFilterPersonalizedProps();
42
35
  case FilterItemType.MULTI_LIST:
43
36
  return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
44
37
  }
45
38
  return { tag: "snk-filter-text" };
46
39
  }
40
+ buildSnkFilterPersonalizedProps() {
41
+ return {
42
+ tag: "snk-personalized-filter-editor", props: {
43
+ onDeleteFilter: (event) => this.handleDeleteFilter(event.detail, FilterItemType.PERSONALIZED),
44
+ onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
45
+ onAddFilter: () => this.addPersonalizedFilter.emit(),
46
+ }
47
+ };
48
+ }
47
49
  isVisible(newValue) {
48
50
  return !this.filterItem.visible ? newValue !== undefined : true;
49
51
  }
@@ -92,13 +92,12 @@ export class SnkFilterBar {
92
92
  this.processAfterUpdateConfig();
93
93
  }
94
94
  }
95
+ getPersonalizedFilterItem() {
96
+ return this.filterConfig.find(item => item.type === FilterItemType.PERSONALIZED);
97
+ }
95
98
  async processAfterUpdateConfig() {
96
99
  if (this._loadingPending) {
97
- const personalizedFilter = this.filterConfig.find(item => {
98
- if (item.type === FilterItemType.PERSONALIZED) {
99
- return true;
100
- }
101
- });
100
+ const personalizedFilter = this.getPersonalizedFilterItem();
102
101
  this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
103
102
  if (this._pendingVariables) {
104
103
  return;
@@ -6,7 +6,6 @@ const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
6
6
  const ENTITY_NAME_PATTERN = /\w+:\/\/(\w+)/;
7
7
  export class SnkFilterFieldSearch {
8
8
  constructor() {
9
- this._filterMetadataStorage = new Map();
10
9
  this._currentMetadata = null;
11
10
  this._filterText = "";
12
11
  this._isLoading = false;
@@ -49,15 +48,8 @@ export class SnkFilterFieldSearch {
49
48
  async loadData() {
50
49
  var _a, _b;
51
50
  this._isLoading = true;
52
- let metadata;
53
- if (this._currentLink != undefined) {
54
- metadata = this._filterMetadataStorage.get(this._currentLink.uri);
55
- }
56
- if (!metadata) {
57
- metadata = await this.fieldsDataSource.fetchData(this._currentLink);
58
- this._currentLink = metadata.currentLink;
59
- this._filterMetadataStorage.set(this._currentLink.uri, metadata);
60
- }
51
+ let metadata = await this.fieldsDataSource.fetchData(this._currentLink);
52
+ this._currentLink = metadata.currentLink;
61
53
  const { fields, links } = metadata || {};
62
54
  if (!Array.isArray(fields) || !Array.isArray(links))
63
55
  throw new Error('Invalid metadata');
@@ -110,7 +102,6 @@ export class SnkFilterFieldSearch {
110
102
  if (this._isLoading)
111
103
  return;
112
104
  const breadcrumbByIndex = this.breadcrumbItems.findIndex(breadcrumbItem => breadcrumbItem.id === item.id);
113
- item.cache = this._filterMetadataStorage.has(item.uri);
114
105
  if (breadcrumbByIndex > -1) {
115
106
  this.breadcrumbItems = this.breadcrumbItems.slice(0, (breadcrumbByIndex + 1));
116
107
  }
@@ -162,7 +153,6 @@ export class SnkFilterFieldSearch {
162
153
  }
163
154
  disconnectedCallback() {
164
155
  var _a;
165
- this._filterMetadataStorage.clear();
166
156
  (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
167
157
  }
168
158
  render() {
@@ -0,0 +1,39 @@
1
+ export * from './IExpressionItem';
2
+ export * from './ISystemFilterConfig';
3
+ export * from './IUserFilterConfig';
4
+ export var FilterConfigType;
5
+ (function (FilterConfigType) {
6
+ FilterConfigType["SYSTEM_CONFIG"] = "S";
7
+ FilterConfigType["USER_CONFIG"] = "E";
8
+ })(FilterConfigType || (FilterConfigType = {}));
9
+ export var FilterUserConfigTypes;
10
+ (function (FilterUserConfigTypes) {
11
+ FilterUserConfigTypes["DATE"] = "D";
12
+ FilterUserConfigTypes["HORA"] = "H";
13
+ FilterUserConfigTypes["TEXT"] = "S";
14
+ FilterUserConfigTypes["INTEGER"] = "I";
15
+ FilterUserConfigTypes["DECIMAL"] = "F";
16
+ FilterUserConfigTypes["NUMBER"] = "NUMBER";
17
+ })(FilterUserConfigTypes || (FilterUserConfigTypes = {}));
18
+ export var FilterOperand;
19
+ (function (FilterOperand) {
20
+ FilterOperand["AND"] = "AND";
21
+ FilterOperand["OR"] = "OR";
22
+ FilterOperand["IN"] = "IN";
23
+ FilterOperand["DIFFERENT"] = "<>";
24
+ FilterOperand["LIKE"] = "LIKE";
25
+ FilterOperand["START_WITH"] = "LIKE_START";
26
+ FilterOperand["FINISHED_WITH"] = "LIKE_END";
27
+ FilterOperand["NULL"] = "NULL";
28
+ FilterOperand["NOT_NULL"] = "NOT NULL";
29
+ FilterOperand["EQUAL"] = "=";
30
+ FilterOperand["LARGER"] = ">";
31
+ FilterOperand["LARGER_EQUAL"] = ">=";
32
+ FilterOperand["SMALLER"] = "<";
33
+ FilterOperand["SMALLER_EQUAL"] = "<=";
34
+ })(FilterOperand || (FilterOperand = {}));
35
+ export var FilterEntities;
36
+ (function (FilterEntities) {
37
+ FilterEntities["FIELD"] = "Campo";
38
+ FilterEntities["INSTANCE"] = "Instancia";
39
+ })(FilterEntities || (FilterEntities = {}));
@@ -4,19 +4,24 @@ import { PersonalizedFilterUtils } from './subcomponents/snk-filter-param-config
4
4
  import { ConfigStorage } from "../../lib/configs/ConfigStorage";
5
5
  import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
6
6
  import { ObjectUtils } from "@sankhyalabs/core";
7
- import { FilterGroupCondition } from './subcomponents/snk-filter-param-config/interfaces/IExpressionItem';
7
+ import { FilterGroupCondition } from './interfaces/IExpressionItem';
8
8
  import store from '../../lib/store';
9
9
  import PersonalizedFilterFetcher from "../../lib/http/data-fetcher/fetchers/personalized-filter-fetcher";
10
10
  export class SnkPersonalizedFilter {
11
11
  constructor() {
12
12
  this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
13
+ this._filterMetadataStorage = new Map();
13
14
  this._dataSourceFetcher = {
14
15
  fetchData: async (entity) => {
15
16
  let entityURI = entity === null || entity === void 0 ? void 0 : entity.uri;
16
17
  if (StringUtils.isEmpty(entityURI)) {
17
18
  entityURI = this.entityUri;
18
19
  }
19
- return await this._personalizedFilterFetcher.loadFields(entityURI);
20
+ if (!this._filterMetadataStorage.has(entityURI)) {
21
+ const filterMetadata = await this._personalizedFilterFetcher.loadFields(entityURI);
22
+ this._filterMetadataStorage.set(entityURI, filterMetadata);
23
+ }
24
+ return this._filterMetadataStorage.get(entityURI);
20
25
  }
21
26
  };
22
27
  this._filterAssistentMode = true;
@@ -129,11 +134,11 @@ export class SnkPersonalizedFilter {
129
134
  ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"), this.getMessage("snkPersonalizedFilter.confirmCancel.description"))
130
135
  .then((canCancel) => {
131
136
  var _a;
132
- if (canCancel) {
133
- this._filterAssistent = ObjectUtils.copy((_a = this._originalFilterAssistent) !== null && _a !== void 0 ? _a : {});
134
- this.ezCancel.emit();
135
- this._elButtonSave.enabled = false;
136
- }
137
+ if (!canCancel)
138
+ return;
139
+ this._filterAssistent = ObjectUtils.copy((_a = this._originalFilterAssistent) !== null && _a !== void 0 ? _a : {});
140
+ this.ezCancel.emit();
141
+ this._elButtonSave.enabled = false;
137
142
  });
138
143
  }
139
144
  handleTitleChange(name) {
@@ -166,14 +171,21 @@ export class SnkPersonalizedFilter {
166
171
  }
167
172
  return (h("div", { class: "ez-flex" }, h("ez-alert", { alertType: "warn" }, this._filterAssistent.warningMessage)));
168
173
  }
174
+ buildContainerPersonalizedFilter() {
175
+ var _a, _b, _c;
176
+ if (this._filterAssistentMode) {
177
+ return (h(Fragment, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri })), h("div", null, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container" }, h("ez-text-area", { ref: (el) => this._elTextAreaExpression = el, enabled: false, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.expression })))))));
178
+ }
179
+ else {
180
+ return (h(Fragment, null, h("span", { class: "ez-text ez-text--small ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkPersonalizedFilter.info.applyExpression")), h("ez-text-area", { label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.expression, onEzChange: (evt) => this.handleExpressionChange(evt.detail) }), this.getWarningMessageComponent()));
181
+ }
182
+ }
169
183
  render() {
170
- var _a, _b, _c, _d, _e;
184
+ var _a, _b;
171
185
  if (!((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent) && this._filterAssistentMode) {
172
186
  return;
173
187
  }
174
- return (h(Host, null, h("div", { class: "snk-personalized-filter" }, h("div", null, h("snk-simple-bar", { label: this.filterId ? this.getMessage("snkPersonalizedFilter.info.titleEdit") : this.getMessage("snkPersonalizedFilter.info.titleAdd"), onExit: () => this.handleCancel() }, h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, h("ez-button", { size: "small", label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), h("ez-button", { size: "small", ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, h("div", { class: "ez-box__container" }, h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, h("div", { class: "ez-flex" }, h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail) })), this._filterAssistentMode ?
175
- h(Fragment, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri })), h("div", null, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container" }, h("ez-text-area", { ref: (el) => this._elTextAreaExpression = el, enabled: false, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_d = this._filterAssistent) === null || _d === void 0 ? void 0 : _d.expression })))))) :
176
- h(Fragment, null, h("span", { class: "ez-text ez-text--small ez-text--bold ez-padding-bottom--medium" }, "Express\u00E3o a ser aplicada:"), h("ez-text-area", { label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_e = this._filterAssistent) === null || _e === void 0 ? void 0 : _e.expression, onEzChange: (evt) => this.handleExpressionChange(evt.detail) }), this.getWarningMessageComponent())))))));
188
+ return (h(Host, null, h("div", { class: "snk-personalized-filter" }, h("div", null, h("snk-simple-bar", { label: this.filterId ? this.getMessage("snkPersonalizedFilter.info.titleEdit") : this.getMessage("snkPersonalizedFilter.info.titleAdd"), onExit: () => this.handleCancel() }, h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, h("ez-button", { size: "small", label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), h("ez-button", { size: "small", ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, h("div", { class: "ez-box__container" }, h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, h("div", { class: "ez-flex" }, h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail) })), this.buildContainerPersonalizedFilter()))))));
177
189
  }
178
190
  static get is() { return "snk-personalized-filter"; }
179
191
  static get encapsulation() { return "scoped"; }
@@ -313,7 +325,7 @@ export class SnkPersonalizedFilter {
313
325
  },
314
326
  "IPersonalizedFilter": {
315
327
  "location": "import",
316
- "path": "./subcomponents/snk-filter-param-config/interfaces/IPersonalizedFilter"
328
+ "path": "./interfaces/IPersonalizedFilter"
317
329
  }
318
330
  },
319
331
  "return": "Promise<void>"
@@ -1,11 +1,11 @@
1
1
  import { h, Host, forceUpdate } from '@stencil/core';
2
- import { FilterGroupCondition } from '../../subcomponents/snk-filter-param-config/interfaces/IExpressionItem';
2
+ import { FilterGroupCondition } from '../../interfaces/IExpressionItem';
3
3
  import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
4
4
  import { ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
5
- const LIMIT_GROUP_LEVEL = 4;
6
5
  export class SnkExpressionGroup {
7
6
  constructor() {
8
7
  this.FIRST_LEVEL = "0";
8
+ this.LIMIT_GROUP_LEVEL = 4;
9
9
  this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
10
10
  this._conditionOperator = FilterGroupCondition.AND;
11
11
  this._group = undefined;
@@ -32,11 +32,11 @@ export class SnkExpressionGroup {
32
32
  }
33
33
  watchGroup(newValue) {
34
34
  this._group = newValue;
35
- this._conditionOperator = !this._group.operand ? FilterGroupCondition.AND : this._group.operand;
35
+ this._conditionOperator = this.getOperand();
36
36
  }
37
37
  componentWillLoad() {
38
38
  this._group = this.group;
39
- this._conditionOperator = !this._group.operand ? FilterGroupCondition.AND : this._group.operand;
39
+ this._conditionOperator = this.getOperand();
40
40
  if (!this.getDataGroupLevel()) {
41
41
  this._element.setAttribute('data-group-level', this.FIRST_LEVEL);
42
42
  }
@@ -62,6 +62,9 @@ export class SnkExpressionGroup {
62
62
  getDashedHeight() {
63
63
  return this._selfTop - this.parentTop;
64
64
  }
65
+ getOperand() {
66
+ return !this._group.operand ? FilterGroupCondition.AND : this._group.operand;
67
+ }
65
68
  getMessage(key, params) {
66
69
  return this.application.messagesBuilder.getMessage(key, params);
67
70
  }
@@ -95,18 +98,19 @@ export class SnkExpressionGroup {
95
98
  this.changeHandler();
96
99
  this.canAddExpression = true;
97
100
  }
101
+ isFilledItem(item) {
102
+ if (!item.fieldName || !item.operand)
103
+ return false;
104
+ if (item.operand === 'NULL' || item.operand === 'NOT_NULL') {
105
+ return true;
106
+ }
107
+ else {
108
+ return item.paramVariable || (item.userInterface === 'SWITCH') ? true : !!item.value;
109
+ }
110
+ }
98
111
  handleFilterItemChange() {
99
112
  this.ezFilterGroupChange.emit(this._group);
100
- this.canAddExpression = this.group.items.every(item => {
101
- if (!item.fieldName || !item.operand)
102
- return false;
103
- if (item.operand === 'NULL' || item.operand === 'NOT_NULL') {
104
- return true;
105
- }
106
- else {
107
- return item.paramVariable || (item.userInterface === 'SWITCH') ? true : !!item.value;
108
- }
109
- });
113
+ this.canAddExpression = this.group.items.every(this.isFilledItem);
110
114
  }
111
115
  handleAddExpression() {
112
116
  const newItem = {
@@ -195,7 +199,7 @@ export class SnkExpressionGroup {
195
199
  }
196
200
  canAddGroup() {
197
201
  const dataGroupLevel = Number(this.getDataGroupLevel() || this.FIRST_LEVEL);
198
- return dataGroupLevel < LIMIT_GROUP_LEVEL;
202
+ return dataGroupLevel < this.LIMIT_GROUP_LEVEL;
199
203
  }
200
204
  isFirstLevel() {
201
205
  return Boolean(this.getDataGroupLevel() === this.FIRST_LEVEL);
@@ -204,7 +208,7 @@ export class SnkExpressionGroup {
204
208
  evt.preventDefault();
205
209
  evt.stopPropagation();
206
210
  }
207
- handleMessageAddTooltip() {
211
+ getMessageAddTooltip() {
208
212
  if (this.isFirstLevel()) {
209
213
  const allValidItems = this.group.items.every(item => {
210
214
  if (!item.fieldName || !item.operand)
@@ -223,7 +227,7 @@ export class SnkExpressionGroup {
223
227
  }
224
228
  render() {
225
229
  const canAddGroup = this.canAddGroup();
226
- 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()))));
230
+ 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()))));
227
231
  }
228
232
  static get is() { return "snk-expression-group"; }
229
233
  static get encapsulation() { return "scoped"; }
@@ -266,7 +270,7 @@ export class SnkExpressionGroup {
266
270
  "references": {
267
271
  "IExpressionGroup": {
268
272
  "location": "import",
269
- "path": "../../subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
273
+ "path": "../../interfaces/IExpressionItem"
270
274
  }
271
275
  }
272
276
  },
@@ -359,7 +363,7 @@ export class SnkExpressionGroup {
359
363
  "references": {
360
364
  "IExpressionGroup": {
361
365
  "location": "import",
362
- "path": "../../subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
366
+ "path": "../../interfaces/IExpressionItem"
363
367
  }
364
368
  }
365
369
  }
@@ -379,7 +383,7 @@ export class SnkExpressionGroup {
379
383
  "references": {
380
384
  "IExpressionGroup": {
381
385
  "location": "import",
382
- "path": "../../subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
386
+ "path": "../../interfaces/IExpressionItem"
383
387
  }
384
388
  }
385
389
  }
@@ -412,7 +416,7 @@ export class SnkExpressionGroup {
412
416
  },
413
417
  "IExpressionGroup": {
414
418
  "location": "import",
415
- "path": "../../subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
419
+ "path": "../../interfaces/IExpressionItem"
416
420
  }
417
421
  },
418
422
  "return": "Promise<IExpressionGroup>"
@@ -3,16 +3,16 @@ import { ApplicationContext, ElementIDUtils, UserInterface } from '@sankhyalabs/
3
3
  import { SelectedItemType } from "../../../snk-filter-field-search/interfaces";
4
4
  import { CheckMode, ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
5
5
  import { fieldBuilder } from "@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder";
6
- import { FilterOperand } from '../../../../lib/@types';
6
+ import { FilterOperand } from '../../interfaces/index';
7
7
  import { FilterOperandDefault, FilterOperandTypeTextSearch, FIELD_TYPE_SEARCH_AND_TEXT } from "./filter-operands/filter-operands";
8
8
  import store from '../../../../lib/store';
9
9
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
10
- const DEFAULT_FIELD_NAME = 'NOT_DEFINED';
11
10
  export class SnkExpressionItem {
12
11
  constructor() {
13
12
  this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
14
13
  this.filterOperandDefault = FilterOperandDefault;
15
14
  this.filterOperandTypeTextSearch = FilterOperandTypeTextSearch;
15
+ this.DEFAULT_FIELD_NAME = 'NOT_DEFINED';
16
16
  this._showValueVariable = false;
17
17
  this._fieldSelected = undefined;
18
18
  this._optionNotNull = false;
@@ -197,7 +197,7 @@ export class SnkExpressionItem {
197
197
  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)) {
198
198
  inputFieldData.$attrs$.enabled = false;
199
199
  }
200
- if (this.expression.value) {
200
+ if (this.expression.value != undefined) {
201
201
  inputFieldData.$attrs$.value = this.getExpressiontValue(this.expression);
202
202
  }
203
203
  inputFieldData.$attrs$.onEzChange = (event) => {
@@ -254,7 +254,7 @@ export class SnkExpressionItem {
254
254
  }
255
255
  render() {
256
256
  var _a;
257
- 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 ?
257
+ 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 ?
258
258
  h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
259
259
  this.buildFieldByType()), h("div", { class: "box__container--input-value-variable" }, !this._optionNotNull &&
260
260
  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) &&
@@ -283,7 +283,7 @@ export class SnkExpressionItem {
283
283
  "references": {
284
284
  "IExpressionItem": {
285
285
  "location": "import",
286
- "path": "../../../snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
286
+ "path": "../../interfaces/IExpressionItem"
287
287
  }
288
288
  }
289
289
  },
@@ -376,7 +376,7 @@ export class SnkExpressionItem {
376
376
  "references": {
377
377
  "IExpressionItem": {
378
378
  "location": "import",
379
- "path": "../../../snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
379
+ "path": "../../interfaces/IExpressionItem"
380
380
  }
381
381
  }
382
382
  }
@@ -396,7 +396,7 @@ export class SnkExpressionItem {
396
396
  "references": {
397
397
  "IExpressionItem": {
398
398
  "location": "import",
399
- "path": "../../../snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
399
+ "path": "../../interfaces/IExpressionItem"
400
400
  }
401
401
  }
402
402
  }
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { ApplicationContext, DataType, ElementIDUtils, StringUtils } from "@sankhyalabs/core";
3
3
  import { ModalAction } from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container";
4
- import { FilterConfigType, FilterEntities, FilterUserConfigTypes } from "../../../../lib/@types";
4
+ import { FilterConfigType, FilterEntities, FilterUserConfigTypes } from "../../interfaces/index";
5
5
  import { PersonalizedFilterUtils } from "./utils/PersonalizedFilterUtils";
6
6
  export class SnkFilterParamConfig {
7
7
  constructor() {
@@ -249,7 +249,7 @@ export class SnkFilterParamConfig {
249
249
  },
250
250
  "IExpressionItem": {
251
251
  "location": "import",
252
- "path": "./interfaces/IExpressionItem"
252
+ "path": "../../interfaces/IExpressionItem"
253
253
  }
254
254
  },
255
255
  "return": "Promise<IExpressionItem>"
@@ -269,7 +269,7 @@ export class SnkFilterParamConfig {
269
269
  },
270
270
  "IExpressionItem": {
271
271
  "location": "import",
272
- "path": "./interfaces/IExpressionItem"
272
+ "path": "../../interfaces/IExpressionItem"
273
273
  }
274
274
  },
275
275
  "return": "Promise<IExpressionItem>"
@@ -1,5 +1,5 @@
1
1
  import { DataType, DateUtils, NumberUtils, UserInterface } from "@sankhyalabs/core";
2
- import { FilterOperand } from "../../../../../lib/@types";
2
+ import { FilterOperand } from "../../../interfaces/index";
3
3
  import FilterItemType from "../../../../snk-filter-bar/filter-item/filter-item-type.enum";
4
4
  export class PersonalizedFilterUtils {
5
5
  /**
@@ -29,16 +29,16 @@ export class PersonalizedFilterUtils {
29
29
  expression += ` IS ${FilterOperand[expressionItem.operand]}`;
30
30
  break;
31
31
  case "LIKE":
32
- expression += ` LIKE ${commas}%${value}%${commas}`;
32
+ expression += ` LIKE '%${value}%'`;
33
33
  break;
34
34
  case "START_WITH":
35
- expression += ` LIKE ${commas}${value}%${commas}`;
35
+ expression += ` LIKE '${value}%'`;
36
36
  break;
37
37
  case "FINISHED_WITH":
38
- expression += ` LIKE ${commas}%${value}${commas}`;
38
+ expression += ` LIKE '%${value}'`;
39
39
  break;
40
40
  default:
41
- value = isNaN(value) ? `${commas}${value}${commas}` : value;
41
+ value = typeof value === 'string' ? `${commas}${value}${commas}` : value;
42
42
  expression += ` ${FilterOperand[expressionItem.operand]} ${value}`;
43
43
  }
44
44
  return expression;
@@ -150,7 +150,7 @@ export class PersonalizedFilterUtils {
150
150
  value: (value, byPassValue) => {
151
151
  if (byPassValue)
152
152
  return true;
153
- return !!value;
153
+ return value != undefined;
154
154
  },
155
155
  operand: (value) => !!value
156
156
  };
@@ -1,14 +1,16 @@
1
- import { DataType, ObjectUtils, UserInterface } from '@sankhyalabs/core';
1
+ import { ApplicationContext, DataType, ObjectUtils, UserInterface } from '@sankhyalabs/core';
2
2
  import { h } from '@stencil/core';
3
3
  import { VIEW_MODE, SIMPLE_CRUD_MODE } from '../../lib/utils/constants';
4
4
  import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
5
5
  import { PresentationMode } from '../../lib';
6
6
  import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
7
7
  import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
8
+ import SnkMultiSelectionListDataSource from '../snk-grid/filtercolumn/SnkMultiSelectionListDataSource';
8
9
  export class SnkSimpleCrud {
9
10
  constructor() {
10
11
  this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
11
12
  this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
13
+ this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
12
14
  this._taskbarProcessor = new TaskbarProcessor({
13
15
  "snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
14
16
  "snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
@@ -70,6 +72,12 @@ export class SnkSimpleCrud {
70
72
  componentWillLoad() {
71
73
  this.processMetadata();
72
74
  this.onModeChange();
75
+ this.configDatasource();
76
+ }
77
+ configDatasource() {
78
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
79
+ this._multiSelectionListDataSource.setApplication(application);
80
+ this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
73
81
  }
74
82
  getTaskBarId() {
75
83
  var _a, _b, _c;
@@ -155,7 +163,7 @@ export class SnkSimpleCrud {
155
163
  }
156
164
  render() {
157
165
  var _a;
158
- return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM) }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
166
+ return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this._multiSelectionListDataSource }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
159
167
  }
160
168
  static get is() { return "snk-simple-crud"; }
161
169
  static get encapsulation() { return "scoped"; }
@@ -29,39 +29,3 @@ export var DataExporterType;
29
29
  DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
30
30
  DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
31
31
  })(DataExporterType || (DataExporterType = {}));
32
- export var FilterConfigType;
33
- (function (FilterConfigType) {
34
- FilterConfigType["SYSTEM_CONFIG"] = "S";
35
- FilterConfigType["USER_CONFIG"] = "E";
36
- })(FilterConfigType || (FilterConfigType = {}));
37
- export 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
- export 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
- export var FilterEntities;
64
- (function (FilterEntities) {
65
- FilterEntities["FIELD"] = "Campo";
66
- FilterEntities["INSTANCE"] = "Instancia";
67
- })(FilterEntities || (FilterEntities = {}));
@@ -1,11 +1,12 @@
1
- import { ChangeOperation, DataType, DataUnit, SortMode, StringUtils } from "@sankhyalabs/core";
1
+ import { ChangeOperation, DataType, DataUnit, SortMode, StringUtils, } from '@sankhyalabs/core';
2
+ import { DISTINCT_FILTER_NAME_PREFIX } from "@sankhyalabs/ezui/dist/collection/utils/constants";
2
3
  export default class InMemoryLoader {
3
4
  constructor(metadata, records) {
4
5
  this.records = records || [];
5
6
  this.metadata = metadata;
6
7
  this._dataUnit = new DataUnit("InMemoryDataUnit");
7
8
  this._dataUnit.metadataLoader = () => this.metadaLoader();
8
- this._dataUnit.dataLoader = (_dataUnit, request) => this.dataLoader(_dataUnit, request);
9
+ this._dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
9
10
  this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
10
11
  this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
11
12
  this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
@@ -42,8 +43,9 @@ export default class InMemoryLoader {
42
43
  metadaLoader() {
43
44
  return Promise.resolve(this._metadata);
44
45
  }
45
- dataLoader(_dataUnit, request) {
46
- let records = [...this._records];
46
+ dataLoader(dataUnit, request) {
47
+ const filters = this.getColumnFilters(dataUnit);
48
+ let records = this.applyFilters(filters);
47
49
  if (request.sort) {
48
50
  request.sort.forEach(sort => {
49
51
  records = records.sort((recordA, recordB) => {
@@ -56,6 +58,25 @@ export default class InMemoryLoader {
56
58
  }
57
59
  return Promise.resolve({ records: records });
58
60
  }
61
+ applyFilters(filters) {
62
+ let records = [...this._records];
63
+ filters.forEach(filter => {
64
+ records = records.filter(record => { var _a; return filter.values.includes((_a = record[filter.column]) === null || _a === void 0 ? void 0 : _a.toString()); });
65
+ });
66
+ return records;
67
+ }
68
+ getColumnFilters(dataUnit) {
69
+ var _a, _b;
70
+ const allFilters = (_a = dataUnit.getFilters()) !== null && _a !== void 0 ? _a : [];
71
+ const columnFilters = (_b = allFilters.filter(filter => { var _a; return (_a = filter.name) === null || _a === void 0 ? void 0 : _a.includes(DISTINCT_FILTER_NAME_PREFIX); })) !== null && _b !== void 0 ? _b : [];
72
+ return columnFilters.map(filter => {
73
+ var _a, _b;
74
+ return {
75
+ column: (_b = (_a = filter.name) === null || _a === void 0 ? void 0 : _a.replace(DISTINCT_FILTER_NAME_PREFIX, "")) !== null && _b !== void 0 ? _b : "",
76
+ values: filter.params.map(param => param.value),
77
+ };
78
+ });
79
+ }
59
80
  getSortFn(type) {
60
81
  switch (type) {
61
82
  case DataType.NUMBER:
@@ -17,7 +17,10 @@ export const snkPersonalizedFilterMessages = {
17
17
  labelNameFilter: "Nome do filtro",
18
18
  labelExpression: "Expressão SQL",
19
19
  badgeVariable: "variável",
20
- noDataFound: "Nenhum filtro encontrado"
20
+ noDataFound: "Nenhum filtro encontrado",
21
+ condition: "Condição",
22
+ addGroup: "Adicionar grupo",
23
+ applyExpression: "Expressão a ser aplicada:"
21
24
  },
22
25
  confirmExpression: {
23
26
  title: "Aviso",