@sankhyalabs/sankhyablocks 8.16.0-dev.105 → 8.16.0-dev.106

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 (58) hide show
  1. package/dist/cjs/{ClientSideExporterProvider-8c219037.js → ClientSideExporterProvider-a2753c93.js} +3 -3
  2. package/dist/cjs/{dataunit-fetcher-4a5d491a.js → dataunit-fetcher-a723f0dc.js} +5 -2
  3. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
  4. package/dist/cjs/snk-actions-button_7.cjs.entry.js +1 -1
  5. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-attach.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  9. package/dist/cjs/{snk-data-unit-9a463a4f.js → snk-data-unit-ebfdb9ba.js} +1 -1
  10. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  13. package/dist/cjs/{snk-guides-viewer-c9e1e97b.js → snk-guides-viewer-fd39f437.js} +1 -1
  14. package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
  17. package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +2 -2
  18. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +5 -2
  19. package/dist/components/ContinuousInsertUtils.js +2 -2
  20. package/dist/components/dataunit-fetcher.js +5 -2
  21. package/dist/esm/{ClientSideExporterProvider-a37f890b.js → ClientSideExporterProvider-b3871edb.js} +3 -3
  22. package/dist/esm/{dataunit-fetcher-1d02ecfc.js → dataunit-fetcher-0e025732.js} +5 -2
  23. package/dist/esm/pesquisa-grid_2.entry.js +1 -1
  24. package/dist/esm/snk-actions-button_7.entry.js +1 -1
  25. package/dist/esm/snk-application.entry.js +1 -1
  26. package/dist/esm/snk-attach.entry.js +1 -1
  27. package/dist/esm/snk-crud.entry.js +1 -1
  28. package/dist/esm/snk-data-exporter.entry.js +2 -2
  29. package/dist/esm/{snk-data-unit-affee080.js → snk-data-unit-03654813.js} +1 -1
  30. package/dist/esm/snk-data-unit.entry.js +2 -2
  31. package/dist/esm/snk-detail-view.entry.js +2 -2
  32. package/dist/esm/snk-grid.entry.js +2 -2
  33. package/dist/esm/{snk-guides-viewer-3befd409.js → snk-guides-viewer-75e06feb.js} +1 -1
  34. package/dist/esm/snk-guides-viewer.entry.js +2 -2
  35. package/dist/esm/snk-pesquisa.entry.js +1 -1
  36. package/dist/esm/snk-simple-crud.entry.js +2 -2
  37. package/dist/sankhyablocks/{p-2101be8b.entry.js → p-1a51dfde.entry.js} +1 -1
  38. package/dist/sankhyablocks/{p-21a5acc4.entry.js → p-1c29409b.entry.js} +1 -1
  39. package/dist/sankhyablocks/{p-cbb4c043.entry.js → p-271c86d3.entry.js} +1 -1
  40. package/dist/sankhyablocks/{p-3f624cbe.js → p-41da5310.js} +1 -1
  41. package/dist/sankhyablocks/{p-624390bb.entry.js → p-4a93daef.entry.js} +1 -1
  42. package/dist/sankhyablocks/{p-cf685cef.entry.js → p-65be98c5.entry.js} +1 -1
  43. package/dist/sankhyablocks/{p-6541bb6d.entry.js → p-6a0c8ce0.entry.js} +1 -1
  44. package/dist/sankhyablocks/p-7993b2e3.js +60 -0
  45. package/dist/sankhyablocks/{p-a5e5574c.entry.js → p-7cd5c315.entry.js} +1 -1
  46. package/dist/sankhyablocks/p-885802c3.js +1 -0
  47. package/dist/sankhyablocks/{p-53e1de0a.entry.js → p-ab0caed6.entry.js} +1 -1
  48. package/dist/sankhyablocks/{p-ea55f2ab.entry.js → p-ad07f0c5.entry.js} +1 -1
  49. package/dist/sankhyablocks/{p-dcfc8b35.entry.js → p-cc8c3bca.entry.js} +1 -1
  50. package/dist/sankhyablocks/{p-3b190fb1.entry.js → p-d31a701e.entry.js} +1 -1
  51. package/dist/sankhyablocks/{p-00796b12.entry.js → p-dc6ad9a6.entry.js} +1 -1
  52. package/dist/sankhyablocks/{p-82177c24.js → p-f4d5bb7f.js} +1 -1
  53. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  54. package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +2 -1
  55. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -1
  56. package/package.json +1 -1
  57. package/dist/sankhyablocks/p-8fa828b5.js +0 -1
  58. package/dist/sankhyablocks/p-a8be1d67.js +0 -60
@@ -6,7 +6,7 @@ const core = require('@sankhyalabs/core');
6
6
  const index$1 = require('./index-e3e39724.js');
7
7
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
8
8
  const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
9
- const dataunitFetcher = require('./dataunit-fetcher-4a5d491a.js');
9
+ const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
10
10
  require('./filter-item-type.enum-a7ffdaa6.js');
11
11
  require('./form-config-fetcher-40d3f752.js');
12
12
  require('./constants-77c1b8bd.js');
@@ -125,11 +125,11 @@ class SnkMultiSelectionListDataSource {
125
125
  }
126
126
  return String(this._dataUnit.getFormattedValue(fieldName, value));
127
127
  }
