@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
@@ -6466,6 +6466,7 @@ class GraphQLRecaller {
6466
6466
 
6467
6467
  class PrintUtils {
6468
6468
  constructor() {
6469
+ this.appletImpressao = new AppletImpressao();
6469
6470
  }
6470
6471
  static getInstance() {
6471
6472
  if (!PrintUtils.instance) {
@@ -6488,17 +6489,15 @@ class PrintUtils {
6488
6489
  };
6489
6490
  const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
6490
6491
  const printJobData = this.parsePrintData(response);
6491
- this.openSnkPrintSelector(printJobData);
6492
+ const pendingPrints = await this.processDirectPrint(printJobData);
6493
+ if (!pendingPrints.length)
6494
+ return;
6495
+ this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
6492
6496
  }
6493
- findLocalPrinters() {
6494
- const appletImpressao = document.getElementById('centralNotaAppletImpressao');
6495
- if (!appletImpressao)
6496
- return [];
6497
- const localPrinters = appletImpressao.getLocalPrinters();
6498
- if (!localPrinters)
6499
- return [];
6497
+ getLocalPrinters() {
6498
+ const localPrinters = this.appletImpressao.findLocalPrinters();
6500
6499
  const printers = [];
6501
- for (const printerName of localPrinters.split(',')) {
6500
+ for (const printerName of localPrinters) {
6502
6501
  printers.push({
6503
6502
  nome: printerName,
6504
6503
  printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
@@ -6507,9 +6506,6 @@ class PrintUtils {
6507
6506
  }
6508
6507
  return printers;
6509
6508
  }
6510
- getLocalPrinters() {
6511
- return this.findLocalPrinters();
6512
- }
6513
6509
  parsePrintData(payload) {
6514
6510
  const pendingPrintJobData = payload.pendindPrintJobData;
6515
6511
  if (!pendingPrintJobData)
@@ -6541,13 +6537,7 @@ class PrintUtils {
6541
6537
  }
6542
6538
  processLocalPrinting(localPrintings) {
6543
6539
  const transactionIds = localPrintings.map((item) => item.transactionId);
6544
- this.doLocalPrinting(transactionIds.join());
6545
- }
6546
- doLocalPrinting(transactionIds) {
6547
- const appletImpressao = document.getElementById('centralNotaAppletImpressao');
6548
- if (!appletImpressao)
6549
- return;
6550
- appletImpressao.doLocalPrinting(transactionIds);
6540
+ this.appletImpressao.doLocalPrinting(transactionIds.join());
6551
6541
  }
6552
6542
  async openSnkPrintSelector(printJobData) {
6553
6543
  let printSelector = document.querySelector('snk-print-selector');
@@ -6556,15 +6546,22 @@ class PrintUtils {
6556
6546
  printSelector.setAttribute('id', StringUtils.generateUUID());
6557
6547
  window.document.body.appendChild(printSelector);
6558
6548
  }
6559
- const selectedPrinter = await printSelector.openPrintSelector(printJobData);
6549
+ const { selectedPrinter, saveSubstitute } = await printSelector.openPrintSelector(printJobData);
6560
6550
  if (!selectedPrinter)
6561
6551
  return;
6562
- await this.saveSubstitutePrinter(printJobData.transactionId, printJobData.pendingPrinters, selectedPrinter);
6552
+ const params = {
6553
+ transactionId: printJobData.transactionId,
6554
+ pendingPrinters: printJobData.pendingPrinters,
6555
+ printerUri: selectedPrinter.printerUri,
6556
+ saveSubstitutePrinters: saveSubstitute
6557
+ };
6558
+ await this.saveSubstitutePrinter(params);
6563
6559
  }
6564
- async saveSubstitutePrinter(transactionId, pendingPrinters, printer) {
6560
+ async saveSubstitutePrinter(params) {
6561
+ const { transactionId, pendingPrinters, printerUri, saveSubstitutePrinters = false } = params;
6565
6562
  const parsedPendingPrinters = pendingPrinters.map((item) => ({
6566
6563
  printerUri: {
6567
- $: printer.printerUri
6564
+ $: item.printerUri || printerUri
6568
6565
  },
6569
6566
  originalPrinterName: {
6570
6567
  $: item.originalPrinterName
@@ -6585,7 +6582,7 @@ class PrintUtils {
6585
6582
  pendingPrinter: parsedPendingPrinters
6586
6583
  },
6587
6584
  saveSubstitutePrinters: {
6588
- $: 'false'
6585
+ $: saveSubstitutePrinters.toString()
6589
6586
  },
6590
6587
  transactionId: {
6591
6588
  $: transactionId
@@ -6594,11 +6591,78 @@ class PrintUtils {
6594
6591
  };
6595
6592
  await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
6596
6593
  }
6594
+ async processDirectPrint(printJobData) {
6595
+ const isWCRunning = this.appletImpressao.checkWebConnection();
6596
+ if (!isWCRunning) {
6597
+ return [];
6598
+ }
6599
+ const localPrinters = this.getLocalPrinters();
6600
+ if (!localPrinters.length)
6601
+ return [];
6602
+ const directPendingPrints = [];
6603
+ const pendingPrints = printJobData.pendingPrinters.filter(item => {
6604
+ const defaultPrinterName = this.getDefaultPrinterName(item.originalPrinterName);
6605
+ const isDirectPrint = !!localPrinters.find(localPrinter => localPrinter.nome === defaultPrinterName) || this.isPrinterNameAFile(defaultPrinterName);
6606
+ if (isDirectPrint) {
6607
+ directPendingPrints.push(Object.assign(Object.assign({}, item), { printerUri: PrintUtils.LOCAL_SERVER_URI + defaultPrinterName }));
6608
+ return false;
6609
+ }
6610
+ return true;
6611
+ });
6612
+ if (!directPendingPrints.length)
6613
+ return pendingPrints;
6614
+ const params = {
6615
+ transactionId: printJobData.transactionId,
6616
+ pendingPrinters: directPendingPrints
6617
+ };
6618
+ await this.saveSubstitutePrinter(params);
6619
+ return pendingPrints;
6620
+ }
6621
+ getDefaultPrinterName(printerName) {
6622
+ const defaultPrinterName = this.appletImpressao.getDefaultPrinter();
6623
+ const isDefaultPrinterName = /padr[aã]o/ig.test(printerName);
6624
+ return (defaultPrinterName && isDefaultPrinterName) ? defaultPrinterName : printerName;
6625
+ }
6626
+ isPrinterNameAFile(printerName) {
6627
+ const regExp = new RegExp("^(\w:)?[/\\\w\s]+?\.\w{3}$", "mis");
6628
+ return regExp.test(printerName);
6629
+ }
6597
6630
  }
6598
6631
  PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
6599
6632
  PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
6600
6633
  PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
6601
6634
  PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
6635
+ class AppletImpressao {
6636
+ constructor() {
6637
+ this.appletImpressao = document.getElementById('centralNotaAppletImpressao');
6638
+ }
6639
+ checkWebConnection() {
6640
+ if (!this.appletImpressao)
6641
+ return false;
6642
+ if (!this.appletImpressao.testRunningWC)
6643
+ return false;
6644
+ const isRunning = this.appletImpressao.testRunningWC();
6645
+ return !!isRunning;
6646
+ }
6647
+ findLocalPrinters() {
6648
+ if (!this.appletImpressao)
6649
+ return [];
6650
+ const localPrinters = this.appletImpressao.getLocalPrinters();
6651
+ if (!localPrinters)
6652
+ return [];
6653
+ return localPrinters.split(",");
6654
+ }
6655
+ doLocalPrinting(transactionIds) {
6656
+ if (!this.appletImpressao)
6657
+ return;
6658
+ this.appletImpressao.doLocalPrinting(transactionIds);
6659
+ }
6660
+ getDefaultPrinter() {
6661
+ if (!this.appletImpressao)
6662
+ return '';
6663
+ return this.appletImpressao.getPrintDefault();
6664
+ }
6665
+ }
6602
6666
 
6603
6667
  class DataFetcher {
6604
6668
  constructor() {
@@ -50,14 +50,12 @@ class PersonalizedFilterUtils {
50
50
  * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
51
51
  * @returns Retorna a expressão de filtro.
52
52
  */
53
- static buildFilterExpression(expressionItem, ignoreInvalidExpressions = false) {
53
+ static buildFilterExpression(expressionItem) {
54
+ var _a;
54
55
  if (expressionItem == undefined) {
55
56
  return;
56
57
  }
57
- if (!this.validateExpressionItem(expressionItem) && ignoreInvalidExpressions) {
58
- return "";
59
- }
60
- let value = this.buildVariableParameterValue(expressionItem);
58
+ let value = (_a = this.buildVariableParameterValue(expressionItem)) !== null && _a !== void 0 ? _a : undefined;
61
59
  let expression = expressionItem.expression || "";
62
60
  let commas = "'";
63
61
  if (expressionItem.paramVariable) {
@@ -81,8 +79,13 @@ class PersonalizedFilterUtils {
81
79
  expression += ` LIKE '%${value}'`;
82
80
  break;
83
81
  default:
84
- value = typeof value === 'string' ? `${commas}${value}${commas}` : value;
85
- expression += ` ${FilterOperand[expressionItem.operand]} ${value}`;
82
+ if (expressionItem.operand) {
83
+ expression += ` ${FilterOperand[expressionItem.operand]}`;
84
+ }
85
+ if (value) {
86
+ value = isNaN(value) ? `${commas}${value}${commas}` : value;
87
+ expression += ` ${value}`;
88
+ }
86
89
  }
87
90
  return expression;
88
91
  }
@@ -106,7 +109,7 @@ class PersonalizedFilterUtils {
106
109
  pois para filtros herdados do HTML5 não temos o tipo OBJECT, fazendo com que a expressão
107
110
  fique inválida para campos do tipo pesquisa.
108
111
  */
109
- if (UserInterface.SEARCH === expressionItem.userInterface || DataType.OBJECT == type) {
112
+ if (UserInterface.SEARCH === expressionItem.userInterface || expressionItem.userInterface === UserInterface.OPTIONSELECTOR || DataType.OBJECT == type) {
110
113
  value = (_a = value === null || value === void 0 ? void 0 : value.value) !== null && _a !== void 0 ? _a : value;
111
114
  }
112
115
  if (DataType.NUMBER == type && value != undefined) {
@@ -148,11 +151,11 @@ class PersonalizedFilterUtils {
148
151
  /*
149
152
  * Cria uma expressão de filtro para um grupo de itens.
150
153
  */
151
- static buildGroupExpression(expressionGroup, ignoreInvalidExpressions = false) {
154
+ static buildGroupExpression(expressionGroup) {
152
155
  var _a, _b;
153
156
  if (!((_a = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.items) === null || _a === void 0 ? void 0 : _a.length))
154
157
  return "";
155
- const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item, ignoreInvalidExpressions)).join(` ${expressionGroup.operand} `);
158
+ const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item)).join(` ${expressionGroup.operand} `);
156
159
  if (((_b = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.childrenGroups) === null || _b === void 0 ? void 0 : _b.length) > 0) {
157
160
  const childGroupExpressions = expressionGroup.childrenGroups.map((children) => this.buildGroupExpression(children)).join(` ${expressionGroup.operand} `);
158
161
  return `(${itemExpressions} ${expressionGroup.operand} (${childGroupExpressions}))`;
@@ -239,7 +242,6 @@ class PersonalizedFilterUtils {
239
242
  * do tipo variavel;
240
243
  */
241
244
  static buildVariableParameters(expressionGroup) {
242
- var _a, _b, _c, _d;
243
245
  const allItems = this.buildPlainExpressionItems(expressionGroup);
244
246
  const allParams = [];
245
247
  for (const item of allItems) {
@@ -248,18 +250,7 @@ class PersonalizedFilterUtils {
248
250
  }
249
251
  allParams.push({
250
252
  entityName: item.entityName,
251
- fieldName: item.fieldName,
252
- dataType: item.type,
253
- description: item.description,
254
- userInterface: item.userInterface,
255
- label: item.fieldLabel,
256
- searchContext: {
257
- 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,
258
- 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,
259
- searchOptions: {
260
- showInactives: false
261
- }
262
- }
253
+ fieldName: item.fieldName
263
254
  });
264
255
  }
265
256
  return allParams;
@@ -359,12 +359,16 @@ const snkPersonalizedFilterMessages = {
359
359
  labelCancel: "Cancelar",
360
360
  labelSave: "Salvar",
361
361
  labelNameFilter: "Nome do filtro",
362
- labelExpression: "Expressão SQL",
362
+ labelExpression: "Expressão",
363
363
  badgeVariable: "variável",
364
364
  noDataFound: "Nenhum filtro encontrado",
365
365
  condition: "Condição",
366
366
  addGroup: "Adicionar grupo",
367
- applyExpression: "Expressão a ser aplicada:"
367
+ addField: "Adicionar campo",
368
+ applyExpression: "Expressão a ser aplicada:",
369
+ tooltipDisabledAssistentMode: "Expressão não suportada pelo assistente.",
370
+ activeModeAdvanced: "Ativar modo avançado",
371
+ activeModeAssistent: "Ativar modo assistente"
368
372
  },
369
373
  confirmExpression: {
370
374
  title: "Aviso",
@@ -378,6 +382,18 @@ const snkPersonalizedFilterMessages = {
378
382
  title: "Aviso",
379
383
  description: `As alterações realizadas serão descartadas.</br></br><b>Gostaria de continuar?</b>`
380
384
  },
385
+ confirmChangeModeAssistent: {
386
+ title: "Aviso",
387
+ description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
388
+ },
389
+ confirmChangeModeAdvanced: {
390
+ title: "Aviso",
391
+ description: `Ao retornar ao modo assistente suas alterações serão perdidas.</br></br><b>Gostaria de continuar?</b>`
392
+ },
393
+ confirmSaveModeAdvanced: {
394
+ title: "Aviso",
395
+ description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
396
+ },
381
397
  operador: {
382
398
  firstLevel: "A seleção será habilitada a partir da adição da segunda linha de regras.",
383
399
  and: "Será verdadeiro se todas as condições forem obedecidas.",
@@ -452,7 +468,8 @@ const snkPrintSelectorMessages = {
452
468
  },
453
469
  message: {
454
470
  canceledPrint: "A impressão será cancelada. Deseja mesmo continuar?",
455
- noPrinters: "Não há impressoras para seleção"
471
+ noPrinters: "Não há impressoras para seleção",
472
+ savePrinter: "Usar sempre esta seleção"
456
473
  },
457
474
  button: {
458
475
  print: "Imprimir",
@@ -75,9 +75,9 @@ 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,11 +125,28 @@ 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
  }
135
152
 
@@ -15,6 +15,8 @@ export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/compo
15
15
  export { SnkExpressionGroup as SnkExpressionGroup } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group';
16
16
  export { SnkExpressionItem as SnkExpressionItem } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item';
17
17
  export { SnkFieldConfig as SnkFieldConfig } from '../types/components/snk-form/subcomponents/snk-field-config/snk-field-config';
18
+ export { SnkFilterAdvancedMode as SnkFilterAdvancedMode } from '../types/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode';
19
+ export { SnkFilterAssistentMode as SnkFilterAssistentMode } from '../types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode';
18
20
  export { SnkFilterBar as SnkFilterBar } from '../types/components/snk-filter-bar/snk-filter-bar';
19
21
  export { SnkFilterBinarySelect as SnkFilterBinarySelect } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select';
20
22
  export { SnkFilterDetail as SnkFilterDetail } from '../types/components/snk-filter-bar/filter-item/snk-filter-detail';
@@ -15,6 +15,8 @@ export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkEx
15
15
  export { SnkExpressionGroup, defineCustomElement as defineCustomElementSnkExpressionGroup } from './snk-expression-group.js';
16
16
  export { SnkExpressionItem, defineCustomElement as defineCustomElementSnkExpressionItem } from './snk-expression-item.js';
17
17
  export { SnkFieldConfig, defineCustomElement as defineCustomElementSnkFieldConfig } from './snk-field-config.js';
18
+ export { SnkFilterAdvancedMode, defineCustomElement as defineCustomElementSnkFilterAdvancedMode } from './snk-filter-advanced-mode.js';
19
+ export { SnkFilterAssistentMode, defineCustomElement as defineCustomElementSnkFilterAssistentMode } from './snk-filter-assistent-mode.js';
18
20
  export { SnkFilterBar, defineCustomElement as defineCustomElementSnkFilterBar } from './snk-filter-bar.js';
19
21
  export { SnkFilterBinarySelect, defineCustomElement as defineCustomElementSnkFilterBinarySelect } from './snk-filter-binary-select.js';
20
22
  export { SnkFilterDetail, defineCustomElement as defineCustomElementSnkFilterDetail } from './snk-filter-detail.js';
@@ -5,17 +5,19 @@ import './DataFetcher.js';
5
5
  import './pesquisa-fetcher.js';
6
6
  import { P as PresentationMode } from './index2.js';
7
7
  import { V as VIEW_MODE } from './constants.js';
8
- import { d as defineCustomElement$t } from './snk-actions-button2.js';
9
- import { d as defineCustomElement$s } from './snk-attach2.js';
10
- import { d as defineCustomElement$r } from './snk-config-options2.js';
11
- import { d as defineCustomElement$q } from './snk-configurator2.js';
12
- import { d as defineCustomElement$p } from './snk-data-exporter2.js';
13
- import { d as defineCustomElement$o } from './snk-data-unit2.js';
14
- import { d as defineCustomElement$8, a as defineCustomElement$n } from './snk-detail-view2.js';
15
- import { d as defineCustomElement$m } from './snk-exporter-email-sender2.js';
16
- import { d as defineCustomElement$l } from './snk-expression-group2.js';
17
- import { d as defineCustomElement$k } from './snk-expression-item2.js';
18
- import { d as defineCustomElement$j } from './snk-field-config2.js';
8
+ import { d as defineCustomElement$v } from './snk-actions-button2.js';
9
+ import { d as defineCustomElement$u } from './snk-attach2.js';
10
+ import { d as defineCustomElement$t } from './snk-config-options2.js';
11
+ import { d as defineCustomElement$s } from './snk-configurator2.js';
12
+ import { d as defineCustomElement$r } from './snk-data-exporter2.js';
13
+ import { d as defineCustomElement$q } from './snk-data-unit2.js';
14
+ import { d as defineCustomElement$8, a as defineCustomElement$p } from './snk-detail-view2.js';
15
+ import { d as defineCustomElement$o } from './snk-exporter-email-sender2.js';
16
+ import { d as defineCustomElement$n } from './snk-expression-group2.js';
17
+ import { d as defineCustomElement$m } from './snk-expression-item2.js';
18
+ import { d as defineCustomElement$l } from './snk-field-config2.js';
19
+ import { d as defineCustomElement$k } from './snk-filter-advanced-mode2.js';
20
+ import { d as defineCustomElement$j } from './snk-filter-assistent-mode2.js';
19
21
  import { d as defineCustomElement$i } from './snk-filter-bar2.js';
20
22
  import { d as defineCustomElement$h } from './snk-filter-detail2.js';
21
23
  import { d as defineCustomElement$g } from './snk-filter-field-search2.js';
@@ -216,7 +218,7 @@ function defineCustomElement$1() {
216
218
  if (typeof customElements === "undefined") {
217
219
  return;
218
220
  }
219
- const components = ["snk-crud", "snk-actions-button", "snk-attach", "snk-config-options", "snk-configurator", "snk-data-exporter", "snk-data-unit", "snk-detail-view", "snk-exporter-email-sender", "snk-expression-group", "snk-expression-item", "snk-field-config", "snk-filter-bar", "snk-filter-detail", "snk-filter-field-search", "snk-filter-item", "snk-filter-param-config", "snk-form-config", "snk-form-summary", "snk-form-view", "snk-grid", "snk-grid-config", "snk-guides-viewer", "snk-personalized-filter", "snk-select-box", "snk-simple-bar", "snk-simple-crud", "snk-tab-config", "snk-taskbar"];
221
+ const components = ["snk-crud", "snk-actions-button", "snk-attach", "snk-config-options", "snk-configurator", "snk-data-exporter", "snk-data-unit", "snk-detail-view", "snk-exporter-email-sender", "snk-expression-group", "snk-expression-item", "snk-field-config", "snk-filter-advanced-mode", "snk-filter-assistent-mode", "snk-filter-bar", "snk-filter-detail", "snk-filter-field-search", "snk-filter-item", "snk-filter-param-config", "snk-form-config", "snk-form-summary", "snk-form-view", "snk-grid", "snk-grid-config", "snk-guides-viewer", "snk-personalized-filter", "snk-select-box", "snk-simple-bar", "snk-simple-crud", "snk-tab-config", "snk-taskbar"];
220
222
  components.forEach(tagName => { switch (tagName) {
221
223
  case "snk-crud":
222
224
  if (!customElements.get(tagName)) {
@@ -225,55 +227,65 @@ function defineCustomElement$1() {
225
227
  break;
226
228
  case "snk-actions-button":
227
229
  if (!customElements.get(tagName)) {
228
- defineCustomElement$t();
230
+ defineCustomElement$v();
229
231
  }
230
232
  break;
231
233
  case "snk-attach":
232
234
  if (!customElements.get(tagName)) {
233
- defineCustomElement$s();
235
+ defineCustomElement$u();
234
236
  }
235
237
  break;
236
238
  case "snk-config-options":
237
239
  if (!customElements.get(tagName)) {
238
- defineCustomElement$r();
240
+ defineCustomElement$t();
239
241
  }
240
242
  break;
241
243
  case "snk-configurator":
242
244
  if (!customElements.get(tagName)) {
243
- defineCustomElement$q();
245
+ defineCustomElement$s();
244
246
  }
245
247
  break;
246
248
  case "snk-data-exporter":
247
249
  if (!customElements.get(tagName)) {
248
- defineCustomElement$p();
250
+ defineCustomElement$r();
249
251
  }
250
252
  break;
251
253
  case "snk-data-unit":
252
254
  if (!customElements.get(tagName)) {
253
- defineCustomElement$o();
255
+ defineCustomElement$q();
254
256
  }
255
257
  break;
256
258
  case "snk-detail-view":
257
259
  if (!customElements.get(tagName)) {
258
- defineCustomElement$n();
260
+ defineCustomElement$p();
259
261
  }
260
262
  break;
261
263
  case "snk-exporter-email-sender":
262
264
  if (!customElements.get(tagName)) {
263
- defineCustomElement$m();
265
+ defineCustomElement$o();
264
266
  }
265
267
  break;
266
268
  case "snk-expression-group":
267
269
  if (!customElements.get(tagName)) {
268
- defineCustomElement$l();
270
+ defineCustomElement$n();
269
271
  }
270
272
  break;
271
273
  case "snk-expression-item":
272
274
  if (!customElements.get(tagName)) {
273
- defineCustomElement$k();
275
+ defineCustomElement$m();
274
276
  }
275
277
  break;
276
278
  case "snk-field-config":
279
+ if (!customElements.get(tagName)) {
280
+ defineCustomElement$l();
281
+ }
282
+ break;
283
+ case "snk-filter-advanced-mode":
284
+ if (!customElements.get(tagName)) {
285
+ defineCustomElement$k();
286
+ }
287
+ break;
288
+ case "snk-filter-assistent-mode":
277
289
  if (!customElements.get(tagName)) {
278
290
  defineCustomElement$j();
279
291
  }