@sankhyalabs/sankhyablocks 10.1.0-dev.30 → 10.1.0-dev.32

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 (81) hide show
  1. package/dist/cjs/{SnkMultiSelectionListDataSource-a891430e.js → SnkMultiSelectionListDataSource-f53b60c4.js} +1 -1
  2. package/dist/cjs/{dataunit-fetcher-4320f7ec.js → dataunit-fetcher-6febd6c4.js} +23 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-actions-button_8.cjs.entry.js +5 -3
  7. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-attach.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  10. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  11. package/dist/cjs/{snk-data-unit-b54fdf9a.js → snk-data-unit-94757628.js} +1 -1
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +11 -3
  15. package/dist/cjs/snk-grid.cjs.entry.js +9 -9
  16. package/dist/cjs/{snk-guides-viewer-58185ae3.js → snk-guides-viewer-315f8580.js} +1 -1
  17. package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
  18. package/dist/cjs/snk-layout-form-config.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -13
  21. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +1 -3
  22. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +16 -0
  23. package/dist/collection/components/snk-grid/snk-grid.js +7 -7
  24. package/dist/collection/components/snk-grid-config/snk-grid-config.js +30 -3
  25. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +12 -11
  26. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +24 -2
  27. package/dist/components/dataunit-fetcher.js +23 -1
  28. package/dist/components/snk-filter-bar2.js +11 -1
  29. package/dist/components/snk-filter-item2.js +1 -3
  30. package/dist/components/snk-grid-config2.js +5 -2
  31. package/dist/components/snk-grid2.js +7 -7
  32. package/dist/components/snk-simple-crud2.js +12 -11
  33. package/dist/esm/{SnkMultiSelectionListDataSource-14633bf6.js → SnkMultiSelectionListDataSource-6e9496f0.js} +1 -1
  34. package/dist/esm/{dataunit-fetcher-3d5c4ae4.js → dataunit-fetcher-21c43ec7.js} +23 -1
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/esm/pesquisa-grid_2.entry.js +1 -1
  37. package/dist/esm/sankhyablocks.js +1 -1
  38. package/dist/esm/snk-actions-button_8.entry.js +5 -3
  39. package/dist/esm/snk-application.entry.js +1 -1
  40. package/dist/esm/snk-attach.entry.js +1 -1
  41. package/dist/esm/snk-crud.entry.js +1 -1
  42. package/dist/esm/snk-data-exporter.entry.js +2 -2
  43. package/dist/esm/{snk-data-unit-363c3551.js → snk-data-unit-3b06a0f3.js} +1 -1
  44. package/dist/esm/snk-data-unit.entry.js +2 -2
  45. package/dist/esm/snk-detail-view.entry.js +2 -2
  46. package/dist/esm/snk-filter-bar_4.entry.js +11 -3
  47. package/dist/esm/snk-grid.entry.js +9 -9
  48. package/dist/esm/{snk-guides-viewer-6a72a3f4.js → snk-guides-viewer-a4e31f63.js} +1 -1
  49. package/dist/esm/snk-guides-viewer.entry.js +2 -2
  50. package/dist/esm/snk-layout-form-config.entry.js +1 -1
  51. package/dist/esm/snk-pesquisa.entry.js +1 -1
  52. package/dist/esm/snk-simple-crud.entry.js +14 -13
  53. package/dist/sankhyablocks/{p-fc5e95f4.entry.js → p-07619e85.entry.js} +1 -1
  54. package/dist/sankhyablocks/{p-c6a97fda.entry.js → p-0d15b109.entry.js} +1 -1
  55. package/dist/sankhyablocks/{p-30641d55.entry.js → p-17653b22.entry.js} +1 -1
  56. package/dist/sankhyablocks/{p-48762fe9.js → p-25540da8.js} +1 -1
  57. package/dist/sankhyablocks/{p-7c4f4851.js → p-362e6e8c.js} +1 -1
  58. package/dist/sankhyablocks/{p-2ccbbeec.js → p-45a830d9.js} +1 -1
  59. package/dist/sankhyablocks/{p-18cc9111.entry.js → p-4a8d0917.entry.js} +1 -1
  60. package/dist/sankhyablocks/p-4abf2838.entry.js +1 -0
  61. package/dist/sankhyablocks/p-4cdfa0e4.entry.js +1 -0
  62. package/dist/sankhyablocks/p-4fe8380b.entry.js +1 -0
  63. package/dist/sankhyablocks/p-73b455e1.entry.js +1 -0
  64. package/dist/sankhyablocks/{p-1df34264.entry.js → p-88b0797e.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-fce86770.entry.js → p-8bb4e86b.entry.js} +1 -1
  66. package/dist/sankhyablocks/{p-685bc841.js → p-b9970342.js} +1 -1
  67. package/dist/sankhyablocks/{p-d70de708.entry.js → p-f1110b78.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-9ce1539b.entry.js → p-f1bf7248.entry.js} +1 -1
  69. package/dist/sankhyablocks/{p-2ee83af1.entry.js → p-f1d541e9.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-a210e55b.entry.js → p-f2472d12.entry.js} +1 -1
  71. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  72. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
  73. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
  74. package/dist/types/components/snk-grid-config/snk-grid-config.d.ts +4 -0
  75. package/dist/types/components.d.ts +8 -0
  76. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +2 -1
  77. package/package.json +1 -1
  78. package/dist/sankhyablocks/p-45f53520.entry.js +0 -1
  79. package/dist/sankhyablocks/p-7cede5db.entry.js +0 -1
  80. package/dist/sankhyablocks/p-e0e3914e.entry.js +0 -1
  81. package/dist/sankhyablocks/p-f4ac3b50.entry.js +0 -1
