@sankhyalabs/sankhyablocks 4.4.0-hotfix-ga-SKA-99999.1 → 4.5.0

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 (123) hide show
  1. package/dist/cjs/{ConfigStorage-05b9b162.js → ConfigStorage-bc7d1d9b.js} +1 -1
  2. package/dist/cjs/{DataFetcher-451b3e68.js → DataFetcher-6acfc3a8.js} +3 -3
  3. package/dist/cjs/{SnkFormConfigManager-18ed80a5.js → SnkFormConfigManager-5230e010.js} +2 -2
  4. package/dist/cjs/{SnkMessageBuilder-0a6f6459.js → SnkMessageBuilder-d147f088.js} +8 -1
  5. package/dist/cjs/{constants-3d09ebea.js → constants-73803daf.js} +5 -0
  6. package/dist/cjs/{form-config-fetcher-a93d6334.js → form-config-fetcher-4a952a50.js} +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  9. package/dist/cjs/snk-application.cjs.entry.js +4 -4
  10. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -4
  14. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-detail-view.cjs.entry.js +6 -6
  16. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  17. package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -3
  18. package/dist/cjs/snk-filter-field-search.cjs.entry.js +185 -0
  19. package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-form.cjs.entry.js +4 -4
  21. package/dist/cjs/snk-grid-config.cjs.entry.js +4 -4
  22. package/dist/cjs/snk-grid.cjs.entry.js +3 -3
  23. package/dist/cjs/{snk-guides-viewer-618e5c1d.js → snk-guides-viewer-5d3dca5d.js} +3 -3
  24. package/dist/cjs/snk-guides-viewer.cjs.entry.js +6 -6
  25. package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
  26. package/dist/cjs/snk-simple-crud.cjs.entry.js +252 -0
  27. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  28. package/dist/collection/collection-manifest.json +2 -0
  29. package/dist/collection/components/snk-filter-field-search/interfaces/index.js +5 -0
  30. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.css +41 -0
  31. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +297 -0
  32. package/dist/collection/components/snk-filter-field-search/subcomponents/index.js +1 -0
  33. package/dist/collection/components/snk-filter-field-search/subcomponents/list-item.js +24 -0
  34. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +27 -0
  35. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +343 -0
  36. package/dist/collection/lib/dataUnit/InMemoryLoader.js +112 -0
  37. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
  38. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +1 -1
  39. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/personalized-reports-fetcher.js +1 -1
  40. package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
  41. package/dist/collection/lib/message/resources/snk-filter-field-search.msg.js +5 -0
  42. package/dist/collection/lib/utils/constants.js +5 -0
  43. package/dist/components/DataFetcher.js +3 -3
  44. package/dist/components/SnkMessageBuilder.js +8 -1
  45. package/dist/components/constants.js +6 -1
  46. package/dist/components/index.d.ts +2 -0
  47. package/dist/components/index.js +2 -0
  48. package/dist/components/snk-data-exporter2.js +2 -2
  49. package/dist/components/snk-detail-view2.js +2 -1
  50. package/dist/components/snk-filter-field-search.d.ts +11 -0
  51. package/dist/components/snk-filter-field-search.js +205 -0
  52. package/dist/components/snk-grid2.js +2 -47
  53. package/dist/components/snk-simple-crud.d.ts +11 -0
  54. package/dist/components/snk-simple-crud.js +297 -0
  55. package/dist/components/taskbar-processor.js +47 -0
  56. package/dist/esm/{ConfigStorage-34caac5c.js → ConfigStorage-1b64cd96.js} +1 -1
  57. package/dist/esm/{DataFetcher-00309101.js → DataFetcher-5e99fa75.js} +3 -3
  58. package/dist/esm/{SnkFormConfigManager-d3a8aaf4.js → SnkFormConfigManager-0d9752c3.js} +2 -2
  59. package/dist/esm/{SnkMessageBuilder-9473ae03.js → SnkMessageBuilder-0e1ffd61.js} +8 -1
  60. package/dist/esm/{constants-fb9721cc.js → constants-9560e54f.js} +6 -1
  61. package/dist/esm/{form-config-fetcher-e58fc104.js → form-config-fetcher-677f86dd.js} +1 -1
  62. package/dist/esm/loader.js +1 -1
  63. package/dist/esm/sankhyablocks.js +1 -1
  64. package/dist/esm/snk-application.entry.js +4 -4
  65. package/dist/esm/snk-config-options.entry.js +1 -1
  66. package/dist/esm/snk-configurator.entry.js +1 -1
  67. package/dist/esm/snk-crud.entry.js +2 -2
  68. package/dist/esm/snk-data-exporter.entry.js +4 -4
  69. package/dist/esm/snk-data-unit.entry.js +2 -2
  70. package/dist/esm/snk-detail-view.entry.js +6 -6
  71. package/dist/esm/snk-field-config.entry.js +1 -1
  72. package/dist/esm/snk-filter-bar.entry.js +3 -3
  73. package/dist/esm/snk-filter-field-search.entry.js +181 -0
  74. package/dist/esm/snk-form-config.entry.js +3 -3
  75. package/dist/esm/snk-form.entry.js +4 -4
  76. package/dist/esm/snk-grid-config.entry.js +4 -4
  77. package/dist/esm/snk-grid.entry.js +3 -3
  78. package/dist/esm/{snk-guides-viewer-7c32399d.js → snk-guides-viewer-6bb54367.js} +3 -3
  79. package/dist/esm/snk-guides-viewer.entry.js +6 -6
  80. package/dist/esm/snk-select-box.entry.js +1 -1
  81. package/dist/esm/snk-simple-crud.entry.js +248 -0
  82. package/dist/esm/snk-tab-config.entry.js +1 -1
  83. package/dist/sankhyablocks/{p-9cff8df2.js → p-0c11c980.js} +1 -1
  84. package/dist/sankhyablocks/{p-52989652.entry.js → p-268ab84f.entry.js} +1 -1
  85. package/dist/sankhyablocks/{p-0fe01a57.entry.js → p-2a3996b0.entry.js} +1 -1
  86. package/dist/sankhyablocks/p-330813ff.entry.js +1 -0
  87. package/dist/sankhyablocks/{p-25341d65.js → p-3c4823fc.js} +1 -1
  88. package/dist/sankhyablocks/{p-44c23eb1.entry.js → p-4bd183ba.entry.js} +1 -1
  89. package/dist/sankhyablocks/{p-c4483cb2.js → p-5518d572.js} +1 -1
  90. package/dist/sankhyablocks/{p-e0416591.entry.js → p-7889d481.entry.js} +1 -1
  91. package/dist/sankhyablocks/p-79d22df0.entry.js +1 -0
  92. package/dist/sankhyablocks/{p-fc86a31e.entry.js → p-869d6616.entry.js} +1 -1
  93. package/dist/sankhyablocks/{p-99742169.entry.js → p-86efa17d.entry.js} +1 -1
  94. package/dist/sankhyablocks/{p-2980936b.entry.js → p-8b0e8deb.entry.js} +1 -1
  95. package/dist/sankhyablocks/{p-ca72cc38.js → p-9bf0319f.js} +1 -1
  96. package/dist/sankhyablocks/{p-83ddac9f.entry.js → p-9f00c061.entry.js} +1 -1
  97. package/dist/sankhyablocks/{p-43d8d388.entry.js → p-9f2306ba.entry.js} +1 -1
  98. package/dist/sankhyablocks/{p-9d4a25d2.js → p-9f98fc3c.js} +1 -1
  99. package/dist/sankhyablocks/{p-840494aa.entry.js → p-a056d61f.entry.js} +1 -1
  100. package/dist/sankhyablocks/{p-70037212.js → p-a6258eed.js} +1 -1
  101. package/dist/sankhyablocks/{p-de1ee26c.entry.js → p-b318cec6.entry.js} +1 -1
  102. package/dist/sankhyablocks/p-c0bfafcb.entry.js +1 -0
  103. package/dist/sankhyablocks/p-cf9d1b55.entry.js +1 -0
  104. package/dist/sankhyablocks/{p-8899a7ea.entry.js → p-d3199c18.entry.js} +1 -1
  105. package/dist/sankhyablocks/{p-9d62bbca.entry.js → p-dbeac5db.entry.js} +1 -1
  106. package/dist/sankhyablocks/{p-f5d3ecb3.js → p-ecbfbb4a.js} +1 -1
  107. package/dist/sankhyablocks/{p-6e6ef989.entry.js → p-f83e3219.entry.js} +1 -1
  108. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  109. package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +35 -0
  110. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +58 -0
  111. package/dist/types/components/snk-filter-field-search/subcomponents/index.d.ts +1 -0
  112. package/dist/types/components/snk-filter-field-search/subcomponents/list-item.d.ts +2 -0
  113. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +41 -0
  114. package/dist/types/components.d.ts +81 -2
  115. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +21 -0
  116. package/dist/types/lib/message/resources/snk-filter-field-search.msg.d.ts +1 -0
  117. package/dist/types/lib/utils/constants.d.ts +4 -0
  118. package/package.json +2 -2
  119. package/react/components.d.ts +2 -0
  120. package/react/components.js +2 -0
  121. package/react/components.js.map +1 -1
  122. package/dist/sankhyablocks/p-4de78929.entry.js +0 -1
  123. package/dist/sankhyablocks/p-e7cc6e62.entry.js +0 -1
