@sankhyalabs/sankhyablocks 6.9.2 → 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 (188) hide show
  1. package/dist/cjs/{ConfigStorage-3aaa8a9f.js → ConfigStorage-97468a0f.js} +31 -25
  2. package/dist/cjs/{DataFetcher-093c47ae.js → DataFetcher-04c70ba9.js} +88 -24
  3. package/dist/cjs/{PersonalizedFilterUtils-cfcd9af2.js → PersonalizedFilterUtils-9848e09b.js} +18 -64
  4. package/dist/cjs/{SnkFormConfigManager-ddad3cbb.js → SnkFormConfigManager-bef6e022.js} +2 -2
  5. package/dist/cjs/{SnkMessageBuilder-e55c7afa.js → SnkMessageBuilder-f40df6d4.js} +20 -3
  6. package/dist/cjs/{dataunit-fetcher-2f67ac79.js → dataunit-fetcher-4102080d.js} +1 -1
  7. package/dist/cjs/{filter-bar-config-fetcher-81868495.js → filter-bar-config-fetcher-a7747f69.js} +23 -6
  8. package/dist/cjs/{form-config-fetcher-affb0b28.js → form-config-fetcher-56442594.js} +2 -2
  9. package/dist/cjs/index-8d94b7e0.js +7 -0
  10. package/dist/cjs/index-c5771aba.js +44 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{pesquisa-fetcher-21c3afc9.js → pesquisa-fetcher-cab451b6.js} +1 -1
  13. package/dist/cjs/{resource-fetcher-e71a11b8.js → resource-fetcher-260e98a4.js} +1 -1
  14. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  15. package/dist/cjs/snk-actions-button.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-application.cjs.entry.js +8 -8
  17. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  18. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  19. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  20. package/dist/cjs/{snk-data-unit-26cf970c.js → snk-data-unit-b0cc2d42.js} +1 -1
  21. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  22. package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
  23. package/dist/cjs/snk-expression-group_2.cjs.entry.js +542 -0
  24. package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +66 -0
  25. package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -17
  26. package/dist/cjs/snk-filter-detail.cjs.entry.js +5 -5
  27. package/dist/cjs/{snk-expression-item_3.cjs.entry.js → snk-filter-field-search_2.cjs.entry.js} +23 -315
  28. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -5
  29. package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -2
  30. package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
  31. package/dist/cjs/snk-form.cjs.entry.js +6 -6
  32. package/dist/cjs/snk-grid-config.cjs.entry.js +5 -5
  33. package/dist/cjs/snk-grid.cjs.entry.js +5 -5
  34. package/dist/cjs/{snk-guides-viewer-b0f98cf4.js → snk-guides-viewer-897368ea.js} +3 -3
  35. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  36. package/dist/cjs/snk-personalized-filter.cjs.entry.js +125 -34
  37. package/dist/cjs/snk-print-selector.cjs.entry.js +15 -11
  38. package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
  39. package/dist/collection/collection-manifest.json +2 -0
  40. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
  41. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +5 -1
  42. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +114 -23
  43. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +4 -6
  44. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +2 -1
  45. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.css +10 -0
  46. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.js +95 -0
  47. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.css +66 -0
  48. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js +158 -0
  49. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +8 -2
  50. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +14 -23
  51. package/dist/collection/components/snk-print-selector/snk-print-selector.css +9 -1
  52. package/dist/collection/components/snk-print-selector/snk-print-selector.js +17 -14
  53. package/dist/collection/lib/configs/ConfigStorage.js +5 -3
  54. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +22 -5
  55. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +22 -18
  56. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +18 -2
  57. package/dist/collection/lib/message/resources/snk-print-selector.msg.js +2 -1
  58. package/dist/collection/lib/utils/PrintUtils.js +88 -24
  59. package/dist/components/ConfigStorage.js +27 -21
  60. package/dist/components/DataFetcher.js +88 -24
  61. package/dist/components/PersonalizedFilterUtils.js +14 -23
  62. package/dist/components/SnkMessageBuilder.js +20 -3
  63. package/dist/components/filter-bar-config-fetcher.js +22 -5
  64. package/dist/components/index.d.ts +2 -0
  65. package/dist/components/index.js +2 -0
  66. package/dist/components/snk-crud.js +34 -22
  67. package/dist/components/snk-detail-view2.js +49 -27
  68. package/dist/components/snk-expression-group2.js +4 -6
  69. package/dist/components/snk-expression-item2.js +2 -1
  70. package/dist/components/snk-filter-advanced-mode.d.ts +11 -0
  71. package/dist/components/snk-filter-advanced-mode.js +6 -0
  72. package/dist/components/snk-filter-advanced-mode2.js +46 -0
  73. package/dist/components/snk-filter-assistent-mode.d.ts +11 -0
  74. package/dist/components/snk-filter-assistent-mode.js +6 -0
  75. package/dist/components/snk-filter-assistent-mode2.js +77 -0
  76. package/dist/components/snk-filter-bar2.js +17 -5
  77. package/dist/components/snk-filter-param-config2.js +6 -0
  78. package/dist/components/snk-grid2.js +22 -10
  79. package/dist/components/snk-personalized-filter2.js +131 -28
  80. package/dist/components/snk-print-selector.js +14 -10
  81. package/dist/esm/{ConfigStorage-24b221ba.js → ConfigStorage-02f17a26.js} +31 -25
  82. package/dist/esm/{DataFetcher-6153ff3e.js → DataFetcher-fddeb917.js} +88 -24
  83. package/dist/esm/{PersonalizedFilterUtils-1a167d89.js → PersonalizedFilterUtils-731cae01.js} +16 -62
  84. package/dist/esm/{SnkFormConfigManager-fcbefc1a.js → SnkFormConfigManager-cd9e6cab.js} +2 -2
  85. package/dist/esm/{SnkMessageBuilder-96e66d9c.js → SnkMessageBuilder-5be56185.js} +20 -3
  86. package/dist/esm/{dataunit-fetcher-09586248.js → dataunit-fetcher-66f42154.js} +1 -1
  87. package/dist/esm/{filter-bar-config-fetcher-73ebc12f.js → filter-bar-config-fetcher-790283d8.js} +23 -6
  88. package/dist/esm/{form-config-fetcher-01e9985d.js → form-config-fetcher-533b895e.js} +2 -2
  89. package/dist/esm/index-620ac460.js +7 -0
  90. package/dist/esm/index-ae591a44.js +44 -0
  91. package/dist/esm/loader.js +1 -1
  92. package/dist/esm/{pesquisa-fetcher-829ec5a9.js → pesquisa-fetcher-4a702655.js} +1 -1
  93. package/dist/esm/{resource-fetcher-d053e214.js → resource-fetcher-0f20a072.js} +1 -1
  94. package/dist/esm/sankhyablocks.js +1 -1
  95. package/dist/esm/snk-actions-button.entry.js +2 -2
  96. package/dist/esm/snk-application.entry.js +8 -8
  97. package/dist/esm/snk-attach.entry.js +2 -2
  98. package/dist/esm/snk-crud.entry.js +2 -2
  99. package/dist/esm/snk-data-exporter.entry.js +3 -3
  100. package/dist/esm/{snk-data-unit-0f2d3c74.js → snk-data-unit-b9b4bb5f.js} +1 -1
  101. package/dist/esm/snk-data-unit.entry.js +2 -2
  102. package/dist/esm/snk-detail-view.entry.js +9 -9
  103. package/dist/esm/snk-expression-group_2.entry.js +537 -0
  104. package/dist/esm/snk-filter-advanced-mode_2.entry.js +61 -0
  105. package/dist/esm/snk-filter-bar.entry.js +8 -8
  106. package/dist/esm/snk-filter-detail.entry.js +5 -5
  107. package/dist/esm/{snk-expression-item_3.entry.js → snk-filter-field-search_2.entry.js} +12 -303
  108. package/dist/esm/snk-filter-modal-item.entry.js +5 -5
  109. package/dist/esm/snk-filter-modal.entry.js +2 -2
  110. package/dist/esm/snk-form-config.entry.js +3 -3
  111. package/dist/esm/snk-form.entry.js +6 -6
  112. package/dist/esm/snk-grid-config.entry.js +5 -5
  113. package/dist/esm/snk-grid.entry.js +5 -5
  114. package/dist/esm/{snk-guides-viewer-ab5c376c.js → snk-guides-viewer-579c70cc.js} +3 -3
  115. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  116. package/dist/esm/snk-personalized-filter.entry.js +122 -31
  117. package/dist/esm/snk-print-selector.entry.js +15 -11
  118. package/dist/esm/snk-simple-crud.entry.js +2 -2
  119. package/dist/sankhyablocks/{p-e665c93f.entry.js → p-19fdcf88.entry.js} +1 -1
  120. package/dist/sankhyablocks/{p-4ab8d0ee.entry.js → p-1fe2976e.entry.js} +1 -1
  121. package/dist/sankhyablocks/p-2227bb94.js +1 -0
  122. package/dist/sankhyablocks/{p-85e6068d.entry.js → p-2ddf3e87.entry.js} +1 -1
  123. package/dist/sankhyablocks/p-386102a7.entry.js +1 -0
  124. package/dist/sankhyablocks/{p-eaec700d.js → p-3b059f4e.js} +1 -1
  125. package/dist/sankhyablocks/p-4af6cbef.entry.js +1 -0
  126. package/dist/sankhyablocks/p-4bbc7aac.entry.js +1 -0
  127. package/dist/sankhyablocks/p-4f550a1a.js +1 -0
  128. package/dist/sankhyablocks/{p-7dd92fb8.entry.js → p-4f687570.entry.js} +1 -1
  129. package/dist/sankhyablocks/p-5098f618.js +1 -0
  130. package/dist/sankhyablocks/{p-16ad23d5.entry.js → p-5596a2dd.entry.js} +1 -1
  131. package/dist/sankhyablocks/p-7e636457.entry.js +1 -0
  132. package/dist/sankhyablocks/p-7f1c4687.js +56 -0
  133. package/dist/sankhyablocks/p-82800006.entry.js +1 -0
  134. package/dist/sankhyablocks/{p-05d82333.entry.js → p-88f4ef73.entry.js} +1 -1
  135. package/dist/sankhyablocks/{p-d20e2ce3.js → p-8f484733.js} +1 -1
  136. package/dist/sankhyablocks/{p-eb0c9f4c.js → p-90a926c7.js} +1 -1
  137. package/dist/sankhyablocks/{p-432dd007.entry.js → p-90e7c3a2.entry.js} +1 -1
  138. package/dist/sankhyablocks/p-933c0c0b.js +1 -0
  139. package/dist/sankhyablocks/p-9666c0d0.entry.js +1 -0
  140. package/dist/sankhyablocks/p-97720467.entry.js +1 -0
  141. package/dist/sankhyablocks/{p-a4cd60bf.entry.js → p-97c586ab.entry.js} +1 -1
  142. package/dist/sankhyablocks/{p-814f9247.js → p-982107dc.js} +1 -1
  143. package/dist/sankhyablocks/{p-354ce206.entry.js → p-9fa9331b.entry.js} +1 -1
  144. package/dist/sankhyablocks/{p-07cb8a03.entry.js → p-a357d13c.entry.js} +1 -1
  145. package/dist/sankhyablocks/{p-bfe8b96d.js → p-acd8b97b.js} +1 -1
  146. package/dist/sankhyablocks/{p-40a5d35e.entry.js → p-ad6673fb.entry.js} +1 -1
  147. package/dist/sankhyablocks/{p-3e8748b1.entry.js → p-af8ed6d5.entry.js} +1 -1
  148. package/dist/sankhyablocks/{p-bd1f8640.entry.js → p-bc19b890.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-bd86c9d3.entry.js +1 -0
  150. package/dist/sankhyablocks/{p-1b596ea1.entry.js → p-cdbdcf13.entry.js} +1 -1
  151. package/dist/sankhyablocks/{p-89fb7531.js → p-d97eb781.js} +2 -2
  152. package/dist/sankhyablocks/{p-60ad0dea.js → p-f034254e.js} +1 -1
  153. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  154. package/dist/sankhyablocks/{p-9a7aafe4.js → p-fb1e5b6d.js} +1 -1
  155. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  156. package/dist/types/components/snk-personalized-filter/interfaces/IPersonalizedFilter.d.ts +4 -0
  157. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +17 -6
  158. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +2 -2
  159. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.d.ts +20 -0
  160. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.d.ts +31 -0
  161. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +6 -0
  162. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +2 -2
  163. package/dist/types/components/snk-print-selector/snk-print-selector.d.ts +7 -1
  164. package/dist/types/components.d.ts +106 -4
  165. package/dist/types/lib/configs/ConfigStorage.d.ts +3 -2
  166. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +2 -1
  167. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
  168. package/dist/types/lib/utils/PrintUtils.d.ts +5 -2
  169. package/package.json +1 -1
  170. package/react/components.d.ts +2 -0
  171. package/react/components.js +2 -0
  172. package/react/components.js.map +1 -1
  173. package/dist/cjs/IExpressionItem-0e32ebb7.js +0 -7
  174. package/dist/cjs/snk-expression-group.cjs.entry.js +0 -250
  175. package/dist/esm/IExpressionItem-21f225bf.js +0 -7
  176. package/dist/esm/snk-expression-group.entry.js +0 -246
  177. package/dist/sankhyablocks/p-13f0ed88.entry.js +0 -1
  178. package/dist/sankhyablocks/p-2b449454.js +0 -1
  179. package/dist/sankhyablocks/p-63bff2a8.js +0 -1
  180. package/dist/sankhyablocks/p-6f49f5d4.entry.js +0 -1
  181. package/dist/sankhyablocks/p-744d0fd2.js +0 -1
  182. package/dist/sankhyablocks/p-7d68a43a.js +0 -1
  183. package/dist/sankhyablocks/p-9404ad4d.entry.js +0 -1
  184. package/dist/sankhyablocks/p-ad4bb9d2.entry.js +0 -1
  185. package/dist/sankhyablocks/p-d9586ead.entry.js +0 -1
  186. package/dist/sankhyablocks/p-e789eb2d.js +0 -68
  187. package/dist/sankhyablocks/p-f8ce17d3.entry.js +0 -1
  188. package/dist/sankhyablocks/p-feb6963e.entry.js +0 -1
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const core = require('@sankhyalabs/core');
4
- const formConfigFetcher = require('./form-config-fetcher-affb0b28.js');
5
- const resourceFetcher = require('./resource-fetcher-e71a11b8.js');
6
- const filterBarConfigFetcher = require('./filter-bar-config-fetcher-81868495.js');
7
- const DataFetcher = require('./DataFetcher-093c47ae.js');
4
+ const formConfigFetcher = require('./form-config-fetcher-56442594.js');
5
+ const resourceFetcher = require('./resource-fetcher-260e98a4.js');
6
+ const filterBarConfigFetcher = require('./filter-bar-config-fetcher-a7747f69.js');
7
+ const DataFetcher = require('./DataFetcher-04c70ba9.js');
8
8
 
9
9
  class GridConfigFetcher extends resourceFetcher.ResourceFetcher {
10
10
  constructor() {
@@ -95,24 +95,6 @@ class PersonalizedFilterFetcher {
95
95
  active
96
96
  expression
97
97
  warningMessage
98
- parameters {
99
- entityName
100
- fieldName
101
- dataType
102
- description
103
- userInterface
104
- label
105
- searchContext {
106
- entity
107
- entityDescription
108
- searchOptions {
109
- rootEntity
110
- descriptionFieldName
111
- codeFieldName
112
- showInactives
113
- }
114
- }
115
- }
116
98
  assistent
117
99
  }
118
100
  }`);
@@ -130,6 +112,13 @@ class PersonalizedFilterFetcher {
130
112
  name
131
113
  }
132
114
  }`);
115
+ this.templateByQuery.set("validateExpression", DataFetcher.dist.gql `
116
+ query($dataUnitName: String!, $expression: String!) {
117
+ $queryAlias$: validateExpression(dataUnitName: $dataUnitName, expression: $expression) {
118
+ valid
119
+ message
120
+ }
121
+ }`);
133
122
  }
