@sankhyalabs/sankhyablocks 10.1.0-dev.45 → 10.1.0-dev.47

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 (59) hide show
  1. package/dist/cjs/{SnkMultiSelectionListDataSource-b951ed91.js → SnkMultiSelectionListDataSource-293bc3d2.js} +1 -1
  2. package/dist/cjs/{dataunit-fetcher-93f53260.js → dataunit-fetcher-b9822794.js} +40 -3
  3. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
  4. package/dist/cjs/snk-actions-button_9.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-configurator.cjs.entry.js +2 -0
  8. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-6abc5efc.js → snk-data-unit-4b6dc396.js} +1 -1
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-layout-form-config.cjs.entry.js +1 -1
  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-configurator/snk-configurator.js +2 -0
  18. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -1
  19. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +40 -3
  20. package/dist/components/dataunit-fetcher.js +40 -3
  21. package/dist/components/snk-configurator2.js +2 -0
  22. package/dist/components/snk-detail-view2.js +1 -1
  23. package/dist/esm/{SnkMultiSelectionListDataSource-7fe25a58.js → SnkMultiSelectionListDataSource-f6cabd15.js} +1 -1
  24. package/dist/esm/{dataunit-fetcher-050b6d31.js → dataunit-fetcher-c176e002.js} +40 -3
  25. package/dist/esm/pesquisa-grid_2.entry.js +1 -1
  26. package/dist/esm/snk-actions-button_9.entry.js +1 -1
  27. package/dist/esm/snk-application.entry.js +1 -1
  28. package/dist/esm/snk-attach.entry.js +1 -1
  29. package/dist/esm/snk-configurator.entry.js +2 -0
  30. package/dist/esm/snk-crud.entry.js +1 -1
  31. package/dist/esm/snk-data-exporter.entry.js +2 -2
  32. package/dist/esm/{snk-data-unit-ca2c9858.js → snk-data-unit-d8cfa950.js} +1 -1
  33. package/dist/esm/snk-data-unit.entry.js +2 -2
  34. package/dist/esm/snk-detail-view.entry.js +2 -2
  35. package/dist/esm/snk-grid.entry.js +2 -2
  36. package/dist/esm/snk-layout-form-config.entry.js +1 -1
  37. package/dist/esm/snk-pesquisa.entry.js +1 -1
  38. package/dist/esm/snk-simple-crud.entry.js +2 -2
  39. package/dist/sankhyablocks/{p-35317d9a.entry.js → p-0afc64df.entry.js} +1 -1
  40. package/dist/sankhyablocks/{p-1086fb0c.entry.js → p-134702f6.entry.js} +1 -1
  41. package/dist/sankhyablocks/{p-46f75667.entry.js → p-20f03230.entry.js} +1 -1
  42. package/dist/sankhyablocks/p-26f1919e.entry.js +1 -0
  43. package/dist/sankhyablocks/{p-ac384a1e.entry.js → p-4b238673.entry.js} +1 -1
  44. package/dist/sankhyablocks/{p-20af4b6a.entry.js → p-4d04bc75.entry.js} +1 -1
  45. package/dist/sankhyablocks/{p-2b3c284c.entry.js → p-57e37f81.entry.js} +1 -1
  46. package/dist/sankhyablocks/{p-b3b51693.entry.js → p-610cae75.entry.js} +1 -1
  47. package/dist/sankhyablocks/{p-efd18bc2.entry.js → p-6d775eb9.entry.js} +1 -1
  48. package/dist/sankhyablocks/p-6e278003.js +60 -0
  49. package/dist/sankhyablocks/{p-ab12f544.entry.js → p-82bcb4cf.entry.js} +1 -1
  50. package/dist/sankhyablocks/{p-251aee41.entry.js → p-8fe740b7.entry.js} +1 -1
  51. package/dist/sankhyablocks/{p-09ba6bd4.js → p-9e77e136.js} +1 -1
  52. package/dist/sankhyablocks/{p-7c8bf699.entry.js → p-a905712a.entry.js} +1 -1
  53. package/dist/sankhyablocks/{p-f185d5ad.js → p-f5ad0720.js} +1 -1
  54. package/dist/sankhyablocks/{p-ce3b284c.entry.js → p-fec88660.entry.js} +1 -1
  55. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  56. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  57. package/package.json +1 -1
  58. package/dist/sankhyablocks/p-27e0cd68.entry.js +0 -1
  59. package/dist/sankhyablocks/p-d972a9c1.js +0 -60
