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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/cjs/{IExporterProvider-9479f618.js → IExporterProvider-597949f9.js} +1 -1
  2. package/dist/cjs/{dataunit-fetcher-0c7106a0.js → dataunit-fetcher-688d3f05.js} +7 -3
  3. package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
  4. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  5. package/dist/cjs/snk-attach.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  8. package/dist/cjs/{snk-data-unit-16791a2f.js → snk-data-unit-685272e7.js} +1 -1
  9. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  10. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  12. package/dist/cjs/{snk-guides-viewer-d82746e8.js → snk-guides-viewer-67605336.js} +1 -1
  13. package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
  15. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +7 -3
  16. package/dist/components/dataunit-fetcher.js +7 -3
  17. package/dist/esm/{IExporterProvider-5a858363.js → IExporterProvider-63a188b6.js} +1 -1
  18. package/dist/esm/{dataunit-fetcher-f7e0ffc0.js → dataunit-fetcher-264191b2.js} +7 -3
  19. package/dist/esm/snk-actions-button_4.entry.js +1 -1
  20. package/dist/esm/snk-application.entry.js +1 -1
  21. package/dist/esm/snk-attach.entry.js +1 -1
  22. package/dist/esm/snk-crud.entry.js +1 -1
  23. package/dist/esm/snk-data-exporter.entry.js +2 -2
  24. package/dist/esm/{snk-data-unit-a327d22c.js → snk-data-unit-63f83504.js} +1 -1
  25. package/dist/esm/snk-data-unit.entry.js +2 -2
  26. package/dist/esm/snk-detail-view.entry.js +2 -2
  27. package/dist/esm/snk-grid.entry.js +2 -2
  28. package/dist/esm/{snk-guides-viewer-874da66f.js → snk-guides-viewer-151f6091.js} +1 -1
  29. package/dist/esm/snk-guides-viewer.entry.js +2 -2
  30. package/dist/esm/snk-simple-crud.entry.js +2 -2
  31. package/dist/sankhyablocks/{p-6ded2076.entry.js → p-14b9f964.entry.js} +1 -1
  32. package/dist/sankhyablocks/{p-e6210aec.js → p-3a212712.js} +1 -1
  33. package/dist/sankhyablocks/{p-b8cde0d8.entry.js → p-3a216b81.entry.js} +1 -1
  34. package/dist/sankhyablocks/{p-e0b9f59a.entry.js → p-7505da04.entry.js} +1 -1
  35. package/dist/sankhyablocks/{p-e9bbc3d5.entry.js → p-75f83d1d.entry.js} +1 -1
  36. package/dist/sankhyablocks/{p-60e46675.entry.js → p-82a0bfb0.entry.js} +1 -1
  37. package/dist/sankhyablocks/{p-0e11ee18.entry.js → p-941bf3ef.entry.js} +1 -1
  38. package/dist/sankhyablocks/{p-0046959e.entry.js → p-b4b21558.entry.js} +1 -1
  39. package/dist/sankhyablocks/{p-b7c4feeb.entry.js → p-bad55caa.entry.js} +1 -1
  40. package/dist/sankhyablocks/{p-8c6b44ea.entry.js → p-c053256c.entry.js} +1 -1
  41. package/dist/sankhyablocks/{p-7d9baaf4.entry.js → p-c5268346.entry.js} +1 -1
  42. package/dist/sankhyablocks/{p-a4b1f1eb.js → p-cefba299.js} +1 -1
  43. package/dist/sankhyablocks/{p-c7cbad38.js → p-fcac4dfc.js} +1 -1
  44. package/dist/sankhyablocks/{p-6d4f4614.js → p-fe79f83a.js} +1 -1
  45. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  46. package/package.json +1 -1
@@ -7,7 +7,7 @@ require('./index-1dfc7a6e.js');
7
7
  require('./ISave-e91b70a7.js');
8
8
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
9
9
  const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
10
- const dataunitFetcher = require('./dataunit-fetcher-0c7106a0.js');
10
+ const dataunitFetcher = require('./dataunit-fetcher-688d3f05.js');
11
11
  require('./filter-item-type.enum-a7ffdaa6.js');
12
12
  require('./form-config-fetcher-2dd00e5b.js');
13
13
  const InMemoryFilterColumnDataSource = require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
@@ -252,13 +252,17 @@ function applySorting(records, dataUnit, sorting) {
252
252
  return records.sort(sortingFunction);
253
253
  }
254
254
  function buildPaginationInfo(records, offset = 0, limit = 0) {
255
- const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
255
+ if (records === undefined) {
256
+ return undefined;
257
+ }
258
+ const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
259
+ const lastRecord = Math.min(offset + limit, total);
256
260
  return {
257
261
  currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
258
262
  firstRecord: offset,
259
263
  lastRecord: lastRecord,
260
- total: records === null || records === void 0 ? void 0 : records.length,
261
- hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
264
+ total: total,
265
+ hasMore: !!(total - lastRecord),
262
266
  };
263
267
  }
264
268
 
@@ -11,7 +11,7 @@ require('./index-1dfc7a6e.js');
11
11
  require('./ISave-e91b70a7.js');
12
12
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
- require('./dataunit-fetcher-0c7106a0.js');
14
+ require('./dataunit-fetcher-688d3f05.js');
15
15
  require('./filter-item-type.enum-a7ffdaa6.js');
16
16
  require('./form-config-fetcher-2dd00e5b.js');
17
17
  const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const ConfigStorage = require('./ConfigStorage-942ce74b.js');
9
9
  const DataFetcher = require('./DataFetcher-313debd8.js');
10
10
  const authFetcher = require('./auth-fetcher-54f5ff9d.js');
11
- const dataunitFetcher = require('./dataunit-fetcher-0c7106a0.js');
11
+ const dataunitFetcher = require('./dataunit-fetcher-688d3f05.js');
12
12
  const pesquisaFetcher = require('./pesquisa-fetcher-680e198f.js');
13
13
  const SnkMessageBuilder = require('./SnkMessageBuilder-722b104e.js');
14
14
  require('./form-config-fetcher-2dd00e5b.js');
@@ -8,7 +8,7 @@ const DataFetcher = require('./DataFetcher-313debd8.js');
8
8
  require('./pesquisa-fetcher-680e198f.js');
9
9
  require('./index-1dfc7a6e.js');
10
10
  const ISave = require('./ISave-e91b70a7.js');
11
- const dataunitFetcher = require('./dataunit-fetcher-0c7106a0.js');
11
+ const dataunitFetcher = require('./dataunit-fetcher-688d3f05.js');
12
12
  require('./filter-item-type.enum-a7ffdaa6.js');
13
13
  require('./form-config-fetcher-2dd00e5b.js');
14
14
  const constants = require('./constants-35ddd366.js');
@@ -11,7 +11,7 @@ const index$1 = require('./index-1dfc7a6e.js');
11
11
  require('./ISave-e91b70a7.js');
12
12
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
- require('./dataunit-fetcher-0c7106a0.js');
14
+ require('./dataunit-fetcher-688d3f05.js');
15
15
  require('./filter-item-type.enum-a7ffdaa6.js');
