@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76031.1 → 0.0.0-bugfix-dev-KB-81512.2

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 (91) hide show
  1. package/dist/cjs/{ContinuousInsertUtils-2718aaaa.js → ContinuousInsertUtils-e9454466.js} +2 -2
  2. package/dist/cjs/{dataunit-fetcher-c32fdff7.js → dataunit-fetcher-8ea97d88.js} +17 -171
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{pesquisa-fetcher-3b86b6c4.js → pesquisa-fetcher-8a4857b5.js} +5 -6
  5. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +12 -34
  6. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  7. package/dist/cjs/snk-actions-button_5.cjs.entry.js +2 -2
  8. package/dist/cjs/snk-application.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  10. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  12. package/dist/cjs/{snk-data-unit-2c7c1964.js → snk-data-unit-72ef8777.js} +1 -1
  13. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
  15. package/dist/cjs/snk-grid.cjs.entry.js +3 -3
  16. package/dist/cjs/{snk-guides-viewer-266339d2.js → snk-guides-viewer-0a547d11.js} +2 -2
  17. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  18. package/dist/cjs/snk-pesquisa.cjs.entry.js +35 -22
  19. package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -8
  21. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +1 -0
  22. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +5 -41
  23. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +1 -4
  24. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +7 -36
  25. package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +4 -6
  26. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +0 -10
  27. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +34 -22
  28. package/dist/collection/components/snk-taskbar/snk-taskbar.js +3 -9
  29. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +12 -57
  30. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +8 -9
  31. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -0
  32. package/dist/components/ISave.js +6 -7
  33. package/dist/components/dataunit-fetcher.js +17 -171
  34. package/dist/components/pesquisa-grid2.js +6 -21
  35. package/dist/components/pesquisa-tree2.js +6 -15
  36. package/dist/components/snk-pesquisa2.js +35 -23
  37. package/dist/components/snk-taskbar2.js +3 -9
  38. package/dist/esm/{ContinuousInsertUtils-deb7767f.js → ContinuousInsertUtils-c599f41b.js} +2 -2
  39. package/dist/esm/{dataunit-fetcher-26c2bed4.js → dataunit-fetcher-8dd93d8b.js} +17 -171
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/{pesquisa-fetcher-767abffa.js → pesquisa-fetcher-3b206fe3.js} +6 -7
  42. package/dist/esm/pesquisa-grid_2.entry.js +12 -34
  43. package/dist/esm/sankhyablocks.js +1 -1
  44. package/dist/esm/snk-actions-button_5.entry.js +2 -2
  45. package/dist/esm/snk-application.entry.js +2 -2
  46. package/dist/esm/snk-attach.entry.js +2 -2
  47. package/dist/esm/snk-crud.entry.js +2 -2
  48. package/dist/esm/snk-data-exporter.entry.js +3 -3
  49. package/dist/esm/{snk-data-unit-a36df23f.js → snk-data-unit-11a49fc3.js} +1 -1
  50. package/dist/esm/snk-data-unit.entry.js +2 -2
  51. package/dist/esm/snk-detail-view.entry.js +3 -3
  52. package/dist/esm/snk-grid.entry.js +3 -3
  53. package/dist/esm/{snk-guides-viewer-9f03a9a0.js → snk-guides-viewer-a87a4639.js} +2 -2
  54. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  55. package/dist/esm/snk-pesquisa.entry.js +35 -22
  56. package/dist/esm/snk-simple-crud.entry.js +3 -3
  57. package/dist/esm/snk-taskbar.entry.js +3 -9
  58. package/dist/sankhyablocks/{p-9cec99d8.entry.js → p-07f40d74.entry.js} +1 -1
  59. package/dist/sankhyablocks/{p-045398fb.entry.js → p-1a91d1f3.entry.js} +1 -1
  60. package/dist/sankhyablocks/{p-1f17a44e.entry.js → p-4b85ab68.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-18f58d73.js → p-4d3e557b.js} +1 -1
  62. package/dist/sankhyablocks/p-500f7114.js +6 -0
  63. package/dist/sankhyablocks/{p-86fc5865.js → p-5b5e877f.js} +1 -1
  64. package/dist/sankhyablocks/{p-70ae0779.js → p-60e4db34.js} +1 -1
  65. package/dist/sankhyablocks/{p-28ca3908.entry.js → p-619aeac8.entry.js} +1 -1
  66. package/dist/sankhyablocks/{p-b896f0df.entry.js → p-7b5f24ec.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-d3a44f8f.entry.js → p-ad5ae3ef.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-5dbed7b4.entry.js → p-b1e0fcdd.entry.js} +1 -1
  69. package/dist/sankhyablocks/{p-09b4a36b.entry.js → p-bd2e8377.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-aa3ead06.entry.js → p-c691d03b.entry.js} +1 -1
  71. package/dist/sankhyablocks/{p-9070bfe3.entry.js → p-cc8b7b73.entry.js} +1 -1
  72. package/dist/sankhyablocks/p-ddefbbc7.js +60 -0
  73. package/dist/sankhyablocks/p-ef0e94b9.entry.js +1 -0
  74. package/dist/sankhyablocks/p-ef566451.entry.js +1 -0
  75. package/dist/sankhyablocks/{p-0d2c8bc8.entry.js → p-f1120c28.entry.js} +1 -1
  76. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  77. package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +5 -11
  78. package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +4 -8
  79. package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +1 -6
  80. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +6 -5
  81. package/dist/types/components.d.ts +2 -18
  82. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +1 -9
  83. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +0 -4
  84. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +3 -3
  85. package/package.json +1 -1
  86. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.js +0 -108
  87. package/dist/sankhyablocks/p-07583bae.entry.js +0 -1
  88. package/dist/sankhyablocks/p-4fe8bb73.js +0 -6
  89. package/dist/sankhyablocks/p-78d49c74.js +0 -60
  90. package/dist/sankhyablocks/p-800a8209.entry.js +0 -1
  91. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.d.ts +0 -6