@@ -0,0 +1,343 @@
1
+ import { DataType, UserInterface } from '@sankhyalabs/core';
2
+ import { h } from '@stencil/core';
3
+ import { VIEW_MODE, SIMPLE_CRUD_MODE } from '../../lib/utils/constants';
4
+ import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
5
+ import { PresentationMode } from '../../lib';
6
+ import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
7
+ import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
8
+ export class SnkSimpleCrud {
9
+ constructor() {
10
+ this.REGULAR_DEFAULT_BTNS = ["INSERT", "PREVIOUS", "NEXT", "DIVIDER"];
11
+ this.REGULAR_SELECTED_BTNS = ["INSERT", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
12
+ this._taskbarProcessor = new TaskbarProcessor({
13
+ "snkSimpleCrudTaskbar.form_regular": this.REGULAR_DEFAULT_BTNS.concat(TaskbarElement.GRID_MODE),
14
+ "snkSimpleCrudTaskbar.grid_regular": this.REGULAR_DEFAULT_BTNS.concat(TaskbarElement.FORM_MODE),
15
+ "snkSimpleCrudTaskbar.form_selected": this.REGULAR_SELECTED_BTNS.concat(TaskbarElement.GRID_MODE),
16
+ "snkSimpleCrudTaskbar.grid_selected": this.REGULAR_SELECTED_BTNS.concat(TaskbarElement.FORM_MODE),
17
+ "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
18
+ });
19
+ this._currentViewMode = VIEW_MODE.GRID;
20
+ this._config = undefined;
21
+ this.dataState = undefined;
22
+ this.dataUnit = undefined;
23
+ this.mode = SIMPLE_CRUD_MODE.SERVER;
24
+ this.taskbarManager = undefined;
25
+ }
26
+ /**
27
+ * Usado para alternar a visão entre GRID e FORM externamente.
28
+ */
29
+ async goToView(view) {
30
+ this._currentViewMode = view;
31
+ if (this._viewStack) {
32
+ this._viewStack.show(view);
33
+ }
34
+ }
35
+ actionClickListener(evt) {
36
+ const act = evt.detail;
37
+ if (act === TaskbarElement.GRID_MODE) {
38
+ this.goToView(VIEW_MODE.GRID);
39
+ }
40
+ else if (act === TaskbarElement.FORM_MODE) {
41
+ this.goToView(VIEW_MODE.FORM);
42
+ }
43
+ evt.stopPropagation();
44
+ }
45
+ onModeChange() {
46
+ if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
47
+ this.initInMemoryDataUnit();
48
+ }
49
+ }
50
+ componentWillRender() {
51
+ this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, undefined);
52
+ }
53
+ componentWillLoad() {
54
+ this.processMetadata();
55
+ this.onModeChange();
56
+ }
57
+ getTaskBarId() {
58
+ var _a, _b;
59
+ if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
60
+ return "snkSimpleCrudTaskbar.finish_edition";
61
+ }
62
+ if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectedRecords.length) > 0) {
63
+ return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
64
+ }
65
+ return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
66
+ }
67
+ initInMemoryDataUnit() {
68
+ this._inMemoryLoader = new InMemoryLoader(this._metadata);
69
+ this.dataUnit = this._inMemoryLoader.dataUnit;
70
+ }
71
+ setMetadata(metadata) {
72
+ if (this._inMemoryLoader) {
73
+ this._inMemoryLoader.metadata = metadata;
74
+ }
75
+ else if (this.dataUnit) {
76
+ this.dataUnit.metadata = metadata;
77
+ }
78
+ return Promise.resolve();
79
+ }
80
+ setRecords(records) {
81
+ if (this._inMemoryLoader) {
82
+ this._inMemoryLoader.records = records;
83
+ }
84
+ else if (this.dataUnit) {
85
+ this.dataUnit.records = records;
86
+ }
87
+ return Promise.resolve();
88
+ }
89
+ getRecords() {
90
+ return Promise.resolve(this.dataUnit.records);
91
+ }
92
+ processMetadata() {
93
+ const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
94
+ const fieldMetadata = [];
95
+ const formConfig = { fields: [], emptyConfig: false };
96
+ fieldsMetadataElem.forEach(fieldElem => {
97
+ const field = {
98
+ name: fieldElem.getAttribute("name") || fieldElem.getAttribute("label"),
99
+ label: fieldElem.getAttribute("label"),
100
+ dataType: DataType[fieldElem.getAttribute("dataType")] || DataType.TEXT,
101
+ userInterface: UserInterface[fieldElem.getAttribute("userInterface")] || UserInterface.SHORTTEXT,
102
+ readOnly: fieldElem.getAttribute("readOnly") == "true",
103
+ required: fieldElem.getAttribute("required") == "true",
104
+ tab: fieldElem.getAttribute("tab") || undefined
105
+ };
106
+ const fieldConfig = { name: field.name, tab: field.tab };
107
+ formConfig.fields.push(fieldConfig);
108
+ fieldMetadata.push(field);
109
+ });
110
+ if (fieldMetadata.length > 0) {
111
+ this._config = formConfig;
112
+ this._metadata = {
113
+ name: "SimpleCrud",
114
+ label: "SimpleCrud",
115
+ fields: fieldMetadata
116
+ };
117
+ }
118
+ }
119
+ render() {
120
+ var _a;
121
+ return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, onDataStateChange: evt => this.dataState = evt.detail, onInsertionMode: () => this.goToView(VIEW_MODE.FORM) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "simple-crud__taskbar ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), "no-header": true }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this._config }))))));
122
+ }
123
+ static get is() { return "snk-simple-crud"; }
124
+ static get encapsulation() { return "scoped"; }
125
+ static get originalStyleUrls() {
126
+ return {
127
+ "$": ["snk-simple-crud.css"]
128
+ };
129
+ }
130
+ static get styleUrls() {
131
+ return {
132
+ "$": ["snk-simple-crud.css"]
133
+ };
134
+ }
135
+ static get properties() {
136
+ return {
137
+ "dataState": {
138
+ "type": "unknown",
139
+ "mutable": false,
140
+ "complexType": {
141
+ "original": "DataState",
142
+ "resolved": "DataState",
143
+ "references": {
144
+ "DataState": {
145
+ "location": "import",
146
+ "path": "../snk-data-unit/snk-data-unit"
147
+ }
148
+ }
149
+ },
150
+ "required": false,
151
+ "optional": false,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": ""
155
+ }
156
+ },
157
+ "dataUnit": {
158
+ "type": "unknown",
159
+ "mutable": false,
160
+ "complexType": {
161
+ "original": "DataUnit",
162
+ "resolved": "DataUnit",
163
+ "references": {
164
+ "DataUnit": {
165
+ "location": "import",
166
+ "path": "@sankhyalabs/core"
167
+ }
168
+ }
169
+ },
170
+ "required": false,
171
+ "optional": false,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": ""
175
+ }
176
+ },
177
+ "mode": {
178
+ "type": "number",
179
+ "mutable": false,
180
+ "complexType": {
181
+ "original": "SIMPLE_CRUD_MODE",
182
+ "resolved": "SIMPLE_CRUD_MODE.IN_MEMORY | SIMPLE_CRUD_MODE.SERVER",
183
+ "references": {
184
+ "SIMPLE_CRUD_MODE": {
185
+ "location": "import",
186
+ "path": "../../lib/utils/constants"
187
+ }
188
+ }
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": ""
195
+ },
196
+ "attribute": "mode",
197
+ "reflect": false,
198
+ "defaultValue": "SIMPLE_CRUD_MODE.SERVER"
199
+ },
200
+ "taskbarManager": {
201
+ "type": "unknown",
202
+ "mutable": false,
203
+ "complexType": {
204
+ "original": "TaskbarManager",
205
+ "resolved": "TaskbarManager",
206
+ "references": {
207
+ "TaskbarManager": {
208
+ "location": "import",
209
+ "path": "../snk-taskbar/snk-taskbar"
210
+ }
211
+ }
212
+ },
213
+ "required": false,
214
+ "optional": false,
215
+ "docs": {
216
+ "tags": [],
217
+ "text": "Gerenciador das barras de tarefas. \u00C9 poss\u00EDvel determinar bot\u00F5es espec\u00EDficos\nou mesmo gerenciar o estado dos bot\u00F5es."
218
+ }
219
+ }
220
+ };
221
+ }
222
+ static get states() {
223
+ return {
224
+ "_currentViewMode": {},
225
+ "_config": {}
226
+ };
227
+ }
228
+ static get methods() {
229
+ return {
230
+ "goToView": {
231
+ "complexType": {
232
+ "signature": "(view: VIEW_MODE) => Promise<void>",
233
+ "parameters": [{
234
+ "tags": [],
235
+ "text": ""
236
+ }],
237
+ "references": {
238
+ "Promise": {
239
+ "location": "global"
240
+ },
241
+ "VIEW_MODE": {
242
+ "location": "import",
243
+ "path": "../../lib/utils/constants"
244
+ }
245
+ },
246
+ "return": "Promise<void>"
247
+ },
248
+ "docs": {
249
+ "text": "Usado para alternar a vis\u00E3o entre GRID e FORM externamente.",
250
+ "tags": []
251
+ }
252
+ },
253
+ "setMetadata": {
254
+ "complexType": {
255
+ "signature": "(metadata: UnitMetadata) => Promise<void>",
256
+ "parameters": [{
257
+ "tags": [],
258
+ "text": ""
259
+ }],
260
+ "references": {
261
+ "Promise": {
262
+ "location": "global"
263
+ },
264
+ "UnitMetadata": {
265
+ "location": "import",
266
+ "path": "@sankhyalabs/core"
267
+ }
268
+ },
269
+ "return": "Promise<void>"
270
+ },
271
+ "docs": {
272
+ "text": "",
273
+ "tags": []
274
+ }
275
+ },
276
+ "setRecords": {
277
+ "complexType": {
278
+ "signature": "(records: Array<Record>) => Promise<void>",
279
+ "parameters": [{
280
+ "tags": [],
281
+ "text": ""
282
+ }],
283
+ "references": {
284
+ "Promise": {
285
+ "location": "global"
286
+ },
287
+ "Array": {
288
+ "location": "global"
289
+ },
290
+ "Record": {
291
+ "location": "import",
292
+ "path": "@sankhyalabs/core"
293
+ }
294
+ },
295
+ "return": "Promise<void>"
296
+ },
297
+ "docs": {
298
+ "text": "",
299
+ "tags": []
300
+ }
301
+ },
302
+ "getRecords": {
303
+ "complexType": {
304
+ "signature": "() => Promise<Array<Record>>",
305
+ "parameters": [],
306
+ "references": {
307
+ "Promise": {
308
+ "location": "global"
309
+ },
310
+ "Record": {
311
+ "location": "import",
312
+ "path": "@sankhyalabs/core"
313
+ },
314
+ "Array": {
315
+ "location": "global"
316
+ }
317
+ },
318
+ "return": "Promise<Record[]>"
319
+ },
320
+ "docs": {
321
+ "text": "",
322
+ "tags": []
323
+ }
324
+ }
325
+ };
326
+ }
327
+ static get elementRef() { return "_element"; }
328
+ static get watchers() {
329
+ return [{
330
+ "propName": "mode",
331
+ "methodName": "onModeChange"
332
+ }];
333
+ }
334
+ static get listeners() {
335
+ return [{
336
+ "name": "actionClick",
337
+ "method": "actionClickListener",
338
+ "target": undefined,
339
+ "capture": false,
340
+ "passive": false
341
+ }];
342
+ }
343
+ }
@@ -0,0 +1,112 @@
1
+ import { ChangeOperation, DataType, DataUnit, SortMode, StringUtils } from "@sankhyalabs/core";
2
+ export default class InMemoryLoader {
3
+ constructor(metadata, records) {
4
+ this.records = records || [];
5
+ this.metadata = metadata;
6
+ this._dataUnit = new DataUnit("InMemoryDataUnit");
7
+ this._dataUnit.metadataLoader = () => this.metadaLoader();
8
+ this._dataUnit.dataLoader = (_dataUnit, request) => this.dataLoader(_dataUnit, request);
9
+ this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
10
+ this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
11
+ this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
12
+ }
13
+ get dataUnit() {
14
+ return this._dataUnit;
15
+ }
16
+ get records() {
17
+ return this._records;
18
+ }
19
+ set records(records) {
20
+ this._records = records === null || records === void 0 ? void 0 : records.map(record => {
21
+ if (!record["__record__id__"]) {
22
+ record["__record__id__"] = this.generateUniqueId();
23
+ }
24
+ return record;
25
+ });
26
+ if (this._dataUnit) {
27
+ this._dataUnit.records = [...this._records];
28
+ }
29
+ }
30
+ get metadata() {
31
+ return this._metadata;
32
+ }
33
+ set metadata(metadata) {
34
+ this._metadata = metadata;
35
+ if (this._dataUnit) {
36
+ this._dataUnit.metadata = this._metadata;
37
+ }
38
+ }
39
+ generateUniqueId() {
40
+ return StringUtils.generateUUID();
41
+ }
42
+ metadaLoader() {
43
+ return Promise.resolve(this._metadata);
44
+ }
45
+ dataLoader(_dataUnit, request) {
46
+ let records = [...this._records];
47
+ if (request.sort) {
48
+ request.sort.forEach(sort => {
49
+ records = records.sort((recordA, recordB) => {
50
+ const fieldA = recordA[sort.field];
51
+ const fieldB = recordB[sort.field];
52
+ const sortFn = this.getSortFn(sort.dataType);
53
+ return sortFn(fieldA, fieldB) * (sort.mode == SortMode.ASC ? 1 : -1);
54
+ });
55
+ });
56
+ }
57
+ return Promise.resolve({ records: records });
58
+ }
59
+ getSortFn(type) {
60
+ switch (type) {
61
+ case DataType.NUMBER:
62
+ return this.sortNumber;
63
+ case DataType.DATE:
64
+ return this.sortDate;
65
+ case DataType.OBJECT:
66
+ return this.sortObject;
67
+ default:
68
+ return StringUtils.compare;
69
+ }
70
+ }
71
+ sortObject(a, b) {
72
+ return StringUtils.compare(a["label"], b["label"]);
73
+ }
74
+ sortNumber(a, b) {
75
+ return a - b;
76
+ }
77
+ sortDate(a, b) {
78
+ let timeA = a.getTime(), timeB = b.getTime();
79
+ return timeA === timeB ? 0 : (timeA < timeB ? -1 : 1);
80
+ }
81
+ saveLoader(_dataUnit, changes) {
82
+ return new Promise((resolve) => {
83
+ let dataUnitRecords = [];
84
+ changes.forEach(change => {
85
+ let { record, updatingFields, operation } = change;
86
+ let isAdd = false;
87
+ if (operation === ChangeOperation.INSERT ||
88
+ operation === ChangeOperation.COPY) {
89
+ record["__old__id__"] = record["__record__id__"];
90
+ record["__record__id__"] = this.generateUniqueId();
91
+ isAdd = true;
92
+ }
93
+ const changedRecord = Object.assign(Object.assign({}, record), updatingFields);
94
+ if (isAdd) {
95
+ this.records.push(changedRecord);
96
+ }
97
+ else {
98
+ const recordIndex = this.records.findIndex(r => r["__record__id__"] == changedRecord["__record__id__"]);
99
+ this.records[recordIndex] = changedRecord;
100
+ }
101
+ dataUnitRecords.push(changedRecord);
102
+ });
103
+ resolve(dataUnitRecords);
104
+ });
105
+ }
106
+ removeLoader(_dataUnit, recordIds) {
107
+ return new Promise((resolve) => {
108
+ this._records = this._records.filter(record => !recordIds.includes(record["__record__id__"]));
109
+ resolve(recordIds);
110
+ });
111
+ }
112
+ }
@@ -6,7 +6,7 @@ import { ServiceBrokerRecaller } from './recaller/ServiceBrokerRecaller';
6
6
  import { GraphQLRecaller } from './recaller/GraphQLRecaller';