16
16
  require('./form-config-fetcher-2dd00e5b.js');
17
17
  const constants = require('./constants-35ddd366.js');
@@ -8,12 +8,12 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const index = require('./index-1dfc7a6e.js');
9
9
  const constants = require('./constants-35ddd366.js');
10
10
  const DataFetcher = require('./DataFetcher-313debd8.js');
11
- const snkDataUnit = require('./snk-data-unit-16791a2f.js');
11
+ const snkDataUnit = require('./snk-data-unit-685272e7.js');
12
12
  require('./pesquisa-fetcher-680e198f.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-0c7106a0.js');
16
+ require('./dataunit-fetcher-688d3f05.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  require('./form-config-fetcher-2dd00e5b.js');
19
19
  require('./PrintUtils-bcaeb82f.js');
@@ -4,7 +4,7 @@ const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
5
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
6
6
  const SnkMessageBuilder = require('./SnkMessageBuilder-722b104e.js');
7
- const dataunitFetcher = require('./dataunit-fetcher-0c7106a0.js');
7
+ const dataunitFetcher = require('./dataunit-fetcher-688d3f05.js');
8
8
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
9
9
  const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
10
10
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkDataUnit = require('./snk-data-unit-16791a2f.js');
5
+ const snkDataUnit = require('./snk-data-unit-685272e7.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/ezui/dist/collection/utils');
9
9
  require('./SnkMessageBuilder-722b104e.js');
10
- require('./dataunit-fetcher-0c7106a0.js');
10
+ require('./dataunit-fetcher-688d3f05.js');
11
11
  require('./DataFetcher-313debd8.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -12,12 +12,12 @@ const index$1 = require('./index-1dfc7a6e.js');
12
12
  require('./ISave-e91b70a7.js');
13
13
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
- require('./dataunit-fetcher-0c7106a0.js');
15
+ require('./dataunit-fetcher-688d3f05.js');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
17
  require('./form-config-fetcher-2dd00e5b.js');
18
18
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
19
19
  const constants = require('./constants-35ddd366.js');
20
- const snkGuidesViewer = require('./snk-guides-viewer-d82746e8.js');
20
+ const snkGuidesViewer = require('./snk-guides-viewer-67605336.js');
21
21
  const SnkMessageBuilder = require('./SnkMessageBuilder-722b104e.js');
22
22
  require('./ConfigStorage-942ce74b.js');
23
23
  require('./PrintUtils-bcaeb82f.js');
@@ -9,14 +9,14 @@ const ConfigStorage = require('./ConfigStorage-942ce74b.js');
9
9
  const index$1 = require('./index-1dfc7a6e.js');
10
10
  const fieldSearch = require('./field-search-f56aa7d6.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
- const IExporterProvider = require('./IExporterProvider-9479f618.js');
12
+ const IExporterProvider = require('./IExporterProvider-597949f9.js');
13
13
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
14
14
  require('./DataFetcher-313debd8.js');
15
15
  require('./pesquisa-fetcher-680e198f.js');
16
16
  require('./ISave-e91b70a7.js');
17
17
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
18
18
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
19
- require('./dataunit-fetcher-0c7106a0.js');
19
+ require('./dataunit-fetcher-688d3f05.js');
20
20
  require('./filter-item-type.enum-a7ffdaa6.js');
21
21
  require('./form-config-fetcher-2dd00e5b.js');
22
22
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
@@ -13,7 +13,7 @@ const index$1 = require('./index-1dfc7a6e.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-0c7106a0.js');
16
+ require('./dataunit-fetcher-688d3f05.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  require('./form-config-fetcher-2dd00e5b.js');
19
19
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-d82746e8.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-67605336.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('./SnkFormConfigManager-1b13bacd.js');
@@ -21,7 +21,7 @@ require('./constants-35ddd366.js');
21
21
  require('./pesquisa-fetcher-680e198f.js');
22
22
  require('./ISave-e91b70a7.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
24
- require('./dataunit-fetcher-0c7106a0.js');
24
+ require('./dataunit-fetcher-688d3f05.js');
25
25
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
26
26
  require('@sankhyalabs/core/dist/utils/SortingUtils');
27
27
  require('./ResourceIDUtils-5ff86aa7.js');
@@ -9,12 +9,12 @@ const constants = require('./constants-35ddd366.js');
9
9
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
10
10
  require('./DataFetcher-313debd8.js');
11
11
  require('./pesquisa-fetcher-680e198f.js');
12
- const IExporterProvider = require('./IExporterProvider-9479f618.js');
12
+ const IExporterProvider = require('./IExporterProvider-597949f9.js');
13
13
  const index = require('./index-1dfc7a6e.js');
14
14
  require('./ISave-e91b70a7.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
- const dataunitFetcher = require('./dataunit-fetcher-0c7106a0.js');
17
+ const dataunitFetcher = require('./dataunit-fetcher-688d3f05.js');
18
18
  require('./filter-item-type.enum-a7ffdaa6.js');
19
19
  const formConfigFetcher = require('./form-config-fetcher-2dd00e5b.js');
20
20
  const fieldSearch = require('./field-search-f56aa7d6.js');
@@ -22,12 +22,16 @@ export function applySorting(records, dataUnit, sorting) {
22
22
  return records.sort(sortingFunction);
23
23
  }
24
24
  export function buildPaginationInfo(records, offset = 0, limit = 0) {
25
- const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
25
+ if (records === undefined) {
26
+ return undefined;
27
+ }
28
+ const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
29
+ const lastRecord = Math.min(offset + limit, total);
26
30
  return {
27
31
  currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
28
32
  firstRecord: offset,
29
33
  lastRecord: lastRecord,
30
- total: records === null || records === void 0 ? void 0 : records.length,
31
- hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
34
+ total: total,
35
+ hasMore: !!(total - lastRecord),
32
36
  };
33
37
  }
@@ -246,13 +246,17 @@ function applySorting(records, dataUnit, sorting) {
246
246
  return records.sort(sortingFunction);
247
247
  }
248
248
  function buildPaginationInfo(records, offset = 0, limit = 0) {
249
- const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
249
+ if (records === undefined) {
250
+ return undefined;
251
+ }
252
+ const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
253
+ const lastRecord = Math.min(offset + limit, total);
250
254
  return {
251
255
  currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
252
256
  firstRecord: offset,
253
257
  lastRecord: lastRecord,
254
- total: records === null || records === void 0 ? void 0 : records.length,
255
- hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
258
+ total: total,
259
+ hasMore: !!(total - lastRecord),
256
260
  };
257
261
  }
258
262
 
@@ -5,7 +5,7 @@ import './index-3aa4977a.js';
5
5
  import './ISave-d8c8bc59.js';
6
6
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
7
7
  import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
- import { P as PreloadManager } from './dataunit-fetcher-f7e0ffc0.js';
8
+ import { P as PreloadManager } from './dataunit-fetcher-264191b2.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
10
  import './form-config-fetcher-30fb808f.js';
11
11
  import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
@@ -246,13 +246,17 @@ function applySorting(records, dataUnit, sorting) {
246
246
  return records.sort(sortingFunction);
247
247
  }
248
248
  function buildPaginationInfo(records, offset = 0, limit = 0) {
249
- const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
249
+ if (records === undefined) {
250
+ return undefined;
251
+ }
252
+ const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
253
+ const lastRecord = Math.min(offset + limit, total);
250
254
  return {
251
255
  currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
252
256
  firstRecord: offset,
253
257
  lastRecord: lastRecord,
254
- total: records === null || records === void 0 ? void 0 : records.length,
255
- hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
258
+ total: total,
259
+ hasMore: !!(total - lastRecord),
256
260
  };
257
261
  }
258
262
 
@@ -7,7 +7,7 @@ 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-f7e0ffc0.js';
10
+ import './dataunit-fetcher-264191b2.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
12
  import './form-config-fetcher-30fb808f.js';
13
13
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { C as ConfigStorage } from './ConfigStorage-86187da3.js';
5
5
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-c1baf61d.js';
6
6
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-039abba3.js';
7
- import { D as DataUnitFetcher } from './dataunit-fetcher-f7e0ffc0.js';
7
+ import { D as DataUnitFetcher } from './dataunit-fetcher-264191b2.js';
8
8
  import { P as PesquisaFetcher } from './pesquisa-fetcher-03c8f919.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-89925609.js';
10
10
  import './form-config-fetcher-30fb808f.js';
@@ -4,7 +4,7 @@ import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
4
4
  import './pesquisa-fetcher-03c8f919.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-f7e0ffc0.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';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
9
  import './form-config-fetcher-30fb808f.js';
10
10
  import { d as VIEW_MODE } from './constants-8457af36.js';
@@ -7,7 +7,7 @@ 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-f7e0ffc0.js';
10
+ import './dataunit-fetcher-264191b2.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
12
  import './form-config-fetcher-30fb808f.js';
13
13
  import { d as VIEW_MODE } from './constants-8457af36.js';
@@ -4,12 +4,12 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
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
6
  import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
7
- import { S as SnkDataUnit } from './snk-data-unit-a327d22c.js';
7
+ import { S as SnkDataUnit } from './snk-data-unit-63f83504.js';
8
8
  import './pesquisa-fetcher-03c8f919.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-f7e0ffc0.js';
12
+ import './dataunit-fetcher-264191b2.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
14
  import './form-config-fetcher-30fb808f.js';
15
15
  import './PrintUtils-3e4ff0f5.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-89925609.js';
5
- import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-f7e0ffc0.js';
5
+ import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-264191b2.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,9 +1,9 @@
1
- export { S as snk_data_unit } from './snk-data-unit-a327d22c.js';
1
+ export { S as snk_data_unit } from './snk-data-unit-63f83504.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import './SnkMessageBuilder-89925609.js';
6
- import './dataunit-fetcher-f7e0ffc0.js';
6
+ import './dataunit-fetcher-264191b2.js';
7
7
  import './DataFetcher-c1baf61d.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -8,12 +8,12 @@ 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-f7e0ffc0.js';
11
+ import './dataunit-fetcher-264191b2.js';
12
12
  import './filter-item-type.enum-d45e026f.js';
13
13
  import './form-config-fetcher-30fb808f.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-874da66f.js';
16
+ import { S as SnkGuidesViewer } from './snk-guides-viewer-151f6091.js';
17
17
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-89925609.js';
18
18
  import './ConfigStorage-86187da3.js';
19
19
  import './PrintUtils-3e4ff0f5.js';
@@ -5,14 +5,14 @@ import { C as ConfigStorage } from './ConfigStorage-86187da3.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-5a858363.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter } from './IExporterProvider-63a188b6.js';
9
9
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
10
10
  import './DataFetcher-c1baf61d.js';
11
11
  import './pesquisa-fetcher-03c8f919.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-f7e0ffc0.js';
15
+ import './dataunit-fetcher-264191b2.js';
16
16
  import './filter-item-type.enum-d45e026f.js';
17
17
  import './form-config-fetcher-30fb808f.js';
18
18
  import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
@@ -11,7 +11,7 @@ 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-f7e0ffc0.js';
14
+ import './dataunit-fetcher-264191b2.js';
15
15
  import './filter-item-type.enum-d45e026f.js';
16
16
  import './form-config-fetcher-30fb808f.js';
17
17
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
@@ -1,4 +1,4 @@
1
- export { S as snk_guides_viewer } from './snk-guides-viewer-874da66f.js';
1
+ export { S as snk_guides_viewer } from './snk-guides-viewer-151f6091.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
4
  import './SnkFormConfigManager-d4554df9.js';
@@ -17,7 +17,7 @@ import './constants-8457af36.js';
17
17
  import './pesquisa-fetcher-03c8f919.js';
18
18
  import './ISave-d8c8bc59.js';
19
19
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
20
- import './dataunit-fetcher-f7e0ffc0.js';
20
+ import './dataunit-fetcher-264191b2.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';
@@ -5,12 +5,12 @@ 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
6
  import './DataFetcher-c1baf61d.js';
7
7
  import './pesquisa-fetcher-03c8f919.js';
8
- import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, a as CrudUtils } from './IExporterProvider-5a858363.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, a as CrudUtils } from './IExporterProvider-63a188b6.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-f7e0ffc0.js';
13
+ import { I as InMemoryLoader } from './dataunit-fetcher-264191b2.js';
14
14
  import './filter-item-type.enum-d45e026f.js';
15
15
  import { F as FormConfigFetcher } from './form-config-fetcher-30fb808f.js';
16
16
  import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
@@ -1 +1 @@
1
- export{S as snk_guides_viewer}from"./p-a4b1f1eb.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"./p-829d4045.js";import"./p-aff76a53.js";import"./p-df5451c7.js";import"./p-dc7c9047.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-ff1990ad.js";import"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-c2495304.js";import"./p-7e7a7473.js";import"./p-30cf616e.js";import"./p-6dc031de.js";import"./p-b0ef4383.js";import"./p-af8efd95.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"./p-6d4f4614.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";
1
+ export{S as snk_guides_viewer}from"./p-cefba299.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"./p-829d4045.js";import"./p-aff76a53.js";import"./p-df5451c7.js";import"./p-dc7c9047.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-ff1990ad.js";import"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-c2495304.js";import"./p-7e7a7473.js";import"./p-30cf616e.js";import"./p-6dc031de.js";import"./p-b0ef4383.js";import"./p-af8efd95.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"./p-fe79f83a.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";
@@ -1 +1 @@
1
- import{D as t}from"./p-dc7c9047.js";import"./p-af8efd95.js";import{SortMode as i,ApplicationContext as e,UserInterface as s,DateUtils as r,ObjectUtils as a,NumberUtils as o,DataType as n}from"@sankhyalabs/core";import"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import{UserInterface as l}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{P as c}from"./p-6d4f4614.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import d from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";class u{static assertDefaultSorting(t,e){t&&e&&(e.defaultSorting=t.columns.filter((t=>null!=t.ascending)).sort(((t,i)=>t.orderIndex-i.orderIndex)).map((({name:t,ascending:s})=>{const{dataType:r}=e.getField(t);return{field:t,dataType:r,mode:s?i.ASC:i.DESC}})))}static find(i,s,r,a=!0,o,n){let l=[],c=[],d={},u=e.getContextValue("__SNK__APPLICATION__");if(s){if(!Array.isArray(s))throw new Error(u.messagesBuilder.getMessage("crudUtils.errorArray",null));s.forEach((t=>{l.push({name:t})}))}if(r)for(const t in r)r.hasOwnProperty(t)&&c.push({nome:t,valor:r[t]});o&&(d={expression:{$:o}});let f={requestBody:{entity:{name:i,criterio:c,fields:{field:l},literalCriteria:d,orderby:n}}};return new Promise((i=>{t.get().callServiceBroker("mge@crud.find",JSON.stringify(f)).then((t=>{var e;let s=null===(e=t.entidades)||void 0===e?void 0:e.entidade;if(null!=s){let t={fields:new Map};for(let i in s){let e=s[i];if(e.hasOwnProperty("$")&&t.fields.set(i,e.$),a)break}i(t)}else i(null)}))}))}}class f{setDataUnit(t){this._dataUnit=t}setApplication(t){this._application=t}formatLabel(t,i){const{userInterface:e}=this._dataUnit.getField(t);return e===s.DATETIME?r.formatDate(this._dataUnit.valueFromString(t,i)):String(this._dataUnit.getFormattedValue(t,i))}async getStaticOptions(t){return Promise.resolve(null==t?void 0:await c.getDistinct(this._dataUnit,t))}fetchData(t,i){return new Promise((e=>{this._application.executeSelectDistinct(this._dataUnit,i,t).then((t=>{e(t.map((t=>this._dataUnit.getField(i).userInterface===s.SEARCH?Object.assign(Object.assign({},JSON.parse(t)),{check:!0}):{value:t,label:this.formatLabel(i,t),check:!0})))}))}))}sortItems(t,i){return d.defaultSorterMultSelectionOption(this._dataUnit,t,i)}}class h{setGrid(t){this._grid||(this._grid=t,this.refreshSelectedRows())}setDataState(t){a.objectToString(t)!==a.objectToString(this._dataState)&&(this._dataState=t,this.refreshSelectedRows())}format(t,i,e){var s;if(!t)return t;const r=null===(s=this._dataState)||void 0===s?void 0:s.metadataByRow.get(e),a=null==r?void 0:r.getProp("rm_precision",i.name);return a||0===a?o.format(t,a,a):t}refreshSelectedRows(){var t;null===(t=this._grid)||void 0===t||t.refreshSelectedRows()}}class m{constructor(t,i){this.dataUnit=t,this.grid=i}async getColumnsMetadata(){var t;return this.columnsState=await(null===(t=this.grid)||void 0===t?void 0:t.getColumnsState())||[],await this.buildColumnsMetadata(this.columnsState)}getColumnsState(){return this.columnsState}async buildColumnsMetadata(t){var i,e;const s=[];for(const r of t){if(r.hidden&&"RECDESP"!==r.name)continue;const t=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(r.name),a=await this.grid.getCustomValueFormatter(r.name);if(s.push({label:r.label,id:r.name,width:r.width,type:null==t?void 0:t.dataType,userInterface:null==t?void 0:t.userInterface,customFormatter:a}),null!=(null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e.DESCRIPTIONFIELD)){const i=t.properties.mergedFrom;s.push({label:t.properties.DESCRIPTIONENTITY,id:`${i?i+".":""}${t.properties.ENTITYNAME}.${t.properties.DESCRIPTIONFIELD}`,width:r.width,type:n.TEXT,userInterface:l.LONGTEXT,descriptionFrom:t.name})}}return s||[]}}export{m as C,h as R,f as S,u as a}
1
+ import{D as t}from"./p-dc7c9047.js";import"./p-af8efd95.js";import{SortMode as i,ApplicationContext as e,UserInterface as s,DateUtils as r,ObjectUtils as a,NumberUtils as o,DataType as n}from"@sankhyalabs/core";import"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import{UserInterface as l}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{P as c}from"./p-fe79f83a.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import d from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";class u{static assertDefaultSorting(t,e){t&&e&&(e.defaultSorting=t.columns.filter((t=>null!=t.ascending)).sort(((t,i)=>t.orderIndex-i.orderIndex)).map((({name:t,ascending:s})=>{const{dataType:r}=e.getField(t);return{field:t,dataType:r,mode:s?i.ASC:i.DESC}})))}static find(i,s,r,a=!0,o,n){let l=[],c=[],d={},u=e.getContextValue("__SNK__APPLICATION__");if(s){if(!Array.isArray(s))throw new Error(u.messagesBuilder.getMessage("crudUtils.errorArray",null));s.forEach((t=>{l.push({name:t})}))}if(r)for(const t in r)r.hasOwnProperty(t)&&c.push({nome:t,valor:r[t]});o&&(d={expression:{$:o}});let f={requestBody:{entity:{name:i,criterio:c,fields:{field:l},literalCriteria:d,orderby:n}}};return new Promise((i=>{t.get().callServiceBroker("mge@crud.find",JSON.stringify(f)).then((t=>{var e;let s=null===(e=t.entidades)||void 0===e?void 0:e.entidade;if(null!=s){let t={fields:new Map};for(let i in s){let e=s[i];if(e.hasOwnProperty("$")&&t.fields.set(i,e.$),a)break}i(t)}else i(null)}))}))}}class f{setDataUnit(t){this._dataUnit=t}setApplication(t){this._application=t}formatLabel(t,i){const{userInterface:e}=this._dataUnit.getField(t);return e===s.DATETIME?r.formatDate(this._dataUnit.valueFromString(t,i)):String(this._dataUnit.getFormattedValue(t,i))}async getStaticOptions(t){return Promise.resolve(null==t?void 0:await c.getDistinct(this._dataUnit,t))}fetchData(t,i){return new Promise((e=>{this._application.executeSelectDistinct(this._dataUnit,i,t).then((t=>{e(t.map((t=>this._dataUnit.getField(i).userInterface===s.SEARCH?Object.assign(Object.assign({},JSON.parse(t)),{check:!0}):{value:t,label:this.formatLabel(i,t),check:!0})))}))}))}sortItems(t,i){return d.defaultSorterMultSelectionOption(this._dataUnit,t,i)}}class h{setGrid(t){this._grid||(this._grid=t,this.refreshSelectedRows())}setDataState(t){a.objectToString(t)!==a.objectToString(this._dataState)&&(this._dataState=t,this.refreshSelectedRows())}format(t,i,e){var s;if(!t)return t;const r=null===(s=this._dataState)||void 0===s?void 0:s.metadataByRow.get(e),a=null==r?void 0:r.getProp("rm_precision",i.name);return a||0===a?o.format(t,a,a):t}refreshSelectedRows(){var t;null===(t=this._grid)||void 0===t||t.refreshSelectedRows()}}class m{constructor(t,i){this.dataUnit=t,this.grid=i}async getColumnsMetadata(){var t;return this.columnsState=await(null===(t=this.grid)||void 0===t?void 0:t.getColumnsState())||[],await this.buildColumnsMetadata(this.columnsState)}getColumnsState(){return this.columnsState}async buildColumnsMetadata(t){var i,e;const s=[];for(const r of t){if(r.hidden&&"RECDESP"!==r.name)continue;const t=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(r.name),a=await this.grid.getCustomValueFormatter(r.name);if(s.push({label:r.label,id:r.name,width:r.width,type:null==t?void 0:t.dataType,userInterface:null==t?void 0:t.userInterface,customFormatter:a}),null!=(null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e.DESCRIPTIONFIELD)){const i=t.properties.mergedFrom;s.push({label:t.properties.DESCRIPTIONENTITY,id:`${i?i+".":""}${t.properties.ENTITYNAME}.${t.properties.DESCRIPTIONFIELD}`,width:r.width,type:n.TEXT,userInterface:l.LONGTEXT,descriptionFrom:t.name})}}return s||[]}}export{m as C,h as R,f as S,u as a}
@@ -1 +1 @@
1
- import{r as i,c as t,h as s,F as e,g as a}from"./p-d2d301a6.js";import{Action as r,ElementIDUtils as n,ApplicationContext as d,StringUtils as o}from"@sankhyalabs/core";import{T as h}from"./p-7e7a7473.js";import{C as l}from"./p-aff76a53.js";import{P as c}from"./p-30cf616e.js";import{T as u,o as g,b as T}from"./p-c2495304.js";import{s as m}from"./p-6dc031de.js";import{C as k,S as E,a as f,R as v}from"./p-e6210aec.js";import{SelectionMode as p}from"@sankhyalabs/core/dist/dataunit/DataUnit";import"./p-dc7c9047.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-6d4f4614.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import{g as R}from"./p-9863d682.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class O extends k{getFilters(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getAppliedFilters()}getOrders(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getSort()}getResourceURI(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.name}getSelectedNumber(){return this.dataUnit.getSelectionInfo().length}getTotalRecords(){var i,t,s;const{total:e}=(null===(i=this.dataUnit)||void 0===i?void 0:i.getPaginationInfo())||{};return null!=e?e:null===(s=null===(t=this.dataUnit)||void 0===t?void 0:t.records)||void 0===s?void 0:s.length}getSelectedIDs(){return R(this.dataUnit)}getOffset(){return this.getExporterOffset(this.getPaginationInfo())}getPageSize(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.pageSize}getExportLimit(){return 5e3}getRecordID(){var i,t,s;return null===(s=null===(t=null===(i=this.dataUnit)||void 0===i?void 0:i.records)||void 0===t?void 0:t[0])||void 0===s?void 0:s.__record__id__}getPaginationInfo(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getPaginationInfo()}getExporterOffset(i){if(null==i)return;const t=i.firstRecord;return t>0?t-1:t}}const b=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this._customEditors=new Map,this._customRenders=new Map,this._topTaskbarProcessor=new u({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.singleTaskbar":[],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE"],"snkGridTopTaskbar.finish_edition.secondary":[],"snkGridTopTaskbar.finish_edition.singleTaskbar":[]}),this._headerTaskbarProcessor=new u({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.detail.unselected":["REFRESH","MORE_OPTIONS"],"snkGridHeaderTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"],"snkGridHeaderTaskbar.singleTaskbar.unselected":["INSERT","FORM_MODE","CONFIGURATOR","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.singleTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","FORM_MODE","CONFIGURATOR","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.singleTaskbar.detail.unselected":["INSERT","FORM_MODE","CONFIGURATOR","REFRESH","MORE_OPTIONS"],"snkGridHeaderTaskbar.singleTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","FORM_MODE","CONFIGURATOR","REFRESH"],"snkGridHeaderTaskbar.singleTaskbar.finish_edition":["CANCEL","SAVE"]}),this.dataUnitInterceptor={interceptAction:async i=>i.type===r.METADATA_LOADED?await this.interceptMetadataLoaded(i):i},this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this._showSnkFilterBar=!0,this.columnFilterDataSource=new E,this.configName=void 0,this.filterBarTitle=void 0,this.resourceID=void 0,this.selectionToastConfig=void 0,this.actionsList=void 0,this.isDetail=void 0,this.taskbarManager=void 0,this.statusResolver=void 0,this.multipleSelection=void 0,this.presentationMode=c.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.recordsValidator=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.gridHeaderCustomSlotId="GRID_HEADER_CUSTOM_ELEMENTS",this.topTaskbarCustomSlotId="GRID_TASKBAR_CUSTOM_ELEMENTS",this.disablePersonalizedFilter=void 0,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.autoLoad=void 0,this.autoFocus=!0}async showConfig(){null!=this._grid&&this.openGridConfig()}async hideConfig(){null!=this._grid&&this.closeGridConfig()}async setConfig(i){this.setGridConfig(i)}async reloadFilterBar(){var i;null===(i=this._snkFilterBar)||void 0===i||i.reload()}async getFilterBar(){return this._snkFilterBar}async findColumn(){await g(this._moreOptions,this._columnSearch)}async addCustomEditor(i,t,s){if(this._grid)return void this._grid.addCustomEditor(i,t,s);const e=new Map(this._customEditors);e.set(i,{customEditor:t,detailContext:s}),this._customEditors=e}async addGridCustomRender(i,t,s){if(this._grid)return void this._grid.addGridCustomRender(i,t,s);const e=new Map(this._customRenders);e.set(i,{customRender:t,detailContext:s}),this._customRenders=e}async addCustomValueFormatter(i,t){this._grid.addCustomValueFormatter(i,t)}async removeCustomValueFormatter(i){this._grid.removeCustomValueFormatter(i)}async setFocus(){this._grid.setFocus()}async handleGridLegacyConfigName(i,t){i&&i!==t&&(this.addGridLegacyConfigName(),this.loadConfig())}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._snkGridConfig.selectedIndex=0,this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i,f.assertDefaultSorting(this._gridConfig,this._dataUnit)}loadConfig(){l.loadGridConfig(this.configName,this.resourceID).then((i=>{this.setGridConfig(i)})).catch((i=>{console.warn(i)}))}addGridLegacyConfigName(){this.gridLegacyConfigName&&this.configName&&l.addGridLegacyConfig(this.configName,this.gridLegacyConfigName)}gridConfigChangeHandler(i){l.saveGridConfig(i.detail,this.configName,this.resourceID),i.stopPropagation()}modalConfigChangeHandler(i){const t=i.detail;this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}async dataExporterProviderStore(){const i=new O(this._dataUnit,this._grid);m.set("exporterProviders",Object.assign(Object.assign({},m.get("exporterProviders")),{[this.configName]:i}))}addElementID(){n.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}loadGridCustomFormatters(i){i&&this._grid&&i.forEach((i=>{var t;(null===(t=i.properties)||void 0===t?void 0:t.rm_precision)&&this.addCustomValueFormatter(i.name,this._rmPrecisionCustomValueFormatter)}))}async interceptMetadataLoaded(i){return this.loadGridCustomFormatters(i.payload.fields),i}finishLoading(){this._dataUnit.addInterceptor(this.dataUnitInterceptor),f.assertDefaultSorting(this._gridConfig,this._dataUnit),this.addElementID(),null!=this.columnFilterDataSource&&(this.columnFilterDataSource.setApplication(this._application),this.columnFilterDataSource.setDataUnit(this._dataUnit))}setCustomRenders(){if(this._grid)for(const[i,t]of this._customRenders)this._grid.addGridCustomRender(i,t.customRender,t.detailContext),this._customRenders.delete(i)}setCustomEditors(){if(this._grid)for(const[i,t]of this._customEditors)this._grid.addCustomEditor(i,t.customEditor,t.detailContext),this._customEditors.delete(i)}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__");let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit?this.finishLoading():this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.finishLoading()})),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this)),this._snkDataUnit.addEventListener("cancelEdition",(()=>{var i;(null===(i=this._dataState)||void 0===i?void 0:i.recordsIsEmpty)&&this._dataUnit.clearSelection()}));break}i=i.parentElement}this._rmPrecisionCustomValueFormatter=new v,this.addGridLegacyConfigName(),this.loadConfig()}componentDidRender(){this._rmPrecisionCustomValueFormatter.setGrid(this._grid),this.loadGridCustomFormatters(this._dataUnit.metadata.fields),this.setCustomRenders(),this.setCustomEditors()}async handleDataStateChange(i){this._dataState=i.detail,this._rmPrecisionCustomValueFormatter.setDataState(this._dataState)}getHeaderDisabledButtons(){var i;const t=[];return(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)&&(this._dataState.selectionInfo.length>1&&t.push(h.CLONE,"ATTACH"),this._dataState.selectionInfo.isAllRecords()&&t.push("REMOVE")),t}getInvisibleButtons(){let i=[];return this._dataUnit&&0!==this._dataUnit.records.length||i.push("DATA_EXPORTER"),this._dataState&&this._dataState.selectionInfo.mode===p.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}componentWillRender(){const i=this.getInvisibleButtons();this._headerTaskbarProcessor.process(this.getHeaderTaskbarId(),this.taskbarManager,this._dataState,this.getHeaderDisabledButtons(),i),this._topTaskbarProcessor.process(this.getTopTaskBarId(),this.taskbarManager,this._dataState,void 0,i),this.dataExporterProviderStore()}getHeaderTaskbarId(){var i,t;const s=this._dataState&&!!(null===(i=this._dataState.selectionInfo)||void 0===i?void 0:i.length),e={primary:this.isDetail?"snkGridHeaderTaskbar.detail":"snkGridHeaderTaskbar",secondary:this.isDetail?"snkGridHeaderTaskbar.detail":"snkGridHeaderTaskbar",singleTaskbar:this.isDetail?"snkGridHeaderTaskbar.singleTaskbar.detail":"snkGridHeaderTaskbar.singleTaskbar"}[this.presentationMode];let a=s?`${e}.selected`:`${e}.unselected`;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)&&this.presentationMode===c.SINGLE_TASKBAR&&(a="snkGridHeaderTaskbar.singleTaskbar.finish_edition"),a}getTopTaskBarId(){var i;const t={primary:"",secondary:".secondary",singleTaskbar:".singleTaskbar"}[this.presentationMode];return(null===(i=this._dataState)||void 0===i?void 0:i.isDirty)?`snkGridTopTaskbar.finish_edition${t}`:`snkGridTopTaskbar.regular${t}`}getPrimaryButton(){return{primary:"INSERT",secondary:"",singleTaskbar:"INSERT"}[this.presentationMode]}getColumnSearch(i,t){return null!=this._columnSearch||(this._moreOptions=i,this._columnSearch=T(t,(({argument:i})=>new Promise((t=>{this._grid.filterColumns(i).then((i=>{t(i.filter((i=>!i.hidden)).map((i=>({label:i.label,value:i.name}))))}))}))),(t=>{null!=t&&(this._grid.locateColumn(t.value),i.hideActions())}))),this._columnSearch}getActionsList(){const i=[{value:o.generateUUID(),label:this.messagesBuilder.getMessage("snkGrid.findColumn",{}),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getColumnSearch(i,t)}];if(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions){const t=this.getTopTaskBarId();return i.concat(this.taskbarManager.getMoreOptions(t,this.configName,this._dataState,this.actionsList))}return i.concat(this.actionsList)}handleFilterConfigUpdated(i){this._showSnkFilterBar=!!i.length&&(1!==i.length||"PERSONALIZED_FILTER_GROUP"!==i[0].id||i[0].groupedItems.length>0)}render(){if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large"},s("div",{class:"snk-grid__header ez-margin-bottom--medium"},this._showSnkFilterBar&&s(e,null,s("snk-filter-bar",{ref:i=>this._snkFilterBar=i,title:this.filterBarTitle,dataUnit:this._dataUnit,"data-element-id":"gridFilter",class:"snk-grid__filter-bar ez-align--top",configName:this.configName,messagesBuilder:this.messagesBuilder,resourceID:this.resourceID,onConfigUpdated:i=>this.handleFilterConfigUpdated(i.detail),disablePersonalizedFilter:this.disablePersonalizedFilter,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad}),s("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider"})),s("snk-taskbar",{class:"ez-padding-left--medium","data-element-id":"grid_top",key:"topTaskbar",configName:this.configName,dataUnit:this._dataUnit,messagesBuilder:this.messagesBuilder,buttons:this._topTaskbarProcessor.buttons,disabledButtons:this._topTaskbarProcessor.disabledButtons,customButtons:this._topTaskbarProcessor.customButtons,primaryButton:this.getPrimaryButton(),resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:this.topTaskbarCustomSlotId,overflowStrategy:"none"},s("slot",{name:this.topTaskbarCustomSlotId}))),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===c.SECONDARY?"snk-grid-container__without-shadow ":"")+"snk-grid__table","data-element-id":"embedded",dataUnit:this._dataUnit,key:"grid-"+this._snkDataUnit.entityName,config:this._gridConfig,onConfigChange:i=>{this.gridConfigChangeHandler(i)},onEzDoubleClick:i=>this.gridDoubleClick.emit(i.detail),statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,columnfilterDataSource:this.columnFilterDataSource,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,recordsValidator:this.recordsValidator,canEdit:this.canEdit,autoFocus:this.autoFocus},s("snk-taskbar",{id:"teste",dataUnit:this._dataUnit,configName:this.configName,messagesBuilder:this.messagesBuilder,"data-element-id":"grid_left",buttons:this._headerTaskbarProcessor.buttons,presentationMode:this.presentationMode,disabledButtons:this._headerTaskbarProcessor.disabledButtons,customButtons:this._headerTaskbarProcessor.customButtons,slot:"leftButtons",actionsList:this.getActionsList(),primaryButton:this.getPrimaryButton(),resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:this.gridHeaderCustomSlotId},s("slot",{name:this.gridHeaderCustomSlotId}))),s("div",{class:"ez-col ez-col--sd-12"},s("slot",{name:"SnkGridFooter"})),s("ez-modal",{modalSize:"small",closeEsc:!1,closeOutsideClick:!1,opened:this._popUpGridConfig,onEzCloseModal:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(n.DATA_ELEMENT_ID_ATTRIBUTE_NAME),selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resourceID})))}get _element(){return a(this)}static get watchers(){return{gridLegacyConfigName:["handleGridLegacyConfigName"]}}};b.style=".sc-snk-grid-h{--snk-grid-min-height:300px}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";export{b as snk_grid}
1
+ import{r as i,c as t,h as s,F as e,g as a}from"./p-d2d301a6.js";import{Action as r,ElementIDUtils as n,ApplicationContext as d,StringUtils as o}from"@sankhyalabs/core";import{T as h}from"./p-7e7a7473.js";import{C as l}from"./p-aff76a53.js";import{P as c}from"./p-30cf616e.js";import{T as u,o as g,b as T}from"./p-c2495304.js";import{s as m}from"./p-6dc031de.js";import{C as k,S as f,a as E,R as v}from"./p-3a212712.js";import{SelectionMode as p}from"@sankhyalabs/core/dist/dataunit/DataUnit";import"./p-dc7c9047.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{g as R}from"./p-9863d682.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class O extends k{getFilters(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getAppliedFilters()}getOrders(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getSort()}getResourceURI(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.name}getSelectedNumber(){return this.dataUnit.getSelectionInfo().length}getTotalRecords(){var i,t,s;const{total:e}=(null===(i=this.dataUnit)||void 0===i?void 0:i.getPaginationInfo())||{};return null!=e?e:null===(s=null===(t=this.dataUnit)||void 0===t?void 0:t.records)||void 0===s?void 0:s.length}getSelectedIDs(){return R(this.dataUnit)}getOffset(){return this.getExporterOffset(this.getPaginationInfo())}getPageSize(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.pageSize}getExportLimit(){return 5e3}getRecordID(){var i,t,s;return null===(s=null===(t=null===(i=this.dataUnit)||void 0===i?void 0:i.records)||void 0===t?void 0:t[0])||void 0===s?void 0:s.__record__id__}getPaginationInfo(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getPaginationInfo()}getExporterOffset(i){if(null==i)return;const t=i.firstRecord;return t>0?t-1:t}}const b=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this._customEditors=new Map,this._customRenders=new Map,this._topTaskbarProcessor=new u({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.singleTaskbar":[],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE"],"snkGridTopTaskbar.finish_edition.secondary":[],"snkGridTopTaskbar.finish_edition.singleTaskbar":[]}),this._headerTaskbarProcessor=new u({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.detail.unselected":["REFRESH","MORE_OPTIONS"],"snkGridHeaderTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"],"snkGridHeaderTaskbar.singleTaskbar.unselected":["INSERT","FORM_MODE","CONFIGURATOR","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.singleTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","FORM_MODE","CONFIGURATOR","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.singleTaskbar.detail.unselected":["INSERT","FORM_MODE","CONFIGURATOR","REFRESH","MORE_OPTIONS"],"snkGridHeaderTaskbar.singleTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","FORM_MODE","CONFIGURATOR","REFRESH"],"snkGridHeaderTaskbar.singleTaskbar.finish_edition":["CANCEL","SAVE"]}),this.dataUnitInterceptor={interceptAction:async i=>i.type===r.METADATA_LOADED?await this.interceptMetadataLoaded(i):i},this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this._showSnkFilterBar=!0,this.columnFilterDataSource=new f,this.configName=void 0,this.filterBarTitle=void 0,this.resourceID=void 0,this.selectionToastConfig=void 0,this.actionsList=void 0,this.isDetail=void 0,this.taskbarManager=void 0,this.statusResolver=void 0,this.multipleSelection=void 0,this.presentationMode=c.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.recordsValidator=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.gridHeaderCustomSlotId="GRID_HEADER_CUSTOM_ELEMENTS",this.topTaskbarCustomSlotId="GRID_TASKBAR_CUSTOM_ELEMENTS",this.disablePersonalizedFilter=void 0,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.autoLoad=void 0,this.autoFocus=!0}async showConfig(){null!=this._grid&&this.openGridConfig()}async hideConfig(){null!=this._grid&&this.closeGridConfig()}async setConfig(i){this.setGridConfig(i)}async reloadFilterBar(){var i;null===(i=this._snkFilterBar)||void 0===i||i.reload()}async getFilterBar(){return this._snkFilterBar}async findColumn(){await g(this._moreOptions,this._columnSearch)}async addCustomEditor(i,t,s){if(this._grid)return void this._grid.addCustomEditor(i,t,s);const e=new Map(this._customEditors);e.set(i,{customEditor:t,detailContext:s}),this._customEditors=e}async addGridCustomRender(i,t,s){if(this._grid)return void this._grid.addGridCustomRender(i,t,s);const e=new Map(this._customRenders);e.set(i,{customRender:t,detailContext:s}),this._customRenders=e}async addCustomValueFormatter(i,t){this._grid.addCustomValueFormatter(i,t)}async removeCustomValueFormatter(i){this._grid.removeCustomValueFormatter(i)}async setFocus(){this._grid.setFocus()}async handleGridLegacyConfigName(i,t){i&&i!==t&&(this.addGridLegacyConfigName(),this.loadConfig())}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._snkGridConfig.selectedIndex=0,this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i,E.assertDefaultSorting(this._gridConfig,this._dataUnit)}loadConfig(){l.loadGridConfig(this.configName,this.resourceID).then((i=>{this.setGridConfig(i)})).catch((i=>{console.warn(i)}))}addGridLegacyConfigName(){this.gridLegacyConfigName&&this.configName&&l.addGridLegacyConfig(this.configName,this.gridLegacyConfigName)}gridConfigChangeHandler(i){l.saveGridConfig(i.detail,this.configName,this.resourceID),i.stopPropagation()}modalConfigChangeHandler(i){const t=i.detail;this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}async dataExporterProviderStore(){const i=new O(this._dataUnit,this._grid);m.set("exporterProviders",Object.assign(Object.assign({},m.get("exporterProviders")),{[this.configName]:i}))}addElementID(){n.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}loadGridCustomFormatters(i){i&&this._grid&&i.forEach((i=>{var t;(null===(t=i.properties)||void 0===t?void 0:t.rm_precision)&&this.addCustomValueFormatter(i.name,this._rmPrecisionCustomValueFormatter)}))}async interceptMetadataLoaded(i){return this.loadGridCustomFormatters(i.payload.fields),i}finishLoading(){this._dataUnit.addInterceptor(this.dataUnitInterceptor),E.assertDefaultSorting(this._gridConfig,this._dataUnit),this.addElementID(),null!=this.columnFilterDataSource&&(this.columnFilterDataSource.setApplication(this._application),this.columnFilterDataSource.setDataUnit(this._dataUnit))}setCustomRenders(){if(this._grid)for(const[i,t]of this._customRenders)this._grid.addGridCustomRender(i,t.customRender,t.detailContext),this._customRenders.delete(i)}setCustomEditors(){if(this._grid)for(const[i,t]of this._customEditors)this._grid.addCustomEditor(i,t.customEditor,t.detailContext),this._customEditors.delete(i)}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__");let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit?this.finishLoading():this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.finishLoading()})),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this)),this._snkDataUnit.addEventListener("cancelEdition",(()=>{var i;(null===(i=this._dataState)||void 0===i?void 0:i.recordsIsEmpty)&&this._dataUnit.clearSelection()}));break}i=i.parentElement}this._rmPrecisionCustomValueFormatter=new v,this.addGridLegacyConfigName(),this.loadConfig()}componentDidRender(){this._rmPrecisionCustomValueFormatter.setGrid(this._grid),this.loadGridCustomFormatters(this._dataUnit.metadata.fields),this.setCustomRenders(),this.setCustomEditors()}async handleDataStateChange(i){this._dataState=i.detail,this._rmPrecisionCustomValueFormatter.setDataState(this._dataState)}getHeaderDisabledButtons(){var i;const t=[];return(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)&&(this._dataState.selectionInfo.length>1&&t.push(h.CLONE,"ATTACH"),this._dataState.selectionInfo.isAllRecords()&&t.push("REMOVE")),t}getInvisibleButtons(){let i=[];return this._dataUnit&&0!==this._dataUnit.records.length||i.push("DATA_EXPORTER"),this._dataState&&this._dataState.selectionInfo.mode===p.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}componentWillRender(){const i=this.getInvisibleButtons();this._headerTaskbarProcessor.process(this.getHeaderTaskbarId(),this.taskbarManager,this._dataState,this.getHeaderDisabledButtons(),i),this._topTaskbarProcessor.process(this.getTopTaskBarId(),this.taskbarManager,this._dataState,void 0,i),this.dataExporterProviderStore()}getHeaderTaskbarId(){var i,t;const s=this._dataState&&!!(null===(i=this._dataState.selectionInfo)||void 0===i?void 0:i.length),e={primary:this.isDetail?"snkGridHeaderTaskbar.detail":"snkGridHeaderTaskbar",secondary:this.isDetail?"snkGridHeaderTaskbar.detail":"snkGridHeaderTaskbar",singleTaskbar:this.isDetail?"snkGridHeaderTaskbar.singleTaskbar.detail":"snkGridHeaderTaskbar.singleTaskbar"}[this.presentationMode];let a=s?`${e}.selected`:`${e}.unselected`;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)&&this.presentationMode===c.SINGLE_TASKBAR&&(a="snkGridHeaderTaskbar.singleTaskbar.finish_edition"),a}getTopTaskBarId(){var i;const t={primary:"",secondary:".secondary",singleTaskbar:".singleTaskbar"}[this.presentationMode];return(null===(i=this._dataState)||void 0===i?void 0:i.isDirty)?`snkGridTopTaskbar.finish_edition${t}`:`snkGridTopTaskbar.regular${t}`}getPrimaryButton(){return{primary:"INSERT",secondary:"",singleTaskbar:"INSERT"}[this.presentationMode]}getColumnSearch(i,t){return null!=this._columnSearch||(this._moreOptions=i,this._columnSearch=T(t,(({argument:i})=>new Promise((t=>{this._grid.filterColumns(i).then((i=>{t(i.filter((i=>!i.hidden)).map((i=>({label:i.label,value:i.name}))))}))}))),(t=>{null!=t&&(this._grid.locateColumn(t.value),i.hideActions())}))),this._columnSearch}getActionsList(){const i=[{value:o.generateUUID(),label:this.messagesBuilder.getMessage("snkGrid.findColumn",{}),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getColumnSearch(i,t)}];if(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions){const t=this.getTopTaskBarId();return i.concat(this.taskbarManager.getMoreOptions(t,this.configName,this._dataState,this.actionsList))}return i.concat(this.actionsList)}handleFilterConfigUpdated(i){this._showSnkFilterBar=!!i.length&&(1!==i.length||"PERSONALIZED_FILTER_GROUP"!==i[0].id||i[0].groupedItems.length>0)}render(){if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large"},s("div",{class:"snk-grid__header ez-margin-bottom--medium"},this._showSnkFilterBar&&s(e,null,s("snk-filter-bar",{ref:i=>this._snkFilterBar=i,title:this.filterBarTitle,dataUnit:this._dataUnit,"data-element-id":"gridFilter",class:"snk-grid__filter-bar ez-align--top",configName:this.configName,messagesBuilder:this.messagesBuilder,resourceID:this.resourceID,onConfigUpdated:i=>this.handleFilterConfigUpdated(i.detail),disablePersonalizedFilter:this.disablePersonalizedFilter,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad}),s("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider"})),s("snk-taskbar",{class:"ez-padding-left--medium","data-element-id":"grid_top",key:"topTaskbar",configName:this.configName,dataUnit:this._dataUnit,messagesBuilder:this.messagesBuilder,buttons:this._topTaskbarProcessor.buttons,disabledButtons:this._topTaskbarProcessor.disabledButtons,customButtons:this._topTaskbarProcessor.customButtons,primaryButton:this.getPrimaryButton(),resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:this.topTaskbarCustomSlotId,overflowStrategy:"none"},s("slot",{name:this.topTaskbarCustomSlotId}))),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===c.SECONDARY?"snk-grid-container__without-shadow ":"")+"snk-grid__table","data-element-id":"embedded",dataUnit:this._dataUnit,key:"grid-"+this._snkDataUnit.entityName,config:this._gridConfig,onConfigChange:i=>{this.gridConfigChangeHandler(i)},onEzDoubleClick:i=>this.gridDoubleClick.emit(i.detail),statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,columnfilterDataSource:this.columnFilterDataSource,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,recordsValidator:this.recordsValidator,canEdit:this.canEdit,autoFocus:this.autoFocus},s("snk-taskbar",{id:"teste",dataUnit:this._dataUnit,configName:this.configName,messagesBuilder:this.messagesBuilder,"data-element-id":"grid_left",buttons:this._headerTaskbarProcessor.buttons,presentationMode:this.presentationMode,disabledButtons:this._headerTaskbarProcessor.disabledButtons,customButtons:this._headerTaskbarProcessor.customButtons,slot:"leftButtons",actionsList:this.getActionsList(),primaryButton:this.getPrimaryButton(),resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:this.gridHeaderCustomSlotId},s("slot",{name:this.gridHeaderCustomSlotId}))),s("div",{class:"ez-col ez-col--sd-12"},s("slot",{name:"SnkGridFooter"})),s("ez-modal",{modalSize:"small",closeEsc:!1,closeOutsideClick:!1,opened:this._popUpGridConfig,onEzCloseModal:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(n.DATA_ELEMENT_ID_ATTRIBUTE_NAME),selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resourceID})))}get _element(){return a(this)}static get watchers(){return{gridLegacyConfigName:["handleGridLegacyConfigName"]}}};b.style=".sc-snk-grid-h{--snk-grid-min-height:300px}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";export{b as snk_grid}