@@ -5,20 +5,12 @@ export class PesquisaTree {
5
5
  this.treeLoader = undefined;
6
6
  this.argument = undefined;
7
7
  this.allowsNonAnalytic = false;
8
- this.shouldLoadTree = false;
9
8
  this.items = [];
10
9
  }
11
10
  async applyFilter() {
12
11
  await this._tree.applyFilter(this.argument);
13
12
  }
14
- async observeShouldLoadTree(newValue) {
15
- if (!newValue || this.items.length > 0)
16
- return;
17
- await this.loadTree();
18
- }
19
13
  async loadTree() {
20
- if (!this.shouldLoadTree)
21
- return;
22
14
  if (!this.treeLoader || typeof this.treeLoader !== 'function')
23
15
  return;
24
16
  const response = await this.treeLoader((this.argument || '').trim());
@@ -47,13 +39,16 @@ export class PesquisaTree {
47
39
  };
48
40
  this.pesquisaTreeSelectItem.emit(option);
49
41
  }
50
- renderEmptyMessage() {
42
+ async componentWillLoad() {
43
+ await this.loadTree();
44
+ }
45
+ renderEmptyMessate() {
51
46
  return (h("div", { class: "ez-flex ez-flex--justify-center ez-flex--align-items-center ez-margin--large ez-text ez-text--xlarge ez-text--secondary" }, h("span", null, "Nenhum registro encontrado...")));
52
47
  }
53
48
  render() {
54
49
  var _a;
55
50
  return (h(Host, null, !((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) ?
56
- this.renderEmptyMessage() :
51
+ this.renderEmptyMessate() :
57
52
  h(Fragment, null, h("div", { class: 'actions-container' }, h("ez-button", { size: 'small', mode: 'icon', class: 'ez-margin-right--small', iconName: 'show-list', title: "Expandir", onClick: () => this.handleExpandAll() }), h("ez-button", { size: 'small', mode: 'icon', iconName: 'hide-list', title: "Recolher", onClick: () => this.handleCloseAll() })), h("ez-tree", { ref: (element) => this._tree = element, onEzDbClickItem: ({ detail }) => this.handleDbClick(detail), items: this.items }))));
58
53
  }
59
54
  static get is() { return "pesquisa-tree"; }
@@ -85,7 +80,7 @@ export class PesquisaTree {
85
80
  },
86
81
  "ITreeItem": {
87
82
  "location": "import",
88
- "path": "@sankhyalabs/ezui/src/components/ez-tree/interfaces/ITreeItem"
83
+ "path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-tree/interfaces/ITreeItem"
89
84
  }
90
85
  }
91
86
  },
