@sankhyalabs/ezui 1.1.8 → 1.1.9
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/README.md +72 -72
- package/dist/cjs/{DataUnit-28b290cb.js → DataUnit-9a4a35ca.js} +415 -371
- package/dist/cjs/ez-action-chip.cjs.entry.js +41 -41
- package/dist/cjs/ez-button_14.cjs.entry.js +1911 -1911
- package/dist/cjs/ez-label-chip.cjs.entry.js +120 -120
- package/dist/cjs/ez-modal.cjs.entry.js +104 -104
- package/dist/cjs/ez-number-input.cjs.entry.js +236 -236
- package/dist/cjs/ez-time-input.cjs.entry.js +168 -168
- package/dist/cjs/form-metadata.cjs.entry.js +65 -65
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -82
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -109
- package/dist/collection/components/ez-button/ez-button.css +94 -94
- package/dist/collection/components/ez-button/ez-button.js +125 -125
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -210
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -215
- package/dist/collection/components/ez-check/ez-check.css +265 -265
- package/dist/collection/components/ez-check/ez-check.js +168 -168
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +67 -67
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -108
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -167
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -363
- package/dist/collection/components/ez-date-input/ez-date-input.css +38 -38
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -172
- package/dist/collection/components/ez-form/ez-form.css +19 -19
- package/dist/collection/components/ez-form/ez-form.js +368 -368
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +251 -207
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -16
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +23 -23
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -173
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -71
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -40
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -27
- package/dist/collection/components/ez-icon/ez-icon.css +36 -36
- package/dist/collection/components/ez-icon/ez-icon.js +56 -56
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -117
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -276
- package/dist/collection/components/ez-modal/ez-modal.css +86 -86
- package/dist/collection/components/ez-modal/ez-modal.js +224 -224
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -144
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -465
- package/dist/collection/components/ez-popover/ez-popover.css +38 -38
- package/dist/collection/components/ez-popover/ez-popover.js +323 -323
- package/dist/collection/components/ez-search/ez-search.css +295 -295
- package/dist/collection/components/ez-search/ez-search.js +527 -527
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +125 -125
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +283 -283
- package/dist/collection/components/ez-text-area/ez-text-area.css +139 -139
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -267
- package/dist/collection/components/ez-text-input/ez-text-input.css +169 -169
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -395
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -155
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -326
- package/dist/collection/index.js +1 -1
- package/dist/collection/servidor.js +100 -100
- package/dist/collection/utils/FloatingManager.js +15 -15
- package/dist/collection/utils/utils.js +6 -6
- package/dist/custom-elements/index.js +3125 -3081
- package/dist/esm/{DataUnit-69e518fa.js → DataUnit-d5d4c9a3.js} +415 -371
- package/dist/esm/ez-action-chip.entry.js +41 -41
- package/dist/esm/ez-button_14.entry.js +1911 -1911
- package/dist/esm/ez-label-chip.entry.js +120 -120
- package/dist/esm/ez-modal.entry.js +104 -104
- package/dist/esm/ez-number-input.entry.js +236 -236
- package/dist/esm/ez-time-input.entry.js +168 -168
- package/dist/esm/form-metadata.entry.js +65 -65
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-b0974f4f.entry.js → p-0fcdfb51.entry.js} +1 -1
- package/dist/ezui/p-dac7a6c2.js +1 -0
- package/dist/ezui/{p-db11c600.entry.js → p-dbef7060.entry.js} +1 -1
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +26 -31
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +60 -55
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -17
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -32
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/package.json +114 -114
- package/dist/ezui/p-10ef58b3.js +0 -1
- package/react/components.d.ts +0 -22
- package/react/components.js +0 -25
- package/react/components.js.map +0 -1
- package/react/react-component-lib/createComponent.d.ts +0 -10
- package/react/react-component-lib/createComponent.js +0 -59
- package/react/react-component-lib/createComponent.js.map +0 -1
- package/react/react-component-lib/createOverlayComponent.d.ts +0 -20
- package/react/react-component-lib/createOverlayComponent.js +0 -89
- package/react/react-component-lib/createOverlayComponent.js.map +0 -1
- package/react/react-component-lib/index.d.ts +0 -2
- package/react/react-component-lib/index.js +0 -3
- package/react/react-component-lib/index.js.map +0 -1
- package/react/react-component-lib/interfaces.d.ts +0 -29
- package/react/react-component-lib/interfaces.js +0 -1
- package/react/react-component-lib/interfaces.js.map +0 -1
- package/react/react-component-lib/utils/attachProps.d.ts +0 -12
- package/react/react-component-lib/utils/attachProps.js +0 -96
- package/react/react-component-lib/utils/attachProps.js.map +0 -1
- package/react/react-component-lib/utils/case.d.ts +0 -2
- package/react/react-component-lib/utils/case.js +0 -7
- package/react/react-component-lib/utils/case.js.map +0 -1
- package/react/react-component-lib/utils/dev.d.ts +0 -2
- package/react/react-component-lib/utils/dev.js +0 -13
- package/react/react-component-lib/utils/dev.js.map +0 -1
- package/react/react-component-lib/utils/index.d.ts +0 -7
- package/react/react-component-lib/utils/index.js +0 -21
- package/react/react-component-lib/utils/index.js.map +0 -1
|
@@ -7,174 +7,174 @@ const RequestMetadata = require('./RequestMetadata-2cd01e8a.js');
|
|
|
7
7
|
|
|
8
8
|
const ezTimeInputCss = ":host{--eztime--height:42px;--eztime--width:100%;--eztime__icon--width:48px;--eztime--border-radius:var(--border--radius-medium, 12px);--eztime--font-size:var(--text--medium, 14px);--eztime--font-family:var(--font-pattern, Arial);--eztime--font-weight:var(--text-weight--large, 500);--eztime--space--medium:var(--space--medium, 6px);--eztime__input--background-color:var(--background--medium, #e0e0e0);--eztime__input--border:var(--border--medium, 2px solid);--eztime__input--border-color:var(--eztime__input--background-color);--eztime__input--focus--border-color:var(--color--primary, #008561);--eztime__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--eztime__input--disabled--color:var(--text--disable, #AFB6C0);--eztime__input--error--border-color:#CC2936;--eztime__label--color:var(--title--primary, #919191);--eztime__message_box--font-size:var(--text--small, 12px);--eztime__message_box--info--color:var(--color--success, #22085d);--eztime__message_box--error--color:var(--color--error, #FF0000);display:flex;flex-wrap:wrap;position:relative;width:var(--eztime--width)}.invisible{visibility:hidden}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);font-weight:var(--text-weight--large, 600);height:var(--eztime--height);border-radius:var(--eztime--border-radius);font-family:var(--eztime--font-family);font-size:var(--eztime--font-size);border:var(--eztime__input--border);border-color:var(--eztime__input--border-color);background-color:var(--eztime__input--background-color)}input:disabled{background-color:var(--eztime__input--disabled--background-color);color:var(--eztime__input--disabled--color)}input:focus{outline:none;border-color:var(--eztime__input--focus--border-color)}input.icon--left{padding-left:var(--eztime__icon--width)}input.icon--right{padding-right:var(--eztime__icon--width)}input::placeholder{color:var(--eztime__placeholder--color);font-weight:var(--eztime__placeholder--font-weight)}input:disabled::placeholder{color:var(--eztime__placeholder--disabled--color)}input.hasError{color:inherit;border-color:var(--eztime__input--error--border-color)}input.text--right{text-align:right}.message-box{min-height:16px;min-width:100%;margin-top:2px;line-height:12px;font-family:var(--eztime--font-family);font-size:var(--eztime__message_box--font-size);color:var(--eztime__message_box--info--color)}.hasError{color:var(--eztime__message_box--error--color)}.input__label{font-size:var(--eztime--font-size);font-weight:var(--eztime--font-weight);position:absolute;color:var(it__label--color);top:var(--eztime--space--medium);font-family:var(--eztime--font-family);-webkit-transition:font-size .3s, top .3s;transition:font-size .3s, top .3s;z-index:var(--visible);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;left:var(--eztime__icon--width);width:calc(100% - 10px - var(--eztime__icon--width))}.input__label--floated{font-family:var(--eztime--font-family);font-size:var(--text--extra-small);top:var(--space--small);color:var(--text--primary)}.input__label--left{left:var(--eztime__icon--width);width:calc(100% - 10px - var(--eztime__icon--width))}.input__label--right{padding-right:var(--eztime__icon--width);width:calc(100% - 10px - var(--eztime__icon--width))}.input--with--label{padding-bottom:0}";
|
|
9
9
|
|
|
10
|
-
const EzTimeInput = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
/**
|
|
14
|
-
* Deixa o campo disponível ou não para digitação.
|
|
15
|
-
*/
|
|
16
|
-
this.enabled = true;
|
|
17
|
-
/**
|
|
18
|
-
* Define se o componente irá ou não considerar os segundos
|
|
19
|
-
*/
|
|
20
|
-
this.showSeconds = false;
|
|
21
|
-
}
|
|
22
|
-
showError() {
|
|
23
|
-
const hasError = typeof this.errormessage === 'string' && this.errormessage !== '';
|
|
24
|
-
if (hasError) {
|
|
25
|
-
this._inputElem.classList.add('hasError');
|
|
26
|
-
this._messageBoxElem.classList.add('hasError');
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
this._inputElem.classList.remove('hasError');
|
|
30
|
-
this._messageBoxElem.classList.remove('hasError');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
prepareMask() {
|
|
34
|
-
if (this.showSeconds) {
|
|
35
|
-
if (this._maskFormatter == undefined) {
|
|
36
|
-
this._maskFormatter = new RequestMetadata.MaskFormatter("##:##:##");
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this._maskFormatter.mask = "##:##:##";
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
if (this._maskFormatter == undefined) {
|
|
44
|
-
this._maskFormatter = new RequestMetadata.MaskFormatter("##:##");
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
this._maskFormatter.mask = "##:##";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
adjustFloatingLabel() {
|
|
52
|
-
if (this.label) {
|
|
53
|
-
if (!this._inputElem.classList.contains("input--with--label")) {
|
|
54
|
-
this._inputElem.classList.add("input--with--label");
|
|
55
|
-
}
|
|
56
|
-
if (this.viewValue && this.viewValue.toString().length > 0) {
|
|
57
|
-
if (!this._labelElem.classList.contains("input__label--floated")) {
|
|
58
|
-
this._labelElem.classList.add("input__label--floated");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
if (this._labelElem.classList.contains("input__label--floated")) {
|
|
63
|
-
this._labelElem.classList.remove("input__label--floated");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
onValueChanged() {
|
|
69
|
-
if (this.value === NaN) {
|
|
70
|
-
this.value = undefined;
|
|
71
|
-
this.handleFocusout();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
//---------------------------------------------
|
|
75
|
-
// Public methods
|
|
76
|
-
//---------------------------------------------
|
|
77
|
-
/**
|
|
78
|
-
* Faz o foco no componente de input
|
|
79
|
-
*/
|
|
80
|
-
async setFocus() {
|
|
81
|
-
this._inputElem.focus();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Remove o foco no componente de input
|
|
85
|
-
*/
|
|
86
|
-
async setBlur() {
|
|
87
|
-
this._inputElem.blur();
|
|
88
|
-
}
|
|
89
|
-
//---------------------------------------------
|
|
90
|
-
// Test Methods
|
|
91
|
-
//---------------------------------------------
|
|
92
|
-
setInputElemnt(input) {
|
|
93
|
-
this._iconElement = input;
|
|
94
|
-
}
|
|
95
|
-
//---------------------------------------------
|
|
96
|
-
// Event handlers
|
|
97
|
-
//---------------------------------------------
|
|
98
|
-
handleFocusout() {
|
|
99
|
-
this.errormessage = "";
|
|
100
|
-
this.prepareValue(this.viewValue);
|
|
101
|
-
if (!RequestMetadata.TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
|
|
102
|
-
this.clearField();
|
|
103
|
-
this.errormessage = "Favor inserir um horário válido.";
|
|
104
|
-
}
|
|
105
|
-
this.adjustFloatingLabel();
|
|
106
|
-
}
|
|
107
|
-
prepareValue(value) {
|
|
108
|
-
try {
|
|
109
|
-
this.viewValue = RequestMetadata.TimeFormatter.prepareValue(value, this.showSeconds);
|
|
110
|
-
}
|
|
111
|
-
catch (e) {
|
|
112
|
-
this.clearField();
|
|
113
|
-
this.errormessage = e.message;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
clearField() {
|
|
117
|
-
this.viewValue = this.value = undefined;
|
|
118
|
-
}
|
|
119
|
-
handleChange() {
|
|
120
|
-
this.viewValue = this._inputElem.value;
|
|
121
|
-
this.value = RequestMetadata.NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
|
|
122
|
-
}
|
|
123
|
-
adjustIconStyle() {
|
|
124
|
-
if (this._iconElement) {
|
|
125
|
-
this._iconElement.style.position = "absolute";
|
|
126
|
-
this._iconElement.style.display = "flex";
|
|
127
|
-
this._iconElement.style.alignItems = "center";
|
|
128
|
-
this._iconElement.style.justifyContent = "center";
|
|
129
|
-
this._iconElement.style.overflow = "hidden";
|
|
130
|
-
this._iconElement.style.top = "0px";
|
|
131
|
-
this._iconElement.style.width = "var(--eztime__icon--width)";
|
|
132
|
-
this._iconElement.style.height = "var(--eztime--height)";
|
|
133
|
-
this._iconElement.style.left = "0px";
|
|
134
|
-
this._iconElement.style.borderRadius = "var(--eztime--border-radius) 0 0 var(--eztime--border-radius)";
|
|
135
|
-
this._inputElem.classList.add('icon--left');
|
|
136
|
-
if (this._labelElem) {
|
|
137
|
-
this._labelElem.classList.add("input__label--left");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
this.showError();
|
|
141
|
-
}
|
|
142
|
-
doFocus() {
|
|
143
|
-
if (this.label && this._labelElem) {
|
|
144
|
-
if (!this._labelElem.classList.contains("input__label--floated")) {
|
|
145
|
-
this._labelElem.classList.add("input__label--floated");
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
//---------------------------------------------
|
|
150
|
-
// Lifecycle web component
|
|
151
|
-
//---------------------------------------------
|
|
152
|
-
componentDidLoad() {
|
|
153
|
-
this.onValueChanged();
|
|
154
|
-
this.adjustIconStyle();
|
|
155
|
-
this.adjustFloatingLabel();
|
|
156
|
-
this.showError();
|
|
157
|
-
}
|
|
158
|
-
componentWillLoad() {
|
|
159
|
-
this.prepareMask();
|
|
160
|
-
if (this.value) {
|
|
161
|
-
this.prepareValue(this.value.toString());
|
|
162
|
-
}
|
|
163
|
-
else if (this.viewValue) {
|
|
164
|
-
this.prepareValue(this.viewValue);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
render() {
|
|
168
|
-
return (index.h(index.Host, null, index.h("ez-icon", { ref: (el) => this._iconElement = el, href: "/themes/default/images/icons/actions-sprite.svg#timer-outline" }), this.label ?
|
|
169
|
-
index.h("label", { onClick: () => this._inputElem.focus(), class: this.value ? "input__label input__label--floated" : "input__label", ref: (el) => this._labelElem = el, title: this.label }, this.label)
|
|
170
|
-
: null, index.h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.viewValue, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el }, this.errormessage)));
|
|
171
|
-
}
|
|
172
|
-
static get watchers() { return {
|
|
173
|
-
"errormessage": ["showError"],
|
|
174
|
-
"showSeconds": ["prepareMask"],
|
|
175
|
-
"value": ["onValueChanged"]
|
|
176
|
-
}; }
|
|
177
|
-
};
|
|
10
|
+
const EzTimeInput = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
/**
|
|
14
|
+
* Deixa o campo disponível ou não para digitação.
|
|
15
|
+
*/
|
|
16
|
+
this.enabled = true;
|
|
17
|
+
/**
|
|
18
|
+
* Define se o componente irá ou não considerar os segundos
|
|
19
|
+
*/
|
|
20
|
+
this.showSeconds = false;
|
|
21
|
+
}
|
|
22
|
+
showError() {
|
|
23
|
+
const hasError = typeof this.errormessage === 'string' && this.errormessage !== '';
|
|
24
|
+
if (hasError) {
|
|
25
|
+
this._inputElem.classList.add('hasError');
|
|
26
|
+
this._messageBoxElem.classList.add('hasError');
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
this._inputElem.classList.remove('hasError');
|
|
30
|
+
this._messageBoxElem.classList.remove('hasError');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
prepareMask() {
|
|
34
|
+
if (this.showSeconds) {
|
|
35
|
+
if (this._maskFormatter == undefined) {
|
|
36
|
+
this._maskFormatter = new RequestMetadata.MaskFormatter("##:##:##");
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this._maskFormatter.mask = "##:##:##";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (this._maskFormatter == undefined) {
|
|
44
|
+
this._maskFormatter = new RequestMetadata.MaskFormatter("##:##");
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this._maskFormatter.mask = "##:##";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
adjustFloatingLabel() {
|
|
52
|
+
if (this.label) {
|
|
53
|
+
if (!this._inputElem.classList.contains("input--with--label")) {
|
|
54
|
+
this._inputElem.classList.add("input--with--label");
|
|
55
|
+
}
|
|
56
|
+
if (this.viewValue && this.viewValue.toString().length > 0) {
|
|
57
|
+
if (!this._labelElem.classList.contains("input__label--floated")) {
|
|
58
|
+
this._labelElem.classList.add("input__label--floated");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (this._labelElem.classList.contains("input__label--floated")) {
|
|
63
|
+
this._labelElem.classList.remove("input__label--floated");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
onValueChanged() {
|
|
69
|
+
if (this.value === NaN) {
|
|
70
|
+
this.value = undefined;
|
|
71
|
+
this.handleFocusout();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//---------------------------------------------
|
|
75
|
+
// Public methods
|
|
76
|
+
//---------------------------------------------
|
|
77
|
+
/**
|
|
78
|
+
* Faz o foco no componente de input
|
|
79
|
+
*/
|
|
80
|
+
async setFocus() {
|
|
81
|
+
this._inputElem.focus();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Remove o foco no componente de input
|
|
85
|
+
*/
|
|
86
|
+
async setBlur() {
|
|
87
|
+
this._inputElem.blur();
|
|
88
|
+
}
|
|
89
|
+
//---------------------------------------------
|
|
90
|
+
// Test Methods
|
|
91
|
+
//---------------------------------------------
|
|
92
|
+
setInputElemnt(input) {
|
|
93
|
+
this._iconElement = input;
|
|
94
|
+
}
|
|
95
|
+
//---------------------------------------------
|
|
96
|
+
// Event handlers
|
|
97
|
+
//---------------------------------------------
|
|
98
|
+
handleFocusout() {
|
|
99
|
+
this.errormessage = "";
|
|
100
|
+
this.prepareValue(this.viewValue);
|
|
101
|
+
if (!RequestMetadata.TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
|
|
102
|
+
this.clearField();
|
|
103
|
+
this.errormessage = "Favor inserir um horário válido.";
|
|
104
|
+
}
|
|
105
|
+
this.adjustFloatingLabel();
|
|
106
|
+
}
|
|
107
|
+
prepareValue(value) {
|
|
108
|
+
try {
|
|
109
|
+
this.viewValue = RequestMetadata.TimeFormatter.prepareValue(value, this.showSeconds);
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
this.clearField();
|
|
113
|
+
this.errormessage = e.message;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
clearField() {
|
|
117
|
+
this.viewValue = this.value = undefined;
|
|
118
|
+
}
|
|
119
|
+
handleChange() {
|
|
120
|
+
this.viewValue = this._inputElem.value;
|
|
121
|
+
this.value = RequestMetadata.NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
|
|
122
|
+
}
|
|
123
|
+
adjustIconStyle() {
|
|
124
|
+
if (this._iconElement) {
|
|
125
|
+
this._iconElement.style.position = "absolute";
|
|
126
|
+
this._iconElement.style.display = "flex";
|
|
127
|
+
this._iconElement.style.alignItems = "center";
|
|
128
|
+
this._iconElement.style.justifyContent = "center";
|
|
129
|
+
this._iconElement.style.overflow = "hidden";
|
|
130
|
+
this._iconElement.style.top = "0px";
|
|
131
|
+
this._iconElement.style.width = "var(--eztime__icon--width)";
|
|
132
|
+
this._iconElement.style.height = "var(--eztime--height)";
|
|
133
|
+
this._iconElement.style.left = "0px";
|
|
134
|
+
this._iconElement.style.borderRadius = "var(--eztime--border-radius) 0 0 var(--eztime--border-radius)";
|
|
135
|
+
this._inputElem.classList.add('icon--left');
|
|
136
|
+
if (this._labelElem) {
|
|
137
|
+
this._labelElem.classList.add("input__label--left");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
this.showError();
|
|
141
|
+
}
|
|
142
|
+
doFocus() {
|
|
143
|
+
if (this.label && this._labelElem) {
|
|
144
|
+
if (!this._labelElem.classList.contains("input__label--floated")) {
|
|
145
|
+
this._labelElem.classList.add("input__label--floated");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//---------------------------------------------
|
|
150
|
+
// Lifecycle web component
|
|
151
|
+
//---------------------------------------------
|
|
152
|
+
componentDidLoad() {
|
|
153
|
+
this.onValueChanged();
|
|
154
|
+
this.adjustIconStyle();
|
|
155
|
+
this.adjustFloatingLabel();
|
|
156
|
+
this.showError();
|
|
157
|
+
}
|
|
158
|
+
componentWillLoad() {
|
|
159
|
+
this.prepareMask();
|
|
160
|
+
if (this.value) {
|
|
161
|
+
this.prepareValue(this.value.toString());
|
|
162
|
+
}
|
|
163
|
+
else if (this.viewValue) {
|
|
164
|
+
this.prepareValue(this.viewValue);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
render() {
|
|
168
|
+
return (index.h(index.Host, null, index.h("ez-icon", { ref: (el) => this._iconElement = el, href: "/themes/default/images/icons/actions-sprite.svg#timer-outline" }), this.label ?
|
|
169
|
+
index.h("label", { onClick: () => this._inputElem.focus(), class: this.value ? "input__label input__label--floated" : "input__label", ref: (el) => this._labelElem = el, title: this.label }, this.label)
|
|
170
|
+
: null, index.h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.viewValue, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el }, this.errormessage)));
|
|
171
|
+
}
|
|
172
|
+
static get watchers() { return {
|
|
173
|
+
"errormessage": ["showError"],
|
|
174
|
+
"showSeconds": ["prepareMask"],
|
|
175
|
+
"value": ["onValueChanged"]
|
|
176
|
+
}; }
|
|
177
|
+
};
|
|
178
178
|
EzTimeInput.style = ezTimeInputCss;
|
|
179
179
|
|
|
180
180
|
exports.ez_time_input = EzTimeInput;
|
|
@@ -3,72 +3,72 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-9403fe8f.js');
|
|
6
|
-
const DataUnit = require('./DataUnit-
|
|
6
|
+
const DataUnit = require('./DataUnit-9a4a35ca.js');
|
|
7
7
|
|
|
8
|
-
const FormMetadata = class {
|
|
9
|
-
constructor(hostRef) {
|
|
10
|
-
index.registerInstance(this, hostRef);
|
|
11
|
-
}
|
|
12
|
-
buildField(element) {
|
|
13
|
-
const label = element.textContent;
|
|
14
|
-
let name = element.getAttribute("name") || label;
|
|
15
|
-
let userInterface = element.getAttribute("ui") || "SHORTTEXT";
|
|
16
|
-
const defaultValue = element.getAttribute("defaultValue");
|
|
17
|
-
const required = element.getAttribute("required") === "true";
|
|
18
|
-
const readOnly = element.getAttribute("readonly") === "true";
|
|
19
|
-
return { name, userInterface, label, defaultValue, required, readOnly };
|
|
20
|
-
}
|
|
21
|
-
buildFieldSet(element) {
|
|
22
|
-
const label = element.getAttribute("label");
|
|
23
|
-
const fields = Array.from(element.getElementsByTagName('FIELD')).map(f => this.buildField(f));
|
|
24
|
-
return { label, fields };
|
|
25
|
-
}
|
|
26
|
-
fromElements(elements, label, name, dataUnit, many, autoLoad) {
|
|
27
|
-
const form = {
|
|
28
|
-
name: name || label,
|
|
29
|
-
label,
|
|
30
|
-
autoLoad
|
|
31
|
-
};
|
|
32
|
-
if (dataUnit) {
|
|
33
|
-
form.dataUnit = new DataUnit.DataUnit(dataUnit, many ? 'N' : '1');
|
|
34
|
-
}
|
|
35
|
-
Array.from(elements).forEach(child => {
|
|
36
|
-
const tagName = child.tagName.toUpperCase();
|
|
37
|
-
switch (tagName) {
|
|
38
|
-
case 'FIELD':
|
|
39
|
-
if (!form.items) {
|
|
40
|
-
form.items = [];
|
|
41
|
-
}
|
|
42
|
-
form.items.push(this.buildField(child));
|
|
43
|
-
break;
|
|
44
|
-
case 'FIELD-SET':
|
|
45
|
-
if (!form.items) {
|
|
46
|
-
form.items = [];
|
|
47
|
-
}
|
|
48
|
-
form.items.push(this.buildFieldSet(child));
|
|
49
|
-
break;
|
|
50
|
-
case 'SUB-FORM':
|
|
51
|
-
if (!form.subForms) {
|
|
52
|
-
form.subForms = [];
|
|
53
|
-
}
|
|
54
|
-
const label = child.getAttribute("label") || "Subform " + (form.subForms.length + 1);
|
|
55
|
-
const name = child.getAttribute("name") || label;
|
|
56
|
-
form.subForms.push(this.fromElements(child.children, label, name, child.getAttribute("dataunit"), child.hasAttribute("many"), child.getAttribute("autoload") === "true"));
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
return form;
|
|
61
|
-
}
|
|
62
|
-
componentWillLoad() {
|
|
63
|
-
if (!this.dataunit) {
|
|
64
|
-
this.dataunit = "dataunit_" + (this.name || this.label || new Date().getTime());
|
|
65
|
-
}
|
|
66
|
-
this.metadata = this.fromElements(this._host.children, this.label, this.name, this.dataunit, this.many, this.autoload);
|
|
67
|
-
}
|
|
68
|
-
render() {
|
|
69
|
-
return index.h(index.Host, null);
|
|
70
|
-
}
|
|
71
|
-
get _host() { return index.getElement(this); }
|
|
8
|
+
const FormMetadata = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
buildField(element) {
|
|
13
|
+
const label = element.textContent;
|
|
14
|
+
let name = element.getAttribute("name") || label;
|
|
15
|
+
let userInterface = element.getAttribute("ui") || "SHORTTEXT";
|
|
16
|
+
const defaultValue = element.getAttribute("defaultValue");
|
|
17
|
+
const required = element.getAttribute("required") === "true";
|
|
18
|
+
const readOnly = element.getAttribute("readonly") === "true";
|
|
19
|
+
return { name, userInterface, label, defaultValue, required, readOnly };
|
|
20
|
+
}
|
|
21
|
+
buildFieldSet(element) {
|
|
22
|
+
const label = element.getAttribute("label");
|
|
23
|
+
const fields = Array.from(element.getElementsByTagName('FIELD')).map(f => this.buildField(f));
|
|
24
|
+
return { label, fields };
|
|
25
|
+
}
|
|
26
|
+
fromElements(elements, label, name, dataUnit, many, autoLoad) {
|
|
27
|
+
const form = {
|
|
28
|
+
name: name || label,
|
|
29
|
+
label,
|
|
30
|
+
autoLoad
|
|
31
|
+
};
|
|
32
|
+
if (dataUnit) {
|
|
33
|
+
form.dataUnit = new DataUnit.DataUnit(dataUnit, many ? 'N' : '1');
|
|
34
|
+
}
|
|
35
|
+
Array.from(elements).forEach(child => {
|
|
36
|
+
const tagName = child.tagName.toUpperCase();
|
|
37
|
+
switch (tagName) {
|
|
38
|
+
case 'FIELD':
|
|
39
|
+
if (!form.items) {
|
|
40
|
+
form.items = [];
|
|
41
|
+
}
|
|
42
|
+
form.items.push(this.buildField(child));
|
|
43
|
+
break;
|
|
44
|
+
case 'FIELD-SET':
|
|
45
|
+
if (!form.items) {
|
|
46
|
+
form.items = [];
|
|
47
|
+
}
|
|
48
|
+
form.items.push(this.buildFieldSet(child));
|
|
49
|
+
break;
|
|
50
|
+
case 'SUB-FORM':
|
|
51
|
+
if (!form.subForms) {
|
|
52
|
+
form.subForms = [];
|
|
53
|
+
}
|
|
54
|
+
const label = child.getAttribute("label") || "Subform " + (form.subForms.length + 1);
|
|
55
|
+
const name = child.getAttribute("name") || label;
|
|
56
|
+
form.subForms.push(this.fromElements(child.children, label, name, child.getAttribute("dataunit"), child.hasAttribute("many"), child.getAttribute("autoload") === "true"));
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return form;
|
|
61
|
+
}
|
|
62
|
+
componentWillLoad() {
|
|
63
|
+
if (!this.dataunit) {
|
|
64
|
+
this.dataunit = "dataunit_" + (this.name || this.label || new Date().getTime());
|
|
65
|
+
}
|
|
66
|
+
this.metadata = this.fromElements(this._host.children, this.label, this.name, this.dataunit, this.many, this.autoload);
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return index.h(index.Host, null);
|
|
70
|
+
}
|
|
71
|
+
get _host() { return index.getElement(this); }
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
exports.form_metadata = FormMetadata;
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
/* dimensions */
|
|
3
|
-
--ac--height: 36px;
|
|
4
|
-
--ac--width: 100%;
|
|
5
|
-
--ac__icon--width: 48px;
|
|
6
|
-
/* general */
|
|
7
|
-
--ac--border-radius: var(--border--radius-large, 24px);
|
|
8
|
-
--ac--font-size: var(--text--medium, 14px);
|
|
9
|
-
--ac--font-family: var(--font-pattern, Arial);
|
|
10
|
-
--ac--font-weight: var(--text-weight--large, 500);
|
|
11
|
-
--ac--space--medium: var(--space--medium, 6px);
|
|
12
|
-
--ac__border: 1px solid;
|
|
13
|
-
--ac__border-color-strokes: var(--color--strokes, #DCE0E8);
|
|
14
|
-
/* label */
|
|
15
|
-
--ac__label--title--primary: var(--title--primary, #919191);
|
|
16
|
-
--ac__label--color-primary: var(--color--primary, #008561);
|
|
17
|
-
--ac__label-color--disable-secondary: var(--color--disable-secondary, #F2F5F8);
|
|
18
|
-
--ac__label--background-color: #0085610F;
|
|
19
|
-
--ac__label__default--background-color--hover: var(--color--primary-200, #f2faf8);
|
|
20
|
-
--ac__label__default--border-color--hover: var(--color--primary-600, #007a5a);
|
|
21
|
-
--ac__label--text--disabled: var(--text--disable, #AFB6C0);
|
|
22
|
-
--ac__label--text--primary: var(--text--primary, #626e82);
|
|
23
|
-
/* message box */
|
|
24
|
-
--ac__message_box--font-size: var(--text--small, 12px);
|
|
25
|
-
--ac__message_box--info--color: var(--color--success, #22085d);
|
|
26
|
-
--ac__message_box--error--color: var(--color--error, #FF0000);
|
|
27
|
-
/***************
|
|
28
|
-
host style
|
|
29
|
-
***************/
|
|
30
|
-
/*public*/
|
|
31
|
-
width: 100%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.padding-right--small {
|
|
35
|
-
padding-right: var(--ac--space--medium);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.padding-left--small {
|
|
39
|
-
padding-left: var(--ac--space--medium);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.label__container {
|
|
43
|
-
/*private*/
|
|
44
|
-
width: fit-content;
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-wrap: wrap;
|
|
47
|
-
position: relative;
|
|
48
|
-
align-items: center;
|
|
49
|
-
align-self: center;
|
|
50
|
-
color: var(--ac__label--title--primary);
|
|
51
|
-
fill: var(--ac__label--title--primary);
|
|
52
|
-
border: var(--ac__border);
|
|
53
|
-
border-radius: var(--ac--border-radius);
|
|
54
|
-
border-color: var( --ac__border-color-strokes);
|
|
55
|
-
padding-right: var(--space--large, 12px);
|
|
56
|
-
padding-left: var(--space--large, 12px);
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.label__container:hover {
|
|
61
|
-
border-color: var(--ac__label__default--border-color--hover);
|
|
62
|
-
background-color: var(--ac__label__default--background-color--hover);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.label__container--active:hover {
|
|
66
|
-
border-color: var(--ac__label__active--background-color--hover);
|
|
67
|
-
background-color: var(--ac__label__active--background-color--hover);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
label {
|
|
71
|
-
/*private*/
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
width: calc(100% - var(--ac__icon--width));
|
|
75
|
-
width: fit-content;
|
|
76
|
-
font-weight: var(--text-weight--large, 600);
|
|
77
|
-
cursor: pointer;
|
|
78
|
-
/*public*/
|
|
79
|
-
height: var(--ac--height);
|
|
80
|
-
font-family: var(--ac--font-family);
|
|
81
|
-
font-size: var(--ac--font-size);
|
|
82
|
-
}
|
|
1
|
+
:host {
|
|
2
|
+
/* dimensions */
|
|
3
|
+
--ac--height: 36px;
|
|
4
|
+
--ac--width: 100%;
|
|
5
|
+
--ac__icon--width: 48px;
|
|
6
|
+
/* general */
|
|
7
|
+
--ac--border-radius: var(--border--radius-large, 24px);
|
|
8
|
+
--ac--font-size: var(--text--medium, 14px);
|
|
9
|
+
--ac--font-family: var(--font-pattern, Arial);
|
|
10
|
+
--ac--font-weight: var(--text-weight--large, 500);
|
|
11
|
+
--ac--space--medium: var(--space--medium, 6px);
|
|
12
|
+
--ac__border: 1px solid;
|
|
13
|
+
--ac__border-color-strokes: var(--color--strokes, #DCE0E8);
|
|
14
|
+
/* label */
|
|
15
|
+
--ac__label--title--primary: var(--title--primary, #919191);
|
|
16
|
+
--ac__label--color-primary: var(--color--primary, #008561);
|
|
17
|
+
--ac__label-color--disable-secondary: var(--color--disable-secondary, #F2F5F8);
|
|
18
|
+
--ac__label--background-color: #0085610F;
|
|
19
|
+
--ac__label__default--background-color--hover: var(--color--primary-200, #f2faf8);
|
|
20
|
+
--ac__label__default--border-color--hover: var(--color--primary-600, #007a5a);
|
|
21
|
+
--ac__label--text--disabled: var(--text--disable, #AFB6C0);
|
|
22
|
+
--ac__label--text--primary: var(--text--primary, #626e82);
|
|
23
|
+
/* message box */
|
|
24
|
+
--ac__message_box--font-size: var(--text--small, 12px);
|
|
25
|
+
--ac__message_box--info--color: var(--color--success, #22085d);
|
|
26
|
+
--ac__message_box--error--color: var(--color--error, #FF0000);
|
|
27
|
+
/***************
|
|
28
|
+
host style
|
|
29
|
+
***************/
|
|
30
|
+
/*public*/
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.padding-right--small {
|
|
35
|
+
padding-right: var(--ac--space--medium);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.padding-left--small {
|
|
39
|
+
padding-left: var(--ac--space--medium);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.label__container {
|
|
43
|
+
/*private*/
|
|
44
|
+
width: fit-content;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
position: relative;
|
|
48
|
+
align-items: center;
|
|
49
|
+
align-self: center;
|
|
50
|
+
color: var(--ac__label--title--primary);
|
|
51
|
+
fill: var(--ac__label--title--primary);
|
|
52
|
+
border: var(--ac__border);
|
|
53
|
+
border-radius: var(--ac--border-radius);
|
|
54
|
+
border-color: var( --ac__border-color-strokes);
|
|
55
|
+
padding-right: var(--space--large, 12px);
|
|
56
|
+
padding-left: var(--space--large, 12px);
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.label__container:hover {
|
|
61
|
+
border-color: var(--ac__label__default--border-color--hover);
|
|
62
|
+
background-color: var(--ac__label__default--background-color--hover);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.label__container--active:hover {
|
|
66
|
+
border-color: var(--ac__label__active--background-color--hover);
|
|
67
|
+
background-color: var(--ac__label__active--background-color--hover);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
label {
|
|
71
|
+
/*private*/
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
width: calc(100% - var(--ac__icon--width));
|
|
75
|
+
width: fit-content;
|
|
76
|
+
font-weight: var(--text-weight--large, 600);
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
/*public*/
|
|
79
|
+
height: var(--ac--height);
|
|
80
|
+
font-family: var(--ac--font-family);
|
|
81
|
+
font-size: var(--ac--font-size);
|
|
82
|
+
}
|