@sankhyalabs/ezui 1.1.76 → 1.1.77
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-d1c1db56.js +35 -0
- package/dist/cjs/AssetsUtils-dd585fba.js +24 -0
- package/dist/cjs/DataUnit-fdd7c70e.js +474 -0
- package/dist/cjs/DateUtils-716769e0.js +46 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +28 -0
- package/dist/cjs/ez-button_11.cjs.entry.js +111771 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +212 -0
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +630 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +250 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +144 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +1838 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +61 -190
- package/dist/cjs/ez-popover.cjs.entry.js +3 -3
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-time-input.cjs.entry.js +9 -27
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +3 -3
- package/dist/cjs/form-metadata.cjs.entry.js +129 -0
- package/dist/cjs/index-262d703b.js +7442 -0
- package/dist/cjs/{index-9431aeeb.js → index-4e4bae01.js} +1 -5
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +8 -3
- package/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/collection/components/ez-application/ez-application.js +37 -0
- package/dist/collection/components/ez-button/ez-button.css +16 -1
- package/dist/collection/components/ez-button/ez-button.js +27 -2
- package/dist/collection/components/ez-calendar/ez-calendar.css +70 -3
- package/dist/collection/components/ez-calendar/ez-calendar.js +168 -24
- package/dist/collection/components/ez-check/ez-check.css +78 -78
- package/dist/collection/components/ez-check/ez-check.js +3 -3
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +67 -51
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +49 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +254 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +4 -4
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +1 -1
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +2 -2
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +21 -0
- package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +203 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +41 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +12 -0
- package/dist/collection/components/ez-grid/ez-grid.css +15 -0
- package/dist/collection/components/ez-grid/ez-grid.js +414 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +105 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +354 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +7 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +66 -0
- package/dist/collection/components/ez-icon/ez-icon.css +1 -1
- package/dist/collection/components/ez-list/ez-list.css +227 -44
- package/dist/collection/components/ez-list/ez-list.js +529 -149
- package/dist/collection/components/ez-modal/ez-modal.css +4 -4
- package/dist/collection/components/ez-modal/ez-modal.js +1 -1
- package/dist/collection/components/ez-number-input/ez-number-input.css +7 -162
- package/dist/collection/components/ez-number-input/ez-number-input.js +90 -281
- package/dist/collection/components/ez-popover/ez-popover.css +10 -6
- package/dist/collection/components/ez-popup/ez-popup.css +25 -27
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -1
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +3 -3
- package/dist/collection/components/ez-text-area/ez-text-area.js +1 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +1 -0
- package/dist/collection/components/ez-upload/ez-upload.js +3 -3
- package/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/collection/components/test-du/test-du.js +45 -0
- package/dist/collection/servidor.js +94 -94
- package/dist/collection/utils/{Application.js → ApplicationUtils.js} +4 -4
- package/dist/custom-elements/index.d.ts +36 -6
- package/dist/custom-elements/index.js +120975 -3013
- package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
- package/dist/esm/AssetsUtils-3803e935.js +22 -0
- package/dist/esm/DataUnit-1cd45202.js +464 -0
- package/dist/esm/DateUtils-0a1bbd7a.js +44 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +24 -0
- package/dist/esm/ez-button_11.entry.js +111757 -0
- package/dist/esm/ez-calendar.entry.js +208 -0
- package/dist/esm/ez-collapsible-box_6.entry.js +621 -0
- package/dist/esm/ez-combo-box.entry.js +246 -0
- package/dist/esm/ez-date-time-input.entry.js +140 -0
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +1834 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +61 -190
- package/dist/esm/ez-popover.entry.js +3 -3
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-time-input.entry.js +3 -21
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/form-metadata.entry.js +125 -0
- package/dist/esm/{index-fd3c8023.js → index-1dacecd3.js} +1 -5
- package/dist/esm/index-cfd5e193.js +7433 -0
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-1ea8187e.entry.js +369 -0
- package/dist/ezui/p-37a611ea.js +1 -0
- package/dist/ezui/p-45689464.entry.js +1 -0
- package/dist/ezui/{p-a0b6eee2.entry.js → p-516d0e0f.entry.js} +1 -1
- package/dist/ezui/p-57291f97.entry.js +1 -0
- package/dist/ezui/{p-66954a04.entry.js → p-5a86e18a.entry.js} +1 -1
- package/dist/ezui/{p-823ff0a0.entry.js → p-5da66d3e.entry.js} +1 -1
- package/dist/ezui/p-69416bec.entry.js +1 -0
- package/dist/ezui/p-7107d7ef.js +1 -0
- package/dist/ezui/p-7ef97c5f.entry.js +1 -0
- package/dist/ezui/p-88f45a83.entry.js +1 -0
- package/dist/ezui/p-8c51a6aa.entry.js +1 -0
- package/dist/ezui/{p-e0ab3746.js → p-8f4851a6.js} +1 -1
- package/dist/ezui/p-9dfd537e.js +1 -0
- package/dist/ezui/{p-d443f020.entry.js → p-a18a2d7b.entry.js} +1 -1
- package/dist/ezui/p-a223eed8.entry.js +1 -0
- package/dist/ezui/p-b36308e7.js +1 -0
- package/dist/ezui/p-c0af195b.entry.js +1 -0
- package/dist/ezui/p-c6d469fc.entry.js +1 -0
- package/dist/ezui/p-c89629eb.js +1 -0
- package/dist/ezui/p-e7ee2836.entry.js +1 -0
- package/dist/ezui/p-f7b835cf.entry.js +1 -0
- package/dist/types/components/ez-application/ez-application.d.ts +12 -0
- package/dist/types/components/ez-button/ez-button.d.ts +5 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +21 -0
- package/dist/types/components/ez-check/ez-check.d.ts +1 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +42 -0
- package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +8 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +195 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +34 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +78 -0
- package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +30 -0
- package/dist/types/components/ez-grid/subcomponents/select-box/select-box.d.ts +9 -0
- package/dist/types/components/ez-list/ez-list.d.ts +70 -17
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +33 -50
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +1 -1
- package/dist/types/components/test-du/test-du.d.ts +6 -0
- package/dist/types/components.d.ts +283 -117
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/utils/{Application.d.ts → ApplicationUtils.d.ts} +1 -1
- package/package.json +10 -8
- package/react/components.d.ts +6 -1
- package/react/components.js +6 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/RequestMetadata-2cd01e8a.js +0 -531
- package/dist/cjs/ez-button_16.cjs.entry.js +0 -4079
- package/dist/cjs/ez-list.cjs.entry.js +0 -174
- package/dist/cjs/ez-modal.cjs.entry.js +0 -65
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +0 -13
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.js +0 -185
- package/dist/esm/RequestMetadata-c265c9d5.js +0 -527
- package/dist/esm/ez-button_16.entry.js +0 -4060
- package/dist/esm/ez-list.entry.js +0 -170
- package/dist/esm/ez-modal.entry.js +0 -61
- package/dist/ezui/p-11ae4ae7.entry.js +0 -1
- package/dist/ezui/p-47fa3d6c.entry.js +0 -1
- package/dist/ezui/p-8ab6168f.entry.js +0 -1
- package/dist/ezui/p-9c1fb51c.entry.js +0 -1
- package/dist/ezui/p-9d85125b.entry.js +0 -1
- package/dist/ezui/p-9dfccb16.js +0 -1
- package/dist/ezui/p-a7b546b2.entry.js +0 -1
- package/dist/ezui/p-c833c94f.entry.js +0 -1
- package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +0 -45
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-4e4bae01.js');
|
|
6
|
+
require('./index-262d703b.js');
|
|
7
|
+
const DateUtils = require('./DateUtils-716769e0.js');
|
|
8
|
+
const CSSVarsUtils = require('./CSSVarsUtils-f8827674.js');
|
|
9
|
+
const ApplicationUtils = require('./ApplicationUtils-d1c1db56.js');
|
|
10
|
+
|
|
11
|
+
const ezCollapsibleBoxCss = ":host{--ez-collapsible-box--height:42px;--ez-collapsible-box--font-size:var(--title--medium, 14px);--ez-collapsible-box--font-family:var(--font-pattern, Arial);--ez-collapsible-box--font-weight:var(--text-weight--large, 600);--ez-collapsible-box--color:var(--title--primary);--ez-collapsible-box__btn--image--xsmall:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"12px\" width=\"7.5px\"><path d=\"M 0,10.56 4.5967752,6.0000006 0,1.3800006 1.4516132,0 7.5,6.0000006 1.4516132,12 Z\"/></svg>');--ez-collapsible-box__btn--image--small:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"14px\" width=\"8.68px\"><path d=\"M 0,12.32 5.3200012,7.0000007 0,1.6100007 1.6800004,0 8.68,7.0000007 1.6800004,14 Z\"/></svg>');--ez-collapsible-box__btn--image--medium:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--ez-collapsible-box__btn--image--large:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"18px\" width=\"11.25px\"><path d=\"M 0,15.84 6.8951628,9.0000009 0,2.0700009 2.1774198,0 11.25,9.0000009 2.1774198,18 Z\"/></svg>');--ez-collapsible-box__btn--image--xlarge:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"20px\" width=\"12.5px\"><path d=\"M 0,17.6 7.661292,10.000001 0,2.300001 2.4193553,0 12.5,10.000001 2.4193553,20 Z\"/></svg>');--ez-collapsible-box__btn--fill:var(--ez-collapsible-box--color);--ez-collapsible-box__btn--width:10px;--ez-collapsible-box__btn--height:16px;display:flex;flex-wrap:wrap;width:100%}.collapsible-box__title{width:100%;align-self:center;display:flex;box-sizing:border-box}.collapsible-box__label{white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;width:100%;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight);color:var(--ez-collapsible-box--color)}.collapsible-box__label--icon-right{white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight);color:var(--ez-collapsible-box--color)}.collapsible-box__btn{outline:none;border:none;background-color:unset;cursor:pointer;padding:1px 6px}.collapsible-box__btn::after{content:'';display:flex;background-color:var(--ez-collapsible-box__btn--fill);width:var(--ez-collapsible-box__btn--width);height:var(--ez-collapsible-box__btn--height);transition:transform var(--transition);transform:rotate(90deg)}.collapsible-box__btn--xsmall::after{width:7.5px;height:12px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--xsmall);mask-image:var(--ez-collapsible-box__btn--image--xsmall)}.collapsible-box__btn--small::after{width:8.68px;height:14px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--small);mask-image:var(--ez-collapsible-box__btn--image--small)}.collapsible-box__btn--medium::after{width:10px;height:16px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--medium);mask-image:var(--ez-collapsible-box__btn--image--medium)}.collapsible-box__btn--large::after{width:11.25px;height:18px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--large);mask-image:var(--ez-collapsible-box__btn--image--large)}.collapsible-box__btn--xlarge::after{width:12.5px;height:20px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--xlarge);mask-image:var(--ez-collapsible-box__btn--image--xlarge)}.collapsible-box__btn--collapsed::after{transform:rotate(0deg)}.font--xsmall{font-size:10px}.font--small{font-size:12px}.font--medium{font-size:14px}.font--large{font-size:16px}.font--xlarge{font-size:20px}";
|
|
12
|
+
|
|
13
|
+
let EzCollapsibleBox = class {
|
|
14
|
+
constructor(hostRef) {
|
|
15
|
+
index.registerInstance(this, hostRef);
|
|
16
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
17
|
+
/**
|
|
18
|
+
* Valor externalizado que garante a exibição ou não do componente
|
|
19
|
+
*/
|
|
20
|
+
this.value = false;
|
|
21
|
+
/**
|
|
22
|
+
* Define o tamanho do texto e do ícone do componente.
|
|
23
|
+
*/
|
|
24
|
+
this.headerSize = "small";
|
|
25
|
+
/**
|
|
26
|
+
* Define o local onde o ícone será renderizado.
|
|
27
|
+
*/
|
|
28
|
+
this.iconPlacement = "left";
|
|
29
|
+
}
|
|
30
|
+
observeValue() {
|
|
31
|
+
this.ezChange.emit();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Esconde ou revela o conteúdo do componente
|
|
35
|
+
*/
|
|
36
|
+
async showHide() {
|
|
37
|
+
this.value = !this.value;
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
return (index.h(index.Host, null, this.iconPlacement == "right" ?
|
|
41
|
+
index.h("div", { class: "collapsible-box__title" }, index.h("label", { class: (this.iconPlacement == "right" ? "collapsible-box__label--icon-right " : "collapsible-box__label ") + (this.headerSize ? "font--" + this.headerSize : ""), onClick: () => this.showHide(), title: this.label }, this.label), index.h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.headerSize : "collapsible-box__btn " + "collapsible-box__btn--" + this.headerSize, onClick: () => this.showHide() }))
|
|
42
|
+
:
|
|
43
|
+
index.h("div", { class: "collapsible-box__title" }, index.h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.headerSize : "collapsible-box__btn " + "collapsible-box__btn--" + this.headerSize, onClick: () => this.showHide() }), index.h("label", { class: (this.iconPlacement == "right" ? "collapsible-box__label--icon-right " : "collapsible-box__label ") + (this.headerSize ? "font--" + this.headerSize : ""), onClick: () => this.showHide(), title: this.label }, this.label)), !this.value ? index.h("slot", null) : null));
|
|
44
|
+
}
|
|
45
|
+
static get watchers() { return {
|
|
46
|
+
"value": ["observeValue"]
|
|
47
|
+
}; }
|
|
48
|
+
};
|
|
49
|
+
EzCollapsibleBox.style = ezCollapsibleBoxCss;
|
|
50
|
+
|
|
51
|
+
const ezDateInputCss = ":host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.text-input{--ez-text-input__input--background-color:inherit;--ez-text-input__input--border-color:inherit}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}";
|
|
52
|
+
|
|
53
|
+
let EzDateInput = class {
|
|
54
|
+
constructor(hostRef) {
|
|
55
|
+
index.registerInstance(this, hostRef);
|
|
56
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
57
|
+
/**
|
|
58
|
+
* Deixa o campo disponível ou não para uso.
|
|
59
|
+
*/
|
|
60
|
+
this.enabled = true;
|
|
61
|
+
}
|
|
62
|
+
setLabel() {
|
|
63
|
+
this._textInput.label = this.label;
|
|
64
|
+
}
|
|
65
|
+
setErrorMessage() {
|
|
66
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
67
|
+
}
|
|
68
|
+
applyValueToInput() {
|
|
69
|
+
if (this._textInput) {
|
|
70
|
+
this._textInput.value = this.getTextValue(this.value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
changeValue(newValue) {
|
|
74
|
+
newValue = newValue == null ? null : DateUtils.DateUtils.clearTime(newValue);
|
|
75
|
+
this._textInput.errorMessage = "";
|
|
76
|
+
if (this.getTextValue(newValue) !== this.getTextValue(this.value)) {
|
|
77
|
+
this.value = newValue;
|
|
78
|
+
this.ezChange.emit();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
showCalendar() {
|
|
82
|
+
this.parseDate();
|
|
83
|
+
this._calendar.value = this.value;
|
|
84
|
+
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
85
|
+
//posição errada no futuro. Preferi fazer simples no começo,
|
|
86
|
+
//porque não quis onerar o text input com essa funcionalidade...
|
|
87
|
+
const top = this._textInput.errorMessage ? 0 : -17;
|
|
88
|
+
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
89
|
+
}
|
|
90
|
+
hideCalendar() {
|
|
91
|
+
this.changeValue(this._calendar.value);
|
|
92
|
+
this._calendar.hide();
|
|
93
|
+
}
|
|
94
|
+
parseDate() {
|
|
95
|
+
const strValue = this._textInput.value;
|
|
96
|
+
const parsedDate = DateUtils.DateUtils.strToDate(strValue);
|
|
97
|
+
if (parsedDate || !strValue) {
|
|
98
|
+
if (this.value === parsedDate) {
|
|
99
|
+
this.changeValue(this.value);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.changeValue(parsedDate);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this._textInput.errorMessage = "O valor digitado não é uma data válida";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
getTextValue(d) {
|
|
110
|
+
return d ? new Intl.DateTimeFormat("pt-BR").format(d) : null;
|
|
111
|
+
}
|
|
112
|
+
componentDidLoad() {
|
|
113
|
+
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
114
|
+
}
|
|
115
|
+
render() {
|
|
116
|
+
return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
|
|
117
|
+
if (event.key === "H" || event.key === "h")
|
|
118
|
+
this.changeValue(new Date());
|
|
119
|
+
}, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
120
|
+
}
|
|
121
|
+
get _elem() { return index.getElement(this); }
|
|
122
|
+
static get watchers() { return {
|
|
123
|
+
"label": ["setLabel"],
|
|
124
|
+
"errorMessage": ["setErrorMessage"],
|
|
125
|
+
"value": ["applyValueToInput"]
|
|
126
|
+
}; }
|
|
127
|
+
};
|
|
128
|
+
EzDateInput.style = ezDateInputCss;
|
|
129
|
+
|
|
130
|
+
const ezSearchCss = ":host{width:100%}";
|
|
131
|
+
|
|
132
|
+
let EzSearch = class {
|
|
133
|
+
constructor(hostRef) {
|
|
134
|
+
index.registerInstance(this, hostRef);
|
|
135
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
136
|
+
this.showPopup = index.createEvent(this, "showPopup", 7);
|
|
137
|
+
/**
|
|
138
|
+
* Deixa o campo disponível ou não.
|
|
139
|
+
*/
|
|
140
|
+
this.enabled = true;
|
|
141
|
+
/**
|
|
142
|
+
* Ajusta a opção de mostrar o "value" ao selecionar uma opção.
|
|
143
|
+
*/
|
|
144
|
+
this.showSelectedValue = true;
|
|
145
|
+
/**
|
|
146
|
+
* Ajusta a opção de mostrar o "value" para cada opção.
|
|
147
|
+
*/
|
|
148
|
+
this.showOptionValue = true;
|
|
149
|
+
}
|
|
150
|
+
updateValue() {
|
|
151
|
+
if (this._comboElement) {
|
|
152
|
+
this._comboElement.value = this.value;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
onComboChange(evt) {
|
|
156
|
+
evt.stopPropagation();
|
|
157
|
+
this.value = evt.detail;
|
|
158
|
+
this.ezChange.emit(evt.detail);
|
|
159
|
+
}
|
|
160
|
+
render() {
|
|
161
|
+
return (index.h("ez-combo-box", { ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, optionLoader: this.optionLoader, searchMode: true, onEzChange: evt => this.onComboChange(evt), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue }));
|
|
162
|
+
}
|
|
163
|
+
;
|
|
164
|
+
static get watchers() { return {
|
|
165
|
+
"value": ["updateValue"]
|
|
166
|
+
}; }
|
|
167
|
+
};
|
|
168
|
+
EzSearch.style = ezSearchCss;
|
|
169
|
+
|
|
170
|
+
const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--large, 500);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-weight--large, 600);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);color:var(--text-area--color);padding:0;background:none}textarea:focus{outline:none}textarea:disabled{background-color:transparent;color:var(--text-area__input--disabled--color)}.textarea{width:100%;box-sizing:border-box;padding-left:var(--space--medium);padding-right:var(--space--extra-small);border-radius:var(--text-area--border-radius);border:var(--text-area__input--border);border-color:var(--text-area__input--border-color);background-color:var(--text-area__input--background-color)}.textarea--focus{border-color:var(--text-area__input--focus--border-color)}.textarea.hasError{color:var(--text-area--color);border-color:var(--text-area__input--error--border-color)}.message-box{min-height:16px;min-width:100%;margin-top:2px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--text-area--font-family);font-size:var(--text-area__message_box--font-size);color:var(--text-area__message_box--info--color)}.hasError{color:var(--text-area__message_box--error--color)}.textarea__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--text-area__label--padding-right));left:var(--text-area--space--medium);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color);top:var(--text-area__label--padding-top);left:var(--text-area__label--padding-left);padding-right:var(--text-area__label--padding-right)}.textarea__label--floated{font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--text-area__label--floating--top)}.textarea__label--disabled{color:var(--text-area__input--disabled--color)}";
|
|
171
|
+
|
|
172
|
+
let EzTextArea = class {
|
|
173
|
+
constructor(hostRef) {
|
|
174
|
+
index.registerInstance(this, hostRef);
|
|
175
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
176
|
+
/**
|
|
177
|
+
* Deixa o campo disponível ou não para digitação.
|
|
178
|
+
*/
|
|
179
|
+
this.enabled = true;
|
|
180
|
+
/**
|
|
181
|
+
* Ajusta o número de linhas e consequentemente o height do textarea. Valor default: 4
|
|
182
|
+
*/
|
|
183
|
+
this.rows = 4;
|
|
184
|
+
}
|
|
185
|
+
showError() {
|
|
186
|
+
const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
|
|
187
|
+
if (hasError) {
|
|
188
|
+
this._container.classList.add('hasError');
|
|
189
|
+
this._messageBoxElem.classList.add('hasError');
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this._container.classList.remove('hasError');
|
|
193
|
+
this._messageBoxElem.classList.remove('hasError');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
updateInputValue() {
|
|
197
|
+
this._inputElem.value = this.value;
|
|
198
|
+
this.handleChange();
|
|
199
|
+
this.adjustFloatingLabel();
|
|
200
|
+
this.ezChange.emit(this.value);
|
|
201
|
+
}
|
|
202
|
+
adjustFloatingLabel() {
|
|
203
|
+
if (this.label) {
|
|
204
|
+
const hasValue = this.value && this.value.toString().length > 0;
|
|
205
|
+
const containsFloatedClass = this._labelElem.classList.contains("textarea__label--floated");
|
|
206
|
+
if (hasValue || this.isFocused()) {
|
|
207
|
+
if (!containsFloatedClass) {
|
|
208
|
+
this._labelElem.classList.add("textarea__label--floated");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
if (containsFloatedClass) {
|
|
213
|
+
this._labelElem.classList.remove("textarea__label--floated");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
isFocused() {
|
|
219
|
+
return this._hostElement.shadowRoot.activeElement !== null;
|
|
220
|
+
}
|
|
221
|
+
//---------------------------------------------
|
|
222
|
+
// Public methods
|
|
223
|
+
//---------------------------------------------
|
|
224
|
+
/**
|
|
225
|
+
* Faz o foco no componente de input
|
|
226
|
+
*/
|
|
227
|
+
async setFocus() {
|
|
228
|
+
this._inputElem.focus();
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Remove o foco no componente de input
|
|
232
|
+
*/
|
|
233
|
+
async setBlur() {
|
|
234
|
+
this._inputElem.blur();
|
|
235
|
+
}
|
|
236
|
+
//---------------------------------------------
|
|
237
|
+
// Event handlers
|
|
238
|
+
//---------------------------------------------
|
|
239
|
+
handleFocusout() {
|
|
240
|
+
this.adjustFloatingLabel();
|
|
241
|
+
if (this._container && this._container.classList.contains("textarea--focus")) {
|
|
242
|
+
this._container.classList.remove("textarea--focus");
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
handleChange() {
|
|
246
|
+
this.errorMessage = "";
|
|
247
|
+
this.value = this._inputElem.value;
|
|
248
|
+
}
|
|
249
|
+
handleFocus() {
|
|
250
|
+
if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
|
|
251
|
+
this._labelElem.classList.add("textarea__label--floated");
|
|
252
|
+
}
|
|
253
|
+
if (this._container && !this._container.classList.contains("textarea--focus")) {
|
|
254
|
+
this._container.classList.add("textarea--focus");
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
//---------------------------------------------
|
|
258
|
+
// Lifecycle web component
|
|
259
|
+
//---------------------------------------------
|
|
260
|
+
componentDidLoad() {
|
|
261
|
+
this.showError();
|
|
262
|
+
this.adjustFloatingLabel();
|
|
263
|
+
}
|
|
264
|
+
render() {
|
|
265
|
+
return (index.h(index.Host, null, index.h("div", { class: "textarea", ref: (el) => this._container = el }, this.label ?
|
|
266
|
+
index.h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "textarea__label" : "textarea__label textarea__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
267
|
+
: null, index.h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, onKeyDown: event => event.stopPropagation(), rows: this.rows })), index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
268
|
+
}
|
|
269
|
+
get _hostElement() { return index.getElement(this); }
|
|
270
|
+
static get watchers() { return {
|
|
271
|
+
"errorMessage": ["showError"],
|
|
272
|
+
"value": ["updateInputValue"]
|
|
273
|
+
}; }
|
|
274
|
+
};
|
|
275
|
+
EzTextArea.style = ezTextAreaCss;
|
|
276
|
+
|
|
277
|
+
class RemoteFile {
|
|
278
|
+
constructor(file) {
|
|
279
|
+
this.file = file;
|
|
280
|
+
this.size = file.size;
|
|
281
|
+
this.name = file.name;
|
|
282
|
+
}
|
|
283
|
+
abortUpload() {
|
|
284
|
+
if (this._uploadingXhr) {
|
|
285
|
+
this._aborted = true;
|
|
286
|
+
this._uploadingXhr.abort();
|
|
287
|
+
this._uploadingXhr = undefined;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
isUploading() {
|
|
291
|
+
return this._uploadingXhr !== undefined;
|
|
292
|
+
}
|
|
293
|
+
async upload(server, headers, updateCallBack) {
|
|
294
|
+
return new Promise((resolve, reject) => {
|
|
295
|
+
const xhr = new XMLHttpRequest();
|
|
296
|
+
this._uploadingXhr = xhr;
|
|
297
|
+
this._aborted = false;
|
|
298
|
+
this.progress = 0;
|
|
299
|
+
xhr.upload.onprogress = (e) => {
|
|
300
|
+
const loaded = e.loaded;
|
|
301
|
+
const total = e.total;
|
|
302
|
+
this.progress = ~~((loaded / total) * 100);
|
|
303
|
+
updateCallBack(this, loaded, total);
|
|
304
|
+
};
|
|
305
|
+
xhr.onreadystatechange = () => {
|
|
306
|
+
if (xhr.readyState == 4) {
|
|
307
|
+
this._uploadingXhr = undefined;
|
|
308
|
+
const status = xhr.status;
|
|
309
|
+
if (!this._aborted) {
|
|
310
|
+
if (status === 0) {
|
|
311
|
+
reject("Servidor indisponível");
|
|
312
|
+
}
|
|
313
|
+
else if (status >= 500) {
|
|
314
|
+
reject("Erro inesperado no servidor");
|
|
315
|
+
}
|
|
316
|
+
else if (status >= 400) {
|
|
317
|
+
reject("Operação não permitida");
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
const response = xhr.response;
|
|
321
|
+
if (response) {
|
|
322
|
+
resolve(JSON.parse(response));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
xhr.ontimeout = () => {
|
|
327
|
+
reject("Tempo limite de transferência atingido.");
|
|
328
|
+
};
|
|
329
|
+
const formData = new FormData();
|
|
330
|
+
formData.append("ARQUIVO", this.file, this.file.name);
|
|
331
|
+
xhr.open("POST", server, true);
|
|
332
|
+
if (headers) {
|
|
333
|
+
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
334
|
+
}
|
|
335
|
+
xhr.send(formData);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
async delete(item, server, headers) {
|
|
339
|
+
return new Promise((resolve, reject) => {
|
|
340
|
+
const xhr = new XMLHttpRequest();
|
|
341
|
+
xhr.onreadystatechange = () => {
|
|
342
|
+
if (xhr.readyState == 4) {
|
|
343
|
+
if (xhr.status === 0) {
|
|
344
|
+
reject("Servidor indisponível");
|
|
345
|
+
}
|
|
346
|
+
else if (xhr.status >= 500) {
|
|
347
|
+
reject("Erro inesperado no servidor");
|
|
348
|
+
}
|
|
349
|
+
else if (xhr.status >= 400) {
|
|
350
|
+
reject("Operação não permitida");
|
|
351
|
+
}
|
|
352
|
+
resolve(true);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
xhr.ontimeout = () => {
|
|
356
|
+
reject("Tempo limite de remoção atingido.");
|
|
357
|
+
};
|
|
358
|
+
xhr.open("DELETE", server, true);
|
|
359
|
+
if (headers) {
|
|
360
|
+
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
361
|
+
}
|
|
362
|
+
xhr.send(JSON.stringify(item));
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
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}.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%}}";
|
|
368
|
+
|
|
369
|
+
let EzUpload = class {
|
|
370
|
+
constructor(hostRef) {
|
|
371
|
+
index.registerInstance(this, hostRef);
|
|
372
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
373
|
+
this._filePointers = new Map();
|
|
374
|
+
/**
|
|
375
|
+
* Deixa o campo disponível ou não para digitação.
|
|
376
|
+
*/
|
|
377
|
+
this.enabled = true;
|
|
378
|
+
}
|
|
379
|
+
changeValue(newValue) {
|
|
380
|
+
if (newValue !== this._updatingValue) {
|
|
381
|
+
this._filePointers.forEach(f => {
|
|
382
|
+
if (this.isRemoteFile(f)) {
|
|
383
|
+
f.abortUpload();
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
this._filePointers = new Map();
|
|
387
|
+
this.updateFilePointers();
|
|
388
|
+
}
|
|
389
|
+
this._updatingValue = undefined;
|
|
390
|
+
}
|
|
391
|
+
updateFilePointers() {
|
|
392
|
+
if (this.value) {
|
|
393
|
+
this.value.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
normalizeRequestHeaders() {
|
|
397
|
+
this._requestHeaders = new Map();
|
|
398
|
+
if (typeof this.requestHeaders == "string") {
|
|
399
|
+
try {
|
|
400
|
+
this.requestHeaders = JSON.parse(this.requestHeaders);
|
|
401
|
+
}
|
|
402
|
+
catch (e) {
|
|
403
|
+
this.requestHeaders = undefined;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
for (var key in this.requestHeaders) {
|
|
407
|
+
this._requestHeaders.set(key, this.requestHeaders[key]);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Método responsável por adicionar um ou mais arquivos ao componente.
|
|
412
|
+
*/
|
|
413
|
+
async addFiles(files) {
|
|
414
|
+
if (this.maxFiles > 0) {
|
|
415
|
+
let countDistinctFiles = this._filePointers.size;
|
|
416
|
+
files.forEach(file => {
|
|
417
|
+
if (!this._filePointers.has(file.name)) {
|
|
418
|
+
countDistinctFiles++;
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
if (countDistinctFiles > this.maxFiles) {
|
|
422
|
+
this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
Array.prototype.forEach.call(files, this.addFile.bind(this));
|
|
427
|
+
}
|
|
428
|
+
async addFile(file) {
|
|
429
|
+
const oldFile = this._filePointers.get(file.name);
|
|
430
|
+
if (oldFile) {
|
|
431
|
+
ApplicationUtils.ApplicationUtils.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
|
|
432
|
+
.then(ok => {
|
|
433
|
+
if (ok) {
|
|
434
|
+
if (this.isRemoteFile(oldFile)) {
|
|
435
|
+
oldFile.abortUpload();
|
|
436
|
+
}
|
|
437
|
+
this.doAddFile(file);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
this.doAddFile(file);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
async doAddFile(file) {
|
|
446
|
+
if (this.validateFile(file)) {
|
|
447
|
+
const uploadingFile = new RemoteFile(file);
|
|
448
|
+
this._filePointers.set(file.name, uploadingFile);
|
|
449
|
+
uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
|
|
450
|
+
.then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
|
|
451
|
+
.catch(msg => this.showError(msg));
|
|
452
|
+
index.forceUpdate(this);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
finishUpload(ezFile) {
|
|
456
|
+
this._filePointers.set(ezFile.name, ezFile);
|
|
457
|
+
this.updateValue();
|
|
458
|
+
}
|
|
459
|
+
updateValue() {
|
|
460
|
+
this._updatingValue = [];
|
|
461
|
+
this._filePointers.forEach(f => {
|
|
462
|
+
if (!this.isRemoteFile(f)) {
|
|
463
|
+
this._updatingValue.push(f);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
this.value = this._updatingValue;
|
|
467
|
+
this.ezChange.emit(this.value);
|
|
468
|
+
}
|
|
469
|
+
buildProgressId(uploading) {
|
|
470
|
+
let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, "_");
|
|
471
|
+
return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
|
|
472
|
+
}
|
|
473
|
+
updateFeedback(uf) {
|
|
474
|
+
window.requestAnimationFrame(() => {
|
|
475
|
+
if (this._host) {
|
|
476
|
+
const progress = this._host.shadowRoot.querySelector("#" + this.buildProgressId(uf));
|
|
477
|
+
if (progress) {
|
|
478
|
+
progress.value = uf.progress;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
validateFile(file) {
|
|
484
|
+
if (!this._filePointers.has(file.name) && this.maxFiles > 0 && this._filePointers.size >= this.maxFiles) {
|
|
485
|
+
this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
if (file.size === 0) {
|
|
489
|
+
this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
if (!this.urlUpload) {
|
|
493
|
+
this.showError("Endereço de upload não informado");
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
|
|
497
|
+
this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxFileSize));
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
502
|
+
showError(message) {
|
|
503
|
+
ApplicationUtils.ApplicationUtils.alert("Enviando arquivo", message);
|
|
504
|
+
}
|
|
505
|
+
formatBytes(bytes, decimals = 1) {
|
|
506
|
+
if (bytes === 0)
|
|
507
|
+
return "0 Bytes";
|
|
508
|
+
const k = 1024;
|
|
509
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
510
|
+
const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
511
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
512
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
513
|
+
}
|
|
514
|
+
onFileInputChange(event) {
|
|
515
|
+
const input = event.target;
|
|
516
|
+
this.addFiles(Array.from(input.files));
|
|
517
|
+
this._fileInput.value = "";
|
|
518
|
+
}
|
|
519
|
+
isRemoteFile(item) {
|
|
520
|
+
return "file" in item;
|
|
521
|
+
}
|
|
522
|
+
removeFromList(name) {
|
|
523
|
+
this._filePointers.delete(name);
|
|
524
|
+
this.updateValue();
|
|
525
|
+
}
|
|
526
|
+
removeFile(name) {
|
|
527
|
+
const item = this._filePointers.get(name);
|
|
528
|
+
if (this.isRemoteFile(item)) {
|
|
529
|
+
item.abortUpload();
|
|
530
|
+
this.removeFromList(name);
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
if (this.urlDelete) {
|
|
534
|
+
const uploadingFile = new RemoteFile(null);
|
|
535
|
+
this._filePointers.set(item.name, uploadingFile);
|
|
536
|
+
uploadingFile.delete(item, this.urlDelete, null)
|
|
537
|
+
.then(_ok => this.removeFromList(name))
|
|
538
|
+
.catch(msg => this.showError(msg));
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
this.removeFromList(name);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
openFilesDialog() {
|
|
546
|
+
if (this.enabled) {
|
|
547
|
+
this._fileInput.click();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
componentDidLoad() {
|
|
551
|
+
if (this.enabled && this._dropZone && window.FileList && window.File) {
|
|
552
|
+
this._dropZone.addEventListener("dragover", event => {
|
|
553
|
+
event.stopPropagation();
|
|
554
|
+
event.preventDefault();
|
|
555
|
+
event.dataTransfer.dropEffect = "copy";
|
|
556
|
+
this._dropZone.style.background = "#c2dbff";
|
|
557
|
+
});
|
|
558
|
+
this._dropZone.addEventListener("drop", event => {
|
|
559
|
+
event.stopPropagation();
|
|
560
|
+
event.preventDefault();
|
|
561
|
+
this.addFiles(Array.from(event.dataTransfer.files));
|
|
562
|
+
this._dropZone.style.background = "";
|
|
563
|
+
});
|
|
564
|
+
this._dropZone.addEventListener("dragleave", _event => {
|
|
565
|
+
this._dropZone.style.background = "";
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
componentWillRender() {
|
|
570
|
+
if (this.value) {
|
|
571
|
+
if (this._filePointers.size < this.value.length) {
|
|
572
|
+
this.updateFilePointers();
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
render() {
|
|
577
|
+
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, hidden: true })));
|
|
578
|
+
}
|
|
579
|
+
buildFooter() {
|
|
580
|
+
if (this._filePointers.size === 0) {
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
const items = [];
|
|
584
|
+
this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
|
|
585
|
+
return (index.h("div", { class: "iu__footer" }, items));
|
|
586
|
+
}
|
|
587
|
+
buildFileItem(item) {
|
|
588
|
+
const fileName = item.name;
|
|
589
|
+
const progress = Number(item["progress"]);
|
|
590
|
+
const downloadURL = item["downloadURL"];
|
|
591
|
+
const label = `${fileName} (${this.formatBytes(item.size)})`;
|
|
592
|
+
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)
|
|
593
|
+
?
|
|
594
|
+
null
|
|
595
|
+
:
|
|
596
|
+
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
|
|
597
|
+
?
|
|
598
|
+
index.h("div", { class: "col col--stretch align--middle" }, index.h("button", { class: "btn-cancel ", onClick: () => this.removeFile(fileName) }))
|
|
599
|
+
:
|
|
600
|
+
null));
|
|
601
|
+
}
|
|
602
|
+
evalDisabledClass(regularClasses, disabledClass) {
|
|
603
|
+
return this.enabled ? regularClasses : `${regularClasses} ${disabledClass}`;
|
|
604
|
+
}
|
|
605
|
+
get _host() { return index.getElement(this); }
|
|
606
|
+
static get watchers() { return {
|
|
607
|
+
"value": ["changeValue"],
|
|
608
|
+
"requestHeaders": ["normalizeRequestHeaders"]
|
|
609
|
+
}; }
|
|
610
|
+
};
|
|
611
|
+
EzUpload.style = ezUploadCss;
|
|
612
|
+
|
|
613
|
+
const placeHolderCss = ":host{display:flex;width:100%;height:42px;border-radius:12px;background:var(--background--medium);background-image:linear-gradient(to right, var(--background--medium) 0%, var(--background--strong) 20%, var(--background--medium) 40%, var(--background--medium) 100%);background-repeat:no-repeat;background-size:800px 1000px;animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:placeholderShimmer;animation-timing-function:linear}@keyframes placeholderShimmer{0%{background-position:-800px 0}100%{background-position:800px 0}}";
|
|
614
|
+
|
|
615
|
+
let PlaceHolder = class {
|
|
616
|
+
constructor(hostRef) {
|
|
617
|
+
index.registerInstance(this, hostRef);
|
|
618
|
+
}
|
|
619
|
+
render() {
|
|
620
|
+
return index.h(index.Host, null);
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
PlaceHolder.style = placeHolderCss;
|
|
624
|
+
|
|
625
|
+
exports.ez_collapsible_box = EzCollapsibleBox;
|
|
626
|
+
exports.ez_date_input = EzDateInput;
|
|
627
|
+
exports.ez_search = EzSearch;
|
|
628
|
+
exports.ez_text_area = EzTextArea;
|
|
629
|
+
exports.ez_upload = EzUpload;
|
|
630
|
+
exports.place_holder = PlaceHolder;
|