@sankhyalabs/sankhyablocks 10.1.0-dev.23 → 10.1.0-dev.25
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/{ConfigStorage-a4e1e518.js → ConfigStorage-d9d24844.js} +2 -2
- package/dist/cjs/{DataFetcher-0b6aa084.js → DataFetcher-3a8ea521.js} +2 -2743
- package/dist/cjs/{ISave-2c455a77.js → ISave-a66bb65e.js} +1 -1
- package/dist/cjs/ImageUtils-5e3f406b.js +142 -0
- package/dist/cjs/{SnkFormConfigManager-b8c81493.js → SnkFormConfigManager-c88cf1e9.js} +2 -2
- package/dist/cjs/SnkMessageBuilder-d9558dba.js +2809 -0
- package/dist/cjs/{SnkMultiSelectionListDataSource-03b58f5a.js → SnkMultiSelectionListDataSource-a891430e.js} +4 -4
- package/dist/cjs/{auth-fetcher-7e7796c9.js → auth-fetcher-faa61f64.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-8dffbcdf.js → dataunit-fetcher-4320f7ec.js} +3 -2
- package/dist/cjs/{form-config-fetcher-5516d68a.js → form-config-fetcher-72cf0e3d.js} +1 -1
- package/dist/cjs/index-1894343a.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +5 -4
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button_9.cjs.entry.js → snk-actions-button_8.cjs.entry.js} +7 -56
- package/dist/cjs/snk-application.cjs.entry.js +8 -7
- package/dist/cjs/snk-attach.cjs.entry.js +7 -6
- package/dist/cjs/snk-crud.cjs.entry.js +7 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -5
- package/dist/cjs/{snk-data-unit-036ce58c.js → snk-data-unit-b54fdf9a.js} +11 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +15 -11
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +4 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +4 -3
- package/dist/cjs/snk-form-view.cjs.entry.js +72 -7
- package/dist/cjs/snk-form_2.cjs.entry.js +5 -4
- package/dist/cjs/snk-grid.cjs.entry.js +10 -7
- package/dist/cjs/{snk-guides-viewer-164c063e.js → snk-guides-viewer-4bbd697f.js} +10 -9
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -7
- package/dist/cjs/snk-image-input.cjs.entry.js +148 -0
- package/dist/cjs/snk-layout-form-config.cjs.entry.js +72 -0
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +4 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -4
- package/dist/cjs/snk-simple-crud.cjs.entry.js +8 -7
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/snk-application/snk-application.js +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/GuideBuilder.js +1 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +4 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +93 -8
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +5 -4
- package/dist/collection/components/snk-grid/snk-grid.js +3 -1
- package/dist/collection/components/snk-image-input/snk-image-input.css +3 -0
- package/dist/collection/components/snk-image-input/snk-image-input.js +326 -0
- package/dist/collection/components/snk-image-input/utils/ImageUtils.js +133 -0
- package/dist/collection/components/snk-layout-form-config/snk-layout-form-config.js +1 -1
- package/dist/collection/components/snk-layout-form-config/snk-view-representation/snk-view-representation.js +1 -1
- package/dist/collection/lib/message/messageResourceEnUSUtils.js +2 -0
- package/dist/collection/lib/message/messageResourceEsESUtils.js +2 -0
- package/dist/collection/lib/message/messageResourcePtBRUtils.js +2 -0
- package/dist/collection/lib/message/resources/en-us/snk-crud.msg.js +1 -1
- package/dist/collection/lib/message/resources/en-us/snk-image-input.msg.js +11 -0
- package/dist/collection/lib/message/resources/en-us/snk-layout-form-config.msg.js +10 -2
- package/dist/collection/lib/message/resources/es-es/snk-crud.msg.js +1 -1
- package/dist/collection/lib/message/resources/es-es/snk-image-input.msg.js +11 -0
- package/dist/collection/lib/message/resources/es-es/snk-layout-form-config.msg.js +8 -0
- package/dist/collection/lib/message/resources/pt-br/snk-configurator.msg.js +1 -1
- package/dist/collection/lib/message/resources/pt-br/snk-crud.msg.js +1 -1
- package/dist/collection/lib/message/resources/pt-br/snk-image-input.msg.js +11 -0
- package/dist/collection/lib/message/resources/pt-br/snk-layout-form-config.msg.js +10 -2
- package/dist/components/DataFetcher.js +3 -2743
- package/dist/components/SnkMessageBuilder.js +2807 -0
- package/dist/components/dataunit-fetcher.js +2 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-application2.js +2 -1
- package/dist/components/snk-attach2.js +2 -1
- package/dist/components/snk-crud.js +70 -64
- package/dist/components/snk-data-unit2.js +1 -1
- package/dist/components/snk-detail-view2.js +105 -89
- package/dist/components/snk-form-view2.js +82 -10
- package/dist/components/snk-grid2.js +3 -1
- package/dist/components/snk-image-input.d.ts +11 -0
- package/dist/components/snk-image-input.js +6 -0
- package/dist/components/snk-image-input2.js +302 -0
- package/dist/components/snk-layout-form-config2.js +1 -1
- package/dist/components/snk-view-representation2.js +1 -1
- package/dist/esm/{ConfigStorage-39ac8fef.js → ConfigStorage-d15d2014.js} +2 -2
- package/dist/esm/{DataFetcher-0b9da57d.js → DataFetcher-1dd7e8c0.js} +3 -2743
- package/dist/esm/{ISave-f1c9269b.js → ISave-498c4831.js} +1 -1
- package/dist/esm/ImageUtils-8fc8d905.js +136 -0
- package/dist/esm/{SnkFormConfigManager-a87566c8.js → SnkFormConfigManager-86befa68.js} +2 -2
- package/dist/esm/SnkMessageBuilder-c0bc4424.js +2807 -0
- package/dist/esm/{SnkMultiSelectionListDataSource-01b3744b.js → SnkMultiSelectionListDataSource-14633bf6.js} +4 -4
- package/dist/esm/{auth-fetcher-acdc1cb4.js → auth-fetcher-69cbda8d.js} +1 -1
- package/dist/esm/{dataunit-fetcher-4c312b43.js → dataunit-fetcher-3d5c4ae4.js} +2 -1
- package/dist/esm/{form-config-fetcher-7cda6254.js → form-config-fetcher-fcc7b62f.js} +1 -1
- package/dist/esm/index-04f73a26.js +10 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +5 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button_9.entry.js → snk-actions-button_8.entry.js} +8 -56
- package/dist/esm/snk-application.entry.js +7 -6
- package/dist/esm/snk-attach.entry.js +6 -5
- package/dist/esm/snk-crud.entry.js +7 -6
- package/dist/esm/snk-data-exporter.entry.js +6 -5
- package/dist/esm/{snk-data-unit-130021b3.js → snk-data-unit-363c3551.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +4 -3
- package/dist/esm/snk-detail-view.entry.js +13 -9
- package/dist/esm/snk-filter-bar_4.entry.js +4 -3
- package/dist/esm/snk-filter-modal-item.entry.js +4 -3
- package/dist/esm/snk-form-view.entry.js +73 -8
- package/dist/esm/snk-form_2.entry.js +5 -4
- package/dist/esm/snk-grid.entry.js +10 -7
- package/dist/esm/{snk-guides-viewer-3fd18298.js → snk-guides-viewer-97708c80.js} +10 -9
- package/dist/esm/snk-guides-viewer.entry.js +8 -7
- package/dist/esm/snk-image-input.entry.js +144 -0
- package/dist/esm/snk-layout-form-config.entry.js +68 -0
- package/dist/esm/snk-personalized-filter.entry.js +4 -3
- package/dist/esm/snk-pesquisa.entry.js +5 -4
- package/dist/esm/snk-simple-crud.entry.js +8 -7
- package/dist/sankhyablocks/p-10cad767.entry.js +1 -0
- package/dist/sankhyablocks/p-18cc9111.entry.js +1 -0
- package/dist/sankhyablocks/{p-5e2dffc1.entry.js → p-1df34264.entry.js} +2 -2
- package/dist/sankhyablocks/p-27d6590e.js +1 -0
- package/dist/sankhyablocks/p-2a356340.entry.js +1 -0
- package/dist/sankhyablocks/{p-998a9d6f.js → p-2ccbbeec.js} +1 -1
- package/dist/sankhyablocks/p-30641d55.entry.js +1 -0
- package/dist/sankhyablocks/{p-48a5c311.js → p-32ad76cc.js} +2 -2
- package/dist/sankhyablocks/p-3b07c117.entry.js +1 -0
- package/dist/sankhyablocks/p-43d84207.entry.js +1 -0
- package/dist/sankhyablocks/p-48c580b9.entry.js +1 -0
- package/dist/sankhyablocks/p-4ff3b494.js +1 -0
- package/dist/sankhyablocks/p-685bc841.js +60 -0
- package/dist/sankhyablocks/{p-d714b6ca.js → p-7c4f4851.js} +1 -1
- package/dist/sankhyablocks/{p-2ac55a5d.js → p-7e9f8fa4.js} +1 -1
- package/dist/sankhyablocks/{p-1f310bc6.js → p-9114e869.js} +1 -1
- package/dist/sankhyablocks/p-a65559fe.entry.js +1 -0
- package/dist/sankhyablocks/{p-7ee6b1bf.js → p-a9839628.js} +1 -1
- package/dist/sankhyablocks/p-b2b56f04.js +1 -0
- package/dist/sankhyablocks/p-bb81a356.entry.js +1 -0
- package/dist/sankhyablocks/p-bdf0077f.js +1 -0
- package/dist/sankhyablocks/p-bf65dcc1.entry.js +1 -0
- package/dist/sankhyablocks/p-c6a97fda.entry.js +1 -0
- package/dist/sankhyablocks/p-c860552e.entry.js +1 -0
- package/dist/sankhyablocks/p-c9316c5d.entry.js +1 -0
- package/dist/sankhyablocks/p-e0a6818c.js +1 -0
- package/dist/sankhyablocks/p-e0e3914e.entry.js +1 -0
- package/dist/sankhyablocks/p-e973a5d4.entry.js +1 -0
- package/dist/sankhyablocks/p-ebce5394.entry.js +1 -0
- package/dist/sankhyablocks/p-fc5e95f4.entry.js +1 -0
- package/dist/sankhyablocks/p-fce86770.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -1
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +12 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +1 -0
- package/dist/types/components/snk-image-input/snk-image-input.d.ts +56 -0
- package/dist/types/components/snk-image-input/utils/ImageUtils.d.ts +15 -0
- package/dist/types/components.d.ts +89 -0
- package/dist/types/lib/message/resources/en-us/snk-image-input.msg.d.ts +1 -0
- package/dist/types/lib/message/resources/es-es/snk-image-input.msg.d.ts +1 -0
- package/dist/types/lib/message/resources/pt-br/snk-image-input.msg.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-12f595a6.entry.js +0 -1
- package/dist/sankhyablocks/p-18d66638.entry.js +0 -1
- package/dist/sankhyablocks/p-2a33d4cf.entry.js +0 -1
- package/dist/sankhyablocks/p-2c6be187.entry.js +0 -1
- package/dist/sankhyablocks/p-3a443150.entry.js +0 -1
- package/dist/sankhyablocks/p-3b6d8d33.entry.js +0 -1
- package/dist/sankhyablocks/p-3db72758.entry.js +0 -1
- package/dist/sankhyablocks/p-52691b42.js +0 -1
- package/dist/sankhyablocks/p-6768f176.js +0 -1
- package/dist/sankhyablocks/p-6d322b0a.js +0 -1
- package/dist/sankhyablocks/p-877d9614.entry.js +0 -1
- package/dist/sankhyablocks/p-94267a30.entry.js +0 -1
- package/dist/sankhyablocks/p-9e4555ab.js +0 -60
- package/dist/sankhyablocks/p-acd2ba28.entry.js +0 -1
- package/dist/sankhyablocks/p-b533edab.entry.js +0 -1
- package/dist/sankhyablocks/p-c2d33fc8.entry.js +0 -1
- package/dist/sankhyablocks/p-cd40c8cf.entry.js +0 -1
- package/dist/sankhyablocks/p-cd412add.entry.js +0 -1
- package/dist/sankhyablocks/p-d6dad5e4.entry.js +0 -1
- package/dist/sankhyablocks/p-f8c5395a.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UserInterface, DataType, ApplicationContext, ErrorException } from '@sankhyalabs/core';
|
|
2
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
|
2
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-1dd7e8c0.js';
|
|
3
3
|
|
|
4
4
|
function buildGridMetadata(rawValue) {
|
|
5
5
|
const fieldsMetadata = buildFieldsMetadata(rawValue.fieldsMetadata);
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
|
|
3
|
+
async function base64ToBlob(base64) {
|
|
4
|
+
const response = await fetch(base64);
|
|
5
|
+
return await response.blob();
|
|
6
|
+
}
|
|
7
|
+
function buildFileKey(entityName, fieldName) {
|
|
8
|
+
if (entityName) {
|
|
9
|
+
return `${entityName}_${fieldName}`;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return fieldName;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function hasSpecialCharacters(value) {
|
|
16
|
+
const specialChars = /[ !@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?]/;
|
|
17
|
+
return specialChars.test(value);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gera a URL base para upload de sessão
|
|
21
|
+
*/
|
|
22
|
+
function getSessionUploadBaseUrl(fileKey, context = 'mge') {
|
|
23
|
+
let url = `/${context}/sessionUpload.${context}?sessionkey=${fileKey}`;
|
|
24
|
+
// Verifica se precisa processar caracteres especiais
|
|
25
|
+
if (canProcessSpecialKeys(context) && hasSpecialCharacters(fileKey)) {
|
|
26
|
+
url += `&encodedKey=${btoa(encodeURI(fileKey))}`;
|
|
27
|
+
}
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Verifica se pode processar chaves especiais
|
|
32
|
+
* Baseado no método canProcessSpecialKeys do sessionfileupload.service.js
|
|
33
|
+
*/
|
|
34
|
+
async function canProcessSpecialKeys(context) {
|
|
35
|
+
var _a;
|
|
36
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
37
|
+
if (!application)
|
|
38
|
+
return false;
|
|
39
|
+
const resourceId = await ((_a = application.getResourceID) === null || _a === void 0 ? void 0 : _a.call(application)) || '';
|
|
40
|
+
const adPrefix = "br.com.sankhya.menu.adicional";
|
|
41
|
+
return context === 'mge' && resourceId.startsWith(adPrefix);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Constrói a URL de upload
|
|
45
|
+
* Baseado no método buildUploadURL do sessionfileupload.service.js
|
|
46
|
+
*/
|
|
47
|
+
function buildUploadURL(fileKey) {
|
|
48
|
+
let url = getSessionUploadBaseUrl(fileKey);
|
|
49
|
+
url += "&fitem=S&salvar=S&useCache=N";
|
|
50
|
+
return url;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Faz upload de arquivo para a sessão usando XMLHttpRequest
|
|
54
|
+
* Baseado no método uploadSessionFile do sessionfileupload.service.js
|
|
55
|
+
*/
|
|
56
|
+
async function sessionFileUpload(blob, entityName, fieldName, onProgress) {
|
|
57
|
+
const fileKey = buildFileKey(entityName, fieldName);
|
|
58
|
+
const uploadUrl = buildUploadURL(fileKey);
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const formData = new FormData();
|
|
61
|
+
formData.append('arquivo', blob);
|
|
62
|
+
const http = new XMLHttpRequest();
|
|
63
|
+
http.addEventListener("load", () => {
|
|
64
|
+
if (http.status >= 200 && http.status < 300) {
|
|
65
|
+
resolve(`/mge/UPLOADING_${fileKey}.dbimage`);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
reject(new Error(`Upload failed: ${http.statusText}`));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
http.addEventListener("error", () => {
|
|
72
|
+
reject(new Error('Upload error'));
|
|
73
|
+
});
|
|
74
|
+
if (onProgress) {
|
|
75
|
+
http.upload.addEventListener("progress", onProgress);
|
|
76
|
+
}
|
|
77
|
+
http.open("POST", uploadUrl);
|
|
78
|
+
http.send(formData);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function getUrlBase() {
|
|
82
|
+
return window.location.origin;
|
|
83
|
+
}
|
|
84
|
+
function getBaseUrl(pk, entityName, fieldName) {
|
|
85
|
+
if (!pk)
|
|
86
|
+
return undefined;
|
|
87
|
+
const baseUrl = getUrlBase();
|
|
88
|
+
let url = `${baseUrl}/mge/${entityName}@${fieldName}`;
|
|
89
|
+
for (const pkField in pk) {
|
|
90
|
+
url += `@${pkField}=${pk[pkField]}`;
|
|
91
|
+
}
|
|
92
|
+
url += '.dbimage';
|
|
93
|
+
return url;
|
|
94
|
+
}
|
|
95
|
+
function getPKs(dataUnit) {
|
|
96
|
+
if (!dataUnit) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const pk = {};
|
|
100
|
+
const fields = dataUnit.metadata.fields;
|
|
101
|
+
const selectedRecord = dataUnit.getSelectedRecord();
|
|
102
|
+
fields.forEach((field) => {
|
|
103
|
+
if (field.properties['isPrimaryKey']) {
|
|
104
|
+
pk[field.name] = selectedRecord[field.name];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return pk;
|
|
108
|
+
}
|
|
109
|
+
async function imageBlobToBase64(blob) {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
const reader = new FileReader();
|
|
112
|
+
reader.onloadend = () => {
|
|
113
|
+
resolve(reader.result);
|
|
114
|
+
};
|
|
115
|
+
reader.onerror = reject;
|
|
116
|
+
reader.readAsDataURL(blob);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async function downloadImage(pks, fieldName, entityName) {
|
|
120
|
+
const uploadUrl = getBaseUrl(pks, entityName, fieldName);
|
|
121
|
+
if (!uploadUrl) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const response = await fetch(uploadUrl);
|
|
126
|
+
if (response.ok) {
|
|
127
|
+
const blob = await response.blob();
|
|
128
|
+
return await imageBlobToBase64(blob);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
console.error('Error downloading image:', error);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { buildFileKey as a, base64ToBlob as b, downloadImage as d, getPKs as g, sessionFileUpload as s };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
2
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
|
2
|
+
import { C as ConfigStorage } from './ConfigStorage-d15d2014.js';
|
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-fcc7b62f.js';
|
|
4
4
|
import { a as TAB_NAMES } from './constants-7b422de0.js';
|
|
5
5
|
|
|
6
6
|
class SnkFormConfigManager {
|