@jtandrelevicius/utils-js-library 1.0.2 → 1.0.4
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/index.js +24 -22
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -53,7 +53,6 @@ class DataQueryService {
|
|
|
53
53
|
* @returns {Promise<Array<Object>>} Promise resolvendo com os dados.
|
|
54
54
|
*/
|
|
55
55
|
static async fetch(query, params = null) {
|
|
56
|
-
// Tenta usar o executor configurado ou busca o global executeQuery como fallback
|
|
57
56
|
const executor = this.executor || (typeof window !== 'undefined' ? window.executeQuery : null);
|
|
58
57
|
|
|
59
58
|
if (typeof executor !== 'function') {
|
|
@@ -110,7 +109,7 @@ class DataQueryService {
|
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
/**
|
|
113
|
-
* FormatUtils
|
|
112
|
+
* FormatUtils
|
|
114
113
|
* Utilitários para formatação de moeda, números e datas (Locale pt-BR).
|
|
115
114
|
*/
|
|
116
115
|
class FormatUtils {
|
|
@@ -188,7 +187,7 @@ class FormatUtils {
|
|
|
188
187
|
}
|
|
189
188
|
|
|
190
189
|
/**
|
|
191
|
-
* SortUtils
|
|
190
|
+
* SortUtils
|
|
192
191
|
* Utilitários para ordenação de listas.
|
|
193
192
|
*/
|
|
194
193
|
class SortUtils {
|
|
@@ -216,7 +215,7 @@ class SortUtils {
|
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
/**
|
|
219
|
-
* ExportService
|
|
218
|
+
* ExportService
|
|
220
219
|
* Exportação para Excel (.xlsx) e CSV.
|
|
221
220
|
*/
|
|
222
221
|
class ExportService {
|
|
@@ -285,26 +284,29 @@ class ExportService {
|
|
|
285
284
|
}
|
|
286
285
|
}
|
|
287
286
|
|
|
288
|
-
if (typeof window !== 'undefined') {
|
|
289
|
-
window.JSK = DataQueryService;
|
|
290
|
-
window.JFSK = FormatUtils;
|
|
291
|
-
window.JOSK = SortUtils;
|
|
292
|
-
window.JEXSK = ExportService;
|
|
293
287
|
|
|
288
|
+
const lib = {
|
|
289
|
+
DataQueryService,
|
|
290
|
+
FormatUtils,
|
|
291
|
+
SortUtils,
|
|
292
|
+
ExportService,
|
|
293
|
+
|
|
294
|
+
JSK: DataQueryService,
|
|
295
|
+
JFSK: FormatUtils,
|
|
296
|
+
JOSK: SortUtils,
|
|
297
|
+
JEXSK: ExportService
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
if (typeof module !== 'undefined' && module.exports) {
|
|
302
|
+
module.exports = lib;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
else if (typeof window !== 'undefined') {
|
|
306
|
+
Object.assign(window, lib);
|
|
307
|
+
|
|
294
308
|
if (typeof window.executeQuery === 'function') {
|
|
295
309
|
DataQueryService.setExecutor(window.executeQuery);
|
|
296
310
|
console.log("[DataQueryService] Executor 'executeQuery' detectado e configurado automaticamente.");
|
|
297
311
|
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export {
|
|
301
|
-
DataQueryService,
|
|
302
|
-
FormatUtils,
|
|
303
|
-
SortUtils,
|
|
304
|
-
ExportService,
|
|
305
|
-
// Aliases
|
|
306
|
-
DataQueryService as JSK,
|
|
307
|
-
FormatUtils as JFSK,
|
|
308
|
-
SortUtils as JOSK,
|
|
309
|
-
ExportService as JEXSK
|
|
310
|
-
};
|
|
312
|
+
}
|