@sankhyalabs/ezui 3.0.3 → 3.1.0
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-350ac2ff.js → ApplicationUtils-1eef635f.js} +8 -4
- package/dist/cjs/constants-5a75e2f3.js +5 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-alert.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +263 -9
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +2 -2
- package/dist/cjs/ez-combo-box.cjs.entry.js +95 -11
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-filter-input_4.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +3 -2
- package/dist/cjs/ez-form.cjs.entry.js +2 -2
- package/dist/cjs/ez-grid.cjs.entry.js +1 -1
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-edit.cjs.entry.js +2 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-toast.cjs.entry.js +11 -3
- package/dist/cjs/ez-upload.cjs.entry.js +2 -2
- package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-892780f1.js → index-b54f47a1.js} +5 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.css +10 -1
- package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.js +291 -9
- package/dist/collection/components/ez-breadcrumb/subcomponents/breadcrumb-item.js +31 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +93 -9
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +2 -1
- package/dist/collection/components/ez-toast/ez-toast.css +1 -1
- package/dist/collection/components/ez-toast/ez-toast.js +9 -1
- package/dist/collection/utils/ApplicationUtils.js +8 -4
- package/dist/collection/utils/constants.js +1 -0
- package/dist/custom-elements/index.js +377 -26
- package/dist/esm/{ApplicationUtils-9fda4796.js → ApplicationUtils-79bf1d95.js} +8 -4
- package/dist/esm/constants-ca136201.js +3 -0
- package/dist/esm/ez-actions-button.entry.js +2 -2
- package/dist/esm/ez-alert.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-breadcrumb.entry.js +264 -10
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item.entry.js +1 -1
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +2 -2
- package/dist/esm/ez-combo-box.entry.js +95 -11
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-dropdown.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-filter-input_4.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +3 -2
- package/dist/esm/ez-form.entry.js +2 -2
- package/dist/esm/ez-grid.entry.js +1 -1
- package/dist/esm/ez-guide-navigator.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +1 -1
- package/dist/esm/ez-text-edit.entry.js +2 -2
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-toast.entry.js +11 -3
- package/dist/esm/ez-upload.entry.js +2 -2
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/{index-de655f48.js → index-c27164d3.js} +5 -0
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-7ffd12e7.js → p-00ea9b50.js} +2 -2
- package/dist/ezui/{p-0c7e81fe.entry.js → p-044a3427.entry.js} +1 -1
- package/dist/ezui/{p-6818dd0a.entry.js → p-064e558f.entry.js} +1 -1
- package/dist/ezui/{p-c98e571a.entry.js → p-0f76448d.entry.js} +1 -1
- package/dist/ezui/{p-36f7ec68.entry.js → p-124859c3.entry.js} +1 -1
- package/dist/ezui/{p-9613fae6.entry.js → p-149442dd.entry.js} +1 -1
- package/dist/ezui/{p-493e2af4.entry.js → p-1806b3c6.entry.js} +1 -1
- package/dist/ezui/{p-37b4bf04.entry.js → p-1a1c2eda.entry.js} +1 -1
- package/dist/ezui/{p-eceb9382.entry.js → p-1cfae451.entry.js} +1 -1
- package/dist/ezui/{p-07b99b94.entry.js → p-216e1153.entry.js} +1 -1
- package/dist/ezui/{p-1b95836f.entry.js → p-2c5f1107.entry.js} +1 -1
- package/dist/ezui/{p-fcf6cf57.entry.js → p-2d16e8c2.entry.js} +1 -1
- package/dist/ezui/p-30afcb93.entry.js +1 -0
- package/dist/ezui/{p-a323b415.entry.js → p-330aef41.entry.js} +1 -1
- package/dist/ezui/p-3f4ae3a3.js +1 -0
- package/dist/ezui/p-51ecf138.entry.js +1 -0
- package/dist/ezui/{p-f670bd32.entry.js → p-52e5cc09.entry.js} +1 -1
- package/dist/ezui/{p-c0184982.entry.js → p-66dba09c.entry.js} +1 -1
- package/dist/ezui/p-68acdc61.entry.js +1 -0
- package/dist/ezui/{p-4bfed869.entry.js → p-74379544.entry.js} +1 -1
- package/dist/ezui/{p-b1e4ccf4.entry.js → p-74b3615b.entry.js} +1 -1
- package/dist/ezui/{p-db131605.entry.js → p-77d70bae.entry.js} +1 -1
- package/dist/ezui/{p-600f1732.entry.js → p-78b28632.entry.js} +1 -1
- package/dist/ezui/{p-a4b281ca.entry.js → p-7ff5d0cc.entry.js} +1 -1
- package/dist/ezui/{p-cc5cfcb7.entry.js → p-80f79b1c.entry.js} +1 -1
- package/dist/ezui/{p-06b3e801.entry.js → p-85c1e00f.entry.js} +1 -1
- package/dist/ezui/{p-c1300e84.entry.js → p-8f1a5e21.entry.js} +1 -1
- package/dist/ezui/p-90c3d4fd.entry.js +1 -0
- package/dist/ezui/{p-b941aeee.entry.js → p-936ae3ac.entry.js} +1 -1
- package/dist/ezui/{p-b3c7b243.entry.js → p-93c8bdc6.entry.js} +1 -1
- package/dist/ezui/p-a0e47238.entry.js +1 -0
- package/dist/ezui/{p-86d29565.entry.js → p-aaba630e.entry.js} +1 -1
- package/dist/ezui/{p-62481744.entry.js → p-bb011a51.entry.js} +1 -1
- package/dist/ezui/{p-fd87638e.entry.js → p-bb0607a6.entry.js} +1 -1
- package/dist/ezui/{p-b405d9b6.entry.js → p-bf442859.entry.js} +1 -1
- package/dist/ezui/{p-8ca4750d.entry.js → p-bfca509e.entry.js} +1 -1
- package/dist/ezui/{p-82db6de7.entry.js → p-cd1e0679.entry.js} +1 -1
- package/dist/ezui/{p-cc40fcb3.entry.js → p-ce1408dd.entry.js} +1 -1
- package/dist/ezui/{p-1581fece.entry.js → p-dd13d0e6.entry.js} +1 -1
- package/dist/ezui/{p-a67e056f.entry.js → p-e6cf82e8.entry.js} +1 -1
- package/dist/ezui/{p-695facd0.entry.js → p-e8271a0e.entry.js} +1 -1
- package/dist/ezui/p-efb43dd8.js +1 -0
- package/dist/types/components/ez-breadcrumb/ez-breadcrumb.d.ts +52 -2
- package/dist/types/components/ez-breadcrumb/subcomponents/breadcrumb-item.d.ts +13 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +10 -0
- package/dist/types/components/ez-toast/ez-toast.d.ts +1 -0
- package/dist/types/components.d.ts +25 -1
- package/dist/types/utils/ApplicationUtils.d.ts +4 -4
- package/dist/types/utils/constants.d.ts +1 -0
- package/package.json +1 -1
- package/dist/ezui/p-69a913b8.js +0 -1
- package/dist/ezui/p-a8c7355e.entry.js +0 -1
- package/dist/ezui/p-ada6e6b0.entry.js +0 -1
- package/dist/ezui/p-d6dd32b2.entry.js +0 -1
- package/dist/ezui/p-e0d756d9.entry.js +0 -1
- package/dist/ezui/p-f18d39e6.entry.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ElementIDUtils, FloatingManager } from "@sankhyalabs/core";
|
|
2
2
|
import { h, Host } from "@stencil/core";
|
|
3
3
|
import { ApplicationUtils, CSSVarsUtils } from "../../utils";
|
|
4
|
+
import { REQUIRED_INFO } from "../../utils/constants";
|
|
4
5
|
export class EzComboBox {
|
|
5
6
|
constructor() {
|
|
6
7
|
this._changeDeboucingTimeout = null;
|
|
@@ -9,6 +10,7 @@ export class EzComboBox {
|
|
|
9
10
|
this._maxWidthValue = 0;
|
|
10
11
|
this._tabPressed = false;
|
|
11
12
|
this._textEmptyList = "Nenhum resultado encontrado";
|
|
13
|
+
this._textEmptySearch = "Nenhum resultado de {0} encontrado";
|
|
12
14
|
this._preSelection = undefined;
|
|
13
15
|
this._visibleOptions = undefined;
|
|
14
16
|
this._startLoading = false;
|
|
@@ -38,15 +40,14 @@ export class EzComboBox {
|
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
observeValue(newValue, oldValue) {
|
|
41
|
-
var _a, _b, _c, _d;
|
|
42
43
|
if (this._textInput && newValue != oldValue) {
|
|
43
44
|
const newValueSelected = this.getSelectedOption(newValue);
|
|
44
45
|
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
45
46
|
const currentValue = this.getSelectedOption(this.value);
|
|
46
|
-
if ((
|
|
47
|
+
if (this.isDifferentValues(currentValue, newValueSelected)) {
|
|
47
48
|
this.value = newValueSelected;
|
|
48
49
|
}
|
|
49
|
-
if ((
|
|
50
|
+
if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
|
|
50
51
|
this.setInputValue();
|
|
51
52
|
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
52
53
|
this.ezChange.emit(valueEmitted);
|
|
@@ -75,12 +76,24 @@ export class EzComboBox {
|
|
|
75
76
|
async isInvalid() {
|
|
76
77
|
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
77
78
|
}
|
|
79
|
+
isDifferentValues(firstValue, secondValue) {
|
|
80
|
+
return JSON.stringify(firstValue || {}) !== JSON.stringify(secondValue || {});
|
|
81
|
+
}
|
|
82
|
+
getFormattedText(currentValue) {
|
|
83
|
+
if (currentValue == undefined) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!this.showSelectedValue || currentValue.value == undefined) {
|
|
87
|
+
return currentValue.label;
|
|
88
|
+
}
|
|
89
|
+
if (!currentValue.label) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
return `${currentValue.value} - ${currentValue.label}`;
|
|
93
|
+
}
|
|
78
94
|
getText() {
|
|
79
|
-
let text = "";
|
|
80
95
|
const currentValue = this.getSelectedOption(this.value);
|
|
81
|
-
|
|
82
|
-
text = this.showSelectedValue ? `${currentValue.value} - ${currentValue.label}` : currentValue.label;
|
|
83
|
-
}
|
|
96
|
+
const text = this.getFormattedText(currentValue);
|
|
84
97
|
if (text == undefined) {
|
|
85
98
|
return;
|
|
86
99
|
}
|
|
@@ -139,6 +152,7 @@ export class EzComboBox {
|
|
|
139
152
|
}
|
|
140
153
|
buildItem(opt, index) {
|
|
141
154
|
const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
|
|
155
|
+
opt.label = opt.label || (opt.value ? `<SEM ${this.getFieldLabel()}>` : "");
|
|
142
156
|
return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = index }, this.showOptionValue
|
|
143
157
|
? h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
|
|
144
158
|
: undefined, h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
|
|
@@ -274,7 +288,7 @@ export class EzComboBox {
|
|
|
274
288
|
if ((this._textInput.value || '') !== textValue) {
|
|
275
289
|
this._textInput.value = textValue;
|
|
276
290
|
if (clearError) {
|
|
277
|
-
this.errorMessage =
|
|
291
|
+
this.errorMessage = null;
|
|
278
292
|
}
|
|
279
293
|
}
|
|
280
294
|
}
|
|
@@ -301,6 +315,71 @@ export class EzComboBox {
|
|
|
301
315
|
}
|
|
302
316
|
}
|
|
303
317
|
}
|
|
318
|
+
validateDescriptionValue() {
|
|
319
|
+
if (!this.searchMode || typeof this.value !== "object") {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const { label, value } = this.value || {};
|
|
323
|
+
if (label || value == undefined) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
this.loadDescriptionValue(value);
|
|
327
|
+
}
|
|
328
|
+
async loadDescriptionValue(argument) {
|
|
329
|
+
var _a, _b;
|
|
330
|
+
if (argument == undefined) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
334
|
+
this.loadOptionValue(argument);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const searchArgument = {
|
|
338
|
+
mode: SearchMode.PREDICTIVE,
|
|
339
|
+
argument
|
|
340
|
+
};
|
|
341
|
+
const source = await ((_b = this.optionLoader) === null || _b === void 0 ? void 0 : _b.call(this, searchArgument));
|
|
342
|
+
if (source == undefined) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (source instanceof Promise) {
|
|
346
|
+
source.then((result) => {
|
|
347
|
+
this.setDescriptionValue(result);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
this.setDescriptionValue(source);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
setDescriptionValue(source) {
|
|
355
|
+
const value = (source === null || source === void 0 ? void 0 : source[0]) || source;
|
|
356
|
+
if (value == undefined || !Object.keys(value).length) {
|
|
357
|
+
this.showNoResultMessage();
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (!value.label) {
|
|
361
|
+
value.label = `<SEM ${this.getFieldLabel()}>`;
|
|
362
|
+
}
|
|
363
|
+
this.value = value;
|
|
364
|
+
}
|
|
365
|
+
loadOptionValue(argument) {
|
|
366
|
+
var _a;
|
|
367
|
+
const source = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.value === argument);
|
|
368
|
+
if (source != undefined) {
|
|
369
|
+
this.selectOption(source);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
this.showNoResultMessage();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async showNoResultMessage() {
|
|
376
|
+
this.clearSearch();
|
|
377
|
+
ApplicationUtils.info(this._textEmptySearch.replace("{0}", this.getFieldLabel()));
|
|
378
|
+
}
|
|
379
|
+
getFieldLabel() {
|
|
380
|
+
var _a;
|
|
381
|
+
return (_a = this.label) === null || _a === void 0 ? void 0 : _a.replace(REQUIRED_INFO, "").toUpperCase();
|
|
382
|
+
}
|
|
304
383
|
//---------------------------------------------
|
|
305
384
|
// Lifecycle web component
|
|
306
385
|
//---------------------------------------------
|
|
@@ -340,6 +419,11 @@ export class EzComboBox {
|
|
|
340
419
|
CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
341
420
|
this.setInputValue(false);
|
|
342
421
|
}
|
|
422
|
+
componentShouldUpdate(newValue, oldValue) {
|
|
423
|
+
if (this.isDifferentValues(newValue, oldValue)) {
|
|
424
|
+
this.validateDescriptionValue();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
343
427
|
//---------------------------------------------
|
|
344
428
|
// Event handlers
|
|
345
429
|
//---------------------------------------------
|
|
@@ -381,7 +465,7 @@ export class EzComboBox {
|
|
|
381
465
|
clearDeboucingTimeout() {
|
|
382
466
|
if (this._changeDeboucingTimeout) {
|
|
383
467
|
window.clearTimeout(this._changeDeboucingTimeout);
|
|
384
|
-
this._changeDeboucingTimeout =
|
|
468
|
+
this._changeDeboucingTimeout = null;
|
|
385
469
|
}
|
|
386
470
|
}
|
|
387
471
|
onTextInputClickHandler() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
import { REQUIRED_INFO } from "../../../utils/constants";
|
|
2
3
|
import { buildCheckBox, buildSwitch } from "./templates/CheckBox.tpl";
|
|
3
4
|
import { buildComboBox } from "./templates/ComboBox.tpl";
|
|
4
5
|
import { buildDate, buildTime, buildDateTime } from "./templates/DateInput.tpl";
|
|
@@ -21,6 +22,6 @@ uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
|
21
22
|
uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
|
|
22
23
|
export const fieldBuilder = (field) => {
|
|
23
24
|
const builder = uiBuilders.get(field.userInterface) || buildTextInput;
|
|
24
|
-
const label = field.required ? `${field.label}
|
|
25
|
+
const label = field.required ? `${field.label}${REQUIRED_INFO}` : field.label;
|
|
25
26
|
return builder(Object.assign(Object.assign({}, field), { label }));
|
|
26
27
|
};
|
|
@@ -19,6 +19,9 @@ export class EzToast {
|
|
|
19
19
|
return new Promise(resolve => {
|
|
20
20
|
var _a;
|
|
21
21
|
if ((_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.contains(this._toastOpenedClass)) {
|
|
22
|
+
if (this.isRepeatedMessage(message)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
22
25
|
this._nextMessages.push({ message, fadeTime, useIcon, canClose, callBack: resolve });
|
|
23
26
|
}
|
|
24
27
|
else {
|
|
@@ -52,6 +55,11 @@ export class EzToast {
|
|
|
52
55
|
this._currentMessageInfo.callBack(true);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
58
|
+
isRepeatedMessage(message) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
return ((_a = this._nextMessages) === null || _a === void 0 ? void 0 : _a.some((info) => info.message === message))
|
|
61
|
+
|| ((_b = this._currentMessageInfo) === null || _b === void 0 ? void 0 : _b.message) === message;
|
|
62
|
+
}
|
|
55
63
|
makeToastInvisible() {
|
|
56
64
|
this.container.classList.remove(this._toastOpenedClass);
|
|
57
65
|
this.container.style.animation = `none`;
|
|
@@ -74,7 +82,7 @@ export class EzToast {
|
|
|
74
82
|
}
|
|
75
83
|
render() {
|
|
76
84
|
return (h(Host, null, h("div", { ref: (el) => this.container = el, class: "toast__container" }, this._currentMessageInfo.useIcon &&
|
|
77
|
-
h("slot", { name: "icon" }), h("div", { lang: this._lang, ref: (el) => this._elemText = el, class: this._currentMessageInfo.useIcon ? "message__container
|
|
85
|
+
h("slot", { name: "icon" }), h("div", { lang: this._lang, ref: (el) => this._elemText = el, class: this._currentMessageInfo.useIcon ? "message__container message__container--icon" : "message__container", title: this._currentMessageInfo.message, innerHTML: this._currentMessageInfo.message }), this._currentMessageInfo.canClose &&
|
|
78
86
|
h("button", { class: "btn-close", onClick: () => { this.hideToast(); }, ref: (el) => this._elemBtnClose = el }))));
|
|
79
87
|
}
|
|
80
88
|
static get is() { return "ez-toast"; }
|
|
@@ -29,13 +29,17 @@ export default class ApplicationUtils {
|
|
|
29
29
|
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.DEFAULT, options);
|
|
30
30
|
}
|
|
31
31
|
static async info(message, options = ApplicationUtils.defaultMessageOptions) {
|
|
32
|
+
if (options !== ApplicationUtils.defaultMessageOptions) {
|
|
33
|
+
options = Object.assign(Object.assign({}, ApplicationUtils.defaultMessageOptions), options);
|
|
34
|
+
}
|
|
35
|
+
let useIcon = false;
|
|
32
36
|
let toast = document.querySelector("ez-toast");
|
|
33
37
|
if (!toast) {
|
|
34
38
|
toast = document.createElement("ez-toast");
|
|
35
39
|
const icon = document.createElement("ez-icon");
|
|
36
40
|
icon.className = "ez-margin-right--small";
|
|
37
41
|
icon.slot = "icon";
|
|
38
|
-
icon.style.setProperty(
|
|
42
|
+
icon.style.setProperty("--ez-icon--color", "var(--color--success)");
|
|
39
43
|
toast.appendChild(icon);
|
|
40
44
|
window.document.body.appendChild(toast);
|
|
41
45
|
}
|
|
@@ -43,13 +47,13 @@ export default class ApplicationUtils {
|
|
|
43
47
|
const iconElem = toast.querySelector("ez-icon");
|
|
44
48
|
if (iconElem) {
|
|
45
49
|
iconElem.iconName = options.iconName;
|
|
46
|
-
|
|
50
|
+
useIcon = true;
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
else {
|
|
50
|
-
|
|
54
|
+
useIcon = false;
|
|
51
55
|
}
|
|
52
|
-
toast.show(message, 5000,
|
|
56
|
+
toast.show(message, 5000, useIcon, options.canClose);
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
ApplicationUtils.defaultMessageOptions = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const REQUIRED_INFO = " (obrigatório) *";
|