@sankhyalabs/sankhyablocks 8.16.0-rc.2 → 8.16.0-rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/dist/cjs/{ConfigStorage-a343e418.js → ConfigStorage-e49214c6.js} +2 -2
  2. package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-77729a93.js} +7 -2
  3. package/dist/cjs/{IExporterProvider-597949f9.js → IExporterProvider-10b7fed5.js} +4 -4
  4. package/dist/cjs/{SnkFormConfigManager-166cbd1f.js → SnkFormConfigManager-beebf47a.js} +2 -2
  5. package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-29bb791c.js} +1 -1
  6. package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-d4873076.js} +1 -1
  7. package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-feb08214.js} +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-a1d0353f.js} +1 -1
  9. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  10. package/dist/cjs/snk-application.cjs.entry.js +6 -6
  11. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  12. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  14. package/dist/cjs/{snk-data-unit-8fa7917a.js → snk-data-unit-ece44c4a.js} +1 -1
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  16. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  17. package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -3
  18. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  19. package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
  20. package/dist/cjs/snk-form.cjs.entry.js +4 -4
  21. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  22. package/dist/cjs/{snk-guides-viewer-bdc41281.js → snk-guides-viewer-69ec61af.js} +5 -5
  23. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  24. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  25. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  26. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -3
  27. package/dist/components/DataFetcher.js +8 -3
  28. package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-e476378d.js} +2 -2
  29. package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-773a3e4b.js} +8 -3
  30. package/dist/esm/{IExporterProvider-63a188b6.js → IExporterProvider-d597f27d.js} +4 -4
  31. package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-298cd647.js} +2 -2
  32. package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-a411f73c.js} +1 -1
  33. package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-3d2ec959.js} +1 -1
  34. package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-e0382e5a.js} +1 -1
  35. package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-a87445a0.js} +1 -1
  36. package/dist/esm/snk-actions-button_4.entry.js +5 -5
  37. package/dist/esm/snk-application.entry.js +6 -6
  38. package/dist/esm/snk-attach.entry.js +5 -5
  39. package/dist/esm/snk-crud.entry.js +5 -5
  40. package/dist/esm/snk-data-exporter.entry.js +5 -5
  41. package/dist/esm/{snk-data-unit-f5cbe64b.js → snk-data-unit-2a1d5d09.js} +1 -1
  42. package/dist/esm/snk-data-unit.entry.js +3 -3
  43. package/dist/esm/snk-detail-view.entry.js +7 -7
  44. package/dist/esm/snk-filter-bar.entry.js +3 -3
  45. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  46. package/dist/esm/snk-form-config.entry.js +2 -2
  47. package/dist/esm/snk-form.entry.js +4 -4
  48. package/dist/esm/snk-grid.entry.js +6 -6
  49. package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-43f21b03.js} +5 -5
  50. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  51. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  52. package/dist/esm/snk-simple-crud.entry.js +7 -7
  53. package/dist/sankhyablocks/{p-fe79f83a.js → p-091ce761.js} +1 -1
  54. package/dist/sankhyablocks/{p-913a9979.js → p-0cd3c0a9.js} +1 -1
  55. package/dist/sankhyablocks/{p-df5451c7.js → p-181975f1.js} +1 -1
  56. package/dist/sankhyablocks/{p-8c59edd7.entry.js → p-1e971cb0.entry.js} +1 -1
  57. package/dist/sankhyablocks/{p-fa4d8cb4.js → p-1f35c795.js} +1 -1
  58. package/dist/sankhyablocks/{p-af8efd95.js → p-25f1fc39.js} +1 -1
  59. package/dist/sankhyablocks/{p-62ba211a.entry.js → p-2e9c764c.entry.js} +1 -1
  60. package/dist/sankhyablocks/{p-52920496.js → p-3287a6cc.js} +1 -1
  61. package/dist/sankhyablocks/{p-4e5e1313.entry.js → p-421bec84.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-7505da04.entry.js → p-42f7b05d.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-b05d8893.entry.js → p-53412c1d.entry.js} +1 -1
  64. package/dist/sankhyablocks/p-594bc21d.js +1 -0
  65. package/dist/sankhyablocks/{p-2a408684.js → p-5f016aed.js} +1 -1
  66. package/dist/sankhyablocks/{p-d6e26ea8.entry.js → p-62f34e6f.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-6bb2f3e9.entry.js → p-631954eb.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-7a85fd49.entry.js → p-65f8c11c.entry.js} +1 -1
  69. package/dist/sankhyablocks/{p-80042dc6.entry.js → p-684a2590.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-3a212712.js → p-76a65660.js} +1 -1
  71. package/dist/sankhyablocks/p-7b8f7242.entry.js +1 -0
  72. package/dist/sankhyablocks/{p-450c60e4.entry.js → p-939e15d3.entry.js} +1 -1
  73. package/dist/sankhyablocks/{p-47db7e88.entry.js → p-9dfda04a.entry.js} +1 -1
  74. package/dist/sankhyablocks/{p-871aa14e.entry.js → p-ba25555b.entry.js} +1 -1
  75. package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-bd008859.entry.js} +1 -1
  76. package/dist/sankhyablocks/{p-7619bdb1.entry.js → p-d6610d11.entry.js} +2 -2
  77. package/dist/sankhyablocks/{p-17def7cd.js → p-ffa5e4ff.js} +1 -1
  78. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  79. package/package.json +1 -1
  80. package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
  81. package/dist/sankhyablocks/p-dc7c9047.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { ObjectUtils, DataUnit, DataType, DateUtils, StringUtils, ChangeOperation, ApplicationContext, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
2
- import { D as DataFetcher, d as dist } from './DataFetcher-c1baf61d.js';
2
+ import { D as DataFetcher, d as dist } from './DataFetcher-773a3e4b.js';
3
3
  import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
4
4
  import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
5
5
  import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -1,4 +1,4 @@
1
- import { d as dist, D as DataFetcher } from './DataFetcher-c1baf61d.js';
1
+ import { d as dist, D as DataFetcher } from './DataFetcher-773a3e4b.js';
2
2
  import { ObjectUtils } from '@sankhyalabs/core';
3
3
 
4
4
  class ResourceFetcher {
@@ -1,5 +1,5 @@
1
1
  import { DataType, ApplicationContext } from '@sankhyalabs/core';
2
- import { d as dist, D as DataFetcher } from './DataFetcher-c1baf61d.js';
2
+ import { d as dist, D as DataFetcher } from './DataFetcher-773a3e4b.js';
3
3
 
4
4
  class PesquisaFetcher {
5
5
  constructor() {
@@ -1,19 +1,19 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-a7d3d3f1.js';
2
2
  import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
3
+ import { D as DataFetcher } from './DataFetcher-773a3e4b.js';
4
4
  import { P as ParamType } from './ParamType-d5152b06.js';
5
- import './pesquisa-fetcher-03c8f919.js';
5
+ import './pesquisa-fetcher-a87445a0.js';
6
6
  import './index-3aa4977a.js';
7
7
  import './ISave-d8c8bc59.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './dataunit-fetcher-264191b2.js';
10
+ import './dataunit-fetcher-3d2ec959.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-30fb808f.js';
12
+ import './form-config-fetcher-e0382e5a.js';
13
13
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
14
14
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
15
15
  import { CheckMode } from '@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode';
16
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
16
+ import { C as ConfigStorage } from './ConfigStorage-e476378d.js';
17
17
  import { O as ORDER_VALUES } from './constants-8457af36.js';
18
18
  import './PrintUtils-3e4ff0f5.js';
19
19
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -1,13 +1,13 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, KeyboardManager, OnboardingUtils, DependencyType, ArrayUtils, SearchUtils, ElementIDUtils, ApplicationContext, DataType, ErrorTracking } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
5
- import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-c1baf61d.js';
6
- import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-039abba3.js';
7
- import { D as DataUnitFetcher } from './dataunit-fetcher-264191b2.js';
8
- import { P as PesquisaFetcher } from './pesquisa-fetcher-03c8f919.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-e476378d.js';
5
+ import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-773a3e4b.js';
6
+ import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-a411f73c.js';
7
+ import { D as DataUnitFetcher } from './dataunit-fetcher-3d2ec959.js';
8
+ import { P as PesquisaFetcher } from './pesquisa-fetcher-a87445a0.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-571462fb.js';
10
- import './form-config-fetcher-30fb808f.js';
10
+ import './form-config-fetcher-e0382e5a.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
12
  import './PrintUtils-3e4ff0f5.js';
13
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -1,14 +1,14 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-a7d3d3f1.js';
2
2
  import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
4
- import './pesquisa-fetcher-03c8f919.js';
3
+ import { D as DataFetcher } from './DataFetcher-773a3e4b.js';
4
+ import './pesquisa-fetcher-a87445a0.js';
5
5
  import './index-3aa4977a.js';
6
6
  import { S as SaveErrorsEnum } from './ISave-d8c8bc59.js';
7
- import { P as PreloadManager, b as applyFilter, c as applySorting, d as buildPaginationInfo, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-264191b2.js';
7
+ import { P as PreloadManager, b as applyFilter, c as applySorting, d as buildPaginationInfo, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-3d2ec959.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
- import './form-config-fetcher-30fb808f.js';
9
+ import './form-config-fetcher-e0382e5a.js';
10
10
  import { d as VIEW_MODE } from './constants-8457af36.js';
11
- import { A as AutorizationType } from './auth-fetcher-039abba3.js';
11
+ import { A as AutorizationType } from './auth-fetcher-a411f73c.js';
12
12
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
13
13
  import './PrintUtils-3e4ff0f5.js';
14
14
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -1,17 +1,17 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
4
- import './DataFetcher-c1baf61d.js';
5
- import './pesquisa-fetcher-03c8f919.js';
4
+ import './DataFetcher-773a3e4b.js';
5
+ import './pesquisa-fetcher-a87445a0.js';
6
6
  import { P as PresentationMode } from './index-3aa4977a.js';
7
7
  import './ISave-d8c8bc59.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './dataunit-fetcher-264191b2.js';
10
+ import './dataunit-fetcher-3d2ec959.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-30fb808f.js';
12
+ import './form-config-fetcher-e0382e5a.js';
13
13
  import { d as VIEW_MODE } from './constants-8457af36.js';
14
- import { A as AutorizationType } from './auth-fetcher-039abba3.js';
14
+ import { A as AutorizationType } from './auth-fetcher-a411f73c.js';
15
15
  import './index-bdf75557.js';
16
16
  import './PrintUtils-3e4ff0f5.js';
17
17
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -3,15 +3,15 @@ import { ApplicationContext, ObjectUtils, UserInterface, DataType, ElementIDUtil
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat } from './index-3aa4977a.js';
5
5
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-8457af36.js';
6
- import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
7
- import { S as SnkDataUnit } from './snk-data-unit-f5cbe64b.js';
8
- import './pesquisa-fetcher-03c8f919.js';
6
+ import { D as DataFetcher } from './DataFetcher-773a3e4b.js';
7
+ import { S as SnkDataUnit } from './snk-data-unit-2a1d5d09.js';
8
+ import './pesquisa-fetcher-a87445a0.js';
9
9
  import './ISave-d8c8bc59.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
- import './dataunit-fetcher-264191b2.js';
12
+ import './dataunit-fetcher-3d2ec959.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
- import './form-config-fetcher-30fb808f.js';
14
+ import './form-config-fetcher-e0382e5a.js';
15
15
  import './PrintUtils-3e4ff0f5.js';
16
16
  import './SnkMessageBuilder-571462fb.js';
17
17
  import './RecordIDUtils-87d02110.js';
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, g as getElement, H as Host
2
2
  import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-571462fb.js';
5
- import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-264191b2.js';
5
+ import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-3d2ec959.js';
6
6
  import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
7
7
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
8
8
 
@@ -1,10 +1,10 @@
1
- export { S as snk_data_unit } from './snk-data-unit-f5cbe64b.js';
1
+ export { S as snk_data_unit } from './snk-data-unit-2a1d5d09.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import './SnkMessageBuilder-571462fb.js';
6
- import './dataunit-fetcher-264191b2.js';
7
- import './DataFetcher-c1baf61d.js';
6
+ import './dataunit-fetcher-3d2ec959.js';
7
+ import './DataFetcher-773a3e4b.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
@@ -1,21 +1,21 @@
1
1
  import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host } from './index-a7d3d3f1.js';
2
2
  import { Action } from '@sankhyalabs/core';
3
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-31b24066.js';
3
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-298cd647.js';
4
4
  import { FormMetadata, buildFormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
- import './DataFetcher-c1baf61d.js';
6
- import './pesquisa-fetcher-03c8f919.js';
5
+ import './DataFetcher-773a3e4b.js';
6
+ import './pesquisa-fetcher-a87445a0.js';
7
7
  import { P as PresentationMode } from './index-3aa4977a.js';
8
8
  import './ISave-d8c8bc59.js';
9
9
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
- import './dataunit-fetcher-264191b2.js';
11
+ import './dataunit-fetcher-3d2ec959.js';
12
12
  import './filter-item-type.enum-d45e026f.js';
13
- import './form-config-fetcher-30fb808f.js';
13
+ import './form-config-fetcher-e0382e5a.js';
14
14
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
15
15
  import { d as VIEW_MODE } from './constants-8457af36.js';
16
- import { S as SnkGuidesViewer } from './snk-guides-viewer-dda0fede.js';
16
+ import { S as SnkGuidesViewer } from './snk-guides-viewer-43f21b03.js';
17
17
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-571462fb.js';
18
- import './ConfigStorage-3806514e.js';
18
+ import './ConfigStorage-e476378d.js';
19
19
  import './PrintUtils-3e4ff0f5.js';
20
20
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
21
21
  import '@sankhyalabs/core/dist/utils/SortingUtils';
@@ -1,15 +1,15 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
4
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-e476378d.js';
5
5
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
6
6
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
7
7
  import { F as FilterOperand } from './index-ae591a44.js';
8
8
  import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
9
9
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
10
10
  import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
11
- import './form-config-fetcher-30fb808f.js';
12
- import './DataFetcher-c1baf61d.js';
11
+ import './form-config-fetcher-e0382e5a.js';
12
+ import './DataFetcher-773a3e4b.js';
13
13
  import './PrintUtils-3e4ff0f5.js';
14
14
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
15
15
 
@@ -2,10 +2,10 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
2
2
  import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
3
3
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
4
4
  import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
5
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
5
+ import { C as ConfigStorage } from './ConfigStorage-e476378d.js';
6
6
  import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
7
- import './form-config-fetcher-30fb808f.js';
8
- import './DataFetcher-c1baf61d.js';
7
+ import './form-config-fetcher-e0382e5a.js';
8
+ import './DataFetcher-773a3e4b.js';
9
9
  import './PrintUtils-3e4ff0f5.js';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
11
 
@@ -3,9 +3,9 @@ import { S as Sortable } from './Sortable-83960219.js';
3
3
  import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { C as CONFIG_EVENTS, a as CONFIG_SORTABLE_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-8457af36.js';
6
- import { U as UserConfigType } from './form-config-fetcher-30fb808f.js';
6
+ import { U as UserConfigType } from './form-config-fetcher-e0382e5a.js';
7
7
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
8
- import './DataFetcher-c1baf61d.js';
8
+ import './DataFetcher-773a3e4b.js';
9
9
  import './PrintUtils-3e4ff0f5.js';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
11
 
@@ -1,10 +1,10 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-31b24066.js';
3
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-298cd647.js';
4
4
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
5
- import './ConfigStorage-3806514e.js';
6
- import './form-config-fetcher-30fb808f.js';
7
- import './DataFetcher-c1baf61d.js';
5
+ import './ConfigStorage-e476378d.js';
6
+ import './form-config-fetcher-e0382e5a.js';
7
+ import './DataFetcher-773a3e4b.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
10
  import './filter-item-type.enum-d45e026f.js';
@@ -1,20 +1,20 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { Action, ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
4
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-e476378d.js';
5
5
  import { P as PresentationMode } from './index-3aa4977a.js';
6
6
  import { T as TaskbarProcessor, o as openFieldSearch, b as buildFieldSearch } from './field-search-efbe307f.js';
7
7
  import { s as store } from './index-bdf75557.js';
8
- import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter } from './IExporterProvider-63a188b6.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter } from './IExporterProvider-d597f27d.js';
9
9
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
10
- import './DataFetcher-c1baf61d.js';
11
- import './pesquisa-fetcher-03c8f919.js';
10
+ import './DataFetcher-773a3e4b.js';
11
+ import './pesquisa-fetcher-a87445a0.js';
12
12
  import './ISave-d8c8bc59.js';
13
13
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
14
14
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
15
- import './dataunit-fetcher-264191b2.js';
15
+ import './dataunit-fetcher-3d2ec959.js';
16
16
  import './filter-item-type.enum-d45e026f.js';
17
- import './form-config-fetcher-30fb808f.js';
17
+ import './form-config-fetcher-e0382e5a.js';
18
18
  import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
19
19
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
20
20
  import './PrintUtils-3e4ff0f5.js';
@@ -1,19 +1,19 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-a7d3d3f1.js';
2
2
  import { Action, ElementIDUtils } from '@sankhyalabs/core';
3
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-31b24066.js';
3
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-298cd647.js';
4
4
  import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
5
  import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './field-search-efbe307f.js';
6
6
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
7
7
  import { d as VIEW_MODE } from './constants-8457af36.js';
8
- import './DataFetcher-c1baf61d.js';
9
- import './pesquisa-fetcher-03c8f919.js';
8
+ import './DataFetcher-773a3e4b.js';
9
+ import './pesquisa-fetcher-a87445a0.js';
10
10
  import { P as PresentationMode } from './index-3aa4977a.js';
11
11
  import './ISave-d8c8bc59.js';
12
12
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
13
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
14
- import './dataunit-fetcher-264191b2.js';
14
+ import './dataunit-fetcher-3d2ec959.js';
15
15
  import './filter-item-type.enum-d45e026f.js';
16
- import './form-config-fetcher-30fb808f.js';
16
+ import './form-config-fetcher-e0382e5a.js';
17
17
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
18
18
 
19
19
  const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
@@ -1,10 +1,10 @@
1
- export { S as snk_guides_viewer } from './snk-guides-viewer-dda0fede.js';
1
+ export { S as snk_guides_viewer } from './snk-guides-viewer-43f21b03.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
- import './SnkFormConfigManager-31b24066.js';
5
- import './ConfigStorage-3806514e.js';
6
- import './form-config-fetcher-30fb808f.js';
7
- import './DataFetcher-c1baf61d.js';
4
+ import './SnkFormConfigManager-298cd647.js';
5
+ import './ConfigStorage-e476378d.js';
6
+ import './form-config-fetcher-e0382e5a.js';
7
+ import './DataFetcher-773a3e4b.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
10
  import './filter-item-type.enum-d45e026f.js';
@@ -14,10 +14,10 @@ import './taskbar-elements-d59867f1.js';
14
14
  import './index-3aa4977a.js';
15
15
  import './index-bdf75557.js';
16
16
  import './constants-8457af36.js';
17
- import './pesquisa-fetcher-03c8f919.js';
17
+ import './pesquisa-fetcher-a87445a0.js';
18
18
  import './ISave-d8c8bc59.js';
19
19
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
20
- import './dataunit-fetcher-264191b2.js';
20
+ import './dataunit-fetcher-3d2ec959.js';
21
21
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
22
22
  import '@sankhyalabs/core/dist/utils/SortingUtils';
23
23
  import './ResourceIDUtils-a114189a.js';
@@ -1,13 +1,13 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
4
- import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-3806514e.js';
4
+ import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-e476378d.js';
5
5
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
6
6
  import { a as FilterGroupCondition } from './index-ae591a44.js';
7
7
  import { s as store } from './index-bdf75557.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
- import './form-config-fetcher-30fb808f.js';
10
- import './DataFetcher-c1baf61d.js';
9
+ import './form-config-fetcher-e0382e5a.js';
10
+ import './DataFetcher-773a3e4b.js';
11
11
  import './PrintUtils-3e4ff0f5.js';
12
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
13
 
@@ -3,19 +3,19 @@ import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType,
3
3
  import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { d as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-8457af36.js';
5
5
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
6
- import './DataFetcher-c1baf61d.js';
7
- import './pesquisa-fetcher-03c8f919.js';
8
- import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, a as CrudUtils } from './IExporterProvider-63a188b6.js';
6
+ import './DataFetcher-773a3e4b.js';
7
+ import './pesquisa-fetcher-a87445a0.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, a as CrudUtils } from './IExporterProvider-d597f27d.js';
9
9
  import { D as DataExporterOption, P as PresentationMode } from './index-3aa4977a.js';
10
10
  import './ISave-d8c8bc59.js';
11
11
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
12
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
- import { I as InMemoryLoader } from './dataunit-fetcher-264191b2.js';
13
+ import { I as InMemoryLoader } from './dataunit-fetcher-3d2ec959.js';
14
14
  import './filter-item-type.enum-d45e026f.js';
15
- import { F as FormConfigFetcher } from './form-config-fetcher-30fb808f.js';
15
+ import { F as FormConfigFetcher } from './form-config-fetcher-e0382e5a.js';
16
16
  import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
17
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
18
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-31b24066.js';
17
+ import { C as ConfigStorage } from './ConfigStorage-e476378d.js';
18
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-298cd647.js';
19
19
  import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
20
20
  import { s as store } from './index-bdf75557.js';
21
21
  import './PrintUtils-3e4ff0f5.js';
@@ -1,4 +1,4 @@
1
- import{ObjectUtils as t,DataUnit as e,DataType as r,DateUtils as n,StringUtils as a,ChangeOperation as s,ApplicationContext as i,UserInterface as o,DataUnitStorage as l}from"@sankhyalabs/core";import{D as c,d as u}from"./p-dc7c9047.js";import{DISTINCT_FILTER_NAME_PREFIX as d}from"@sankhyalabs/ezui/dist/collection/utils/constants";import{DataUnitTransient as h}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{ColumnFilterManager as m}from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import f from"@sankhyalabs/core/dist/utils/SortingUtils";import{R as _}from"./p-688dcb4c.js";class p{constructor(t){this._list=[],this._equalsFunction=t}async load(t,e,r,n){let a=[].concat(this._list);null!=t&&(a=this._list.filter((e=>t(e)))),null!=e&&(a=a.sort(e));const s=a.length;if(null!=n){const t=r||0;a=a.slice(t,n?t+n:a.length)}return Promise.resolve({result:a,count:s})}async distict(t){const e=[];let r=!1;for(const n of this._list){const a=t(n);null!=a&&(null!=a.value?e.push(a):r=!0)}return r&&e.push({key:"",value:null}),Promise.resolve(new Map(e.map((t=>[t.key,t.value]))))}async push(t){this._list.push(...t)}async clear(){this._list=[]}async delete(t){this._list=this._list.filter((e=>{for(const r of t)if(this._equalsFunction(e,r))return!1;return!0}))}async update(t){this._list=this._list.map((e=>{const r=t.find((t=>this._equalsFunction(e,t)));return null==r?e:r}))}async insert(t,e){const r=this._list.indexOf(t);-1!=r?this._list=this._list.slice(0,r).concat(e).concat(this._list.slice(r)):this._list.push(...e)}isOperating(){return!0}async isEmpty(){return Promise.resolve(0===this._list.length)}async count(){return Promise.resolve(this._list.length)}getFromCache(){return t.copy(this._list)}}class g{static setLoadingStatus(t,e){this._loadingStatus.set(t.name,e)}static isCacheEnabled(t){return!0}static cacheRecords(t,e,r,n){g.setLoadingStatus(t,n),g.isCacheEnabled(t)?this.getRepository(t).push(e):r&&this._repositories.delete(t.name)}static getSortingFunction(t,e){return f.getSortingFunction(t,e)}static async getDistinct(t,e){if(!g.isCacheEnabled(t))return Promise.resolve(m.compileDistinct(e,t));let r;const n=t.getLastLoadRequest();if(null!=n){const a=m.getColumnFilters(n.filters,e);r=m.getFilterFunction(t,Array.from(a.values()))}return new Promise(((n,a)=>{g.getRepository(t).distict((n=>{if(null!=r&&!r(n))return;const a=n[e];if(null==a)return{key:null,value:null};const s=null!=a.value?a.value:a;return{key:t.getFormattedValue(e,a),value:s}})).then((t=>{n(null!=t?Array.from(t.entries()).map((([t,e])=>({label:t,value:e,check:!0}))):void 0)})).catch((t=>a(t)))}))}static async loadData(t,r,n){try{if(g.isCacheEnabled(t)){if(["EZ_GRID_LOADING_SOURCE",e.CHANGING_PAGE_LOADING_SOURCE,e.ALL_RECORDS_SELECTION_SOURCE].includes(r.source)&&!await g.getRepository(t).isEmpty())return g.loadFromCache(t,r);g.getRepository(t).clear().catch((()=>{}))}return n(t,r)}catch(t){return console.error(t),Promise.reject(t)}}static insertRecords(t,e,r){g.isCacheEnabled(t)&&g.getRepository(t).insert(e,r)}static updateRecords(t,e){g.isCacheEnabled(t)&&g.getRepository(t).update(e)}static removeRecords(t,e){g.isCacheEnabled(t)&&g.getRepository(t).delete(e)}static async countRecords(t){return g.isCacheEnabled(t)?g.getRepository(t).count():Promise.resolve(0)}static getRepository(t){const e=t.name;return g._repositories.has(e)||g._repositories.set(e,new p(((t,e)=>t.__record__id__===e.__record__id__))),g._repositories.get(e)}static async loadFromCache(t,e){return new Promise(((r,n)=>{const a=m.getColumnFilters(e.filters,""),{limit:s,offset:i,sort:o}=e;g.getRepository(t).load(m.getFilterFunction(t,Array.from(a.values())),g.getSortingFunction(t,o),i,s).then((e=>{const n=g._loadingStatus.get(t.name),{count:a,result:o}=e,l=0==a?0:i+1,c=i+Math.min(o.length,s);r({records:o,paginationInfo:{count:a,currentPage:i/s,firstRecord:l,lastRecord:c,hasMore:n||c<a,total:n?void 0:a}})})).catch((t=>n(t)))}))}static getCachedRecords(t){return g.getRepository(t).getFromCache()}}function y(t,e,r){const n=m.getColumnFilters(r,"");if(!(null==n?void 0:n.size))return t;const a=m.getFilterFunction(e,Array.from(n.values()));return null==a?t:t.filter(a)}function v(t,e,r){if(null==r||0==r.length)return t;const n=g.getSortingFunction(e,r);return null==n?t:t.sort(n)}function b(t,e=0,r=0){if(void 0===t)return;const n=(null==t?void 0:t.length)||0,a=Math.min(e+r,n);return{currentPage:0===r?0:Math.ceil(e/r),firstRecord:e,lastRecord:a,total:n,hasMore:!!(n-a)}}g._repositories=new Map,g._loadingStatus=new Map;class D{constructor(t,r,n){this.metadata=t,this.records=r,this._dataUnit=new e(D.IN_MEMORY_DATA_UNIT_NAME),this._dataUnit.pageSize=150,this._dataUnit.metadataLoader=()=>this.metadaLoader(),this._dataUnit.dataLoader=(t,e)=>this.inMemoryLoader(t,e,this.getRecordsToLoad()),this._dataUnit.saveLoader=(t,e)=>this.saveLoader(t,e),this._dataUnit.removeLoader=(t,e)=>this.removeLoader(t,e),this.dataUnit.loadMetadata().then((()=>{!1!==(null==n?void 0:n.autoLoad)&&this.dataUnit.loadData()}))}getRecordsToLoad(){null==this._initialRecords&&this.dataUnit.records.length>0&&(this._initialRecords=this.dataUnit.records);const t=this.dataUnit.getAddedRecords();return t?[...this._initialRecords,...t]:this._initialRecords}get dataUnit(){return this._dataUnit}get records(){return this.dataUnit.records}static getConvertedValue(t,e){return t.dataType===r.BOOLEAN?"S"===e:t.dataType===r.NUMBER?Number(e):t.dataType===r.DATE?n.strToDate(e,!0):t.dataType===r.OBJECT?JSON.parse(e):e}set records(t){const e=this._metadata?new Map(this._metadata.fields.map((t=>[t.name,t]))):void 0,r=null==t?void 0:t.map((t=>{if(t.__record__id__||(t.__record__id__=this.generateUniqueId()),null!=e)for(const r in t){const n=t[r];"string"==typeof n&&e.has(r)&&(t[r]=D.getConvertedValue(e.get(r),n))}return t}));this._initialRecords=r,this._dataUnit&&this._dataUnit.loadData()}get metadata(){return this._metadata}set metadata(t){this._metadata=t,this._dataUnit&&(this._dataUnit.metadata=this._metadata)}generateUniqueId(){return a.generateUUID()}inMemoryLoader(t,e,r){let n=y(r,t,e.filters);return n=v(n,t,e.sort),Promise.resolve({records:n,paginationInfo:b(n,e.offset,e.limit)})}metadaLoader(){return Promise.resolve(this._metadata)}saveLoader(t,e){return new Promise((t=>{let r=[];e.forEach((t=>{let{record:e,updatingFields:n,operation:a}=t;const i=Object.assign(Object.assign({},e),n);if(a===s.INSERT||a===s.COPY)i.__old__id__=e.__record__id__,i.__record__id__=this.generateUniqueId(),this.records.push(i);else{const t=this.records.findIndex((t=>t.__record__id__==i.__record__id__));this.records[t]=i}r.push(i)})),t(r)}))}removeLoader(t,e){return new Promise((t=>{t(e)}))}}function P(t,e){var r,n;return void 0!==(null===(r=t[e])||void 0===r?void 0:r.value)?null===(n=t[e])||void 0===n?void 0:n.value:t[e]}D.IN_MEMORY_DATA_UNIT_NAME="InMemoryDataUnit";class N{canSlice(){return!1}processSortingSide(t,e,r){var n;const a=[],s=[];if(null!=t.sort){if(0===r.length)return{localSorting:t.sort,serverSorting:[]};for(const r of t.sort){const t=e.getField(r.field);"true"===(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.calculated)||(null==t?void 0:t.userInterface)===o.LONGTEXT?a.push(r):s.push(r)}}return{localSorting:a,serverSorting:s}}async load(t,e,r){var n,a;if(null==t.metadata)return Promise.resolve({records:[],loadingInfo:r});try{const s=null!==(a=null===(n=e.filters)||void 0===n?void 0:n.filter((t=>!t.name.startsWith("FILTRO_COLUNA_"))))&&void 0!==a?a:[],{localSorting:i,serverSorting:o}=this.processSortingSide(e,t,s),l=this.getFieldsList(t),u="DatasetSP.loadRecords",d=this.buildRequestBody(u,l,t,e,r,o,s),h=r.quiet?{urlParams:{quietMode:"true"}}:void 0,{result:m,pagerID:f}=await c.get().callServiceBroker(u,d,h),_=this.processRecords(t,l,m),p=null!=f,g=r.count+_.length,y=!p&&i.length>0;return Promise.resolve({records:_,loadingInfo:Object.assign(Object.assign({},r),{pagerId:f,loadingInProgress:p,total:p?void 0:g,count:g,needReload:y})})}catch(t){return console.error(t),Promise.reject(t)}}async loadRowMetadata(t,e,r,n={}){try{const a="DatasetSP.loadRowMetadata",s=await this.buildRequestBodyLoadRowMetadata({snkDataUnit:t,fieldName:e,metadataName:r,serviceName:a,updatedFields:n});return await c.get().callServiceBroker(a,s)}catch(t){return console.error(t),Promise.reject(t)}}async buildRequestBodyLoadRowMetadata({snkDataUnit:t,serviceName:e,fieldName:r,metadataName:n,updatedFields:a}){const s=t.dataUnit,i=R.parseDataUnitName(s.name).entityName,o=(await t.getSelectedRecordsIDsInfo()).reduce(((t,e)=>(t[e.name]=e.value,t)),{}),l=s.getSelectedRecord(),c=s.metadata.fields.filter((({standAlone:t,name:e})=>!t&&!e.includes("."))).map((({name:t})=>t)),u=c.reduce(((t,e,r)=>{const n=P(l,e),s=P(a,e);return t[r]=void 0!==s?s:n,t}),{});return JSON.stringify({serviceName:e,requestBody:{dataSetID:s.dataUnitId,entityName:i,standAlone:!1,metadataName:n,fieldName:r,fields:c,record:{pk:o,oldPk:o,values:u}}})}getFieldsList(t){let e=["__record__id__","__record__label__"];return t.metadata.fields.forEach((t=>{t.standAlone||(e=e.concat(this.getFieldNames(t)))})),e}getStandAloneFieldsList(t){let e={};return t.metadata.fields.forEach((t=>{t.standAlone&&(e=Object.assign(Object.assign({},e),{[t.name]:{fieldType:t.dataType,userType:t.userInterface}}))})),e}getFieldNames(t){const e=this.getSearchDescriptionField(t);return null==e?t.name:[t.name,e]}buildRequestBody(t,e,r,n,a,s,i){const o=r.dataUnitId,l=R.parseDataUnitName(r.name).entityName,c=!(!n.limit&&!n.offset),u={serviceName:t,requestBody:{dataSetID:o,fields:e,entityName:l,pageNumber:a.pageNumber,totalRecordsCount:a.count,pagerID:a.pagerId,standAlone:!1,standAloneFieldsMD:Object.assign({__record__id__:{fieldType:"S",userType:"P"},__record__label__:{fieldType:"S",userType:"P"}},this.getStandAloneFieldsList(r)),tryJoinedFields:!0,parallelLoader:c,crudListener:`br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,txProperties:this.getTxProperties(r,n,s,i),useDefaultRowsLimit:!1}};return JSON.stringify(u)}getModuleName(){return i.getContextValue("__SNK__APPLICATION__").getModuleName().replace("-bff","")}getTxProperties(t,e,r,n){const a={"__DATA_UNIT_ADAPTER__[dataUnitName]":t.name};0!==n.length&&(a["__DATA_UNIT_ADAPTER__[criteria]"]=JSON.stringify(n)),null!=r&&0!==r.length&&(a["__DATA_UNIT_ADAPTER__[sorting]"]=JSON.stringify(r)),null!=e.parentRecordId&&(a["__DATA_UNIT_ADAPTER__[parentRecordId]"]=e.parentRecordId);const s=t.getGlobalLoaderProps();return null==s||0===s.size||Array.from(s.entries()).forEach((([t,e])=>{a[t]=e})),a}processRecords(t,e,r){return r.map((r=>{const n={__record__id__:r[0],__record__label__:r[1],__record__metadata__:r[r.length-1]._rmd};return t.metadata.fields.forEach((t=>{n[t.name]=this.buildFieldValue(t,e,r)})),n}))}buildFieldValue(t,e,r){const n=e.indexOf(t.name);if(n<0)return null;const s=r[n];if(a.isEmpty(s))return null;const i=this.getSearchDescriptionField(t);if(null!=i){const t=e.indexOf(i);if(t>=0)return{value:s,label:r[t]}}return t.userInterface===o.SEARCH?isNaN(Number(s))?s:Number(s):D.getConvertedValue(t,s)}getSearchDescriptionField(t){if(t.userInterface===o.SEARCH){const{ENTITYNAME:e,mergedFrom:r,DESCRIPTIONFIELD:n}=t.properties;if(!a.isEmpty(n))return null!=r?`${r}.${e}.${n}`:`${e}.${n}`}}}class I{static async debounce(t,e){const r=t.name;I._debouncingTimeouts[r]&&(clearTimeout(I._debouncingTimeouts[r]),delete I._debouncingTimeouts[r]),I._debouncingTimeouts[r]=setTimeout((()=>{delete I._debouncingTimeouts[r],e()}),100)}static async loadData(t,e){return new Promise(((r,n)=>{I.debounce(t,(()=>{g.loadData(t,e,this.loadFromServer).then((t=>r(t))).catch((t=>n(t)))}))}))}static getCachedRecords(t){return g.getCachedRecords(t)}static async loadFromServer(t,e,r){try{r=I.registryLoading(t,r);const n=await I.callLoader(t,e,r);if(null==n)return;const a=n.records,s=I.buildPaginationInfo(a.length,e,n.loadingInfo),i=null==s?a:a.slice(0,s.lastRecord);return Promise.resolve({records:i,paginationInfo:s})}catch(t){return console.error(t),Promise.reject(t)}}static async callLoader(t,e,r,n){null==n&&(n=new N);const a=await n.load(t,e,r),{records:s,loadingInfo:i}=a;if(I.isOldRequest(t,i))return Promise.resolve(void 0);const o=!n.canSlice()||0===i.count;if(g.cacheRecords(t,s,o,i.loadingInProgress),g.isCacheEnabled(t)&&i.loadingInProgress){const r=Object.assign(Object.assign({},e),{offset:i.count}),a=Object.assign(Object.assign({},i),{pageNumber:(i.pageNumber||0)+1,quiet:!0});this.callLoader(t,r,a,n).then((e=>I.afterLoadingPage(t,e.loadingInfo))).catch((t=>console.error(t)))}return Promise.resolve(a)}static afterLoadingPage(t,e){g.setLoadingStatus(t,e.loadingInProgress);const r=t.getPaginationInfo();if(null==r)return;const n=e.count;e.loadingInProgress?t.updatePagination(Object.assign(Object.assign({},r),{count:n})):e.needReload?t.gotoPage(0):t.updatePagination(Object.assign(Object.assign({},r),{total:n,count:n}))}static registryLoading(t,e){return null==e&&(e={requestTime:(new Date).getTime(),count:0}),I._requestTimeByDataUnit.set(t.name,e.requestTime),e}static isOldRequest(t,e){return I._requestTimeByDataUnit.get(t.name)>e.requestTime}static buildPaginationInfo(t,e,r){let{limit:n,offset:a}=e;if(!n)return;1===r.pageNumber&&(a=0);const{total:s,count:i,loadingInProgress:o}=r,l=0===i||0===t?0:a+1,c=a+Math.min(t,n);return{total:s,count:i,lastRecord:c,firstRecord:l,currentPage:a/n,hasMore:c<i||o}}}I._requestTimeByDataUnit=new Map,I._debouncingTimeouts={};const O=/dd:\/\/([^/]+)\/([^/?]+)/;class R{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",u.gql`query($name: String!) {
1
+ import{ObjectUtils as t,DataUnit as e,DataType as r,DateUtils as n,StringUtils as a,ChangeOperation as s,ApplicationContext as i,UserInterface as o,DataUnitStorage as l}from"@sankhyalabs/core";import{D as c,d as u}from"./p-594bc21d.js";import{DISTINCT_FILTER_NAME_PREFIX as d}from"@sankhyalabs/ezui/dist/collection/utils/constants";import{DataUnitTransient as h}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{ColumnFilterManager as m}from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import f from"@sankhyalabs/core/dist/utils/SortingUtils";import{R as _}from"./p-688dcb4c.js";class p{constructor(t){this._list=[],this._equalsFunction=t}async load(t,e,r,n){let a=[].concat(this._list);null!=t&&(a=this._list.filter((e=>t(e)))),null!=e&&(a=a.sort(e));const s=a.length;if(null!=n){const t=r||0;a=a.slice(t,n?t+n:a.length)}return Promise.resolve({result:a,count:s})}async distict(t){const e=[];let r=!1;for(const n of this._list){const a=t(n);null!=a&&(null!=a.value?e.push(a):r=!0)}return r&&e.push({key:"",value:null}),Promise.resolve(new Map(e.map((t=>[t.key,t.value]))))}async push(t){this._list.push(...t)}async clear(){this._list=[]}async delete(t){this._list=this._list.filter((e=>{for(const r of t)if(this._equalsFunction(e,r))return!1;return!0}))}async update(t){this._list=this._list.map((e=>{const r=t.find((t=>this._equalsFunction(e,t)));return null==r?e:r}))}async insert(t,e){const r=this._list.indexOf(t);-1!=r?this._list=this._list.slice(0,r).concat(e).concat(this._list.slice(r)):this._list.push(...e)}isOperating(){return!0}async isEmpty(){return Promise.resolve(0===this._list.length)}async count(){return Promise.resolve(this._list.length)}getFromCache(){return t.copy(this._list)}}class g{static setLoadingStatus(t,e){this._loadingStatus.set(t.name,e)}static isCacheEnabled(t){return!0}static cacheRecords(t,e,r,n){g.setLoadingStatus(t,n),g.isCacheEnabled(t)?this.getRepository(t).push(e):r&&this._repositories.delete(t.name)}static getSortingFunction(t,e){return f.getSortingFunction(t,e)}static async getDistinct(t,e){if(!g.isCacheEnabled(t))return Promise.resolve(m.compileDistinct(e,t));let r;const n=t.getLastLoadRequest();if(null!=n){const a=m.getColumnFilters(n.filters,e);r=m.getFilterFunction(t,Array.from(a.values()))}return new Promise(((n,a)=>{g.getRepository(t).distict((n=>{if(null!=r&&!r(n))return;const a=n[e];if(null==a)return{key:null,value:null};const s=null!=a.value?a.value:a;return{key:t.getFormattedValue(e,a),value:s}})).then((t=>{n(null!=t?Array.from(t.entries()).map((([t,e])=>({label:t,value:e,check:!0}))):void 0)})).catch((t=>a(t)))}))}static async loadData(t,r,n){try{if(g.isCacheEnabled(t)){if(["EZ_GRID_LOADING_SOURCE",e.CHANGING_PAGE_LOADING_SOURCE,e.ALL_RECORDS_SELECTION_SOURCE].includes(r.source)&&!await g.getRepository(t).isEmpty())return g.loadFromCache(t,r);g.getRepository(t).clear().catch((()=>{}))}return n(t,r)}catch(t){return console.error(t),Promise.reject(t)}}static insertRecords(t,e,r){g.isCacheEnabled(t)&&g.getRepository(t).insert(e,r)}static updateRecords(t,e){g.isCacheEnabled(t)&&g.getRepository(t).update(e)}static removeRecords(t,e){g.isCacheEnabled(t)&&g.getRepository(t).delete(e)}static async countRecords(t){return g.isCacheEnabled(t)?g.getRepository(t).count():Promise.resolve(0)}static getRepository(t){const e=t.name;return g._repositories.has(e)||g._repositories.set(e,new p(((t,e)=>t.__record__id__===e.__record__id__))),g._repositories.get(e)}static async loadFromCache(t,e){return new Promise(((r,n)=>{const a=m.getColumnFilters(e.filters,""),{limit:s,offset:i,sort:o}=e;g.getRepository(t).load(m.getFilterFunction(t,Array.from(a.values())),g.getSortingFunction(t,o),i,s).then((e=>{const n=g._loadingStatus.get(t.name),{count:a,result:o}=e,l=0==a?0:i+1,c=i+Math.min(o.length,s);r({records:o,paginationInfo:{count:a,currentPage:i/s,firstRecord:l,lastRecord:c,hasMore:n||c<a,total:n?void 0:a}})})).catch((t=>n(t)))}))}static getCachedRecords(t){return g.getRepository(t).getFromCache()}}function y(t,e,r){const n=m.getColumnFilters(r,"");if(!(null==n?void 0:n.size))return t;const a=m.getFilterFunction(e,Array.from(n.values()));return null==a?t:t.filter(a)}function v(t,e,r){if(null==r||0==r.length)return t;const n=g.getSortingFunction(e,r);return null==n?t:t.sort(n)}function b(t,e=0,r=0){if(void 0===t)return;const n=(null==t?void 0:t.length)||0,a=Math.min(e+r,n);return{currentPage:0===r?0:Math.ceil(e/r),firstRecord:e,lastRecord:a,total:n,hasMore:!!(n-a)}}g._repositories=new Map,g._loadingStatus=new Map;class D{constructor(t,r,n){this.metadata=t,this.records=r,this._dataUnit=new e(D.IN_MEMORY_DATA_UNIT_NAME),this._dataUnit.pageSize=150,this._dataUnit.metadataLoader=()=>this.metadaLoader(),this._dataUnit.dataLoader=(t,e)=>this.inMemoryLoader(t,e,this.getRecordsToLoad()),this._dataUnit.saveLoader=(t,e)=>this.saveLoader(t,e),this._dataUnit.removeLoader=(t,e)=>this.removeLoader(t,e),this.dataUnit.loadMetadata().then((()=>{!1!==(null==n?void 0:n.autoLoad)&&this.dataUnit.loadData()}))}getRecordsToLoad(){null==this._initialRecords&&this.dataUnit.records.length>0&&(this._initialRecords=this.dataUnit.records);const t=this.dataUnit.getAddedRecords();return t?[...this._initialRecords,...t]:this._initialRecords}get dataUnit(){return this._dataUnit}get records(){return this.dataUnit.records}static getConvertedValue(t,e){return t.dataType===r.BOOLEAN?"S"===e:t.dataType===r.NUMBER?Number(e):t.dataType===r.DATE?n.strToDate(e,!0):t.dataType===r.OBJECT?JSON.parse(e):e}set records(t){const e=this._metadata?new Map(this._metadata.fields.map((t=>[t.name,t]))):void 0,r=null==t?void 0:t.map((t=>{if(t.__record__id__||(t.__record__id__=this.generateUniqueId()),null!=e)for(const r in t){const n=t[r];"string"==typeof n&&e.has(r)&&(t[r]=D.getConvertedValue(e.get(r),n))}return t}));this._initialRecords=r,this._dataUnit&&this._dataUnit.loadData()}get metadata(){return this._metadata}set metadata(t){this._metadata=t,this._dataUnit&&(this._dataUnit.metadata=this._metadata)}generateUniqueId(){return a.generateUUID()}inMemoryLoader(t,e,r){let n=y(r,t,e.filters);return n=v(n,t,e.sort),Promise.resolve({records:n,paginationInfo:b(n,e.offset,e.limit)})}metadaLoader(){return Promise.resolve(this._metadata)}saveLoader(t,e){return new Promise((t=>{let r=[];e.forEach((t=>{let{record:e,updatingFields:n,operation:a}=t;const i=Object.assign(Object.assign({},e),n);if(a===s.INSERT||a===s.COPY)i.__old__id__=e.__record__id__,i.__record__id__=this.generateUniqueId(),this.records.push(i);else{const t=this.records.findIndex((t=>t.__record__id__==i.__record__id__));this.records[t]=i}r.push(i)})),t(r)}))}removeLoader(t,e){return new Promise((t=>{t(e)}))}}function P(t,e){var r,n;return void 0!==(null===(r=t[e])||void 0===r?void 0:r.value)?null===(n=t[e])||void 0===n?void 0:n.value:t[e]}D.IN_MEMORY_DATA_UNIT_NAME="InMemoryDataUnit";class N{canSlice(){return!1}processSortingSide(t,e,r){var n;const a=[],s=[];if(null!=t.sort){if(0===r.length)return{localSorting:t.sort,serverSorting:[]};for(const r of t.sort){const t=e.getField(r.field);"true"===(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.calculated)||(null==t?void 0:t.userInterface)===o.LONGTEXT?a.push(r):s.push(r)}}return{localSorting:a,serverSorting:s}}async load(t,e,r){var n,a;if(null==t.metadata)return Promise.resolve({records:[],loadingInfo:r});try{const s=null!==(a=null===(n=e.filters)||void 0===n?void 0:n.filter((t=>!t.name.startsWith("FILTRO_COLUNA_"))))&&void 0!==a?a:[],{localSorting:i,serverSorting:o}=this.processSortingSide(e,t,s),l=this.getFieldsList(t),u="DatasetSP.loadRecords",d=this.buildRequestBody(u,l,t,e,r,o,s),h=r.quiet?{urlParams:{quietMode:"true"}}:void 0,{result:m,pagerID:f}=await c.get().callServiceBroker(u,d,h),_=this.processRecords(t,l,m),p=null!=f,g=r.count+_.length,y=!p&&i.length>0;return Promise.resolve({records:_,loadingInfo:Object.assign(Object.assign({},r),{pagerId:f,loadingInProgress:p,total:p?void 0:g,count:g,needReload:y})})}catch(t){return console.error(t),Promise.reject(t)}}async loadRowMetadata(t,e,r,n={}){try{const a="DatasetSP.loadRowMetadata",s=await this.buildRequestBodyLoadRowMetadata({snkDataUnit:t,fieldName:e,metadataName:r,serviceName:a,updatedFields:n});return await c.get().callServiceBroker(a,s)}catch(t){return console.error(t),Promise.reject(t)}}async buildRequestBodyLoadRowMetadata({snkDataUnit:t,serviceName:e,fieldName:r,metadataName:n,updatedFields:a}){const s=t.dataUnit,i=R.parseDataUnitName(s.name).entityName,o=(await t.getSelectedRecordsIDsInfo()).reduce(((t,e)=>(t[e.name]=e.value,t)),{}),l=s.getSelectedRecord(),c=s.metadata.fields.filter((({standAlone:t,name:e})=>!t&&!e.includes("."))).map((({name:t})=>t)),u=c.reduce(((t,e,r)=>{const n=P(l,e),s=P(a,e);return t[r]=void 0!==s?s:n,t}),{});return JSON.stringify({serviceName:e,requestBody:{dataSetID:s.dataUnitId,entityName:i,standAlone:!1,metadataName:n,fieldName:r,fields:c,record:{pk:o,oldPk:o,values:u}}})}getFieldsList(t){let e=["__record__id__","__record__label__"];return t.metadata.fields.forEach((t=>{t.standAlone||(e=e.concat(this.getFieldNames(t)))})),e}getStandAloneFieldsList(t){let e={};return t.metadata.fields.forEach((t=>{t.standAlone&&(e=Object.assign(Object.assign({},e),{[t.name]:{fieldType:t.dataType,userType:t.userInterface}}))})),e}getFieldNames(t){const e=this.getSearchDescriptionField(t);return null==e?t.name:[t.name,e]}buildRequestBody(t,e,r,n,a,s,i){const o=r.dataUnitId,l=R.parseDataUnitName(r.name).entityName,c=!(!n.limit&&!n.offset),u={serviceName:t,requestBody:{dataSetID:o,fields:e,entityName:l,pageNumber:a.pageNumber,totalRecordsCount:a.count,pagerID:a.pagerId,standAlone:!1,standAloneFieldsMD:Object.assign({__record__id__:{fieldType:"S",userType:"P"},__record__label__:{fieldType:"S",userType:"P"}},this.getStandAloneFieldsList(r)),tryJoinedFields:!0,parallelLoader:c,crudListener:`br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,txProperties:this.getTxProperties(r,n,s,i),useDefaultRowsLimit:!1}};return JSON.stringify(u)}getModuleName(){return i.getContextValue("__SNK__APPLICATION__").getModuleName().replace("-bff","")}getTxProperties(t,e,r,n){const a={"__DATA_UNIT_ADAPTER__[dataUnitName]":t.name};0!==n.length&&(a["__DATA_UNIT_ADAPTER__[criteria]"]=JSON.stringify(n)),null!=r&&0!==r.length&&(a["__DATA_UNIT_ADAPTER__[sorting]"]=JSON.stringify(r)),null!=e.parentRecordId&&(a["__DATA_UNIT_ADAPTER__[parentRecordId]"]=e.parentRecordId);const s=t.getGlobalLoaderProps();return null==s||0===s.size||Array.from(s.entries()).forEach((([t,e])=>{a[t]=e})),a}processRecords(t,e,r){return r.map((r=>{const n={__record__id__:r[0],__record__label__:r[1],__record__metadata__:r[r.length-1]._rmd};return t.metadata.fields.forEach((t=>{n[t.name]=this.buildFieldValue(t,e,r)})),n}))}buildFieldValue(t,e,r){const n=e.indexOf(t.name);if(n<0)return null;const s=r[n];if(a.isEmpty(s))return null;const i=this.getSearchDescriptionField(t);if(null!=i){const t=e.indexOf(i);if(t>=0)return{value:s,label:r[t]}}return t.userInterface===o.SEARCH?isNaN(Number(s))?s:Number(s):D.getConvertedValue(t,s)}getSearchDescriptionField(t){if(t.userInterface===o.SEARCH){const{ENTITYNAME:e,mergedFrom:r,DESCRIPTIONFIELD:n}=t.properties;if(!a.isEmpty(n))return null!=r?`${r}.${e}.${n}`:`${e}.${n}`}}}class I{static async debounce(t,e){const r=t.name;I._debouncingTimeouts[r]&&(clearTimeout(I._debouncingTimeouts[r]),delete I._debouncingTimeouts[r]),I._debouncingTimeouts[r]=setTimeout((()=>{delete I._debouncingTimeouts[r],e()}),100)}static async loadData(t,e){return new Promise(((r,n)=>{I.debounce(t,(()=>{g.loadData(t,e,this.loadFromServer).then((t=>r(t))).catch((t=>n(t)))}))}))}static getCachedRecords(t){return g.getCachedRecords(t)}static async loadFromServer(t,e,r){try{r=I.registryLoading(t,r);const n=await I.callLoader(t,e,r);if(null==n)return;const a=n.records,s=I.buildPaginationInfo(a.length,e,n.loadingInfo),i=null==s?a:a.slice(0,s.lastRecord);return Promise.resolve({records:i,paginationInfo:s})}catch(t){return console.error(t),Promise.reject(t)}}static async callLoader(t,e,r,n){null==n&&(n=new N);const a=await n.load(t,e,r),{records:s,loadingInfo:i}=a;if(I.isOldRequest(t,i))return Promise.resolve(void 0);const o=!n.canSlice()||0===i.count;if(g.cacheRecords(t,s,o,i.loadingInProgress),g.isCacheEnabled(t)&&i.loadingInProgress){const r=Object.assign(Object.assign({},e),{offset:i.count}),a=Object.assign(Object.assign({},i),{pageNumber:(i.pageNumber||0)+1,quiet:!0});this.callLoader(t,r,a,n).then((e=>I.afterLoadingPage(t,e.loadingInfo))).catch((t=>console.error(t)))}return Promise.resolve(a)}static afterLoadingPage(t,e){g.setLoadingStatus(t,e.loadingInProgress);const r=t.getPaginationInfo();if(null==r)return;const n=e.count;e.loadingInProgress?t.updatePagination(Object.assign(Object.assign({},r),{count:n})):e.needReload?t.gotoPage(0):t.updatePagination(Object.assign(Object.assign({},r),{total:n,count:n}))}static registryLoading(t,e){return null==e&&(e={requestTime:(new Date).getTime(),count:0}),I._requestTimeByDataUnit.set(t.name,e.requestTime),e}static isOldRequest(t,e){return I._requestTimeByDataUnit.get(t.name)>e.requestTime}static buildPaginationInfo(t,e,r){let{limit:n,offset:a}=e;if(!n)return;1===r.pageNumber&&(a=0);const{total:s,count:i,loadingInProgress:o}=r,l=0===i||0===t?0:a+1,c=a+Math.min(t,n);return{total:s,count:i,lastRecord:c,firstRecord:l,currentPage:a/n,hasMore:c<i||o}}}I._requestTimeByDataUnit=new Map,I._debouncingTimeouts={};const O=/dd:\/\/([^/]+)\/([^/?]+)/;class R{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",u.gql`query($name: String!) {
2
2
  $queryAlias$: fetchDataUnit(name: $name){
3
3
  name
4
4
  fields{
@@ -1 +1 @@
1
- import{ObjectUtils as t}from"@sankhyalabs/core";import{R as a}from"./p-df5451c7.js";class s extends a{getData(a){const s=`cfg://auth/${a}`;return new Promise(((a,e)=>{this.loadResource(s).then((s=>{let e=t.stringToObject(s);e&&"object"==typeof e&&a(e)})).catch((t=>{e(t)}))}))}}var e;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(e||(e={}));export{e as A,s as a}
1
+ import{ObjectUtils as t}from"@sankhyalabs/core";import{R as a}from"./p-181975f1.js";class s extends a{getData(a){const s=`cfg://auth/${a}`;return new Promise(((a,e)=>{this.loadResource(s).then((s=>{let e=t.stringToObject(s);e&&"object"==typeof e&&a(e)})).catch((t=>{e(t)}))}))}}var e;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(e||(e={}));export{e as A,s as a}
@@ -1,4 +1,4 @@
1
- import{d as e,D as t}from"./p-dc7c9047.js";import{ObjectUtils as r}from"@sankhyalabs/core";class s{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchResource",e.gql`query($name: String!) {
1
+ import{d as e,D as t}from"./p-594bc21d.js";import{ObjectUtils as r}from"@sankhyalabs/core";class s{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchResource",e.gql`query($name: String!) {
2
2
  $queryAlias$: fetchResource(name: $name){
3
3
  resource
4
4
  }
@@ -1 +1 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{ApplicationContext as o,ObjectUtils as r,UserInterface as n,DataType as l,ElementIDUtils as a}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as h}from"@sankhyalabs/ezui/dist/collection/utils";import{D as c,a as p,b as u}from"./p-30cf616e.js";import{R as m}from"./p-b0ef4383.js";import{D as v}from"./p-dc7c9047.js";import{S as x}from"./p-17def7cd.js";import"./p-af8efd95.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-fe79f83a.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import"./p-8d884fab.js";import"./p-7ef9c55c.js";import"./p-9863d682.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class f{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===c.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===c.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this._selectedNumber>0&&this.setExportAllRecords(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];if(t===c.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===c.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportAllRecords(t,e){var i;const s=[c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS];if(t===c.EXPORT_ALL_RECORDS&&e.push(this.getAllRecords()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS));null==s&&(e.push(this.getAllRecords()),s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS))),(null===(i=s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_ALL_RECORDS_TO_PDF&&s.children.push(this.getExportAllRecordsToPDF()),t===c.EXPORT_ALL_RECORDS_TO_XLS&&s.children.push(this.getExportAllRecordsToXLS())}}setExportByEmail(t,e){t===c.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:c.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:c.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,group:t}}getCurrentPage(){return{id:c.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getAllRecords(){return{id:c.EXPORT_ALL_RECORDS,label:this._getMessage("snkDataExporter.label.allRecords"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:c.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:c.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportAllRecordsToPDF(){return{id:c.EXPORT_ALL_RECORDS_TO_PDF,label:"PDF (.pdf)"}}getExportAllRecordsToXLS(){return{id:c.EXPORT_ALL_RECORDS_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:c.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function g(t){const e=[];let i=0;for(const s of t){if(i+=s.width,i>=800)break;e.push(s)}return e}function E(t){return Object.keys(c).find((e=>c[e]===t))}class b{constructor(t){this._provider=t}async getParsedColumns(){return g(await this._provider.getColumnsMetadata())}async getParams(t){var e,i,s,o,r,n;const l=null===(i=(e=this._provider).getFilters)||void 0===i?void 0:i.call(e),a=[p.EXPORT_TO_PDF,p.EXPORT_PAGE_TO_PDF,p.EXPORT_PDF_TO_EMAIL,p.EXPORT_ALL_RECORDS_TO_PDF].includes(E(null==t?void 0:t.exportOption))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),d=null===(o=(s=this._provider).getOrders)||void 0===o?void 0:o.call(s),h=null===(n=(r=this._provider).getResourceURI)||void 0===n?void 0:n.call(r),u=this._provider.getSelectedIDs(),m=t.exportOption,v=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];delete t.exportOption;let x=Object.assign({filters:l,columns:a,sort:d,resourceURI:h,selectedIDs:u.slice(0,this._provider.getExportLimit())},t);if(v.includes(m)||"page"==t.type){const t=this._provider.getOffset(),e=this._provider.getPageSize();x=Object.assign(Object.assign({},x),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(x=Object.assign(Object.assign({},x),{offset:0,limit:this._provider.getExportLimit(),selectedIDs:[]}));return Promise.resolve(x)}async executeExport(t){const e=await this.getParams(t),{methodName:i}=e,s=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(e,["methodName"]),n=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.${i}`,l={serviceName:n,requestBody:s};return new Promise(((t,e)=>{v.get().callServiceBroker(n,r.objectToString(l)).then((e=>t(this.getFormatResponse(e)))).catch((t=>e(t)))}))}getFormatResponse(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}}class w{constructor(t){this._provider=t}async getParsedColumns(){return g(await this._provider.getColumnsMetadata())}async executeExport(t){const{methodName:e,titleGrid:i}=t,s=await this._provider.getRecords(),o=[p.EXPORT_TO_PDF,p.EXPORT_PAGE_TO_PDF,p.EXPORT_PDF_TO_EMAIL,p.EXPORT_ALL_RECORDS_TO_PDF].includes(E(null==t?void 0:t.exportOption))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),[r,n]=this.getExecutor(e),l={serviceName:r,requestBody:{grid:{titleGrid:i,columns:this.buildColumnsObject(o),rows:this.buildRowsObject(o,s),customOptions:{xlsxExtension:!1}}}};return new Promise(((t,e)=>{v.get().callServiceBroker(r,l).then((e=>t(n(e)))).catch((t=>e(t)))}))}getExecutor(t){return"exportToPDF"===t?["GridPDFBuilderSP.buildPDFFromJson",t=>({fileSessionKey:t.chavePDF.valor,canPrint:"S"===t.permiteImprimir.valor,canExport:"S"===t.permiteExportar.valor,canSendEmail:"S"===t.canSendEmail.valor,useAppPrint:!0})]:["GridXLSBuilderSP.buildXLSFromJson",t=>({fileSessionKey:t.chaveXLS.valor,canPrint:!1,canExport:!1,useAppPrint:!1,canSendEmail:!1})]}buildColumnsObject(t){return{column:t.map(((t,e)=>{const{label:i,id:s,width:o,userInterface:r}=t;return Object.assign({index:e+1,id:s,label:i,width:o,presentationType:"P"},k[r]||{type:"S",align:"left"})}))}}buildRowsObject(t,e){return{row:e.map((e=>{const i={};return t.forEach(((t,s)=>i["c"+(s+1)]={$:this.formatValue(e,t)})),i}))}}formatValue(t,e){return null!=this._provider.formatValue?this._provider.formatValue(t,e):t[e.id]||""}}const k={[n.DATE]:{type:"D",align:"center"},[n.DATETIME]:{type:"H",align:"center"},[n.TIME]:{type:"I",align:"right"},[n.ELAPSEDTIME]:{type:"I",align:"right"},[n.DECIMALNUMBER]:{type:"F",align:"right"},[n.INTEGERNUMBER]:{type:"I",align:"right"},[n.SEARCH]:{type:"S",align:"right"}},D=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._releasedToExport=[c.EXPORT_TO_PDF,c.EXPORT_TO_XLS,c.EXPORT_BY_EMAIL,c.EXPORT_PDF_TO_EMAIL,c.EXPORT_XLS_TO_EMAIL,c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS,c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS],this._items=[],this._showDropdown=!1,this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=u[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:u.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,titleGrid:this._appLabel},(()=>{this._snkEmailSender.close(),d.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=x.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}async resolveExporter(t,e){null!=this.provider&&null!=t&&null!=e&&this.getExporterStrategy().executeExport(t).then((t=>e(t))).catch((t=>{console.error(t);let{title:e,message:i,statusMessage:s}=t||{};d.error(e||this.getMessage("snkDataExporter.message.exportError"),s||i||this.getMessage("snkDataExporter.message.unknownFailure"))}))}getExporterStrategy(){return null==this.provider.getRecords?new b(this.provider):new w(this.provider)}getOptionKey(t){return Object.keys(c).find((e=>c[e]===t))}getExportType(t){return t===c.EXPORT_ALL_RECORDS_TO_PDF||t===c.EXPORT_ALL_RECORDS_TO_XLS?"all":t===c.EXPORT_PAGE_TO_PDF||t===c.EXPORT_PAGE_TO_XLS?"page":"selection"}async dispatchExporter(t){var e,i,s;const r=this.getOptionKey(t),n=null!==(e=p[r])&&void 0!==e?e:p.EXPORT_TO_PDF,l=p[r]===p.EXPORT_TO_XLS,a={methodName:c[`EXPORT_TO_${n}`],fileName:this._appLabel,titleGrid:this._appLabel,exportOption:t,limit:null===(s=null===(i=this.provider)||void 0===i?void 0:i.getExportLimit)||void 0===s?void 0:s.call(i),type:this.getExportType(t)};await this.resolveExporter(a,(t=>{t.canExport||n===p.EXPORT_TO_PDF?function({fileSessionKey:t,isDownload:e}){const i=o.getContextValue("__SNK__APPLICATION__");window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${e?"&download=S":""}`),d.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(i),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:n,isDownload:l})):d.error(this.getMessage("snkDataExporter.title.permission"),this.getMessage("snkDataExporter.message.exportPermission"))}))}async processExporter(t){var e,i,s,o,r,n,l;const a=null==t?void 0:t.detail,p=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS],u=null===(e=null==a?void 0:a.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==a?void 0:a.id)===c.EXPORT_CURRENT_PAGE)return;const m=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),v=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),x=null===(r=null===(o=this.provider)||void 0===o?void 0:o.getPageSize)||void 0===r?void 0:r.call(o),f=null===(l=null===(n=this.provider)||void 0===n?void 0:n.getExportLimit)||void 0===l?void 0:l.call(n);let g=!1;if(p.includes(null==a?void 0:a.id)&&x<=f||u?g=!1:(null==m?void 0:m.length)?g=m.length>f:v>f&&(g=!0),g){const t=f.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await d.confirm(e.title,e.description,null,h.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(u)return this.openPersonalizedReports(a.id),void(this._showDropdown=!1);this.getFilteredReleasedToExport().includes(null==a?void 0:a.id)&&(a.id===c.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(a.id),this._showDropdown=!1)}getFilteredReleasedToExport(){var t,e;if(null==this.provider)return this._releasedToExport;const i=null===(e=(t=this.provider).getHiddenOptions)||void 0===e?void 0:e.call(t);return null==i?this._releasedToExport:this._releasedToExport.filter((t=>!i.includes(t)))}loadItems(){const t=[];this.getFilteredReleasedToExport().forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e,i;const s=null===(i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID)||void 0===i?void 0:i.call(e);if(null==s)return void(this._items=t);const n=await function(t){const e=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.getPersonalizedReports`,i={serviceName:e,requestBody:t};return new Promise(((t,s)=>v.get().callServiceBroker(e,r.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:s});null==n||n.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e,i;const s=[],o=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(i=null===(e=this.provider)||void 0===e?void 0:e.getSelectedIDs)||void 0===i||i.call(e).forEach((({name:t,type:e,value:i},o)=>{const r={fields:[]};0===o&&(s[`PK_${t}`]={type:this.parseDataType(e),value:i},s.pks=[]);const n={nome:`PK_${t}`,tipo:this.parseDataType(e),valor:i};r.fields.push(n),s.pks.push(r)})),this._application.openApp(`${m}${o}`,s)}parseDataType(t){switch(t){case l.NUMBER:return"I";case l.DATE:return"D";default:return"S"}}loadDropdown(){var t;this._selectedNumber=(null===(t=this.provider)||void 0===t?void 0:t.getSelectedNumber())||0,this._itemBuilder=new f(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=o.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(a.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" ez-elevation--16":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};D.style=".sc-snk-data-exporter-h{display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{D as snk_data_exporter}
1
+ import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{ApplicationContext as o,ObjectUtils as r,UserInterface as n,DataType as l,ElementIDUtils as a}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as h}from"@sankhyalabs/ezui/dist/collection/utils";import{D as c,a as p,b as u}from"./p-30cf616e.js";import{R as m}from"./p-b0ef4383.js";import{D as v}from"./p-594bc21d.js";import{S as x}from"./p-ffa5e4ff.js";import"./p-25f1fc39.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-091ce761.js";import"./p-ff1990ad.js";import"./p-181975f1.js";import"./p-8d884fab.js";import"./p-7ef9c55c.js";import"./p-9863d682.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class f{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===c.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===c.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this._selectedNumber>0&&this.setExportAllRecords(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];if(t===c.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===c.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportAllRecords(t,e){var i;const s=[c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS];if(t===c.EXPORT_ALL_RECORDS&&e.push(this.getAllRecords()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS));null==s&&(e.push(this.getAllRecords()),s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS))),(null===(i=s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_ALL_RECORDS_TO_PDF&&s.children.push(this.getExportAllRecordsToPDF()),t===c.EXPORT_ALL_RECORDS_TO_XLS&&s.children.push(this.getExportAllRecordsToXLS())}}setExportByEmail(t,e){t===c.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:c.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:c.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,group:t}}getCurrentPage(){return{id:c.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getAllRecords(){return{id:c.EXPORT_ALL_RECORDS,label:this._getMessage("snkDataExporter.label.allRecords"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:c.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:c.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportAllRecordsToPDF(){return{id:c.EXPORT_ALL_RECORDS_TO_PDF,label:"PDF (.pdf)"}}getExportAllRecordsToXLS(){return{id:c.EXPORT_ALL_RECORDS_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:c.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function g(t){const e=[];let i=0;for(const s of t){if(i+=s.width,i>=800)break;e.push(s)}return e}function b(t){return Object.keys(c).find((e=>c[e]===t))}class E{constructor(t){this._provider=t}async getParsedColumns(){return g(await this._provider.getColumnsMetadata())}async getParams(t){var e,i,s,o,r,n;const l=null===(i=(e=this._provider).getFilters)||void 0===i?void 0:i.call(e),a=[p.EXPORT_TO_PDF,p.EXPORT_PAGE_TO_PDF,p.EXPORT_PDF_TO_EMAIL,p.EXPORT_ALL_RECORDS_TO_PDF].includes(b(null==t?void 0:t.exportOption))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),d=null===(o=(s=this._provider).getOrders)||void 0===o?void 0:o.call(s),h=null===(n=(r=this._provider).getResourceURI)||void 0===n?void 0:n.call(r),u=this._provider.getSelectedIDs(),m=t.exportOption,v=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];delete t.exportOption;let x=Object.assign({filters:l,columns:a,sort:d,resourceURI:h,selectedIDs:u.slice(0,this._provider.getExportLimit())},t);if(v.includes(m)||"page"==t.type){const t=this._provider.getOffset(),e=this._provider.getPageSize();x=Object.assign(Object.assign({},x),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(x=Object.assign(Object.assign({},x),{offset:0,limit:this._provider.getExportLimit(),selectedIDs:[]}));return Promise.resolve(x)}async executeExport(t){const e=await this.getParams(t),{methodName:i}=e,s=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(e,["methodName"]),n=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.${i}`,l={serviceName:n,requestBody:s};return new Promise(((t,e)=>{v.get().callServiceBroker(n,r.objectToString(l)).then((e=>t(this.getFormatResponse(e)))).catch((t=>e(t)))}))}getFormatResponse(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}}class w{constructor(t){this._provider=t}async getParsedColumns(){return g(await this._provider.getColumnsMetadata())}async executeExport(t){const{methodName:e,titleGrid:i}=t,s=await this._provider.getRecords(),o=[p.EXPORT_TO_PDF,p.EXPORT_PAGE_TO_PDF,p.EXPORT_PDF_TO_EMAIL,p.EXPORT_ALL_RECORDS_TO_PDF].includes(b(null==t?void 0:t.exportOption))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),[r,n]=this.getExecutor(e),l={serviceName:r,requestBody:{grid:{titleGrid:i,columns:this.buildColumnsObject(o),rows:this.buildRowsObject(o,s),customOptions:{xlsxExtension:!1}}}};return new Promise(((t,e)=>{v.get().callServiceBroker(r,l).then((e=>t(n(e)))).catch((t=>e(t)))}))}getExecutor(t){return"exportToPDF"===t?["GridPDFBuilderSP.buildPDFFromJson",t=>({fileSessionKey:t.chavePDF.valor,canPrint:"S"===t.permiteImprimir.valor,canExport:"S"===t.permiteExportar.valor,canSendEmail:"S"===t.canSendEmail.valor,useAppPrint:!0})]:["GridXLSBuilderSP.buildXLSFromJson",t=>({fileSessionKey:t.chaveXLS.valor,canPrint:!1,canExport:!1,useAppPrint:!1,canSendEmail:!1})]}buildColumnsObject(t){return{column:t.map(((t,e)=>{const{label:i,id:s,width:o,userInterface:r}=t;return Object.assign({index:e+1,id:s,label:i,width:o,presentationType:"P"},k[r]||{type:"S",align:"left"})}))}}buildRowsObject(t,e){return{row:e.map((e=>{const i={};return t.forEach(((t,s)=>i["c"+(s+1)]={$:this.formatValue(e,t)})),i}))}}formatValue(t,e){return null!=this._provider.formatValue?this._provider.formatValue(t,e):t[e.id]||""}}const k={[n.DATE]:{type:"D",align:"center"},[n.DATETIME]:{type:"H",align:"center"},[n.TIME]:{type:"I",align:"right"},[n.ELAPSEDTIME]:{type:"I",align:"right"},[n.DECIMALNUMBER]:{type:"F",align:"right"},[n.INTEGERNUMBER]:{type:"I",align:"right"},[n.SEARCH]:{type:"S",align:"right"}},D=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._releasedToExport=[c.EXPORT_TO_PDF,c.EXPORT_TO_XLS,c.EXPORT_BY_EMAIL,c.EXPORT_PDF_TO_EMAIL,c.EXPORT_XLS_TO_EMAIL,c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS,c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS],this._items=[],this._showDropdown=!1,this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=u[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:u.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,titleGrid:this._appLabel},(()=>{this._snkEmailSender.close(),d.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=x.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}async resolveExporter(t,e){null!=this.provider&&null!=t&&null!=e&&this.getExporterStrategy().executeExport(t).then((t=>e(t))).catch((t=>{console.error(t);let{title:e,message:i,statusMessage:s}=t||{};d.error(e||this.getMessage("snkDataExporter.message.exportError"),s||i||this.getMessage("snkDataExporter.message.unknownFailure"))}))}getExporterStrategy(){return null==this.provider.getRecords?new E(this.provider):new w(this.provider)}getOptionKey(t){return Object.keys(c).find((e=>c[e]===t))}getExportType(t){return t===c.EXPORT_ALL_RECORDS_TO_PDF||t===c.EXPORT_ALL_RECORDS_TO_XLS?"all":t===c.EXPORT_PAGE_TO_PDF||t===c.EXPORT_PAGE_TO_XLS?"page":"selection"}async dispatchExporter(t){var e,i,s;const r=this.getOptionKey(t),n=null!==(e=p[r])&&void 0!==e?e:p.EXPORT_TO_PDF,l=p[r]===p.EXPORT_TO_XLS,a={methodName:c[`EXPORT_TO_${n}`],fileName:this._appLabel,titleGrid:this._appLabel,exportOption:t,limit:null===(s=null===(i=this.provider)||void 0===i?void 0:i.getExportLimit)||void 0===s?void 0:s.call(i),type:this.getExportType(t)};await this.resolveExporter(a,(t=>{t.canExport||n===p.EXPORT_TO_PDF?function({fileSessionKey:t,isDownload:e}){const i=o.getContextValue("__SNK__APPLICATION__");window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${e?"&download=S":""}`),d.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(i),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:n,isDownload:l})):d.error(this.getMessage("snkDataExporter.title.permission"),this.getMessage("snkDataExporter.message.exportPermission"))}))}async processExporter(t){var e,i,s,o,r,n,l;const a=null==t?void 0:t.detail,p=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS],u=null===(e=null==a?void 0:a.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==a?void 0:a.id)===c.EXPORT_CURRENT_PAGE)return;const m=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),v=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),x=null===(r=null===(o=this.provider)||void 0===o?void 0:o.getPageSize)||void 0===r?void 0:r.call(o),f=null===(l=null===(n=this.provider)||void 0===n?void 0:n.getExportLimit)||void 0===l?void 0:l.call(n);let g=!1;if(p.includes(null==a?void 0:a.id)&&x<=f||u?g=!1:(null==m?void 0:m.length)?g=m.length>f:v>f&&(g=!0),g){const t=f.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await d.confirm(e.title,e.description,null,h.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(u)return this.openPersonalizedReports(a.id),void(this._showDropdown=!1);this.getFilteredReleasedToExport().includes(null==a?void 0:a.id)&&(a.id===c.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(a.id),this._showDropdown=!1)}getFilteredReleasedToExport(){var t,e;if(null==this.provider)return this._releasedToExport;const i=null===(e=(t=this.provider).getHiddenOptions)||void 0===e?void 0:e.call(t);return null==i?this._releasedToExport:this._releasedToExport.filter((t=>!i.includes(t)))}loadItems(){const t=[];this.getFilteredReleasedToExport().forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e,i;const s=null===(i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID)||void 0===i?void 0:i.call(e);if(null==s)return void(this._items=t);const n=await function(t){const e=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.getPersonalizedReports`,i={serviceName:e,requestBody:t};return new Promise(((t,s)=>v.get().callServiceBroker(e,r.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:s});null==n||n.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e,i;const s=[],o=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(i=null===(e=this.provider)||void 0===e?void 0:e.getSelectedIDs)||void 0===i||i.call(e).forEach((({name:t,type:e,value:i},o)=>{const r={fields:[]};0===o&&(s[`PK_${t}`]={type:this.parseDataType(e),value:i},s.pks=[]);const n={nome:`PK_${t}`,tipo:this.parseDataType(e),valor:i};r.fields.push(n),s.pks.push(r)})),this._application.openApp(`${m}${o}`,s)}parseDataType(t){switch(t){case l.NUMBER:return"I";case l.DATE:return"D";default:return"S"}}loadDropdown(){var t;this._selectedNumber=(null===(t=this.provider)||void 0===t?void 0:t.getSelectedNumber())||0,this._itemBuilder=new f(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=o.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(a.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" ez-elevation--16":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};D.style=".sc-snk-data-exporter-h{display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{D as snk_data_exporter}