@@ -6,7 +6,7 @@ const core = require('@sankhyalabs/core');
6
6
  const index = 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-93f53260.js');
9
+ const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
10
10
  require('./filter-item-type.enum-a7ffdaa6.js');
11
11
  require('./form-config-fetcher-45d1964c.js');
12
12
  require('./constants-6d82e405.js');
@@ -142,6 +142,9 @@ class PreloadManager {
142
142
  const columnFilters = utils.ColumnFilterManager.getColumnFilters(request.filters, fieldName);
143
143
  filterFunction = utils.ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
144
144
  }
145
+ if (onlyLabel) {
146
+ return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
147
+ }
145
148
  return new Promise((accept, reject) => {
146
149
  PreloadManager.getRepository(dataUnit).distict(record => {
147
150
  if (filterFunction != undefined && !filterFunction(record)) {
@@ -152,9 +155,6 @@ class PreloadManager {
152
155
  return { key: null, value: null };
153
156
  }
154
157
  let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
155
- if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
156
- return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
157
- }
158
158
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
159
159
  })
160
160
  .then(result => {
@@ -167,6 +167,43 @@ class PreloadManager {
167
167
  .catch(reason => reject(reason));
168
168
  });
169
169
  }
170
+ static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
171
+ const groupedOptions = new Map();
172
+ const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
173
+ cachedRecords.forEach(record => {
174
+ if (filterFunction != undefined && !filterFunction(record)) {
175
+ return;
176
+ }
177
+ const fieldValue = record[fieldName];
178
+ if (fieldValue == undefined) {
179
+ const nullKey = '';
180
+ if (!groupedOptions.has(nullKey)) {
181
+ groupedOptions.set(nullKey, {
182
+ values: new Set([null]),
183
+ option: { label: null, value: null, check: true },
184
+ });
185
+ }
186
+ return;
187
+ }
188
+ const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
189
+ const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
190
+ const key = String(label !== null && label !== void 0 ? label : '');
191
+ let grouped = groupedOptions.get(key);
192
+ if (!grouped) {
193
+ grouped = {
194
+ values: new Set(),
195
+ option: { label, value, check: true },
196
+ };
197
+ groupedOptions.set(key, grouped);
198
+ }
199
+ grouped.values.add(value);
200
+ });
201
+ return Array.from(groupedOptions.values()).map(grouped => {
202
+ const option = grouped.option;
203
+ option.__multiValues = Array.from(grouped.values.values());
204
+ return grouped.option;
205
+ });
206
+ }
170
207
  static async loadData(dataUnit, request, loadFromServer) {
171
208
  try {
172
209
  if (PreloadManager.isCacheEnabled(dataUnit)) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1894343a.js');
6
- const dataunitFetcher = require('./dataunit-fetcher-93f53260.js');
6
+ const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
7
7
  require('./DataFetcher-384d2ce8.js');
8
8
  const ISave = require('./ISave-ecbe9336.js');
9
9
  require('@sankhyalabs/core');
@@ -10,7 +10,7 @@ require('./ISave-ecbe9336.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-93f53260.js');
13
+ require('./dataunit-fetcher-b9822794.js');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
15
15
  const formConfigFetcher = require('./form-config-fetcher-45d1964c.js');
16
16
  const constants = require('./constants-6d82e405.js');
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const ConfigStorage = require('./ConfigStorage-a1fab5ca.js');
9
9
  const DataFetcher = require('./DataFetcher-384d2ce8.js');
10
10
  const authFetcher = require('./auth-fetcher-6b134ec4.js');
11
- const dataunitFetcher = require('./dataunit-fetcher-93f53260.js');
11
+ const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
12
12
  const ISave = require('./ISave-ecbe9336.js');
13
13
  const SnkMessageBuilder = require('./SnkMessageBuilder-a9300ebe.js');
14
14
  const constants = require('./constants-6d82e405.js');
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
7
7
  const DataFetcher = require('./DataFetcher-384d2ce8.js');
8
8
  const ISave = require('./ISave-ecbe9336.js');
9
9
  require('./index-e3e39724.js');
10
- const dataunitFetcher = require('./dataunit-fetcher-93f53260.js');
10
+ const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
11
11
  require('./filter-item-type.enum-a7ffdaa6.js');
12
12
  require('./form-config-fetcher-45d1964c.js');
13
13
  const constants = require('./constants-6d82e405.js');
@@ -91,6 +91,7 @@ const SnkConfigurator = class {
91
91
  if (!this.disableNumberingConfig) {
92
92
  const result = await ((_a = this._snkNumberingConfig) === null || _a === void 0 ? void 0 : _a.save());
93
93
  if (!result) {
94
+ this.closeConfig();
94
95
  return;
95
96
  }
96
97
  }
@@ -98,6 +99,7 @@ const SnkConfigurator = class {
98
99
  this._snkLayoutFormConfig.save();
99
100
  }
100
101
  this.save.emit();
102
+ this.closeConfig();
101
103
  }
102
104
  componentWillLoad() {
103
105
  this._application = core.ApplicationContext.getContextValue('__SNK__APPLICATION__');
@@ -9,7 +9,7 @@ require('./ISave-ecbe9336.js');
9
9
  const index = 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-93f53260.js');
12
+ require('./dataunit-fetcher-b9822794.js');
13
13
  require('./filter-item-type.enum-a7ffdaa6.js');
14
14
  require('./form-config-fetcher-45d1964c.js');
15
15
  const constants = require('./constants-6d82e405.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-6d82e405.js');
11
11
  const DataFetcher = require('./DataFetcher-384d2ce8.js');
12
- const snkDataUnit = require('./snk-data-unit-6abc5efc.js');
12
+ const snkDataUnit = require('./snk-data-unit-4b6dc396.js');
13
13
  require('./ISave-ecbe9336.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-93f53260.js');
16
+ require('./dataunit-fetcher-b9822794.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  require('./form-config-fetcher-45d1964c.js');
19
19
  require('./PrintUtils-bcaeb82f.js');
@@ -4,7 +4,7 @@ const index = require('./index-1894343a.js');
4
4
  const core = require('@sankhyalabs/core');
5
5
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
6
6
  const SnkMessageBuilder = require('./SnkMessageBuilder-a9300ebe.js');
7
- const dataunitFetcher = require('./dataunit-fetcher-93f53260.js');
7
+ const dataunitFetcher = require('./dataunit-fetcher-b9822794.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-6abc5efc.js');
5
+ const snkDataUnit = require('./snk-data-unit-4b6dc396.js');
6
6
  require('./index-1894343a.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/ezui/dist/collection/utils');
9
9
  require('./SnkMessageBuilder-a9300ebe.js');
10
- require('./dataunit-fetcher-93f53260.js');
10
+ require('./dataunit-fetcher-b9822794.js');
11
11
  require('./DataFetcher-384d2ce8.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -11,7 +11,7 @@ require('./ISave-ecbe9336.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-93f53260.js');
14
+ require('./dataunit-fetcher-b9822794.js');
15
15
  require('./filter-item-type.enum-a7ffdaa6.js');
16
16
  require('./form-config-fetcher-45d1964c.js');
17
17
  const constants = require('./constants-6d82e405.js');
@@ -372,7 +372,7 @@ const SnkDetailView = class {
372
372
  render() {
373
373
  this.updateLabel();
374
374
  //const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
375
- return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, index.h("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: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, index.h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), index.h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
375
+ return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, index.h("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: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, index.h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), index.h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
376
376
  }
377
377
  get _element() { return index.getElement(this); }
378
378
  static get watchers() { return {
@@ -8,11 +8,11 @@ const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
8
8
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
9
9
  require('./DataFetcher-384d2ce8.js');
10
10
  require('./ISave-ecbe9336.js');
11
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-b951ed91.js');
11
+ const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-293bc3d2.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-93f53260.js');
15
+ require('./dataunit-fetcher-b9822794.js');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
17
  require('./form-config-fetcher-45d1964c.js');
18
18
  require('./constants-6d82e405.js');
@@ -9,7 +9,7 @@ const core = require('@sankhyalabs/core');
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-93f53260.js');
12
+ require('./dataunit-fetcher-b9822794.js');
13
13
  require('./filter-item-type.enum-a7ffdaa6.js');
14
14
  const formConfigFetcher = require('./form-config-fetcher-45d1964c.js');
15
15
  require('./constants-6d82e405.js');
@@ -9,7 +9,7 @@ require('./DataFetcher-384d2ce8.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-93f53260.js');
12
+ require('./dataunit-fetcher-b9822794.js');
13
13
  require('./filter-item-type.enum-a7ffdaa6.js');
14
14
  require('./form-config-fetcher-45d1964c.js');
15
15
  require('./constants-6d82e405.js');
@@ -9,11 +9,11 @@ const constants = require('./constants-6d82e405.js');
9
9
  const taskbarElements = require('./taskbar-elements-80eddec8.js');
10
10
  require('./DataFetcher-384d2ce8.js');
11
11
  require('./ISave-ecbe9336.js');
12
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-b951ed91.js');
12
+ const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-293bc3d2.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-93f53260.js');
16
+ const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  const formConfigFetcher = require('./form-config-fetcher-45d1964c.js');
19
19
  const ConfigStorage = require('./ConfigStorage-a1fab5ca.js');
@@ -79,6 +79,7 @@ export class SnkConfigurator {
79
79
  if (!this.disableNumberingConfig) {
80
80
  const result = await ((_a = this._snkNumberingConfig) === null || _a === void 0 ? void 0 : _a.save());
81
81
  if (!result) {
82
+ this.closeConfig();
82
83
  return;
83
84
  }
84
85
  }
@@ -86,6 +87,7 @@ export class SnkConfigurator {
86
87
  this._snkLayoutFormConfig.save();
87
88
  }
88
89
  this.save.emit();
90
+ this.closeConfig();
89
91
  }
90
92
  componentWillLoad() {
91
93
  this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
@@ -299,7 +299,7 @@ export class SnkDetailView {
299
299
  render() {
300
300
  this.updateLabel();
301
301
  //const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
302
- return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("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: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
302
+ return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("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: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
303
303
  }
304
304
  static get is() { return "snk-detail-view"; }
305
305
  static get encapsulation() { return "scoped"; }
@@ -33,6 +33,9 @@ export default class PreloadManager {
33
33
  const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, fieldName);
34
34
  filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
35
35
  }
36
+ if (onlyLabel) {
37
+ return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
38
+ }
36
39
  return new Promise((accept, reject) => {
37
40
  PreloadManager.getRepository(dataUnit).distict(record => {
38
41
  if (filterFunction != undefined && !filterFunction(record)) {
@@ -43,9 +46,6 @@ export default class PreloadManager {
43
46
  return { key: null, value: null };
44
47
  }
45
48
  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
- }
49
49
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
50
50
  })
51
51
  .then(result => {
@@ -58,6 +58,43 @@ export default class PreloadManager {
58
58
  .catch(reason => reject(reason));
59
59
  });
60
60
  }
61
+ static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
62
+ const groupedOptions = new Map();
63
+ const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
64
+ cachedRecords.forEach(record => {
65
+ if (filterFunction != undefined && !filterFunction(record)) {
66
+ return;
67
+ }
68
+ const fieldValue = record[fieldName];
69
+ if (fieldValue == undefined) {
70
+ const nullKey = '';
71
+ if (!groupedOptions.has(nullKey)) {
72
+ groupedOptions.set(nullKey, {
73
+ values: new Set([null]),
74
+ option: { label: null, value: null, check: true },
75
+ });
76
+ }
77
+ return;
78
+ }
79
+ const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
80
+ const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
81
+ const key = String(label !== null && label !== void 0 ? label : '');
82
+ let grouped = groupedOptions.get(key);
83
+ if (!grouped) {
84
+ grouped = {
85
+ values: new Set(),
86
+ option: { label, value, check: true },
87
+ };
88
+ groupedOptions.set(key, grouped);
89
+ }
90
+ grouped.values.add(value);
91
+ });
92
+ return Array.from(groupedOptions.values()).map(grouped => {
93
+ const option = grouped.option;
94
+ option.__multiValues = Array.from(grouped.values.values());
95
+ return grouped.option;
96
+ });
97
+ }
61
98
  static async loadData(dataUnit, request, loadFromServer) {
62
99
  try {
63
100
  if (PreloadManager.isCacheEnabled(dataUnit)) {
@@ -164,6 +164,9 @@ class PreloadManager {
164
164
  const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, fieldName);
165
165
  filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
166
166
  }
167
+ if (onlyLabel) {
168
+ return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
169
+ }
167
170
  return new Promise((accept, reject) => {
168
171
  PreloadManager.getRepository(dataUnit).distict(record => {
169
172
  if (filterFunction != undefined && !filterFunction(record)) {
@@ -174,9 +177,6 @@ class PreloadManager {
174
177
  return { key: null, value: null };
175
178
  }
176
179
  let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
177
- if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
178
- return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
179
- }
180
180
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
181
181
  })
182
182
  .then(result => {
@@ -189,6 +189,43 @@ class PreloadManager {
189
189
  .catch(reason => reject(reason));
190
190
  });
191
191
  }
192
+ static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
193
+ const groupedOptions = new Map();
194
+ const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
195
+ cachedRecords.forEach(record => {
196
+ if (filterFunction != undefined && !filterFunction(record)) {
197
+ return;
198
+ }
199
+ const fieldValue = record[fieldName];
200
+ if (fieldValue == undefined) {
201
+ const nullKey = '';
202
+ if (!groupedOptions.has(nullKey)) {
203
+ groupedOptions.set(nullKey, {
204
+ values: new Set([null]),
205
+ option: { label: null, value: null, check: true },
206
+ });
207
+ }
208
+ return;
209
+ }
210
+ const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
211
+ const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
212
+ const key = String(label !== null && label !== void 0 ? label : '');
213
+ let grouped = groupedOptions.get(key);
214
+ if (!grouped) {
215
+ grouped = {
216
+ values: new Set(),
217
+ option: { label, value, check: true },
218
+ };
219
+ groupedOptions.set(key, grouped);
220
+ }
221
+ grouped.values.add(value);
222
+ });
223
+ return Array.from(groupedOptions.values()).map(grouped => {
224
+ const option = grouped.option;
225
+ option.__multiValues = Array.from(grouped.values.values());
226
+ return grouped.option;
227
+ });
228
+ }
192
229
  static async loadData(dataUnit, request, loadFromServer) {
193
230
  try {
194
231
  if (PreloadManager.isCacheEnabled(dataUnit)) {
@@ -91,6 +91,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
91
91
  if (!this.disableNumberingConfig) {
92
92
  const result = await ((_a = this._snkNumberingConfig) === null || _a === void 0 ? void 0 : _a.save());
93
93
  if (!result) {
94
+ this.closeConfig();
94
95
  return;
95
96
  }
96
97
  }
@@ -98,6 +99,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
98
99
  this._snkLayoutFormConfig.save();
99
100
  }
100
101
  this.save.emit();
102
+ this.closeConfig();
101
103
  }
102
104
  componentWillLoad() {
103
105
  this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
@@ -1196,7 +1196,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
1196
1196
  render() {
1197
1197
  this.updateLabel();
1198
1198
  //const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
1199
- return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("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: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
1199
+ return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("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: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
1200
1200
  }
1201
1201
  get _element() { return this; }
1202
1202
  static get watchers() { return {
@@ -4,7 +4,7 @@ import { SortMode, ApplicationContext, ObjectUtils, StringUtils, NumberUtils, Da
4
4
  import { D as DataExporterOption } from './index-b40568ff.js';
5
5
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
6
6
  import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
7
- import { P as PreloadManager } from './dataunit-fetcher-050b6d31.js';
7
+ import { P as PreloadManager } from './dataunit-fetcher-c176e002.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
9
  import './form-config-fetcher-b44b2727.js';
10
10
  import './constants-7b422de0.js';
@@ -136,6 +136,9 @@ class PreloadManager {
136
136
  const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, fieldName);
137
137
  filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
138
138
  }
139
+ if (onlyLabel) {
140
+ return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
141
+ }
139
142
  return new Promise((accept, reject) => {
140
143
  PreloadManager.getRepository(dataUnit).distict(record => {
141
144
  if (filterFunction != undefined && !filterFunction(record)) {
@@ -146,9 +149,6 @@ class PreloadManager {
146
149
  return { key: null, value: null };
147
150
  }
148
151
  let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
149
- if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
150
- return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
151
- }
152
152
  return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
153
153
  })
154
154
  .then(result => {
@@ -161,6 +161,43 @@ class PreloadManager {
161
161
  .catch(reason => reject(reason));
162
162
  });
163
163
  }
164
+ static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
165
+ const groupedOptions = new Map();
166
+ const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
167
+ cachedRecords.forEach(record => {
168
+ if (filterFunction != undefined && !filterFunction(record)) {
169
+ return;
170
+ }
171
+ const fieldValue = record[fieldName];
172
+ if (fieldValue == undefined) {
173
+ const nullKey = '';
174
+ if (!groupedOptions.has(nullKey)) {
175
+ groupedOptions.set(nullKey, {
176
+ values: new Set([null]),
177
+ option: { label: null, value: null, check: true },
178
+ });
179
+ }
180
+ return;
181
+ }
182
+ const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
183
+ const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
184
+ const key = String(label !== null && label !== void 0 ? label : '');
185
+ let grouped = groupedOptions.get(key);
186
+ if (!grouped) {
187
+ grouped = {
188
+ values: new Set(),
189
+ option: { label, value, check: true },
190
+ };
191
+ groupedOptions.set(key, grouped);
192
+ }
193
+ grouped.values.add(value);
194
+ });
195
+ return Array.from(groupedOptions.values()).map(grouped => {
196
+ const option = grouped.option;
197
+ option.__multiValues = Array.from(grouped.values.values());
198
+ return grouped.option;
199
+ });
200
+ }
164
201
  static async loadData(dataUnit, request, loadFromServer) {
165
202
  try {
166
203
  if (PreloadManager.isCacheEnabled(dataUnit)) {
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, e as createEvent, h, f as Host, F as Fragment } from './index-04f73a26.js';
2
- import { I as InMemoryLoader } from './dataunit-fetcher-050b6d31.js';
2
+ import { I as InMemoryLoader } from './dataunit-fetcher-c176e002.js';
3
3
  import './DataFetcher-e60f8d53.js';
4
4
  import { P as PesquisaFetcher } from './ISave-4929c071.js';
5
5
  import '@sankhyalabs/core';
@@ -6,7 +6,7 @@ import './ISave-4929c071.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-050b6d31.js';
9
+ import './dataunit-fetcher-c176e002.js';
10
10
  import './filter-item-type.enum-d45e026f.js';
11
11
  import { F as FormConfigFetcher } from './form-config-fetcher-b44b2727.js';
12
12
  import { O as ORDER_VALUES } from './constants-7b422de0.js';
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { C as ConfigStorage } from './ConfigStorage-76872695.js';
5
5
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-e60f8d53.js';
6
6
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-1a31c1e4.js';
7
- import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-050b6d31.js';
7
+ import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-c176e002.js';
8
8
  import { P as PesquisaFetcher } from './ISave-4929c071.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-1eb7a1af.js';
10
10
  import { T as TEMPLATES_SKELETON } from './constants-7b422de0.js';
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataU
3
3
  import { D as DataFetcher } from './DataFetcher-e60f8d53.js';
4
4
  import { S as SaveErrorsEnum } from './ISave-4929c071.js';
5
5
  import './index-b40568ff.js';
6
- import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-050b6d31.js';
6
+ import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-c176e002.js';
7
7
  import './filter-item-type.enum-d45e026f.js';
8
8
  import './form-config-fetcher-b44b2727.js';
9
9
  import { V as VIEW_MODE } from './constants-7b422de0.js';
@@ -87,6 +87,7 @@ const SnkConfigurator = class {
87
87
  if (!this.disableNumberingConfig) {
88
88
  const result = await ((_a = this._snkNumberingConfig) === null || _a === void 0 ? void 0 : _a.save());
89
89
  if (!result) {
90
+ this.closeConfig();
90
91
  return;
91
92
  }
92
93
  }
@@ -94,6 +95,7 @@ const SnkConfigurator = class {
94
95
  this._snkLayoutFormConfig.save();
95
96
  }
96
97
  this.save.emit();
98
+ this.closeConfig();
97
99
  }
98
100
  componentWillLoad() {
99
101
  this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
@@ -5,7 +5,7 @@ import './ISave-4929c071.js';
5
5
  import { P as PresentationMode, E as ExporterStrategy } from './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-050b6d31.js';
8
+ import './dataunit-fetcher-c176e002.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
10
  import './form-config-fetcher-b44b2727.js';
11
11
  import { V as VIEW_MODE } from './constants-7b422de0.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-7b422de0.js';
7
7
  import { D as DataFetcher } from './DataFetcher-e60f8d53.js';
8
- import { S as SnkDataUnit } from './snk-data-unit-ca2c9858.js';
8
+ import { S as SnkDataUnit } from './snk-data-unit-d8cfa950.js';
9
9
  import './ISave-4929c071.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
- import './dataunit-fetcher-050b6d31.js';
12
+ import './dataunit-fetcher-c176e002.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
14
  import './form-config-fetcher-b44b2727.js';
15
15
  import './PrintUtils-3e4ff0f5.js';