128
- async getStaticOptions(fieldName) {
128
+ async getStaticOptions(fieldName, options) {
129
129
  if (fieldName == undefined) {
130
130
  return Promise.resolve(undefined);
131
131
  }
132
- return Promise.resolve(await dataunitFetcher.PreloadManager.getDistinct(this._dataUnit, fieldName));
132
+ return Promise.resolve(await dataunitFetcher.PreloadManager.getDistinct(this._dataUnit, fieldName, options === null || options === void 0 ? void 0 : options.onlyLabel));
133
133
  }
134
134
  fetchData(filterTerm, fieldName) {
135
135
  return new Promise(resolve => {
@@ -131,7 +131,7 @@ class PreloadManager {
131
131
  static getSortingFunction(dataUnit, sorting) {
132
132
  return SortingUtils__default['default'].getSortingFunction(dataUnit, sorting);
133
133
  }
134
- static async getDistinct(dataUnit, fieldName) {
134
+ static async getDistinct(dataUnit, fieldName, onlyLabel = false) {
135
135
  if (!PreloadManager.isCacheEnabled(dataUnit)) {
136
136
  return Promise.resolve(utils.ColumnFilterManager.compileDistinct(fieldName, dataUnit));
137
137
  }
@@ -150,7 +150,10 @@ class PreloadManager {
150
150
  if (fieldValue == undefined) {
151
151
  return { key: null, value: null };
152
152
  }
153
- const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
153
+ let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
154
+ if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
155
+ return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
156
+ }
154
157
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
155
158
  })
156
159
  .then(result => {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
- const dataunitFetcher = require('./dataunit-fetcher-4a5d491a.js');
6
+ const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
7
7
  require('./DataFetcher-1afdb18e.js');
8
8
  const ISave = require('./ISave-c76e2c51.js');
9
9
  require('@sankhyalabs/core');
@@ -10,7 +10,7 @@ require('./ISave-c76e2c51.js');
10
10
  require('./index-e3e39724.js');
11
11
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
12
12
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
13
- require('./dataunit-fetcher-4a5d491a.js');
13
+ require('./dataunit-fetcher-a723f0dc.js');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
15
15
  const formConfigFetcher = require('./form-config-fetcher-40d3f752.js');
16
16
  const constants = require('./constants-77c1b8bd.js');
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const ConfigStorage = require('./ConfigStorage-df09fb78.js');
9
9
  const DataFetcher = require('./DataFetcher-1afdb18e.js');
10
10
  const authFetcher = require('./auth-fetcher-1687ac0a.js');
11
- const dataunitFetcher = require('./dataunit-fetcher-4a5d491a.js');
11
+ const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
12
12
  const ISave = require('./ISave-c76e2c51.js');
13
13
  const SnkMessageBuilder = require('./SnkMessageBuilder-aecd7c18.js');
14
14
  const constants = require('./constants-77c1b8bd.js');
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
7
7
  const DataFetcher = require('./DataFetcher-1afdb18e.js');
8
8
  const ISave = require('./ISave-c76e2c51.js');
9
9
  require('./index-e3e39724.js');
10
- const dataunitFetcher = require('./dataunit-fetcher-4a5d491a.js');
10
+ const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
11
11
  require('./filter-item-type.enum-a7ffdaa6.js');
12
12
  require('./form-config-fetcher-40d3f752.js');
13
13
  const constants = require('./constants-77c1b8bd.js');
@@ -10,7 +10,7 @@ require('./ISave-c76e2c51.js');
10
10
  const index$1 = require('./index-e3e39724.js');
11
11
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
12
12
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
13
- require('./dataunit-fetcher-4a5d491a.js');
13
+ require('./dataunit-fetcher-a723f0dc.js');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
15
15
  require('./form-config-fetcher-40d3f752.js');
16
16
  const constants = require('./constants-77c1b8bd.js');
@@ -9,11 +9,11 @@ const IFetchDataExporterParams = require('./IFetchDataExporterParams-e78ec415.js
9
9
  const index = require('./index-e3e39724.js');
10
10
  const constants = require('./constants-77c1b8bd.js');
11
11
  const DataFetcher = require('./DataFetcher-1afdb18e.js');
12
- const snkDataUnit = require('./snk-data-unit-9a463a4f.js');
12
+ const snkDataUnit = require('./snk-data-unit-ebfdb9ba.js');
13
13
  require('./ISave-c76e2c51.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-4a5d491a.js');
16
+ require('./dataunit-fetcher-a723f0dc.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  require('./form-config-fetcher-40d3f752.js');
19
19
  require('./PrintUtils-bcaeb82f.js');
@@ -4,7 +4,7 @@ const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
5
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
6
6
  const SnkMessageBuilder = require('./SnkMessageBuilder-aecd7c18.js');
7
- const dataunitFetcher = require('./dataunit-fetcher-4a5d491a.js');
7
+ const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
8
8
  const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
9
9
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
10
10
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkDataUnit = require('./snk-data-unit-9a463a4f.js');
5
+ const snkDataUnit = require('./snk-data-unit-ebfdb9ba.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/ezui/dist/collection/utils');
9
9
  require('./SnkMessageBuilder-aecd7c18.js');
10
- require('./dataunit-fetcher-4a5d491a.js');
10
+ require('./dataunit-fetcher-a723f0dc.js');
11
11
  require('./DataFetcher-1afdb18e.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -11,12 +11,12 @@ require('./ISave-c76e2c51.js');
11
11
  const index$1 = require('./index-e3e39724.js');
12
12
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
- require('./dataunit-fetcher-4a5d491a.js');
14
+ require('./dataunit-fetcher-a723f0dc.js');
15
15
  require('./filter-item-type.enum-a7ffdaa6.js');
16
16
  require('./form-config-fetcher-40d3f752.js');
17
17
  const constants = require('./constants-77c1b8bd.js');
18
18
  const taskbarElements = require('./taskbar-elements-02379452.js');
19
- const snkGuidesViewer = require('./snk-guides-viewer-c9e1e97b.js');
19
+ const snkGuidesViewer = require('./snk-guides-viewer-fd39f437.js');
20
20
  const SnkMessageBuilder = require('./SnkMessageBuilder-aecd7c18.js');
21
21
  require('./ConfigStorage-df09fb78.js');
22
22
  require('./PrintUtils-bcaeb82f.js');
@@ -9,13 +9,13 @@ const ConfigStorage = require('./ConfigStorage-df09fb78.js');
9
9
  const index$1 = require('./index-e3e39724.js');
10
10
  const fieldSearch = require('./field-search-68e34bf4.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
- const ClientSideExporterProvider = require('./ClientSideExporterProvider-8c219037.js');
12
+ const ClientSideExporterProvider = require('./ClientSideExporterProvider-a2753c93.js');
13
13
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
14
14
  require('./DataFetcher-1afdb18e.js');
15
15
  require('./ISave-c76e2c51.js');
16
16
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
17
17
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
18
- require('./dataunit-fetcher-4a5d491a.js');
18
+ require('./dataunit-fetcher-a723f0dc.js');
19
19
  require('./filter-item-type.enum-a7ffdaa6.js');
20
20
  require('./form-config-fetcher-40d3f752.js');
21
21
  require('./constants-77c1b8bd.js');
@@ -12,7 +12,7 @@ require('./ISave-c76e2c51.js');
12
12
  const index$1 = require('./index-e3e39724.js');
13
13
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
- require('./dataunit-fetcher-4a5d491a.js');
15
+ require('./dataunit-fetcher-a723f0dc.js');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
17
  require('./form-config-fetcher-40d3f752.js');
18
18
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-c9e1e97b.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-fd39f437.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('./SnkFormConfigManager-45a8d7b7.js');
@@ -20,7 +20,7 @@ require('./index-e3e39724.js');
20
20
  require('./index-102ba62d.js');
21
21
  require('./ISave-c76e2c51.js');
22
22
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
23
- require('./dataunit-fetcher-4a5d491a.js');
23
+ require('./dataunit-fetcher-a723f0dc.js');
24
24
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
25
25
  require('@sankhyalabs/core/dist/utils/SortingUtils');
26
26
  require('./ResourceIDUtils-5ff86aa7.js');
@@ -9,7 +9,7 @@ require('./DataFetcher-1afdb18e.js');
9
9
  require('./index-e3e39724.js');
10
10
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
11
11
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
12
- require('./dataunit-fetcher-4a5d491a.js');
12
+ require('./dataunit-fetcher-a723f0dc.js');
13
13
  require('./filter-item-type.enum-a7ffdaa6.js');
14
14
  require('./form-config-fetcher-40d3f752.js');
15
15
  require('./constants-77c1b8bd.js');
@@ -9,11 +9,11 @@ const constants = require('./constants-77c1b8bd.js');
9
9
  const taskbarElements = require('./taskbar-elements-02379452.js');
10
10
  require('./DataFetcher-1afdb18e.js');
11
11
  require('./ISave-c76e2c51.js');
12
- const ClientSideExporterProvider = require('./ClientSideExporterProvider-8c219037.js');
12
+ const ClientSideExporterProvider = require('./ClientSideExporterProvider-a2753c93.js');
13
13
  const index$1 = require('./index-e3e39724.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- const dataunitFetcher = require('./dataunit-fetcher-4a5d491a.js');
16
+ const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  const formConfigFetcher = require('./form-config-fetcher-40d3f752.js');
19
19
  const fieldSearch = require('./field-search-68e34bf4.js');
@@ -15,11 +15,11 @@ export default class SnkMultiSelectionListDataSource {
15
15
  }
16
16
  return String(this._dataUnit.getFormattedValue(fieldName, value));
17
17
  }
18
- async getStaticOptions(fieldName) {
18
+ async getStaticOptions(fieldName, options) {
19
19
  if (fieldName == undefined) {
20
20
  return Promise.resolve(undefined);
21
21
  }
22
- return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName));
22
+ return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName, options === null || options === void 0 ? void 0 : options.onlyLabel));
23
23
  }
24
24
  fetchData(filterTerm, fieldName) {
25
25
  return new Promise(resolve => {
@@ -23,7 +23,7 @@ export default class PreloadManager {
23
23
  static getSortingFunction(dataUnit, sorting) {
24
24
  return SortingUtils.getSortingFunction(dataUnit, sorting);
25
25
  }
26
- static async getDistinct(dataUnit, fieldName) {
26
+ static async getDistinct(dataUnit, fieldName, onlyLabel = false) {
27
27
  if (!PreloadManager.isCacheEnabled(dataUnit)) {
28
28
  return Promise.resolve(ColumnFilterManager.compileDistinct(fieldName, dataUnit));
29
29
  }
@@ -42,7 +42,10 @@ export default class PreloadManager {
42
42
  if (fieldValue == undefined) {
43
43
  return { key: null, value: null };
44
44
  }
45
- const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
45
+ let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
46
+ if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
47
+ return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
48
+ }
46
49
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
47
50
  })
48
51
  .then(result => {
@@ -168,11 +168,11 @@ class SnkMultiSelectionListDataSource {
168
168
  }
169
169
  return String(this._dataUnit.getFormattedValue(fieldName, value));
170
170
  }
171
- async getStaticOptions(fieldName) {
171
+ async getStaticOptions(fieldName, options) {
172
172
  if (fieldName == undefined) {
173
173
  return Promise.resolve(undefined);
174
174
  }
175
- return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName));
175
+ return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName, options === null || options === void 0 ? void 0 : options.onlyLabel));
176
176
  }
177
177
  fetchData(filterTerm, fieldName) {
178
178
  return new Promise(resolve => {
@@ -153,7 +153,7 @@ class PreloadManager {
153
153
  static getSortingFunction(dataUnit, sorting) {
154
154
  return SortingUtils.getSortingFunction(dataUnit, sorting);
155
155
  }
156
- static async getDistinct(dataUnit, fieldName) {
156
+ static async getDistinct(dataUnit, fieldName, onlyLabel = false) {
157
157
  if (!PreloadManager.isCacheEnabled(dataUnit)) {
158
158
  return Promise.resolve(ColumnFilterManager.compileDistinct(fieldName, dataUnit));
159
159
  }
@@ -172,7 +172,10 @@ class PreloadManager {
172
172
  if (fieldValue == undefined) {
173
173
  return { key: null, value: null };
174
174
  }
175
- const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
175
+ let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
176
+ if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
177
+ return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
178
+ }
176
179
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
177
180
  })
178
181
  .then(result => {
@@ -4,7 +4,7 @@ import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, St
4
4
  import { D as DataExporterOption } from './index-b40568ff.js';
5
5
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
6
6
  import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
7
- import { P as PreloadManager } from './dataunit-fetcher-1d02ecfc.js';
7
+ import { P as PreloadManager } from './dataunit-fetcher-0e025732.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
9
  import './form-config-fetcher-fa208a6c.js';
10
10
  import './constants-7db1128a.js';
@@ -119,11 +119,11 @@ class SnkMultiSelectionListDataSource {
119
119
  }
120
120
  return String(this._dataUnit.getFormattedValue(fieldName, value));
121
121
  }
122
- async getStaticOptions(fieldName) {
122
+ async getStaticOptions(fieldName, options) {
123
123
  if (fieldName == undefined) {
124
124
  return Promise.resolve(undefined);
125
125
  }
126
- return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName));
126
+ return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName, options === null || options === void 0 ? void 0 : options.onlyLabel));
127
127
  }
128
128
  fetchData(filterTerm, fieldName) {
129
129
  return new Promise(resolve => {
@@ -125,7 +125,7 @@ class PreloadManager {
125
125
  static getSortingFunction(dataUnit, sorting) {
126
126
  return SortingUtils.getSortingFunction(dataUnit, sorting);
127
127
  }
128
- static async getDistinct(dataUnit, fieldName) {
128
+ static async getDistinct(dataUnit, fieldName, onlyLabel = false) {
129
129
  if (!PreloadManager.isCacheEnabled(dataUnit)) {
130
130
  return Promise.resolve(ColumnFilterManager.compileDistinct(fieldName, dataUnit));
131
131
  }
@@ -144,7 +144,10 @@ class PreloadManager {
144
144
  if (fieldValue == undefined) {
145
145
  return { key: null, value: null };
146
146
  }
147
- const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
147
+ let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
148
+ if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
149
+ return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
150
+ }
148
151
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
149
152
  })
150
153
  .then(result => {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment } from './index-a7d3d3f1.js';
2
- import { I as InMemoryLoader } from './dataunit-fetcher-1d02ecfc.js';
2
+ import { I as InMemoryLoader } from './dataunit-fetcher-0e025732.js';
3
3
  import './DataFetcher-88e56266.js';
4
4
  import { P as PesquisaFetcher } from './ISave-5efafc97.js';
5
5
  import '@sankhyalabs/core';
@@ -6,7 +6,7 @@ import './ISave-5efafc97.js';
6
6
  import './index-b40568ff.js';
7
7
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
8
8
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
9
- import './dataunit-fetcher-1d02ecfc.js';
9
+ import './dataunit-fetcher-0e025732.js';
10
10
  import './filter-item-type.enum-d45e026f.js';
11
11
  import { F as FormConfigFetcher } from './form-config-fetcher-fa208a6c.js';
12
12
  import { O as ORDER_VALUES } from './constants-7db1128a.js';
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { C as ConfigStorage } from './ConfigStorage-71e6766f.js';
5
5
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-88e56266.js';
6
6
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-3510520e.js';
7
- import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-1d02ecfc.js';
7
+ import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-0e025732.js';
8
8
  import { P as PesquisaFetcher } from './ISave-5efafc97.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-12f5fe1a.js';
10
10
  import { T as TEMPLATES_SKELETON } from './constants-7db1128a.js';
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataU
3
3
  import { D as DataFetcher } from './DataFetcher-88e56266.js';
4
4
  import { S as SaveErrorsEnum } from './ISave-5efafc97.js';
5
5
  import './index-b40568ff.js';
6
- import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-1d02ecfc.js';
6
+ import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-0e025732.js';
7
7
  import './filter-item-type.enum-d45e026f.js';
8
8
  import './form-config-fetcher-fa208a6c.js';
9
9
  import { V as VIEW_MODE } from './constants-7db1128a.js';
@@ -6,7 +6,7 @@ import './ISave-5efafc97.js';
6
6
  import { P as PresentationMode, E as ExporterStrategy } from './index-b40568ff.js';
7
7
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
8
8
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
9
- import './dataunit-fetcher-1d02ecfc.js';
9
+ import './dataunit-fetcher-0e025732.js';
10
10
  import './filter-item-type.enum-d45e026f.js';
11
11
  import './form-config-fetcher-fa208a6c.js';
12
12
  import { V as VIEW_MODE } from './constants-7db1128a.js';
@@ -5,11 +5,11 @@ 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-7db1128a.js';
7
7
  import { D as DataFetcher } from './DataFetcher-88e56266.js';
8
- import { S as SnkDataUnit } from './snk-data-unit-affee080.js';
8
+ import { S as SnkDataUnit } from './snk-data-unit-03654813.js';
9
9
  import './ISave-5efafc97.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
- import './dataunit-fetcher-1d02ecfc.js';
12
+ import './dataunit-fetcher-0e025732.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
14
  import './form-config-fetcher-fa208a6c.js';
15
15
  import './PrintUtils-3e4ff0f5.js';
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, g as getElement, H as Host
2
2
  import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-12f5fe1a.js';
5
- import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-1d02ecfc.js';
5
+ import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-0e025732.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,9 +1,9 @@
1
- export { S as snk_data_unit } from './snk-data-unit-affee080.js';
1
+ export { S as snk_data_unit } from './snk-data-unit-03654813.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import './SnkMessageBuilder-12f5fe1a.js';
6
- import './dataunit-fetcher-1d02ecfc.js';
6
+ import './dataunit-fetcher-0e025732.js';
7
7
  import './DataFetcher-88e56266.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -7,12 +7,12 @@ import './ISave-5efafc97.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-1d02ecfc.js';
10
+ import './dataunit-fetcher-0e025732.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
12
  import './form-config-fetcher-fa208a6c.js';
13
13
  import { V as VIEW_MODE } from './constants-7db1128a.js';
14
14
  import { T as TaskbarElement } from './taskbar-elements-c62b6c66.js';
15
- import { S as SnkGuidesViewer } from './snk-guides-viewer-3befd409.js';
15
+ import { S as SnkGuidesViewer } from './snk-guides-viewer-75e06feb.js';
16
16
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-12f5fe1a.js';
17
17
  import './ConfigStorage-71e6766f.js';
18
18
  import './PrintUtils-3e4ff0f5.js';
@@ -5,13 +5,13 @@ import { C as ConfigStorage } from './ConfigStorage-71e6766f.js';
5
5
  import { P as PresentationMode, E as ExporterStrategy } from './index-b40568ff.js';
6
6
  import { T as TaskbarProcessor, o as openFieldSearch, b as buildFieldSearch } from './field-search-f8b1d91e.js';
7
7
  import { s as store } from './index-bdf75557.js';
8
- import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, c as ClientSideExporterProvider } from './ClientSideExporterProvider-a37f890b.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, c as ClientSideExporterProvider } from './ClientSideExporterProvider-b3871edb.js';
9
9
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
10
10
  import './DataFetcher-88e56266.js';
11
11
  import './ISave-5efafc97.js';
12
12
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
13
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
14
- import './dataunit-fetcher-1d02ecfc.js';
14
+ import './dataunit-fetcher-0e025732.js';
15
15
  import './filter-item-type.enum-d45e026f.js';
16
16
  import './form-config-fetcher-fa208a6c.js';
17
17
  import './constants-7db1128a.js';
@@ -10,7 +10,7 @@ import './ISave-5efafc97.js';
10
10
  import { P as PresentationMode } from './index-b40568ff.js';
11
11
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
12
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
- import './dataunit-fetcher-1d02ecfc.js';
13
+ import './dataunit-fetcher-0e025732.js';
14
14
  import './filter-item-type.enum-d45e026f.js';
15
15
  import './form-config-fetcher-fa208a6c.js';
16
16
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
@@ -1,4 +1,4 @@
1
- export { S as snk_guides_viewer } from './snk-guides-viewer-3befd409.js';
1
+ export { S as snk_guides_viewer } from './snk-guides-viewer-75e06feb.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
4
  import './SnkFormConfigManager-be490a33.js';
@@ -16,7 +16,7 @@ import './index-b40568ff.js';
16
16
  import './index-bdf75557.js';
17
17
  import './ISave-5efafc97.js';
18
18
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
19
- import './dataunit-fetcher-1d02ecfc.js';
19
+ import './dataunit-fetcher-0e025732.js';
20
20
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
21
21
  import '@sankhyalabs/core/dist/utils/SortingUtils';
22
22
  import './ResourceIDUtils-a114189a.js';
@@ -5,7 +5,7 @@ import './DataFetcher-88e56266.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-1d02ecfc.js';
8
+ import './dataunit-fetcher-0e025732.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
10
  import './form-config-fetcher-fa208a6c.js';
11
11
  import './constants-7db1128a.js';
@@ -5,11 +5,11 @@ import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-7db1128a.js';
5
5
  import { T as TaskbarElement } from './taskbar-elements-c62b6c66.js';
6
6
  import './DataFetcher-88e56266.js';
7
7
  import './ISave-5efafc97.js';
8
- import { S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils, c as ClientSideExporterProvider } from './ClientSideExporterProvider-a37f890b.js';
8
+ import { S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils, c as ClientSideExporterProvider } from './ClientSideExporterProvider-b3871edb.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-1d02ecfc.js';
12
+ import { I as InMemoryLoader } from './dataunit-fetcher-0e025732.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
14
  import { F as FormConfigFetcher } from './form-config-fetcher-fa208a6c.js';
15
15
  import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-f8b1d91e.js';
@@ -1 +1 @@
1
- import{r as t,c as i,f as s,h as e,H as a}from"./p-d2d301a6.js";import{Action as o}from"@sankhyalabs/core";import{S as h}from"./p-ebdb9d89.js";import{FormMetadata as n,buildFormMetadata as r}from"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-fbba7e3d.js";import"./p-6dd38d7b.js";import{P as d}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-a8be1d67.js";import"./p-ff1990ad.js";import"./p-601b252b.js";import{V as l}from"./p-9261d8a0.js";import{T as c}from"./p-fb0f0087.js";import{S as u}from"./p-3f624cbe.js";import{S as m}from"./p-80f8c22c.js";import"./p-03b68a74.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-6dc031de.js";import"./p-23736d75.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";class v{constructor(t,i,s){this._parentGuide=t,this._formMetadata=i,this._dataUnit=s}get id(){return this._parentGuide.id}buildGuideItem(t){const i=Object.assign({},this._parentGuide);delete i.expanded,delete i.children;const s=this._dataUnit.getSelectedRecord();if(!s)return i;const e=this._dataUnit.isNewRecord(s.__record__id__),a=Array.from(this._formMetadata.getAllSheets().values()).map((i=>{const{name:s,label:a}=i,o=null!=n.getDetailName(s.split("::").pop()),h=o&&e,r=this._parentGuide.id,d=o?`${r}::${s}`:`${r}__FORM:${s}`;return o&&t.has(d)&&!h?t.get(d).buildGuideItem(t):{id:d,label:a,disabled:h,tooltip:h?"Finalize o cadastro para ter acesso a esta guia.":void 0}})),o=a.shift();return o.label=e?"Novo Registro":s.__record__label__,o.children=a,i.children=[o],i}}const p=class{constructor(s){t(this,s),this.snkDetailGuidesChange=i(this,"snkDetailGuidesChange",7),this.snkSwitchGuide=i(this,"snkSwitchGuide",7),this.formItemsReady=i(this,"formItemsReady",7),this._disabledButtons=void 0,this._currentView=void 0,this.attachmentRegisterKey=void 0,this.formConfigManager=void 0,this.dataUnitName=void 0,this.resourceID=void 0,this.guideItemPath=void 0,this.entityName=void 0,this.label=void 0,this.dataUnit=void 0,this.selectedForm=void 0,this.dataState=void 0,this.messagesBuilder=void 0,this.branchGuide=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.customEditors=void 0,this.customRenders=void 0,this.presentationMode=d.SECONDARY}observeDataUnit(t,i){null==t||t.subscribe(this.dataUnitActionHandler.bind(this)),null==i||i.unsubscribe(this.dataUnitActionHandler)}observerDataState(t,i){const s=!(null==i?void 0:i.insertionMode)&&(null==t?void 0:t.insertionMode),e=(null==i?void 0:i.insertionMode)&&!(null==t?void 0:t.insertionMode);if((s||e)&&this.loadMetadata(),null==this._formMetadata)return;const a=null==t?void 0:t.selectedRecord,o=null==i?void 0:i.selectedRecord;(null==a?void 0:a.__record__id__)!==(null==o?void 0:o.__record__id__)&&this.snkDetailGuidesChange.emit(new v(this.branchGuide,this._formMetadata,this.dataUnit)),s&&setTimeout((()=>{this.changeViewMode(l.FORM)}),0),e&&this.changeViewMode(l.GRID);const h=[];this.dataState.hasPrevious||h.push(c.PREVIOUS),this.dataState.hasNext||h.push(c.NEXT),this.dataState.insertionMode&&h.push(c.INSERT),this._disabledButtons=h}async changeViewMode(t){this.emitSwitchEvent(t)}async configGrid(){this._snkGrid&&this._snkGrid.showConfig()}async showUp(){this._snkFormView&&this._snkFormView.showUp(),this._snkGrid&&this._snkGrid.scrollIntoView({behavior:"smooth",block:"start"})}async addCustomEditor(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);this._snkGrid.addCustomEditor(t,i,e),this._snkFormView.addCustomEditor(t,i,e)}async observerPropsCustomEditor(t){for(const i in t)await this.addCustomEditor(i,t[i])}async addGridCustomRender(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);await this._snkGrid.addGridCustomRender(t,i,e)}onContentCardChanged(t){u.updateContentCard(t.detail.formName,t.detail.cardConfig,t.detail.propertyChanged,this.formConfigManager).then((()=>s(this))),t.stopPropagation()}async observeCustomRenders(t){for(const i in t){const s=t[i];await this.addGridCustomRender(i,s)}}updateLabel(){const t=this.guideItemPath?this.guideItemPath.length:0;if(t>0){const i=t>0?this.guideItemPath.map((t=>t.label)):void 0;this.label=i.pop(),this._levelPath=i.length>0?i.join(" / "):void 0}else this.label="",this._levelPath=void 0}getFormGuideId(t){var i;if(!t){if(null==(null===(i=this.dataState)||void 0===i?void 0:i.selectedRecord))return;const s=Array.from(this._formMetadata.getAllSheets().keys());if(!s||0==s.length)return;t=s[0]}return`${this.stripFormPattern(this.branchGuide.id)}__FORM:${t}`}stripFormPattern(t){return t.replace(p.REGEX_FORM_ID,"")}loadMetadata(){if(!this.dataUnit)return;if(!this.formConfigManager.isLoaded)return;const t=this.formConfigManager.getConfig(this.dataUnit);this._formMetadata=r(null==t||0===t.fields.length?void 0:t,this.dataUnit,!0)}dataUnitReadyHandler(t){this.dataUnit=t.detail,this.loadMetadata()}updateViewStack(t){var i,s;this._viewStack=t,this._currentView=this.selectedForm?1:0,null===(s=null===(i=this._viewStack)||void 0===i?void 0:i.show)||void 0===s||s.call(i,this._currentView)}getFormFields(){return this.selectedForm&&this._formMetadata?this._formMetadata.getSheet(this.selectedForm).fields:[]}emitSwitchEvent(t){const i=t===l.GRID?this.stripFormPattern(this.branchGuide.id):this.getFormGuideId();i&&this.snkSwitchGuide.emit(i)}handleAttachBack(){this._viewStack.show(l.GRID)}executeActionHandler(t){t.detail===c.GRID_MODE&&(this.emitSwitchEvent(l.GRID),t.stopPropagation()),t.detail!==c.FORM_MODE&&t.detail!==c.UPDATE||(this.emitSwitchEvent(l.FORM),t.stopPropagation()),t.detail===c.ATTACH&&(this._viewStack.show(l.ATTACHMENT),t.stopPropagation())}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}async handleDataStateChange({detail:t}){this.dataState=t,void 0!==t.selectedRecord&&this._snkDataUnit&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}componentWillLoad(){this._configName=`dynaform.${this.entityName}`,this.formConfigManager=new h(this._configName,this.resourceID,(()=>this.loadMetadata()),this.dataUnit),this.formConfigManager.loadConfig(),null==this.messagesBuilder&&(this.messagesBuilder=new m(this.entityName))}async componentDidLoad(){await this.observerPropsCustomEditor(this.customEditors),await this.observeCustomRenders(this.customRenders)}async dataUnitActionHandler(t){t.type===o.FIELD_INVALIDATED&&this.addErrorBadgeToBranchGuide()}addErrorBadgeToBranchGuide(){this.branchGuide=Object.assign(Object.assign({},this.branchGuide),{badge:"error"}),this.snkDetailGuidesChange.emit(new v(this.branchGuide,this._formMetadata,this.dataUnit))}normalizeBranchGuideId(t){return null==t?void 0:t.replace(/child\[(.*?)\]/g,"$1").replace(/::/g,">")}render(){return this.updateLabel(),e(a,null,e("snk-data-unit",{ref:t=>this._snkDataUnit=t,dataUnitName:`${this.dataUnitName}`,onDataUnitReady:t=>this.dataUnitReadyHandler(t),entityName:this.entityName,onDataStateChange:this.handleDataStateChange.bind(this),ignoreSaveMessage:this._currentView===l.GRID,messagesBuilder:this.messagesBuilder,configName:this._configName},e("ez-view-stack",{ref:t=>this.updateViewStack(t)},e("stack-item",null,e("div",{class:"ez-box ez-box--shadow grid-container"},e("div",{class:"ez-title--primary ez-size-width--full ez-padding--large detail-header"},e("div",{class:"ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center"},this._levelPath?e("span",{class:"level-path"},this._levelPath+" /"):void 0,this.label)),e("snk-grid",{class:"ez-size-width--full",ref:t=>this._snkGrid=t,configName:this._configName,messagesBuilder:this.messagesBuilder,onGridDoubleClick:()=>this.emitSwitchEvent(l.FORM),onActionClick:t=>this.executeActionHandler(t),presentationMode:this.presentationMode,canEdit:this.canEdit,isDetail:!0,taskbarCustomContainerId:this.taskbarCustomContainerId,gridHeaderCustomSlotId:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS",topTaskbarCustomSlotId:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS",outlineMode:!1}))),e("stack-item",null,e("snk-form-view",{ref:t=>this._snkFormView=t,canExpand:!1,canFix:!1,name:this.selectedForm,formMetadata:this._formMetadata,dataUnit:this.dataUnit,fields:this.getFormFields(),label:this.label,levelPath:this._levelPath,onFormItemsReady:({detail:t})=>this.formItemsReady.emit(t)},e("snk-taskbar",{key:"guideViewerTaskbar",class:"form-taskbar","data-element-id":"guideViewer",configName:this._configName,messagesBuilder:this.messagesBuilder,disabledButtons:this._disabledButtons,buttons:"INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR",primaryButton:"INSERT",presentationMode:this.presentationMode,onActionClick:t=>this.executeActionHandler(t),dataUnit:this.dataUnit,resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"},e("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))),e("stack-item",null,e("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this.entityName,onBack:this.handleAttachBack.bind(this)})))))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observerDataState"],customEditors:["observerPropsCustomEditor"],customRenders:["observeCustomRenders"]}}};p.REGEX_FORM_ID=/__FORM:[^:]+/g,p.style=".sc-snk-detail-view-h{display:flex;row-gap:24px;flex-direction:column;width:100%;height:100%}.level-path.sc-snk-detail-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.form-taskbar.sc-snk-detail-view{padding-bottom:var(--space--medium)}.grid-container.sc-snk-detail-view{background-color:#FFF;min-height:100px;height:100%}.detail-header.sc-snk-detail-view{padding-bottom:0}snk-data-unit.sc-snk-detail-view{flex:1}snk-grid.sc-snk-detail-view{height:calc(100% - 43px)}";export{p as snk_detail_view}
1
+ import{r as t,c as i,f as s,h as e,H as a}from"./p-d2d301a6.js";import{Action as o}from"@sankhyalabs/core";import{S as h}from"./p-ebdb9d89.js";import{FormMetadata as n,buildFormMetadata as r}from"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-fbba7e3d.js";import"./p-6dd38d7b.js";import{P as d}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-7993b2e3.js";import"./p-ff1990ad.js";import"./p-601b252b.js";import{V as l}from"./p-9261d8a0.js";import{T as c}from"./p-fb0f0087.js";import{S as u}from"./p-41da5310.js";import{S as m}from"./p-80f8c22c.js";import"./p-03b68a74.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-6dc031de.js";import"./p-23736d75.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";class v{constructor(t,i,s){this._parentGuide=t,this._formMetadata=i,this._dataUnit=s}get id(){return this._parentGuide.id}buildGuideItem(t){const i=Object.assign({},this._parentGuide);delete i.expanded,delete i.children;const s=this._dataUnit.getSelectedRecord();if(!s)return i;const e=this._dataUnit.isNewRecord(s.__record__id__),a=Array.from(this._formMetadata.getAllSheets().values()).map((i=>{const{name:s,label:a}=i,o=null!=n.getDetailName(s.split("::").pop()),h=o&&e,r=this._parentGuide.id,d=o?`${r}::${s}`:`${r}__FORM:${s}`;return o&&t.has(d)&&!h?t.get(d).buildGuideItem(t):{id:d,label:a,disabled:h,tooltip:h?"Finalize o cadastro para ter acesso a esta guia.":void 0}})),o=a.shift();return o.label=e?"Novo Registro":s.__record__label__,o.children=a,i.children=[o],i}}const p=class{constructor(s){t(this,s),this.snkDetailGuidesChange=i(this,"snkDetailGuidesChange",7),this.snkSwitchGuide=i(this,"snkSwitchGuide",7),this.formItemsReady=i(this,"formItemsReady",7),this._disabledButtons=void 0,this._currentView=void 0,this.attachmentRegisterKey=void 0,this.formConfigManager=void 0,this.dataUnitName=void 0,this.resourceID=void 0,this.guideItemPath=void 0,this.entityName=void 0,this.label=void 0,this.dataUnit=void 0,this.selectedForm=void 0,this.dataState=void 0,this.messagesBuilder=void 0,this.branchGuide=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.customEditors=void 0,this.customRenders=void 0,this.presentationMode=d.SECONDARY}observeDataUnit(t,i){null==t||t.subscribe(this.dataUnitActionHandler.bind(this)),null==i||i.unsubscribe(this.dataUnitActionHandler)}observerDataState(t,i){const s=!(null==i?void 0:i.insertionMode)&&(null==t?void 0:t.insertionMode),e=(null==i?void 0:i.insertionMode)&&!(null==t?void 0:t.insertionMode);if((s||e)&&this.loadMetadata(),null==this._formMetadata)return;const a=null==t?void 0:t.selectedRecord,o=null==i?void 0:i.selectedRecord;(null==a?void 0:a.__record__id__)!==(null==o?void 0:o.__record__id__)&&this.snkDetailGuidesChange.emit(new v(this.branchGuide,this._formMetadata,this.dataUnit)),s&&setTimeout((()=>{this.changeViewMode(l.FORM)}),0),e&&this.changeViewMode(l.GRID);const h=[];this.dataState.hasPrevious||h.push(c.PREVIOUS),this.dataState.hasNext||h.push(c.NEXT),this.dataState.insertionMode&&h.push(c.INSERT),this._disabledButtons=h}async changeViewMode(t){this.emitSwitchEvent(t)}async configGrid(){this._snkGrid&&this._snkGrid.showConfig()}async showUp(){this._snkFormView&&this._snkFormView.showUp(),this._snkGrid&&this._snkGrid.scrollIntoView({behavior:"smooth",block:"start"})}async addCustomEditor(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);this._snkGrid.addCustomEditor(t,i,e),this._snkFormView.addCustomEditor(t,i,e)}async observerPropsCustomEditor(t){for(const i in t)await this.addCustomEditor(i,t[i])}async addGridCustomRender(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);await this._snkGrid.addGridCustomRender(t,i,e)}onContentCardChanged(t){u.updateContentCard(t.detail.formName,t.detail.cardConfig,t.detail.propertyChanged,this.formConfigManager).then((()=>s(this))),t.stopPropagation()}async observeCustomRenders(t){for(const i in t){const s=t[i];await this.addGridCustomRender(i,s)}}updateLabel(){const t=this.guideItemPath?this.guideItemPath.length:0;if(t>0){const i=t>0?this.guideItemPath.map((t=>t.label)):void 0;this.label=i.pop(),this._levelPath=i.length>0?i.join(" / "):void 0}else this.label="",this._levelPath=void 0}getFormGuideId(t){var i;if(!t){if(null==(null===(i=this.dataState)||void 0===i?void 0:i.selectedRecord))return;const s=Array.from(this._formMetadata.getAllSheets().keys());if(!s||0==s.length)return;t=s[0]}return`${this.stripFormPattern(this.branchGuide.id)}__FORM:${t}`}stripFormPattern(t){return t.replace(p.REGEX_FORM_ID,"")}loadMetadata(){if(!this.dataUnit)return;if(!this.formConfigManager.isLoaded)return;const t=this.formConfigManager.getConfig(this.dataUnit);this._formMetadata=r(null==t||0===t.fields.length?void 0:t,this.dataUnit,!0)}dataUnitReadyHandler(t){this.dataUnit=t.detail,this.loadMetadata()}updateViewStack(t){var i,s;this._viewStack=t,this._currentView=this.selectedForm?1:0,null===(s=null===(i=this._viewStack)||void 0===i?void 0:i.show)||void 0===s||s.call(i,this._currentView)}getFormFields(){return this.selectedForm&&this._formMetadata?this._formMetadata.getSheet(this.selectedForm).fields:[]}emitSwitchEvent(t){const i=t===l.GRID?this.stripFormPattern(this.branchGuide.id):this.getFormGuideId();i&&this.snkSwitchGuide.emit(i)}handleAttachBack(){this._viewStack.show(l.GRID)}executeActionHandler(t){t.detail===c.GRID_MODE&&(this.emitSwitchEvent(l.GRID),t.stopPropagation()),t.detail!==c.FORM_MODE&&t.detail!==c.UPDATE||(this.emitSwitchEvent(l.FORM),t.stopPropagation()),t.detail===c.ATTACH&&(this._viewStack.show(l.ATTACHMENT),t.stopPropagation())}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}async handleDataStateChange({detail:t}){this.dataState=t,void 0!==t.selectedRecord&&this._snkDataUnit&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}componentWillLoad(){this._configName=`dynaform.${this.entityName}`,this.formConfigManager=new h(this._configName,this.resourceID,(()=>this.loadMetadata()),this.dataUnit),this.formConfigManager.loadConfig(),null==this.messagesBuilder&&(this.messagesBuilder=new m(this.entityName))}async componentDidLoad(){await this.observerPropsCustomEditor(this.customEditors),await this.observeCustomRenders(this.customRenders)}async dataUnitActionHandler(t){t.type===o.FIELD_INVALIDATED&&this.addErrorBadgeToBranchGuide()}addErrorBadgeToBranchGuide(){this.branchGuide=Object.assign(Object.assign({},this.branchGuide),{badge:"error"}),this.snkDetailGuidesChange.emit(new v(this.branchGuide,this._formMetadata,this.dataUnit))}normalizeBranchGuideId(t){return null==t?void 0:t.replace(/child\[(.*?)\]/g,"$1").replace(/::/g,">")}render(){return this.updateLabel(),e(a,null,e("snk-data-unit",{ref:t=>this._snkDataUnit=t,dataUnitName:`${this.dataUnitName}`,onDataUnitReady:t=>this.dataUnitReadyHandler(t),entityName:this.entityName,onDataStateChange:this.handleDataStateChange.bind(this),ignoreSaveMessage:this._currentView===l.GRID,messagesBuilder:this.messagesBuilder,configName:this._configName},e("ez-view-stack",{ref:t=>this.updateViewStack(t)},e("stack-item",null,e("div",{class:"ez-box ez-box--shadow grid-container"},e("div",{class:"ez-title--primary ez-size-width--full ez-padding--large detail-header"},e("div",{class:"ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center"},this._levelPath?e("span",{class:"level-path"},this._levelPath+" /"):void 0,this.label)),e("snk-grid",{class:"ez-size-width--full",ref:t=>this._snkGrid=t,configName:this._configName,messagesBuilder:this.messagesBuilder,onGridDoubleClick:()=>this.emitSwitchEvent(l.FORM),onActionClick:t=>this.executeActionHandler(t),presentationMode:this.presentationMode,canEdit:this.canEdit,isDetail:!0,taskbarCustomContainerId:this.taskbarCustomContainerId,gridHeaderCustomSlotId:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS",topTaskbarCustomSlotId:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS",outlineMode:!1}))),e("stack-item",null,e("snk-form-view",{ref:t=>this._snkFormView=t,canExpand:!1,canFix:!1,name:this.selectedForm,formMetadata:this._formMetadata,dataUnit:this.dataUnit,fields:this.getFormFields(),label:this.label,levelPath:this._levelPath,onFormItemsReady:({detail:t})=>this.formItemsReady.emit(t)},e("snk-taskbar",{key:"guideViewerTaskbar",class:"form-taskbar","data-element-id":"guideViewer",configName:this._configName,messagesBuilder:this.messagesBuilder,disabledButtons:this._disabledButtons,buttons:"INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR",primaryButton:"INSERT",presentationMode:this.presentationMode,onActionClick:t=>this.executeActionHandler(t),dataUnit:this.dataUnit,resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"},e("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))),e("stack-item",null,e("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this.entityName,onBack:this.handleAttachBack.bind(this)})))))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observerDataState"],customEditors:["observerPropsCustomEditor"],customRenders:["observeCustomRenders"]}}};p.REGEX_FORM_ID=/__FORM:[^:]+/g,p.style=".sc-snk-detail-view-h{display:flex;row-gap:24px;flex-direction:column;width:100%;height:100%}.level-path.sc-snk-detail-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.form-taskbar.sc-snk-detail-view{padding-bottom:var(--space--medium)}.grid-container.sc-snk-detail-view{background-color:#FFF;min-height:100px;height:100%}.detail-header.sc-snk-detail-view{padding-bottom:0}snk-data-unit.sc-snk-detail-view{flex:1}snk-grid.sc-snk-detail-view{height:calc(100% - 43px)}";export{p as snk_detail_view}