@sankhyalabs/ezui 1.1.40 → 1.1.44

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.
@@ -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-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"oppened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64]}]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errormessage":[1537],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-modal.cjs",[[1,"ez-modal",{"modalsize":[1],"align":[1],"oppened":[4],"closeesc":[4],"closeoutsideclick":[4]}]]],["ez-number-input.cjs",[[1,"ez-number-input",{"strvalue":[1025],"value":[1026],"label":[513],"enabled":[516],"errormessage":[1537],"precision":[1538],"prettyprecision":[1538],"textleft":[516],"formatnumber":[513],"setFocus":[64],"setBlur":[64],"handleFocusout":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoclose":[516],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxwidth":[513],"isOpened":[1540,"is-opened"],"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"],"show":[64]}]]],["ez-button_16.cjs",[[0,"ez-form",{"metadataexecutor":[1],"loadexecutor":[1],"saveexecutor":[1],"removeexecutor":[1],"fieldsearchexecutor":[1],"ignoresavevalidation":[4],"metadata":[16],"slavemode":[4],"enabled":[4],"validate":[64],"getChanges":[64],"changeFieldValue":[64]}],[1,"form-metadata",{"name":[1],"label":[1],"dataunit":[1025],"many":[4],"autoload":[4],"metadata":[1040]}],[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errormessage":[1537]}],[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errormessage":[1537],"optionloader":[16],"showselectedvalue":[4],"showoptionvalue":[4]}],[1,"ez-numeric-input",{"label":[513],"value":[1538],"enabled":[516],"errormessage":[1537],"precision":[8],"prettyprecision":[8]}],[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}],[1,"ez-collapsable-box",{"value":[1540],"label":[513],"showHide":[64]}],[1,"ez-tabselector",{"selectedindex":[1537],"selectedtab":[1537],"tabs":[1]}],[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errormessage":[1537],"rows":[1538],"setFocus":[64],"setBlur":[64]}],[1,"ez-upload",{"maxFileSize":[514,"max-file-size"],"headers":[520],"timeout":[514],"withCredentials":[516,"with-credentials"],"formDataName":[513,"form-data-name"],"target":[513],"value":[16],"addFiles":[64]}],[1,"place-holder"],[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513]}],[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errormessage":[1537],"searchmode":[4],"showselectedvalue":[4],"showoptionvalue":[4],"optionloader":[16],"_preSelection":[32],"_visibleOptions":[32]}],[1,"ez-calendar",{"value":[1040],"floating":[516],"show":[64],"hide":[64]}],[1,"ez-icon",{"size":[513],"href":[513]}],[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errormessage":[1537],"onlynumber":[516],"mask":[1],"restrict":[1],"setFocus":[64],"setBlur":[64]}]]]], options);
17
+ return index.bootstrapLazy([["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"oppened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64]}]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errormessage":[1537],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-modal.cjs",[[1,"ez-modal",{"modalsize":[1],"align":[1],"oppened":[4],"closeesc":[4],"closeoutsideclick":[4]}]]],["ez-number-input.cjs",[[1,"ez-number-input",{"strvalue":[1025],"value":[1026],"label":[513],"enabled":[516],"errormessage":[1537],"precision":[1538],"prettyprecision":[1538],"textleft":[516],"formatnumber":[513],"setFocus":[64],"setBlur":[64],"handleFocusout":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoclose":[516],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxwidth":[513],"isOpened":[1540,"is-opened"],"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"],"show":[64]}]]],["ez-button_16.cjs",[[0,"ez-form",{"metadataexecutor":[1],"loadexecutor":[1],"saveexecutor":[1],"removeexecutor":[1],"fieldsearchexecutor":[1],"ignoresavevalidation":[4],"metadata":[16],"slavemode":[4],"enabled":[4],"validate":[64],"getChanges":[64],"changeFieldValue":[64]}],[1,"form-metadata",{"name":[1],"label":[1],"dataunit":[1025],"many":[4],"autoload":[4],"metadata":[1040]}],[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errormessage":[1537]}],[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errormessage":[1537],"optionloader":[16],"showselectedvalue":[4],"showoptionvalue":[4]}],[1,"ez-numeric-input",{"label":[513],"value":[1538],"enabled":[516],"errormessage":[1537],"precision":[8],"prettyprecision":[8]}],[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}],[1,"ez-collapsable-box",{"value":[1540],"label":[513],"showHide":[64]}],[1,"ez-tabselector",{"selectedindex":[1537],"selectedtab":[1537],"tabs":[1]}],[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errormessage":[1537],"rows":[1538],"setFocus":[64],"setBlur":[64]}],[1,"ez-upload",{"label":[1],"enabled":[4],"maxfilesize":[2],"maxfiles":[2],"requestheaders":[8],"urlupload":[1],"urldelete":[1],"value":[1040],"addFiles":[64]}],[1,"place-holder"],[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513]}],[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errormessage":[1537],"searchmode":[4],"showselectedvalue":[4],"showoptionvalue":[4],"optionloader":[16],"_preSelection":[32],"_visibleOptions":[32]}],[1,"ez-calendar",{"value":[1040],"floating":[516],"show":[64],"hide":[64]}],[1,"ez-icon",{"size":[513],"href":[513]}],[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errormessage":[1537],"onlynumber":[516],"mask":[1],"restrict":[1],"setFocus":[64],"setBlur":[64]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -19,11 +19,6 @@ export class FormMetadata {
19
19
  properties.push({ name: "options", value: JSON.stringify(objOpts) });
20
20
  }
