@sankhyalabs/sankhyablocks 6.10.0 → 7.0.0

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 (145) hide show
  1. package/dist/cjs/{ConfigStorage-da2bf3bf.js → ConfigStorage-97468a0f.js} +28 -22
  2. package/dist/cjs/{PersonalizedFilterUtils-cfcd9af2.js → PersonalizedFilterUtils-9848e09b.js} +18 -64
  3. package/dist/cjs/{SnkFormConfigManager-d7cc9118.js → SnkFormConfigManager-bef6e022.js} +1 -1
  4. package/dist/cjs/{SnkMessageBuilder-a5a9b437.js → SnkMessageBuilder-f40df6d4.js} +18 -2
  5. package/dist/cjs/{filter-bar-config-fetcher-58cfc12e.js → filter-bar-config-fetcher-a7747f69.js} +22 -5
  6. package/dist/cjs/index-8d94b7e0.js +7 -0
  7. package/dist/cjs/index-c5771aba.js +44 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  10. package/dist/cjs/snk-application.cjs.entry.js +3 -3
  11. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  12. package/dist/cjs/{snk-data-unit-9d03800c.js → snk-data-unit-b0cc2d42.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 +5 -5
  15. package/dist/cjs/snk-expression-group_2.cjs.entry.js +542 -0
  16. package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +66 -0
  17. package/dist/cjs/snk-filter-bar.cjs.entry.js +14 -14
  18. package/dist/cjs/snk-filter-detail.cjs.entry.js +3 -3
  19. package/dist/cjs/{snk-expression-item_3.cjs.entry.js → snk-filter-field-search_2.cjs.entry.js} +23 -315
  20. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
  21. package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -2
  22. package/dist/cjs/snk-form.cjs.entry.js +3 -3
  23. package/dist/cjs/snk-grid-config.cjs.entry.js +2 -2
  24. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  25. package/dist/cjs/{snk-guides-viewer-36766466.js → snk-guides-viewer-897368ea.js} +1 -1
  26. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  27. package/dist/cjs/snk-personalized-filter.cjs.entry.js +122 -31
  28. package/dist/collection/collection-manifest.json +2 -0
  29. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
  30. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +5 -1
  31. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +114 -23
  32. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +4 -6
  33. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +2 -1
  34. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.css +10 -0
  35. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.js +95 -0
  36. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.css +66 -0
  37. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js +158 -0
  38. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +8 -2
  39. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +14 -23
  40. package/dist/collection/lib/configs/ConfigStorage.js +5 -3
  41. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +22 -5
  42. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +22 -18
  43. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +18 -2
  44. package/dist/components/ConfigStorage.js +27 -21
  45. package/dist/components/PersonalizedFilterUtils.js +14 -23
  46. package/dist/components/SnkMessageBuilder.js +18 -2
  47. package/dist/components/filter-bar-config-fetcher.js +22 -5
  48. package/dist/components/index.d.ts +2 -0
  49. package/dist/components/index.js +2 -0
  50. package/dist/components/snk-crud.js +34 -22
  51. package/dist/components/snk-detail-view2.js +49 -27
  52. package/dist/components/snk-expression-group2.js +4 -6
  53. package/dist/components/snk-expression-item2.js +2 -1
  54. package/dist/components/snk-filter-advanced-mode.d.ts +11 -0
  55. package/dist/components/snk-filter-advanced-mode.js +6 -0
  56. package/dist/components/snk-filter-advanced-mode2.js +46 -0
  57. package/dist/components/snk-filter-assistent-mode.d.ts +11 -0
  58. package/dist/components/snk-filter-assistent-mode.js +6 -0
  59. package/dist/components/snk-filter-assistent-mode2.js +77 -0
  60. package/dist/components/snk-filter-bar2.js +17 -5
  61. package/dist/components/snk-filter-param-config2.js +6 -0
  62. package/dist/components/snk-grid2.js +22 -10
  63. package/dist/components/snk-personalized-filter2.js +131 -28
  64. package/dist/esm/{ConfigStorage-f1e805a0.js → ConfigStorage-02f17a26.js} +28 -22
  65. package/dist/esm/{PersonalizedFilterUtils-1a167d89.js → PersonalizedFilterUtils-731cae01.js} +16 -62
  66. package/dist/esm/{SnkFormConfigManager-324f6dc7.js → SnkFormConfigManager-cd9e6cab.js} +1 -1
  67. package/dist/esm/{SnkMessageBuilder-76f62087.js → SnkMessageBuilder-5be56185.js} +18 -2
  68. package/dist/esm/{filter-bar-config-fetcher-a358b8e0.js → filter-bar-config-fetcher-790283d8.js} +22 -5
  69. package/dist/esm/index-620ac460.js +7 -0
  70. package/dist/esm/index-ae591a44.js +44 -0
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/sankhyablocks.js +1 -1
  73. package/dist/esm/snk-application.entry.js +3 -3
  74. package/dist/esm/snk-data-exporter.entry.js +2 -2
  75. package/dist/esm/{snk-data-unit-0ff2d644.js → snk-data-unit-b9b4bb5f.js} +1 -1
  76. package/dist/esm/snk-data-unit.entry.js +2 -2
  77. package/dist/esm/snk-detail-view.entry.js +5 -5
  78. package/dist/esm/snk-expression-group_2.entry.js +537 -0
  79. package/dist/esm/snk-filter-advanced-mode_2.entry.js +61 -0
  80. package/dist/esm/snk-filter-bar.entry.js +5 -5
  81. package/dist/esm/snk-filter-detail.entry.js +3 -3
  82. package/dist/esm/{snk-expression-item_3.entry.js → snk-filter-field-search_2.entry.js} +12 -303
  83. package/dist/esm/snk-filter-modal-item.entry.js +2 -2
  84. package/dist/esm/snk-filter-modal.entry.js +2 -2
  85. package/dist/esm/snk-form.entry.js +3 -3
  86. package/dist/esm/snk-grid-config.entry.js +2 -2
  87. package/dist/esm/snk-grid.entry.js +2 -2
  88. package/dist/esm/{snk-guides-viewer-e7209909.js → snk-guides-viewer-579c70cc.js} +1 -1
  89. package/dist/esm/snk-guides-viewer.entry.js +4 -4
  90. package/dist/esm/snk-personalized-filter.entry.js +119 -28
  91. package/dist/sankhyablocks/{p-8f6575c8.entry.js → p-19fdcf88.entry.js} +1 -1
  92. package/dist/sankhyablocks/{p-18b74675.entry.js → p-1fe2976e.entry.js} +1 -1
  93. package/dist/sankhyablocks/p-2227bb94.js +1 -0
  94. package/dist/sankhyablocks/p-386102a7.entry.js +1 -0
  95. package/dist/sankhyablocks/{p-7a075ae6.js → p-3b059f4e.js} +1 -1
  96. package/dist/sankhyablocks/p-4af6cbef.entry.js +1 -0
  97. package/dist/sankhyablocks/p-4bbc7aac.entry.js +1 -0
  98. package/dist/sankhyablocks/{p-3251999f.entry.js → p-4f687570.entry.js} +1 -1
  99. package/dist/sankhyablocks/p-5098f618.js +1 -0
  100. package/dist/sankhyablocks/p-7e636457.entry.js +1 -0
  101. package/dist/sankhyablocks/p-7f1c4687.js +56 -0
  102. package/dist/sankhyablocks/{p-ed9e1e52.entry.js → p-88f4ef73.entry.js} +1 -1
  103. package/dist/sankhyablocks/{p-4f3df9b6.js → p-90a926c7.js} +1 -1
  104. package/dist/sankhyablocks/{p-eef26a01.entry.js → p-90e7c3a2.entry.js} +1 -1
  105. package/dist/sankhyablocks/p-933c0c0b.js +1 -0
  106. package/dist/sankhyablocks/p-9666c0d0.entry.js +1 -0
  107. package/dist/sankhyablocks/p-97720467.entry.js +1 -0
  108. package/dist/sankhyablocks/{p-522172e1.entry.js → p-97c586ab.entry.js} +1 -1
  109. package/dist/sankhyablocks/{p-bd840081.entry.js → p-9fa9331b.entry.js} +1 -1
  110. package/dist/sankhyablocks/{p-652b9081.js → p-acd8b97b.js} +1 -1
  111. package/dist/sankhyablocks/{p-40a5d35e.entry.js → p-ad6673fb.entry.js} +1 -1
  112. package/dist/sankhyablocks/p-bd86c9d3.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-8d583a79.entry.js → p-cdbdcf13.entry.js} +1 -1
  114. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  115. package/dist/sankhyablocks/{p-56378a3b.js → p-fb1e5b6d.js} +1 -1
  116. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  117. package/dist/types/components/snk-personalized-filter/interfaces/IPersonalizedFilter.d.ts +4 -0
  118. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +17 -6
  119. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +2 -2
  120. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.d.ts +20 -0
  121. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.d.ts +31 -0
  122. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +6 -0
  123. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +2 -2
  124. package/dist/types/components.d.ts +103 -2
  125. package/dist/types/lib/configs/ConfigStorage.d.ts +3 -2
  126. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +2 -1
  127. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
  128. package/package.json +1 -1
  129. package/react/components.d.ts +2 -0
  130. package/react/components.js +2 -0
  131. package/react/components.js.map +1 -1
  132. package/dist/cjs/IExpressionItem-0e32ebb7.js +0 -7
  133. package/dist/cjs/snk-expression-group.cjs.entry.js +0 -250
  134. package/dist/esm/IExpressionItem-21f225bf.js +0 -7
  135. package/dist/esm/snk-expression-group.entry.js +0 -246
  136. package/dist/sankhyablocks/p-432a73a8.js +0 -1
  137. package/dist/sankhyablocks/p-63bff2a8.js +0 -1
  138. package/dist/sankhyablocks/p-6490021d.entry.js +0 -1
  139. package/dist/sankhyablocks/p-7d68a43a.js +0 -1
  140. package/dist/sankhyablocks/p-7fd8a0ab.entry.js +0 -1
  141. package/dist/sankhyablocks/p-9f34a127.entry.js +0 -1
  142. package/dist/sankhyablocks/p-d4adf773.js +0 -68
  143. package/dist/sankhyablocks/p-d9586ead.entry.js +0 -1
  144. package/dist/sankhyablocks/p-eb30a52a.entry.js +0 -1
  145. package/dist/sankhyablocks/p-f8ce17d3.entry.js +0 -1