@@ -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-3a8ea521.js');
10
10
  require('./ISave-a66bb65e.js');
11
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-a891430e.js');
11
+ const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-f53b60c4.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-4320f7ec.js');
15
+ require('./dataunit-fetcher-6febd6c4.js');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
17
  require('./form-config-fetcher-72cf0e3d.js');
18
18
  require('./constants-6d82e405.js');
@@ -201,7 +201,7 @@ const SnkGrid = class {
201
201
  if (this._grid == undefined) {
202
202
  return;
203
203
  }
204
- this.openGridConfig();
204
+ await this.openGridConfig();
205
205
  }
206
206
  /**
207
207
  * Fecha a janela de configurações da grade.
@@ -341,12 +341,12 @@ const SnkGrid = class {
341
341
  handleAddFormMode() {
342
342
  return this.enableGridInsert ? taskbarElements.TaskbarElement.FORM_MODE : '';
343
343
  }
344
- openGridConfig() {
345
- this._grid.getColumnsState()
346
- .then((gridColumns) => {
347
- this._snkGridConfig.columns = gridColumns.filter(c => c.name);
348
- this._popUpGridConfig = true;
349
- });
344
+ async openGridConfig() {
345
+ const originalColumns = await this._grid.getColumns();
346
+ const gridColumns = await this._grid.getColumnsState();
347
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
348
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
349
+ this._popUpGridConfig = true;
350
350
  }
351
351
  closeGridConfig() {
352
352
  this._popUpGridConfig = false;
@@ -10,7 +10,7 @@ require('./ISave-a66bb65e.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-4320f7ec.js');
13
+ require('./dataunit-fetcher-6febd6c4.js');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
15
15
  require('./form-config-fetcher-72cf0e3d.js');
16
16
  const constants = require('./constants-6d82e405.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-58185ae3.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-315f8580.js');
6
6
  require('./index-1894343a.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -15,7 +15,7 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
15
  require('./ISave-a66bb65e.js');
16
16
  require('./index-e3e39724.js');
17
17
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
18
- require('./dataunit-fetcher-4320f7ec.js');
18
+ require('./dataunit-fetcher-6febd6c4.js');
19
19
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
20
20
  require('@sankhyalabs/core/dist/utils/SortingUtils');
21
21
  require('./ResourceIDUtils-5ff86aa7.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-4320f7ec.js');
12
+ require('./dataunit-fetcher-6febd6c4.js');
13
13
  require('./filter-item-type.enum-a7ffdaa6.js');
14
14
  const formConfigFetcher = require('./form-config-fetcher-72cf0e3d.js');
15
15
  require('./constants-6d82e405.js');
@@ -9,7 +9,7 @@ require('./DataFetcher-3a8ea521.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-4320f7ec.js');
12
+ require('./dataunit-fetcher-6febd6c4.js');
13
13
  require('./filter-item-type.enum-a7ffdaa6.js');
14
14
  require('./form-config-fetcher-72cf0e3d.js');
15
15
  require('./constants-6d82e405.js');
@@ -9,11 +9,11 @@ const constants = require('./constants-6d82e405.js');
9
9
  const taskbarElements = require('./taskbar-elements-a94d4318.js');
10
10
  require('./DataFetcher-3a8ea521.js');
11
11
  require('./ISave-a66bb65e.js');
12
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-a891430e.js');
12
+ const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-f53b60c4.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-4320f7ec.js');
16
+ const dataunitFetcher = require('./dataunit-fetcher-6febd6c4.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  const formConfigFetcher = require('./form-config-fetcher-72cf0e3d.js');
19
19
  const taskbarProcessor = require('./taskbar-processor-2fba34a8.js');
@@ -298,22 +298,23 @@ const SnkSimpleCrud = class {
298
298
  }
299
299
  await this.loadFormConfig(true);
300
300
  }
301
- openConfig(viewMode) {
302
- this._snkConfigurator.close();
301
+ async openConfig(viewMode) {
302
+ await this._snkConfigurator.close();
303
303
  if (viewMode === constants.VIEW_MODE.GRID) {
304
- this.openGridConfig();
304
+ await this.openGridConfig();
305
305
  }
306
306
  else if (viewMode === constants.VIEW_MODE.FORM) {
307
- this.openFormConfig();
307
+ await this.openFormConfig();
308
308
  }
309
309
  }
310
- openGridConfig() {
311
- this._grid.getColumnsState()
312
- .then((gridColumns) => {
313
- this._snkGridConfig.columns = gridColumns.filter(c => c.name);
314
- this._snkGridConfig.selectedIndex = 0;
315
- this._showPopUpGridConfig = true;
316
- });
310
+ async openGridConfig() {
311
+ var _a, _b, _c, _d;
312
+ const originalColumns = (_b = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumns())) !== null && _b !== void 0 ? _b : [];
313
+ const gridColumns = (_d = await ((_c = this._grid) === null || _c === void 0 ? void 0 : _c.getColumnsState())) !== null && _d !== void 0 ? _d : [];
314
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
315
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
316
+ this._snkGridConfig.selectedIndex = 0;
317
+ this._showPopUpGridConfig = true;
317
318
  }
318
319
  async openFormConfig() {
319
320
  if (this.formLegacyConfigName || this.configName) {
@@ -16,10 +16,8 @@ export class SnkFilterItem {
16
16
  /**
17
17
  * Emitido quando o estado do filtro é alterado.
18
18
  */