@@ -130,24 +125,6 @@ export class PesquisaTree {
130
125
  "attribute": "allows-non-analytic",
131
126
  "reflect": false,
132
127
  "defaultValue": "false"
133
- },
134
- "shouldLoadTree": {
135
- "type": "boolean",
136
- "mutable": false,
137
- "complexType": {
138
- "original": "boolean",
139
- "resolved": "boolean",
140
- "references": {}
141
- },
142
- "required": false,
143
- "optional": false,
144
- "docs": {
145
- "tags": [],
146
- "text": "Informa se a \u00E1rvore hier\u00E1rquica deve ou n\u00E3o ser carregada."
147
- },
148
- "attribute": "should-load-tree",
149
- "reflect": false,
150
- "defaultValue": "false"
151
128
  }
152
129
  };
153
130
  }
@@ -173,7 +150,7 @@ export class PesquisaTree {
173
150
  "references": {
174
151
  "IOption": {
175
152
  "location": "import",
176
- "path": "@sankhyalabs/ezui/src/components/ez-search/ez-search"
153
+ "path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-combo-box/ez-combo-box"
177
154
  }
178
155
  }
179
156
  }
@@ -199,10 +176,4 @@ export class PesquisaTree {
199
176
  }
200
177
  };
201
178
  }
202
- static get watchers() {
203
- return [{
204
- "propName": "shouldLoadTree",
205
- "methodName": "observeShouldLoadTree"
206
- }];
207
- }
208
179
  }
@@ -55,6 +55,8 @@ function buildUserInterface(field) {
55
55
  return UserInterface.DATETIME;
56
56
  if (field['type'] === 'T')
57
57
  return UserInterface.TIME;
58
+ if (field['type'] === 'I')
59
+ return UserInterface.INTEGERNUMBER;
58
60
  return undefined;
59
61
  }
60
62
  function buildDataType(rawType) {
@@ -66,6 +68,8 @@ function buildDataType(rawType) {
66
68
  return DataType.DATE;
67
69
  case 'B':
68
70
  return DataType.OBJECT;
71
+ case 'I':
72
+ return DataType.NUMBER;
69
73
  default:
70
74
  return DataType.TEXT;
71
75
  }
@@ -87,9 +91,3 @@ export function parseGridConfig(rawConfig) {
87
91
  return undefined;
88
92
  return { columns };
89
93
  }
90
- export var PESQUISA_VIEW_MODE;
91
- (function (PESQUISA_VIEW_MODE) {
92
- PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["GRID"] = 0] = "GRID";
93
- PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["CARDS"] = 1] = "CARDS";
94
- PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["TREE"] = 2] = "TREE";
95
- })(PESQUISA_VIEW_MODE || (PESQUISA_VIEW_MODE = {}));
@@ -79,7 +79,6 @@
79
79
  /*public*/
80
80
  scrollbar-color: var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);
81
81
  padding-right: var(--snk-pesquisa__content--padding-right);
82
- height: 100vh;
83
82
  }
84
83
 
85
84
  .snk-pesquisa__content::-webkit-scrollbar {
@@ -126,10 +125,6 @@
126
125
  padding-top: var(--snk-pesquisa__records--padding-vertical);
127
126
  }
128
127
 
129
- .snk-pesquisa__records-label.hidden{
130
- display: none;
131
- }
132
-
133
128
  .snk-pesquisa__records {
134
129
  color: var(--snk-pesquisa__records--color);
135
130
  }
@@ -171,8 +166,3 @@
171
166
  /*public*/
172
167
  color: var(--snk-pesquisa__btn-hover--color);
173
168
  }
174
-
175
- .snk-pesquisa__cards-container{
176
- height: 100%;
177
- overflow-y: auto;
178
- }
@@ -1,7 +1,8 @@
1
1
  import { ElementIDUtils, ObjectUtils, StringUtils } from '@sankhyalabs/core';
2
2
  import { h, Host } from '@stencil/core';
