@sankhyalabs/sankhyablocks 8.15.0-dev.13 → 8.15.0-dev.15

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 (64) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{pesquisa-fetcher-5e5a5386.js → pesquisa-fetcher-aa79cb86.js} +46 -25
  3. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  4. package/dist/cjs/snk-actions-button_2.cjs.entry.js +4 -2
  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-detail-view.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-filter-item.cjs.entry.js +1 -47
  10. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
  11. package/dist/cjs/{snk-guides-viewer-8fd9bd4a.js → snk-guides-viewer-ec2b8931.js} +1 -1
  12. package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  14. package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -2
  15. package/dist/collection/components/snk-application/snk-application.js +9 -9
  16. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +2 -1
  17. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +1 -47
  18. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
  19. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +53 -1
  20. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +3 -1
  21. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +17 -3
  22. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +29 -22
  23. package/dist/components/dataunit-fetcher.js +46 -25
  24. package/dist/components/snk-filter-item2.js +1 -47
  25. package/dist/components/snk-filter-multi-select.js +2 -1
  26. package/dist/components/snk-pesquisa2.js +1 -1
  27. package/dist/components/snk-simple-crud2.js +15 -1
  28. package/dist/components/taskbar-actions-button2.js +3 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/{pesquisa-fetcher-19ebe13d.js → pesquisa-fetcher-0282b820.js} +46 -25
  31. package/dist/esm/sankhyablocks.js +1 -1
  32. package/dist/esm/snk-actions-button_2.entry.js +4 -2
  33. package/dist/esm/snk-application.entry.js +1 -1
  34. package/dist/esm/snk-attach.entry.js +1 -1
  35. package/dist/esm/snk-crud.entry.js +1 -1
  36. package/dist/esm/snk-detail-view.entry.js +2 -2
  37. package/dist/esm/snk-filter-item.entry.js +1 -47
  38. package/dist/esm/snk-filter-multi-select.entry.js +2 -1
  39. package/dist/esm/{snk-guides-viewer-cfd10e2e.js → snk-guides-viewer-5423bd6a.js} +1 -1
  40. package/dist/esm/snk-guides-viewer.entry.js +2 -2
  41. package/dist/esm/snk-pesquisa.entry.js +1 -1
  42. package/dist/esm/snk-simple-crud.entry.js +14 -2
  43. package/dist/sankhyablocks/{p-275344d4.entry.js → p-0d223147.entry.js} +1 -1
  44. package/dist/sankhyablocks/{p-f5cedad2.entry.js → p-3207f15e.entry.js} +1 -1
  45. package/dist/sankhyablocks/p-68720af8.entry.js +1 -0
  46. package/dist/sankhyablocks/{p-8b457163.js → p-6ea1be5f.js} +1 -1
  47. package/dist/sankhyablocks/{p-37aec2c8.entry.js → p-86801b08.entry.js} +1 -1
  48. package/dist/sankhyablocks/{p-6892a25e.entry.js → p-87f9fbba.entry.js} +1 -1
  49. package/dist/sankhyablocks/{p-2ae6e426.entry.js → p-a969c590.entry.js} +1 -1
  50. package/dist/sankhyablocks/{p-1d6b75b7.js → p-b95d6b71.js} +3 -3
  51. package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
  52. package/dist/sankhyablocks/{p-5c063748.entry.js → p-cb3ef3c9.entry.js} +1 -1
  53. package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
  54. package/dist/sankhyablocks/{p-d299d975.entry.js → p-e61caf9e.entry.js} +1 -1
  55. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  56. package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
  57. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +0 -1
  58. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -1
  59. package/dist/types/components.d.ts +16 -0
  60. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +1 -0
  61. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +1 -0
  62. package/package.json +5 -5
  63. package/dist/sankhyablocks/p-20726710.entry.js +0 -1
  64. package/dist/sankhyablocks/p-ef0c0d08.entry.js +0 -1