7
7
  export class DataFetcher {
8
8
  constructor() {
9
- this.GRAPHQL_PATH = "/mgefin-bff/graphql";
9
+ this.GRAPHQL_PATH = "/mge/graphql";
10
10
  this.watingRequestsById = new Map();
11
11
  }
12
12
  static get() {
@@ -235,8 +235,8 @@ export class DataFetcher {
235
235
  let errorsResponse = [];
236
236
  let url = `${this.resolveURL() + this.GRAPHQL_PATH}`;
237
237
  const responseExtensions = [];
238
- if (window['mgeSession']) {
239
- url += `?mgeSession=${window['mgeSession']}`;
238
+ if (window['skw_session']) {
239
+ url += `?mgeSession=${window['skw_session']}`;
240
240
  }
241
241
  DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: request }));
242
242
  try {
@@ -14,7 +14,7 @@ import { ObjectUtils } from "@sankhyalabs/core";
14
14
  import { DataFetcher } from '../../DataFetcher';
15
15
  export default function fetchDataExporter(_a) {
16
16
  var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
17
- const serviceName = `mgefin-bff@DataExporterSPBean.${methodName}`;
17
+ const serviceName = `DataExporterSPBean.${methodName}`;
18
18
  const payload = { serviceName, requestBody };
19
19
  return new Promise((resolve, reject) => {
20
20
  DataFetcher.get()
@@ -1,7 +1,7 @@
1
1
  import { ObjectUtils } from '@sankhyalabs/core';
2
2
  import { DataFetcher } from '../../DataFetcher';
3
3
  export default function getPersonalizedReports(requestBody) {
4
- const serviceName = "mgefin-bff@DataExporterSPBean.getPersonalizedReports";
4
+ const serviceName = "DataExporterSPBean.getPersonalizedReports";
5
5
  const payload = { serviceName, requestBody };
6
6
  return new Promise((resolve, reject) => (DataFetcher.get()
7
7
  .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
@@ -10,6 +10,7 @@ import { snkConfiguratorMessages } from "./resources/snk-configurator.msg.js";
10
10
  import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg.js";
11
11
  import { snkDataExporterMessages } from "./resources/snk-data-exporter.msg.js";
12
12
  import { snkFilterParamConfigMessages } from "./resources/snk-filter-param-config.msg.js";
13
+ import { snkFilterFieldSearchMessages } from "./resources/snk-filter-field-search.msg.js";
13
14
  export class SnkMessageBuilder {
14
15
  constructor() {
15
16
  this._defaults = {
@@ -28,7 +29,8 @@ export class SnkMessageBuilder {
28
29
  snkDataExporter: snkDataExporterMessages,
29
30
  snkCrud: snkCrudMessages,
30
31
  fileViewer: fileViewerMessages,
31
- snkFilterParamConfig: snkFilterParamConfigMessages
32
+ snkFilterParamConfig: snkFilterParamConfigMessages,
33
+ snkFilterFieldSearch: snkFilterFieldSearchMessages
32
34
  };
33
35
  this._currentOperation = OperationMap.CLEAN;
34
36
  this.loadAppMessages().then((msgs) => {
@@ -0,0 +1,5 @@
1
+ export const snkFilterFieldSearchMessages = {
2
+ searchLabel: "Buscar campo",
3
+ fieldLabel: "Campos de {{link}}",
4
+ linkLabel: "Categorias de {{link}}",
5
+ };
@@ -94,3 +94,8 @@ export const WEB_CONNECTION = {
94
94
  IMPORT_IMAGE: "importImage"
95
95
  }
96
96
  };
97
+ export var SIMPLE_CRUD_MODE;
98
+ (function (SIMPLE_CRUD_MODE) {
99
+ SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["SERVER"] = 0] = "SERVER";
100
+ SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["IN_MEMORY"] = 1] = "IN_MEMORY";
101
+ })(SIMPLE_CRUD_MODE || (SIMPLE_CRUD_MODE = {}));
@@ -6466,7 +6466,7 @@ class GraphQLRecaller {
6466
6466
 
6467
6467
  class DataFetcher {
6468
6468
  constructor() {
6469
- this.GRAPHQL_PATH = "/mgefin-bff/graphql";
6469
+ this.GRAPHQL_PATH = "/mge/graphql";
6470
6470
  this.watingRequestsById = new Map();
6471
6471
  }
6472
6472
  static get() {
@@ -6695,8 +6695,8 @@ class DataFetcher {
6695
6695
  let errorsResponse = [];
6696
6696
  let url = `${this.resolveURL() + this.GRAPHQL_PATH}`;
6697
6697
  const responseExtensions = [];
6698
- if (window['mgeSession']) {
6699
- url += `?mgeSession=${window['mgeSession']}`;
6698
+ if (window['skw_session']) {
6699
+ url += `?mgeSession=${window['skw_session']}`;
6700
6700
  }
6701
6701
  DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: request }));
6702
6702
  try {
@@ -271,6 +271,12 @@ const snkFilterParamConfigMessages = {
271
271
  labelSave: "Salvar"
272
272
  };
273
273
 
274
+ const snkFilterFieldSearchMessages = {
275
+ searchLabel: "Buscar campo",
276
+ fieldLabel: "Campos de {{link}}",
277
+ linkLabel: "Categorias de {{link}}",
278
+ };
279
+
274
280
  class SnkMessageBuilder {
275
281
  constructor() {
276
282
  this._defaults = {
@@ -289,7 +295,8 @@ class SnkMessageBuilder {
289
295
  snkDataExporter: snkDataExporterMessages,
290
296
  snkCrud: snkCrudMessages,
291
297
  fileViewer: fileViewerMessages,
292
- snkFilterParamConfig: snkFilterParamConfigMessages
298
+ snkFilterParamConfig: snkFilterParamConfigMessages,
299
+ snkFilterFieldSearch: snkFilterFieldSearchMessages
293
300
  };
294
301
  this._currentOperation = OperationMap.CLEAN;
295
302
  this.loadAppMessages().then((msgs) => {
@@ -93,5 +93,10 @@ const WEB_CONNECTION = {
93
93
  IMPORT_IMAGE: "importImage"
94
94
  }
95
95
  };
96
+ var SIMPLE_CRUD_MODE;
97
+ (function (SIMPLE_CRUD_MODE) {
98
+ SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["SERVER"] = 0] = "SERVER";
99
+ SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["IN_MEMORY"] = 1] = "IN_MEMORY";
100
+ })(SIMPLE_CRUD_MODE || (SIMPLE_CRUD_MODE = {}));
96
101
 
97
- export { ALL_RECORD as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_PORT_EXPORT as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, TAGS_BY_TYPE as T, VIEW_MODE as V, WEB_CONNECTION as W, VARS_BY_TYPE as a, ACTION_CONFIG as b, TAB_NAMES as c, KEY_EVENTS as d, TYPE_ACTIONS as e };
102
+ export { ALL_RECORD as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_PORT_EXPORT as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S, TAGS_BY_TYPE as T, VIEW_MODE as V, WEB_CONNECTION as W, VARS_BY_TYPE as a, ACTION_CONFIG as b, TAB_NAMES as c, KEY_EVENTS as d, TYPE_ACTIONS as e };
@@ -11,6 +11,7 @@ export { SnkFieldConfig as SnkFieldConfig } from '../types/components/snk-form/s
11
11
  export { SnkFilterBar as SnkFilterBar } from '../types/components/snk-filter-bar/snk-filter-bar';
12
12
  export { SnkFilterBinarySelect as SnkFilterBinarySelect } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select';
13
13
  export { SnkFilterDetail as SnkFilterDetail } from '../types/components/snk-filter-bar/filter-item/snk-filter-detail';
14
+ export { SnkFilterFieldSearch as SnkFilterFieldSearch } from '../types/components/snk-filter-field-search/snk-filter-field-search';
14
15
  export { SnkFilterItem as SnkFilterItem } from '../types/components/snk-filter-bar/filter-item/snk-filter-item';
15
16
  export { SnkFilterList as SnkFilterList } from '../types/components/snk-filter-bar/filter-list/snk-filter-list';
16
17
  export { SnkFilterModal as SnkFilterModal } from '../types/components/snk-filter-bar/filter-modal/snk-filter-modal';
@@ -30,6 +31,7 @@ export { SnkGridConfig as SnkGridConfig } from '../types/components/snk-grid/sub
30
31
  export { SnkGuidesViewer as SnkGuidesViewer } from '../types/components/snk-crud/subcomponents/snk-guides-viewer';
31
32
  export { SnkPesquisa as SnkPesquisa } from '../types/components/snk-pesquisa/snk-pesquisa';
32
33
  export { SelectBox as SnkSelectBox } from '../types/components/snk-grid/subcomponents/snk-select-box/snk-select-box';
34
+ export { SnkSimpleCrud as SnkSimpleCrud } from '../types/components/snk-simple-crud/snk-simple-crud';
33
35
  export { SnkTabConfig as SnkTabConfig } from '../types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config';
34
36
  export { SnkTaskbar as SnkTaskbar } from '../types/components/snk-taskbar/snk-taskbar';
35
37
  export { TestePesquisa as TestePesquisa } from '../types/components/teste-pesquisa/teste-pesquisa';
@@ -11,6 +11,7 @@ export { SnkFieldConfig, defineCustomElement as defineCustomElementSnkFieldConfi
11
11
  export { SnkFilterBar, defineCustomElement as defineCustomElementSnkFilterBar } from './snk-filter-bar.js';
12
12
  export { SnkFilterBinarySelect, defineCustomElement as defineCustomElementSnkFilterBinarySelect } from './snk-filter-binary-select.js';
13
13
  export { SnkFilterDetail, defineCustomElement as defineCustomElementSnkFilterDetail } from './snk-filter-detail.js';
14
+ export { SnkFilterFieldSearch, defineCustomElement as defineCustomElementSnkFilterFieldSearch } from './snk-filter-field-search.js';
14
15
  export { SnkFilterItem, defineCustomElement as defineCustomElementSnkFilterItem } from './snk-filter-item.js';
15
16
  export { SnkFilterList, defineCustomElement as defineCustomElementSnkFilterList } from './snk-filter-list.js';
16
17
  export { SnkFilterModal, defineCustomElement as defineCustomElementSnkFilterModal } from './snk-filter-modal.js';
@@ -30,6 +31,7 @@ export { SnkGridConfig, defineCustomElement as defineCustomElementSnkGridConfig
30
31
  export { SnkGuidesViewer, defineCustomElement as defineCustomElementSnkGuidesViewer } from './snk-guides-viewer.js';
31
32
  export { SnkPesquisa, defineCustomElement as defineCustomElementSnkPesquisa } from './snk-pesquisa.js';
32
33
  export { SnkSelectBox, defineCustomElement as defineCustomElementSnkSelectBox } from './snk-select-box.js';
34
+ export { SnkSimpleCrud, defineCustomElement as defineCustomElementSnkSimpleCrud } from './snk-simple-crud.js';
33
35
  export { SnkTabConfig, defineCustomElement as defineCustomElementSnkTabConfig } from './snk-tab-config.js';
34
36
  export { SnkTaskbar, defineCustomElement as defineCustomElementSnkTaskbar } from './snk-taskbar.js';
35
37
  export { TestePesquisa, defineCustomElement as defineCustomElementTestePesquisa } from './teste-pesquisa.js';
@@ -159,7 +159,7 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
159
159
  };
160
160
  function fetchDataExporter(_a) {
161
161
  var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
162
- const serviceName = `mgefin-bff@DataExporterSPBean.${methodName}`;
162
+ const serviceName = `DataExporterSPBean.${methodName}`;
163
163
  const payload = { serviceName, requestBody };
164
164
  return new Promise((resolve, reject) => {
165
165
  DataFetcher.get()
@@ -202,7 +202,7 @@ function fileViewer({ fileSessionKey, canPrint, canExport, useAppPrint, isDownlo
202
202
  }
203
203
 
204
204
  function getPersonalizedReports(requestBody) {
205
- const serviceName = "mgefin-bff@DataExporterSPBean.getPersonalizedReports";
205
+ const serviceName = "DataExporterSPBean.getPersonalizedReports";
206
206
  const payload = { serviceName, requestBody };
207
207
  return new Promise((resolve, reject) => (DataFetcher.get()
208
208
  .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
@@ -6,7 +6,7 @@ import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
6
6
  import { P as PresentationMode } from './index2.js';
7
7
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
8
8
  import { V as VIEW_MODE } from './constants.js';
9
- import { T as TaskbarProcessor, d as defineCustomElement$6 } from './snk-grid2.js';
9
+ import { T as TaskbarProcessor } from './taskbar-processor.js';
10
10
  import { d as defineCustomElement$k } from './snk-config-options2.js';
11
11
  import { d as defineCustomElement$j } from './snk-configurator2.js';
12
12
  import { d as defineCustomElement$i } from './snk-data-exporter2.js';
@@ -19,6 +19,7 @@ import { d as defineCustomElement$b } from './snk-filter-list2.js';
19
19
  import { d as defineCustomElement$a } from './snk-filter-modal2.js';
20
20
  import { d as defineCustomElement$8 } from './snk-form-summary2.js';
21
21
  import { d as defineCustomElement$7 } from './snk-form-view2.js';
22
+ import { d as defineCustomElement$6 } from './snk-grid2.js';
22
23
  import { d as defineCustomElement$5 } from './snk-grid-config2.js';
23
24
  import { d as defineCustomElement$4 } from './snk-select-box2.js';
24
25
  import { d as defineCustomElement$f } from './snk-field-config2.js';
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkFilterFieldSearch extends Components.SnkFilterFieldSearch, HTMLElement {}
4
+ export const SnkFilterFieldSearch: {
5
+ prototype: SnkFilterFieldSearch;
6
+ new (): SnkFilterFieldSearch;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;