3
- import { buildGridMetadata, PESQUISA_VIEW_MODE } from './pesquisaHelper';
3
+ import { buildGridMetadata } from './pesquisaHelper';
4
4
  import { PesquisaFetcher } from '../../lib';
5
+ import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
5
6
  export class SnkPesquisa {
6
7
  constructor() {
7
8
  this._mdByName = {};
@@ -18,7 +19,6 @@ export class SnkPesquisa {
18
19
  this._itemList = undefined;
19
20
  this._startLoading = false;
20
21
  this._presentationMode = "list";
21
- this._currentView = undefined;
22
22
  this.searchLoader = undefined;
23
23
  this.treeLoader = undefined;
24
24
  this.selectItem = undefined;
@@ -321,29 +321,25 @@ export class SnkPesquisa {
321
321
  }
322
322
  async componentDidLoad() {
323
323
  ElementIDUtils.addIDInfo(this._element);
324
- await this.chooseViewMode();
325
324
  }
326
- async handleChangeViewMode() {
325
+ async onClickList() {
327
326
  this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
328
- await this.chooseViewMode();
329
327
  await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
330
328
  }
331
- async chooseViewMode() {
332
- var _a, _b;
333
- if (this._presentationMode !== 'list') {
334
- await ((_a = this._viewStack) === null || _a === void 0 ? void 0 : _a.show(PESQUISA_VIEW_MODE.GRID));
335
- this._currentView = PESQUISA_VIEW_MODE.GRID;
336
- return;
337
- }
338
- const view = this.isHierarchyEntity ? PESQUISA_VIEW_MODE.TREE : PESQUISA_VIEW_MODE.CARDS;
339
- await ((_b = this._viewStack) === null || _b === void 0 ? void 0 : _b.show(view));
340
- this._currentView = view;
329
+ enableListButton() {
330
+ var _a;
331
+ return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
341
332
  }
342
333
  //Os limites de exibição são diferentes para lista e grade
343
334
  hideLimitMessage() {
344
335
  if (!this._itemList)
345
336
  return true;
346
- return this._itemList.length < 100;
337
+ if (this._presentationMode === "list") {
338
+ if (this.isHierarchyEntity)
339
+ return true;
340
+ return this._itemList.length <= 100;
341
+ }
342
+ return this._itemList.length <= 150;
347
343
  }
348
344
  hideRecordsMessage() {
349
345
  return (this._presentationMode === "list" && this.isHierarchyEntity);
@@ -366,13 +362,30 @@ export class SnkPesquisa {
366
362
  title: 'Modo lista',
367
363
  };
368
364
  }
365
+ renderContent() {
366
+ if (!this._itemList)
367
+ return;
368
+ if (this._presentationMode === 'list') {
369
+ return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
370
+ }
371
+ return this.renderPesquisaGrid();
372
+ }
373
+ renderTree() {
374
+ return h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) }));
375
+ }
376
+ renderCards() {
377
+ return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
378
+ return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
379
+ }))));
380
+ }
381
+ renderPesquisaGrid() {
382
+ return h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
383
+ }
369
384
  render() {
370
- var _a, _b;
385
+ var _a;
371
386
  return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument, "data-element-id": "searchInput" }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
372
387
  ? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
373
- : undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.handleChangeViewMode() })), h("div", { class: `snk-pesquisa__records-label ${this._currentView === PESQUISA_VIEW_MODE.TREE ? 'hidden' : ''}` }, h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), h("div", { class: "snk-pesquisa__content" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, shouldLoadConfig: this._currentView === PESQUISA_VIEW_MODE.GRID, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) })), h("stack-item", null, h("div", { class: 'snk-pesquisa__cards-container' }, (_b = this._itemList) === null || _b === void 0 ? void 0 : _b.map((item) => {
374
- return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
375
- }))), h("stack-item", null, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, shouldLoadTree: this._currentView === PESQUISA_VIEW_MODE.TREE, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) })))))));
388
+ : undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.onClickList(), enabled: this.enableListButton() })), h("div", { class: "snk-pesquisa__records-label" }, h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), h("div", { class: "snk-pesquisa__content" }, this.renderContent()))));
376
389
  }
377
390
  static get is() { return "snk-pesquisa"; }
378
391
  static get encapsulation() { return "scoped"; }
