@sankhyalabs/sankhyablocks 1.3.31-beta.6 → 1.3.31
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.
- package/dist/cjs/{index-532bcc28.js → index-1133bc2a.js} +9 -419
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +98 -213
- package/dist/cjs/snk-pesquisa.cjs.entry.js +2 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +0 -4
- package/dist/collection/components/snk-application/snk-application.js +48 -165
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +21 -52
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +3 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -0
- package/dist/components/snk-application2.js +97 -213
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/esm/{index-0b078db7.js → index-ffda6382.js} +10 -419
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +98 -213
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-a8305c35.entry.js → p-2a7b4cb3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a670853c.entry.js → p-49fdec1f.entry.js} +1 -1
- package/dist/sankhyablocks/p-9bc9abe0.entry.js +69 -0
- package/dist/sankhyablocks/p-edcb9d8e.js +2 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +13 -90
- package/dist/types/components.d.ts +2 -334
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +0 -2
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
- package/package.json +5 -5
- package/react/components.d.ts +0 -4
- package/react/components.js +0 -4
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +0 -189
- package/dist/cjs/snk-form.cjs.entry.js +0 -95
- package/dist/cjs/snk-grid.cjs.entry.js +0 -64
- package/dist/cjs/snk-taskbar.cjs.entry.js +0 -140
- package/dist/cjs/taskbar-elements-9d47b416.js +0 -70
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +0 -6
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -449
- package/dist/collection/components/snk-form/snk-form.css +0 -3
- package/dist/collection/components/snk-form/snk-form.js +0 -194
- package/dist/collection/components/snk-grid/snk-grid.css +0 -5
- package/dist/collection/components/snk-grid/snk-grid.js +0 -128
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +0 -65
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +0 -3
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +0 -252
- package/dist/components/snk-data-unit.d.ts +0 -11
- package/dist/components/snk-data-unit.js +0 -213
- package/dist/components/snk-form.d.ts +0 -11
- package/dist/components/snk-form.js +0 -121
- package/dist/components/snk-grid.d.ts +0 -11
- package/dist/components/snk-grid.js +0 -88
- package/dist/components/snk-taskbar.d.ts +0 -11
- package/dist/components/snk-taskbar.js +0 -6
- package/dist/components/snk-taskbar2.js +0 -221
- package/dist/esm/snk-data-unit.entry.js +0 -185
- package/dist/esm/snk-form.entry.js +0 -91
- package/dist/esm/snk-grid.entry.js +0 -60
- package/dist/esm/snk-taskbar.entry.js +0 -136
- package/dist/esm/taskbar-elements-3ba30bf4.js +0 -68
- package/dist/sankhyablocks/p-3cb106f7.entry.js +0 -69
- package/dist/sankhyablocks/p-3fce3190.entry.js +0 -1
- package/dist/sankhyablocks/p-560fdf54.entry.js +0 -1
- package/dist/sankhyablocks/p-574764bf.js +0 -1
- package/dist/sankhyablocks/p-8f7b9a85.entry.js +0 -1
- package/dist/sankhyablocks/p-9c225717.entry.js +0 -1
- package/dist/sankhyablocks/p-a45dba1a.js +0 -2
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +0 -25
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -45
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
3
|
"./components/snk-application/snk-application.js",
|
|
4
|
-
"./components/snk-data-unit/snk-data-unit.js",
|
|
5
|
-
"./components/snk-taskbar/snk-taskbar.js",
|
|
6
|
-
"./components/snk-form/snk-form.js",
|
|
7
|
-
"./components/snk-grid/snk-grid.js",
|
|
8
4
|
"./components/snk-pesquisa/snk-pesquisa.js",
|
|
9
5
|
"./components/teste-pesquisa/teste-pesquisa.js"
|
|
10
6
|
],
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component, h, Method, Event } from "@stencil/core";
|
|
2
2
|
import { DataType, ErrorTracking } from "@sankhyalabs/core";
|
|
3
|
-
import { DependencyType } from "@sankhyalabs/core";
|
|
4
3
|
import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
|
|
5
4
|
import { DataFetcher } from "../../lib/http/data-fetcher/DataFetcher";
|
|
6
5
|
import UrlUtils from "../../lib/utils/urlutils";
|
|
@@ -11,13 +10,13 @@ import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-con
|
|
|
11
10
|
import { ApplicationContext } from "@sankhyalabs/core";
|
|
12
11
|
import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
|
|
13
12
|
import { PesquisaFetcher } from "../../lib/http/data-fetcher/fetchers/pesquisa-fetcher";
|
|
13
|
+
import { DependencyType } from "@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";
|
|
14
14
|
import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
|
|
15
15
|
import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
|
|
16
16
|
import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
|
|
17
17
|
import { agGridLicense } from '../../lib/licenses/sankhyalicense.module';
|
|
18
18
|
export class SnkApplication {
|
|
19
19
|
constructor() {
|
|
20
|
-
this._duCache = new Map();
|
|
21
20
|
this._requestListener = new RequestListenerLoadingBar();
|
|
22
21
|
}
|
|
23
22
|
get parameters() {
|
|
@@ -48,9 +47,6 @@ export class SnkApplication {
|
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Caso o usuário logado seja o SUP.
|
|
53
|
-
*/
|
|
54
50
|
async isUserSup() {
|
|
55
51
|
return new Promise((resolve, reject) => {
|
|
56
52
|
this.auth.then((authorization) => {
|
|
@@ -60,9 +56,6 @@ export class SnkApplication {
|
|
|
60
56
|
});
|
|
61
57
|
});
|
|
62
58
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Se o usuário logado tem permissão pra determinada ação.
|
|
65
|
-
*/
|
|
66
59
|
async hasAccess(access) {
|
|
67
60
|
return new Promise((resolve, reject) => {
|
|
68
61
|
this.auth.then((authorization) => {
|
|
@@ -72,9 +65,6 @@ export class SnkApplication {
|
|
|
72
65
|
});
|
|
73
66
|
});
|
|
74
67
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Retorna todos os acessos do usuário logado.
|
|
77
|
-
*/
|
|
78
68
|
async getAllAccess() {
|
|
79
69
|
return new Promise((resolve, reject) => {
|
|
80
70
|
this.auth.then((authorization) => {
|
|
@@ -89,55 +79,33 @@ export class SnkApplication {
|
|
|
89
79
|
});
|
|
90
80
|
});
|
|
91
81
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
async getAuthList(_auth) {
|
|
83
|
+
return await (new MGEAuthorization()).parseFromJSON(_auth);
|
|
84
|
+
}
|
|
95
85
|
async getStringParam(name) {
|
|
96
86
|
return this.parameters.asString(name, this.resourceID);
|
|
97
87
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Retorna o valor de um parâmetro do tipo Inteiro.
|
|
100
|
-
*/
|
|
101
88
|
async getIntParam(name) {
|
|
102
89
|
return this.parameters.asInteger(name, this.resourceID);
|
|
103
90
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Retorna o valor de um parâmetro do tipo Decimal.
|
|
106
|
-
*/
|
|
107
91
|
async getFloatParam(name) {
|
|
108
92
|
return this.parameters.asFloat(name, this.resourceID);
|
|
109
93
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Retorna o valor de um parâmetro do tipo booleano.
|
|
112
|
-
*/
|
|
113
94
|
async getBooleanParam(name) {
|
|
114
95
|
return this.parameters.asBoolean(name, this.resourceID);
|
|
115
96
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Retorna o valor de um parâmetro do tipo data.
|
|
118
|
-
*/
|
|
119
97
|
async getDateParam(name) {
|
|
120
98
|
return this.parameters.asDate(name, this.resourceID);
|
|
121
99
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Mostra o conteúdo passado em um Popup
|
|
124
|
-
*/
|
|
125
100
|
async showPopUp(content) {
|
|
101
|
+
this.clearPopUpContent();
|
|
126
102
|
this._popUp.appendChild(content);
|
|
127
|
-
this._popUp
|
|
103
|
+
this._popUp.opened = true;
|
|
128
104
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Fecha o popup, liberando o conteúdo.
|
|
131
|
-
*/
|
|
132
105
|
async closePopUp() {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
this._popUp["opened"] = false;
|
|
106
|
+
this.clearPopUpContent();
|
|
107
|
+
this._popUp.opened = false;
|
|
137
108
|
}
|
|
138
|
-
/**
|
|
139
|
-
* Verifica se a licença do cliente tem determinado opcional (produto)
|
|
140
|
-
*/
|
|
141
109
|
async temOpcional(opcional) {
|
|
142
110
|
const opts = opcional.split(",");
|
|
143
111
|
return new Promise((resolve, reject) => {
|
|
@@ -161,10 +129,6 @@ export class SnkApplication {
|
|
|
161
129
|
});
|
|
162
130
|
});
|
|
163
131
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Retorna a configuração de um recurso por service broker
|
|
166
|
-
* Veja também o método "loadConfig"
|
|
167
|
-
*/
|
|
168
132
|
async getConfig(key) {
|
|
169
133
|
let payload = {
|
|
170
134
|
"serviceName": "SystemUtilsSP.getConf",
|
|
@@ -182,9 +146,6 @@ export class SnkApplication {
|
|
|
182
146
|
.catch(error => reject(error));
|
|
183
147
|
});
|
|
184
148
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Salva a configuração de determinado recurso.
|
|
187
|
-
*/
|
|
188
149
|
async saveConfig(key, data) {
|
|
189
150
|
let payload = {
|
|
190
151
|
"serviceName": "SystemUtilsSP.saveConf",
|
|
@@ -203,97 +164,42 @@ export class SnkApplication {
|
|
|
203
164
|
.catch(error => reject(error));
|
|
204
165
|
});
|
|
205
166
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Acessa informações de contexto "empurrados" na abertura da tela
|
|
208
|
-
*/
|
|
209
167
|
async getAttributeFromHTMLWrapper(attribName) {
|
|
210
168
|
return Promise.resolve(window[attribName]);
|
|
211
169
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Abre determinada tela, repassando pkObject
|
|
214
|
-
*/
|
|
215
170
|
async openApp(resourceId, pkObject) {
|
|
216
171
|
Workspace.openAppActivity(resourceId, pkObject);
|
|
217
172
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Cria o DataUnit a partir do nome da entidade.
|
|
220
|
-
*/
|
|
221
173
|
async createDataunit(entityName) {
|
|
222
174
|
return new Promise(resolve => {
|
|
223
175
|
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
|
|
224
176
|
dataUnit.loadMetadata().then(() => resolve(dataUnit));
|
|
225
177
|
});
|
|
226
178
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Cria e armazena o DataUnit em um cache
|
|
229
|
-
*/
|
|
230
|
-
async getDataUnit(entityName, dataUnitName) {
|
|
231
|
-
return new Promise((resolve, reject) => {
|
|
232
|
-
const dataUnit = this._duCache.get(dataUnitName);
|
|
233
|
-
if (dataUnit) {
|
|
234
|
-
resolve(dataUnit);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
this.createDataunit(entityName).then(dataUnit => {
|
|
238
|
-
if (dataUnitName) {
|
|
239
|
-
this._duCache.set(dataUnitName, dataUnit);
|
|
240
|
-
}
|
|
241
|
-
resolve(dataUnit);
|
|
242
|
-
}).catch(reason => reject(reason));
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Retorna o resourceID da tela em questão.
|
|
248
|
-
*/
|
|
249
179
|
async getResourceID() {
|
|
250
180
|
return Promise.resolve(this.resourceID);
|
|
251
181
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Mostra o diálogo de alerta de acordo com os parâmetros passados.
|
|
254
|
-
*/
|
|
255
182
|
async alert(title, message, icon, options) {
|
|
256
183
|
return ApplicationUtils.alert(title, message, icon, options);
|
|
257
184
|
}
|
|
258
|
-
/**
|
|
259
|
-
* Mostra o diálogo de erro de acordo com os parâmetros passados.
|
|
260
|
-
*/
|
|
261
185
|
async error(title, message, icon, options) {
|
|
262
186
|
return ApplicationUtils.error(title, message, icon, options);
|
|
263
187
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Exibe um diálogo de confirmação
|
|
266
|
-
*/
|
|
267
188
|
async confirm(title, message, icon, critical, options) {
|
|
268
189
|
return ApplicationUtils.confirm(title, message, icon, critical, options);
|
|
269
190
|
}
|
|
270
|
-
/**
|
|
271
|
-
* Mostra uma informação efêmera (de segundo plano).
|
|
272
|
-
*/
|
|
273
191
|
async info(message, options) {
|
|
274
192
|
return ApplicationUtils.info(message, options);
|
|
275
193
|
}
|
|
276
|
-
/**
|
|
277
|
-
* Busca a configuração de formulário.
|
|
278
|
-
*/
|
|
279
194
|
async loadFormConfig(name) {
|
|
280
195
|
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
281
196
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
*/
|
|
285
|
-
async loadGridConfig(name) {
|
|
286
|
-
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
|
197
|
+
async loadGridConfig() {
|
|
198
|
+
return this.gridConfigFetcher.getConfig(this.resourceID);
|
|
287
199
|
}
|
|
288
|
-
/**
|
|
289
|
-
* Salva a configuração de grade.
|
|
290
|
-
*/
|
|
291
200
|
async saveGridConfig(config) {
|
|
292
201
|
return this.gridConfigFetcher.saveConfig(config, this.resourceID);
|
|
293
202
|
}
|
|
294
|
-
async getAuthList(_auth) {
|
|
295
|
-
return await (new MGEAuthorization()).parseFromJSON(_auth);
|
|
296
|
-
}
|
|
297
203
|
get urlParams() {
|
|
298
204
|
if (!this._urlParams) {
|
|
299
205
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -373,7 +279,7 @@ export class SnkApplication {
|
|
|
373
279
|
pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
|
|
374
280
|
pesquisaContent.selectItem = (option) => {
|
|
375
281
|
accept(option);
|
|
376
|
-
this.
|
|
282
|
+
this.clearPopUpTitle();
|
|
377
283
|
this.closePopUp();
|
|
378
284
|
};
|
|
379
285
|
this.setPopUpTitle(DESCRIPTIONENTITY);
|
|
@@ -390,11 +296,18 @@ export class SnkApplication {
|
|
|
390
296
|
accept(window['isDebugMode']);
|
|
391
297
|
});
|
|
392
298
|
}
|
|
393
|
-
|
|
394
|
-
this._popUp
|
|
299
|
+
clearPopUpContent() {
|
|
300
|
+
if (this._popUp) {
|
|
301
|
+
Array.from(this._popUp.children).forEach(c => {
|
|
302
|
+
this._popUp.removeChild(c);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
clearPopUpTitle() {
|
|
307
|
+
this._popUp.ezTitle = "";
|
|
395
308
|
}
|
|
396
309
|
setPopUpTitle(title) {
|
|
397
|
-
this._popUp
|
|
310
|
+
this._popUp.ezTitle = title;
|
|
398
311
|
}
|
|
399
312
|
componentWillLoad() {
|
|
400
313
|
this._errorHandler = new SnkErrorHandler(this);
|
|
@@ -404,7 +317,6 @@ export class SnkApplication {
|
|
|
404
317
|
});
|
|
405
318
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
|
406
319
|
ErrorTracking.init();
|
|
407
|
-
ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
|
408
320
|
}
|
|
409
321
|
connectedCallback() {
|
|
410
322
|
DataFetcher.addRequestListener(this._requestListener);
|
|
@@ -454,7 +366,7 @@ export class SnkApplication {
|
|
|
454
366
|
"composed": true,
|
|
455
367
|
"docs": {
|
|
456
368
|
"tags": [],
|
|
457
|
-
"text": "Evento
|
|
369
|
+
"text": "Evento"
|
|
458
370
|
},
|
|
459
371
|
"complexType": {
|
|
460
372
|
"original": "boolean",
|
|
@@ -475,7 +387,7 @@ export class SnkApplication {
|
|
|
475
387
|
"return": "Promise<boolean>"
|
|
476
388
|
},
|
|
477
389
|
"docs": {
|
|
478
|
-
"text": "
|
|
390
|
+
"text": "",
|
|
479
391
|
"tags": []
|
|
480
392
|
}
|
|
481
393
|
},
|
|
@@ -498,7 +410,7 @@ export class SnkApplication {
|
|
|
498
410
|
"return": "Promise<boolean>"
|
|
499
411
|
},
|
|
500
412
|
"docs": {
|
|
501
|
-
"text": "
|
|
413
|
+
"text": "",
|
|
502
414
|
"tags": []
|
|
503
415
|
}
|
|
504
416
|
},
|
|
@@ -514,7 +426,7 @@ export class SnkApplication {
|
|
|
514
426
|
"return": "Promise<any>"
|
|
515
427
|
},
|
|
516
428
|
"docs": {
|
|
517
|
-
"text": "
|
|
429
|
+
"text": "",
|
|
518
430
|
"tags": []
|
|
519
431
|
}
|
|
520
432
|
},
|
|
@@ -533,7 +445,7 @@ export class SnkApplication {
|
|
|
533
445
|
"return": "Promise<string>"
|
|
534
446
|
},
|
|
535
447
|
"docs": {
|
|
536
|
-
"text": "
|
|
448
|
+
"text": "",
|
|
537
449
|
"tags": []
|
|
538
450
|
}
|
|
539
451
|
},
|
|
@@ -552,7 +464,7 @@ export class SnkApplication {
|
|
|
552
464
|
"return": "Promise<number>"
|
|
553
465
|
},
|
|
554
466
|
"docs": {
|
|
555
|
-
"text": "
|
|
467
|
+
"text": "",
|
|
556
468
|
"tags": []
|
|
557
469
|
}
|
|
558
470
|
},
|
|
@@ -571,7 +483,7 @@ export class SnkApplication {
|
|
|
571
483
|
"return": "Promise<number>"
|
|
572
484
|
},
|
|
573
485
|
"docs": {
|
|
574
|
-
"text": "
|
|
486
|
+
"text": "",
|
|
575
487
|
"tags": []
|
|
576
488
|
}
|
|
577
489
|
},
|
|
@@ -590,7 +502,7 @@ export class SnkApplication {
|
|
|
590
502
|
"return": "Promise<boolean>"
|
|
591
503
|
},
|
|
592
504
|
"docs": {
|
|
593
|
-
"text": "
|
|
505
|
+
"text": "",
|
|
594
506
|
"tags": []
|
|
595
507
|
}
|
|
596
508
|
},
|
|
@@ -612,7 +524,7 @@ export class SnkApplication {
|
|
|
612
524
|
"return": "Promise<Date>"
|
|
613
525
|
},
|
|
614
526
|
"docs": {
|
|
615
|
-
"text": "
|
|
527
|
+
"text": "",
|
|
616
528
|
"tags": []
|
|
617
529
|
}
|
|
618
530
|
},
|
|
@@ -634,7 +546,7 @@ export class SnkApplication {
|
|
|
634
546
|
"return": "Promise<void>"
|
|
635
547
|
},
|
|
636
548
|
"docs": {
|
|
637
|
-
"text": "
|
|
549
|
+
"text": "",
|
|
638
550
|
"tags": []
|
|
639
551
|
}
|
|
640
552
|
},
|
|
@@ -650,7 +562,7 @@ export class SnkApplication {
|
|
|
650
562
|
"return": "Promise<void>"
|
|
651
563
|
},
|
|
652
564
|
"docs": {
|
|
653
|
-
"text": "
|
|
565
|
+
"text": "",
|
|
654
566
|
"tags": []
|
|
655
567
|
}
|
|
656
568
|
},
|
|
@@ -669,7 +581,7 @@ export class SnkApplication {
|
|
|
669
581
|
"return": "Promise<boolean>"
|
|
670
582
|
},
|
|
671
583
|
"docs": {
|
|
672
|
-
"text": "
|
|
584
|
+
"text": "",
|
|
673
585
|
"tags": []
|
|
674
586
|
}
|
|
675
587
|
},
|
|
@@ -688,7 +600,7 @@ export class SnkApplication {
|
|
|
688
600
|
"return": "Promise<any>"
|
|
689
601
|
},
|
|
690
602
|
"docs": {
|
|
691
|
-
"text": "
|
|
603
|
+
"text": "",
|
|
692
604
|
"tags": []
|
|
693
605
|
}
|
|
694
606
|
},
|
|
@@ -713,7 +625,7 @@ export class SnkApplication {
|
|
|
713
625
|
"return": "Promise<any>"
|
|
714
626
|
},
|
|
715
627
|
"docs": {
|
|
716
|
-
"text": "
|
|
628
|
+
"text": "",
|
|
717
629
|
"tags": []
|
|
718
630
|
}
|
|
719
631
|
},
|
|
@@ -732,7 +644,7 @@ export class SnkApplication {
|
|
|
732
644
|
"return": "Promise<string>"
|
|
733
645
|
},
|
|
734
646
|
"docs": {
|
|
735
|
-
"text": "
|
|
647
|
+
"text": "",
|
|
736
648
|
"tags": []
|
|
737
649
|
}
|
|
738
650
|
},
|
|
@@ -757,7 +669,7 @@ export class SnkApplication {
|
|
|
757
669
|
"return": "Promise<void>"
|
|
758
670
|
},
|
|
759
671
|
"docs": {
|
|
760
|
-
"text": "
|
|
672
|
+
"text": "",
|
|
761
673
|
"tags": []
|
|
762
674
|
}
|
|
763
675
|
},
|
|
@@ -780,33 +692,7 @@ export class SnkApplication {
|
|
|
780
692
|
"return": "Promise<DataUnit>"
|
|
781
693
|
},
|
|
782
694
|
"docs": {
|
|
783
|
-
"text": "
|
|
784
|
-
"tags": []
|
|
785
|
-
}
|
|
786
|
-
},
|
|
787
|
-
"getDataUnit": {
|
|
788
|
-
"complexType": {
|
|
789
|
-
"signature": "(entityName: string, dataUnitName: string) => Promise<DataUnit>",
|
|
790
|
-
"parameters": [{
|
|
791
|
-
"tags": [],
|
|
792
|
-
"text": ""
|
|
793
|
-
}, {
|
|
794
|
-
"tags": [],
|
|
795
|
-
"text": ""
|
|
796
|
-
}],
|
|
797
|
-
"references": {
|
|
798
|
-
"Promise": {
|
|
799
|
-
"location": "global"
|
|
800
|
-
},
|
|
801
|
-
"DataUnit": {
|
|
802
|
-
"location": "import",
|
|
803
|
-
"path": "@sankhyalabs/core"
|
|
804
|
-
}
|
|
805
|
-
},
|
|
806
|
-
"return": "Promise<DataUnit>"
|
|
807
|
-
},
|
|
808
|
-
"docs": {
|
|
809
|
-
"text": "Cria e armazena o DataUnit em um cache",
|
|
695
|
+
"text": "",
|
|
810
696
|
"tags": []
|
|
811
697
|
}
|
|
812
698
|
},
|
|
@@ -822,7 +708,7 @@ export class SnkApplication {
|
|
|
822
708
|
"return": "Promise<string>"
|
|
823
709
|
},
|
|
824
710
|
"docs": {
|
|
825
|
-
"text": "
|
|
711
|
+
"text": "",
|
|
826
712
|
"tags": []
|
|
827
713
|
}
|
|
828
714
|
},
|
|
@@ -854,7 +740,7 @@ export class SnkApplication {
|
|
|
854
740
|
"return": "Promise<boolean>"
|
|
855
741
|
},
|
|
856
742
|
"docs": {
|
|
857
|
-
"text": "
|
|
743
|
+
"text": "",
|
|
858
744
|
"tags": []
|
|
859
745
|
}
|
|
860
746
|
},
|
|
@@ -886,7 +772,7 @@ export class SnkApplication {
|
|
|
886
772
|
"return": "Promise<boolean>"
|
|
887
773
|
},
|
|
888
774
|
"docs": {
|
|
889
|
-
"text": "
|
|
775
|
+
"text": "",
|
|
890
776
|
"tags": []
|
|
891
777
|
}
|
|
892
778
|
},
|
|
@@ -921,7 +807,7 @@ export class SnkApplication {
|
|
|
921
807
|
"return": "Promise<boolean>"
|
|
922
808
|
},
|
|
923
809
|
"docs": {
|
|
924
|
-
"text": "
|
|
810
|
+
"text": "",
|
|
925
811
|
"tags": []
|
|
926
812
|
}
|
|
927
813
|
},
|
|
@@ -947,7 +833,7 @@ export class SnkApplication {
|
|
|
947
833
|
"return": "Promise<void>"
|
|
948
834
|
},
|
|
949
835
|
"docs": {
|
|
950
|
-
"text": "
|
|
836
|
+
"text": "",
|
|
951
837
|
"tags": []
|
|
952
838
|
}
|
|
953
839
|
},
|
|
@@ -973,17 +859,14 @@ export class SnkApplication {
|
|
|
973
859
|
"return": "Promise<FieldConfig[]>"
|
|
974
860
|
},
|
|
975
861
|
"docs": {
|
|
976
|
-
"text": "
|
|
862
|
+
"text": "",
|
|
977
863
|
"tags": []
|
|
978
864
|
}
|
|
979
865
|
},
|
|
980
866
|
"loadGridConfig": {
|
|
981
867
|
"complexType": {
|
|
982
|
-
"signature": "(
|
|
983
|
-
"parameters": [
|
|
984
|
-
"tags": [],
|
|
985
|
-
"text": ""
|
|
986
|
-
}],
|
|
868
|
+
"signature": "() => Promise<EzGridConfig>",
|
|
869
|
+
"parameters": [],
|
|
987
870
|
"references": {
|
|
988
871
|
"Promise": {
|
|
989
872
|
"location": "global"
|
|
@@ -996,7 +879,7 @@ export class SnkApplication {
|
|
|
996
879
|
"return": "Promise<EzGridConfig>"
|
|
997
880
|
},
|
|
998
881
|
"docs": {
|
|
999
|
-
"text": "
|
|
882
|
+
"text": "",
|
|
1000
883
|
"tags": []
|
|
1001
884
|
}
|
|
1002
885
|
},
|
|
@@ -1019,7 +902,7 @@ export class SnkApplication {
|
|
|
1019
902
|
"return": "Promise<boolean>"
|
|
1020
903
|
},
|
|
1021
904
|
"docs": {
|
|
1022
|
-
"text": "
|
|
905
|
+
"text": "",
|
|
1023
906
|
"tags": []
|
|
1024
907
|
}
|
|
1025
908
|
},
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
--snk-pesquisa__content-scrollbar--background-color: var(--text--primary, #626e82);
|
|
22
22
|
|
|
23
23
|
/*@doc Define o raio da borda da barra de rolagem do componente.*/
|
|
24
|
-
--snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-
|
|
24
|
+
--snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-small, 6px);
|
|
25
25
|
|
|
26
26
|
/*@doc Define a largura da barra de rolagem do componente.*/
|
|
27
|
-
--snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px)
|
|
27
|
+
--snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px);
|
|
28
28
|
|
|
29
29
|
max-height: 100%;
|
|
30
30
|
height: 100%;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ChangeOperation,
|
|
2
|
-
import { gql } from "graphql-request";
|
|
1
|
+
import { DataUnit, ChangeOperation, StringUtils, DataType, } from "@sankhyalabs/core";
|
|
3
2
|
import { DataFetcher } from "../DataFetcher";
|
|
3
|
+
import { gql } from "graphql-request";
|
|
4
4
|
export default class DataUnitFetcher {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.templateByQuery = new Map();
|
|
7
|
-
this._loadDataTimeout = {};
|
|
8
7
|
this.buldTemplates();
|
|
9
8
|
}
|
|
10
9
|
buldTemplates() {
|
|
@@ -33,9 +32,9 @@ export default class DataUnitFetcher {
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
}`);
|
|
36
|
-
this.templateByQuery.set("fetchData", gql `query($dataunit: String! $limit: Int $offset:Int $
|
|
35
|
+
this.templateByQuery.set("fetchData", gql `query($dataunit: String! $limit: Int $offset:Int $filter: [InputFilter!] $sort: [InputSort!]) {
|
|
37
36
|
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
38
|
-
data(limit: $limit offset: $offset filters: $
|
|
37
|
+
data(limit: $limit offset: $offset filters: $filter sort: $sort){
|
|
39
38
|
limit
|
|
40
39
|
offset
|
|
41
40
|
total
|
|
@@ -64,7 +63,7 @@ export default class DataUnitFetcher {
|
|
|
64
63
|
getDataUnit(entityName, resourceID) {
|
|
65
64
|
const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
|
|
66
65
|
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
|
67
|
-
dataUnit.dataLoader = (dataUnit,
|
|
66
|
+
dataUnit.dataLoader = (dataUnit, page, sort, filters) => this.loadData(dataUnit, page, sort, filters);
|
|
68
67
|
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
69
68
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
70
69
|
return dataUnit;
|
|
@@ -101,39 +100,25 @@ export default class DataUnitFetcher {
|
|
|
101
100
|
});
|
|
102
101
|
});
|
|
103
102
|
}
|
|
104
|
-
loadData(dataUnit,
|
|
105
|
-
const duName = dataUnit.name;
|
|
106
|
-
if (this._loadDataTimeout[duName]) {
|
|
107
|
-
clearTimeout(this._loadDataTimeout[duName]);
|
|
108
|
-
delete this._loadDataTimeout[duName];
|
|
109
|
-
}
|
|
110
|
-
return new Promise((resolve, reject) => {
|
|
111
|
-
this._loadDataTimeout[duName] = setTimeout(() => {
|
|
112
|
-
delete this._loadDataTimeout[duName];
|
|
113
|
-
this.doLoadData(dataUnit, request)
|
|
114
|
-
.then(result => resolve(result))
|
|
115
|
-
.catch(reason => reject(reason));
|
|
116
|
-
}, 200);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
doLoadData(dataUnit, request) {
|
|
103
|
+
loadData(dataUnit, page, sort, filter) {
|
|
120
104
|
return new Promise((resolve, reject) => {
|
|
121
|
-
var _a;
|
|
122
|
-
const {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
105
|
+
var _a, _b, _c;
|
|
106
|
+
const variables = { dataunit: dataUnit.name, sort, filter };
|
|
107
|
+
if (page) {
|
|
108
|
+
variables.limit = page.limit;
|
|
109
|
+
variables.offset = page.offset;
|
|
110
|
+
}
|
|
111
|
+
if (!StringUtils.isEmpty((_a = page === null || page === void 0 ? void 0 : page.quickFilter) === null || _a === void 0 ? void 0 : _a.term)) {
|
|
127
112
|
if (variables.filter === undefined) {
|
|
128
113
|
variables.filter = [];
|
|
129
114
|
}
|
|
130
115
|
const quickFilterCriteria = {
|
|
131
116
|
name: "__QUICK_FILTER__",
|
|
132
117
|
expression: "__QUICK_FILTER__",
|
|
133
|
-
params: [{ name: "term", dataType: DataType.TEXT, value: quickFilter.term }]
|
|
118
|
+
params: [{ name: "term", dataType: DataType.TEXT, value: page.quickFilter.term }]
|
|
134
119
|
};
|
|
135
|
-
if (((
|
|
136
|
-
quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: quickFilter.fields });
|
|
120
|
+
if (((_c = (_b = page.quickFilter) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
121
|
+
quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: page.quickFilter.fields });
|
|
137
122
|
}
|
|
138
123
|
variables.filter.push(quickFilterCriteria);
|
|
139
124
|
}
|
|
@@ -143,32 +128,16 @@ export default class DataUnitFetcher {
|
|
|
143
128
|
query: this.templateByQuery.get("fetchData"),
|
|
144
129
|
})
|
|
145
130
|
.then((resp) => {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const firstRecord = offset + 1;
|
|
150
|
-
const lastRecord = offset + Math.min(records.length, limit);
|
|
151
|
-
const currentPage = offset / limit;
|
|
152
|
-
paginationInfo = {
|
|
153
|
-
firstRecord,
|
|
154
|
-
lastRecord,
|
|
155
|
-
total,
|
|
156
|
-
currentPage,
|
|
157
|
-
hasMore
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
const processedRecords = [];
|
|
161
|
-
records.forEach((responseRecord) => {
|
|
131
|
+
const pageResult = resp.data;
|
|
132
|
+
const records = [];
|
|
133
|
+
pageResult.records.forEach((responseRecord) => {
|
|
162
134
|
const duRecord = { __record__id__: responseRecord.id };
|
|
163
135
|
responseRecord.fields.forEach(({ name, value }) => {
|
|
164
136
|
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
165
137
|
});
|
|
166
|
-
|
|
167
|
-
});
|
|
168
|
-
resolve({
|
|
169
|
-
paginationInfo,
|
|
170
|
-
records: processedRecords
|
|
138
|
+
records.push(duRecord);
|
|
171
139
|
});
|
|
140
|
+
resolve(Object.assign(Object.assign({}, pageResult), { records }));
|
|
172
141
|
})
|
|
173
142
|
.catch((error) => {
|
|
174
143
|
reject(error);
|
|
@@ -4,16 +4,15 @@ export default class GridConfigFetcher extends ResourceFetcher {
|
|
|
4
4
|
super(...arguments);
|
|
5
5
|
this.GRID_CONFIG_VERSION = "V3:";
|
|
6
6
|
}
|
|
7
|
-
getConfig(
|
|
7
|
+
getConfig(resourceID) {
|
|
8
8
|
const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
this.loadResource(completePath)
|
|
11
11
|
.then(loadedResource => {
|
|
12
|
-
let config = undefined;
|
|
13
12
|
if (loadedResource) {
|
|
14
|
-
config = JSON.parse(loadedResource);
|
|
13
|
+
let config = JSON.parse(loadedResource);
|
|
14
|
+
resolve(config);
|
|
15
15
|
}
|
|
16
|
-
resolve(config);
|
|
17
16
|
}).catch((error) => {
|
|
18
17
|
reject(error);
|
|
19
18
|
});
|