@@ -2150,10 +2150,6 @@ export class SnkApplication {
2150
2150
  "Promise": {
2151
2151
  "location": "global"
2152
2152
  },
2153
- "IOption": {
2154
- "location": "import",
2155
- "path": "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search"
2156
- },
2157
2153
  "ISearchArgument": {
2158
2154
  "location": "import",
2159
2155
  "path": "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search"
@@ -2165,12 +2161,16 @@ export class SnkApplication {
2165
2161
  "Array": {
2166
2162
  "location": "global"
2167
2163
  },
2164
+ "IOption": {
2165
+ "location": "import",
2166
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search"
2167
+ },
2168
2168
  "SearchCriteria": {
2169
2169
  "location": "import",
2170
2170
  "path": "../../lib/http/data-fetcher/fetchers/pesquisa-fetcher"
2171
2171
  }
2172
2172
  },
2173
- "return": "Promise<IOption | IOption[]>"
2173
+ "return": "Promise<any>"
2174
2174
  },
2175
2175
  "docs": {
2176
2176
  "text": "Obt\u00E9m as op\u00E7\u00F5es em componentes de pesquisa\nEx.: snk-config-options",
@@ -2194,18 +2194,18 @@ export class SnkApplication {
2194
2194
  "Promise": {
2195
2195
  "location": "global"
2196
2196
  },
2197
+ "Array": {
2198
+ "location": "global"
2199
+ },
2197
2200
  "IOption": {
2198
2201
  "location": "import",
2199
2202
  "path": "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search"
2200
2203
  },
2201
- "Array": {
2202
- "location": "global"
2203
- },
2204
2204
  "HTMLSnkPesquisaElement": {
2205
2205
  "location": "global"
2206
2206
  }
2207
2207
  },
2208
- "return": "Promise<IOption | IOption[]>"
2208
+ "return": "Promise<any>"
2209
2209
  },
2210
2210
  "docs": {
2211
2211
  "text": "Obt\u00E9m as op\u00E7\u00F5es em componentes de pesquisa\nEx.: snk-config-options",
@@ -10,7 +10,8 @@ export class SnkFilterMultiSelect {
10
10
  * Emitido quando acontece a alteração de valor do componente snk-filter-multi-select
11
11
  */
12
12
  ezChangeListener(evt) {
13
- this.value = evt.detail.value;
13
+ var _a;
14
+ this.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value;
14
15
  this.valueChanged.emit(this.value);
15
16
  }
16
17
  /**
@@ -287,14 +287,9 @@ export class SnkFilterItem {
287
287
  }
288
288
  return this.hasActiveValue(this.config);
289
289
  }
290
- onEzClick() {
291
- console.log("onEzClick");
292
- }
293
290
  render() {
294
291
  const leftIcon = this.getLeftIconName();
295
- return (h(Host, null, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("ez-split-button", { label: "Split Button", class: "ez-button--primary", mode: "label-icon", iconName: "acao", size: "small", onEzClick: this.onEzClick,
296
- //onclick={this.onEzClick}
297
- items: items }), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
292
+ return (h(Host, null, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
298
293
  }
299
294
  static get is() { return "snk-filter-item"; }
300
295
  static get properties() {
@@ -445,44 +440,3 @@ export class SnkFilterItem {
445
440
  }];
446
441
  }
447
442
  }
448
- const items = [
449
- {
450
- id: "1",
451
- label: "Emitir NFe",
452
- type: "item"
453
- },
454
- {
455
- id: "2",
456
- label: "Cancelar NFe",
457
- type: "item"
458
- },
459
- {
460
- id: "3",
461
- label: "Exportar NFe",
462
- type: "item",
463
- children: [
464
- {
465
- id: "4",
466
- label: "Danfe PDF",
467
- type: "item",
468
- children: [
469
- {
470
- id: "6",
471
- label: "Modo retrato",
472
- type: "item"
473
- },
474
- {
475
- id: "7",
476
- label: "Modo paisagem",
477
- type: "item"
478
- }
479
- ]
480
- },
481
- {
482
- id: "5",
483
- label: "XML",
484
- type: "item"
485
- }
486
- ]
487
- }
488
- ];
@@ -6,7 +6,7 @@
6
6
  --snk-pesquisa--font-family: var(--font-pattern, Arial);
7
7
  /*@doc Define o peso da fonte do componente.*/
8
8
  --snk-pesquisa--font-weight: var(--text-weight--medium, 400);
9
-
9
+
10
10
  /* records */
11
11
  /*@doc Define a cor da fonte do indicador de registros do componente.*/
12
12
  --snk-pesquisa__records--color: var(--text--primary, #626e82);
@@ -39,7 +39,6 @@
39
39
  /*@doc Define a largura da barra de rolagem do componente.*/
40
40
  --snk-pesquisa__scrollbar--width: var(--space--medium, 12px);
41
41
 
42
- max-height: 100%;
43
42
  height: 100%;
44
43
  display: flex;
45
44
  flex-direction: column;
@@ -70,7 +69,6 @@
70
69
  .snk-pesquisa__content {
71
70
  display: flex;
72
71
  flex-direction: column;
73
- height: 100%;
74
72
  overflow-y: auto;
75
73
  scrollbar-width: thin;
76
74
 
@@ -148,4 +146,4 @@
148
146
  .snk-pesquisa__btn:hover {
149
147
  /*public*/
150
148
  color: var(--snk-pesquisa__btn-hover--color);
151
- }
149
+ }
@@ -34,6 +34,8 @@ export class SnkSimpleCrud {
34
34
  this.taskbarManager = undefined;
35
35
  this.messagesBuilder = undefined;
36
36
  this.useEnterLikeTab = false;
37
+ this.actionsList = undefined;
38
+ this.configName = undefined;
37
39
  }
38
40
  resolveInMemoryBtns(taskbarButtons) {
39
41
  const newTaskBarConfig = [...taskbarButtons];
@@ -232,7 +234,7 @@ export class SnkSimpleCrud {
232
234
  }
233
235
  getActionsList() {
234
236
  var _a, _b;
235
- return [{
237
+ const hardList = [{
236
238
  value: StringUtils.generateUUID(),
237
239
  label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
238
240
  disableCloseOnSelect: true,
@@ -241,6 +243,16 @@ export class SnkSimpleCrud {
241
243
  ? this.getColumnSearch(actionButton, item)
242
244
  : this.getFieldSearch(actionButton, item)
243
245
  }];
246
+ if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
247
+ const taskbarID = this.getTopTaskBarId();
248
+ return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
249
+ }
250
+ return hardList.concat(this.actionsList);
251
+ }
252
+ getTopTaskBarId() {
253
+ var _a;
254
+ return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${PresentationMode.PRIMARY}` :
255
+ `snkGridTopTaskbar.regular${PresentationMode.PRIMARY}`;
244
256
  }
245
257
  async keyDownListener(event) {
246
258
  if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
@@ -494,6 +506,46 @@ export class SnkSimpleCrud {
494
506
  "attribute": "use-enter-like-tab",
495
507
  "reflect": false,
496
508
  "defaultValue": "false"
509
+ },
510
+ "actionsList": {
511
+ "type": "unknown",
512
+ "mutable": false,
513
+ "complexType": {
514
+ "original": "Array<Action>",
515
+ "resolved": "Action[]",
516
+ "references": {
517
+ "Array": {
518
+ "location": "global"
519
+ },
520
+ "Action": {
521
+ "location": "import",
522
+ "path": "../snk-taskbar/snk-taskbar"
523
+ }
524
+ }
525
+ },
526
+ "required": false,
527
+ "optional": false,
528
+ "docs": {
529
+ "tags": [],
530
+ "text": "A\u00E7\u00F5es a serem colocadas no bot\u00E3o \"Mais op\u00E7\u00F5es\" do componente snk-taskbar."
531
+ }
532
+ },
533
+ "configName": {
534
+ "type": "string",
535
+ "mutable": true,
536
+ "complexType": {
537
+ "original": "string",
538
+ "resolved": "string",
539
+ "references": {}
540
+ },
541
+ "required": false,
542
+ "optional": false,
543
+ "docs": {
544
+ "tags": [],
545
+ "text": "Usado para salvar as configura\u00E7\u00F5es dos blocos de constru\u00E7\u00E3o."
546
+ },
547
+ "attribute": "config-name",
548
+ "reflect": false
497
549
  }
498
550
  };
499
551
  }
@@ -67,7 +67,7 @@ export class TaskbarActionsButton {
67
67
  }
68
68
  }
69
69
  getSelectedAction(id, actions) {
70
- let selectedItem;
70
+ let selectedItem = null;
71
71
  for (const item of actions) {
72
72
  if (item.id === id) {
73
73
  selectedItem = item;
@@ -76,6 +76,8 @@ export class TaskbarActionsButton {
76
76
  if (!(item === null || item === void 0 ? void 0 : item.children))
77
77
  continue;
78
78
  selectedItem = this.getSelectedAction(id, item.children);
79
+ if (selectedItem)
80
+ break;
79
81
  }
80
82
  return selectedItem;
81
83
  }
@@ -184,15 +184,29 @@ export default class DataUnitFetcher {
184
184
  });
185
185
  return updatingFields;
186
186
  }
187
+ getUpdatingFields(dataUnit, originalUpdatingFields) {
188
+ if (originalUpdatingFields == undefined) {
189
+ return;
190
+ }
191
+ const updatingFields = Object.assign({}, originalUpdatingFields);
192
+ Object.keys(updatingFields).forEach(key => {
193
+ const descriptor = dataUnit.getField(key);
194
+ if (descriptor != undefined && descriptor.standAlone) {
195
+ delete updatingFields[key];
196
+ }
197
+ });
198
+ return this.addTransientProperties(dataUnit, updatingFields);
199
+ }
187
200
  saveData(dataUnit, duChanges) {
188
201
  const updatedRecordsIds = [];
189
202
  const addedRecordsIds = [];
190
203
  const changes = duChanges.map((change) => {
191
- const { dataUnit: changeDU, record, updatingFields, operation } = change;
204
+ const { dataUnit: changeDU, record, operation } = change;
192
205
  const dataUnitInstance = DataUnitStorage.get(changeDU);
206
+ const updatingFields = this.getUpdatingFields(dataUnitInstance, change.updatingFields);
193
207
  let parsedUpdatingFields;
194
- if (updatingFields) {
195
- parsedUpdatingFields = Object.entries(this.addTransientProperties(dataUnit, updatingFields)).map(([fieldName, value]) => {
208
+ if (updatingFields != undefined) {
209
+ parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
196
210
  const descriptor = dataUnitInstance.getField(fieldName);
197
211
  const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
198
212
  return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
@@ -6,30 +6,39 @@ export class DatasetStrategy {
6
6
  canSlice() {
7
7
  return false;
8
8
  }
9
+ processSortingSide(request, dataUnit, serverSideFilters) {
10
+ const localSorting = [];
11
+ const serverSorting = [];
12
+ if (request.sort != undefined) {
13
+ if (serverSideFilters.length === 0) {
14
+ return { localSorting: request.sort, serverSorting: [] };
15
+ }
16
+ for (const sort of request.sort) {
17
+ const descriptor = dataUnit.getField(sort.field);
18
+ const local = descriptor != undefined
19
+ && descriptor.properties != undefined
20
+ && descriptor.properties.calculated === "true";
21
+ if (local) {
22
+ localSorting.push(sort);
23
+ }
24
+ else {
25
+ serverSorting.push(sort);
26
+ }
27
+ }
28
+ }
29
+ return { localSorting, serverSorting };
30
+ }
9
31
  async load(dataUnit, request, loadingInfo) {
32
+ var _a, _b;
10
33
  if (dataUnit.metadata == undefined) {
11
34
  return Promise.resolve({ records: [], loadingInfo });
12
35
  }
13
36
  try {
14
- const localSorting = [];
15
- const serverSorting = [];
16
- if (request.sort != undefined) {
17
- for (const sort of request.sort) {
18
- const descriptor = dataUnit.getField(sort.field);
19
- const local = descriptor != undefined
20
- && descriptor.properties != undefined
21
- && descriptor.properties.calculated === "true";
22
- if (local) {
23
- localSorting.push(sort);
24
- }
25
- else {
26
- serverSorting.push(sort);
27
- }
28
- }
29
- }
37
+ const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
38
+ const { localSorting, serverSorting } = this.processSortingSide(request, dataUnit, serverSideFilters);
30
39
  const fields = this.getFieldsList(dataUnit);
31
40
  const serviceName = "DatasetSP.loadRecords";
32
- const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting);
41
+ const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting, serverSideFilters);
33
42
  const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
34
43
  const { result: responseRecords, pagerID: pagerId } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
35
44
  const records = this.processRecords(dataUnit, fields, responseRecords);
@@ -73,7 +82,7 @@ export class DatasetStrategy {
73
82
  }
74
83
  return [descriptor.name, descriptionField];
75
84
  }
76
- buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting) {
85
+ buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting, serverSideFilters) {
77
86
  const dataSetID = dataUnit.dataUnitId;
78
87
  const dataUnitName = dataUnit.name;
79
88
  const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
@@ -92,7 +101,7 @@ export class DatasetStrategy {
92
101
  tryJoinedFields: true,
93
102
  parallelLoader: useParallelLoader,
94
103
  crudListener: `br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,
95
- txProperties: this.getTxProperties(dataUnit, request, sorting),
104
+ txProperties: this.getTxProperties(dataUnit, request, sorting, serverSideFilters),
96
105
  useDefaultRowsLimit: false
97
106
  }
98
107
  };
@@ -103,12 +112,10 @@ export class DatasetStrategy {
103
112
  const moduleName = app.getModuleName();
104
113
  return moduleName.replace("-bff", "");
105
114
  }
106
- getTxProperties(dataUnit, request, sorting) {
107
- var _a, _b;
115
+ getTxProperties(dataUnit, request, sorting, serverSideFilters) {
108
116
  const txProperties = {
109
117
  "__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnit.name
110
118
  };
111
- const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
112
119
  if (serverSideFilters.length !== 0) {
113
120
  txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
114
121
  }
@@ -537,30 +537,39 @@ class DatasetStrategy {
537
537
  canSlice() {
538
538
  return false;
539
539
  }
540
+ processSortingSide(request, dataUnit, serverSideFilters) {
541
+ const localSorting = [];
542
+ const serverSorting = [];
543
+ if (request.sort != undefined) {
544
+ if (serverSideFilters.length === 0) {
545
+ return { localSorting: request.sort, serverSorting: [] };
546
+ }
547
+ for (const sort of request.sort) {
548
+ const descriptor = dataUnit.getField(sort.field);
549
+ const local = descriptor != undefined
550
+ && descriptor.properties != undefined
551
+ && descriptor.properties.calculated === "true";
552
+ if (local) {
553
+ localSorting.push(sort);
554
+ }
555
+ else {
556
+ serverSorting.push(sort);
557
+ }
558
+ }
559
+ }
560
+ return { localSorting, serverSorting };
561
+ }
540
562
  async load(dataUnit, request, loadingInfo) {
563
+ var _a, _b;
541
564
  if (dataUnit.metadata == undefined) {
542
565
  return Promise.resolve({ records: [], loadingInfo });
543
566
  }
544
567
  try {
545
- const localSorting = [];
546
- const serverSorting = [];
547
- if (request.sort != undefined) {
548
- for (const sort of request.sort) {
549
- const descriptor = dataUnit.getField(sort.field);
550
- const local = descriptor != undefined
551
- && descriptor.properties != undefined
552
- && descriptor.properties.calculated === "true";
553
- if (local) {
554
- localSorting.push(sort);
555
- }
556
- else {
557
- serverSorting.push(sort);
558
- }
559
- }
560
- }
568
+ const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
569
+ const { localSorting, serverSorting } = this.processSortingSide(request, dataUnit, serverSideFilters);
561
570
  const fields = this.getFieldsList(dataUnit);
562
571
  const serviceName = "DatasetSP.loadRecords";
563
- const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting);
572
+ const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting, serverSideFilters);
564
573
  const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
565
574
  const { result: responseRecords, pagerID: pagerId } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
566
575
  const records = this.processRecords(dataUnit, fields, responseRecords);
@@ -604,7 +613,7 @@ class DatasetStrategy {
604
613
  }
605
614
  return [descriptor.name, descriptionField];
606
615
  }
607
- buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting) {
616
+ buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting, serverSideFilters) {
608
617
  const dataSetID = dataUnit.dataUnitId;
609
618
  const dataUnitName = dataUnit.name;
610
619
  const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
@@ -623,7 +632,7 @@ class DatasetStrategy {
623
632
  tryJoinedFields: true,
624
633
  parallelLoader: useParallelLoader,
625
634
  crudListener: `br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,
626
- txProperties: this.getTxProperties(dataUnit, request, sorting),
635
+ txProperties: this.getTxProperties(dataUnit, request, sorting, serverSideFilters),
627
636
  useDefaultRowsLimit: false
628
637
  }
629
638
  };
@@ -634,12 +643,10 @@ class DatasetStrategy {
634
643
  const moduleName = app.getModuleName();
635
644
  return moduleName.replace("-bff", "");
636
645
  }
637
- getTxProperties(dataUnit, request, sorting) {
638
- var _a, _b;
646
+ getTxProperties(dataUnit, request, sorting, serverSideFilters) {
639
647
  const txProperties = {
640
648
  "__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnit.name
641
649
  };
642
- const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
643
650
  if (serverSideFilters.length !== 0) {
644
651
  txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
645
652
  }
@@ -998,15 +1005,29 @@ class DataUnitFetcher {
998
1005
  });
999
1006
  return updatingFields;
1000
1007
  }
1008
+ getUpdatingFields(dataUnit, originalUpdatingFields) {
1009
+ if (originalUpdatingFields == undefined) {
1010
+ return;
1011
+ }
1012
+ const updatingFields = Object.assign({}, originalUpdatingFields);
1013
+ Object.keys(updatingFields).forEach(key => {
1014
+ const descriptor = dataUnit.getField(key);
1015
+ if (descriptor != undefined && descriptor.standAlone) {
1016
+ delete updatingFields[key];
1017
+ }
1018
+ });
1019
+ return this.addTransientProperties(dataUnit, updatingFields);
1020
+ }
1001
1021
  saveData(dataUnit, duChanges) {
1002
1022
  const updatedRecordsIds = [];
1003
1023
  const addedRecordsIds = [];
1004
1024
  const changes = duChanges.map((change) => {
1005
- const { dataUnit: changeDU, record, updatingFields, operation } = change;
1025
+ const { dataUnit: changeDU, record, operation } = change;
1006
1026
  const dataUnitInstance = DataUnitStorage.get(changeDU);
1027
+ const updatingFields = this.getUpdatingFields(dataUnitInstance, change.updatingFields);
1007
1028
  let parsedUpdatingFields;
1008
- if (updatingFields) {
1009
- parsedUpdatingFields = Object.entries(this.addTransientProperties(dataUnit, updatingFields)).map(([fieldName, value]) => {
1029
+ if (updatingFields != undefined) {
1030
+ parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
1010
1031
  const descriptor = dataUnitInstance.getField(fieldName);
1011
1032
  const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
1012
1033
  return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
@@ -293,14 +293,9 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
293
293
  }
294
294
  return this.hasActiveValue(this.config);
295
295
  }
296
- onEzClick() {
297
- console.log("onEzClick");
298
- }
299
296
  render() {
300
297
  const leftIcon = this.getLeftIconName();
301
- return (h(Host, null, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("ez-split-button", { label: "Split Button", class: "ez-button--primary", mode: "label-icon", iconName: "acao", size: "small", onEzClick: this.onEzClick,
302
- //onclick={this.onEzClick}
303
- items: items }), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
298
+ return (h(Host, null, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
304
299
  }
305
300
  get _filterItemElement() { return this; }
306
301
  static get watchers() { return {
@@ -313,47 +308,6 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
313
308
  "showUp": [64],
314
309
  "hideDetail": [64]
315
310
  }, [[2, "click", "clickListener"], [2, "mousedown", "mouseDownListener"], [0, "filterChange", "filterChangeListener"]]]);
316
- const items = [
317
- {
318
- id: "1",
319
- label: "Emitir NFe",
320
- type: "item"
321
- },
322
- {
323
- id: "2",
324
- label: "Cancelar NFe",
325
- type: "item"
326
- },
327
- {
328
- id: "3",
329
- label: "Exportar NFe",
330
- type: "item",
331
- children: [
332
- {
333
- id: "4",
334
- label: "Danfe PDF",
335
- type: "item",
336
- children: [
337
- {
338
- id: "6",
339
- label: "Modo retrato",
340
- type: "item"
341
- },
342
- {
343
- id: "7",
344
- label: "Modo paisagem",
345
- type: "item"
346
- }
347
- ]
348
- },
349
- {
350
- id: "5",
351
- label: "XML",
352
- type: "item"
353
- }
354
- ]
355
- }
356
- ];
357
311
  function defineCustomElement() {
358
312
  if (typeof customElements === "undefined") {
359
313
  return;
@@ -14,7 +14,8 @@ const SnkFilterMultiSelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
14
14
  * Emitido quando acontece a alteração de valor do componente snk-filter-multi-select
15
15
  */
16
16
  ezChangeListener(evt) {
17
- this.value = evt.detail.value;
17
+ var _a;
18
+ this.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value;
18
19
  this.valueChanged.emit(this.value);
19
20
  }
20
21
  /**
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { ObjectUtils, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
3
3
 
4
- const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--medium, 12px);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__scrollbar--color-background);width:var(--snk-pesquisa__scrollbar--width);max-width:var(--snk-pesquisa__scrollbar--width);min-width:var(--snk-pesquisa__scrollbar--width)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__scrollbar--color-background);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__scrollbar--color-default);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:hover,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-pesquisa__scrollbar--color-hover)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:active,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-pesquisa__scrollbar--color-clicked)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
4
+ const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--medium, 12px);height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__scrollbar--color-background);width:var(--snk-pesquisa__scrollbar--width);max-width:var(--snk-pesquisa__scrollbar--width);min-width:var(--snk-pesquisa__scrollbar--width)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__scrollbar--color-background);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__scrollbar--color-default);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:hover,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-pesquisa__scrollbar--color-hover)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:active,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-pesquisa__scrollbar--color-clicked)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
5
5
 
6
6
  const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -51,6 +51,8 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
51
51
  this.taskbarManager = undefined;
52
52
  this.messagesBuilder = undefined;
53
53
  this.useEnterLikeTab = false;
54
+ this.actionsList = undefined;
55
+ this.configName = undefined;
54
56
  }
55
57
  resolveInMemoryBtns(taskbarButtons) {
56
58
  const newTaskBarConfig = [...taskbarButtons];
@@ -249,7 +251,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
249
251
  }
250
252
  getActionsList() {
251
253
  var _a, _b;
252
- return [{
254
+ const hardList = [{
253
255
  value: StringUtils.generateUUID(),
254
256
  label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
255
257
  disableCloseOnSelect: true,
@@ -258,6 +260,16 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
258
260
  ? this.getColumnSearch(actionButton, item)
259
261
  : this.getFieldSearch(actionButton, item)
260
262
  }];
263
+ if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
264
+ const taskbarID = this.getTopTaskBarId();
265
+ return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
266
+ }
267
+ return hardList.concat(this.actionsList);
268
+ }
269
+ getTopTaskBarId() {
270
+ var _a;
271
+ return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${PresentationMode.PRIMARY}` :
272
+ `snkGridTopTaskbar.regular${PresentationMode.PRIMARY}`;
261
273
  }
262
274
  async keyDownListener(event) {
263
275
  if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
@@ -319,6 +331,8 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
319
331
  "taskbarManager": [16],
320
332
  "messagesBuilder": [1040],
321
333
  "useEnterLikeTab": [4, "use-enter-like-tab"],
334
+ "actionsList": [16],
335
+ "configName": [1025, "config-name"],
322
336
  "_currentViewMode": [32],
323
337
  "_config": [32],
324
338
  "_fieldToGetFocus": [32],
@@ -75,7 +75,7 @@ const TaskbarActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTML
75
75
  }
76
76
  }
77
77
  getSelectedAction(id, actions) {
78
- let selectedItem;
78
+ let selectedItem = null;
79
79
  for (const item of actions) {
80
80
  if (item.id === id) {
81
81
  selectedItem = item;
@@ -84,6 +84,8 @@ const TaskbarActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTML
84
84
  if (!(item === null || item === void 0 ? void 0 : item.children))
85
85
  continue;
86
86
  selectedItem = this.getSelectedAction(id, item.children);
87
+ if (selectedItem)
88
+ break;
87
89
  }
88
90
  return selectedItem;
89
91
  }