134
123
  async loadPersonalizedFilter(resourceID, filterID, configName) {
135
124
  return new Promise((resolve, reject) => {
@@ -179,6 +168,21 @@ class PersonalizedFilterFetcher {
179
168
  });
180
169
  });
181
170
  }
171
+ async validatePersonalizedFilter(dataUnitName, expression) {
172
+ return new Promise((resolve, reject) => {
173
+ DataFetcher.DataFetcher.get()
174
+ .callGraphQL({
175
+ values: { dataUnitName: dataUnitName, expression: expression },
176
+ query: this.templateByQuery.get("validateExpression"),
177
+ })
178
+ .then((resp) => {
179
+ resolve(resp);
180
+ })
181
+ .catch((error) => {
182
+ reject(error);
183
+ });
184
+ });
185
+ }
182
186
  loadFields(uri) {
183
187
  return new Promise((resolve, reject) => {
184
188
  DataFetcher.DataFetcher.get()
@@ -224,17 +228,16 @@ class ConfigStorage {
224
228
  const resourceID = await application.getResourceID();
225
229
  ConfigStorage.instance = new ConfigStorage();
226
230
  ConfigStorage.resourceID = resourceID;
227
- ConfigStorage.instance.loadFilterBarConfig(configName);
228
231
  ConfigStorage.instance.loadFormConfig(configName);
229
232
  ConfigStorage.instance.loadGridConfig(configName);
230
233
  }
231
234
  }
232
235
  return this.instance;
233
236
  }
234
- async loadFilterBarConfig(name) {
237
+ async loadFilterBarConfig(name, urlParams) {
235
238
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
236
239
  if (!ConfigStorage.configById.has(cacheID)) {
237
- ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name));
240
+ ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
238
241
  }
239
242
  return ConfigStorage.configById.get(cacheID);
240
243
  }
