@sankhyalabs/sankhyablocks 1.1.28 → 1.2.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.
- package/LICENSE +21 -21
- package/README.md +75 -75
- package/package.json +94 -52
- package/react/.keepfolder +1 -0
- package/dist/cjs/ApplicationUtils-05b74ee9.js +0 -39
- package/dist/cjs/AssetsUtils-7e3c38f9.js +0 -24
- package/dist/cjs/CSSVarsUtils-75ca9c64.js +0 -19
- package/dist/cjs/_commonjsHelpers-537d719a.js +0 -20
- package/dist/cjs/ez-action-chip.cjs.entry.js +0 -27
- package/dist/cjs/ez-application.cjs.entry.js +0 -26
- package/dist/cjs/ez-button_4.cjs.entry.js +0 -660
- package/dist/cjs/ez-calendar.cjs.entry.js +0 -223
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +0 -47
- package/dist/cjs/ez-combo-box.cjs.entry.js +0 -278
- package/dist/cjs/ez-date-input.cjs.entry.js +0 -102
- package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -145
- package/dist/cjs/ez-dialog.cjs.entry.js +0 -89
- package/dist/cjs/ez-form.cjs.entry.js +0 -785
- package/dist/cjs/ez-grid.cjs.entry.js +0 -110485
- package/dist/cjs/ez-icon.cjs.entry.js +0 -41
- package/dist/cjs/ez-label-chip.cjs.entry.js +0 -104
- package/dist/cjs/ez-modal_2.cjs.entry.js +0 -316
- package/dist/cjs/ez-number-input.cjs.entry.js +0 -86
- package/dist/cjs/ez-popover.cjs.entry.js +0 -120
- package/dist/cjs/ez-popup.cjs.entry.js +0 -48
- package/dist/cjs/ez-search.cjs.entry.js +0 -64
- package/dist/cjs/ez-tabselector.cjs.entry.js +0 -198
- package/dist/cjs/ez-text-area.cjs.entry.js +0 -114
- package/dist/cjs/ez-text-input.cjs.entry.js +0 -201
- package/dist/cjs/ez-time-input.cjs.entry.js +0 -118
- package/dist/cjs/ez-toast.cjs.entry.js +0 -44
- package/dist/cjs/ez-upload.cjs.entry.js +0 -356
- package/dist/cjs/index-682c98b2.js +0 -1771
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/sankhyablocks.cjs.js +0 -19
- package/dist/cjs/snk-application.cjs.entry.js +0 -7050
- package/dist/cjs/test-du.cjs.entry.js +0 -76
- package/dist/collection/collection-manifest.json +0 -47
- package/dist/collection/components/snk-application/snk-application.css +0 -5
- package/dist/collection/components/snk-application/snk-application.js +0 -492
- package/dist/collection/index.js +0 -1
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +0 -158
- package/dist/collection/lib/http/data-fetcher/fetchers/application-config-fetcher.js +0 -23
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +0 -188
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +0 -25
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +0 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +0 -59
- package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +0 -30
- package/dist/collection/lib/http/data-fetcher/state/LoadStateManager.js +0 -66
- package/dist/collection/lib/utils/pesquisa.js +0 -16
- package/dist/collection/lib/utils/urlutils.js +0 -23
- package/dist/collection/lib/workspace/workspace.js +0 -7
- package/dist/components/ApplicationUtils.js +0 -37
- package/dist/components/AssetsUtils.js +0 -22
- package/dist/components/CSSVarsUtils.js +0 -17
- package/dist/components/_commonjsHelpers.js +0 -17
- package/dist/components/ez-action-chip.js +0 -44
- package/dist/components/ez-application.js +0 -39
- package/dist/components/ez-button.js +0 -6
- package/dist/components/ez-button2.js +0 -105
- package/dist/components/ez-calendar.js +0 -6
- package/dist/components/ez-calendar2.js +0 -242
- package/dist/components/ez-check.js +0 -6
- package/dist/components/ez-check2.js +0 -94
- package/dist/components/ez-collapsible-box.js +0 -67
- package/dist/components/ez-combo-box.js +0 -6
- package/dist/components/ez-combo-box2.js +0 -311
- package/dist/components/ez-date-input.js +0 -135
- package/dist/components/ez-date-time-input.js +0 -179
- package/dist/components/ez-dialog.js +0 -124
- package/dist/components/ez-form.js +0 -6
- package/dist/components/ez-form2.js +0 -807
- package/dist/components/ez-grid.js +0 -110576
- package/dist/components/ez-icon.js +0 -6
- package/dist/components/ez-icon2.js +0 -56
- package/dist/components/ez-label-chip.js +0 -125
- package/dist/components/ez-list.js +0 -6
- package/dist/components/ez-list2.js +0 -523
- package/dist/components/ez-modal.js +0 -6
- package/dist/components/ez-modal2.js +0 -82
- package/dist/components/ez-number-input.js +0 -115
- package/dist/components/ez-popover.js +0 -145
- package/dist/components/ez-popup.js +0 -67
- package/dist/components/ez-search.js +0 -100
- package/dist/components/ez-tabselector.js +0 -6
- package/dist/components/ez-tabselector2.js +0 -213
- package/dist/components/ez-text-area.js +0 -137
- package/dist/components/ez-text-input.js +0 -6
- package/dist/components/ez-text-input2.js +0 -223
- package/dist/components/ez-time-input.js +0 -153
- package/dist/components/ez-toast.js +0 -64
- package/dist/components/ez-upload.js +0 -382
- package/dist/components/grid-config.js +0 -6
- package/dist/components/grid-config2.js +0 -318
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/components/select-box.js +0 -6
- package/dist/components/select-box2.js +0 -47
- package/dist/components/snk-application.d.ts +0 -11
- package/dist/components/snk-application.js +0 -7079
- package/dist/components/test-du.js +0 -101
- package/dist/esm/ApplicationUtils-e0b6d857.js +0 -37
- package/dist/esm/AssetsUtils-6e6624dc.js +0 -22
- package/dist/esm/CSSVarsUtils-0787c3f3.js +0 -17
- package/dist/esm/_commonjsHelpers-9943807e.js +0 -17
- package/dist/esm/ez-action-chip.entry.js +0 -23
- package/dist/esm/ez-application.entry.js +0 -22
- package/dist/esm/ez-button_4.entry.js +0 -653
- package/dist/esm/ez-calendar.entry.js +0 -219
- package/dist/esm/ez-collapsible-box.entry.js +0 -43
- package/dist/esm/ez-combo-box.entry.js +0 -274
- package/dist/esm/ez-date-input.entry.js +0 -98
- package/dist/esm/ez-date-time-input.entry.js +0 -141
- package/dist/esm/ez-dialog.entry.js +0 -85
- package/dist/esm/ez-form.entry.js +0 -781
- package/dist/esm/ez-grid.entry.js +0 -110481
- package/dist/esm/ez-icon.entry.js +0 -37
- package/dist/esm/ez-label-chip.entry.js +0 -100
- package/dist/esm/ez-modal_2.entry.js +0 -311
- package/dist/esm/ez-number-input.entry.js +0 -82
- package/dist/esm/ez-popover.entry.js +0 -116
- package/dist/esm/ez-popup.entry.js +0 -44
- package/dist/esm/ez-search.entry.js +0 -60
- package/dist/esm/ez-tabselector.entry.js +0 -194
- package/dist/esm/ez-text-area.entry.js +0 -110
- package/dist/esm/ez-text-input.entry.js +0 -197
- package/dist/esm/ez-time-input.entry.js +0 -114
- package/dist/esm/ez-toast.entry.js +0 -40
- package/dist/esm/ez-upload.entry.js +0 -352
- package/dist/esm/index-35088a3f.js +0 -1740
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/sankhyablocks.js +0 -17
- package/dist/esm/snk-application.entry.js +0 -7046
- package/dist/esm/test-du.entry.js +0 -72
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +0 -67
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +0 -3
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +0 -180
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +0 -319
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +0 -327
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +0 -162
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -217
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +0 -49
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -44
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +0 -527
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +0 -5
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +0 -31
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +0 -129
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +0 -10
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +0 -176
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +0 -139
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +0 -335
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +0 -358
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +0 -4
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +0 -44
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +0 -405
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +0 -3
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -138
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +0 -165
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +0 -196
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +0 -10
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +0 -127
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +0 -568
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +0 -3
- package/dist/sankhyablocks/index.esm.js +0 -0
- package/dist/sankhyablocks/p-0183d259.entry.js +0 -1
- package/dist/sankhyablocks/p-01f23a70.entry.js +0 -1
- package/dist/sankhyablocks/p-07c32f68.entry.js +0 -1
- package/dist/sankhyablocks/p-0f90499d.entry.js +0 -1
- package/dist/sankhyablocks/p-105724a3.entry.js +0 -1
- package/dist/sankhyablocks/p-112455b1.js +0 -1
- package/dist/sankhyablocks/p-2ac02d48.entry.js +0 -1
- package/dist/sankhyablocks/p-35364a97.entry.js +0 -1
- package/dist/sankhyablocks/p-3f6aa9a7.entry.js +0 -1
- package/dist/sankhyablocks/p-4811bc0a.entry.js +0 -369
- package/dist/sankhyablocks/p-5f9af495.entry.js +0 -1
- package/dist/sankhyablocks/p-60967cf0.js +0 -1
- package/dist/sankhyablocks/p-70ad6c16.entry.js +0 -1
- package/dist/sankhyablocks/p-710bfffe.entry.js +0 -1
- package/dist/sankhyablocks/p-73397a0f.entry.js +0 -57
- package/dist/sankhyablocks/p-811b4b9d.js +0 -1
- package/dist/sankhyablocks/p-813fe4f7.js +0 -1
- package/dist/sankhyablocks/p-85a9446b.js +0 -2
- package/dist/sankhyablocks/p-89a1100f.entry.js +0 -1
- package/dist/sankhyablocks/p-8b543003.entry.js +0 -1
- package/dist/sankhyablocks/p-9750632b.entry.js +0 -1
- package/dist/sankhyablocks/p-a96272f7.entry.js +0 -1
- package/dist/sankhyablocks/p-ac8842e5.entry.js +0 -1
- package/dist/sankhyablocks/p-ba64cc41.entry.js +0 -1
- package/dist/sankhyablocks/p-c1ede043.entry.js +0 -1
- package/dist/sankhyablocks/p-d90ebb85.entry.js +0 -1
- package/dist/sankhyablocks/p-e5355a29.entry.js +0 -1
- package/dist/sankhyablocks/p-ef04b633.entry.js +0 -1
- package/dist/sankhyablocks/p-f6db07fb.entry.js +0 -1
- package/dist/sankhyablocks/p-f80cabc7.entry.js +0 -1
- package/dist/sankhyablocks/p-fcd9bd92.entry.js +0 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +0 -1
- package/dist/types/components/snk-application/snk-application.d.ts +0 -44
- package/dist/types/components.d.ts +0 -66
- package/dist/types/index.d.ts +0 -1
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +0 -15
- package/dist/types/lib/http/data-fetcher/fetchers/application-config-fetcher.d.ts +0 -6
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +0 -12
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +0 -5
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +0 -2
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +0 -13
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +0 -6
- package/dist/types/lib/http/data-fetcher/state/LoadStateManager.d.ts +0 -23
- package/dist/types/lib/utils/pesquisa.d.ts +0 -2
- package/dist/types/lib/utils/urlutils.d.ts +0 -4
- package/dist/types/lib/workspace/workspace.d.ts +0 -4
- package/dist/types/stencil-public-runtime.d.ts +0 -1565
- package/loader/cdn.js +0 -3
- package/loader/index.cjs.js +0 -3
- package/loader/index.d.ts +0 -12
- package/loader/index.es2017.js +0 -3
- package/loader/index.js +0 -4
- package/loader/package.json +0 -10
- package/react/components.d.ts +0 -32
- package/react/components.js +0 -35
- package/react/components.js.map +0 -1
- package/react/react-component-lib/createComponent.d.ts +0 -10
- package/react/react-component-lib/createComponent.js +0 -75
- package/react/react-component-lib/createComponent.js.map +0 -1
- package/react/react-component-lib/createOverlayComponent.d.ts +0 -21
- package/react/react-component-lib/createOverlayComponent.js +0 -109
- package/react/react-component-lib/createOverlayComponent.js.map +0 -1
- package/react/react-component-lib/index.d.ts +0 -2
- package/react/react-component-lib/index.js +0 -3
- package/react/react-component-lib/index.js.map +0 -1
- package/react/react-component-lib/interfaces.d.ts +0 -29
- package/react/react-component-lib/interfaces.js +0 -1
- package/react/react-component-lib/interfaces.js.map +0 -1
- package/react/react-component-lib/utils/attachProps.d.ts +0 -12
- package/react/react-component-lib/utils/attachProps.js +0 -98
- package/react/react-component-lib/utils/attachProps.js.map +0 -1
- package/react/react-component-lib/utils/case.d.ts +0 -2
- package/react/react-component-lib/utils/case.js +0 -7
- package/react/react-component-lib/utils/case.js.map +0 -1
- package/react/react-component-lib/utils/dev.d.ts +0 -2
- package/react/react-component-lib/utils/dev.js +0 -13
- package/react/react-component-lib/utils/dev.js.map +0 -1
- package/react/react-component-lib/utils/index.d.ts +0 -10
- package/react/react-component-lib/utils/index.js +0 -34
- package/react/react-component-lib/utils/index.js.map +0 -1
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { A as ApplicationUtils } from './ApplicationUtils.js';
|
|
3
|
-
|
|
4
|
-
class RemoteFile {
|
|
5
|
-
constructor(file) {
|
|
6
|
-
this.file = file;
|
|
7
|
-
this.size = file.size;
|
|
8
|
-
this.name = file.name;
|
|
9
|
-
}
|
|
10
|
-
abortUpload() {
|
|
11
|
-
if (this._uploadingXhr) {
|
|
12
|
-
this._aborted = true;
|
|
13
|
-
this._uploadingXhr.abort();
|
|
14
|
-
this._uploadingXhr = undefined;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
isUploading() {
|
|
18
|
-
return this._uploadingXhr !== undefined;
|
|
19
|
-
}
|
|
20
|
-
async upload(server, headers, updateCallBack) {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
const xhr = new XMLHttpRequest();
|
|
23
|
-
this._uploadingXhr = xhr;
|
|
24
|
-
this._aborted = false;
|
|
25
|
-
this.progress = 0;
|
|
26
|
-
xhr.upload.onprogress = (e) => {
|
|
27
|
-
const loaded = e.loaded;
|
|
28
|
-
const total = e.total;
|
|
29
|
-
this.progress = ~~((loaded / total) * 100);
|
|
30
|
-
updateCallBack(this, loaded, total);
|
|
31
|
-
};
|
|
32
|
-
xhr.onreadystatechange = () => {
|
|
33
|
-
if (xhr.readyState == 4) {
|
|
34
|
-
this._uploadingXhr = undefined;
|
|
35
|
-
const status = xhr.status;
|
|
36
|
-
if (!this._aborted) {
|
|
37
|
-
if (status === 0) {
|
|
38
|
-
reject("Servidor indisponível");
|
|
39
|
-
}
|
|
40
|
-
else if (status >= 500) {
|
|
41
|
-
reject("Erro inesperado no servidor");
|
|
42
|
-
}
|
|
43
|
-
else if (status >= 400) {
|
|
44
|
-
reject("Operação não permitida");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const response = xhr.response;
|
|
48
|
-
if (response) {
|
|
49
|
-
resolve(JSON.parse(response));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
xhr.ontimeout = () => {
|
|
54
|
-
reject("Tempo limite de transferência atingido.");
|
|
55
|
-
};
|
|
56
|
-
const formData = new FormData();
|
|
57
|
-
formData.append("ARQUIVO", this.file, this.file.name);
|
|
58
|
-
xhr.open("POST", server, true);
|
|
59
|
-
if (headers) {
|
|
60
|
-
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
61
|
-
}
|
|
62
|
-
xhr.send(formData);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
async delete(item, server, headers) {
|
|
66
|
-
return new Promise((resolve, reject) => {
|
|
67
|
-
const xhr = new XMLHttpRequest();
|
|
68
|
-
xhr.onreadystatechange = () => {
|
|
69
|
-
if (xhr.readyState == 4) {
|
|
70
|
-
if (xhr.status === 0) {
|
|
71
|
-
reject("Servidor indisponível");
|
|
72
|
-
}
|
|
73
|
-
else if (xhr.status >= 500) {
|
|
74
|
-
reject("Erro inesperado no servidor");
|
|
75
|
-
}
|
|
76
|
-
else if (xhr.status >= 400) {
|
|
77
|
-
reject("Operação não permitida");
|
|
78
|
-
}
|
|
79
|
-
resolve(true);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
xhr.ontimeout = () => {
|
|
83
|
-
reject("Tempo limite de remoção atingido.");
|
|
84
|
-
};
|
|
85
|
-
xhr.open("DELETE", server, true);
|
|
86
|
-
if (headers) {
|
|
87
|
-
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
88
|
-
}
|
|
89
|
-
xhr.send(JSON.stringify(item));
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const ezUploadCss = ":host{--ez-upload--height:42px;--ez-upload--width:100%;--ez-upload__icon--width:48px;--ez-upload__container--background-color:var(--background--medium, #d2dce9);--ez-upload__color--primary:var(--color--primary, #008561);--ez-upload--padding--extra-small:var(--space--extra-small, 3px);--ez-upload--padding--small:var(--space--small, 6px);--ez-upload--padding--medium:var(--space--medium, 12px);--ez-upload--padding--large:var(--space--large, 24px);--ez-upload__border--color:var(--color-strokes, #DCE0E8);--ez-upload--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-upload--text--primary:var(--text-primary, #626e82);--ez-upload--font-size:var(--text--medium, 14px);--ez-upload--font-family:var(--font-pattern, Arial);--ez-upload--font-weight:var(--text-weight--large, 500);--ez-upload__btn__cancel-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"8x\" width=\"8px\"><path d=\"M 8,0.8 7.2,0 4,3.2 0.8,0 0,0.8 3.2,4 0,7.2 0.8,8 4,4.8 7.2,8 8,7.2 4.8,4 Z\"/></svg>');--ez-upload__file-icon-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"11x\" width=\"9px\"><path d=\"M 1.2272719,8.4999999 V 2.75 c 0,-1.1045695 1.4652499,-2 3.2727273,-2 1.8074777,0 3.2727281,0.8954305 3.2727281,2 V 8.9999999 C 7.7727273,9.690356 6.8569456,10.25 5.7272719,10.25 4.5975985,10.25 3.6818174,9.690356 3.6818174,8.9999999 V 3.75 c 0,-0.2761425 0.3663125,-0.5 0.8181818,-0.5 0.4518694,0 0.8181818,0.2238575 0.8181818,0.5 V 8.4999999 H 6.5454537 V 3.75 C 6.5454537,3.059644 5.6296725,2.5 4.4999992,2.5 3.3703258,2.5 2.4545446,3.059644 2.4545446,3.75 V 8.9999999 C 2.4545446,10.10457 3.9197945,11 5.7272719,11 7.5347496,11 9,10.10457 9,8.9999999 V 2.75 C 9,1.231217 6.9852809,0 4.4999992,0 2.0147181,5e-7 0,1.231217 0,2.75 v 5.7499999 z\"/></svg>');display:flex;flex-wrap:wrap;position:relative;font-family:var(--ez-upload--font-family);font-size:var(--ez-upload--font-size);width:var(--ez-upload--width);font-weight:var(--ez-upload--font-weight)}.iu{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:var(--ez-upload--padding--small);width:100%;border-radius:12px;box-sizing:border-box}.iu__container{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;border:2px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.iu__footer{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%;padding:0 var(--ez-upload--padding--medium) var(--ez-upload--padding--medium) var(--ez-upload--padding--medium);box-sizing:border-box}.iu__item{display:flex;width:100%;justify-content:flex-start;align-items:center;align-self:center;padding-bottom:var(--ez-upload--padding--extra-small);box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.iu__item-label{display:flex;max-width:80%;align-self:stretch;align-items:center}.file__name{font-weight:200}.box__content{width:100%;justify-content:center;align-items:center;height:100%;border:1px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.box__container{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:6px;width:100%;border-radius:12px}a:-webkit-any-link{color:#008561;fill:#008561;cursor:pointer;text-decoration:none}progress[value]{display:flex;width:100%;appearance:none;border:1px solid var(--ez-upload__border--color);height:12px;justify-content:flex-start;align-items:center;border-radius:3px;position:relative}progress[value]::-webkit-progress-bar{display:flex;-webkit-appearance:none;width:100%;background-color:rgb(255, 255, 255);border-radius:2px;padding:2px}progress[value]::-webkit-progress-value{display:flex;width:100%;background-color:var(--ez-upload__color--primary)}.text--center{text-align:center}.align--middle{align-self:center;align-items:center}.text{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent}.text--primary{color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.text--medium{font-size:14px}.text--small{font-size:12px}.btn-cancel{outline:none;border:none;background-color:unset;cursor:pointer}.btn-cancel::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:8px;height:8px;-webkit-mask-image:var(--ez-upload__btn__cancel-image);mask-image:var(--ez-upload__btn__cancel-image)}.iu_header{display:flex;flex-direction:column;width:100%}.iu__label{padding:var(--space--small);box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-upload--font-family);font-size:var(--text--extra-small);font-weight:var(--ez-upload--font-weight);color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.iu__file-icon{outline:none;border:none;background-color:unset;cursor:pointer}.iu__file-icon:disabled{cursor:unset}.iu__file-icon::after{content:'';display:flex;background-color:var(--text--primary, #626e82);width:9px;height:11px;-webkit-mask-image:var(--ez-upload__file-icon-image);mask-image:var(--ez-upload__file-icon-image)}.iu__file-icon:disabled::after{background-color:var(--text--disable, #AFB6C0)}.iu__icon-label{justify-content:center;display:flex;cursor:pointer;padding:var(--ez-upload--padding--large) 0px;box-sizing:border-box}.background--disabled{background-color:var(--color--disable-secondary, #F2F5F8)}.text--disabled{color:var(--text--disable, #AFB6C0)}.mouse-pointer--disabled{cursor:unset}.appearanceNone{width:0px;height:0px}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
|
|
95
|
-
|
|
96
|
-
const EzUpload$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
97
|
-
constructor() {
|
|
98
|
-
super();
|
|
99
|
-
this.__registerHost();
|
|
100
|
-
this.__attachShadow();
|
|
101
|
-
this.ezChange = createEvent(this, "ezChange", 7);
|
|
102
|
-
this._filePointers = new Map();
|
|
103
|
-
/**
|
|
104
|
-
* Deixa o campo disponível ou não para digitação.
|
|
105
|
-
*/
|
|
106
|
-
this.enabled = true;
|
|
107
|
-
}
|
|
108
|
-
changeValue(newValue) {
|
|
109
|
-
if (newValue !== this._updatingValue) {
|
|
110
|
-
this._filePointers.forEach(f => {
|
|
111
|
-
if (this.isRemoteFile(f)) {
|
|
112
|
-
f.abortUpload();
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
this._filePointers = new Map();
|
|
116
|
-
this.updateFilePointers();
|
|
117
|
-
}
|
|
118
|
-
this._updatingValue = undefined;
|
|
119
|
-
}
|
|
120
|
-
updateFilePointers() {
|
|
121
|
-
if (this.value) {
|
|
122
|
-
this.value.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
normalizeRequestHeaders() {
|
|
126
|
-
this._requestHeaders = new Map();
|
|
127
|
-
if (typeof this.requestHeaders == "string") {
|
|
128
|
-
try {
|
|
129
|
-
this.requestHeaders = JSON.parse(this.requestHeaders);
|
|
130
|
-
}
|
|
131
|
-
catch (e) {
|
|
132
|
-
this.requestHeaders = undefined;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
for (var key in this.requestHeaders) {
|
|
136
|
-
this._requestHeaders.set(key, this.requestHeaders[key]);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Método responsável por adicionar um ou mais arquivos ao componente.
|
|
141
|
-
*/
|
|
142
|
-
async addFiles(files) {
|
|
143
|
-
if (this.maxFiles > 0) {
|
|
144
|
-
let countDistinctFiles = this._filePointers.size;
|
|
145
|
-
files.forEach(file => {
|
|
146
|
-
if (!this._filePointers.has(file.name)) {
|
|
147
|
-
countDistinctFiles++;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
if (countDistinctFiles > this.maxFiles) {
|
|
151
|
-
this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
Array.prototype.forEach.call(files, this.addFile.bind(this));
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Realiza o foco no componente de upload
|
|
159
|
-
*/
|
|
160
|
-
async setFocus() {
|
|
161
|
-
this._fileInput.focus();
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Remove o foco no componente de upload
|
|
165
|
-
*/
|
|
166
|
-
async setBlur() {
|
|
167
|
-
this._fileInput.blur();
|
|
168
|
-
}
|
|
169
|
-
async addFile(file) {
|
|
170
|
-
const oldFile = this._filePointers.get(file.name);
|
|
171
|
-
if (oldFile) {
|
|
172
|
-
ApplicationUtils.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
|
|
173
|
-
.then(ok => {
|
|
174
|
-
if (ok) {
|
|
175
|
-
if (this.isRemoteFile(oldFile)) {
|
|
176
|
-
oldFile.abortUpload();
|
|
177
|
-
}
|
|
178
|
-
this.doAddFile(file);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
this.doAddFile(file);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
async doAddFile(file) {
|
|
187
|
-
if (this.validateFile(file)) {
|
|
188
|
-
const uploadingFile = new RemoteFile(file);
|
|
189
|
-
this._filePointers.set(file.name, uploadingFile);
|
|
190
|
-
uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
|
|
191
|
-
.then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
|
|
192
|
-
.catch(msg => this.showError(msg));
|
|
193
|
-
forceUpdate(this);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
finishUpload(ezFile) {
|
|
197
|
-
this._filePointers.set(ezFile.name, ezFile);
|
|
198
|
-
this.updateValue();
|
|
199
|
-
}
|
|
200
|
-
updateValue() {
|
|
201
|
-
this._updatingValue = [];
|
|
202
|
-
this._filePointers.forEach(f => {
|
|
203
|
-
if (!this.isRemoteFile(f)) {
|
|
204
|
-
this._updatingValue.push(f);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
this.value = this._updatingValue;
|
|
208
|
-
this.ezChange.emit(this.value);
|
|
209
|
-
}
|
|
210
|
-
buildProgressId(uploading) {
|
|
211
|
-
let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, "_");
|
|
212
|
-
return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
|
|
213
|
-
}
|
|
214
|
-
updateFeedback(uf) {
|
|
215
|
-
window.requestAnimationFrame(() => {
|
|
216
|
-
if (this._host) {
|
|
217
|
-
const progress = this._host.shadowRoot.querySelector("#" + this.buildProgressId(uf));
|
|
218
|
-
if (progress) {
|
|
219
|
-
progress.value = uf.progress;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
validateFile(file) {
|
|
225
|
-
if (!this._filePointers.has(file.name) && this.maxFiles > 0 && this._filePointers.size >= this.maxFiles) {
|
|
226
|
-
this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
if (file.size === 0) {
|
|
230
|
-
this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
if (!this.urlUpload) {
|
|
234
|
-
this.showError("Endereço de upload não informado");
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
|
|
238
|
-
this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxFileSize));
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
return true;
|
|
242
|
-
}
|
|
243
|
-
showError(message) {
|
|
244
|
-
ApplicationUtils.alert("Enviando arquivo", message);
|
|
245
|
-
}
|
|
246
|
-
formatBytes(bytes, decimals = 1) {
|
|
247
|
-
if (bytes === 0)
|
|
248
|
-
return "0 Bytes";
|
|
249
|
-
const k = 1024;
|
|
250
|
-
const dm = decimals < 0 ? 0 : decimals;
|
|
251
|
-
const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
252
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
253
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
254
|
-
}
|
|
255
|
-
onFileInputChange(event) {
|
|
256
|
-
const input = event.target;
|
|
257
|
-
this.addFiles(Array.from(input.files));
|
|
258
|
-
this._fileInput.value = "";
|
|
259
|
-
}
|
|
260
|
-
isRemoteFile(item) {
|
|
261
|
-
return "file" in item;
|
|
262
|
-
}
|
|
263
|
-
removeFromList(name) {
|
|
264
|
-
this._filePointers.delete(name);
|
|
265
|
-
this.updateValue();
|
|
266
|
-
}
|
|
267
|
-
removeFile(name) {
|
|
268
|
-
const item = this._filePointers.get(name);
|
|
269
|
-
if (this.isRemoteFile(item)) {
|
|
270
|
-
item.abortUpload();
|
|
271
|
-
this.removeFromList(name);
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
if (this.urlDelete) {
|
|
275
|
-
const uploadingFile = new RemoteFile(null);
|
|
276
|
-
this._filePointers.set(item.name, uploadingFile);
|
|
277
|
-
uploadingFile.delete(item, this.urlDelete, null)
|
|
278
|
-
.then(_ok => this.removeFromList(name))
|
|
279
|
-
.catch(msg => this.showError(msg));
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
this.removeFromList(name);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
openFilesDialog() {
|
|
287
|
-
if (this.enabled) {
|
|
288
|
-
this._fileInput.click();
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
componentDidLoad() {
|
|
292
|
-
if (this.enabled && this._dropZone && window.FileList && window.File) {
|
|
293
|
-
this._dropZone.addEventListener("dragover", event => {
|
|
294
|
-
event.stopPropagation();
|
|
295
|
-
event.preventDefault();
|
|
296
|
-
event.dataTransfer.dropEffect = "copy";
|
|
297
|
-
this._dropZone.style.background = "#c2dbff";
|
|
298
|
-
});
|
|
299
|
-
this._dropZone.addEventListener("drop", event => {
|
|
300
|
-
event.stopPropagation();
|
|
301
|
-
event.preventDefault();
|
|
302
|
-
this.addFiles(Array.from(event.dataTransfer.files));
|
|
303
|
-
this._dropZone.style.background = "";
|
|
304
|
-
});
|
|
305
|
-
this._dropZone.addEventListener("dragleave", _event => {
|
|
306
|
-
this._dropZone.style.background = "";
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
componentWillRender() {
|
|
311
|
-
if (this.value) {
|
|
312
|
-
if (this._filePointers.size < this.value.length) {
|
|
313
|
-
this.updateFilePointers();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
render() {
|
|
318
|
-
return (h("div", { ref: (el) => this._dropZone = el, class: this.evalDisabledClass("iu", "background--disabled") }, h("div", { class: "iu__container", onClick: () => this.openFilesDialog() }, h("div", { class: "iu_header" }, this.label ? h("label", { class: this.evalDisabledClass("iu__label", "text--disabled"), title: this.label }, this.label) : null, h("div", { class: this.evalDisabledClass("iu__icon-label", "mouse-pointer--disabled") }, h("button", { class: "iu__file-icon", disabled: !this.enabled }), h("div", { class: this.evalDisabledClass("text text--center text--medium text--primary", "text--disabled") }, this.enabled ? "Arraste e solte ou clique para adicionar arquivos" : "Somente leitura"))), this.buildFooter()), h("input", { ref: (el) => this._fileInput = el, onChange: (ev) => this.onFileInputChange(ev), type: "file", multiple: true, class: "appearanceNone" })));
|
|
319
|
-
}
|
|
320
|
-
buildFooter() {
|
|
321
|
-
if (this._filePointers.size === 0) {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
const items = [];
|
|
325
|
-
this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
|
|
326
|
-
return (h("div", { class: "iu__footer" }, items));
|
|
327
|
-
}
|
|
328
|
-
buildFileItem(item) {
|
|
329
|
-
const fileName = item.name;
|
|
330
|
-
const progress = Number(item["progress"]);
|
|
331
|
-
const downloadURL = item["downloadURL"];
|
|
332
|
-
const label = `${fileName} (${this.formatBytes(item.size)})`;
|
|
333
|
-
return (h("div", { class: "iu__item", key: fileName, onClick: evt => evt.stopPropagation() }, h("div", { class: "iu__item-label modificador" }, h("div", { title: label, class: "col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle" }, downloadURL ? h("a", { href: downloadURL, download: true }, label) : label)), isNaN(progress)
|
|
334
|
-
?
|
|
335
|
-
null
|
|
336
|
-
:
|
|
337
|
-
h("div", { class: "col col--sd-4 col--stretch align--middle" }, h("progress", { id: this.buildProgressId(item), value: progress, max: "100" })), this.enabled
|
|
338
|
-
?
|
|
339
|
-
h("div", { class: "col col--stretch align--middle" }, h("button", { class: "btn-cancel ", onClick: () => this.removeFile(fileName) }))
|
|
340
|
-
:
|
|
341
|
-
null));
|
|
342
|
-
}
|
|
343
|
-
evalDisabledClass(regularClasses, disabledClass) {
|
|
344
|
-
return this.enabled ? regularClasses : `${regularClasses} ${disabledClass}`;
|
|
345
|
-
}
|
|
346
|
-
get _host() { return this; }
|
|
347
|
-
static get watchers() { return {
|
|
348
|
-
"value": ["changeValue"],
|
|
349
|
-
"requestHeaders": ["normalizeRequestHeaders"]
|
|
350
|
-
}; }
|
|
351
|
-
static get style() { return ezUploadCss; }
|
|
352
|
-
}, [1, "ez-upload", {
|
|
353
|
-
"label": [1],
|
|
354
|
-
"enabled": [4],
|
|
355
|
-
"maxFileSize": [2, "max-file-size"],
|
|
356
|
-
"maxFiles": [2, "max-files"],
|
|
357
|
-
"requestHeaders": [8, "request-headers"],
|
|
358
|
-
"urlUpload": [1, "url-upload"],
|
|
359
|
-
"urlDelete": [1, "url-delete"],
|
|
360
|
-
"value": [1040],
|
|
361
|
-
"addFiles": [64],
|
|
362
|
-
"setFocus": [64],
|
|
363
|
-
"setBlur": [64]
|
|
364
|
-
}]);
|
|
365
|
-
function defineCustomElement$1() {
|
|
366
|
-
if (typeof customElements === "undefined") {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
const components = ["ez-upload"];
|
|
370
|
-
components.forEach(tagName => { switch (tagName) {
|
|
371
|
-
case "ez-upload":
|
|
372
|
-
if (!customElements.get(tagName)) {
|
|
373
|
-
customElements.define(tagName, EzUpload$1);
|
|
374
|
-
}
|
|
375
|
-
break;
|
|
376
|
-
} });
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
const EzUpload = EzUpload$1;
|
|
380
|
-
const defineCustomElement = defineCustomElement$1;
|
|
381
|
-
|
|
382
|
-
export { EzUpload, defineCustomElement };
|