@sankhyalabs/sankhyablocks 10.1.0-dev.12 → 10.1.0-dev.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/cjs/{ConfigStorage-5c0590b3.js → ConfigStorage-a4e1e518.js} +2 -2
  2. package/dist/cjs/{DataFetcher-5181a917.js → DataFetcher-0b6aa084.js} +11 -22
  3. package/dist/cjs/{ISave-0f98a457.js → ISave-2c455a77.js} +1 -1
  4. package/dist/cjs/{SnkFormConfigManager-1907ffed.js → SnkFormConfigManager-b8c81493.js} +2 -2
  5. package/dist/cjs/{SnkMultiSelectionListDataSource-e4e38139.js → SnkMultiSelectionListDataSource-3f561345.js} +4 -4
  6. package/dist/cjs/{auth-fetcher-cff55b1f.js → auth-fetcher-7e7796c9.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-1ba5e2cc.js → dataunit-fetcher-8dffbcdf.js} +1 -1
  8. package/dist/cjs/{form-config-fetcher-4a679e23.js → form-config-fetcher-5516d68a.js} +1 -1
  9. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
  10. package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -5
  11. package/dist/cjs/snk-application.cjs.entry.js +6 -6
  12. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  13. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  15. package/dist/cjs/{snk-data-unit-061487a8.js → snk-data-unit-b8ea81e1.js} +2 -2
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  18. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +27 -7
  19. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-filter-period.cjs.entry.js +10 -5
  22. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  23. package/dist/cjs/snk-form_2.cjs.entry.js +4 -4
  24. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  25. package/dist/cjs/{snk-guides-viewer-2efe60a7.js → snk-guides-viewer-61701970.js} +5 -5
  26. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  27. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  28. package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -4
  29. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  30. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +1 -1
  31. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +11 -6
  32. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
  33. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +4 -0
  34. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +9 -1
  35. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +12 -3
  36. package/dist/collection/lib/message/SnkMessageBuilder.js +11 -2
  37. package/dist/components/DataFetcher.js +11 -2
  38. package/dist/components/snk-filter-bar2.js +12 -3
  39. package/dist/components/snk-filter-item2.js +4 -0
  40. package/dist/components/snk-filter-modal2.js +9 -2
  41. package/dist/components/snk-filter-number.js +1 -1
  42. package/dist/components/snk-filter-period.js +10 -5
  43. package/dist/components/snk-filter-text.js +1 -1
  44. package/dist/esm/{ConfigStorage-bd096633.js → ConfigStorage-39ac8fef.js} +2 -2
  45. package/dist/esm/{DataFetcher-5780ad39.js → DataFetcher-0b9da57d.js} +11 -2
  46. package/dist/esm/{ISave-8a22ec18.js → ISave-f1c9269b.js} +1 -1
  47. package/dist/esm/{SnkFormConfigManager-437e98bb.js → SnkFormConfigManager-a87566c8.js} +2 -2
  48. package/dist/esm/{SnkMultiSelectionListDataSource-42125ef4.js → SnkMultiSelectionListDataSource-2d1ea0c5.js} +4 -4
  49. package/dist/esm/{auth-fetcher-28b9d0db.js → auth-fetcher-acdc1cb4.js} +1 -1
  50. package/dist/esm/{dataunit-fetcher-c4251d80.js → dataunit-fetcher-4c312b43.js} +1 -1
  51. package/dist/esm/{form-config-fetcher-d0536a71.js → form-config-fetcher-7cda6254.js} +1 -1
  52. package/dist/esm/pesquisa-grid_2.entry.js +4 -4
  53. package/dist/esm/snk-actions-button_9.entry.js +5 -5
  54. package/dist/esm/snk-application.entry.js +6 -6
  55. package/dist/esm/snk-attach.entry.js +5 -5
  56. package/dist/esm/snk-crud.entry.js +5 -5
  57. package/dist/esm/snk-data-exporter.entry.js +5 -5
  58. package/dist/esm/{snk-data-unit-4a1ef77f.js → snk-data-unit-6f31ec56.js} +2 -2
  59. package/dist/esm/snk-data-unit.entry.js +3 -3
  60. package/dist/esm/snk-detail-view.entry.js +7 -7
  61. package/dist/esm/snk-filter-bar_4.entry.js +28 -8
  62. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  63. package/dist/esm/snk-filter-number.entry.js +1 -1
  64. package/dist/esm/snk-filter-period.entry.js +10 -5
  65. package/dist/esm/snk-filter-text.entry.js +1 -1
  66. package/dist/esm/snk-form_2.entry.js +4 -4
  67. package/dist/esm/snk-grid.entry.js +6 -6
  68. package/dist/esm/{snk-guides-viewer-c182d058.js → snk-guides-viewer-c31259f0.js} +5 -5
  69. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  70. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  71. package/dist/esm/snk-pesquisa.entry.js +4 -4
  72. package/dist/esm/snk-simple-crud.entry.js +7 -7
  73. package/dist/sankhyablocks/{p-01ca59fc.entry.js → p-04bbdf6f.entry.js} +1 -1
  74. package/dist/sankhyablocks/{p-fd05e31d.entry.js → p-0814b16c.entry.js} +1 -1
  75. package/dist/sankhyablocks/{p-0e4f8b86.js → p-1f310bc6.js} +1 -1
  76. package/dist/sankhyablocks/{p-42272de8.entry.js → p-20349480.entry.js} +1 -1
  77. package/dist/sankhyablocks/{p-aca74b21.js → p-2ac55a5d.js} +1 -1
  78. package/dist/sankhyablocks/{p-82a3d522.entry.js → p-2d133b6e.entry.js} +1 -1
  79. package/dist/sankhyablocks/{p-d3534985.js → p-3f68a254.js} +1 -1
  80. package/dist/sankhyablocks/{p-3c046287.js → p-48a5c311.js} +2 -2
  81. package/dist/sankhyablocks/{p-55d7abe7.js → p-4b1c26ae.js} +1 -1
  82. package/dist/sankhyablocks/p-52691b42.js +1 -0
  83. package/dist/sankhyablocks/{p-2e882241.entry.js → p-52c0cade.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-6e5af618.entry.js → p-5fd4f0f6.entry.js} +1 -1
  85. package/dist/sankhyablocks/{p-1b1373b6.js → p-6768f176.js} +1 -1
  86. package/dist/sankhyablocks/{p-903fa0b4.entry.js → p-6b9833c7.entry.js} +1 -1
  87. package/dist/sankhyablocks/{p-1037ea7b.entry.js → p-728959a6.entry.js} +1 -1
  88. package/dist/sankhyablocks/{p-d2ec9a24.entry.js → p-74389ec4.entry.js} +1 -1
  89. package/dist/sankhyablocks/p-7af6e6b8.entry.js +1 -0
  90. package/dist/sankhyablocks/{p-4db9dbf8.js → p-7ee6b1bf.js} +1 -1
  91. package/dist/sankhyablocks/{p-a1d23fef.js → p-8027f732.js} +1 -1
  92. package/dist/sankhyablocks/{p-028fb380.entry.js → p-8ce94b62.entry.js} +1 -1
  93. package/dist/sankhyablocks/{p-093f58fa.entry.js → p-99a11017.entry.js} +1 -1
  94. package/dist/sankhyablocks/{p-9ab6ae1e.js → p-9e4555ab.js} +2 -2
  95. package/dist/sankhyablocks/{p-03f02b12.entry.js → p-a5e0a780.entry.js} +1 -1
  96. package/dist/sankhyablocks/{p-4c763b10.entry.js → p-a9b16874.entry.js} +1 -1
  97. package/dist/sankhyablocks/{p-78d4b3e3.entry.js → p-af3aface.entry.js} +1 -1
  98. package/dist/sankhyablocks/p-b47acee0.entry.js +1 -0
  99. package/dist/sankhyablocks/{p-9f16d33e.entry.js → p-bdd4f02c.entry.js} +1 -1
  100. package/dist/sankhyablocks/p-e679c75a.entry.js +1 -0
  101. package/dist/sankhyablocks/{p-5d408e7e.entry.js → p-fa8c2485.entry.js} +1 -1
  102. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  103. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
  104. package/package.json +1 -1
  105. package/dist/sankhyablocks/p-30a58e29.entry.js +0 -1
  106. package/dist/sankhyablocks/p-3ed04f0d.entry.js +0 -1
  107. package/dist/sankhyablocks/p-9b67a417.entry.js +0 -1
  108. package/dist/sankhyablocks/p-b9699067.js +0 -1
@@ -4,14 +4,14 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
4
4
  import { I as IExportType } from './IFetchDataExporterParams-d73bed3d.js';
5
5
  import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat } from './index-b40568ff.js';
6
6
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-7b422de0.js';
7
- import { D as DataFetcher } from './DataFetcher-5780ad39.js';
8
- import { S as SnkDataUnit } from './snk-data-unit-4a1ef77f.js';
9
- import './ISave-8a22ec18.js';
7
+ import { D as DataFetcher } from './DataFetcher-0b9da57d.js';
8
+ import { S as SnkDataUnit } from './snk-data-unit-6f31ec56.js';
9
+ import './ISave-f1c9269b.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
- import './dataunit-fetcher-c4251d80.js';
12
+ import './dataunit-fetcher-4c312b43.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
- import './form-config-fetcher-d0536a71.js';
14
+ import './form-config-fetcher-7cda6254.js';
15
15
  import './PrintUtils-3e4ff0f5.js';