@@ -286,6 +289,9 @@ class ConfigStorage {
286
289
  static async removePersonalizedFilter(personalizedFilter, configName) {
287
290
  return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
288
291
  }
292
+ static async validatePersonalizedFilter(dataUnitName, expression) {
293
+ return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
294
+ }
289
295
  static buildCacheID(name, source) {
290
296
  if (name == undefined) {
291
297
  return `req_${source}_${this.resourceID}`;
@@ -6468,6 +6468,7 @@ class GraphQLRecaller {
6468
6468
 
6469
6469
  class PrintUtils {
6470
6470
  constructor() {
6471
+ this.appletImpressao = new AppletImpressao();
6471
6472
  }
6472
6473
  static getInstance() {
6473
6474
  if (!PrintUtils.instance) {
@@ -6490,17 +6491,15 @@ class PrintUtils {
6490
6491
  };
6491
6492
  const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
6492
6493
  const printJobData = this.parsePrintData(response);
6493
- this.openSnkPrintSelector(printJobData);
6494
+ const pendingPrints = await this.processDirectPrint(printJobData);
6495
+ if (!pendingPrints.length)
6496
+ return;
6497
+ this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
6494
6498
  }
6495
- findLocalPrinters() {
6496
- const appletImpressao = document.getElementById('centralNotaAppletImpressao');
6497
- if (!appletImpressao)
6498
- return [];
6499
- const localPrinters = appletImpressao.getLocalPrinters();
6500
- if (!localPrinters)
6501
- return [];
6499
+ getLocalPrinters() {
6500
+ const localPrinters = this.appletImpressao.findLocalPrinters();
6502
6501
  const printers = [];
6503
- for (const printerName of localPrinters.split(',')) {
6502
+ for (const printerName of localPrinters) {
6504
6503
  printers.push({
6505
6504
  nome: printerName,
6506
6505
  printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
@@ -6509,9 +6508,6 @@ class PrintUtils {
6509
6508
  }
6510
6509
  return printers;
6511
6510
  }
6512
- getLocalPrinters() {
6513
- return this.findLocalPrinters();
6514
- }
6515
6511
  parsePrintData(payload) {
6516
6512
  const pendingPrintJobData = payload.pendindPrintJobData;
6517
6513
  if (!pendingPrintJobData)
@@ -6543,13 +6539,7 @@ class PrintUtils {
6543
6539
  }
6544
6540
  processLocalPrinting(localPrintings) {
6545
6541
  const transactionIds = localPrintings.map((item) => item.transactionId);
6546
- this.doLocalPrinting(transactionIds.join());
6547
- }
6548
- doLocalPrinting(transactionIds) {
6549
- const appletImpressao = document.getElementById('centralNotaAppletImpressao');
6550
- if (!appletImpressao)
6551
- return;
6552
- appletImpressao.doLocalPrinting(transactionIds);
6542
+ this.appletImpressao.doLocalPrinting(transactionIds.join());
6553
6543
  }
6554
6544
  async openSnkPrintSelector(printJobData) {
6555
6545
  let printSelector = document.querySelector('snk-print-selector');
@@ -6558,15 +6548,22 @@ class PrintUtils {
6558
6548
  printSelector.setAttribute('id', core.StringUtils.generateUUID());
6559
6549
  window.document.body.appendChild(printSelector);
6560
6550
  }
6561
- const selectedPrinter = await printSelector.openPrintSelector(printJobData);
6551
+ const { selectedPrinter, saveSubstitute } = await printSelector.openPrintSelector(printJobData);
6562
6552
  if (!selectedPrinter)
6563
6553
  return;
6564
- await this.saveSubstitutePrinter(printJobData.transactionId, printJobData.pendingPrinters, selectedPrinter);
6554
+ const params = {
6555
+ transactionId: printJobData.transactionId,
6556
+ pendingPrinters: printJobData.pendingPrinters,
6557
+ printerUri: selectedPrinter.printerUri,
6558
+ saveSubstitutePrinters: saveSubstitute
6559
+ };
6560
+ await this.saveSubstitutePrinter(params);
6565
6561
  }
6566
- async saveSubstitutePrinter(transactionId, pendingPrinters, printer) {
6562
+ async saveSubstitutePrinter(params) {
6563
+ const { transactionId, pendingPrinters, printerUri, saveSubstitutePrinters = false } = params;
6567
6564
  const parsedPendingPrinters = pendingPrinters.map((item) => ({
6568
6565
  printerUri: {
6569
- $: printer.printerUri
6566
+ $: item.printerUri || printerUri
6570
6567
  },
6571
6568
  originalPrinterName: {
6572
6569
  $: item.originalPrinterName
@@ -6587,7 +6584,7 @@ class PrintUtils {
6587
6584
  pendingPrinter: parsedPendingPrinters
6588
6585
  },
6589
6586
  saveSubstitutePrinters: {
6590
- $: 'false'
6587
+ $: saveSubstitutePrinters.toString()
6591
6588
  },
6592
6589
  transactionId: {
6593
6590
  $: transactionId
@@ -6596,11 +6593,78 @@ class PrintUtils {
6596
6593
  };
6597
6594
  await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
6598
6595
  }
6596
+ async processDirectPrint(printJobData) {
6597
+ const isWCRunning = this.appletImpressao.checkWebConnection();
6598
+ if (!isWCRunning) {
6599
+ return [];
6600
+ }
6601
+ const localPrinters = this.getLocalPrinters();
6602
+ if (!localPrinters.length)
6603
+ return [];
6604
+ const directPendingPrints = [];
6605
+ const pendingPrints = printJobData.pendingPrinters.filter(item => {
6606
+ const defaultPrinterName = this.getDefaultPrinterName(item.originalPrinterName);
6607
+ const isDirectPrint = !!localPrinters.find(localPrinter => localPrinter.nome === defaultPrinterName) || this.isPrinterNameAFile(defaultPrinterName);
6608
+ if (isDirectPrint) {
6609
+ directPendingPrints.push(Object.assign(Object.assign({}, item), { printerUri: PrintUtils.LOCAL_SERVER_URI + defaultPrinterName }));
6610
+ return false;
6611
+ }
6612
+ return true;
6613
+ });
6614
+ if (!directPendingPrints.length)
6615
+ return pendingPrints;
6616
+ const params = {
6617
+ transactionId: printJobData.transactionId,
6618
+ pendingPrinters: directPendingPrints
6619
+ };
6620
+ await this.saveSubstitutePrinter(params);
6621
+ return pendingPrints;
6622
+ }
6623
+ getDefaultPrinterName(printerName) {
6624
+ const defaultPrinterName = this.appletImpressao.getDefaultPrinter();
6625
+ const isDefaultPrinterName = /padr[aã]o/ig.test(printerName);
6626
+ return (defaultPrinterName && isDefaultPrinterName) ? defaultPrinterName : printerName;
6627
+ }
6628
+ isPrinterNameAFile(printerName) {
6629
+ const regExp = new RegExp("^(\w:)?[/\\\w\s]+?\.\w{3}$", "mis");
6630
+ return regExp.test(printerName);
6631
+ }
6599
6632
  }
6600
6633
  PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
6601
6634
  PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
6602
6635
  PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
6603
6636
  PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
6637
+ class AppletImpressao {
6638
+ constructor() {
6639
+ this.appletImpressao = document.getElementById('centralNotaAppletImpressao');
6640
+ }
6641
+ checkWebConnection() {
6642
+ if (!this.appletImpressao)
6643
+ return false;
6644
+ if (!this.appletImpressao.testRunningWC)
6645
+ return false;
6646
+ const isRunning = this.appletImpressao.testRunningWC();
6647
+ return !!isRunning;
6648
+ }
6649
+ findLocalPrinters() {
6650
+ if (!this.appletImpressao)
6651
+ return [];
6652
+ const localPrinters = this.appletImpressao.getLocalPrinters();
6653
+ if (!localPrinters)
6654
+ return [];
6655
+ return localPrinters.split(",");
6656
+ }
6657
+ doLocalPrinting(transactionIds) {
6658
+ if (!this.appletImpressao)
6659
+ return;
6660
+ this.appletImpressao.doLocalPrinting(transactionIds);
6661
+ }
6662
+ getDefaultPrinter() {
6663
+ if (!this.appletImpressao)
6664
+ return '';
6665
+ return this.appletImpressao.getPrintDefault();
6666
+ }
6667
+ }
6604
6668
 
6605
6669
  class DataFetcher {
6606
6670
  constructor() {
@@ -1,60 +1,21 @@
1
1
  'use strict';
2
2
 
3
3
  const core = require('@sankhyalabs/core');
4
- require('./IExpressionItem-0e32ebb7.js');
4
+ const index = require('./index-c5771aba.js');
5
5
  const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
6
6
 
7
- exports.FilterConfigType = void 0;
8
- (function (FilterConfigType) {
9
- FilterConfigType["SYSTEM_CONFIG"] = "S";
10
- FilterConfigType["USER_CONFIG"] = "E";
11
- })(exports.FilterConfigType || (exports.FilterConfigType = {}));
12
- exports.FilterUserConfigTypes = void 0;
13
- (function (FilterUserConfigTypes) {
14
- FilterUserConfigTypes["DATE"] = "D";
15
- FilterUserConfigTypes["HORA"] = "H";
16
- FilterUserConfigTypes["TEXT"] = "S";
17
- FilterUserConfigTypes["INTEGER"] = "I";
18
- FilterUserConfigTypes["DECIMAL"] = "F";
19
- FilterUserConfigTypes["NUMBER"] = "NUMBER";
20
- })(exports.FilterUserConfigTypes || (exports.FilterUserConfigTypes = {}));
21
- exports.FilterOperand = void 0;
22
- (function (FilterOperand) {
23
- FilterOperand["AND"] = "AND";
24
- FilterOperand["OR"] = "OR";
25
- FilterOperand["IN"] = "IN";
26
- FilterOperand["DIFFERENT"] = "<>";
27
- FilterOperand["LIKE"] = "LIKE";
28
- FilterOperand["START_WITH"] = "LIKE_START";
29
- FilterOperand["FINISHED_WITH"] = "LIKE_END";
30
- FilterOperand["NULL"] = "NULL";
31
- FilterOperand["NOT_NULL"] = "NOT NULL";
32
- FilterOperand["EQUAL"] = "=";
33
- FilterOperand["LARGER"] = ">";
34
- FilterOperand["LARGER_EQUAL"] = ">=";
35
- FilterOperand["SMALLER"] = "<";
36
- FilterOperand["SMALLER_EQUAL"] = "<=";
37
- })(exports.FilterOperand || (exports.FilterOperand = {}));
38
- exports.FilterEntities = void 0;
39
- (function (FilterEntities) {
40
- FilterEntities["FIELD"] = "Campo";
41
- FilterEntities["INSTANCE"] = "Instancia";
42
- })(exports.FilterEntities || (exports.FilterEntities = {}));
43
-
44
7
  class PersonalizedFilterUtils {
45
8
  /**
46
9
  * Cria uma expressão de filtro a partir de um IExpressionItem.
47
10
  * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
48
11
  * @returns Retorna a expressão de filtro.
49
12
  */
50
- static buildFilterExpression(expressionItem, ignoreInvalidExpressions = false) {
13
+ static buildFilterExpression(expressionItem) {
14
+ var _a;
51
15
  if (expressionItem == undefined) {
52
16
  return;
53
17
  }
54
- if (!this.validateExpressionItem(expressionItem) && ignoreInvalidExpressions) {
55
- return "";
56
- }
57
- let value = this.buildVariableParameterValue(expressionItem);
18
+ let value = (_a = this.buildVariableParameterValue(expressionItem)) !== null && _a !== void 0 ? _a : undefined;
58
19
  let expression = expressionItem.expression || "";
59
20
  let commas = "'";
60
21
  if (expressionItem.paramVariable) {
@@ -62,11 +23,11 @@ class PersonalizedFilterUtils {
62
23
  }
63
24
  switch (expressionItem.operand) {
64
25
  case "IN":
65
- expression += ` ${exports.FilterOperand[expressionItem.operand]} (${value})`;
26
+ expression += ` ${index.FilterOperand[expressionItem.operand]} (${value})`;
66
27
  break;
67
28
  case "NULL":
68
29
  case "NOT_NULL":
69
- expression += ` IS ${exports.FilterOperand[expressionItem.operand]}`;
30
+ expression += ` IS ${index.FilterOperand[expressionItem.operand]}`;
70
31
  break;
71
32
  case "LIKE":
72
33
  expression += ` LIKE '%${value}%'`;
@@ -78,8 +39,13 @@ class PersonalizedFilterUtils {
78
39
  expression += ` LIKE '%${value}'`;
79
40
  break;
80
41
  default:
81
- value = typeof value === 'string' ? `${commas}${value}${commas}` : value;
82
- expression += ` ${exports.FilterOperand[expressionItem.operand]} ${value}`;
42
+ if (expressionItem.operand) {
43
+ expression += ` ${index.FilterOperand[expressionItem.operand]}`;
44
+ }
45
+ if (value) {
46
+ value = isNaN(value) ? `${commas}${value}${commas}` : value;
47
+ expression += ` ${value}`;
48
+ }
83
49
  }
84
50
  return expression;
85
51
  }
@@ -95,7 +61,7 @@ class PersonalizedFilterUtils {
95
61
  if (expressionItem.paramVariable) {
96
62
  return this.proccessVarialbeParameter(expressionItem);
97
63
  }
98
- if (expressionItem.operand !== exports.FilterOperand.NULL && expressionItem.operand !== "NOT_NULL") {
64
+ if (expressionItem.operand !== index.FilterOperand.NULL && expressionItem.operand !== "NOT_NULL") {
99
65
  let value = expressionItem.value;
100
66
  const type = expressionItem.type;
101
67
  /*
@@ -103,7 +69,7 @@ class PersonalizedFilterUtils {
103
69
  pois para filtros herdados do HTML5 não temos o tipo OBJECT, fazendo com que a expressão
104
70
  fique inválida para campos do tipo pesquisa.
105
71
  */
106
- if (core.UserInterface.SEARCH === expressionItem.userInterface || core.DataType.OBJECT == type) {
72
+ if (core.UserInterface.SEARCH === expressionItem.userInterface || expressionItem.userInterface === core.UserInterface.OPTIONSELECTOR || core.DataType.OBJECT == type) {
107
73
  value = (_a = value === null || value === void 0 ? void 0 : value.value) !== null && _a !== void 0 ? _a : value;
108
74
  }
109
75
  if (core.DataType.NUMBER == type && value != undefined) {
@@ -145,11 +111,11 @@ class PersonalizedFilterUtils {
145
111
  /*
146
112
  * Cria uma expressão de filtro para um grupo de itens.
147
113
  */
148
- static buildGroupExpression(expressionGroup, ignoreInvalidExpressions = false) {
114
+ static buildGroupExpression(expressionGroup) {
149
115
  var _a, _b;
150
116
  if (!((_a = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.items) === null || _a === void 0 ? void 0 : _a.length))
151
117
  return "";
152
- const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item, ignoreInvalidExpressions)).join(` ${expressionGroup.operand} `);
118
+ const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item)).join(` ${expressionGroup.operand} `);
153
119
  if (((_b = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.childrenGroups) === null || _b === void 0 ? void 0 : _b.length) > 0) {
154
120
  const childGroupExpressions = expressionGroup.childrenGroups.map((children) => this.buildGroupExpression(children)).join(` ${expressionGroup.operand} `);
155
121
  return `(${itemExpressions} ${expressionGroup.operand} (${childGroupExpressions}))`;
@@ -236,7 +202,6 @@ class PersonalizedFilterUtils {
236
202
  * do tipo variavel;
237
203
  */
238
204
  static buildVariableParameters(expressionGroup) {
239
- var _a, _b, _c, _d;
240
205
  const allItems = this.buildPlainExpressionItems(expressionGroup);
241
206
  const allParams = [];
242
207
  for (const item of allItems) {
@@ -245,18 +210,7 @@ class PersonalizedFilterUtils {
245
210
  }
246
211
  allParams.push({
247
212
  entityName: item.entityName,
248
- fieldName: item.fieldName,
249
- dataType: item.type,
250
- description: item.description,
251
- userInterface: item.userInterface,
252
- label: item.fieldLabel,
253
- searchContext: {
254
- 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,
255
- 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,
256
- searchOptions: {
257
- showInactives: false
258
- }
259
- }
213
+ fieldName: item.fieldName
260
214
  });
261
215
  }
262
216
  return allParams;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const ConfigStorage = require('./ConfigStorage-3aaa8a9f.js');
3
+ const ConfigStorage = require('./ConfigStorage-97468a0f.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const formConfigFetcher = require('./form-config-fetcher-affb0b28.js');
5
+ const formConfigFetcher = require('./form-config-fetcher-56442594.js');
6
6
 
7
7
  class SnkFormConfigManager {
8
8
  constructor(configName, onConfigChange) {
@@ -381,12 +381,16 @@ const snkPersonalizedFilterMessages = {
381
381
  labelCancel: "Cancelar",
382
382
  labelSave: "Salvar",
383
383
  labelNameFilter: "Nome do filtro",
384
- labelExpression: "Expressão SQL",
384
+ labelExpression: "Expressão",
385
385
  badgeVariable: "variável",
386
386
  noDataFound: "Nenhum filtro encontrado",
387
387
  condition: "Condição",
388
388
  addGroup: "Adicionar grupo",
389
- applyExpression: "Expressão a ser aplicada:"
389
+ addField: "Adicionar campo",
390
+ applyExpression: "Expressão a ser aplicada:",
391
+ tooltipDisabledAssistentMode: "Expressão não suportada pelo assistente.",
392
+ activeModeAdvanced: "Ativar modo avançado",
393
+ activeModeAssistent: "Ativar modo assistente"
390
394
  },
391
395
  confirmExpression: {
392
396
  title: "Aviso",
@@ -400,6 +404,18 @@ const snkPersonalizedFilterMessages = {
400
404
  title: "Aviso",
401
405
  description: `As alterações realizadas serão descartadas.</br></br><b>Gostaria de continuar?</b>`
402
406
  },
407
+ confirmChangeModeAssistent: {
408
+ title: "Aviso",
409
+ description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
410
+ },
411
+ confirmChangeModeAdvanced: {
412
+ title: "Aviso",
413
+ description: `Ao retornar ao modo assistente suas alterações serão perdidas.</br></br><b>Gostaria de continuar?</b>`
414
+ },
415
+ confirmSaveModeAdvanced: {
416
+ title: "Aviso",
417
+ description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
418
+ },
403
419
  operador: {
404
420
  firstLevel: "A seleção será habilitada a partir da adição da segunda linha de regras.",
405
421
  and: "Será verdadeiro se todas as condições forem obedecidas.",
@@ -474,7 +490,8 @@ const snkPrintSelectorMessages = {
474
490
  },
475
491
  message: {
476
492
  canceledPrint: "A impressão será cancelada. Deseja mesmo continuar?",
477
- noPrinters: "Não há impressoras para seleção"
493
+ noPrinters: "Não há impressoras para seleção",
494
+ savePrinter: "Usar sempre esta seleção"
478
495
  },
479
496
  button: {
480
497
  print: "Imprimir",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const core = require('@sankhyalabs/core');
4
- const DataFetcher = require('./DataFetcher-093c47ae.js');
4
+ const DataFetcher = require('./DataFetcher-04c70ba9.js');
5
5
  const constants = require('@sankhyalabs/ezui/dist/collection/utils/constants');
6
6
  const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
4
- const resourceFetcher = require('./resource-fetcher-e71a11b8.js');
4
+ const resourceFetcher = require('./resource-fetcher-260e98a4.js');
5
5
 
6
6
  var __rest = (undefined && undefined.__rest) || function (s, e) {
7
7
  var t = {};
@@ -77,9 +77,9 @@ class FilterBarConfigFetcher extends resourceFetcher.ResourceFetcher {
77
77
  saveConfig(items, resourceID, configName) {
78
78
  return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
79
79
  }
80
- getConfig(resourceID, configName) {
80
+ getConfig(resourceID, configName, urlParams) {
81
81
  return new Promise((accept, reject) => {
82
- this.loadResource(this.getPath(resourceID, configName))
82
+ this.loadResource(this.getPath(resourceID, configName, urlParams))
83
83
  .then((configAsString) => {
84
84
  let fieldsList;
85
85
  if (configAsString) {
@@ -127,11 +127,28 @@ class FilterBarConfigFetcher extends resourceFetcher.ResourceFetcher {
127
127
  return item;
128
128
  });
129
129
  }
130
- getPath(resourceID, name) {
130
+ getPath(resourceID, name, urlParams) {
131
+ let path = `cfg://filter/FilterBarState:${resourceID}`;
131
132
  if (name) {
132
- return `cfg://filter/FilterBarState:${resourceID}.${name}`;
133
+ path += `.${name}`;
133
134
  }
134
- return `cfg://filter/FilterBarState:${resourceID}`;
135
+ if (urlParams) {
136
+ path += this.buildQueryString(urlParams);
137
+ }
138
+ return path;
139
+ }
140
+ buildQueryString(urlParams) {
141
+ let queryString = '?';
142
+ for (let key in urlParams) {
143
+ if (!urlParams.hasOwnProperty(key)) {
144
+ continue;
145
+ }
146
+ if (queryString.length > 1) {
147
+ queryString += '&';
148
+ }
149
+ queryString += key + '=' + urlParams[key];
150
+ }
151
+ return queryString;
135
152
  }
136
153
  }
137
154
 
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const DataFetcher = require('./DataFetcher-093c47ae.js');
3
+ const DataFetcher = require('./DataFetcher-04c70ba9.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const resourceFetcher = require('./resource-fetcher-e71a11b8.js');
5
+ const resourceFetcher = require('./resource-fetcher-260e98a4.js');
6
6
 
7
7
  class FormConfigFetcher extends resourceFetcher.ResourceFetcher {
8
8
  constructor() {
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ exports.SelectedItemType = void 0;
4
+ (function (SelectedItemType) {
5
+ SelectedItemType["LINK"] = "LINK";
6
+ SelectedItemType["FIELD"] = "FIELD";
7
+ })(exports.SelectedItemType || (exports.SelectedItemType = {}));
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ exports.FilterGroupCondition = void 0;
4
+ (function (FilterGroupCondition) {
5
+ FilterGroupCondition["AND"] = "AND";
6
+ FilterGroupCondition["OR"] = "OR";
7
+ })(exports.FilterGroupCondition || (exports.FilterGroupCondition = {}));
8
+
9
+ exports.FilterConfigType = void 0;
10
+ (function (FilterConfigType) {
11
+ FilterConfigType["SYSTEM_CONFIG"] = "S";
12
+ FilterConfigType["USER_CONFIG"] = "E";
13
+ })(exports.FilterConfigType || (exports.FilterConfigType = {}));
14
+ exports.FilterUserConfigTypes = void 0;
15
+ (function (FilterUserConfigTypes) {
16
+ FilterUserConfigTypes["DATE"] = "D";
17
+ FilterUserConfigTypes["HORA"] = "H";
18
+ FilterUserConfigTypes["TEXT"] = "S";
19
+ FilterUserConfigTypes["INTEGER"] = "I";
20
+ FilterUserConfigTypes["DECIMAL"] = "F";
21
+ FilterUserConfigTypes["NUMBER"] = "NUMBER";
22
+ })(exports.FilterUserConfigTypes || (exports.FilterUserConfigTypes = {}));
23
+ exports.FilterOperand = void 0;
24
+ (function (FilterOperand) {
25
+ FilterOperand["AND"] = "AND";
26
+ FilterOperand["OR"] = "OR";
27
+ FilterOperand["IN"] = "IN";
28
+ FilterOperand["DIFFERENT"] = "<>";
29
+ FilterOperand["LIKE"] = "LIKE";
30
+ FilterOperand["START_WITH"] = "LIKE_START";
31
+ FilterOperand["FINISHED_WITH"] = "LIKE_END";
32
+ FilterOperand["NULL"] = "NULL";
33
+ FilterOperand["NOT_NULL"] = "NOT NULL";
34
+ FilterOperand["EQUAL"] = "=";
35
+ FilterOperand["LARGER"] = ">";
36
+ FilterOperand["LARGER_EQUAL"] = ">=";
37
+ FilterOperand["SMALLER"] = "<";
38
+ FilterOperand["SMALLER_EQUAL"] = "<=";
39
+ })(exports.FilterOperand || (exports.FilterOperand = {}));
40
+ exports.FilterEntities = void 0;
41
+ (function (FilterEntities) {
42
+ FilterEntities["FIELD"] = "Campo";
43
+ FilterEntities["INSTANCE"] = "Instancia";
44
+ })(exports.FilterEntities || (exports.FilterEntities = {}));