@@ -522,8 +535,7 @@ export class SnkPesquisa {
522
535
  return {
523
536
  "_itemList": {},
524
537
  "_startLoading": {},
525
- "_presentationMode": {},
526
- "_currentView": {}
538
+ "_presentationMode": {}
527
539
  };
528
540
  }
529
541
  static get elementRef() { return "_element"; }
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME, LockManager, LockManagerOperation, SilentException } from '@sankhyalabs/core';
1
+ import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME, LockManager, LockManagerOperation } from '@sankhyalabs/core';
2
2
  import { h, Host } from '@stencil/core';
3
3
  import { AuthorizationConfig } from '../snk-configurator/AuthorizationConfig';
4
4
  import { AuthorizationElements, buildCustomButton, buildElem, TaskbarElement, VisibleWhenForbidden, } from './elements/taskbar-elements';
@@ -176,14 +176,8 @@ export class SnkTaskbar {
176
176
  case TaskbarElement.SAVE:
177
177
  if (!this._isWaitingForSave) {
178
178
  this._isWaitingForSave = true;
179
- this.dataUnit.saveData().catch((err) => {
180
- if (err instanceof SilentException) {
181
- return;
182
- }
183
- else {
184
- throw err;
185
- }
186
- }).finally(() => {
179
+ this.dataUnit.saveData()
180
+ .finally(() => {
187
181
  this._isWaitingForSave = false;
188
182
  });
189
183
  }
@@ -1,8 +1,6 @@
1
1
  import PreloadManager from "./cache/PreloadManager";
2
2
  import { DatasetStrategy } from "./loadstrategy/DatasetStrategy";
3
- import { CancelPaginationResponse, showAskCancelPaginationPopup } from './helpers/DataUnitDataLoaderHelper';
4
3
  export default class DataUnitDataLoader {
5
- constructor() { }
6
4
  static async debounce(dataUnit, callBack) {
7
5
  const duName = dataUnit.name;
8
6
  if (DataUnitDataLoader._debouncingTimeouts[duName]) {
@@ -48,67 +46,25 @@ export default class DataUnitDataLoader {
48
46
  }
49
47
  static async callLoader(dataUnit, request, requestLoadingInfo, dataLoader) {
50
48
  if (dataLoader == undefined) {
49
+ //dataLoader = new DataUnitStrategy();
51
50
  dataLoader = new DatasetStrategy();
52
51
  }
53
52
  const result = await dataLoader.load(dataUnit, request, requestLoadingInfo);
54
- const responseLoadingInfo = result.loadingInfo;
55
- if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo))
53
+ const { records, loadingInfo: responseLoadingInfo } = result;
54
+ if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo)) {
56
55
  return Promise.resolve(undefined);
57
- this.handleCache(dataLoader, responseLoadingInfo, dataUnit, result.records);
58
- if (dataUnit.cancelPagination)
59
- return this.handlePaginationCanceled(dataUnit, result);
60
- //Não existem mais páginas a serem carregadas
61
- if (this.canFinishPagination(dataUnit, responseLoadingInfo))
62
- return Promise.resolve(result);
63
- const newRequest = Object.assign(Object.assign({}, request), { offset: responseLoadingInfo.count });
64
- let newLoadingInfo = this.buildNewLoadingInfo(responseLoadingInfo);
65
- if (this.canProceedPagination(responseLoadingInfo))
66
- return this.recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result);
67
- const confirm = await showAskCancelPaginationPopup();
68
- if (confirm === CancelPaginationResponse.CANCEL)
69
- return this.handlePaginationCanceled(dataUnit, result);
70
- if (confirm === CancelPaginationResponse.LOAD_ALL) {
71
- newLoadingInfo = Object.assign(Object.assign({}, newLoadingInfo), { loadAllRecords: true });
72
56
  }
73
- newLoadingInfo = Object.assign(Object.assign({}, newLoadingInfo), { lastRowLimitAsked: newLoadingInfo.count });
74
- return this.recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result);
75
- }
76
- static buildNewLoadingInfo(responseLoadingInfo) {
77
- let newLoadingInfo = Object.assign(Object.assign({}, responseLoadingInfo), { pageNumber: (responseLoadingInfo.pageNumber || 0) + 1, quiet: true });
78
- return newLoadingInfo;
79
- }
80
- static handleCache(dataLoader, responseLoadingInfo, dataUnit, records) {
81
57
  const recreateCache = !dataLoader.canSlice() || responseLoadingInfo.count === 0;
82
58
  PreloadManager.cacheRecords(dataUnit, records, recreateCache, responseLoadingInfo.loadingInProgress);
83
- }
84
- static recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result) {
85
- this.callLoader(dataUnit, newRequest, newLoadingInfo, dataLoader)
86
- .then(result => DataUnitDataLoader.afterLoadingPage(dataUnit, result.loadingInfo))
87
- .catch(reason => console.error(reason));
59
+ if (PreloadManager.isCacheEnabled(dataUnit) && responseLoadingInfo.loadingInProgress) {
60
+ const newRequest = Object.assign(Object.assign({}, request), { offset: responseLoadingInfo.count });
61
+ const newLoadingInfo = Object.assign(Object.assign({}, responseLoadingInfo), { pageNumber: (responseLoadingInfo.pageNumber || 0) + 1, quiet: true });
62
+ this.callLoader(dataUnit, newRequest, newLoadingInfo, dataLoader)
63
+ .then(result => DataUnitDataLoader.afterLoadingPage(dataUnit, result.loadingInfo))
64
+ .catch(reason => console.error(reason));
65
+ }
88
66
  return Promise.resolve(result);
89
67
  }