21
21
  else if (userInterface === "FILE") {
22
- /*<URL>http://localhost:8080/2a3skw-graphql/uploadFiles</URL>
23
- <HEADERS>
24
- <HEADER NAME="Authorization">dsfs</HEADER>
25
- </HEADER>
26
- </field> */
27
22
  const urlElement = element.querySelector('URL');
28
23
  const headersElement = element.querySelectorAll('HEADERS>HEADER');
29
24
  if (urlElement) {
@@ -36,6 +31,7 @@ export class FormMetadata {
36
31
  });
37
32
  properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
38
33
  }
34
+ this.addPropertyIfExists(properties, element, "maxfiles");
39
35
  }
40
36
  else {
41
37
  if (!label) {
@@ -67,10 +67,9 @@ export const Field = ({ dataUnit, field, forceScroll, enabled }) => {
67
67
  const target = getProp(properties, 'URL');
68
68
  const strHeaders = getProp(properties, 'HEADERS');
69
69
  const headers = strHeaders ? JSON.parse(strHeaders) : {};
70
- return (h("div", { class: "col col--sd-12 padding--small" },
71
- h("ez-upload", { onEzChange: (event) => {
72
- changeFieldHandler(event.target['value']);
73
- }, target: target, headers: headers, value: value })));
70
+ const maxfiles = Number(getProp(properties, "maxfiles") || 0);
71
+ return (h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
72
+ h("ez-upload", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.detail), urlupload: target, requestheaders: headers, maxfiles: maxfiles })));
74
73
  case 'DATE':
75
74
  return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