16
16
  import '@sankhyalabs/core/dist/dataunit/metadata/DataType';
17
17
  import './GetSelectedRecordsIDsInfo-9fa41508.js';
@@ -1,8 +1,8 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-479e1293.js';
2
2
  import { ApplicationContext, Action, ObjectUtils, DataUnitAction, StringUtils } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { O as OperationMap, S as SnkMessageBuilder } from './DataFetcher-5780ad39.js';
5
- import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-c4251d80.js';
4
+ import { O as OperationMap, S as SnkMessageBuilder } from './DataFetcher-0b9da57d.js';
5
+ import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-4c312b43.js';
6
6
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
7
7
  import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
8
8
 
@@ -1,11 +1,11 @@
1
- export { S as snk_data_unit } from './snk-data-unit-4a1ef77f.js';
1
+ export { S as snk_data_unit } from './snk-data-unit-6f31ec56.js';
2
2
  import './index-479e1293.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/ezui/dist/collection/utils';
5
- import './DataFetcher-5780ad39.js';
5
+ import './DataFetcher-0b9da57d.js';
6
6
  import './PrintUtils-3e4ff0f5.js';
7
7
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
- import './dataunit-fetcher-c4251d80.js';
8
+ import './dataunit-fetcher-4c312b43.js';
9
9
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
10
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
11
11
  import '@sankhyalabs/core/dist/utils/SortingUtils';
@@ -1,20 +1,20 @@
1
1
  import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-479e1293.js';
2
2
  import { Action, StringUtils, KeyboardManager } from '@sankhyalabs/core';
3
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-437e98bb.js';
3
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-a87566c8.js';
4
4
  import { FormMetadata, buildFormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
- import { S as SnkMessageBuilder } from './DataFetcher-5780ad39.js';
6
- import './ISave-8a22ec18.js';
5
+ import { S as SnkMessageBuilder } from './DataFetcher-0b9da57d.js';
6
+ import './ISave-f1c9269b.js';
7
7
  import { P as PresentationMode } from './index-b40568ff.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './dataunit-fetcher-c4251d80.js';
10
+ import './dataunit-fetcher-4c312b43.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-d0536a71.js';
12
+ import './form-config-fetcher-7cda6254.js';
13
13
  import { V as VIEW_MODE } from './constants-7b422de0.js';
14
14
  import { T as TaskbarElement } from './taskbar-elements-faaf5d8f.js';
15
- import { S as SnkGuidesViewer } from './snk-guides-viewer-c182d058.js';
15
+ import { S as SnkGuidesViewer } from './snk-guides-viewer-c31259f0.js';
16
16
  import { buildFieldSearch, SHORTCUT_SEARCH_FIELD } from '@sankhyalabs/ezui/dist/collection/utils';
17
- import './ConfigStorage-bd096633.js';
17
+ import './ConfigStorage-39ac8fef.js';
18
18
  import './PrintUtils-3e4ff0f5.js';
19
19
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
20
20
  import '@sankhyalabs/core/dist/utils/SortingUtils';
@@ -1,7 +1,7 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-479e1293.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, f as forceUpdate } from './index-479e1293.js';
2
2
  import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext, LockManager, LockManagerOperation, DateUtils, MaskFormatter, KeyboardManager, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
3
3
  import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
4
- import { C as ConfigStorage } from './ConfigStorage-bd096633.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-39ac8fef.js';
5
5
  import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-2db38ff2.js';
6
6
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
7
7
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
@@ -12,8 +12,8 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
12
12
  import { A as ActionDefaultFilter } from './default-filters-50105e43.js';
13
13
  import { F as FilterType } from './filter-type.enum-f6a8fe23.js';
14
14
  import { g as getInvalidFilters } from './filter-validate-faf51fa9.js';
15
- import './form-config-fetcher-d0536a71.js';
16
- import './DataFetcher-5780ad39.js';
15
+ import './form-config-fetcher-7cda6254.js';
16
+ import './DataFetcher-0b9da57d.js';
17
17
  import './PrintUtils-3e4ff0f5.js';
18
18
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
19
19
 
@@ -256,10 +256,19 @@ const SnkFilterBar = class {
256
256
  this.isFilterModalOpen = false;
257
257
  }
258
258
  hasValidValue(item) {
259
- if (item.value === undefined || item.value === null)
259
+ var _a, _b;
260
+ if (item.value === undefined || item.value === null) {
260
261
  return false;
261
- if (!Array.isArray(item.value))
262
+ }
263
+ if (item.type === FilterItemType.PERIOD) {
264
+ return (!!((_a = item.value) === null || _a === void 0 ? void 0 : _a.start) || !!((_b = item.value) === null || _b === void 0 ? void 0 : _b.end));
265
+ }
266
+ if (item.groupedItems) {
262
267
  return true;
268
+ }
269
+ if (!Array.isArray(item.value)) {
270
+ return true;
271
+ }
263
272
  return item.value.some(filterItem => filterItem.check === true);
264
273
  }
