@sankhyalabs/sankhyablocks 1.1.23 → 1.1.27
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-05b74ee9.js +39 -0
- package/dist/cjs/AssetsUtils-bd004f63.js +24 -0
- package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
- package/dist/cjs/ez-application.cjs.entry.js +26 -0
- package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +223 -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-dialog.cjs.entry.js +89 -0
- package/dist/cjs/ez-form.cjs.entry.js +785 -0
- package/dist/cjs/ez-grid.cjs.entry.js +110485 -0
- package/dist/cjs/ez-icon.cjs.entry.js +41 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
- package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
- package/dist/cjs/ez-popover.cjs.entry.js +120 -0
- package/dist/cjs/ez-popup.cjs.entry.js +48 -0
- 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-toast.cjs.entry.js +44 -0
- package/dist/cjs/ez-upload.cjs.entry.js +356 -0
- package/dist/cjs/index-6ac5268e.js +1769 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +52 -1313
- package/dist/cjs/test-du.cjs.entry.js +76 -0
- package/dist/collection/collection-manifest.json +36 -1
- package/dist/collection/components/snk-application/snk-application.js +8 -4
- package/dist/{collection/temp → components}/ApplicationUtils.js +37 -31
- package/dist/components/AssetsUtils.js +22 -0
- package/dist/components/CSSVarsUtils.js +17 -0
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/ez-action-chip.js +44 -0
- package/dist/components/ez-application.js +39 -0
- package/dist/components/ez-button.js +6 -0
- package/dist/components/ez-button2.js +105 -0
- package/dist/components/ez-calendar.js +6 -0
- package/dist/components/ez-calendar2.js +242 -0
- package/dist/components/ez-check.js +6 -0
- package/dist/components/ez-check2.js +94 -0
- package/dist/components/ez-collapsible-box.js +67 -0
- package/dist/components/ez-combo-box.js +6 -0
- package/dist/components/ez-combo-box2.js +311 -0
- package/dist/components/ez-date-input.js +135 -0
- package/dist/components/ez-date-time-input.js +179 -0
- package/dist/components/ez-dialog.js +124 -0
- package/dist/components/ez-form.js +6 -0
- package/dist/components/ez-form2.js +807 -0
- package/dist/components/ez-grid.js +110576 -0
- package/dist/components/ez-icon.js +6 -0
- package/dist/components/ez-icon2.js +56 -0
- package/dist/components/ez-label-chip.js +125 -0
- package/dist/components/ez-list.js +6 -0
- package/dist/components/ez-list2.js +523 -0
- package/dist/components/ez-modal.js +6 -0
- package/dist/components/ez-modal2.js +82 -0
- package/dist/components/ez-number-input.js +115 -0
- package/dist/components/ez-popover.js +145 -0
- package/dist/components/ez-popup.js +67 -0
- package/dist/components/ez-search.js +100 -0
- package/dist/components/ez-tabselector.js +6 -0
- package/dist/components/ez-tabselector2.js +213 -0
- package/dist/components/ez-text-area.js +137 -0
- package/dist/components/ez-text-input.js +6 -0
- package/dist/components/ez-text-input2.js +223 -0
- package/dist/components/ez-time-input.js +153 -0
- package/dist/components/ez-toast.js +64 -0
- package/dist/components/ez-upload.js +382 -0
- package/dist/components/grid-config.js +6 -0
- package/dist/components/grid-config2.js +318 -0
- package/dist/components/select-box.js +6 -0
- package/dist/components/select-box2.js +47 -0
- package/dist/components/snk-application.js +5 -1266
- package/dist/components/test-du.js +101 -0
- package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
- package/dist/esm/AssetsUtils-98074c9c.js +22 -0
- package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/ez-action-chip.entry.js +23 -0
- package/dist/esm/ez-application.entry.js +22 -0
- package/dist/esm/ez-button_4.entry.js +653 -0
- package/dist/esm/ez-calendar.entry.js +219 -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-dialog.entry.js +85 -0
- package/dist/esm/ez-form.entry.js +781 -0
- package/dist/esm/ez-grid.entry.js +110481 -0
- package/dist/esm/ez-icon.entry.js +37 -0
- package/dist/esm/ez-label-chip.entry.js +100 -0
- package/dist/esm/ez-modal_2.entry.js +311 -0
- package/dist/esm/ez-number-input.entry.js +82 -0
- package/dist/esm/ez-popover.entry.js +116 -0
- package/dist/esm/ez-popup.entry.js +44 -0
- 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-toast.entry.js +40 -0
- package/dist/esm/ez-upload.entry.js +352 -0
- package/dist/esm/index-df166135.js +1738 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +6 -1267
- package/dist/esm/test-du.entry.js +72 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/sankhyablocks/p-08e1cded.entry.js +1 -0
- package/dist/sankhyablocks/p-0a77ac95.entry.js +57 -0
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-126c4aaa.entry.js +1 -0
- package/dist/sankhyablocks/p-1421b89a.entry.js +1 -0
- package/dist/sankhyablocks/p-1beadcaf.entry.js +1 -0
- package/dist/sankhyablocks/p-1c423f5d.entry.js +1 -0
- package/dist/sankhyablocks/p-28a0dbf0.entry.js +1 -0
- package/dist/sankhyablocks/p-4763d5c2.js +1 -0
- package/dist/sankhyablocks/p-4c66200a.entry.js +1 -0
- package/dist/sankhyablocks/p-5dc772be.entry.js +1 -0
- package/dist/sankhyablocks/p-5ff3e300.entry.js +1 -0
- package/dist/sankhyablocks/p-7122cec4.entry.js +1 -0
- package/dist/sankhyablocks/p-811b4b9d.js +1 -0
- package/dist/sankhyablocks/p-813fe4f7.js +1 -0
- package/dist/sankhyablocks/p-9b33a005.entry.js +1 -0
- package/dist/sankhyablocks/p-9e22ec87.entry.js +1 -0
- package/dist/sankhyablocks/p-9f7239df.entry.js +1 -0
- package/dist/sankhyablocks/p-9f7e6e48.js +1 -0
- package/dist/sankhyablocks/p-a47e0537.entry.js +1 -0
- package/dist/sankhyablocks/p-a9aba60a.entry.js +1 -0
- package/dist/sankhyablocks/p-afda7940.entry.js +1 -0
- package/dist/sankhyablocks/p-b3a83eaf.entry.js +1 -0
- package/dist/sankhyablocks/p-b96a8d40.entry.js +1 -0
- package/dist/sankhyablocks/p-c61c0e40.entry.js +1 -0
- package/dist/sankhyablocks/p-ca29d028.entry.js +1 -0
- package/dist/sankhyablocks/p-cd17abb1.entry.js +1 -0
- package/dist/sankhyablocks/p-d3a5366d.entry.js +369 -0
- package/dist/sankhyablocks/p-d5703a41.entry.js +1 -0
- package/dist/sankhyablocks/p-e5f77a59.entry.js +1 -0
- package/dist/sankhyablocks/p-e9e94d51.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -1
- package/dist/types/components.d.ts +1 -1
- package/package.json +11 -3
- package/react/components.d.ts +29 -0
- package/react/components.js +29 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/index-20a7d705.js +0 -733
- package/dist/esm/index-8d3572c4.js +0 -707
- package/dist/sankhyablocks/p-5fa264b9.js +0 -1
- package/dist/sankhyablocks/p-f3bdd8c3.entry.js +0 -57
- package/dist/types/temp/ApplicationUtils.d.ts +0 -7
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6ac5268e.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #000);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);font-weight:var(--text-weight--large, 600);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input.text--right{text-align:right}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__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(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}";
|
|
9
|
+
|
|
10
|
+
const EzTextInput = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
14
|
+
/**
|
|
15
|
+
* Deixa o campo disponível ou não para digitação.
|
|
16
|
+
*/
|
|
17
|
+
this.enabled = true;
|
|
18
|
+
/**
|
|
19
|
+
* Permite exibir a mensagem de erro.
|
|
20
|
+
*/
|
|
21
|
+
this.canShowError = true;
|
|
22
|
+
}
|
|
23
|
+
showError() {
|
|
24
|
+
const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
|
|
25
|
+
if (hasError) {
|
|
26
|
+
this._inputElem.classList.add("hasError");
|
|
27
|
+
this._messageBoxElem.classList.add("hasError");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this._inputElem.classList.remove("hasError");
|
|
31
|
+
this._messageBoxElem.classList.remove("hasError");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
prepareMask() {
|
|
35
|
+
if (this.mask) {
|
|
36
|
+
if (this._maskFormatter == undefined) {
|
|
37
|
+
this._maskFormatter = new core.MaskFormatter(this.mask);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this._maskFormatter.mask = this.mask;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
updateInputValue() {
|
|
45
|
+
if (this._inputElem) {
|
|
46
|
+
this._inputElem.value = this.value;
|
|
47
|
+
}
|
|
48
|
+
this.handleChange();
|
|
49
|
+
this.errorMessage = "";
|
|
50
|
+
this.ezChange.emit(this.value);
|
|
51
|
+
this.adjustFloatingLabel();
|
|
52
|
+
}
|
|
53
|
+
adjustFloatingLabel() {
|
|
54
|
+
if (this.label && this._labelElem) {
|
|
55
|
+
if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
|
|
56
|
+
this._inputElem.classList.add("input--with--label");
|
|
57
|
+
}
|
|
58
|
+
const hasValue = this.value && this.value.toString().length > 0;
|
|
59
|
+
const containsFloatedClass = this._labelElem.classList.contains("input__label--floated");
|
|
60
|
+
if (hasValue || this.isFocused()) {
|
|
61
|
+
if (!containsFloatedClass) {
|
|
62
|
+
this._labelElem.classList.add("input__label--floated");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
if (containsFloatedClass) {
|
|
67
|
+
this._labelElem.classList.remove("input__label--floated");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
isFocused() {
|
|
73
|
+
return this._hostElement.shadowRoot.activeElement !== null;
|
|
74
|
+
}
|
|
75
|
+
//---------------------------------------------
|
|
76
|
+
// Public methods
|
|
77
|
+
//---------------------------------------------
|
|
78
|
+
/**
|
|
79
|
+
* Faz o foco no componente de input
|
|
80
|
+
*/
|
|
81
|
+
async setFocus() {
|
|
82
|
+
this._inputElem.focus();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Remove o foco no componente de input
|
|
86
|
+
*/
|
|
87
|
+
async setBlur() {
|
|
88
|
+
this._inputElem.blur();
|
|
89
|
+
}
|
|
90
|
+
//---------------------------------------------
|
|
91
|
+
// Event handlers
|
|
92
|
+
//---------------------------------------------
|
|
93
|
+
handleFocusout() {
|
|
94
|
+
const value = this._inputElem.value;
|
|
95
|
+
if (value && this._maskFormatter) {
|
|
96
|
+
try {
|
|
97
|
+
this._inputElem.value = this._maskFormatter.format(value);
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
this.errorMessage = e.message;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
this.value = this._inputElem.value;
|
|
104
|
+
this.adjustFloatingLabel();
|
|
105
|
+
}
|
|
106
|
+
isValidValue(value) {
|
|
107
|
+
if (this.restrict) {
|
|
108
|
+
return Array.from(value).reduce((valid, c) => valid && this.restrict.indexOf(c) > -1, true);
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
handleChange() {
|
|
113
|
+
if (!this._inputElem) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const value = this._inputElem.value;
|
|
117
|
+
if (this.isValidValue(value)) {
|
|
118
|
+
this._lastValidValue = value;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this._inputElem.value = this._lastValidValue === undefined ? "" : this._lastValidValue;
|
|
122
|
+
}
|
|
123
|
+
this.value = this._inputElem.value;
|
|
124
|
+
}
|
|
125
|
+
handleSlotChange(ev) {
|
|
126
|
+
const slot = ev.target;
|
|
127
|
+
const content = slot.assignedElements()[0];
|
|
128
|
+
if (content) {
|
|
129
|
+
content.style.position = "absolute";
|
|
130
|
+
content.style.display = "flex";
|
|
131
|
+
content.style.alignItems = "center";
|
|
132
|
+
content.style.justifyContent = "center";
|
|
133
|
+
content.style.overflow = "hidden";
|
|
134
|
+
content.style.top = "0px";
|
|
135
|
+
content.style.width = "var(--ez-text-input__icon--width)";
|
|
136
|
+
content.style.height = "var(--ez-text-input--height)";
|
|
137
|
+
if (slot.name == "leftIcon") {
|
|
138
|
+
content.style.left = "0px";
|
|
139
|
+
content.style.borderRadius = "var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)";
|
|
140
|
+
this._inputElem.classList.add("icon--left");
|
|
141
|
+
if (this._labelElem) {
|
|
142
|
+
this._labelElem.classList.add("input__label--left");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else if (slot.name == "rightIcon") {
|
|
146
|
+
content.style.right = "0px";
|
|
147
|
+
content.style.borderRadius = "0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0";
|
|
148
|
+
this._inputElem.classList.add("icon--right");
|
|
149
|
+
if (this._labelElem) {
|
|
150
|
+
this._labelElem.classList.add("input__label--right");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
this.showError();
|
|
155
|
+
}
|
|
156
|
+
doFocus() {
|
|
157
|
+
if (this.label && this._labelElem && !this._labelElem.classList.contains("input__label--floated")) {
|
|
158
|
+
this._labelElem.classList.add("input__label--floated");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//---------------------------------------------
|
|
162
|
+
// Lifecycle web component
|
|
163
|
+
//---------------------------------------------
|
|
164
|
+
componentDidLoad() {
|
|
165
|
+
this.showError();
|
|
166
|
+
this.prepareMask();
|
|
167
|
+
this.adjustFloatingLabel();
|
|
168
|
+
}
|
|
169
|
+
componentWillLoad() {
|
|
170
|
+
this.prepareMask();
|
|
171
|
+
if (this.value) {
|
|
172
|
+
if (this._maskFormatter) {
|
|
173
|
+
try {
|
|
174
|
+
this.value = this._maskFormatter.format(this.value);
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
this.errorMessage = e.message;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (!this.isValidValue(this.value)) {
|
|
181
|
+
this._lastValidValue = "";
|
|
182
|
+
this.value = "";
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
render() {
|
|
187
|
+
return (index.h(index.Host, null, index.h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label ?
|
|
188
|
+
index.h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "input__label" : "input__label input__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
189
|
+
: null, index.h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), index.h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError &&
|
|
190
|
+
index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
191
|
+
}
|
|
192
|
+
get _hostElement() { return index.getElement(this); }
|
|
193
|
+
static get watchers() { return {
|
|
194
|
+
"errorMessage": ["showError"],
|
|
195
|
+
"mask": ["prepareMask"],
|
|
196
|
+
"value": ["updateInputValue"]
|
|
197
|
+
}; }
|
|
198
|
+
};
|
|
199
|
+
EzTextInput.style = ezTextInputCss;
|
|
200
|
+
|
|
201
|
+
exports.ez_text_input = EzTextInput;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6ac5268e.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
const CSSVarsUtils = require('./CSSVarsUtils-75ca9c64.js');
|
|
8
|
+
const AssetsUtils = require('./AssetsUtils-bd004f63.js');
|
|
9
|
+
|
|
10
|
+
const ezTimeInputCss = ":host{display:flex;flex-wrap:wrap;position:relative;width:100%}";
|
|
11
|
+
|
|
12
|
+
const EzTimeInput = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
/**
|
|
16
|
+
* Deixa o campo disponível ou não para digitação.
|
|
17
|
+
*/
|
|
18
|
+
this.enabled = true;
|
|
19
|
+
/**
|
|
20
|
+
* Define se o componente irá ou não considerar os segundos
|
|
21
|
+
*/
|
|
22
|
+
this.showSeconds = false;
|
|
23
|
+
}
|
|
24
|
+
prepareMask() {
|
|
25
|
+
if (this.showSeconds) {
|
|
26
|
+
if (this._maskFormatter == undefined) {
|
|
27
|
+
this._maskFormatter = new core.MaskFormatter("##:##:##");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this._maskFormatter.mask = "##:##:##";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (this._maskFormatter == undefined) {
|
|
35
|
+
this._maskFormatter = new core.MaskFormatter("##:##");
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this._maskFormatter.mask = "##:##";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
onValueChanged() {
|
|
43
|
+
if (this.value === NaN) {
|
|
44
|
+
this.value = undefined;
|
|
45
|
+
this.handleFocusout();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//---------------------------------------------
|
|
49
|
+
// Public methods
|
|
50
|
+
//---------------------------------------------
|
|
51
|
+
/**
|
|
52
|
+
* Faz o foco no componente de input
|
|
53
|
+
*/
|
|
54
|
+
async setFocus() {
|
|
55
|
+
this._inputElem.focus();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Remove o foco no componente de input
|
|
59
|
+
*/
|
|
60
|
+
async setBlur() {
|
|
61
|
+
this._inputElem.blur();
|
|
62
|
+
}
|
|
63
|
+
//---------------------------------------------
|
|
64
|
+
// Event handlers
|
|
65
|
+
//---------------------------------------------
|
|
66
|
+
handleFocusout() {
|
|
67
|
+
this.errorMessage = "";
|
|
68
|
+
this.prepareValue(this.viewValue);
|
|
69
|
+
if (!core.TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
|
|
70
|
+
this.clearField();
|
|
71
|
+
this.errorMessage = "Favor inserir um horário válido.";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
prepareValue(value) {
|
|
75
|
+
try {
|
|
76
|
+
this.viewValue = core.TimeFormatter.prepareValue(value, this.showSeconds);
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
this.clearField();
|
|
80
|
+
this.errorMessage = e.message;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
clearField() {
|
|
84
|
+
this.viewValue = this.value = undefined;
|
|
85
|
+
}
|
|
86
|
+
handleChange() {
|
|
87
|
+
this.viewValue = this._inputElem.value;
|
|
88
|
+
this.value = core.NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
|
|
89
|
+
}
|
|
90
|
+
//---------------------------------------------
|
|
91
|
+
// Lifecycle web component
|
|
92
|
+
//---------------------------------------------
|
|
93
|
+
componentDidLoad() {
|
|
94
|
+
this.onValueChanged();
|
|
95
|
+
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._inputElem);
|
|
96
|
+
}
|
|
97
|
+
componentWillLoad() {
|
|
98
|
+
this.prepareMask();
|
|
99
|
+
if (this.value) {
|
|
100
|
+
this.prepareValue(this.value.toString());
|
|
101
|
+
}
|
|
102
|
+
else if (this.viewValue) {
|
|
103
|
+
this.prepareValue(this.viewValue);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
render() {
|
|
107
|
+
return (index.h(index.Host, null, index.h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage }, index.h("ez-icon", { slot: "leftIcon", href: AssetsUtils.getSpritePath("timer-outline") }))));
|
|
108
|
+
}
|
|
109
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
110
|
+
get _elem() { return index.getElement(this); }
|
|
111
|
+
static get watchers() { return {
|
|
112
|
+
"showSeconds": ["prepareMask"],
|
|
113
|
+
"value": ["onValueChanged"]
|
|
114
|
+
}; }
|
|
115
|
+
};
|
|
116
|
+
EzTimeInput.style = ezTimeInputCss;
|
|
117
|
+
|
|
118
|
+
exports.ez_time_input = EzTimeInput;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6ac5268e.js');
|
|
6
|
+
|
|
7
|
+
const ezToastCss = ":host{--ez-toast__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--ez-toast__container-z-index:var(--more-visible, 2);--ez-toast__container--background-color:var(--color--secondary, #383c45);--ez-toast__icon--padding-left:var(--space--small, 6px)}.toast__container{position:fixed;display:flex;bottom:100px;z-index:var(--ez-toast__container-z-index);left:100px;width:280px;box-sizing:border-box;background-color:var(--ez-toast__container--background-color);border-radius:6px;align-items:center;padding:12px;visibility:hidden}.message__container{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent;color:#FFFFFF;font-size:14px;width:90%;overflow:hidden;word-break:break-all;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:4;display:-webkit-box;text-overflow:ellipsis}.message__conteiner--icon{padding-left:var(--ez-toast__icon--padding-left);width:80%}.btn-close{margin-top:3px;display:flex;justify-content:flex-end;align-self:flex-start;padding:0;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:#FFFFFF;width:12px;height:12px;-webkit-mask-image:var(--ez-toast__btn__close__image);mask-image:var(--ez-toast__btn__close__image)}.toast__container--oppened{animation:fadein 0.5s, fadeout 0.5s 3s;visibility:visible}@-webkit-keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@-webkit-keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}";
|
|
8
|
+
|
|
9
|
+
const EzToast = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
/**
|
|
13
|
+
* Controla o tempo de exibição do componente em milissegundos.
|
|
14
|
+
*/
|
|
15
|
+
this.fadeTime = 5000;
|
|
16
|
+
/**
|
|
17
|
+
* Adiciona ícone de check no componente.
|
|
18
|
+
*/
|
|
19
|
+
this.useIcon = false;
|
|
20
|
+
/**
|
|
21
|
+
* Controla o uso do icone de fechar o toast.
|
|
22
|
+
*/
|
|
23
|
+
this.canClose = true;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Exibe o componente na tela.
|
|
27
|
+
*/
|
|
28
|
+
async show() {
|
|
29
|
+
this.container.classList.add("toast__container--oppened");
|
|
30
|
+
this.container.style.animation = `fadein 0.5s, fadeout 0.5s ${this.fadeTime / 1000}s`;
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
this.container.classList.remove("toast__container--oppened");
|
|
33
|
+
this.container.style.animation = `none`;
|
|
34
|
+
}, this.fadeTime + 400);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
return (index.h("div", { ref: (el) => this.container = el, class: "toast__container" }, this.useIcon &&
|
|
38
|
+
index.h("slot", { name: "icon" }), index.h("div", { class: this.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this.message, innerHTML: this.message }), this.canClose &&
|
|
39
|
+
index.h("button", { class: "btn-close", onClick: () => { this.container.classList.remove("toast__container--oppened"); this.container.style.animation = `none`; } })));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
EzToast.style = ezToastCss;
|
|
43
|
+
|
|
44
|
+
exports.ez_toast = EzToast;
|