@sankhyalabs/ezui 6.4.0-ms.2 → 6.4.0-ms.4
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/{ez-card-item_2.cjs.entry.js → ez-card-item.cjs.entry.js} +0 -205
- package/dist/cjs/ez-classic-combo-box.cjs.entry.js +322 -0
- package/dist/cjs/ez-classic-input.cjs.entry.js +26 -9
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover-core.cjs.entry.js +211 -0
- package/dist/cjs/ez-progress-bar.cjs.entry.js +32 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +16 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ez-classic-combo-box/ez-classic-combo-box.css +99 -0
- package/dist/collection/components/ez-classic-combo-box/ez-classic-combo-box.js +796 -0
- package/dist/collection/components/ez-classic-combo-box/interfaces/IOption.js +1 -0
- package/dist/collection/components/ez-classic-input/ez-classic-input.css +29 -0
- package/dist/collection/components/ez-classic-input/ez-classic-input.js +42 -8
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +1 -1
- package/dist/collection/components/ez-progress-bar/ez-progress-bar.css +72 -0
- package/dist/collection/components/ez-progress-bar/ez-progress-bar.js +88 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +375 -12
- package/dist/esm/{ez-card-item_2.entry.js → ez-card-item.entry.js} +1 -205
- package/dist/esm/ez-classic-combo-box.entry.js +318 -0
- package/dist/esm/ez-classic-input.entry.js +26 -9
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-popover-core.entry.js +207 -0
- package/dist/esm/ez-progress-bar.entry.js +28 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +16 -4
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-3bf7f94b.entry.js +1 -0
- package/dist/ezui/{p-0c1a288c.entry.js → p-5b305e5e.entry.js} +1 -1
- package/dist/ezui/p-9b2e6438.entry.js +1 -0
- package/dist/ezui/p-a3075f52.entry.js +1 -0
- package/dist/ezui/p-d6f50207.entry.js +1 -0
- package/dist/ezui/p-dd847dc4.entry.js +1 -0
- package/dist/types/components/ez-classic-combo-box/ez-classic-combo-box.d.ts +114 -0
- package/dist/types/components/ez-classic-combo-box/interfaces/IOption.d.ts +4 -0
- package/dist/types/components/ez-classic-input/ez-classic-input.d.ts +7 -0
- package/dist/types/components/ez-progress-bar/ez-progress-bar.d.ts +11 -0
- package/dist/types/components.d.ts +236 -20
- package/package.json +1 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-5e495d47.entry.js +0 -1
- package/dist/ezui/p-e78e87f5.entry.js +0 -1
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-a7b0c73d.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const floatingUi_dom_esm = require('./floating-ui.dom.esm-017acce4.js');
|
|
8
7
|
|
|
9
8
|
const ezCardItemCss = ":host { \n /*@doc Define o tamanho da fonte do componente.*/\n --ez-card-item--font-size: var(--text--medium, 14px);\n\n /*@doc Define o tamanho da fonte do componente no modo compacto.*/\n --ez-card-item--font-size-compacted: var(--text--extra-small, 10px);\n\n /*@doc Define a família da fonte do componente.*/\n --ez-card-item--font-family: var(--font-pattern, Arial);\n\n /*@doc Define o peso da fonte do componente.*/\n --ez-card-item--font-weight: var(--font-weight--semi-bold, 600);\n\n /*@doc Define o peso da fonte do title do componente.*/\n --ez-card-item--font-weight-large: var(--font-weight--semi-bold, 600);\n\n /*@doc Define a cor da fonte do componente.*/\n --ez-card-item--color: var(--text--primary, #626e82);\n\n /*@doc Define a cor da fonte da key do componente.*/\n --ez-card-item__key--color: var(--text--primary, #626e82);\n\n /*@doc Define a cor da fonte do label do detalhe do componente.*/\n --ez-card-item__detail-label--color: var(--text--secondary, #A2ABB9);\n\n /*@doc Define a cor da fonte do valor do detalhe do componente.*/\n --ez-card-item__detail-value--color: var(--color--petroleum-500, #404E65);\n\n /*@doc Define o espaçamento inferior dos detalhes do componente.*/\n --ez-card-item__detail--padding-bottom: var(--space--extra-small, 3px);\n\n /*@doc Define o espaçamento inferior do title do componente.*/\n --ez-card-item__title--padding-bottom: var(--space--extra-small, 3px);\n\n /*@doc Define a cor do highlight / marcação nos textos do componente.*/\n --ez-card-item__highlight--color: var(--color--primary-300, #E2F4EF);\n\n /*@doc Define o peso da fonte do componente.*/\n --ez-card-item--detail-label--font-weight: var(--text-weight--large, 400);\n\n width: 100%;\n display: flex;\n cursor: pointer;\n}\n\n.card-item {\n display: flex;\n flex-direction: column;\n width: 100%;\n cursor: pointer;\n z-index: 0;\n position: relative;\n container-type: inline-size;\n container-name: box;\n white-space: pre-line;\n}\n\n.card-item__detail{\n display: inline-block;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n opacity: 0.95;\n}\n\n\n\n.card-item__expanded {\n padding: var(--space--medium);\n}\n\n.card-item:hover {\n background: #F0F3F7;\n border-radius: 12px;\n}\n\n.card-item__title {\n display: flex;\n align-items: center;\n line-height: 18px;\n cursor: pointer;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--font-weight-large);\n color: var(--ez-card-item--color);\n padding-bottom: var(--ez-card-item__title--padding-bottom);\n gap: var(--space--small, 6px);\n}\n\n.card-item__key {\n /*public*/\n color: var(--ez-card-item__key--color);\n}\n\n.card-item__details {\n display: flex;\n flex-direction: column;\n cursor: pointer;\n justify-content: space-between;\n width: 100%;\n}\n\n.card-item__details-container__left {\n display: flex;\n flex-direction: column;\n white-space: pre-line;\n cursor: pointer;\n width: 50%;\n}\n\n.card-item__details-container__right {\n display: flex;\n flex-direction: column;\n white-space: pre-line;\n width: 50%;\n cursor: pointer;\n}\n\n.card-item__detail{\n cursor: pointer;\n}\n\n.card-item__detail-default:not(:last-child) {\n padding-bottom: var(--ez-card-item__detail--padding-bottom);\n}\n\n.card-item__detail-label {\n cursor: pointer;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--detail-label--font-weight);\n}\n\n.card-item__detail-value {\n cursor: pointer;\n line-break: anywhere;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--font-weight);\n color: var(--ez-card-item__detail-value--color);\n}\n\n.card-item__highlight {\n position: relative;\n border-radius: 8px;\n z-index: -1;\n\n /*public*/\n background-color: var(--ez-card-item__highlight--color);\n outline: 2px solid var(--ez-card-item__highlight--color);\n box-shadow: -4px 0px 0px 0px var(--ez-card-item__highlight--color), \n 4px 0px 0px 0px var(--ez-card-item__highlight--color);\n}\n\n.card-item__content{\n display: flex;\n align-items: center;\n}\n\n.card-item__details-container_default{\n display: flex;\n}\n\n.card-item__details-slot{\n margin-left: auto;\n}\n\n/* Modo compacto */\n.card-item__compacted {\n padding: var(--space--2xs) var(--space--small);\n}\n\n.card-item__detail-label-compacted {\n font-size: var(--ez-card-item--font-size-compacted);\n}\n\n.card-item__detail-value-compacted {\n font-size: var(--ez-card-item--font-size-compacted);\n}\n\n.card-item__title-compacted {\n font-size: var(--ez-card-item--font-size-compacted);\n}\n\n.card-item__details-container__left-compacted{\n width: 100%;\n}\n\n.card-item__details-container__right-compacted {\n width: 100%;\n}\n\n\n@container box (max-width: 550px) {\n .card-item__details {\n flex-direction: column;\n }\n\n .card-item__details-container__left {\n width: 100%;\n }\n \n .card-item__details-container__right {\n width: 100%;\n }\n}\n\n@container box (max-width: 200px) {\n .card-item__title {\n font-size: 10px;\n }\n\n .card-item__detail-label {\n font-size: 10px;\n }\n\n .card-item__detail-value {\n font-size: 10px;\n }\n\n}";
|
|
10
9
|
|
|
@@ -60,208 +59,4 @@ const EzCardItem = class {
|
|
|
60
59
|
};
|
|
61
60
|
EzCardItem.style = ezCardItemCss;
|
|
62
61
|
|
|
63
|
-
const ezPopoverCoreCss = ":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--elevation--100, 100);--ez-popover__box--overlay-z-index:var(--elevation--24, 24);position:relative;display:flex;user-select:none}.popover__overlay{display:none;position:fixed;padding:0;top:0px;left:0px;width:100%;height:100vh;box-sizing:border-box;z-index:var(--ez-popover__box--overlay-z-index)}.popover__overlay--light{background-color:rgba(var(--rgb-background--overlay), var(--opacity--bright))}.popover__overlay--medium{background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.popover__box{display:none;position:fixed;top:0;left:0;z-index:var(--ez-popover__box--z-index);flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.popover__box--fit-content{width:fit-content}.popover__box--full-width{width:calc(100% - 10px)}";
|
|
64
|
-
|
|
65
|
-
const EzPopoverCore = class {
|
|
66
|
-
constructor(hostRef) {
|
|
67
|
-
index.registerInstance(this, hostRef);
|
|
68
|
-
this.ezVisibilityChange = index.createEvent(this, "ezVisibilityChange", 7);
|
|
69
|
-
this.autoClose = true;
|
|
70
|
-
this.boxWidth = "fit-content";
|
|
71
|
-
this.opened = false;
|
|
72
|
-
this.overlayType = "light";
|
|
73
|
-
this.anchorElement = undefined;
|
|
74
|
-
this.options = { horizontalGap: 0, verticalGap: 0, fromRight: false };
|
|
75
|
-
this.useAnchorSize = false;
|
|
76
|
-
this.minWidth = 150;
|
|
77
|
-
}
|
|
78
|
-
observeOpened(newValue, oldValue) {
|
|
79
|
-
if (newValue === oldValue) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (newValue) {
|
|
83
|
-
this.openPopover();
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
this.hidePopover();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Atualiza a posição do popover.
|
|
91
|
-
*/
|
|
92
|
-
async updatePosition(top, left) {
|
|
93
|
-
this.updateOptionPosition(top, left);
|
|
94
|
-
await this.updatePositionPopover();
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Exibe o ez-popover.
|
|
98
|
-
*/
|
|
99
|
-
async show(top, left) {
|
|
100
|
-
this.updateOptionPosition(top, left);
|
|
101
|
-
this.opened = true;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Ancora a exibição do popOver a um elemento HTML.
|
|
105
|
-
*/
|
|
106
|
-
async showUnder(element, options) {
|
|
107
|
-
if (options) {
|
|
108
|
-
this.options = options;
|
|
109
|
-
}
|
|
110
|
-
this.anchorElement = element;
|
|
111
|
-
this.opened = true;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Oculta o ez-popover.
|
|
115
|
-
*/
|
|
116
|
-
async hide() {
|
|
117
|
-
this.opened = false;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Altera as opções.
|
|
121
|
-
*/
|
|
122
|
-
async setOptions(options) {
|
|
123
|
-
Object.assign(this.options, options);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Altera o elemento de ancoragem.
|
|
127
|
-
*/
|
|
128
|
-
async setAnchorElement(anchor) {
|
|
129
|
-
this.anchorElement = anchor;
|
|
130
|
-
}
|
|
131
|
-
parseSizePixel(sizePixel, defaultValue) {
|
|
132
|
-
if (!sizePixel) {
|
|
133
|
-
return defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0;
|
|
134
|
-
}
|
|
135
|
-
if (typeof sizePixel === "string") {
|
|
136
|
-
return Number(sizePixel.replace("px", ""));
|
|
137
|
-
}
|
|
138
|
-
return sizePixel !== null && sizePixel !== void 0 ? sizePixel : 0;
|
|
139
|
-
}
|
|
140
|
-
updateOptionPosition(top, left) {
|
|
141
|
-
Object.assign(this.options, {
|
|
142
|
-
horizontalGap: this.parseSizePixel(left, this.options.horizontalGap),
|
|
143
|
-
verticalGap: this.parseSizePixel(top, this.options.verticalGap),
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
getElement(element) {
|
|
147
|
-
if (typeof element === 'string') {
|
|
148
|
-
return document.getElementById(element);
|
|
149
|
-
}
|
|
150
|
-
return element;
|
|
151
|
-
}
|
|
152
|
-
getAnchorElement() {
|
|
153
|
-
if (!this.anchorElement) {
|
|
154
|
-
return this._host;
|
|
155
|
-
}
|
|
156
|
-
if (Array.isArray(this.anchorElement)) {
|
|
157
|
-
for (const element of this.anchorElement) {
|
|
158
|
-
const htmlElement = this.getElement(element);
|
|
159
|
-
if (htmlElement) {
|
|
160
|
-
return htmlElement;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return this._host;
|
|
164
|
-
}
|
|
165
|
-
return this.getElement(this.anchorElement);
|
|
166
|
-
}
|
|
167
|
-
async updatePositionPopover() {
|
|
168
|
-
if (!this._box || !this.opened) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const currentAnchorElement = this.getAnchorElement();
|
|
172
|
-
await floatingUi_dom_esm.computePosition(currentAnchorElement, this._box, {
|
|
173
|
-
placement: this.options.fromRight ? 'bottom-end' : 'bottom-start',
|
|
174
|
-
middleware: [floatingUi_dom_esm.flip(), floatingUi_dom_esm.shift({ padding: 5 })],
|
|
175
|
-
strategy: 'fixed',
|
|
176
|
-
}).then(({ x, y, placement }) => {
|
|
177
|
-
const newTop = placement.includes("bottom") ? y + this.options.verticalGap : y - this.options.verticalGap;
|
|
178
|
-
const newLeft = placement.includes("start") ? x + this.options.horizontalGap : x - this.options.horizontalGap;
|
|
179
|
-
Object.assign(this._box.style, {
|
|
180
|
-
top: `${newTop}px`,
|
|
181
|
-
left: `${newLeft}px`,
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
hidePopover() {
|
|
186
|
-
if (!this._box) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
this._box.style.display = '';
|
|
190
|
-
this.hideOverlay();
|
|
191
|
-
this.ezVisibilityChange.emit(false);
|
|
192
|
-
}
|
|
193
|
-
async openPopover() {
|
|
194
|
-
if (!this._box || !this.opened) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
this._box.style.display = 'flex';
|
|
198
|
-
this._box.style.visibility = 'hidden';
|
|
199
|
-
if (this.useAnchorSize) {
|
|
200
|
-
const currentAnchorElement = this.getAnchorElement();
|
|
201
|
-
const anchorSize = currentAnchorElement.getBoundingClientRect().width;
|
|
202
|
-
const width = anchorSize < this.minWidth ? this.minWidth : anchorSize;
|
|
203
|
-
this._box.style.width = `${width}px`;
|
|
204
|
-
}
|
|
205
|
-
await this.updatePositionPopover();
|
|
206
|
-
this.openOverlay();
|
|
207
|
-
this.ezVisibilityChange.emit(true);
|
|
208
|
-
this._box.style.visibility = 'visible';
|
|
209
|
-
}
|
|
210
|
-
openOverlay() {
|
|
211
|
-
if (!this._overlay || !this._overlayIsActive) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
this._overlay.style.display = 'block';
|
|
215
|
-
}
|
|
216
|
-
hideOverlay() {
|
|
217
|
-
if (!this._overlay) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
this._overlay.style.display = 'none';
|
|
221
|
-
}
|
|
222
|
-
checkStatusOverlay() {
|
|
223
|
-
if (this.overlayType !== "none") {
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
if (this.overlayType === "none" && this.autoClose) {
|
|
227
|
-
return true;
|
|
228
|
-
}
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
handlePositionUpdate() {
|
|
232
|
-
if (!this.opened) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
this.updatePositionPopover();
|
|
236
|
-
}
|
|
237
|
-
componentWillLoad() {
|
|
238
|
-
window.addEventListener('scroll', this.handlePositionUpdate.bind(this), true);
|
|
239
|
-
window.addEventListener('resize', this.handlePositionUpdate.bind(this), true);
|
|
240
|
-
}
|
|
241
|
-
componentDidLoad() {
|
|
242
|
-
this._overlayIsActive = this.checkStatusOverlay();
|
|
243
|
-
this._resizeObserver = new ResizeObserver(this.updatePositionPopover.bind(this));
|
|
244
|
-
this._resizeObserver.observe(this._box);
|
|
245
|
-
this.openPopover();
|
|
246
|
-
}
|
|
247
|
-
disconnectedCallback() {
|
|
248
|
-
window.removeEventListener('scroll', this.handlePositionUpdate.bind(this), true);
|
|
249
|
-
window.removeEventListener('resize', this.handlePositionUpdate.bind(this), true);
|
|
250
|
-
this._resizeObserver.disconnect();
|
|
251
|
-
}
|
|
252
|
-
render() {
|
|
253
|
-
return (index.h(index.Host, null, index.h("div", { ref: el => this._overlay = el, onClick: () => this.hide(), class: `popover__overlay popover__overlay--${this.overlayType}` }), index.h("section", { ref: el => this._box = el, class: {
|
|
254
|
-
"popover__box": true,
|
|
255
|
-
"popover__box--fit-content": this.boxWidth === "fit-content",
|
|
256
|
-
"popover__box--full-width": this.boxWidth !== "fit-content",
|
|
257
|
-
} }, index.h("slot", null))));
|
|
258
|
-
}
|
|
259
|
-
get _host() { return index.getElement(this); }
|
|
260
|
-
static get watchers() { return {
|
|
261
|
-
"opened": ["observeOpened"]
|
|
262
|
-
}; }
|
|
263
|
-
};
|
|
264
|
-
EzPopoverCore.style = ezPopoverCoreCss;
|
|
265
|
-
|
|
266
62
|
exports.ez_card_item = EzCardItem;
|
|
267
|
-
exports.ez_popover_core = EzPopoverCore;
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-a7b0c73d.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const ezClassicComboBoxCss = ":host{display:block;box-sizing:border-box;font-family:var(--font--pattern, 'Roboto', Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--gray-500, #494A4E);--ez-classic-combo-box-highlighted-bg-color:var(--color--gray-90, #EAEAEA);--ez-classic-combo-box-max-height:180px;--ez-classic-combo-box-list-bg-color:var(--color--gray-70, #FFFFFF);--ez-classic-combo-box-item-hover-bg-color:var(--color--gray-100, #DEDEDE);--ez-classic-combo-box-selected-bg-color:var(--color--ocean-green-90, #E6F3EF);--ez-classic-combo-box-selected-text-color:var(--color--ocean-green-600, #008561);--ez-classic-combo-box-selected-font-weight:var(--font-weight--medium, 500);--ez-classic-combo-box-item-padding:var(--space--8, 8px) var(--space--4, 4px);--ez-classic-combo-box-item-border-radius:var(--border--radius-8, 8px);--ez-classic-combo-box-list-margin:var(--space--6, 6px);--ez-classic-combo-box-transition-duration:150ms;--ez-classic-combo-box-scrollbar-color:var(--color--gray-300, #C4C4C4);--ez-classic-combo-box-no-results-margin:var(--space--52, 52px) 0;--ez-classic-combo-box-item-text-color:inherit;--ez-classic-combo-box-item-min-height:auto}ul{list-style:none;padding:0;margin:var(--ez-classic-combo-box-list-margin);display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--ez-classic-combo-box-scrollbar-color) transparent;max-height:var(--ez-classic-combo-box-max-height);scroll-behavior:smooth;background-color:var(--ez-classic-combo-box-list-bg-color)}li{cursor:pointer;border-radius:var(--ez-classic-combo-box-item-border-radius);padding:var(--ez-classic-combo-box-item-padding);transition:var(--ez-classic-combo-box-transition-duration) background-color linear;color:var(--ez-classic-combo-box-item-text-color);min-height:var(--ez-classic-combo-box-item-min-height)}li:hover{background-color:var(--ez-classic-combo-box-item-hover-bg-color)}li.highlighted{background-color:var(--ez-classic-combo-box-highlighted-bg-color)}li.selected{background-color:var(--ez-classic-combo-box-selected-bg-color);color:var(--ez-classic-combo-box-selected-text-color);font-weight:var(--ez-classic-combo-box-selected-font-weight)}span.no-results{margin:var(--ez-classic-combo-box-no-results-margin);cursor:default;text-align:center;display:flex;align-items:center;justify-content:center}";
|
|
9
|
+
|
|
10
|
+
const EzClassicComboBox = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
14
|
+
this.ezBlur = index.createEvent(this, "ezBlur", 7);
|
|
15
|
+
this.iconClick = index.createEvent(this, "iconClick", 7);
|
|
16
|
+
this.ezVisibilityChange = index.createEvent(this, "ezVisibilityChange", 7);
|
|
17
|
+
this.ezType = index.createEvent(this, "ezType", 7);
|
|
18
|
+
this._keyboardManager = undefined;
|
|
19
|
+
this._boundHandleDocumentClick = this.handleDocumentClick.bind(this);
|
|
20
|
+
this.popoverVisible = false;
|
|
21
|
+
this.hasSlotContent = false;
|
|
22
|
+
this.highlightedIndex = 0;
|
|
23
|
+
this.filteredOptions = [];
|
|
24
|
+
this.inputValue = '';
|
|
25
|
+
this.value = null;
|
|
26
|
+
this.label = undefined;
|
|
27
|
+
this.placeholder = undefined;
|
|
28
|
+
this.enabled = true;
|
|
29
|
+
this.readonly = false;
|
|
30
|
+
this.name = undefined;
|
|
31
|
+
this.state = "default";
|
|
32
|
+
this.helpText = undefined;
|
|
33
|
+
this.iconName = undefined;
|
|
34
|
+
this.titleIcon = undefined;
|
|
35
|
+
this.iconClickable = false;
|
|
36
|
+
this.suppressSearch = false;
|
|
37
|
+
this.options = undefined;
|
|
38
|
+
this.textEmptyOption = undefined;
|
|
39
|
+
this.suppressEmptyOption = false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Aplica o foco no campo.
|
|
43
|
+
*/
|
|
44
|
+
async setFocus(option) {
|
|
45
|
+
var _a;
|
|
46
|
+
await ((_a = this._inputElem) === null || _a === void 0 ? void 0 : _a.setFocus(option));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Remove o foco do campo.
|
|
50
|
+
*/
|
|
51
|
+
async setBlur() {
|
|
52
|
+
var _a;
|
|
53
|
+
await ((_a = this._inputElem) === null || _a === void 0 ? void 0 : _a.setBlur());
|
|
54
|
+
await this.hidePopover();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Exibe o popover abaixo do input.
|
|
58
|
+
*/
|
|
59
|
+
async showPopover() {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
if (!this._popoverElem || !this._inputElem || this.popoverVisible) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.popoverVisible = true;
|
|
65
|
+
const inputContainer = (_b = (_a = this._inputElem) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.input-container');
|
|
66
|
+
await ((_c = this._popoverElem) === null || _c === void 0 ? void 0 : _c.showUnder(inputContainer !== null && inputContainer !== void 0 ? inputContainer : this._inputElem));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Oculta o popover.
|
|
70
|
+
*/
|
|
71
|
+
async hidePopover() {
|
|
72
|
+
var _a;
|
|
73
|
+
this.popoverVisible = false;
|
|
74
|
+
await ((_a = this._popoverElem) === null || _a === void 0 ? void 0 : _a.hide());
|
|
75
|
+
}
|
|
76
|
+
compareOptionValues(option1, option2) {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
return JSON.stringify((_a = option1 === null || option1 === void 0 ? void 0 : option1.value) !== null && _a !== void 0 ? _a : null) === JSON.stringify((_b = option2 === null || option2 === void 0 ? void 0 : option2.value) !== null && _b !== void 0 ? _b : null);
|
|
79
|
+
}
|
|
80
|
+
setEmptyValue() {
|
|
81
|
+
this.value = null;
|
|
82
|
+
this.inputValue = '';
|
|
83
|
+
}
|
|
84
|
+
async setValue(option) {
|
|
85
|
+
if (!option || !this.options) {
|
|
86
|
+
this.setEmptyValue();
|
|
87
|
+
await this.hidePopover();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (this.compareOptionValues(this.value, option)) {
|
|
91
|
+
await this.hidePopover();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!option.value) {
|
|
95
|
+
this.setEmptyValue();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
this.value = option;
|
|
99
|
+
this.inputValue = option.label;
|
|
100
|
+
}
|
|
101
|
+
this.ezChange.emit(this.value);
|
|
102
|
+
await this.hidePopover();
|
|
103
|
+
}
|
|
104
|
+
async optionsChanged() {
|
|
105
|
+
this.filterOptions('');
|
|
106
|
+
}
|
|
107
|
+
async valueChanged(newValue) {
|
|
108
|
+
if (newValue) {
|
|
109
|
+
this.inputValue = newValue.label;
|
|
110
|
+
this.setHighlightedIndexToValue();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.inputValue = '';
|
|
114
|
+
this.highlightedIndex = 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async handleIconClick(event) {
|
|
118
|
+
event.stopPropagation();
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
if (event.detail.icon === 'right') {
|
|
121
|
+
if (!this.popoverVisible) {
|
|
122
|
+
await this.showPopover();
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
await this.hidePopover();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.iconClick.emit();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async handleEzChange(event) {
|
|
133
|
+
event.stopPropagation();
|
|
134
|
+
this.inputValue = event.detail;
|
|
135
|
+
if (!this.popoverVisible && this.inputValue.length > 0) {
|
|
136
|
+
await this.showPopover();
|
|
137
|
+
}
|
|
138
|
+
this.ezType.emit(this.inputValue);
|
|
139
|
+
this.highlightedIndex = 0;
|
|
140
|
+
this.filterOptions(this.inputValue);
|
|
141
|
+
}
|
|
142
|
+
async handleEzBlur(event) {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
if (((_a = this.value) === null || _a === void 0 ? void 0 : _a.label) !== this.inputValue) {
|
|
146
|
+
this.inputValue = ((_b = this.value) === null || _b === void 0 ? void 0 : _b.label) || '';
|
|
147
|
+
}
|
|
148
|
+
this.ezBlur.emit(this.value);
|
|
149
|
+
}
|
|
150
|
+
filterOptions(searchTerm) {
|
|
151
|
+
if (!this.options) {
|
|
152
|
+
this.filteredOptions = [];
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
let currentOptions = [];
|
|
156
|
+
if (!searchTerm || searchTerm.trim() === '') {
|
|
157
|
+
currentOptions = currentOptions.concat([...this.options]);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const term = searchTerm.toLowerCase().trim();
|
|
161
|
+
currentOptions = currentOptions.concat(this.options.filter(option => option.label.toLowerCase().includes(term) ||
|
|
162
|
+
option.value.toLowerCase().includes(term)));
|
|
163
|
+
}
|
|
164
|
+
if (!this.suppressEmptyOption && currentOptions.length > 0) {
|
|
165
|
+
currentOptions = [
|
|
166
|
+
{
|
|
167
|
+
value: null,
|
|
168
|
+
label: this.textEmptyOption || "Selecione um item"
|
|
169
|
+
},
|
|
170
|
+
...currentOptions
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
this.filteredOptions = currentOptions;
|
|
174
|
+
this.setHighlightedIndexToValue();
|
|
175
|
+
this.scrollToHighlightedOption();
|
|
176
|
+
}
|
|
177
|
+
scrollToHighlightedOption() {
|
|
178
|
+
if (this.highlightedIndex < 0 || !this._listElem) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const highlightedOption = this._listElem.children[this.highlightedIndex];
|
|
182
|
+
if (highlightedOption) {
|
|
183
|
+
highlightedOption.scrollIntoView({
|
|
184
|
+
behavior: 'smooth',
|
|
185
|
+
block: 'nearest',
|
|
186
|
+
inline: 'start'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async selectOption(option) {
|
|
191
|
+
if (!option || this.readonly || !this.enabled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
await this.setValue(option);
|
|
195
|
+
}
|
|
196
|
+
async handleArrowUp() {
|
|
197
|
+
var _a;
|
|
198
|
+
if (!this.popoverVisible) {
|
|
199
|
+
await this.showPopover();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const optionsLength = ((_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
203
|
+
if (optionsLength <= 0 || this.highlightedIndex <= 0) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
this.highlightedIndex = Math.max(0, this.highlightedIndex - 1);
|
|
207
|
+
this.scrollToHighlightedOption();
|
|
208
|
+
}
|
|
209
|
+
handleArrowDown() {
|
|
210
|
+
var _a;
|
|
211
|
+
if (!this.popoverVisible) {
|
|
212
|
+
this.showPopover();
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const optionsLength = ((_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
216
|
+
if (optionsLength <= 0) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
this.highlightedIndex = Math.min(optionsLength - 1, this.highlightedIndex + 1);
|
|
220
|
+
this.scrollToHighlightedOption();
|
|
221
|
+
}
|
|
222
|
+
async selectCurrentItem() {
|
|
223
|
+
if (!this.popoverVisible || this.highlightedIndex < 0) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (this.hasSlotContent || this.filteredOptions.length === 0 || this.readonly || !this.enabled) {
|
|
227
|
+
await this.hidePopover();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (this.filteredOptions && this.filteredOptions[this.highlightedIndex]) {
|
|
231
|
+
this.selectOption(this.filteredOptions[this.highlightedIndex]);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
handleVisibilityChange(event) {
|
|
235
|
+
this.popoverVisible = event.detail;
|
|
236
|
+
this.ezVisibilityChange.emit(this.popoverVisible);
|
|
237
|
+
}
|
|
238
|
+
checkSlotContent() {
|
|
239
|
+
const slot = this._element.querySelector('slot') || this._element;
|
|
240
|
+
if (slot instanceof HTMLSlotElement) {
|
|
241
|
+
this.hasSlotContent = slot.assignedNodes().length > 0;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
this.hasSlotContent = slot.children.length > 0;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
setHighlightedIndexToValue() {
|
|
248
|
+
if (this.value && this.filteredOptions) {
|
|
249
|
+
const index = this.filteredOptions.findIndex(opt => opt.value === this.value.value);
|
|
250
|
+
if (index >= 0) {
|
|
251
|
+
this.highlightedIndex = index;
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this.highlightedIndex = 0;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async handleDocumentClick(event) {
|
|
258
|
+
const target = event.target;
|
|
259
|
+
if (!this._element.contains(target) && !this._popoverElem.contains(target)) {
|
|
260
|
+
await this.hidePopover();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
addInfoId() {
|
|
264
|
+
const dataInfo = { id: 'embedded' };
|
|
265
|
+
if (this._element) {
|
|
266
|
+
core.ElementIDUtils.addIDInfo(this._element);
|
|
267
|
+
}
|
|
268
|
+
if (this._inputElem) {
|
|
269
|
+
core.ElementIDUtils.addIDInfo(this._inputElem, 'classic-combo-box-input', dataInfo);
|
|
270
|
+
}
|
|
271
|
+
if (this._popoverElem) {
|
|
272
|
+
core.ElementIDUtils.addIDInfo(this._popoverElem, 'classic-combo-box-popover', dataInfo);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
async initKeyboardManager() {
|
|
276
|
+
this._keyboardManager = new core.KeyboardManager({ element: this._element, propagate: true });
|
|
277
|
+
this._keyboardManager
|
|
278
|
+
.bind("ArrowUp", () => this.handleArrowUp(), { propagate: false })
|
|
279
|
+
.bind("ArrowDown", () => this.handleArrowDown(), { propagate: false })
|
|
280
|
+
.bind("Enter", () => this.selectCurrentItem(), { propagate: false })
|
|
281
|
+
.bind("Tab", () => this.selectCurrentItem())
|
|
282
|
+
.bind("shift+Tab", () => this.selectCurrentItem())
|
|
283
|
+
.bind("Escape", () => this.hidePopover());
|
|
284
|
+
}
|
|
285
|
+
async connectedCallback() {
|
|
286
|
+
await this.initKeyboardManager();
|
|
287
|
+
document.addEventListener('mouseup', this._boundHandleDocumentClick);
|
|
288
|
+
}
|
|
289
|
+
disconnectedCallback() {
|
|
290
|
+
this._keyboardManager.unbindAllShortcutKeys();
|
|
291
|
+
document.removeEventListener('mouseup', this._boundHandleDocumentClick);
|
|
292
|
+
}
|
|
293
|
+
componentWillLoad() {
|
|
294
|
+
this.filterOptions('');
|
|
295
|
+
}
|
|
296
|
+
componentDidLoad() {
|
|
297
|
+
this.addInfoId();
|
|
298
|
+
this.checkSlotContent();
|
|
299
|
+
if (this.value) {
|
|
300
|
+
this.inputValue = this.value.label;
|
|
301
|
+
this.setHighlightedIndexToValue();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
render() {
|
|
305
|
+
var _a;
|
|
306
|
+
return (index.h(index.Host, null, index.h("ez-classic-input", { ref: ref => this._inputElem = ref, name: this.name, label: this.label, placeholder: this.placeholder, value: this.inputValue, state: this.state, enabled: this.enabled, readonly: this.readonly || this.suppressSearch, leftIconName: this.iconName, leftIconTooltip: this.titleIcon, leftIconClickable: this.iconClickable, rightIconClickable: true, helpText: this.helpText, rightIconName: this.popoverVisible ? 'angle-up' : 'angle-down', onIconClick: this.handleIconClick.bind(this), onEzChange: this.handleEzChange.bind(this), onEzFocus: this.showPopover.bind(this), onEzBlur: this.handleEzBlur.bind(this) }), index.h("ez-popover-core", { ref: ref => this._popoverElem = ref, useAnchorSize: true, onEzVisibilityChange: this.handleVisibilityChange.bind(this), overlayType: "none", options: { verticalGap: 2, horizontalGap: 0 }, autoClose: false }, index.h("slot", { onSlotchange: this.checkSlotContent.bind(this) }), !this.hasSlotContent && (((_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (index.h("ul", { ref: ref => this._listElem = ref, tabIndex: -1 }, this.filteredOptions.map((option, index$1) => {
|
|
307
|
+
var _a, _b;
|
|
308
|
+
return (index.h("li", { key: (_a = option.value) !== null && _a !== void 0 ? _a : '__empty__', value: option.value, class: {
|
|
309
|
+
'highlighted': this.highlightedIndex === index$1,
|
|
310
|
+
'selected': ((_b = this.value) === null || _b === void 0 ? void 0 : _b.value) === option.value
|
|
311
|
+
}, onMouseDown: () => this.selectOption(option) }, option.label));
|
|
312
|
+
}))) : (index.h("span", { class: "no-results" }, "Nenhum resultado encontrado"))))));
|
|
313
|
+
}
|
|
314
|
+
get _element() { return index.getElement(this); }
|
|
315
|
+
static get watchers() { return {
|
|
316
|
+
"options": ["optionsChanged"],
|
|
317
|
+
"value": ["valueChanged"]
|
|
318
|
+
}; }
|
|
319
|
+
};
|
|
320
|
+
EzClassicComboBox.style = ezClassicComboBoxCss;
|
|
321
|
+
|
|
322
|
+
exports.ez_classic_combo_box = EzClassicComboBox;
|
|
@@ -200,14 +200,16 @@ class MaskFormatter {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
const ezClassicInputCss = ":host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0;--ez-classic-input--label-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--border-color-default:var(--color--gray-200, #D2D2D3);--ez-classic-input--border-color-focus:var(--color--gray-300, #A4A5A7);--ez-classic-input--border-color-success:var(--color--green-600, #157A00);--ez-classic-input--border-color-error:var(--color--red-600, #BD0025);--ez-classic-input--border-color-warning:var(--color--yellow-600, #EFB103);--ez-classic-input--background-color:var(--color--gray-70, #FFFFFF);--ez-classic-input--background-color-disabled:var(--color--gray-90, #EAEAEA);--ez-classic-input--text-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--placeholder-color:#bdbdbd;--ez-classic-input--icon-color:var(--color--gray-400, #77777A);--ez-classic-input--helptext-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--height:56px}.input-container{display:flex;flex-direction:row;align-items:center;width:100%;border:none;border-radius:var(--border--radius-8, 8px);padding:var(--space--16, 16px);box-sizing:border-box;gap:var(--space--10, 10px);margin:var(--space--4, 4px) var(--space--2, 2px);transition:box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);height:var(--ez-classic-input--height);background-color:var(--ez-classic-input--background-color)}.input-container,.input-container[data-state=\"default\"]{box-shadow:0 0 0 1px var(--ez-classic-input--border-color-default)}.input-container[data-state=\"success\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-success)}.input-container[data-state=\"error\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-error)}.input-container[data-state=\"warning\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-warning)}.input-container:focus-within{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-focus)}ez-icon{min-width:var(--space--24, 24px);color:var(--ez-classic-input--icon-color)}input{flex:1;border:none;outline:none;background:transparent;height:100%;width:100%;padding:0;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);text-overflow:ellipsis;color:var(--ez-classic-input--text-color)}input::placeholder{color:var(--ez-classic-input--placeholder-color)}.input-container[data-disabled=\"true\"]{cursor:not-allowed;background:var(--ez-classic-input--background-color-disabled);border-color:var(--ez-classic-input--border-color-default)}.input-container[data-disabled=\"true\"]>*{cursor:not-allowed}@keyframes ez-helptext-fadein{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}span{font-size:var(--font-size--xsmall, 10px);line-height:var(--line-height--16, 16px);overflow:hidden;text-overflow:ellipsis;animation:ez-helptext-fadein 0.3s ease;color:var(--ez-classic-input--helptext-color)}label{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:var(--line-height--20, 20px);color:var(--ez-classic-input--label-color)}.icon-clickable{cursor:pointer}";
|
|
203
|
+
const ezClassicInputCss = ":host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0;--ez-classic-input--label-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--border-color-default:var(--color--gray-200, #D2D2D3);--ez-classic-input--border-color-focus:var(--color--gray-300, #A4A5A7);--ez-classic-input--border-color-success:var(--color--green-600, #157A00);--ez-classic-input--border-color-error:var(--color--red-600, #BD0025);--ez-classic-input--border-color-warning:var(--color--yellow-600, #EFB103);--ez-classic-input--background-color:var(--color--gray-70, #FFFFFF);--ez-classic-input--background-color-disabled:var(--color--gray-90, #EAEAEA);--ez-classic-input--text-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--placeholder-color:#bdbdbd;--ez-classic-input--icon-color:var(--color--gray-400, #77777A);--ez-classic-input--helptext-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--height:56px}.input-container{display:flex;flex-direction:row;align-items:center;width:100%;border:none;border-radius:var(--border--radius-8, 8px);padding:var(--space--16, 16px);box-sizing:border-box;gap:var(--space--10, 10px);margin:var(--space--4, 4px) var(--space--2, 2px);transition:box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);height:var(--ez-classic-input--height);background-color:var(--ez-classic-input--background-color)}.input-container,.input-container[data-state=\"default\"]{box-shadow:0 0 0 1px var(--ez-classic-input--border-color-default)}.input-container[data-state=\"success\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-success)}.input-container[data-state=\"error\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-error)}.input-container[data-state=\"warning\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-warning)}.input-container:focus-within{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-focus)}ez-icon{min-width:var(--space--24, 24px);color:var(--ez-classic-input--icon-color)}input{flex:1;border:none;outline:none;background:transparent;height:100%;width:100%;padding:0;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);text-overflow:ellipsis;color:var(--ez-classic-input--text-color)}input::placeholder{color:var(--ez-classic-input--placeholder-color)}.input-container[data-disabled=\"true\"]{cursor:not-allowed;background:var(--ez-classic-input--background-color-disabled);border-color:var(--ez-classic-input--border-color-default)}.input-container[data-disabled=\"true\"]>*{cursor:not-allowed}.input-container input:read-only{cursor:default}@keyframes ez-helptext-fadein{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}span{font-size:var(--font-size--xsmall, 10px);line-height:var(--line-height--16, 16px);overflow:hidden;text-overflow:ellipsis;animation:ez-helptext-fadein 0.3s ease;color:var(--ez-classic-input--helptext-color)}label{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:var(--line-height--20, 20px);color:var(--ez-classic-input--label-color)}.icon-clickable{cursor:pointer}";
|
|
204
204
|
|
|
205
205
|
const EzClassicInput = class {
|
|
206
206
|
constructor(hostRef) {
|
|
207
207
|
index.registerInstance(this, hostRef);
|
|
208
208
|
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
209
209
|
this.ezBlur = index.createEvent(this, "ezBlur", 7);
|
|
210
|
+
this.ezFocus = index.createEvent(this, "ezFocus", 7);
|
|
210
211
|
this.iconClick = index.createEvent(this, "iconClick", 7);
|
|
212
|
+
this._internalValueChange = false;
|
|
211
213
|
this.type = 'text';
|
|
212
214
|
this.value = undefined;
|
|
213
215
|
this.label = undefined;
|
|
@@ -246,6 +248,19 @@ const EzClassicInput = class {
|
|
|
246
248
|
async setBlur() {
|
|
247
249
|
this._inputElem.blur();
|
|
248
250
|
}
|
|
251
|
+
async syncValue() {
|
|
252
|
+
if (this._internalValueChange) {
|
|
253
|
+
this._internalValueChange = false;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (this.value && this._maskFormatter && this._inputElem) {
|
|
257
|
+
const formattedValue = this._maskFormatter.format(this.value);
|
|
258
|
+
this._inputElem.value = formattedValue;
|
|
259
|
+
}
|
|
260
|
+
else if (this._inputElem) {
|
|
261
|
+
this._inputElem.value = this.value || '';
|
|
262
|
+
}
|
|
263
|
+
}
|
|
249
264
|
onInput(event) {
|
|
250
265
|
try {
|
|
251
266
|
const inputElement = event.target;
|
|
@@ -254,11 +269,13 @@ const EzClassicInput = class {
|
|
|
254
269
|
const formattedValue = this._maskFormatter.format(inputValue);
|
|
255
270
|
const cleanValue = this._maskFormatter.removeMask(formattedValue);
|
|
256
271
|
inputElement.value = formattedValue;
|
|
272
|
+
this._internalValueChange = true;
|
|
257
273
|
this.value = cleanValue;
|
|
258
274
|
const emitValue = this.emitMaskedValue ? formattedValue : cleanValue;
|
|
259
275
|
this.ezChange.emit(emitValue);
|
|
260
276
|
}
|
|
261
277
|
else {
|
|
278
|
+
this._internalValueChange = true;
|
|
262
279
|
this.value = inputValue;
|
|
263
280
|
this.ezChange.emit(inputValue);
|
|
264
281
|
}
|
|
@@ -270,6 +287,9 @@ const EzClassicInput = class {
|
|
|
270
287
|
onBlur() {
|
|
271
288
|
this.ezBlur.emit(this.value);
|
|
272
289
|
}
|
|
290
|
+
onFocus() {
|
|
291
|
+
this.ezFocus.emit(this.value);
|
|
292
|
+
}
|
|
273
293
|
handleIconClick(event, icon) {
|
|
274
294
|
if (!this.enabled) {
|
|
275
295
|
return;
|
|
@@ -299,19 +319,16 @@ const EzClassicInput = class {
|
|
|
299
319
|
}
|
|
300
320
|
}
|
|
301
321
|
componentDidLoad() {
|
|
302
|
-
|
|
303
|
-
const formattedValue = this._maskFormatter.format(this.value);
|
|
304
|
-
this._inputElem.value = formattedValue;
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
this._inputElem.value = this.value || '';
|
|
308
|
-
}
|
|
322
|
+
this.syncValue();
|
|
309
323
|
this.addInfoId();
|
|
310
324
|
}
|
|
311
325
|
render() {
|
|
312
|
-
return (index.h(index.Host, null, index.h("label", { title: this.label, htmlFor: this.name }, this.label), index.h("div", { class: "input-container", "data-state": this.state, "data-disabled": (!this.enabled).toString(), onClick: () => this.setFocus({ preventScroll: true }) }, this.leftIconName && (index.h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), index.h("input", { ref: el => this._inputElem = el, id: this.name, type: this.type, title: this.value, placeholder: this.placeholder, disabled: !this.enabled, readonly: this.readonly, name: this.name, minlength: this.minlength, maxlength: this.maxlength, onInput: this.onInput.bind(this),
|
|
326
|
+
return (index.h(index.Host, null, index.h("label", { title: this.label, htmlFor: this.name }, this.label), index.h("div", { class: "input-container", "data-state": this.state, "data-disabled": (!this.enabled).toString(), onClick: () => this.setFocus({ preventScroll: true }) }, this.leftIconName && (index.h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), index.h("input", { ref: el => this._inputElem = el, id: this.name, type: this.type, title: this.value, placeholder: this.placeholder, disabled: !this.enabled, readonly: this.readonly, name: this.name, minlength: this.minlength, maxlength: this.maxlength, onInput: (event) => this.onInput(event), onBlur: this.onBlur.bind(this), onFocus: this.onFocus.bind(this) }), this.rightIconName && (index.h("ez-icon", { iconName: this.rightIconName, title: this.rightIconTooltip, onClick: (event) => this.handleIconClick(event, "right"), class: { 'icon-clickable': this.rightIconClickable } }))), this.helpText && (index.h("span", { title: this.helpText }, this.helpText))));
|
|
313
327
|
}
|
|
314
328
|
get _element() { return index.getElement(this); }
|
|
329
|
+
static get watchers() { return {
|
|
330
|
+
"value": ["syncValue"]
|
|
331
|
+
}; }
|
|
315
332
|
};
|
|
316
333
|
EzClassicInput.style = ezClassicInputCss;
|
|
317
334
|
|
|
@@ -154,7 +154,7 @@ const EzMuiltiSelectionList = class {
|
|
|
154
154
|
itemSelected.check = itemCheckSelected.check;
|
|
155
155
|
}
|
|
156
156
|
buildViewList(hasDelete) {
|
|
157
|
-
return (index.h(index.Fragment, null, this.displayOptionToCheckAllItems && (index.h("ez-check", { ref: (element) => (this.checkInput = element), label: this.i18n("ez-multi-selection-list.selectAll"), class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), index.h("ez-list", { class: "multi-selection__list", dataSource: this.displayOptions, listMode: "check", hoverFeedback: true, onEzCheckChange: this.handleChangeSelectedItem.bind(this), itemSlotBuilder: hasDelete ? this.buildDeleteIconSlot.bind(this) : null })));
|
|
157
|
+
return (index.h(index.Fragment, null, this.displayOptionToCheckAllItems && (index.h("ez-check", { ref: (element) => (this.checkInput = element), label: this.i18n("ez-multi-selection-list.selectAll"), class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), index.h("ez-list", { class: "multi-selection__list", dataSource: this.displayOptions.map(opt => (Object.assign(Object.assign({}, opt), { id: opt.value }))), listMode: "check", hoverFeedback: true, onEzCheckChange: this.handleChangeSelectedItem.bind(this), itemSlotBuilder: hasDelete ? this.buildDeleteIconSlot.bind(this) : null })));
|
|
158
158
|
}
|
|
159
159
|
buildDeleteIconSlot(item) {
|
|
160
160
|
return index.h("ez-icon", { style: { cursor: 'pointer' }, iconName: "delete", onClick: () => this.handleRemoveItemFromOptions(item) });
|