265
274
  observeFilterConfig(newValue, oldValue) {
@@ -461,7 +470,7 @@ const SnkFilterBar = class {
461
470
  if (item.type === FilterItemType.DEFAULT_FILTER) {
462
471
  return true;
463
472
  }
464
- return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
473
+ return this.filterActiveFilter(item) && this.hasValidValue(item);
465
474
  }
466
475
  async registryFilterProvider() {
467
476
  this.dataUnit.addFilterProvider(this);
@@ -946,6 +955,10 @@ const SnkFilterItem = class {
946
955
  return ((_a = list === null || list === void 0 ? void 0 : list.filter((val) => val === null || val === void 0 ? void 0 : val.check)) === null || _a === void 0 ? void 0 : _a.length) > 0;
947
956
  }
948
957
  hasActiveValue(config) {
958
+ var _a, _b;
959
+ if (config.type === FilterItemType.PERIOD) {
960
+ return (!!((_a = config.value) === null || _a === void 0 ? void 0 : _a.start) || !!((_b = config.value) === null || _b === void 0 ? void 0 : _b.end));
961
+ }
949
962
  return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
950
963
  }
951
964
  getEnabledChip() {
@@ -1232,6 +1245,7 @@ const SnkFilterModal = class {
1232
1245
  this.handleClearCustomFilters(customFilters);
1233
1246
  this.handleClearOthersFilters(otherFilters);
1234
1247
  multiListFilters.forEach(multiListFilter => this.handleClearSigleFilter(multiListFilter));
1248
+ forceUpdate(this);
1235
1249
  }
1236
1250
  handleClearOthersFilters(otherFilters) {
1237
1251
  this.filters = this.filters.map(filter => otherFilters.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
@@ -1403,7 +1417,7 @@ const SnkFilterModal = class {
1403
1417
  getIformedFiltersCount(listItems) {
1404
1418
  let countInformedItens = 0;
1405
1419
  listItems.forEach(localItem => {
1406
- var _a, _b, _c, _d, _e, _f;
1420
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1407
1421
  const item = this.filterConfig.find(filter => filter.id === localItem.id);
1408
1422
  if (FilterItemType.MULTI_LIST === item.type) {
1409
1423
  countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
@@ -1415,6 +1429,12 @@ const SnkFilterModal = class {
1415
1429
  .map(([key, _]) => key).length;
1416
1430
  return;
1417
1431
  }
1432
+ if (FilterItemType.PERIOD === item.type) {
1433
+ if (!!((_g = item.value) === null || _g === void 0 ? void 0 : _g.start) || !!((_h = item.value) === null || _h === void 0 ? void 0 : _h.end)) {
1434
+ countInformedItens++;
1435
+ }
1436
+ return;
1437
+ }
1418
1438
  if (item.groupedItems != undefined) {
1419
1439
  countInformedItens = item.groupedItems.filter(item => item.visible).length;
1420
1440
  return;
@@ -1,11 +1,11 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-479e1293.js';
2
2
  import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
3
- import { C as ConfigStorage } from './ConfigStorage-bd096633.js';
3
+ import { C as ConfigStorage } from './ConfigStorage-39ac8fef.js';
4
4
  import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
5
5
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
6
6
  import { F as FilterType } from './filter-type.enum-f6a8fe23.js';
7
- import './form-config-fetcher-d0536a71.js';
8
- import './DataFetcher-5780ad39.js';
7
+ import './form-config-fetcher-7cda6254.js';
8
+ import './DataFetcher-0b9da57d.js';
9
9
  import './PrintUtils-3e4ff0f5.js';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
11
 
@@ -104,7 +104,7 @@ const SnkFilterPeriod = class {
104
104
  if (this.getVariation() === FilterNumberVariation.INTERVAL) {
105
105
  return (h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, h("div", { class: "ez-col ez-col--nowrap" }, h("ez-number-input", { id: `${this.config.id}_start`, class: this.presentationMode === EPresentationMode.MODAL ? 'ez-padding-right--medium' : '', label: this._startIntervalLabel, ref: ref => this._startInterval = ref, value: this.getIntervalValue("start"), enabled: this.config.enabled, precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision, errorMessage: this.errorMessage }), this.buildLabel(), h("ez-number-input", { id: `${this.config.id}_end`, label: this._endIntervalLabel, ref: ref => this._endInterval = ref, value: this.getIntervalValue("end"), enabled: this.config.enabled, precision: (_b = this.config.props) === null || _b === void 0 ? void 0 : _b.precision, errorMessage: this.errorMessage }))));
106
106
  }
107
- return (h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, h("ez-number-input", { id: this.config.id, ref: ref => this._numberElement = ref, value: this.config.value, precision: (_c = this.config.props) === null || _c === void 0 ? void 0 : _c.precision, enabled: this.config.enabled, errorMessage: this.errorMessage })));
107
+ return (h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, h("ez-number-input", { id: this.config.id, label: this.config.label, ref: ref => this._numberElement = ref, value: this.config.value, precision: (_c = this.config.props) === null || _c === void 0 ? void 0 : _c.precision, enabled: this.config.enabled, errorMessage: this.errorMessage })));
108
108
  }
109
109
  get _element() { return getElement(this); }
110
110
  };
@@ -10,16 +10,17 @@ const SnkFilterPeriod = class {
10
10
  this._startDateLabel = 'Inicial';
11
11
  this._endDateLabel = 'Final';
12
12
  this._toLabel = 'até';
13
+ this._defaultEmptyValue = {
14
+ start: null,
15
+ end: null
16
+ };
13
17
  this.internalChange = {
14
18
  start: false,
15
19
  end: false
16
20
  };
17
21
  this.config = undefined;
18
22
  this.getMessage = undefined;
19
- this.value = {
20
- start: null,
21
- end: null
22
- };
23
+ this.value = this._defaultEmptyValue;
23
24
  this.presentationMode = EPresentationMode.CHIP;
24
25
  this.errorMessage = undefined;
25
26
  }
@@ -32,6 +33,10 @@ const SnkFilterPeriod = class {
32
33
  this.internalChange.start = false;
33
34
  return;
34
35
  }
36
+ if ((!newValue && oldValue) || (!(newValue === null || newValue === void 0 ? void 0 : newValue.start) && !(newValue === null || newValue === void 0 ? void 0 : newValue.end))) {
37
+ this.clearValue();
38
+ return;
39
+ }
35
40
  if (newValue && (newValue.start !== (oldValue === null || oldValue === void 0 ? void 0 : oldValue.start) || newValue.end !== (oldValue === null || oldValue === void 0 ? void 0 : oldValue.end))) {
36
41
  this.valueStart = this.parseDate(newValue.start);
37
42
  this.valueEnd = this.parseDate(newValue.end);
@@ -53,7 +58,7 @@ const SnkFilterPeriod = class {
53
58
  * Limpa o valor do componente restaurando o valor original da configuração.
54
59
  */
55
60
  async clearValue() {
56
- this.value = this.config.value;
61
+ this.value = this.config.value || this._defaultEmptyValue;
57
62
  this.valueStart = this.getDate("start");
58
63
  this.valueEnd = this.getDate("end");
59
64
  }
@@ -42,7 +42,7 @@ const SnkFilterText = class {
42
42
  if (!this.config) {
43
43
  return undefined;
44
44
  }
45
- return (h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, h("ez-text-input", { id: this.config.id, ref: ref => this._textInputElement = ref, value: this.config.value, mask: (_a = this.config) === null || _a === void 0 ? void 0 : _a.mask, enabled: this.config.enabled, cleanValueMask: true, errorMessage: this.errorMessage })));
45
+ return (h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, h("ez-text-input", { id: this.config.id, label: this.config.label, ref: ref => this._textInputElement = ref, value: this.config.value, mask: (_a = this.config) === null || _a === void 0 ? void 0 : _a.mask, enabled: this.config.enabled, cleanValueMask: true, errorMessage: this.errorMessage })));
46
46
  }
47
47
  get _element() { return getElement(this); }
48
48
  };
@@ -1,14 +1,14 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-479e1293.js';
2
2
  import { ElementIDUtils, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
3
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-437e98bb.js';
3
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-a87566c8.js';
4
4
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
5
5
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
6
6
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
7
- import { U as UserConfigType } from './form-config-fetcher-d0536a71.js';
7
+ import { U as UserConfigType } from './form-config-fetcher-7cda6254.js';
8
8
  import { a as TAB_NAMES, G as GROUP_NAMES } from './constants-7b422de0.js';
9
9
  import { b as buildGuides, a as buildChildrenGuides, c as buildCustomGuides, d as buildGuidesMap, g as getFieldsToSave, u as updateTabInFieldsFromGroupList, e as buildNewGuideName } from './FormConfigHelper-d09669f3.js';
10
- import './ConfigStorage-bd096633.js';
11
- import './DataFetcher-5780ad39.js';
10
+ import './ConfigStorage-39ac8fef.js';
11
+ import './DataFetcher-0b9da57d.js';
12
12
  import './PrintUtils-3e4ff0f5.js';
13
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
14
14
  import './filter-item-type.enum-d45e026f.js';
@@ -2,17 +2,17 @@ import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElem
2
2
  import { KeyboardManager, Action, ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
3
3
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
4
4
  import { buildFieldSearch } from '@sankhyalabs/ezui/dist/collection/utils';
5
- import './DataFetcher-5780ad39.js';
6
- import './ISave-8a22ec18.js';
7
- import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, c as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-42125ef4.js';
5
+ import './DataFetcher-0b9da57d.js';
6
+ import './ISave-f1c9269b.js';
7
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, c as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-2d1ea0c5.js';
8
8
  import { P as PresentationMode, E as ExporterStrategy } from './index-b40568ff.js';
9
9
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
- import './dataunit-fetcher-c4251d80.js';
11
+ import './dataunit-fetcher-4c312b43.js';
12
12
  import './filter-item-type.enum-d45e026f.js';
13
- import './form-config-fetcher-d0536a71.js';
13
+ import './form-config-fetcher-7cda6254.js';
14
14
  import './constants-7b422de0.js';
15
- import { C as ConfigStorage } from './ConfigStorage-bd096633.js';
15
+ import { C as ConfigStorage } from './ConfigStorage-39ac8fef.js';
16
16
  import { s as store } from './index-446f9341.js';
17
17
  import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
18
18
  import { v as validateFilters } from './filter-validate-faf51fa9.js';
@@ -3,16 +3,16 @@ import { ObjectUtils, StringUtils, Action, KeyboardManager, ElementIDUtils } fro
3
3
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
4
4
  import { buildFieldSearch, SHORTCUT_SEARCH_FIELD } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
6
- import './DataFetcher-5780ad39.js';
7
- import './ISave-8a22ec18.js';
6
+ import './DataFetcher-0b9da57d.js';
7
+ import './ISave-f1c9269b.js';
8
8
  import { P as PresentationMode } from './index-b40568ff.js';
9
9
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
- import './dataunit-fetcher-c4251d80.js';
11
+ import './dataunit-fetcher-4c312b43.js';
12
12
  import './filter-item-type.enum-d45e026f.js';
13
- import './form-config-fetcher-d0536a71.js';
13
+ import './form-config-fetcher-7cda6254.js';
14
14
  import { V as VIEW_MODE } from './constants-7b422de0.js';
15
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-437e98bb.js';
15
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-a87566c8.js';
16
16
  import { T as TaskbarElement } from './taskbar-elements-faaf5d8f.js';
17
17
  import { T as TaskbarProcessor } from './taskbar-processor-3436124c.js';
18
18
 
@@ -1,24 +1,24 @@
1
- export { S as snk_guides_viewer } from './snk-guides-viewer-c182d058.js';
1
+ export { S as snk_guides_viewer } from './snk-guides-viewer-c31259f0.js';
2
2
  import './index-479e1293.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/core/dist/dataunit/DataUnit';
5
5
  import '@sankhyalabs/ezui/dist/collection/utils';
6
6
  import '@sankhyalabs/ezui/dist/collection/utils/form';
7
- import './DataFetcher-5780ad39.js';
7
+ import './DataFetcher-0b9da57d.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './ISave-8a22ec18.js';
10
+ import './ISave-f1c9269b.js';
11
11
  import './index-b40568ff.js';
12
12
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
13
- import './dataunit-fetcher-c4251d80.js';
13
+ import './dataunit-fetcher-4c312b43.js';
14
14
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
15
15
  import '@sankhyalabs/core/dist/utils/SortingUtils';
16
16
  import './ResourceIDUtils-a114189a.js';
17
17
  import './filter-item-type.enum-d45e026f.js';
18
- import './form-config-fetcher-d0536a71.js';
18
+ import './form-config-fetcher-7cda6254.js';
19
19
  import './constants-7b422de0.js';
20
- import './SnkFormConfigManager-437e98bb.js';
21
- import './ConfigStorage-bd096633.js';
20
+ import './SnkFormConfigManager-a87566c8.js';
21
+ import './ConfigStorage-39ac8fef.js';
22
22
  import './taskbar-elements-faaf5d8f.js';
23
23
  import './index-446f9341.js';
24
24
  import './taskbar-processor-3436124c.js';
@@ -1,13 +1,13 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-479e1293.js';
2
2
  import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-2db38ff2.js';
4
- import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-bd096633.js';
4
+ import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-39ac8fef.js';
5
5
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
6
6
  import { a as FilterGroupCondition, D as DefaultFilter } from './index-8acbae97.js';
7
7
  import { s as store } from './index-446f9341.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
- import './form-config-fetcher-d0536a71.js';
10
- import './DataFetcher-5780ad39.js';
9
+ import './form-config-fetcher-7cda6254.js';
10
+ import './DataFetcher-0b9da57d.js';
11
11
  import './PrintUtils-3e4ff0f5.js';
12
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
13
 
@@ -1,13 +1,13 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-479e1293.js';
2
2
  import { ObjectUtils, StringUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
- import { P as PesquisaFetcher, b as buildGridMetadata, a as PESQUISA_VIEW_MODE } from './ISave-8a22ec18.js';
4
- import './DataFetcher-5780ad39.js';
3
+ import { P as PesquisaFetcher, b as buildGridMetadata, a as PESQUISA_VIEW_MODE } from './ISave-f1c9269b.js';
4
+ import './DataFetcher-0b9da57d.js';
5
5
  import './index-b40568ff.js';
6
6
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
7
7
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
- import './dataunit-fetcher-c4251d80.js';
8
+ import './dataunit-fetcher-4c312b43.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
- import './form-config-fetcher-d0536a71.js';
10
+ import './form-config-fetcher-7cda6254.js';
11
11
  import './constants-7b422de0.js';
12
12
  import './PrintUtils-3e4ff0f5.js';
13
13
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -3,18 +3,18 @@ import { StringUtils, ApplicationContext, ObjectUtils, Action, DataType, UserInt
3
3
  import { CSSVarsUtils, buildFieldSearch } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-7b422de0.js';
5
5
  import { T as TaskbarElement } from './taskbar-elements-faaf5d8f.js';
6
- import './DataFetcher-5780ad39.js';
7
- import './ISave-8a22ec18.js';
8
- import { S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils, c as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-42125ef4.js';
6
+ import './DataFetcher-0b9da57d.js';
7
+ import './ISave-f1c9269b.js';
8
+ import { S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils, c as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-2d1ea0c5.js';
9
9
  import { P as PresentationMode } from './index-b40568ff.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
- import { I as InMemoryLoader } from './dataunit-fetcher-c4251d80.js';
12
+ import { I as InMemoryLoader } from './dataunit-fetcher-4c312b43.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
- import { F as FormConfigFetcher } from './form-config-fetcher-d0536a71.js';
14
+ import { F as FormConfigFetcher } from './form-config-fetcher-7cda6254.js';
15
15
  import { T as TaskbarProcessor } from './taskbar-processor-3436124c.js';
16
- import { C as ConfigStorage } from './ConfigStorage-bd096633.js';
17
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-437e98bb.js';
16
+ import { C as ConfigStorage } from './ConfigStorage-39ac8fef.js';
17
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-a87566c8.js';
18
18
  import { s as store } from './index-446f9341.js';
19
19
  import './PrintUtils-3e4ff0f5.js';
20
20
  import './GetSelectedRecordsIDsInfo-9fa41508.js';
@@ -1 +1 @@
1
- import{r as t,c as s,h as i,H as e,F as a}from"./p-d8d8169b.js";import{I as o}from"./p-9ab6ae1e.js";import"./p-1b1373b6.js";import{P as r}from"./p-3c046287.js";import"@sankhyalabs/core";import"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-ff1990ad.js";import"./p-4db9dbf8.js";import"./p-9019a32f.js";import{ApplicationUtils as n}from"@sankhyalabs/ezui/dist/collection/utils";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-8d884fab.js";const h=class{constructor(i){t(this,i),this.pesquisaGridSelectItem=s(this,"pesquisaGridSelectItem",7),this._pesquisaFetcher=new r,this.metadata=void 0,this.dataSource=[],this.pkField=void 0,this.descriptionField=void 0,this.entityName=void 0,this.shouldLoadConfig=!1,this._gridConfig=void 0,this._inMemoryLoader=void 0,this._dataunit=void 0}observeDataSource(t){this._inMemoryLoader&&this._dataunit&&t&&(this._inMemoryLoader.records=[...t])}observeMetadata(){this.initializeDataUnit()}async observeShouldLoadConfig(t){t&&!this._gridConfig&&await this.loadGridConfig()}async loadGridConfig(){this._gridConfig=await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName)}initializeDataUnit(){var t;this.metadata&&!this._dataunit&&(this._inMemoryLoader=new o(this.metadata,null!==(t=this.dataSource)&&void 0!==t?t:[]),this._dataunit=this._inMemoryLoader.dataUnit,this._dataunit.pageSize=0)}handleDbClick(t){this.pesquisaGridSelectItem.emit({value:t[this.pkField],label:t[this.descriptionField]})}async handleConfigChanged({detail:t}){var s;const i=null!==(s=null==t?void 0:t.columns)&&void 0!==s?s:[];await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName,i)}render(){if(this.metadata&&this._dataunit)return i(e,null,i("ez-grid",{dataUnit:this._dataunit,config:this._gridConfig,mode:"simple",autoFocus:!1,onEzDoubleClick:({detail:t})=>this.handleDbClick(t),onConfigChange:async t=>this.handleConfigChanged(t)}))}static get watchers(){return{dataSource:["observeDataSource"],metadata:["observeMetadata"],shouldLoadConfig:["observeShouldLoadConfig"]}}};h.style=".sc-pesquisa-grid-h{background:var(--background--xlight, #FFF);overflow-x:auto}ez-grid.sc-pesquisa-grid{--ez-grid__container--shadow:none;--ez-grid__header--shadow:none}";const l=class{constructor(i){t(this,i),this.pesquisaTreeSelectItem=s(this,"pesquisaTreeSelectItem",7),this.treeLoader=void 0,this.argument=void 0,this.allowsNonAnalytic=!1,this.shouldLoadTree=!1,this.messagesBuilder=void 0,this.items=[]}async applyFilter(){await this._tree.applyFilter(this.argument)}async observeShouldLoadTree(t){!t||this.items.length>0||await this.loadTree()}async loadTree(){if(!this.shouldLoadTree)return;if(!this.treeLoader||"function"!=typeof this.treeLoader)return;const t=await this.treeLoader((this.argument||"").trim());this.items=[...t]}expandOrCloseAllItems(t,s){return t.map((t=>Object.assign(Object.assign({},t),{expanded:s,children:t.children?this.expandOrCloseAllItems(t.children,s):void 0})))}handleExpandAll(){this.items=[...this.expandOrCloseAllItems(this.items,!0)]}handleCloseAll(){this.items=[...this.expandOrCloseAllItems(this.items,!1)]}handleDbClick(t){var s;if(this.allowsNonAnalytic||(null===(s=t.props)||void 0===s?void 0:s.analitico))this.pesquisaTreeSelectItem.emit({value:t.id,label:t.label});else{const t=this.getMessage("snkPesquisa.tree.errorTitle"),s=this.getMessage("snkPesquisa.tree.nonAnalyticError");n.error(t,s)}}renderEmptyMessage(){return i("div",{class:"ez-flex ez-flex--justify-center ez-flex--align-items-center ez-margin--large ez-text ez-text--xlarge ez-text--secondary"},i("span",null,this.getMessage("snkPesquisa.tree.emptyMessage")))}getMessage(t,s){return this.messagesBuilder.getMessage(t,s)}render(){var t;return i(e,null,(null===(t=this.items)||void 0===t?void 0:t.length)?i(a,null,i("div",{class:"actions-container"},i("ez-button",{size:"small",mode:"icon",class:"ez-margin-right--small",iconName:"show-list",title:this.getMessage("snkPesquisa.tree.expandButton"),onClick:()=>this.handleExpandAll()}),i("ez-button",{size:"small",mode:"icon",iconName:"hide-list",title:this.getMessage("snkPesquisa.tree.collapseButton"),onClick:()=>this.handleCloseAll()})),i("ez-tree",{ref:t=>this._tree=t,onEzDbClickItem:({detail:t})=>this.handleDbClick(t),items:this.items})):this.renderEmptyMessage())}static get watchers(){return{shouldLoadTree:["observeShouldLoadTree"]}}};l.style=".sc-pesquisa-tree-h{--snk-pesquisa--tree__action-container--top:var(--space--sm);--snk-pesquisa--tree__action-container--right:var(--space--small);--snk-pesquisa--tree__min-height:var(--space--extra-large);background:var(--background--xlight, #FFF);position:relative;min-height:var(--snk-pesquisa--tree__min-height);height:100%;display:block;overflow-y:auto}.sc-pesquisa-tree-h:hover .actions-container.sc-pesquisa-tree{display:flex}.actions-container.sc-pesquisa-tree{flex-direction:row;position:absolute;top:var(--snk-pesquisa--tree__action-container--top);right:var(--snk-pesquisa--tree__action-container--right);display:none}";export{h as pesquisa_grid,l as pesquisa_tree}
1
+ import{r as t,c as s,h as i,H as e,F as a}from"./p-d8d8169b.js";import{I as o}from"./p-9e4555ab.js";import"./p-6768f176.js";import{P as r}from"./p-48a5c311.js";import"@sankhyalabs/core";import"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-ff1990ad.js";import"./p-7ee6b1bf.js";import"./p-9019a32f.js";import{ApplicationUtils as n}from"@sankhyalabs/ezui/dist/collection/utils";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-8d884fab.js";const h=class{constructor(i){t(this,i),this.pesquisaGridSelectItem=s(this,"pesquisaGridSelectItem",7),this._pesquisaFetcher=new r,this.metadata=void 0,this.dataSource=[],this.pkField=void 0,this.descriptionField=void 0,this.entityName=void 0,this.shouldLoadConfig=!1,this._gridConfig=void 0,this._inMemoryLoader=void 0,this._dataunit=void 0}observeDataSource(t){this._inMemoryLoader&&this._dataunit&&t&&(this._inMemoryLoader.records=[...t])}observeMetadata(){this.initializeDataUnit()}async observeShouldLoadConfig(t){t&&!this._gridConfig&&await this.loadGridConfig()}async loadGridConfig(){this._gridConfig=await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName)}initializeDataUnit(){var t;this.metadata&&!this._dataunit&&(this._inMemoryLoader=new o(this.metadata,null!==(t=this.dataSource)&&void 0!==t?t:[]),this._dataunit=this._inMemoryLoader.dataUnit,this._dataunit.pageSize=0)}handleDbClick(t){this.pesquisaGridSelectItem.emit({value:t[this.pkField],label:t[this.descriptionField]})}async handleConfigChanged({detail:t}){var s;const i=null!==(s=null==t?void 0:t.columns)&&void 0!==s?s:[];await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName,i)}render(){if(this.metadata&&this._dataunit)return i(e,null,i("ez-grid",{dataUnit:this._dataunit,config:this._gridConfig,mode:"simple",autoFocus:!1,onEzDoubleClick:({detail:t})=>this.handleDbClick(t),onConfigChange:async t=>this.handleConfigChanged(t)}))}static get watchers(){return{dataSource:["observeDataSource"],metadata:["observeMetadata"],shouldLoadConfig:["observeShouldLoadConfig"]}}};h.style=".sc-pesquisa-grid-h{background:var(--background--xlight, #FFF);overflow-x:auto}ez-grid.sc-pesquisa-grid{--ez-grid__container--shadow:none;--ez-grid__header--shadow:none}";const l=class{constructor(i){t(this,i),this.pesquisaTreeSelectItem=s(this,"pesquisaTreeSelectItem",7),this.treeLoader=void 0,this.argument=void 0,this.allowsNonAnalytic=!1,this.shouldLoadTree=!1,this.messagesBuilder=void 0,this.items=[]}async applyFilter(){await this._tree.applyFilter(this.argument)}async observeShouldLoadTree(t){!t||this.items.length>0||await this.loadTree()}async loadTree(){if(!this.shouldLoadTree)return;if(!this.treeLoader||"function"!=typeof this.treeLoader)return;const t=await this.treeLoader((this.argument||"").trim());this.items=[...t]}expandOrCloseAllItems(t,s){return t.map((t=>Object.assign(Object.assign({},t),{expanded:s,children:t.children?this.expandOrCloseAllItems(t.children,s):void 0})))}handleExpandAll(){this.items=[...this.expandOrCloseAllItems(this.items,!0)]}handleCloseAll(){this.items=[...this.expandOrCloseAllItems(this.items,!1)]}handleDbClick(t){var s;if(this.allowsNonAnalytic||(null===(s=t.props)||void 0===s?void 0:s.analitico))this.pesquisaTreeSelectItem.emit({value:t.id,label:t.label});else{const t=this.getMessage("snkPesquisa.tree.errorTitle"),s=this.getMessage("snkPesquisa.tree.nonAnalyticError");n.error(t,s)}}renderEmptyMessage(){return i("div",{class:"ez-flex ez-flex--justify-center ez-flex--align-items-center ez-margin--large ez-text ez-text--xlarge ez-text--secondary"},i("span",null,this.getMessage("snkPesquisa.tree.emptyMessage")))}getMessage(t,s){return this.messagesBuilder.getMessage(t,s)}render(){var t;return i(e,null,(null===(t=this.items)||void 0===t?void 0:t.length)?i(a,null,i("div",{class:"actions-container"},i("ez-button",{size:"small",mode:"icon",class:"ez-margin-right--small",iconName:"show-list",title:this.getMessage("snkPesquisa.tree.expandButton"),onClick:()=>this.handleExpandAll()}),i("ez-button",{size:"small",mode:"icon",iconName:"hide-list",title:this.getMessage("snkPesquisa.tree.collapseButton"),onClick:()=>this.handleCloseAll()})),i("ez-tree",{ref:t=>this._tree=t,onEzDbClickItem:({detail:t})=>this.handleDbClick(t),items:this.items})):this.renderEmptyMessage())}static get watchers(){return{shouldLoadTree:["observeShouldLoadTree"]}}};l.style=".sc-pesquisa-tree-h{--snk-pesquisa--tree__action-container--top:var(--space--sm);--snk-pesquisa--tree__action-container--right:var(--space--small);--snk-pesquisa--tree__min-height:var(--space--extra-large);background:var(--background--xlight, #FFF);position:relative;min-height:var(--snk-pesquisa--tree__min-height);height:100%;display:block;overflow-y:auto}.sc-pesquisa-tree-h:hover .actions-container.sc-pesquisa-tree{display:flex}.actions-container.sc-pesquisa-tree{flex-direction:row;position:absolute;top:var(--snk-pesquisa--tree__action-container--top);right:var(--snk-pesquisa--tree__action-container--right);display:none}";export{h as pesquisa_grid,l as pesquisa_tree}
@@ -1 +1 @@
1
- import{r as i,c as t,h as s,F as e,g as r}from"./p-d8d8169b.js";import{KeyboardManager as a,Action as n,ElementIDUtils as o,ApplicationContext as h,StringUtils as d}from"@sankhyalabs/core";import{SelectionMode as l}from"@sankhyalabs/core/dist/dataunit/DataUnit";import{buildFieldSearch as c}from"@sankhyalabs/ezui/dist/collection/utils";import"./p-1b1373b6.js";import"./p-3c046287.js";import{C as u,S as g,a as m,R as k,b as v,c as p}from"./p-d3534985.js";import{P as f,E as T}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9ab6ae1e.js";import"./p-ff1990ad.js";import"./p-4db9dbf8.js";import"./p-9019a32f.js";import{C as b}from"./p-0e4f8b86.js";import{s as C}from"./p-55798617.js";import{g as E}from"./p-7dd49d15.js";import{v as R}from"./p-76e66fd9.js";import{T as _}from"./p-b987e15d.js";import{T as O}from"./p-1a0caadb.js";import"./p-8d884fab.js";import"./p-8f3f2306.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class I extends u{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 E(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 S=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this.componentReady=t(this,"componentReady",7),this._customEditors=new Map,this._customRenders=new Map,this._keyboardManager=new a,this._topTaskbarProcessor=new O({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.singleTaskbar":[],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE",this.handleAddFormMode()],"snkGridTopTaskbar.finish_edition.secondary":[],"snkGridTopTaskbar.finish_edition.singleTaskbar":[]}),this._headerTaskbarProcessor=new O({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.selected":this.getGridHeaderSelectedBtns(),"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.handleAddFormMode()]}),this.dataUnitInterceptor={interceptAction:async i=>i.type===n.METADATA_LOADED?await this.interceptMetadataLoaded(i):i.type===n.LOADING_DATA?await this.interceptLoadData(i):i},this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this._showSnkFilterBar=!0,this._enableContinuousInsert=!1,this._filterMode="regular",this.columnFilterDataSource=new g,this.enableLockManagerLoadingComp=!1,this.enableLockManagerTaskbarClick=!1,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=f.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.gridHeaderDynamicSearchSlotId="GRID_HEADER_DYNAMIC_SEARCH",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,this.enableGridInsert=!1,this.outlineMode=!1,this.suppressHorizontalScroll=!1,this.strategyExporter=T.SERVER_SIDE,this.useSearchColumn=!0,this.multipleEditionEnabled=!0,this.paginationCounterMode="auto",this.suppressCheckboxColumn=void 0,this.suppressFilterColumn=!1,this.compact=void 0,this.filterCustomConfig=void 0,this.filterCustomConfigInterceptor=void 0}getGridHeaderSelectedBtns(){const i=[_.UPDATE,_.CLONE,_.REMOVE,_.MORE_OPTIONS,_.DIVIDER,_.ATTACH,_.FORM_MODE,_.CONFIGURATOR,_.REFRESH,_.DATA_EXPORTER,_.ACTIONS_BUTTON];return this.multipleEditionEnabled&&i.unshift(_.UPDATE_MULTIPLE),i}async refreshColumnFilterDataSource(){await this._grid.refreshColumnFilterDataSource()}reloadConfig(){this.loadConfig()}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 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 handleClick(i){var t;if(this.hasToBlockEvent(i)){if(i.preventDefault(),i.stopPropagation(),!await this._dataUnit.cancelEdition())return;const s=new i.constructor(i.type,i);null===(t=i.target)||void 0===t||t.dispatchEvent(s)}this._grid&&!this._grid.contains(i.target)&&this._grid.stopEdit()}hasToBlockEvent(i){var t;return(null===(t=this._snkFilterBar)||void 0===t?void 0:t.contains(i.target))&&this.enableGridInsert&&this._dataUnit.hasNewRecord()}async handleGridLegacyConfigName(i,t){i&&i!==t&&(this.addGridLegacyConfigName(),this.loadConfig())}handleAddFormMode(){return this.enableGridInsert?_.FORM_MODE:""}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i,m.assertDefaultSorting(this._gridConfig,this._dataUnit)}fixColumNameCharset(i){try{return decodeURIComponent(escape(i))}catch(t){return i}}normalizeGridConfig(i){if(!i)return i;const t=i.columns.map((i=>Object.assign(Object.assign({},i),{name:this.fixColumNameCharset(i.name)})));return Object.assign(Object.assign({},i),{columns:t})}loadConfig(){b.loadGridConfig(this.configName,this.resourceID).then((i=>{this.setGridConfig(this.normalizeGridConfig(i))})).catch((i=>{console.warn(i)}))}addGridLegacyConfigName(){this.gridLegacyConfigName&&this.configName&&b.addGridLegacyConfig(this.configName,this.gridLegacyConfigName)}hasCalculatedFields(i){let t=!1;return i.forEach((i=>{var s;"true"===(null===(s=this._dataUnit.getField(i).properties)||void 0===s?void 0:s.calculated)&&(t=!0)})),t}gridConfigChangeHandler(i){const t=this.normalizeGridConfig(i.detail);b.saveGridConfig(t,this.configName,this.resourceID),i.stopPropagation()}modalConfigChangeHandler(i){const t=this.normalizeGridConfig(i.detail);this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}async hasToForceClientSideExporter(){if(!this._grid)return!1;const i=(await this._grid.getAppliedColumnFilters()).map((i=>i.name.replace("FILTRO_COLUNA_","")));return this.hasCalculatedFields(i)}async dataExporterProviderStore(){const i=await this.hasToForceClientSideExporter()||this.strategyExporter===T.CLIENT_SIDE?new p(this._dataUnit,this._grid):new I(this._dataUnit,this._grid);C.set("exporterProviders",Object.assign(Object.assign({},C.get("exporterProviders")),{[this.configName]:i}))}addElementID(){o.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}async interceptLoadData(i){var t;if(R(null===(t=this._snkFilterBar)||void 0===t?void 0:t.filterConfig))return i;{const i=this.messagesBuilder.getMessage("snkGrid.requiredFiltersNotFilled.title",{}),t=this.messagesBuilder.getMessage("snkGrid.requiredFiltersNotFilled.message",{});await this._application.error(i,t)}}finishLoading(){this._dataUnit.addInterceptor(this.dataUnitInterceptor),m.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=h.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 k,this.addGridLegacyConfigName(),this.loadConfig(),this._continuousInsertUtils=new v(this._application,this.resourceID,this.configName),this.enableGridInsert&&this._continuousInsertUtils.getConfig().then((i=>this._enableContinuousInsert=i))}componentDidRender(){var i,t;this._rmPrecisionCustomValueFormatter.setGrid(this._grid),this.loadGridCustomFormatters(null===(t=null===(i=this._dataUnit)||void 0===i?void 0:i.metadata)||void 0===t?void 0:t.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(_.CLONE,_.ATTACH,_.UPDATE),this._dataState.selectionInfo.isAllRecords()&&t.push(_.REMOVE)),t}getInvisibleButtons(){var i,t;let s=[];return this._dataUnit&&0!==this._dataUnit.records.length||s.push(_.DATA_EXPORTER),(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo.mode)===l.ALL_RECORDS&&s.push(_.ACTIONS_BUTTON),1===(null===(t=this._dataState)||void 0===t?void 0:t.selectionInfo.length)&&s.push(_.UPDATE_MULTIPLE),s}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 r=s?`${e}.selected`:`${e}.unselected`;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)&&this.presentationMode===f.SINGLE_TASKBAR&&(r="snkGridHeaderTaskbar.singleTaskbar.finish_edition"),r}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){return null!=this._columnSearch||(this._columnSearch=c(i,(({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}))))}))}))),(i=>{null!=i&&this._grid.locateColumn(i.value)}))),this._columnSearch}getActionsList(){const i=[];if(this.enableGridInsert&&i.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert,(()=>{this._enableContinuousInsert=!this._enableContinuousInsert,this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert)}))),this.isGridInsertActive())return i;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)}getActionsSettingsList(){return[{value:d.generateUUID(),label:this.messagesBuilder.getMessage("snkGrid.findColumn",{}),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getColumnSearch(t)}]}handleFilterConfigUpdated(i){if(i.length)return 1===i.length&&"PERSONALIZED_FILTER_GROUP"===i[0].id?(this._showSnkFilterBar=!0,void(this._filterMode=i[0].groupedItems.length>0?"regular":"button")):void(this._showSnkFilterBar=!0);this._showSnkFilterBar=!1}getGridHeaderButtons(){return this.isGridInsertActive()?_.MORE_OPTIONS:this._headerTaskbarProcessor.buttons}isGridInsertActive(){return this.enableGridInsert&&this._dataUnit.hasNewRecord()}render(){if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large ez-box--no-outline",tabindex:"0"},s("div",{class:"snk-grid__header ez-margin-bottom--extra-small"},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,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,filterCustomConfig:this.filterCustomConfig,filterCustomConfigInterceptor:this.filterCustomConfigInterceptor,mode:this._filterMode}),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 ez-padding-top--extra-small","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",actionsSettingsList:this.getActionsSettingsList()},s("slot",{name:this.topTaskbarCustomSlotId}))),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===f.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)},onEzColumnFilterChanged:async()=>await this.dataExporterProviderStore(),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,enableGridInsert:this.enableGridInsert,enableContinuousInsert:this._enableContinuousInsert,enableLockManagerTaskbarClick:this.enableLockManagerTaskbarClick,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,outlineMode:this.outlineMode,useSearchColumn:this.useSearchColumn,suppressHorizontalScroll:this.suppressHorizontalScroll,paginationCounterMode:this.paginationCounterMode,suppressCheckboxColumn:this.suppressCheckboxColumn,suppressFilterColumn:this.suppressFilterColumn,compact:this.compact},s("snk-taskbar",{id:"teste",dataUnit:this._dataUnit,configName:this.configName,messagesBuilder:this.messagesBuilder,"data-element-id":"grid_left",buttons:this.getGridHeaderButtons(),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,additionalSlotId:this.gridHeaderDynamicSearchSlotId,actionsSettingsList:this.getActionsSettingsList()},s("slot",{name:this.gridHeaderCustomSlotId}),s("slot",{name:this.gridHeaderDynamicSearchSlotId}))),s("div",{class:"ez-col ez-col--sd-12 snk-grid-container__footer"},s("slot",{name:"SnkGridFooter"})),s("ez-popup",{size:"medium",heightMode:"auto",useHeader:!1,opened:this._popUpGridConfig,onEzClosePopup:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME),selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resourceID})))}get _element(){return r(this)}static get watchers(){return{gridLegacyConfigName:["handleGridLegacyConfigName"]}}};S.style=".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--small)}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%;padding:var(--snk-grid-padding);outline:none;--snk-grid-header--min-height:40px}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end;align-items:flex-start;min-height:var(--snk-grid-header--min-height)}.snk-grid__filter-bar.sc-snk-grid{width:100%;display:flex;align-items:flex-start}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium);margin-top:var(--space--small);align-self:stretch}.snk-grid__header.sc-snk-grid snk-taskbar.sc-snk-grid{display:flex;align-items:flex-start;min-height:var(--snk-grid-header--min-height)}.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}.snk-grid-container__footer.sc-snk-grid{background-color:var(--background--xlight, #FFF);border-radius:0 0 var(--border--radius-medium) var(--border--radius-medium);box-shadow:var(--shadow--small)}";export{S as snk_grid}
1
+ import{r as i,c as t,h as s,F as e,g as r}from"./p-d8d8169b.js";import{KeyboardManager as a,Action as n,ElementIDUtils as o,ApplicationContext as h,StringUtils as d}from"@sankhyalabs/core";import{SelectionMode as l}from"@sankhyalabs/core/dist/dataunit/DataUnit";import{buildFieldSearch as c}from"@sankhyalabs/ezui/dist/collection/utils";import"./p-6768f176.js";import"./p-48a5c311.js";import{C as u,S as g,a as m,R as k,b as v,c as p}from"./p-3f68a254.js";import{P as f,E as T}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9e4555ab.js";import"./p-ff1990ad.js";import"./p-7ee6b1bf.js";import"./p-9019a32f.js";import{C as b}from"./p-1f310bc6.js";import{s as C}from"./p-55798617.js";import{g as E}from"./p-7dd49d15.js";import{v as R}from"./p-76e66fd9.js";import{T as _}from"./p-b987e15d.js";import{T as O}from"./p-1a0caadb.js";import"./p-8d884fab.js";import"./p-8f3f2306.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class I extends u{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 E(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 S=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this.componentReady=t(this,"componentReady",7),this._customEditors=new Map,this._customRenders=new Map,this._keyboardManager=new a,this._topTaskbarProcessor=new O({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.singleTaskbar":[],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE",this.handleAddFormMode()],"snkGridTopTaskbar.finish_edition.secondary":[],"snkGridTopTaskbar.finish_edition.singleTaskbar":[]}),this._headerTaskbarProcessor=new O({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.selected":this.getGridHeaderSelectedBtns(),"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.handleAddFormMode()]}),this.dataUnitInterceptor={interceptAction:async i=>i.type===n.METADATA_LOADED?await this.interceptMetadataLoaded(i):i.type===n.LOADING_DATA?await this.interceptLoadData(i):i},this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this._showSnkFilterBar=!0,this._enableContinuousInsert=!1,this._filterMode="regular",this.columnFilterDataSource=new g,this.enableLockManagerLoadingComp=!1,this.enableLockManagerTaskbarClick=!1,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=f.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.gridHeaderDynamicSearchSlotId="GRID_HEADER_DYNAMIC_SEARCH",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,this.enableGridInsert=!1,this.outlineMode=!1,this.suppressHorizontalScroll=!1,this.strategyExporter=T.SERVER_SIDE,this.useSearchColumn=!0,this.multipleEditionEnabled=!0,this.paginationCounterMode="auto",this.suppressCheckboxColumn=void 0,this.suppressFilterColumn=!1,this.compact=void 0,this.filterCustomConfig=void 0,this.filterCustomConfigInterceptor=void 0}getGridHeaderSelectedBtns(){const i=[_.UPDATE,_.CLONE,_.REMOVE,_.MORE_OPTIONS,_.DIVIDER,_.ATTACH,_.FORM_MODE,_.CONFIGURATOR,_.REFRESH,_.DATA_EXPORTER,_.ACTIONS_BUTTON];return this.multipleEditionEnabled&&i.unshift(_.UPDATE_MULTIPLE),i}async refreshColumnFilterDataSource(){await this._grid.refreshColumnFilterDataSource()}reloadConfig(){this.loadConfig()}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 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 handleClick(i){var t;if(this.hasToBlockEvent(i)){if(i.preventDefault(),i.stopPropagation(),!await this._dataUnit.cancelEdition())return;const s=new i.constructor(i.type,i);null===(t=i.target)||void 0===t||t.dispatchEvent(s)}this._grid&&!this._grid.contains(i.target)&&this._grid.stopEdit()}hasToBlockEvent(i){var t;return(null===(t=this._snkFilterBar)||void 0===t?void 0:t.contains(i.target))&&this.enableGridInsert&&this._dataUnit.hasNewRecord()}async handleGridLegacyConfigName(i,t){i&&i!==t&&(this.addGridLegacyConfigName(),this.loadConfig())}handleAddFormMode(){return this.enableGridInsert?_.FORM_MODE:""}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i,m.assertDefaultSorting(this._gridConfig,this._dataUnit)}fixColumNameCharset(i){try{return decodeURIComponent(escape(i))}catch(t){return i}}normalizeGridConfig(i){if(!i)return i;const t=i.columns.map((i=>Object.assign(Object.assign({},i),{name:this.fixColumNameCharset(i.name)})));return Object.assign(Object.assign({},i),{columns:t})}loadConfig(){b.loadGridConfig(this.configName,this.resourceID).then((i=>{this.setGridConfig(this.normalizeGridConfig(i))})).catch((i=>{console.warn(i)}))}addGridLegacyConfigName(){this.gridLegacyConfigName&&this.configName&&b.addGridLegacyConfig(this.configName,this.gridLegacyConfigName)}hasCalculatedFields(i){let t=!1;return i.forEach((i=>{var s;"true"===(null===(s=this._dataUnit.getField(i).properties)||void 0===s?void 0:s.calculated)&&(t=!0)})),t}gridConfigChangeHandler(i){const t=this.normalizeGridConfig(i.detail);b.saveGridConfig(t,this.configName,this.resourceID),i.stopPropagation()}modalConfigChangeHandler(i){const t=this.normalizeGridConfig(i.detail);this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}async hasToForceClientSideExporter(){if(!this._grid)return!1;const i=(await this._grid.getAppliedColumnFilters()).map((i=>i.name.replace("FILTRO_COLUNA_","")));return this.hasCalculatedFields(i)}async dataExporterProviderStore(){const i=await this.hasToForceClientSideExporter()||this.strategyExporter===T.CLIENT_SIDE?new p(this._dataUnit,this._grid):new I(this._dataUnit,this._grid);C.set("exporterProviders",Object.assign(Object.assign({},C.get("exporterProviders")),{[this.configName]:i}))}addElementID(){o.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}async interceptLoadData(i){var t;if(R(null===(t=this._snkFilterBar)||void 0===t?void 0:t.filterConfig))return i;{const i=this.messagesBuilder.getMessage("snkGrid.requiredFiltersNotFilled.title",{}),t=this.messagesBuilder.getMessage("snkGrid.requiredFiltersNotFilled.message",{});await this._application.error(i,t)}}finishLoading(){this._dataUnit.addInterceptor(this.dataUnitInterceptor),m.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=h.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 k,this.addGridLegacyConfigName(),this.loadConfig(),this._continuousInsertUtils=new v(this._application,this.resourceID,this.configName),this.enableGridInsert&&this._continuousInsertUtils.getConfig().then((i=>this._enableContinuousInsert=i))}componentDidRender(){var i,t;this._rmPrecisionCustomValueFormatter.setGrid(this._grid),this.loadGridCustomFormatters(null===(t=null===(i=this._dataUnit)||void 0===i?void 0:i.metadata)||void 0===t?void 0:t.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(_.CLONE,_.ATTACH,_.UPDATE),this._dataState.selectionInfo.isAllRecords()&&t.push(_.REMOVE)),t}getInvisibleButtons(){var i,t;let s=[];return this._dataUnit&&0!==this._dataUnit.records.length||s.push(_.DATA_EXPORTER),(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo.mode)===l.ALL_RECORDS&&s.push(_.ACTIONS_BUTTON),1===(null===(t=this._dataState)||void 0===t?void 0:t.selectionInfo.length)&&s.push(_.UPDATE_MULTIPLE),s}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 r=s?`${e}.selected`:`${e}.unselected`;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)&&this.presentationMode===f.SINGLE_TASKBAR&&(r="snkGridHeaderTaskbar.singleTaskbar.finish_edition"),r}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){return null!=this._columnSearch||(this._columnSearch=c(i,(({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}))))}))}))),(i=>{null!=i&&this._grid.locateColumn(i.value)}))),this._columnSearch}getActionsList(){const i=[];if(this.enableGridInsert&&i.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert,(()=>{this._enableContinuousInsert=!this._enableContinuousInsert,this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert)}))),this.isGridInsertActive())return i;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)}getActionsSettingsList(){return[{value:d.generateUUID(),label:this.messagesBuilder.getMessage("snkGrid.findColumn",{}),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getColumnSearch(t)}]}handleFilterConfigUpdated(i){if(i.length)return 1===i.length&&"PERSONALIZED_FILTER_GROUP"===i[0].id?(this._showSnkFilterBar=!0,void(this._filterMode=i[0].groupedItems.length>0?"regular":"button")):void(this._showSnkFilterBar=!0);this._showSnkFilterBar=!1}getGridHeaderButtons(){return this.isGridInsertActive()?_.MORE_OPTIONS:this._headerTaskbarProcessor.buttons}isGridInsertActive(){return this.enableGridInsert&&this._dataUnit.hasNewRecord()}render(){if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large ez-box--no-outline",tabindex:"0"},s("div",{class:"snk-grid__header ez-margin-bottom--extra-small"},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,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,filterCustomConfig:this.filterCustomConfig,filterCustomConfigInterceptor:this.filterCustomConfigInterceptor,mode:this._filterMode}),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 ez-padding-top--extra-small","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",actionsSettingsList:this.getActionsSettingsList()},s("slot",{name:this.topTaskbarCustomSlotId}))),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===f.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)},onEzColumnFilterChanged:async()=>await this.dataExporterProviderStore(),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,enableGridInsert:this.enableGridInsert,enableContinuousInsert:this._enableContinuousInsert,enableLockManagerTaskbarClick:this.enableLockManagerTaskbarClick,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,outlineMode:this.outlineMode,useSearchColumn:this.useSearchColumn,suppressHorizontalScroll:this.suppressHorizontalScroll,paginationCounterMode:this.paginationCounterMode,suppressCheckboxColumn:this.suppressCheckboxColumn,suppressFilterColumn:this.suppressFilterColumn,compact:this.compact},s("snk-taskbar",{id:"teste",dataUnit:this._dataUnit,configName:this.configName,messagesBuilder:this.messagesBuilder,"data-element-id":"grid_left",buttons:this.getGridHeaderButtons(),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,additionalSlotId:this.gridHeaderDynamicSearchSlotId,actionsSettingsList:this.getActionsSettingsList()},s("slot",{name:this.gridHeaderCustomSlotId}),s("slot",{name:this.gridHeaderDynamicSearchSlotId}))),s("div",{class:"ez-col ez-col--sd-12 snk-grid-container__footer"},s("slot",{name:"SnkGridFooter"})),s("ez-popup",{size:"medium",heightMode:"auto",useHeader:!1,opened:this._popUpGridConfig,onEzClosePopup:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME),selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resourceID})))}get _element(){return r(this)}static get watchers(){return{gridLegacyConfigName:["handleGridLegacyConfigName"]}}};S.style=".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--small)}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%;padding:var(--snk-grid-padding);outline:none;--snk-grid-header--min-height:40px}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end;align-items:flex-start;min-height:var(--snk-grid-header--min-height)}.snk-grid__filter-bar.sc-snk-grid{width:100%;display:flex;align-items:flex-start}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium);margin-top:var(--space--small);align-self:stretch}.snk-grid__header.sc-snk-grid snk-taskbar.sc-snk-grid{display:flex;align-items:flex-start;min-height:var(--snk-grid-header--min-height)}.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}.snk-grid-container__footer.sc-snk-grid{background-color:var(--background--xlight, #FFF);border-radius:0 0 var(--border--radius-medium) var(--border--radius-medium);box-shadow:var(--shadow--small)}";export{S as snk_grid}
@@ -1,4 +1,4 @@
1
- import{R as e,F as t}from"./p-4db9dbf8.js";import{D as i,d as s}from"./p-1b1373b6.js";import{F as r}from"./p-ff1990ad.js";import{ObjectUtils as a}from"@sankhyalabs/core";var n;function l(e,t){if(null==e)return e;if(e instanceof Date)return e.toISOString();if("object"==typeof e){if(e instanceof Array)return e.map((e=>l(r.MULTI_LIST===t?function(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}(e,["label"]):e)));{const i=Object.assign({},e);return Object.keys(e).forEach((s=>{void 0!==e[s]?i[s]=l(e[s],t):delete i[s]})),i}}return e}class o{constructor(){this.DEFAULT_RESOURCE="_default",this.templateByQuery=new Map,this.buildTemplates()}resolveURI(e,t,i){let s="filter-assistent-config://"+e;return t&&(s+="."+t),i&&(s+=this.DEFAULT_RESOURCE),s}resolveLegacyConfigName(e,t){if(!e)return"";let i=`?legacyResourceID=${e}`;return t&&(i+=this.DEFAULT_RESOURCE),i}buildTemplates(){this.templateByQuery.set("fetchFilterFields",s.gql`
1
+ import{R as e,F as t}from"./p-7ee6b1bf.js";import{D as i,d as s}from"./p-6768f176.js";import{F as r}from"./p-ff1990ad.js";import{ObjectUtils as a}from"@sankhyalabs/core";var n;function l(e,t){if(null==e)return e;if(e instanceof Date)return e.toISOString();if("object"==typeof e){if(e instanceof Array)return e.map((e=>l(r.MULTI_LIST===t?function(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}(e,["label"]):e)));{const i=Object.assign({},e);return Object.keys(e).forEach((s=>{void 0!==e[s]?i[s]=l(e[s],t):delete i[s]})),i}}return e}class o{constructor(){this.DEFAULT_RESOURCE="_default",this.templateByQuery=new Map,this.buildTemplates()}resolveURI(e,t,i){let s="filter-assistent-config://"+e;return t&&(s+="."+t),i&&(s+=this.DEFAULT_RESOURCE),s}resolveLegacyConfigName(e,t){if(!e)return"";let i=`?legacyResourceID=${e}`;return t&&(i+=this.DEFAULT_RESOURCE),i}buildTemplates(){this.templateByQuery.set("fetchFilterFields",s.gql`
2
2
  query($name: String!) {
3
3
  $queryAlias$: fetchFilterFields(name: $name){
4
4
  currentLink {
@@ -1 +1 @@
1
- import{r as t,c as i,h as e,H as s,g as r}from"./p-d8d8169b.js";import{ElementIDUtils as o,ObjectUtils as a}from"@sankhyalabs/core";import{C as l}from"./p-0e4f8b86.js";import{E as n}from"./p-1a68fb59.js";import{F as h}from"./p-ff1990ad.js";import{F as d}from"./p-b568c1d4.js";import"./p-4db9dbf8.js";import"./p-1b1373b6.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const p=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.editPersonalizedFilter=i(this,"editPersonalizedFilter",7),this.addPersonalizedFilter=i(this,"addPersonalizedFilter",7),this.filterItem=void 0,this.configName=void 0,this.resourceID=void 0}getContentEditorConfig(){const t={presentationMode:n.MODAL};switch(this.filterItem.type){case h.BINARY_SELECT:return{tag:"snk-filter-binary-select",props:t};case h.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case h.PERIOD:return{tag:"snk-filter-period",props:t};case h.SEARCH:return{tag:"snk-filter-search"};case h.NUMBER:return{tag:"snk-filter-number",props:t};case h.PERSONALIZED:return this.buildSnkFilterPersonalizedProps();case h.CHECK_BOX_LIST:return{tag:"snk-filter-checkbox-list",props:t};case h.MULTI_LIST:return{tag:"snk-entity-list",props:{maxHeightList:"640px",rightListSlotBuilder:t=>this.buildRightSlot(t)}}}return{tag:"snk-filter-text"}}buildSnkFilterPersonalizedProps(){return{tag:"snk-personalized-filter-editor",props:{onEditFilter:t=>this.editPersonalizedFilter.emit(t.detail),onAddFilter:()=>this.addPersonalizedFilter.emit()}}}isVisible(t){return!!this.filterItem.visible||void 0!==t}updateFilterValue(t){var i,e;const s=void 0!==(null==t?void 0:t.value)?t.value:t;this.filterItem=Object.assign(Object.assign({},this.filterItem),null!=this.filterItem.groupedItems?{visible:s>0,value:s,groupedItems:t.items}:{value:this.filterItem.type===(h.SEARCH||h.CHECK_BOX_LIST)?t:s,visible:this.isVisible(s)}),this._editor&&(this._editor.config=this.filterItem),null===(e=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===e||e.call(i),this.filterChange.emit(this.filterItem)}handleDeleteFilter(t,i){i===h.PERSONALIZED&&l.removePersonalizedFilter(t,this.resourceID,this.configName)}componentDidLoad(){if(this._element){o.addIDInfo(this._element);const t=this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.filterItem.id}`}}buildRightSlot(t){return e("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,e,s;const r=null===(e=null===(i=this.filterItem)||void 0===i?void 0:i.value)||void 0===e?void 0:e.findIndex((({id:i})=>i===t.id)),o=a.copy(this.filterItem);null===(s=null==o?void 0:o.value)||void 0===s||s.splice(r,1),this.updateFilterValue(o.value)}canShowDetailModal(){const{CUSTOM_FILTER:t,OTHER_FILTERS:i}=d;return![t,i].includes(this.filterItem.filterType)&&this.filterItem.type!==h.BINARY_SELECT}render(){const{tag:t,props:i}=this.getContentEditorConfig();return e(s,null,e("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&e("label",{class:"ez-text ez-text--medium ez-text--primary ez-margin-bottom--extra-small",htmlFor:`filter-item-${this.filterItem.id}`},this.filterItem.detailModal),e(t,Object.assign({ref:t=>this._editor=t,id:`filter-item-${this.filterItem.id}`,config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},i))))}get _element(){return r(this)}};p.style=".grow{flex-grow:1}.gap{gap:4px}";export{p as snk_filter_modal_item}
1
+ import{r as t,c as i,h as e,H as s,g as r}from"./p-d8d8169b.js";import{ElementIDUtils as o,ObjectUtils as a}from"@sankhyalabs/core";import{C as l}from"./p-1f310bc6.js";import{E as n}from"./p-1a68fb59.js";import{F as h}from"./p-ff1990ad.js";import{F as d}from"./p-b568c1d4.js";import"./p-7ee6b1bf.js";import"./p-6768f176.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const p=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.editPersonalizedFilter=i(this,"editPersonalizedFilter",7),this.addPersonalizedFilter=i(this,"addPersonalizedFilter",7),this.filterItem=void 0,this.configName=void 0,this.resourceID=void 0}getContentEditorConfig(){const t={presentationMode:n.MODAL};switch(this.filterItem.type){case h.BINARY_SELECT:return{tag:"snk-filter-binary-select",props:t};case h.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case h.PERIOD:return{tag:"snk-filter-period",props:t};case h.SEARCH:return{tag:"snk-filter-search"};case h.NUMBER:return{tag:"snk-filter-number",props:t};case h.PERSONALIZED:return this.buildSnkFilterPersonalizedProps();case h.CHECK_BOX_LIST:return{tag:"snk-filter-checkbox-list",props:t};case h.MULTI_LIST:return{tag:"snk-entity-list",props:{maxHeightList:"640px",rightListSlotBuilder:t=>this.buildRightSlot(t)}}}return{tag:"snk-filter-text"}}buildSnkFilterPersonalizedProps(){return{tag:"snk-personalized-filter-editor",props:{onEditFilter:t=>this.editPersonalizedFilter.emit(t.detail),onAddFilter:()=>this.addPersonalizedFilter.emit()}}}isVisible(t){return!!this.filterItem.visible||void 0!==t}updateFilterValue(t){var i,e;const s=void 0!==(null==t?void 0:t.value)?t.value:t;this.filterItem=Object.assign(Object.assign({},this.filterItem),null!=this.filterItem.groupedItems?{visible:s>0,value:s,groupedItems:t.items}:{value:this.filterItem.type===(h.SEARCH||h.CHECK_BOX_LIST)?t:s,visible:this.isVisible(s)}),this._editor&&(this._editor.config=this.filterItem),null===(e=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===e||e.call(i),this.filterChange.emit(this.filterItem)}handleDeleteFilter(t,i){i===h.PERSONALIZED&&l.removePersonalizedFilter(t,this.resourceID,this.configName)}componentDidLoad(){if(this._element){o.addIDInfo(this._element);const t=this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.filterItem.id}`}}buildRightSlot(t){return e("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,e,s;const r=null===(e=null===(i=this.filterItem)||void 0===i?void 0:i.value)||void 0===e?void 0:e.findIndex((({id:i})=>i===t.id)),o=a.copy(this.filterItem);null===(s=null==o?void 0:o.value)||void 0===s||s.splice(r,1),this.updateFilterValue(o.value)}canShowDetailModal(){const{CUSTOM_FILTER:t,OTHER_FILTERS:i}=d;return![t,i].includes(this.filterItem.filterType)&&this.filterItem.type!==h.BINARY_SELECT}render(){const{tag:t,props:i}=this.getContentEditorConfig();return e(s,null,e("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&e("label",{class:"ez-text ez-text--medium ez-text--primary ez-margin-bottom--extra-small",htmlFor:`filter-item-${this.filterItem.id}`},this.filterItem.detailModal),e(t,Object.assign({ref:t=>this._editor=t,id:`filter-item-${this.filterItem.id}`,config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},i))))}get _element(){return r(this)}};p.style=".grow{flex-grow:1}.gap{gap:4px}";export{p as snk_filter_modal_item}