90
- static canFinishPagination(dataUnit, responseLoadingInfo) {
91
- return !PreloadManager.isCacheEnabled(dataUnit) || !responseLoadingInfo.loadingInProgress;
92
- }
93
- static canProceedPagination(info) {
94
- const { count, askRowsLimit, loadAllRecords, lastRowLimitAsked } = info;
95
- if (loadAllRecords)
96
- return true;
97
- if (!count || !askRowsLimit)
98
- return true;
99
- const askRowLimitNumber = Number(askRowsLimit);
100
- if (count < askRowLimitNumber)
101
- return true;
102
- const nextLimitToAsk = askRowLimitNumber + (lastRowLimitAsked ? lastRowLimitAsked : 0);
103
- return count < nextLimitToAsk;
104
- }
105
- static handlePaginationCanceled(dataUnit, result) {
106
- dataUnit.cancelPagination = false;
107
- let loadingInfo = result.loadingInfo;
108
- loadingInfo = Object.assign(Object.assign({}, loadingInfo), { total: loadingInfo.count, loadingInProgress: false, pagerId: undefined, needReload: loadingInfo.hasLocalSorting });
109
- const loadDataResult = { records: result.records, loadingInfo };
110
- return Promise.resolve(loadDataResult);
111
- }
112
68
  static afterLoadingPage(dataUnit, loadingInfo) {
113
69
  PreloadManager.setLoadingStatus(dataUnit, loadingInfo.loadingInProgress);
114
70
  const dataUnitPagination = dataUnit.getPaginationInfo();
@@ -148,7 +104,7 @@ export default class DataUnitDataLoader {
148
104
  // controle de paginação voltar pra primeira página.
149
105
  offset = 0;
150
106
  }
151
- const { total, count, loadingInProgress, askRowsLimit } = loadingInfo;
107
+ const { total, count, loadingInProgress } = loadingInfo;
152
108
  const firstRecord = (count === 0 || pageSize === 0) ? 0 : offset + 1;
153
109
  const lastRecord = offset + Math.min(pageSize, limit);
154
110
  return {
@@ -157,8 +113,7 @@ export default class DataUnitDataLoader {
157
113
  lastRecord,
158
114
  firstRecord,
159
115
  currentPage: offset / limit,
160
- hasMore: lastRecord < count || loadingInProgress,
161
- askRowsLimit
116
+ hasMore: lastRecord < count || loadingInProgress
162
117
  };
163
118
  }
164
119
  }
@@ -1,7 +1,7 @@
1
1
  import { ApplicationContext, StringUtils, UserInterface, } from '@sankhyalabs/core';
