@sankhyalabs/ezui 1.1.108 → 1.1.111
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/ApplicationUtils-c8f07135.js +39 -0
- package/dist/cjs/AssetsUtils-4909c6de.js +24 -0
- package/dist/cjs/CSSVarsUtils-8fbdf2e0.js +19 -0
- package/dist/cjs/ez-button.cjs.entry.js +79 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
- package/dist/cjs/ez-check.cjs.entry.js +76 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
- package/dist/cjs/ez-form.cjs.entry.js +785 -0
- package/dist/cjs/ez-grid.cjs.entry.js +9 -8
- package/dist/cjs/ez-icon.cjs.entry.js +41 -0
- package/dist/cjs/{ez-button_3.cjs.entry.js → ez-list.cjs.entry.js} +0 -89
- package/dist/cjs/ez-modal.cjs.entry.js +65 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
- package/dist/cjs/ez-popover.cjs.entry.js +4 -5
- package/dist/cjs/ez-search.cjs.entry.js +64 -0
- package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
- package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
- package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
- package/dist/cjs/ez-upload.cjs.entry.js +356 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/{ez-modal_2.cjs.entry.js → grid-config.cjs.entry.js} +3 -62
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/select-box.cjs.entry.js +22 -0
- package/dist/cjs/test-du.cjs.entry.js +76 -0
- package/dist/collection/collection-manifest.json +132 -1
- package/dist/custom-elements/index.js +3 -1577
- package/dist/esm/ApplicationUtils-36e38de9.js +37 -0
- package/dist/esm/AssetsUtils-9b1329a3.js +22 -0
- package/dist/esm/CSSVarsUtils-667e0016.js +17 -0
- package/dist/esm/ez-button.entry.js +75 -0
- package/dist/esm/ez-calendar.entry.js +219 -0
- package/dist/esm/ez-check.entry.js +72 -0
- package/dist/esm/ez-collapsible-box.entry.js +43 -0
- package/dist/esm/ez-combo-box.entry.js +274 -0
- package/dist/esm/ez-date-input.entry.js +98 -0
- package/dist/esm/ez-date-time-input.entry.js +141 -0
- package/dist/esm/ez-form.entry.js +781 -0
- package/dist/esm/ez-grid.entry.js +2 -1
- package/dist/esm/ez-icon.entry.js +37 -0
- package/dist/esm/{ez-button_3.entry.js → ez-list.entry.js} +2 -89
- package/dist/esm/ez-modal.entry.js +61 -0
- package/dist/esm/ez-number-input.entry.js +82 -0
- package/dist/esm/ez-popover.entry.js +1 -2
- package/dist/esm/ez-search.entry.js +60 -0
- package/dist/esm/ez-tabselector.entry.js +194 -0
- package/dist/esm/ez-text-area.entry.js +110 -0
- package/dist/esm/ez-text-input.entry.js +197 -0
- package/dist/esm/ez-time-input.entry.js +114 -0
- package/dist/esm/ez-upload.entry.js +352 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/{ez-modal_2.entry.js → grid-config.entry.js} +3 -61
- package/dist/esm/loader.js +1 -1
- package/dist/esm/select-box.entry.js +18 -0
- package/dist/esm/test-du.entry.js +72 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-080045a0.entry.js +1 -0
- package/dist/ezui/p-25e87823.entry.js +1 -0
- package/dist/ezui/p-31b0e21a.entry.js +1 -0
- package/dist/ezui/p-363fc3af.entry.js +1 -0
- package/dist/ezui/p-3662c09e.entry.js +1 -0
- package/dist/ezui/p-3a8bf0a8.entry.js +1 -0
- package/dist/ezui/p-3c954800.entry.js +1 -0
- package/dist/ezui/p-44d4f8d6.entry.js +1 -0
- package/dist/ezui/p-477bb703.js +1 -0
- package/dist/ezui/p-59a8448a.entry.js +1 -0
- package/dist/ezui/p-62daf508.js +1 -0
- package/dist/ezui/p-65893e25.entry.js +1 -0
- package/dist/ezui/p-73d3f767.entry.js +1 -0
- package/dist/ezui/p-73d45b12.entry.js +1 -0
- package/dist/ezui/p-804c118a.entry.js +1 -0
- package/dist/ezui/p-97f77023.entry.js +1 -0
- package/dist/ezui/p-9aecc079.entry.js +1 -0
- package/dist/ezui/{p-db1797d7.entry.js → p-a038e7a5.entry.js} +28 -28
- package/dist/ezui/p-a5f1f9c4.entry.js +1 -0
- package/dist/ezui/p-bc2834fa.entry.js +1 -0
- package/dist/ezui/p-c27495d9.entry.js +1 -0
- package/dist/ezui/p-c6f2aa6c.entry.js +1 -0
- package/dist/ezui/p-d54c157f.js +1 -0
- package/dist/ezui/p-f26f6d67.entry.js +1 -0
- package/dist/ezui/p-f3f9c7e6.entry.js +1 -0
- package/dist/ezui/p-f78c7ec9.entry.js +1 -0
- package/package.json +5 -4
- package/dist/cjs/AssetsUtils-697927e8.js +0 -79
- package/dist/cjs/FloatingManager-751368a8.js +0 -126
- package/dist/cjs/UnitMetadata-de809a4b.js +0 -1346
- package/dist/cjs/ez-calendar_16.cjs.entry.js +0 -2916
- package/dist/esm/AssetsUtils-f75711ac.js +0 -76
- package/dist/esm/FloatingManager-ee1f7fdf.js +0 -124
- package/dist/esm/UnitMetadata-d300ae38.js +0 -1340
- package/dist/esm/ez-calendar_16.entry.js +0 -2897
- package/dist/ezui/p-3e6fa4ca.entry.js +0 -1
- package/dist/ezui/p-47cf74f0.js +0 -1
- package/dist/ezui/p-6b257393.entry.js +0 -1
- package/dist/ezui/p-780fbe22.entry.js +0 -1
- package/dist/ezui/p-81fc41a5.js +0 -1
- package/dist/ezui/p-b05feb1f.js +0 -1
- package/dist/ezui/p-c451d6e6.entry.js +0 -1
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-88286449.js');
|
|
6
|
+
const ApplicationUtils = require('./ApplicationUtils-c8f07135.js');
|
|
7
|
+
|
|
8
|
+
class RemoteFile {
|
|
9
|
+
constructor(file) {
|
|
10
|
+
this.file = file;
|
|
11
|
+
this.size = file.size;
|
|
12
|
+
this.name = file.name;
|
|
13
|
+
}
|
|
14
|
+
abortUpload() {
|
|
15
|
+
if (this._uploadingXhr) {
|
|
16
|
+
this._aborted = true;
|
|
17
|
+
this._uploadingXhr.abort();
|
|
18
|
+
this._uploadingXhr = undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
isUploading() {
|
|
22
|
+
return this._uploadingXhr !== undefined;
|
|
23
|
+
}
|
|
24
|
+
async upload(server, headers, updateCallBack) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const xhr = new XMLHttpRequest();
|
|
27
|
+
this._uploadingXhr = xhr;
|
|
28
|
+
this._aborted = false;
|
|
29
|
+
this.progress = 0;
|
|
30
|
+
xhr.upload.onprogress = (e) => {
|
|
31
|
+
const loaded = e.loaded;
|
|
32
|
+
const total = e.total;
|
|
33
|
+
this.progress = ~~((loaded / total) * 100);
|
|
34
|
+
updateCallBack(this, loaded, total);
|
|
35
|
+
};
|
|
36
|
+
xhr.onreadystatechange = () => {
|
|
37
|
+
if (xhr.readyState == 4) {
|
|
38
|
+
this._uploadingXhr = undefined;
|
|
39
|
+
const status = xhr.status;
|
|
40
|
+
if (!this._aborted) {
|
|
41
|
+
if (status === 0) {
|
|
42
|
+
reject("Servidor indisponível");
|
|
43
|
+
}
|
|
44
|
+
else if (status >= 500) {
|
|
45
|
+
reject("Erro inesperado no servidor");
|
|
46
|
+
}
|
|
47
|
+
else if (status >= 400) {
|
|
48
|
+
reject("Operação não permitida");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const response = xhr.response;
|
|
52
|
+
if (response) {
|
|
53
|
+
resolve(JSON.parse(response));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
xhr.ontimeout = () => {
|
|
58
|
+
reject("Tempo limite de transferência atingido.");
|
|
59
|
+
};
|
|
60
|
+
const formData = new FormData();
|
|
61
|
+
formData.append("ARQUIVO", this.file, this.file.name);
|
|
62
|
+
xhr.open("POST", server, true);
|
|
63
|
+
if (headers) {
|
|
64
|
+
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
65
|
+
}
|
|
66
|
+
xhr.send(formData);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async delete(item, server, headers) {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
const xhr = new XMLHttpRequest();
|
|
72
|
+
xhr.onreadystatechange = () => {
|
|
73
|
+
if (xhr.readyState == 4) {
|
|
74
|
+
if (xhr.status === 0) {
|
|
75
|
+
reject("Servidor indisponível");
|
|
76
|
+
}
|
|
77
|
+
else if (xhr.status >= 500) {
|
|
78
|
+
reject("Erro inesperado no servidor");
|
|
79
|
+
}
|
|
80
|
+
else if (xhr.status >= 400) {
|
|
81
|
+
reject("Operação não permitida");
|
|
82
|
+
}
|
|
83
|
+
resolve(true);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
xhr.ontimeout = () => {
|
|
87
|
+
reject("Tempo limite de remoção atingido.");
|
|
88
|
+
};
|
|
89
|
+
xhr.open("DELETE", server, true);
|
|
90
|
+
if (headers) {
|
|
91
|
+
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
92
|
+
}
|
|
93
|
+
xhr.send(JSON.stringify(item));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
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%}}";
|
|
99
|
+
|
|
100
|
+
let EzUpload = class {
|
|
101
|
+
constructor(hostRef) {
|
|
102
|
+
index.registerInstance(this, hostRef);
|
|
103
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
104
|
+
this._filePointers = new Map();
|
|
105
|
+
/**
|
|
106
|
+
* Deixa o campo disponível ou não para digitação.
|
|
107
|
+
*/
|
|
108
|
+
this.enabled = true;
|
|
109
|
+
}
|
|
110
|
+
changeValue(newValue) {
|
|
111
|
+
if (newValue !== this._updatingValue) {
|
|
112
|
+
this._filePointers.forEach(f => {
|
|
113
|
+
if (this.isRemoteFile(f)) {
|
|
114
|
+
f.abortUpload();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
this._filePointers = new Map();
|
|
118
|
+
this.updateFilePointers();
|
|
119
|
+
}
|
|
120
|
+
this._updatingValue = undefined;
|
|
121
|
+
}
|
|
122
|
+
updateFilePointers() {
|
|
123
|
+
if (this.value) {
|
|
124
|
+
this.value.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
normalizeRequestHeaders() {
|
|
128
|
+
this._requestHeaders = new Map();
|
|
129
|
+
if (typeof this.requestHeaders == "string") {
|
|
130
|
+
try {
|
|
131
|
+
this.requestHeaders = JSON.parse(this.requestHeaders);
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
this.requestHeaders = undefined;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
for (var key in this.requestHeaders) {
|
|
138
|
+
this._requestHeaders.set(key, this.requestHeaders[key]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Método responsável por adicionar um ou mais arquivos ao componente.
|
|
143
|
+
*/
|
|
144
|
+
async addFiles(files) {
|
|
145
|
+
if (this.maxFiles > 0) {
|
|
146
|
+
let countDistinctFiles = this._filePointers.size;
|
|
147
|
+
files.forEach(file => {
|
|
148
|
+
if (!this._filePointers.has(file.name)) {
|
|
149
|
+
countDistinctFiles++;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
if (countDistinctFiles > this.maxFiles) {
|
|
153
|
+
this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
Array.prototype.forEach.call(files, this.addFile.bind(this));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Realiza o foco no componente de upload
|
|
161
|
+
*/
|
|
162
|
+
async setFocus() {
|
|
163
|
+
this._fileInput.focus();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Remove o foco no componente de upload
|
|
167
|
+
*/
|
|
168
|
+
async setBlur() {
|
|
169
|
+
this._fileInput.blur();
|
|
170
|
+
}
|
|
171
|
+
async addFile(file) {
|
|
172
|
+
const oldFile = this._filePointers.get(file.name);
|
|
173
|
+
if (oldFile) {
|
|
174
|
+
ApplicationUtils.ApplicationUtils.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
|
|
175
|
+
.then(ok => {
|
|
176
|
+
if (ok) {
|
|
177
|
+
if (this.isRemoteFile(oldFile)) {
|
|
178
|
+
oldFile.abortUpload();
|
|
179
|
+
}
|
|
180
|
+
this.doAddFile(file);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
this.doAddFile(file);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async doAddFile(file) {
|
|
189
|
+
if (this.validateFile(file)) {
|
|
190
|
+
const uploadingFile = new RemoteFile(file);
|
|
191
|
+
this._filePointers.set(file.name, uploadingFile);
|
|
192
|
+
uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
|
|
193
|
+
.then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
|
|
194
|
+
.catch(msg => this.showError(msg));
|
|
195
|
+
index.forceUpdate(this);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
finishUpload(ezFile) {
|
|
199
|
+
this._filePointers.set(ezFile.name, ezFile);
|
|
200
|
+
this.updateValue();
|
|
201
|
+
}
|
|
202
|
+
updateValue() {
|
|
203
|
+
this._updatingValue = [];
|
|
204
|
+
this._filePointers.forEach(f => {
|
|
205
|
+
if (!this.isRemoteFile(f)) {
|
|
206
|
+
this._updatingValue.push(f);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
this.value = this._updatingValue;
|
|
210
|
+
this.ezChange.emit(this.value);
|
|
211
|
+
}
|
|
212
|
+
buildProgressId(uploading) {
|
|
213
|
+
let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, "_");
|
|
214
|
+
return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
|
|
215
|
+
}
|
|
216
|
+
updateFeedback(uf) {
|
|
217
|
+
window.requestAnimationFrame(() => {
|
|
218
|
+
if (this._host) {
|
|
219
|
+
const progress = this._host.shadowRoot.querySelector("#" + this.buildProgressId(uf));
|
|
220
|
+
if (progress) {
|
|
221
|
+
progress.value = uf.progress;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
validateFile(file) {
|
|
227
|
+
if (!this._filePointers.has(file.name) && this.maxFiles > 0 && this._filePointers.size >= this.maxFiles) {
|
|
228
|
+
this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
if (file.size === 0) {
|
|
232
|
+
this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
if (!this.urlUpload) {
|
|
236
|
+
this.showError("Endereço de upload não informado");
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
|
|
240
|
+
this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxFileSize));
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
showError(message) {
|
|
246
|
+
ApplicationUtils.ApplicationUtils.alert("Enviando arquivo", message);
|
|
247
|
+
}
|
|
248
|
+
formatBytes(bytes, decimals = 1) {
|
|
249
|
+
if (bytes === 0)
|
|
250
|
+
return "0 Bytes";
|
|
251
|
+
const k = 1024;
|
|
252
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
253
|
+
const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
254
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
255
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
256
|
+
}
|
|
257
|
+
onFileInputChange(event) {
|
|
258
|
+
const input = event.target;
|
|
259
|
+
this.addFiles(Array.from(input.files));
|
|
260
|
+
this._fileInput.value = "";
|
|
261
|
+
}
|
|
262
|
+
isRemoteFile(item) {
|
|
263
|
+
return "file" in item;
|
|
264
|
+
}
|
|
265
|
+
removeFromList(name) {
|
|
266
|
+
this._filePointers.delete(name);
|
|
267
|
+
this.updateValue();
|
|
268
|
+
}
|
|
269
|
+
removeFile(name) {
|
|
270
|
+
const item = this._filePointers.get(name);
|
|
271
|
+
if (this.isRemoteFile(item)) {
|
|
272
|
+
item.abortUpload();
|
|
273
|
+
this.removeFromList(name);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
if (this.urlDelete) {
|
|
277
|
+
const uploadingFile = new RemoteFile(null);
|
|
278
|
+
this._filePointers.set(item.name, uploadingFile);
|
|
279
|
+
uploadingFile.delete(item, this.urlDelete, null)
|
|
280
|
+
.then(_ok => this.removeFromList(name))
|
|
281
|
+
.catch(msg => this.showError(msg));
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.removeFromList(name);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
openFilesDialog() {
|
|
289
|
+
if (this.enabled) {
|
|
290
|
+
this._fileInput.click();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
componentDidLoad() {
|
|
294
|
+
if (this.enabled && this._dropZone && window.FileList && window.File) {
|
|
295
|
+
this._dropZone.addEventListener("dragover", event => {
|
|
296
|
+
event.stopPropagation();
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
event.dataTransfer.dropEffect = "copy";
|
|
299
|
+
this._dropZone.style.background = "#c2dbff";
|
|
300
|
+
});
|
|
301
|
+
this._dropZone.addEventListener("drop", event => {
|
|
302
|
+
event.stopPropagation();
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
this.addFiles(Array.from(event.dataTransfer.files));
|
|
305
|
+
this._dropZone.style.background = "";
|
|
306
|
+
});
|
|
307
|
+
this._dropZone.addEventListener("dragleave", _event => {
|
|
308
|
+
this._dropZone.style.background = "";
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
componentWillRender() {
|
|
313
|
+
if (this.value) {
|
|
314
|
+
if (this._filePointers.size < this.value.length) {
|
|
315
|
+
this.updateFilePointers();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
render() {
|
|
320
|
+
return (index.h("div", { ref: (el) => this._dropZone = el, class: this.evalDisabledClass("iu", "background--disabled") }, index.h("div", { class: "iu__container", onClick: () => this.openFilesDialog() }, index.h("div", { class: "iu_header" }, this.label ? index.h("label", { class: this.evalDisabledClass("iu__label", "text--disabled"), title: this.label }, this.label) : null, index.h("div", { class: this.evalDisabledClass("iu__icon-label", "mouse-pointer--disabled") }, index.h("button", { class: "iu__file-icon", disabled: !this.enabled }), index.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()), index.h("input", { ref: (el) => this._fileInput = el, onChange: (ev) => this.onFileInputChange(ev), type: "file", multiple: true, class: "appearanceNone" })));
|
|
321
|
+
}
|
|
322
|
+
buildFooter() {
|
|
323
|
+
if (this._filePointers.size === 0) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
const items = [];
|
|
327
|
+
this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
|
|
328
|
+
return (index.h("div", { class: "iu__footer" }, items));
|
|
329
|
+
}
|
|
330
|
+
buildFileItem(item) {
|
|
331
|
+
const fileName = item.name;
|
|
332
|
+
const progress = Number(item["progress"]);
|
|
333
|
+
const downloadURL = item["downloadURL"];
|
|
334
|
+
const label = `${fileName} (${this.formatBytes(item.size)})`;
|
|
335
|
+
return (index.h("div", { class: "iu__item", key: fileName, onClick: evt => evt.stopPropagation() }, index.h("div", { class: "iu__item-label modificador" }, index.h("div", { title: label, class: "col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle" }, downloadURL ? index.h("a", { href: downloadURL, download: true }, label) : label)), isNaN(progress)
|
|
336
|
+
?
|
|
337
|
+
null
|
|
338
|
+
:
|
|
339
|
+
index.h("div", { class: "col col--sd-4 col--stretch align--middle" }, index.h("progress", { id: this.buildProgressId(item), value: progress, max: "100" })), this.enabled
|
|
340
|
+
?
|
|
341
|
+
index.h("div", { class: "col col--stretch align--middle" }, index.h("button", { class: "btn-cancel ", onClick: () => this.removeFile(fileName) }))
|
|
342
|
+
:
|
|
343
|
+
null));
|
|
344
|
+
}
|
|
345
|
+
evalDisabledClass(regularClasses, disabledClass) {
|
|
346
|
+
return this.enabled ? regularClasses : `${regularClasses} ${disabledClass}`;
|
|
347
|
+
}
|
|
348
|
+
get _host() { return index.getElement(this); }
|
|
349
|
+
static get watchers() { return {
|
|
350
|
+
"value": ["changeValue"],
|
|
351
|
+
"requestHeaders": ["normalizeRequestHeaders"]
|
|
352
|
+
}; }
|
|
353
|
+
};
|
|
354
|
+
EzUpload.style = ezUploadCss;
|
|
355
|
+
|
|
356
|
+
exports.ez_upload = EzUpload;
|
package/dist/cjs/ezui.cjs.js
CHANGED
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["ez-
|
|
18
|
+
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config.cjs",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]]],["ez-modal.cjs",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input.cjs",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"setFocus":[64],"setBlur":[64]}]]],["ez-date-input.cjs",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input.cjs",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["ez-search.cjs",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["select-box.cjs",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-number-input.cjs",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"setFocus":[64],"setBlur":[64]}]]],["ez-collapsible-box.cjs",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}]]],["ez-list.cjs",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area.cjs",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"setFocus":[64],"setBlur":[64]}]]],["ez-upload.cjs",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button.cjs",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar.cjs",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check.cjs",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector.cjs",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box.cjs",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-icon.cjs",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-form.cjs",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]],["test-du.cjs",[[0,"test-du"]]]], options);
|
|
19
19
|
});
|
|
@@ -3,66 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-88286449.js');
|
|
6
|
-
const AssetsUtils = require('./AssetsUtils-
|
|
7
|
-
require('
|
|
8
|
-
|
|
9
|
-
const ezModalCss = ":host{--ez-modal-z-index:var(--most-visible, 3);--ez-modal-vertical-padding:var(--space--large, 24px);display:block}.modal{position:fixed;padding:var(--ez-modal-vertical-padding) 0;display:flex;top:0px;z-index:var(--ez-modal-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;backdrop-filter:blur(4px);background:rgba(0, 4, 12, 0.4)}@keyframes expand-modal--left{from{transform:translate(-100%)}}@keyframes expand-modal--right{from{transform:translate(100%)}}.modal__container{display:flex;flex-wrap:wrap;height:100%;box-sizing:border-box;width:100%;align-items:flex-start}.modal__container--right{animation:expand-modal--right .2s ease-in-out 1;justify-content:flex-end}.modal__container--left{animation:expand-modal--left .2s ease-in-out 1;justify-content:flex-start}.modal__content{display:flex;flex-wrap:wrap;max-height:calc(100% - 48px);height:100%;overflow-y:auto;background-color:rgb(255, 255, 255);padding:24px;border-radius:12px 0px 0px 12px;box-shadow:rgb(0 38 111 / 12%) 0px 0px 16px 0px}.modal__content--right{border-radius:12px 0px 0px 12px}.modal__content--left{border-radius:0px 12px 12px 0px}.modal__box__container{display:flex;flex-wrap:wrap;background-color:#fff;width:100%;border-radius:12px}.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%}}";
|
|
10
|
-
|
|
11
|
-
let EzModal = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.ezCloseModal = index.createEvent(this, "ezCloseModal", 7);
|
|
15
|
-
/**
|
|
16
|
-
* Controle de exibição do Modal
|
|
17
|
-
*/
|
|
18
|
-
this.opened = true;
|
|
19
|
-
/**
|
|
20
|
-
* Define se o modal será fechado ao clicar ESC
|
|
21
|
-
*/
|
|
22
|
-
this.closeEsc = false;
|
|
23
|
-
/**
|
|
24
|
-
* Define se o modal será fechado ao clicar fora do conteúdo.
|
|
25
|
-
*/
|
|
26
|
-
this.closeOutsideClick = false;
|
|
27
|
-
this.handleKeyboardEvent = (ev) => {
|
|
28
|
-
if ((ev === null || ev === void 0 ? void 0 : ev.key) === "Escape" && this.closeEsc) {
|
|
29
|
-
this.closeModal();
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
handleopenedChange() {
|
|
34
|
-
if (this.opened) {
|
|
35
|
-
document.addEventListener("keydown", this.handleKeyboardEvent);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
document.removeEventListener("keydown", this.handleKeyboardEvent);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
closeModal() {
|
|
42
|
-
this.opened = false;
|
|
43
|
-
this.ezCloseModal.emit(this.opened);
|
|
44
|
-
}
|
|
45
|
-
componentDidLoad() {
|
|
46
|
-
this.handleopenedChange();
|
|
47
|
-
}
|
|
48
|
-
onMouseDownHandler(event) {
|
|
49
|
-
if (this.closeOutsideClick && event.target === this._overlay) {
|
|
50
|
-
this.closeModal();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
render() {
|
|
54
|
-
const positionSufix = this.align === "left" ? "left" : "right";
|
|
55
|
-
return (index.h(index.Host, null, this.opened
|
|
56
|
-
?
|
|
57
|
-
index.h("div", { class: "modal", onMouseDown: evt => this.onMouseDownHandler(evt) }, index.h("div", { class: `modal__container modal__container--${positionSufix}`, ref: ref => this._overlay = ref }, index.h("div", { class: `modal__content modal__content--${positionSufix} ${this.modalSize}` }, index.h("slot", null))))
|
|
58
|
-
:
|
|
59
|
-
undefined));
|
|
60
|
-
}
|
|
61
|
-
static get watchers() { return {
|
|
62
|
-
"opened": ["handleopenedChange"]
|
|
63
|
-
}; }
|
|
64
|
-
};
|
|
65
|
-
EzModal.style = ezModalCss;
|
|
6
|
+
const AssetsUtils = require('./AssetsUtils-4909c6de.js');
|
|
7
|
+
const core = require('@sankhyalabs/core');
|
|
66
8
|
|
|
67
9
|
const gridConfigCss = ".sc-grid-config-h{--ez-grid-config__footer--padding-top:var(--space--medium, 12px);--ez-grid-config__main--padding-right:var(--space--medium, 12px);--ez-grid-config__tabselector-container--padding:var(--space--medium, 12px);--ez-grid-config__button-close--padding-left:var(--space--medium, 12px);--ez-grid-config__subtitle--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-weight:var(--text-weight--large, 700);--ez-grid-config__subtitle--font-size:var(--text--medium, 14px);--ez-grid-config__scrollbar--width:var(--space--medium, 12px);--ez-grid-config__main__scrollbar--background-color:var(--text--primary, #626e82);--ez-grid-config__main__scrollbar--border-radius:var(--border--radius-medium, 12px);--ez-grid__group--font-family:var(--font-pattern, \"Sora\");--ez-grid__group--font-size:var(--text--medium, 14px);--ez-grid__group--font-weight:var(--text-weight--large, 600);--ez-grid__group--padding-bottom:var(--space-small, 6px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.padding-right--medium.sc-grid-config{padding-right:var(--space--medium)}ez-list.sc-grid-config{height:100%}.heigth-calc.sc-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-grid-config{padding-top:var(--ez-grid-config__footer--padding-top);display:flex;justify-content:flex-end;width:100%}.hidden.sc-grid-config{display:none}.grid-config__main.sc-grid-config{padding-right:var(--ez-grid-config__main--padding-right);overflow-y:auto}.tabselector-container.sc-grid-config{padding:var(--ez-grid-config__tabselector-container--padding) 0}.button-close.sc-grid-config{padding-left:var(--ez-grid-config__button-close--padding-left)}.title-container.sc-grid-config{display:flex;justify-content:space-between;align-items:center;width:359px}.subtitle.sc-grid-config{font-family:var(--ez-grid-config__subtitle--font-family);font-size:var(--ez-grid-config__subtitle--font-size);color:var(--text--primary)}.title.sc-grid-config{display:flex;margin:0;font-family:var(--ez-grid-config__title--font-family);font-size:var(--title--large);font-weight:var(--ez-grid-config__title--font-weight);line-height:normal;letter-spacing:0em;text-align:left;color:var(--title--primary)}.grid-config__main.sc-grid-config::-webkit-scrollbar-track{background-color:#f0f2f5}.grid-config__main.sc-grid-config::-webkit-scrollbar-thumb{background-color:var(--ez-grid-config__main__scrollbar--background-color);border-radius:var(--ez-grid-config__main__scrollbar--border-radius)}.grid-config__main.sc-grid-config::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-grid-config__scrollbar--width);max-width:var(--ez-grid-config__scrollbar--width);min-width:var(--ez-grid-config__scrollbar--width)}.group-name.sc-grid-config{font-family:var(--ez-grid__group--font-family);font-size:var(--ez-grid__group--font-size);font-weight:var(--ez-grid__group--font-weight);padding-bottom:var(--ez-grid__group--padding-bottom)}";
|
|
68
10
|
|
|
@@ -263,7 +205,7 @@ let GridConfig = class {
|
|
|
263
205
|
}
|
|
264
206
|
}
|
|
265
207
|
compareWords(column, searchingText) {
|
|
266
|
-
if (
|
|
208
|
+
if (core.StringUtils.replaceAccentuatedChars(column.label).indexOf(core.StringUtils.replaceAccentuatedChars(searchingText)) > -1) {
|
|
267
209
|
return true;
|
|
268
210
|
}
|
|
269
211
|
return false;
|
|
@@ -312,5 +254,4 @@ let GridConfig = class {
|
|
|
312
254
|
};
|
|
313
255
|
GridConfig.style = gridConfigCss;
|
|
314
256
|
|
|
315
|
-
exports.ez_modal = EzModal;
|
|
316
257
|
exports.grid_config = GridConfig;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["ez-
|
|
17
|
+
return index.bootstrapLazy([["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config.cjs",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]]],["ez-modal.cjs",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input.cjs",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"setFocus":[64],"setBlur":[64]}]]],["ez-date-input.cjs",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input.cjs",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["ez-search.cjs",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["select-box.cjs",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-number-input.cjs",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"setFocus":[64],"setBlur":[64]}]]],["ez-collapsible-box.cjs",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}]]],["ez-list.cjs",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area.cjs",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"setFocus":[64],"setBlur":[64]}]]],["ez-upload.cjs",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button.cjs",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar.cjs",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check.cjs",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector.cjs",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box.cjs",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-icon.cjs",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-form.cjs",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]],["test-du.cjs",[[0,"test-du"]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-88286449.js');
|
|
6
|
+
|
|
7
|
+
const selectBoxCss = "ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";
|
|
8
|
+
|
|
9
|
+
let SelectBox = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
13
|
+
this.selectedOption = { value: "na", label: "N/A" };
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return (index.h("ez-combo-box", { class: "grid-config-combo inverted", label: "", value: this.selectedOption, enabled: true, canShowError: false, suppressEmptyOption: true }, index.h("option", { value: "na" }, "N/A"), index.h("option", { value: "asc" }, "A-Z"), index.h("option", { value: "desc" }, "Z-A")));
|
|
17
|
+
}
|
|
18
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
19
|
+
};
|
|
20
|
+
SelectBox.style = selectBoxCss;
|
|
21
|
+
|
|
22
|
+
exports.select_box = SelectBox;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-88286449.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const testDuCss = ":host{display:block}";
|
|
9
|
+
|
|
10
|
+
let TestDu = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
}
|
|
14
|
+
/*private _ezButton// : HTMLEzButton;
|
|
15
|
+
private _ezComboBox// : HTMLEzComboBox;
|
|
16
|
+
private _ezDateInput// : HTMLEzDateInput;
|
|
17
|
+
private _ezDateTimeInput// : HTMLEzDateTimeInput;
|
|
18
|
+
private _ezNumberInput// : HTMLEzNumberInput
|
|
19
|
+
private _ezSearch// : HTMLEzSearch
|
|
20
|
+
private _ezUpload// : HTMLEzUpload*/
|
|
21
|
+
componentWillLoad() {
|
|
22
|
+
this.dataUnit = new core.DataUnit("testes_com_formulario");
|
|
23
|
+
this.dataUnit.metadata = {
|
|
24
|
+
name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
|
|
25
|
+
label: "Parceiro",
|
|
26
|
+
fields: [
|
|
27
|
+
{
|
|
28
|
+
name: "CODPARC",
|
|
29
|
+
label: "Parceiro",
|
|
30
|
+
dataType: core.DataType.NUMBER,
|
|
31
|
+
userInterface: core.UserInterface.SEARCH,
|
|
32
|
+
required: true,
|
|
33
|
+
properties: {}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "RECDESP",
|
|
37
|
+
label: "Receita/Despesa",
|
|
38
|
+
dataType: core.DataType.TEXT,
|
|
39
|
+
userInterface: core.UserInterface.OPTIONSELECTOR,
|
|
40
|
+
required: true,
|
|
41
|
+
properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "P",
|
|
45
|
+
label: "pera",
|
|
46
|
+
dataType: core.DataType.TEXT,
|
|
47
|
+
userInterface: core.UserInterface.OPTIONSELECTOR,
|
|
48
|
+
properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "ME",
|
|
52
|
+
label: "ME",
|
|
53
|
+
dataType: core.DataType.NUMBER,
|
|
54
|
+
userInterface: core.UserInterface.DECIMALNUMBER,
|
|
55
|
+
properties: { precision: 4, prettyPrecision: 1 }
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
this.dataUnit.dataLoader = () => new Promise(accept => accept([
|
|
60
|
+
{
|
|
61
|
+
__record__id__: "1321321321321321",
|
|
62
|
+
CODPARC: 10,
|
|
63
|
+
NOMEPARC: "Parceiro 10",
|
|
64
|
+
P: "M",
|
|
65
|
+
L: "Bagaço",
|
|
66
|
+
LI: "Azedo"
|
|
67
|
+
}
|
|
68
|
+
]));
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
return (index.h("ez-form", { dataUnit: this.dataUnit }));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
TestDu.style = testDuCss;
|
|
75
|
+
|
|
76
|
+
exports.test_du = TestDu;
|