76
75
  h("ez-date-input", { value: !value ? null : DateUtils.clearTime(value), label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target['value']), errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
@@ -21,14 +21,7 @@ export const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
21
21
  buttonProps.removeVisible ? h("ez-button", { key: du.name + '_remove', label: "Remover", enabled: enabled && du.hasCurrentRecord(), onClick: () => removeHandler(du), image: "/themes/default/images/icons/actions-sprite.svg#minus-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
22
22
  buttonProps.addVisible ? h("ez-button", { key: du.name + '_add', label: "Adicionar", enabled: enabled, onClick: () => du.insert(), class: "button--secondary margin-right--medium" }) : null,
23
23
  buttonProps.reloadVisible ? h("ez-button", { key: du.name + '_reload', title: "Recarregar", enabled: enabled, mode: "icon", onClick: () => du.load(), image: "/themes/default/images/icons/actions-sprite.svg#rotate", class: "button--secondary margin-right--medium" }) : null,
24
- buttonProps.cancelVisible ? h("ez-button", { key: du.name + '_cancel', label: "Cancelar", enabled: enabled && du.hasChanges(), onClick: () => {
25
- Application.confirm("Confirmar cancelamento", "Você perderá a edição atual do registro. Deseja continuar?", /*
26
- getAssetPath("./assets/trash-can-outline.svg")*/ null, true).then(ok => {
27
- if (ok) {
28
- du.cancel();
29
- }
30
- });
31
- }, class: "button--secondary margin-right--medium" }) : null,
24
+ buttonProps.cancelVisible ? h("ez-button", { key: du.name + '_cancel', label: "Cancelar", enabled: enabled && du.hasChanges(), onClick: () => du.cancel(), class: "button--secondary margin-right--medium" }) : null,
32
25
  buttonProps.saveVisible ? h("ez-button", { key: du.name + '_save', label: "Salvar", enabled: enabled && du.hasChanges(), onClick: () => du.save(), class: "button--primary margin-right--medium" }) : null);
33
26
  }
34
27
  else {
@@ -0,0 +1,89 @@
1
+ export default class RemoteFile {
2
+ constructor(file) {
3
+ this.file = file;
4
+ this.size = file.size;
5
+ this.name = file.name;
6
+ }
7
+ abortUpload() {
8
+ if (this._uploadingXhr) {
9
+ this._aborted = true;
10
+ this._uploadingXhr.abort();
11
+ this._uploadingXhr = undefined;
12
+ }
13
+ }
14
+ isUploading() {
15
+ return this._uploadingXhr !== undefined;
16
+ }
17
+ async upload(server, headers, updateCallBack) {
18
+ return new Promise((resolve, reject) => {
19
+ const xhr = new XMLHttpRequest();
20
+ this._uploadingXhr = xhr;
21
+ this._aborted = false;
22
+ this.progress = 0;
23
+ xhr.upload.onprogress = (e) => {
24
+ const loaded = e.loaded;
25
+ const total = e.total;
26
+ this.progress = ~~((loaded / total) * 100);
27
+ updateCallBack(this, loaded, total);
28
+ };
29
+ xhr.onreadystatechange = () => {
30
+ if (xhr.readyState == 4) {
31
+ this._uploadingXhr = undefined;
32
+ const status = xhr.status;
33
+ if (!this._aborted) {
34
+ if (status === 0) {
35
+ reject("Servidor indisponível");
36
+ }
37
+ else if (status >= 500) {
38
+ reject("Erro inesperado no servidor");
39
+ }
40
+ else if (status >= 400) {
41
+ reject("Operação não permitida");
42
+ }
43
+ }
44
+ const response = xhr.response;
45
+ if (response) {
46
+ resolve(JSON.parse(response));
47
+ }
48
+ }
49
+ };
50
+ xhr.ontimeout = () => {
51
+ reject("Tempo limite de transferência atingido.");
52
+ };
53
+ const formData = new FormData();
54
+ formData.append("ARQUIVO", this.file, this.file.name);
55
+ xhr.open("POST", server, true);
56
+ if (headers) {
57
+ headers.forEach((value, key) => xhr.setRequestHeader(key, value));
58
+ }
59
+ xhr.send(formData);
60
+ });
61
+ }
62
+ async delete(item, server, headers) {
63
+ return new Promise((resolve, reject) => {
64
+ const xhr = new XMLHttpRequest();
65
+ xhr.onreadystatechange = () => {
66
+ if (xhr.readyState == 4) {
67
+ if (xhr.status === 0) {
68
+ reject("Servidor indisponível");
69
+ }
70
+ else if (xhr.status >= 500) {
71
+ reject("Erro inesperado no servidor");
72
+ }
73
+ else if (xhr.status >= 400) {
74
+ reject("Operação não permitida");
75
+ }
76
+ resolve(true);
77
+ }
78
+ };
79
+ xhr.ontimeout = () => {
80
+ reject("Tempo limite de remoção atingido.");
81
+ };
82
+ xhr.open("DELETE", server, true);
83
+ if (headers) {
84
+ headers.forEach((value, key) => xhr.setRequestHeader(key, value));
85
+ }
86
+ xhr.send(JSON.stringify(item));
87
+ });
88
+ }
89
+ }
@@ -29,6 +29,9 @@
29
29
  --iu--font-family: var(--font-pattern, Arial);
30
30
  --iu--font-weight: var(--text-weight--large, 500);
31
31
 
32
+ --iu__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>');
33
+ --iu__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>');
34
+
32
35
  /*private*/
33
36
  display: flex;
34
37
  flex-wrap: wrap;
@@ -53,7 +56,6 @@
53
56
 
54
57
  .iu__container {
55
58
  width: 100%;
56
- height: 100%;
57
59
  display: flex;
58
60
  flex-wrap: wrap;
59
61
  justify-content: center;
@@ -197,7 +199,24 @@ progress[value]::-webkit-progress-value {
197
199
  background-color: var(--text--primary, #008561);
198
200
  width: 8px;
199
201
  height: 8px;
200
- clip-path: path("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");
202
+ -webkit-mask-image: var(--iu__btn-cancel-image);
203
+ mask-image: var(--iu__btn-cancel-image);
204
+ }
205
+
206
+ .iu__label{
207
+ padding: var(--space--small);
208
+ padding-top: 0;
209
+ box-sizing: border-box;
210
+ overflow: hidden;
211
+ text-overflow: ellipsis;
212
+ white-space: nowrap;
213
+
214
+ /*public*/
215
+ font-family: var(--iu--font-family);
216
+ font-size: var(--text--extra-small);
217
+ font-weight: var( --iu--font-weight);
218
+ color: var(--iu--text--primary);
219
+ text-shadow: var(--iu--text-shadow);
201
220
  }
202
221
 
203
222
  .iu__file-icon {
@@ -206,6 +225,9 @@ progress[value]::-webkit-progress-value {
206
225
  background-color: unset;
207
226
  cursor: pointer;
208
227
  }
228
+ .iu__file-icon:disabled {
229
+ cursor: unset;
230
+ }
209
231
 
210
232
  .iu__file-icon::after {
211
233
  content: '';
@@ -213,7 +235,11 @@ progress[value]::-webkit-progress-value {
213
235
  background-color: var(--text--primary, #626e82);
214
236
  width: 9px;
215
237
  height: 11px;
216
- clip-path: path("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");
238
+ -webkit-mask-image: var(--iu__file-icon-image);
239
+ mask-image: var(--iu__file-icon-image);
240
+ }
241
+ .iu__file-icon:disabled::after {
242
+ background-color: var(--text--disable, #AFB6C0);
217
243
  }
218
244
 
219
245
  .iu__icon-label {
@@ -224,6 +250,19 @@ progress[value]::-webkit-progress-value {
224
250
  box-sizing: border-box;
225
251
  }
226
252
 
253
+ .background--disabled {
254
+ background-color: var(--color--disable-secondary, #F2F5F8);
255
+ }
256
+
257
+ .text--disabled{
258
+ color: var(--text--disable, #AFB6C0);
259
+ }
260
+
261
+ .mouse-pointer--disabled{
262
+ cursor: none;
263
+ }
264
+
265
+
227
266
  /* //////// GRID SYSTEM //////// */
228
267
 
229
268
  .row {