2
- import { DataFetcher } from '../../../DataFetcher';
3
- import DataUnitFetcher from '../dataunit-fetcher';
4
- import InMemoryLoader from '../../../../../dataUnit/InMemoryLoader';
2
+ import { DataFetcher } from "../../../DataFetcher";
3
+ import DataUnitFetcher from "../dataunit-fetcher";
4
+ import InMemoryLoader from "../../../../../dataUnit/InMemoryLoader";
5
5
  import { getRecordValue } from '../../../../../dataUnit/ValueFormatter';
6
6
  export class DatasetStrategy {
7
7
  canSlice() {
@@ -40,13 +40,12 @@ export class DatasetStrategy {
40
40
  const serviceName = "DatasetSP.loadRecords";
41
41
  const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting, serverSideFilters);
42
42
  const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
43
- const { result: responseRecords, pagerID: pagerId, askRowsLimit } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
43
+ const { result: responseRecords, pagerID: pagerId } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
44
44
  const records = this.processRecords(dataUnit, fields, responseRecords);
45
45
  const loadingInProgress = pagerId != undefined;
46
46
  const count = loadingInfo.count + records.length;
47
47
  const isInsertingNewRecord = dataUnit.hasNewRecord();
48
- const hasLocalSorting = localSorting.length > 0;
49
- const needReload = !loadingInProgress && hasLocalSorting;
48
+ const needReload = !loadingInProgress && localSorting.length > 0;
50
49
  /**
51
50
  * Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
52
51
  * Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
@@ -57,8 +56,7 @@ export class DatasetStrategy {
57
56
  return Promise.resolve({
58
57
  records,
59
58
  loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
60
- loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord, askRowsLimit,
61
- hasLocalSorting })
59
+ loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord })
62
60
  });
63
61
  }
64
62
  catch (error) {
@@ -110,7 +108,8 @@ export class DatasetStrategy {
110
108
  },
111
109
  }
112
110
  };
113
- return JSON.stringify(requestBody);
111
+ const parsedRequestBody = JSON.stringify(requestBody);
112
+ return parsedRequestBody;
114
113
  }
115
114
  getFieldsList(dataUnit) {
116
115
  let fields = ["__record__id__", "__record__label__"];
@@ -178,6 +178,7 @@ export class PesquisaFetcher {
178
178
  buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
179
179
  var _a, _b, _c;
180
180
  const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
181
+ console.log("criteria: ", criteria);
181
182
  const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
182
183
  const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
183
184
  const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
@@ -57,6 +57,8 @@ function buildUserInterface(field) {
57
57
  return UserInterface.DATETIME;
58
58
  if (field['type'] === 'T')
59
59
  return UserInterface.TIME;
60
+ if (field['type'] === 'I')
61
+ return UserInterface.INTEGERNUMBER;
60
62
  return undefined;
61
63
  }
62
64
  function buildDataType(rawType) {
@@ -68,6 +70,8 @@ function buildDataType(rawType) {
68
70
  return DataType.DATE;
69
71
  case 'B':
70
72
  return DataType.OBJECT;
73
+ case 'I':
74
+ return DataType.NUMBER;
71
75
  default:
72
76
  return DataType.TEXT;
73
77
  }
@@ -89,12 +93,6 @@ function parseGridConfig(rawConfig) {
89
93
  return undefined;
90
94
  return { columns };
91
95
  }
92
- var PESQUISA_VIEW_MODE;
93
- (function (PESQUISA_VIEW_MODE) {
94
- PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["GRID"] = 0] = "GRID";
95
- PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["CARDS"] = 1] = "CARDS";
96
- PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["TREE"] = 2] = "TREE";
97
- })(PESQUISA_VIEW_MODE || (PESQUISA_VIEW_MODE = {}));
98
96
 
99
97
  class PesquisaFetcher {
100
98
  constructor() {
@@ -272,6 +270,7 @@ class PesquisaFetcher {
272
270
  buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
273
271
  var _a, _b, _c;
274
272
  const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
273
+ console.log("criteria: ", criteria);
275
274
  const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
276
275
  const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
277
276
  const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
@@ -394,4 +393,4 @@ var SaveErrorsEnum;
394
393
  SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
395
394
  })(SaveErrorsEnum || (SaveErrorsEnum = {}));
396
395
 
397
- export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d, PESQUISA_VIEW_MODE as e };
396
+ export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d };