@@ -0,0 +1,95 @@
1
+ import { Host, h } from '@stencil/core';
2
+ import { StringUtils } from '@sankhyalabs/core';
3
+ export class SnkFilterAdvancedMode {
4
+ constructor() {
5
+ this.filterAssistent = undefined;
6
+ this.application = undefined;
7
+ }
8
+ getMessage(key, params) {
9
+ return this.application.messagesBuilder.getMessage(key, params);
10
+ }
11
+ getWarningMessageComponent() {
12
+ var _a;
13
+ if (StringUtils.isEmpty((_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.warningMessage))
14
+ return undefined;
15
+ return (h("div", { class: "ez-flex" }, h("ez-alert", { alertType: "warn" }, this.filterAssistent.warningMessage)));
16
+ }
17
+ render() {
18
+ var _a;
19
+ return (h(Host, null, h("span", { class: "ez-title ez-title--small ez-padding-bottom--small snk-filter-advanced-mode__title" }, this.getMessage("snkPersonalizedFilter.info.applyExpression")), h("ez-text-area", { rows: 9, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.expression, onEzChange: (evt) => this.ezExpressionChange.emit(evt.detail) }), this.getWarningMessageComponent()));
20
+ }
21
+ static get is() { return "snk-filter-advanced-mode"; }
22
+ static get encapsulation() { return "scoped"; }
23
+ static get originalStyleUrls() {
24
+ return {
25
+ "$": ["snk-filter-advanced-mode.css"]
26
+ };
27
+ }
28
+ static get styleUrls() {
29
+ return {
30
+ "$": ["snk-filter-advanced-mode.css"]
31
+ };
32
+ }
33
+ static get properties() {
34
+ return {
35
+ "filterAssistent": {
36
+ "type": "unknown",
37
+ "mutable": true,
38
+ "complexType": {
39
+ "original": "IPersonalizedFilter",
40
+ "resolved": "IPersonalizedFilter",
41
+ "references": {
42
+ "IPersonalizedFilter": {
43
+ "location": "import",
44
+ "path": "../../interfaces/IPersonalizedFilter"
45
+ }
46
+ }
47
+ },
48
+ "required": false,
49
+ "optional": false,
50
+ "docs": {
51
+ "tags": [],
52
+ "text": "Propriedade que cont\u00E9m informa\u00E7\u00F5es do filtro personalizado."
53
+ }
54
+ },
55
+ "application": {
56
+ "type": "unknown",
57
+ "mutable": true,
58
+ "complexType": {
59
+ "original": "SnkApplication",
60
+ "resolved": "SnkApplication",
61
+ "references": {
62
+ "SnkApplication": {
63
+ "location": "import",
64
+ "path": "../../../snk-application/snk-application"
65
+ }
66
+ }
67
+ },
68
+ "required": false,
69
+ "optional": false,
70
+ "docs": {
71
+ "tags": [],
72
+ "text": "Propriedade que mant\u00E9m informa\u00E7\u00F5es relacionadas ao SnkApplication."
73
+ }
74
+ }
75
+ };
76
+ }
77
+ static get events() {
78
+ return [{
79
+ "method": "ezExpressionChange",
80
+ "name": "ezExpressionChange",
81
+ "bubbles": true,
82
+ "cancelable": true,
83
+ "composed": true,
84
+ "docs": {
85
+ "tags": [],
86
+ "text": "Evento emitido sempre que uma edi\u00E7\u00E3o na express\u00E3o \u00E9 realizada."
87
+ },
88
+ "complexType": {
89
+ "original": "void",
90
+ "resolved": "void",
91
+ "references": {}
92
+ }
93
+ }];
94
+ }
95
+ }
@@ -0,0 +1,66 @@
1
+ :host {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+
6
+ /*@doc Define a família da fonte.*/
7
+ --text-area--font-family: var(--font-pattern, Arial);
8
+ /*@doc Define o posicionamento do label.*/
9
+ --text-area__label--floating--top: var(--space--small, 6px);
10
+ /*@doc Define o raio da borda do container*/
11
+ --snk-filter-assistent-mode__container--border-radius: var(--border--radius-medium, 12px);
12
+ /*@doc Define a cor de fundo do container.*/
13
+ --snk-filter-assistent-mode__container--background: var(--background--medium, #f0f3f7);
14
+ /*@doc Define a margem interna do container*/
15
+ --snk-filter-assistent-mode__container--margin: var(--space--small, 6px) var(--space--medium, 12px);
16
+ }
17
+
18
+ .ez-box__container--external {
19
+ /*private*/
20
+ height: 100px;
21
+ width: 100%;
22
+ overflow-y: auto;
23
+
24
+ /*public*/
25
+ background-color: var(--snk-filter-assistent-mode__container--background);
26
+ border-radius: var(--snk-filter-assistent-mode__container--border-radius);
27
+ }
28
+
29
+ .ez-box__container--internal {
30
+ /*public*/
31
+ margin: var(--snk-filter-assistent-mode__container--margin);
32
+ }
33
+
34
+ .ez-box__container--title{
35
+ /*private*/
36
+ display: block;
37
+ user-select: none;
38
+
39
+ /*public*/
40
+ font-family: var(--text-area--font-family);
41
+ font-size: var(--text--extra-small);
42
+ color: var(--title--primary);
43
+ top: var(--text-area__label--floating--top);
44
+ }
45
+
46
+ .ez-box__container--expression{
47
+ /*private*/
48
+ display: block;
49
+
50
+ /*public*/
51
+ font-family: var(--text-area--font-family);
52
+ font-size: var(--text--medium);
53
+ color: var(--title--primary);
54
+ top: var(--text-area__label--floating--top);
55
+ }
56
+
57
+ .snk-personalized-filter__expression-input--line {
58
+ /*private*/
59
+ width: 100%;
60
+ height: 2px;
61
+
62
+ /*public*/
63
+ background-color: var(--snk-personalized-filter--background-color-line);
64
+ margin-top: var(--snk-personalized-filter--margin-line);
65
+ margin-bottom: var(--snk-personalized-filter--margin-line);
66
+ }
@@ -0,0 +1,158 @@
1
+ import { Host, h } from '@stencil/core';
2
+ import { PersonalizedFilterUtils } from '../../subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils';
3
+ export class SnkFilterAssistentMode {
4
+ constructor() {
5
+ this.filterAssistent = undefined;
6
+ this.messagesBuilder = undefined;
7
+ this.filterId = undefined;
8
+ this.entityUri = undefined;
9
+ this.application = undefined;
10
+ }
11
+ getMessage(key, params) {
12
+ return this.application.messagesBuilder.getMessage(key, params);
13
+ }
14
+ async handleFilterGroupChange() {
15
+ const assistent = await this._mainExpressionGroup.getExpressionGroup();
16
+ this.filterAssistent = Object.assign(Object.assign({}, this.filterAssistent), { assistent });
17
+ this.filterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this.filterAssistent.assistent);
18
+ this.filterAssistent.expression = PersonalizedFilterUtils.buildGroupExpression(this.filterAssistent.assistent);
19
+ this.ezChangeFilter.emit(this.filterAssistent);
20
+ }
21
+ render() {
22
+ var _a, _b;
23
+ return (h(Host, 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", { class: "ez-margin-top--auto" }, 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--external" }, h("div", { class: "ez-box__container--internal" }, h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
24
+ }
25
+ static get is() { return "snk-filter-assistent-mode"; }
26
+ static get encapsulation() { return "scoped"; }
27
+ static get originalStyleUrls() {
28
+ return {
29
+ "$": ["snk-filter-assistent-mode.css"]
30
+ };
31
+ }
32
+ static get styleUrls() {
33
+ return {
34
+ "$": ["snk-filter-assistent-mode.css"]
35
+ };
36
+ }
37
+ static get properties() {
38
+ return {
39
+ "filterAssistent": {
40
+ "type": "unknown",
41
+ "mutable": true,
42
+ "complexType": {
43
+ "original": "IPersonalizedFilter",
44
+ "resolved": "IPersonalizedFilter",
45
+ "references": {
46
+ "IPersonalizedFilter": {
47
+ "location": "import",
48
+ "path": "../../interfaces/IPersonalizedFilter"
49
+ }
50
+ }
51
+ },
52
+ "required": false,
53
+ "optional": false,
54
+ "docs": {
55
+ "tags": [],
56
+ "text": "Propriedade que cont\u00E9m informa\u00E7\u00F5es do filtro personalizado."
57
+ }
58
+ },
59
+ "messagesBuilder": {
60
+ "type": "unknown",
61
+ "mutable": true,
62
+ "complexType": {
63
+ "original": "SnkMessageBuilder",
64
+ "resolved": "SnkMessageBuilder",
65
+ "references": {
66
+ "SnkMessageBuilder": {
67
+ "location": "import",
68
+ "path": "../../../../lib/message/SnkMessageBuilder"
69
+ }
70
+ }
71
+ },
72
+ "required": false,
73
+ "optional": false,
74
+ "docs": {
75
+ "tags": [],
76
+ "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
77
+ }
78
+ },
79
+ "filterId": {
80
+ "type": "string",
81
+ "mutable": true,
82
+ "complexType": {
83
+ "original": "string",
84
+ "resolved": "string",
85
+ "references": {}
86
+ },
87
+ "required": false,
88
+ "optional": false,
89
+ "docs": {
90
+ "tags": [],
91
+ "text": "Id do filtro que ser\u00E1 carregado."
92
+ },
93
+ "attribute": "filter-id",
94
+ "reflect": false
95
+ },
96
+ "entityUri": {
97
+ "type": "string",
98
+ "mutable": true,
99
+ "complexType": {
100
+ "original": "string",
101
+ "resolved": "string",
102
+ "references": {}
103
+ },
104
+ "required": false,
105
+ "optional": false,
106
+ "docs": {
107
+ "tags": [],
108
+ "text": "Respons\u00E1vel por receber a URI da entidade."
109
+ },
110
+ "attribute": "entity-uri",
111
+ "reflect": false
112
+ },
113
+ "application": {
114
+ "type": "unknown",
115
+ "mutable": true,
116
+ "complexType": {
117
+ "original": "SnkApplication",
118
+ "resolved": "SnkApplication",
119
+ "references": {
120
+ "SnkApplication": {
121
+ "location": "import",
122
+ "path": "../../../snk-application/snk-application"
123
+ }
124
+ }
125
+ },
126
+ "required": false,
127
+ "optional": false,
128
+ "docs": {
129
+ "tags": [],
130
+ "text": "Propriedade que mant\u00E9m informa\u00E7\u00F5es relacionadas ao SnkApplication."
131
+ }
132
+ }
133
+ };
134
+ }
135
+ static get events() {
136
+ return [{
137
+ "method": "ezChangeFilter",
138
+ "name": "ezChangeFilter",
139
+ "bubbles": true,
140
+ "cancelable": true,
141
+ "composed": true,
142
+ "docs": {
143
+ "tags": [],
144
+ "text": ""
145
+ },
146
+ "complexType": {
147
+ "original": "IPersonalizedFilter",
148
+ "resolved": "IPersonalizedFilter",
149
+ "references": {
150
+ "IPersonalizedFilter": {
151
+ "location": "import",
152
+ "path": "../../interfaces/IPersonalizedFilter"
153
+ }
154
+ }
155
+ }
156
+ }];
157
+ }
158
+ }
@@ -12,6 +12,9 @@ export class SnkFilterParamConfig {
12
12
  this._canSave = false;
13
13
  this.messagesBuilder = undefined;
14
14
  }
15
+ /**
16
+ * Abre o modal de configuração de valor variável
17
+ */
15
18
  open(expressionItem) {
16
19
  this._opened = true;
17
20
  this._expressionItem = expressionItem;
@@ -20,6 +23,9 @@ export class SnkFilterParamConfig {
20
23
  this._promiseResolver = accept;
21
24
  });
22
25
  }
26
+ /**
27
+ * Fecha o modal de configuração de valor variável
28
+ */
23
29
  close() {
24
30
  this._opened = false;
25
31
  return new Promise(accept => {
@@ -255,7 +261,7 @@ export class SnkFilterParamConfig {
255
261
  "return": "Promise<IExpressionItem>"
256
262
  },
257
263
  "docs": {
258
- "text": "",
264
+ "text": "Abre o modal de configura\u00E7\u00E3o de valor vari\u00E1vel",
259
265
  "tags": []
260
266
  }
261
267
  },
@@ -275,7 +281,7 @@ export class SnkFilterParamConfig {
275
281
  "return": "Promise<IExpressionItem>"
276
282
  },
277
283
  "docs": {
278
- "text": "",
284
+ "text": "Fecha o modal de configura\u00E7\u00E3o de valor vari\u00E1vel",
279
285
  "tags": []
280
286
  }
281
287
  }
@@ -7,14 +7,12 @@ export class PersonalizedFilterUtils {
7
7
  * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
8
8
  * @returns Retorna a expressão de filtro.
9
9
  */
10
- static buildFilterExpression(expressionItem, ignoreInvalidExpressions = false) {
10
+ static buildFilterExpression(expressionItem) {
11
+ var _a;
11
12
  if (expressionItem == undefined) {
12
13
  return;
13
14
  }
14
- if (!this.validateExpressionItem(expressionItem) && ignoreInvalidExpressions) {
15
- return "";
16
- }
17
- let value = this.buildVariableParameterValue(expressionItem);
15
+ let value = (_a = this.buildVariableParameterValue(expressionItem)) !== null && _a !== void 0 ? _a : undefined;
18
16
  let expression = expressionItem.expression || "";
19
17
  let commas = "'";
20
18
  if (expressionItem.paramVariable) {
@@ -38,8 +36,13 @@ export class PersonalizedFilterUtils {
38
36
  expression += ` LIKE '%${value}'`;
39
37
  break;
40
38
  default:
41
- value = typeof value === 'string' ? `${commas}${value}${commas}` : value;
42
- expression += ` ${FilterOperand[expressionItem.operand]} ${value}`;
39
+ if (expressionItem.operand) {
40
+ expression += ` ${FilterOperand[expressionItem.operand]}`;
41
+ }
42
+ if (value) {
43
+ value = isNaN(value) ? `${commas}${value}${commas}` : value;
44
+ expression += ` ${value}`;
45
+ }
43
46
  }
44
47
  return expression;
45
48
  }
@@ -63,7 +66,7 @@ export class PersonalizedFilterUtils {
63
66
  pois para filtros herdados do HTML5 não temos o tipo OBJECT, fazendo com que a expressão
64
67
  fique inválida para campos do tipo pesquisa.
65
68
  */
66
- if (UserInterface.SEARCH === expressionItem.userInterface || DataType.OBJECT == type) {
69
+ if (UserInterface.SEARCH === expressionItem.userInterface || expressionItem.userInterface === UserInterface.OPTIONSELECTOR || DataType.OBJECT == type) {
67
70
  value = (_a = value === null || value === void 0 ? void 0 : value.value) !== null && _a !== void 0 ? _a : value;
68
71
  }
69
72
  if (DataType.NUMBER == type && value != undefined) {
@@ -105,11 +108,11 @@ export class PersonalizedFilterUtils {
105
108
  /*
106
109
  * Cria uma expressão de filtro para um grupo de itens.
107
110
  */
108
- static buildGroupExpression(expressionGroup, ignoreInvalidExpressions = false) {
111
+ static buildGroupExpression(expressionGroup) {
109
112
  var _a, _b;
110
113
  if (!((_a = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.items) === null || _a === void 0 ? void 0 : _a.length))
111
114
  return "";
112
- const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item, ignoreInvalidExpressions)).join(` ${expressionGroup.operand} `);
115
+ const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item)).join(` ${expressionGroup.operand} `);
113
116
  if (((_b = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.childrenGroups) === null || _b === void 0 ? void 0 : _b.length) > 0) {
114
117
  const childGroupExpressions = expressionGroup.childrenGroups.map((children) => this.buildGroupExpression(children)).join(` ${expressionGroup.operand} `);
115
118
  return `(${itemExpressions} ${expressionGroup.operand} (${childGroupExpressions}))`;
@@ -196,7 +199,6 @@ export class PersonalizedFilterUtils {
196
199
  * do tipo variavel;
197
200
  */
198
201
  static buildVariableParameters(expressionGroup) {
199
- var _a, _b, _c, _d;
200
202
  const allItems = this.buildPlainExpressionItems(expressionGroup);
201
203
  const allParams = [];
202
204
  for (const item of allItems) {
@@ -205,18 +207,7 @@ export class PersonalizedFilterUtils {
205
207
  }
206
208
  allParams.push({
207
209
  entityName: item.entityName,
208
- fieldName: item.fieldName,
209
- dataType: item.type,
210
- description: item.description,
211
- userInterface: item.userInterface,
212
- label: item.fieldLabel,
213
- searchContext: {
214
- entity: (_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.find(prop => prop.name == "ENTITYNAME")) === null || _b === void 0 ? void 0 : _b.value,
215
- entityDescription: (_d = (_c = item.props) === null || _c === void 0 ? void 0 : _c.find(prop => prop.name == "DESCRIPTIONENTITY")) === null || _d === void 0 ? void 0 : _d.value,
216
- searchOptions: {
217
- showInactives: false
218
- }
219
- }
210
+ fieldName: item.fieldName
220
211
  });
221
212
  }
222
213
  return allParams;
@@ -17,17 +17,16 @@ export class ConfigStorage {
17
17
  const resourceID = await application.getResourceID();
18
18
  ConfigStorage.instance = new ConfigStorage();
19
19
  ConfigStorage.resourceID = resourceID;
20
- ConfigStorage.instance.loadFilterBarConfig(configName);
21
20
  ConfigStorage.instance.loadFormConfig(configName);
22
21
  ConfigStorage.instance.loadGridConfig(configName);
23
22
  }
24
23
  }
25
24
  return this.instance;
26
25
  }
27
- async loadFilterBarConfig(name) {
26
+ async loadFilterBarConfig(name, urlParams) {
28
27
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
29
28
  if (!ConfigStorage.configById.has(cacheID)) {
30
- ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name));
29
+ ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
31
30
  }
32
31
  return ConfigStorage.configById.get(cacheID);
33
32
  }
@@ -79,6 +78,9 @@ export class ConfigStorage {
79
78
  static async removePersonalizedFilter(personalizedFilter, configName) {
80
79
  return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
81
80
  }
81
+ static async validatePersonalizedFilter(dataUnitName, expression) {
82
+ return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
83
+ }
82
84
  static buildCacheID(name, source) {
83
85
  if (name == undefined) {
84
86
  return `req_${source}_${this.resourceID}`;
@@ -75,9 +75,9 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
75
75
  saveConfig(items, resourceID, configName) {
76
76
  return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
77
77
  }
78
- getConfig(resourceID, configName) {
78
+ getConfig(resourceID, configName, urlParams) {
79
79
  return new Promise((accept, reject) => {
80
- this.loadResource(this.getPath(resourceID, configName))
80
+ this.loadResource(this.getPath(resourceID, configName, urlParams))
81
81
  .then((configAsString) => {
82
82
  let fieldsList;
83
83
  if (configAsString) {
@@ -125,10 +125,27 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
125
125
  return item;
126
126
  });
127
127
  }
128
- getPath(resourceID, name) {
128
+ getPath(resourceID, name, urlParams) {
129
+ let path = `cfg://filter/FilterBarState:${resourceID}`;
129
130
  if (name) {
130
- return `cfg://filter/FilterBarState:${resourceID}.${name}`;
131
+ path += `.${name}`;
131
132
  }
132
- return `cfg://filter/FilterBarState:${resourceID}`;
133
+ if (urlParams) {
134
+ path += this.buildQueryString(urlParams);
135
+ }
136
+ return path;
137
+ }
138
+ buildQueryString(urlParams) {
139
+ let queryString = '?';
140
+ for (let key in urlParams) {
141
+ if (!urlParams.hasOwnProperty(key)) {
142
+ continue;
143
+ }
144
+ if (queryString.length > 1) {
145
+ queryString += '&';
146
+ }
147
+ queryString += key + '=' + urlParams[key];
148
+ }
149
+ return queryString;
133
150
  }
134
151
  }
@@ -49,24 +49,6 @@ export default class PersonalizedFilterFetcher {
49
49
  active
50
50
  expression
51
51
  warningMessage
52
- parameters {
53
- entityName
54
- fieldName
55
- dataType
56
- description
57
- userInterface
58
- label
59
- searchContext {
60
- entity
61
- entityDescription
62
- searchOptions {
63
- rootEntity
64
- descriptionFieldName
65
- codeFieldName
66
- showInactives
67
- }
68
- }
69
- }
70
52
  assistent
71
53
  }
72
54
  }`);
@@ -84,6 +66,13 @@ export default class PersonalizedFilterFetcher {
84
66
  name
85
67
  }
86
68
  }`);
69
+ this.templateByQuery.set("validateExpression", gql `
70
+ query($dataUnitName: String!, $expression: String!) {
71
+ $queryAlias$: validateExpression(dataUnitName: $dataUnitName, expression: $expression) {
72
+ valid
73
+ message
74
+ }
75
+ }`);
87
76
  }
88
77
  async loadPersonalizedFilter(resourceID, filterID, configName) {
89
78
  return new Promise((resolve, reject) => {
@@ -133,6 +122,21 @@ export default class PersonalizedFilterFetcher {
133
122
  });
134
123
  });
135
124
  }
125
+ async validatePersonalizedFilter(dataUnitName, expression) {
126
+ return new Promise((resolve, reject) => {
127
+ DataFetcher.get()
128
+ .callGraphQL({
129
+ values: { dataUnitName: dataUnitName, expression: expression },
130
+ query: this.templateByQuery.get("validateExpression"),
131
+ })
132
+ .then((resp) => {
133
+ resolve(resp);
134
+ })
135
+ .catch((error) => {
136
+ reject(error);
137
+ });
138
+ });
139
+ }
136
140
  loadFields(uri) {
137
141
  return new Promise((resolve, reject) => {
138
142
  DataFetcher.get()
@@ -15,12 +15,16 @@ export const snkPersonalizedFilterMessages = {
15
15
  labelCancel: "Cancelar",
16
16
  labelSave: "Salvar",
17
17
  labelNameFilter: "Nome do filtro",
18
- labelExpression: "Expressão SQL",
18
+ labelExpression: "Expressão",
19
19
  badgeVariable: "variável",
20
20
  noDataFound: "Nenhum filtro encontrado",
21
21
  condition: "Condição",
22
22
  addGroup: "Adicionar grupo",
23
- applyExpression: "Expressão a ser aplicada:"
23
+ addField: "Adicionar campo",
24
+ applyExpression: "Expressão a ser aplicada:",
25
+ tooltipDisabledAssistentMode: "Expressão não suportada pelo assistente.",
26
+ activeModeAdvanced: "Ativar modo avançado",
27
+ activeModeAssistent: "Ativar modo assistente"
24
28
  },
25
29
  confirmExpression: {
26
30
  title: "Aviso",
@@ -34,6 +38,18 @@ export const snkPersonalizedFilterMessages = {
34
38
  title: "Aviso",
35
39
  description: `As alterações realizadas serão descartadas.</br></br><b>Gostaria de continuar?</b>`
36
40
  },
41
+ confirmChangeModeAssistent: {
42
+ title: "Aviso",
43
+ description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
44
+ },
45
+ confirmChangeModeAdvanced: {
46
+ title: "Aviso",
47
+ description: `Ao retornar ao modo assistente suas alterações serão perdidas.</br></br><b>Gostaria de continuar?</b>`
48
+ },
49
+ confirmSaveModeAdvanced: {
50
+ title: "Aviso",
51
+ description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
52
+ },
37
53
  operador: {
38
54
  firstLevel: "A seleção será habilitada a partir da adição da segunda linha de regras.",
39
55
  and: "Será verdadeiro se todas as condições forem obedecidas.",