19
- filterChangeListener(event) {
19
+ filterChangeListener(_event) {
20
20
  this.hideDetail();
21
- // Re-emite o evento para o pai (snk-filter-bar)
22
- this.filterChange.emit(event.detail);
23
21
  }
24
22
  /**
25
23
  * Exibe os detalhes de um item da lista.
@@ -430,6 +430,12 @@ export class SnkFilterBar {
430
430
  filterChangeListener(evt) {
431
431
  this.updateFilter(evt.detail);
432
432
  }
433
+ /**
434
+ * Escuta quando há um filtro do tipo pesquisa retorna um valor vazio.
435
+ */
436
+ async emptySearchListener(_evt) {
437
+ await this.showPersonalizedFilterItem();
438
+ }
433
439
  /**
434
440
  * @description Abre o modal de filtros.
435
441
  * @async
@@ -440,6 +446,10 @@ export class SnkFilterBar {
440
446
  }
441
447
  this.isFilterModalOpen = true;
442
448
  }
449
+ async showPersonalizedFilterItem() {
450
+ const popUp = this._element.querySelector('#filter-PERSONALIZED_FILTER_GROUP');
451
+ await (popUp === null || popUp === void 0 ? void 0 : popUp.showUp(true));
452
+ }
443
453
  addPersonalizedFilter(isDefault = false) {
444
454
  this.isFilterModalOpen = false;
445
455
  this._isDefaultFilter = isDefault;
@@ -1177,6 +1187,12 @@ export class SnkFilterBar {
1177
1187
  "target": undefined,
1178
1188
  "capture": false,
1179
1189
  "passive": false
1190
+ }, {
1191
+ "name": "ezEmptySearch",
1192
+ "method": "emptySearchListener",
1193
+ "target": "window",
1194
+ "capture": false,
1195
+ "passive": false
1180
1196
  }];
1181
1197
  }
1182
1198
  }
@@ -125,7 +125,7 @@ export class SnkGrid {
125
125
  if (this._grid == undefined) {
126
126
  return;
127
127
  }
128
- this.openGridConfig();
128
+ await this.openGridConfig();
129
129
  }
130
130
  /**
131
131
  * Fecha a janela de configurações da grade.
@@ -265,12 +265,12 @@ export class SnkGrid {
265
265
  handleAddFormMode() {
266
266
  return this.enableGridInsert ? TaskbarElement.FORM_MODE : '';
267
267
  }
268
- openGridConfig() {
269
- this._grid.getColumnsState()
270
- .then((gridColumns) => {
271
- this._snkGridConfig.columns = gridColumns.filter(c => c.name);
272
- this._popUpGridConfig = true;
273
- });
268
+ async openGridConfig() {
269
+ const originalColumns = await this._grid.getColumns();
270
+ const gridColumns = await this._grid.getColumnsState();
271
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
272
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
273
+ this._popUpGridConfig = true;
274
274
  }
275
275
  closeGridConfig() {
276
276
  this._popUpGridConfig = false;
@@ -13,7 +13,8 @@ export class SnkGridConfig {
13
13
  this._dataChanged = false;
14
14
  this._componenteInternalKey = Date.now();
15
15
  this.selectedIndex = 0;
16
- this.columns = undefined;
16
+ this.columns = [];
17
+ this.originalColumns = [];
17
18
  this.config = undefined;
18
19
  this.configName = undefined;
19
20
  this.resourceID = undefined;
@@ -351,7 +352,8 @@ export class SnkGridConfig {
351
352
  const visibleGroup = this.buildVisibleGroup();
352
353
  const hiddenGroup = this.buildHiddenGroup();
353
354
  const visibleItemsMap = new Map();
354
- this.columns.forEach(column => {
355
+ const columnsToIterate = isEmptyConfig ? this.originalColumns : this.columns;
356
+ columnsToIterate.forEach(column => {
355
357
  const item = this.buildListItemFromColumn(column);
356
358
  if (isEmptyConfig || defaultVisibleCols.includes(column.name)) {
357
359
  visibleItemsMap.set(column.name, item);
@@ -447,7 +449,32 @@ export class SnkGridConfig {
447
449
  "docs": {
448
450
  "tags": [],
449
451
  "text": "Colunas da grade."
450
- }
452
+ },
453
+ "defaultValue": "[]"
454
+ },
455
+ "originalColumns": {
456
+ "type": "unknown",
457
+ "mutable": true,
458
+ "complexType": {
459
+ "original": "Array<EzGridColumn>",
460
+ "resolved": "EzGridColumn[]",
461
+ "references": {
462
+ "Array": {
463
+ "location": "global"
464
+ },
465
+ "EzGridColumn": {
466
+ "location": "import",
467
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-grid/controller/EzGridController"
468
+ }
469
+ }
470
+ },
471
+ "required": false,
472
+ "optional": false,
473
+ "docs": {
474
+ "tags": [],
475
+ "text": "Lista de Colunas original."
476
+ },
477
+ "defaultValue": "[]"
451
478
  },
452
479
  "config": {
453
480
  "type": "unknown",
@@ -272,22 +272,23 @@ export class SnkSimpleCrud {
272
272
  }
273
273
  await this.loadFormConfig(true);
274
274
  }
275
- openConfig(viewMode) {
276
- this._snkConfigurator.close();
275
+ async openConfig(viewMode) {
276
+ await this._snkConfigurator.close();
277
277
  if (viewMode === VIEW_MODE.GRID) {
278
- this.openGridConfig();
278
+ await this.openGridConfig();
279
279
  }
280
280
  else if (viewMode === VIEW_MODE.FORM) {
281
- this.openFormConfig();
281
+ await this.openFormConfig();
282
282
  }
283
283
  }
284
- openGridConfig() {
285
- this._grid.getColumnsState()
286
- .then((gridColumns) => {
287
- this._snkGridConfig.columns = gridColumns.filter(c => c.name);
288
- this._snkGridConfig.selectedIndex = 0;
289
- this._showPopUpGridConfig = true;
290
- });
284
+ async openGridConfig() {
285
+ var _a, _b, _c, _d;
286
+ const originalColumns = (_b = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumns())) !== null && _b !== void 0 ? _b : [];
287
+ const gridColumns = (_d = await ((_c = this._grid) === null || _c === void 0 ? void 0 : _c.getColumnsState())) !== null && _d !== void 0 ? _d : [];
288
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
289
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
290
+ this._snkGridConfig.selectedIndex = 0;
291
+ this._showPopUpGridConfig = true;
291
292
  }
292
293
  async openFormConfig() {
293
294
  if (this.formLegacyConfigName || this.configName) {
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  }
11
11
  return t;
12
12
  };
13
- import { ChangeOperation, DataType, DataUnit, DataUnitStorage } from "@sankhyalabs/core";
13
+ import { ChangeOperation, DataType, DataUnit, DataUnitStorage, } from '@sankhyalabs/core';
14
14
  import { gql } from "graphql-request";
15
15
  import { DataFetcher } from "../../DataFetcher";
16
16
  import { DISTINCT_FILTER_NAME_PREFIX } from "@sankhyalabs/ezui/dist/collection/utils/constants";
@@ -140,7 +140,7 @@ export default class DataUnitFetcher {
140
140
  }
141
141
  metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
142
142
  });
143
- metadata.fields.sort((a, b) => a.order - b.order);
143
+ metadata.fields.sort((a, b) => this.sortFieldsByGroup(a, b));
144
144
  resolve(metadata);
145
145
  })
146
146
  .catch((error) => {
@@ -148,6 +148,28 @@ export default class DataUnitFetcher {
148
148
  });
149
149
  });
150
150
  }
151
+ // Os campos devem ser separados em dois grupos: campos da própria entidade e campos que representam ligação com outra entidade.
152
+ // Além do grupo, a ordenação deve respeitar o atributo "order" de cada campo.
153
+ // Para saber se é um campo de relação, verificamos se o nome contém '.' (ex: 'Parceiro.CODPAR').
154
+ sortFieldsByGroup(a, b) {
155
+ const aIsRelation = a.name.includes('.');
156
+ const bIsRelation = b.name.includes('.');
157
+ // Se um é relação e outro não, campos próprios vêm primeiro
158
+ if (aIsRelation !== bIsRelation) {
159
+ return aIsRelation ? 1 : -1;
160
+ }
161
+ // Se ambos são relações, ordena por nome da entidade primeiro
162
+ if (aIsRelation && bIsRelation) {
163
+ const aEntity = a.name.split('.')[0];
164
+ const bEntity = b.name.split('.')[0];
165
+ if (aEntity !== bEntity) {
166
+ return aEntity.localeCompare(bEntity);
167
+ }
168
+ }
169
+ // Dentro do mesmo grupo (próprios ou mesma entidade de relação), ordena por order
170
+ return a.order - b.order;
171
+ }
172
+ ;
151
173
  loadSelectDistinct(dataUnit, fieldName, argument) {
152
174
  const { parentRecordId, filters } = dataUnit.getLastLoadRequest() || {};
153
175
  const filteredFilters = filters.filter(f => f.name !== `${DISTINCT_FILTER_NAME_PREFIX}${fieldName}`);
@@ -920,7 +920,7 @@ class DataUnitFetcher {
920
920
  }
921
921
  metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
922
922
  });
923
- metadata.fields.sort((a, b) => a.order - b.order);
923
+ metadata.fields.sort((a, b) => this.sortFieldsByGroup(a, b));
924
924
  resolve(metadata);
925
925
  })
926
926
  .catch((error) => {
@@ -928,6 +928,28 @@ class DataUnitFetcher {
928
928
  });
929
929
  });
930
930
  }
931
+ // Os campos devem ser separados em dois grupos: campos da própria entidade e campos que representam ligação com outra entidade.
932
+ // Além do grupo, a ordenação deve respeitar o atributo "order" de cada campo.
933
+ // Para saber se é um campo de relação, verificamos se o nome contém '.' (ex: 'Parceiro.CODPAR').
934
+ sortFieldsByGroup(a, b) {
935
+ const aIsRelation = a.name.includes('.');
936
+ const bIsRelation = b.name.includes('.');
937
+ // Se um é relação e outro não, campos próprios vêm primeiro
938
+ if (aIsRelation !== bIsRelation) {
939
+ return aIsRelation ? 1 : -1;
940
+ }
941
+ // Se ambos são relações, ordena por nome da entidade primeiro
942
+ if (aIsRelation && bIsRelation) {
943
+ const aEntity = a.name.split('.')[0];
944
+ const bEntity = b.name.split('.')[0];
945
+ if (aEntity !== bEntity) {
946
+ return aEntity.localeCompare(bEntity);
947
+ }
948
+ }
949
+ // Dentro do mesmo grupo (próprios ou mesma entidade de relação), ordena por order
950
+ return a.order - b.order;
951
+ }
952
+ ;
931
953
  loadSelectDistinct(dataUnit, fieldName, argument) {
932
954
  const { parentRecordId, filters } = dataUnit.getLastLoadRequest() || {};
933
955
  const filteredFilters = filters.filter(f => f.name !== `${DISTINCT_FILTER_NAME_PREFIX}${fieldName}`);
@@ -640,6 +640,12 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
640
640
  filterChangeListener(evt) {
641
641
  this.updateFilter(evt.detail);
642
642
  }
643
+ /**
644
+ * Escuta quando há um filtro do tipo pesquisa retorna um valor vazio.
645
+ */
646
+ async emptySearchListener(_evt) {
647
+ await this.showPersonalizedFilterItem();
648
+ }
643
649
  /**
644
650
  * @description Abre o modal de filtros.
645
651
  * @async
@@ -650,6 +656,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
650
656
  }
651
657
  this.isFilterModalOpen = true;
652
658
  }
659
+ async showPersonalizedFilterItem() {
660
+ const popUp = this._element.querySelector('#filter-PERSONALIZED_FILTER_GROUP');
661
+ await (popUp === null || popUp === void 0 ? void 0 : popUp.showUp(true));
662
+ }
653
663
  addPersonalizedFilter(isDefault = false) {
654
664
  this.isFilterModalOpen = false;
655
665
  this._isDefaultFilter = isDefault;
@@ -772,7 +782,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
772
782
  "removeFilterItem": [64],
773
783
  "getFilters": [64],
774
784
  "showFilterModal": [64]
775
- }, [[0, "filterChange", "filterChangeListener"]]]);
785
+ }, [[0, "filterChange", "filterChangeListener"], [8, "ezEmptySearch", "emptySearchListener"]]]);
776
786
  function defineCustomElement() {
777
787
  if (typeof customElements === "undefined") {
778
788
  return;
@@ -24,10 +24,8 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
24
24
  /**
25
25
  * Emitido quando o estado do filtro é alterado.
26
26
  */
27
- filterChangeListener(event) {
27
+ filterChangeListener(_event) {
28
28
  this.hideDetail();
29
- // Re-emite o evento para o pai (snk-filter-bar)
30
- this.filterChange.emit(event.detail);
31
29
  }
32
30
  /**
33
31
  * Exibe os detalhes de um item da lista.
@@ -21,7 +21,8 @@ const SnkGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
21
21
  this._dataChanged = false;
22
22
  this._componenteInternalKey = Date.now();
23
23
  this.selectedIndex = 0;
24
- this.columns = undefined;
24
+ this.columns = [];
25
+ this.originalColumns = [];
25
26
  this.config = undefined;
26
27
  this.configName = undefined;
27
28
  this.resourceID = undefined;
@@ -359,7 +360,8 @@ const SnkGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
359
360
  const visibleGroup = this.buildVisibleGroup();
360
361
  const hiddenGroup = this.buildHiddenGroup();
361
362
  const visibleItemsMap = new Map();
362
- this.columns.forEach(column => {
363
+ const columnsToIterate = isEmptyConfig ? this.originalColumns : this.columns;
364
+ columnsToIterate.forEach(column => {
363
365
  const item = this.buildListItemFromColumn(column);
364
366
  if (isEmptyConfig || defaultVisibleCols.includes(column.name)) {
365
367
  visibleItemsMap.set(column.name, item);
@@ -407,6 +409,7 @@ const SnkGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
407
409
  }, [2, "snk-grid-config", {
408
410
  "selectedIndex": [1026, "selected-index"],
409
411
  "columns": [1040],
412
+ "originalColumns": [1040],
410
413
  "config": [1040],
411
414
  "configName": [1, "config-name"],
412
415
  "resourceID": [1, "resource-i-d"],
@@ -209,7 +209,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
209
209
  if (this._grid == undefined) {
210
210
  return;
211
211
  }
212
- this.openGridConfig();
212
+ await this.openGridConfig();
213
213
  }
214
214
  /**
215
215
  * Fecha a janela de configurações da grade.
@@ -349,12 +349,12 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
349
349
  handleAddFormMode() {
350
350
  return this.enableGridInsert ? TaskbarElement.FORM_MODE : '';
351
351
  }
352
- openGridConfig() {
353
- this._grid.getColumnsState()
354
- .then((gridColumns) => {
355
- this._snkGridConfig.columns = gridColumns.filter(c => c.name);
356
- this._popUpGridConfig = true;
357
- });
352
+ async openGridConfig() {
353
+ const originalColumns = await this._grid.getColumns();
354
+ const gridColumns = await this._grid.getColumnsState();
355
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
356
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
357
+ this._popUpGridConfig = true;
358
358
  }
359
359
  closeGridConfig() {
360
360
  this._popUpGridConfig = false;
@@ -298,22 +298,23 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
298
298
  }
299
299
  await this.loadFormConfig(true);
300
300
  }
301
- openConfig(viewMode) {
302
- this._snkConfigurator.close();
301
+ async openConfig(viewMode) {
302
+ await this._snkConfigurator.close();
303
303
  if (viewMode === VIEW_MODE.GRID) {
304
- this.openGridConfig();
304
+ await this.openGridConfig();
305
305
  }
306
306
  else if (viewMode === VIEW_MODE.FORM) {
307
- this.openFormConfig();
307
+ await this.openFormConfig();
308
308
  }
309
309
  }
310
- openGridConfig() {
311
- this._grid.getColumnsState()
312
- .then((gridColumns) => {
313
- this._snkGridConfig.columns = gridColumns.filter(c => c.name);
314
- this._snkGridConfig.selectedIndex = 0;
315
- this._showPopUpGridConfig = true;
316
- });
310
+ async openGridConfig() {
311
+ var _a, _b, _c, _d;
312
+ const originalColumns = (_b = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumns())) !== null && _b !== void 0 ? _b : [];
313
+ const gridColumns = (_d = await ((_c = this._grid) === null || _c === void 0 ? void 0 : _c.getColumnsState())) !== null && _d !== void 0 ? _d : [];
314
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
315
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
316
+ this._snkGridConfig.selectedIndex = 0;
317
+ this._showPopUpGridConfig = true;
317
318
  }
318
319
  async openFormConfig() {
319
320
  if (this.formLegacyConfigName || this.configName) {
@@ -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-3d5c4ae4.js';
7
+ import { P as PreloadManager } from './dataunit-fetcher-21c43ec7.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
9
  import './form-config-fetcher-fcc7b62f.js';
10
10
  import './constants-7b422de0.js';
@@ -920,7 +920,7 @@ class DataUnitFetcher {
920
920
  }
921
921
  metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
922
922
  });
923
- metadata.fields.sort((a, b) => a.order - b.order);
923
+ metadata.fields.sort((a, b) => this.sortFieldsByGroup(a, b));
924
924
  resolve(metadata);
925
925
  })
926
926
  .catch((error) => {
@@ -928,6 +928,28 @@ class DataUnitFetcher {
928
928
  });
929
929
  });
930
930
  }
931
+ // Os campos devem ser separados em dois grupos: campos da própria entidade e campos que representam ligação com outra entidade.
932
+ // Além do grupo, a ordenação deve respeitar o atributo "order" de cada campo.
933
+ // Para saber se é um campo de relação, verificamos se o nome contém '.' (ex: 'Parceiro.CODPAR').
934
+ sortFieldsByGroup(a, b) {
935
+ const aIsRelation = a.name.includes('.');
936
+ const bIsRelation = b.name.includes('.');
937
+ // Se um é relação e outro não, campos próprios vêm primeiro
938
+ if (aIsRelation !== bIsRelation) {
939
+ return aIsRelation ? 1 : -1;
940
+ }
941
+ // Se ambos são relações, ordena por nome da entidade primeiro
942
+ if (aIsRelation && bIsRelation) {
943
+ const aEntity = a.name.split('.')[0];
944
+ const bEntity = b.name.split('.')[0];
945
+ if (aEntity !== bEntity) {
946
+ return aEntity.localeCompare(bEntity);
947
+ }
948
+ }
949
+ // Dentro do mesmo grupo (próprios ou mesma entidade de relação), ordena por order
950
+ return a.order - b.order;
951
+ }
952
+ ;
931
953
  loadSelectDistinct(dataUnit, fieldName, argument) {
932
954
  const { parentRecordId, filters } = dataUnit.getLastLoadRequest() || {};
933
955
  const filteredFilters = filters.filter(f => f.name !== `${DISTINCT_FILTER_NAME_PREFIX}${fieldName}`);