@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-77126.0 → 0.0.0-bugfix-dev-KB-77074.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/RecordValidationProcessor-10846595.js +108 -0
- package/dist/cjs/ez-card-item_3.cjs.entry.js +19 -12
- package/dist/cjs/ez-chart.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +10 -46
- package/dist/cjs/ez-date-input.cjs.entry.js +2 -8
- package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -8
- package/dist/cjs/ez-dialog.cjs.entry.js +2 -10
- package/dist/cjs/ez-form-view.cjs.entry.js +2 -2
- package/dist/cjs/ez-form.cjs.entry.js +324 -4
- package/dist/cjs/ez-grid.cjs.entry.js +70542 -14645
- package/dist/cjs/ez-list.cjs.entry.js +100 -151
- package/dist/cjs/ez-number-input.cjs.entry.js +0 -7
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +12 -28
- package/dist/cjs/ez-text-area.cjs.entry.js +4 -66
- package/dist/cjs/ez-text-input.cjs.entry.js +7 -49
- package/dist/cjs/ez-time-input.cjs.entry.js +0 -6
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-card-item/ez-card-item.css +5 -14
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +14 -75
- package/dist/collection/components/ez-date-input/ez-date-input.js +4 -35
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +4 -35
- package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
- package/dist/collection/components/ez-dialog/ez-dialog.js +1 -9
- package/dist/collection/components/ez-filter-input/ez-filter-input.css +11 -0
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +52 -22
- package/dist/collection/components/ez-form/ez-form.js +0 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +25 -80
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +0 -8
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +46 -167
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +0 -7
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +0 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +0 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +0 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +0 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +1 -4
- package/dist/collection/components/ez-grid/ez-grid.js +3 -90
- package/dist/collection/components/ez-list/ez-list.css +5 -5
- package/dist/collection/components/ez-list/ez-list.js +170 -152
- package/dist/collection/components/ez-number-input/ez-number-input.js +0 -25
- package/dist/collection/components/ez-popover/ez-popover.css +10 -3
- package/dist/collection/components/ez-popup/ez-popup.js +1 -1
- package/dist/collection/components/ez-search/ez-search.css +1 -1
- package/dist/collection/components/ez-search/ez-search.js +14 -55
- package/dist/collection/components/ez-text-area/ez-text-area.css +0 -49
- package/dist/collection/components/ez-text-area/ez-text-area.js +2 -102
- package/dist/collection/components/ez-text-input/ez-text-input.css +53 -27
- package/dist/collection/components/ez-text-input/ez-text-input.js +6 -84
- package/dist/collection/components/ez-time-input/ez-time-input.js +0 -24
- package/dist/collection/utils/form/DataBinder.js +3 -18
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
- package/dist/custom-elements/index.js +70890 -15272
- package/dist/esm/RecordValidationProcessor-9c6cc267.js +105 -0
- package/dist/esm/ez-card-item_3.entry.js +19 -12
- package/dist/esm/ez-chart.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +11 -47
- package/dist/esm/ez-date-input.entry.js +2 -8
- package/dist/esm/ez-date-time-input.entry.js +2 -8
- package/dist/esm/ez-dialog.entry.js +2 -10
- package/dist/esm/ez-form-view.entry.js +2 -2
- package/dist/esm/ez-form.entry.js +323 -3
- package/dist/esm/ez-grid.entry.js +70542 -14645
- package/dist/esm/ez-list.entry.js +101 -152
- package/dist/esm/ez-number-input.entry.js +0 -7
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +12 -28
- package/dist/esm/ez-text-area.entry.js +4 -66
- package/dist/esm/ez-text-input.entry.js +7 -49
- package/dist/esm/ez-time-input.entry.js +0 -6
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-188f1c4c.entry.js +1 -0
- package/dist/ezui/p-49456b34.entry.js +1 -0
- package/dist/ezui/p-5a90d7d1.entry.js +1 -0
- package/dist/ezui/p-5b205c80.entry.js +1 -0
- package/dist/ezui/p-62732269.entry.js +1 -0
- package/dist/ezui/p-86b6aa01.entry.js +1 -0
- package/dist/ezui/p-b3b94f72.entry.js +1 -0
- package/dist/ezui/p-b95632e8.entry.js +1 -0
- package/dist/ezui/p-bcd47eda.entry.js +1 -0
- package/dist/ezui/p-c3c3d640.entry.js +304 -0
- package/dist/ezui/p-cdc472cc.entry.js +1 -0
- package/dist/ezui/p-d2c06f38.entry.js +1 -0
- package/dist/ezui/p-d8f64bb7.entry.js +1 -0
- package/dist/ezui/p-dc4ada32.entry.js +1 -0
- package/dist/ezui/p-e85c48d7.entry.js +1 -0
- package/dist/ezui/p-f299c608.entry.js +1 -0
- package/dist/ezui/p-f42855b9.js +1 -0
- package/dist/ezui/p-f80ac647.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -7
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +1 -6
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +1 -6
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +0 -2
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +11 -4
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +0 -12
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -7
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -2
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -19
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +1 -3
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +0 -1
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +1 -11
- package/dist/types/components/ez-list/ez-list.d.ts +26 -3
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +0 -4
- package/dist/types/components/ez-search/ez-search.d.ts +1 -6
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +0 -17
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +0 -9
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +0 -4
- package/dist/types/components.d.ts +42 -107
- package/dist/types/utils/form/DataBinder.d.ts +0 -3
- package/package.json +4 -11
- package/dist/cjs/DataBinder-3b083480.js +0 -445
- package/dist/cjs/FocusResolver-885f2173.js +0 -35
- package/dist/collection/utils/FocusResolver.js +0 -31
- package/dist/esm/DataBinder-02fa9bb9.js +0 -441
- package/dist/esm/FocusResolver-1ccbf850.js +0 -33
- package/dist/ezui/p-0a75bb05.entry.js +0 -1
- package/dist/ezui/p-0db68715.entry.js +0 -1
- package/dist/ezui/p-19098a3f.entry.js +0 -1
- package/dist/ezui/p-1f830a2f.entry.js +0 -1
- package/dist/ezui/p-2aa8e4b2.entry.js +0 -1
- package/dist/ezui/p-3dd919b7.entry.js +0 -1
- package/dist/ezui/p-455e737c.js +0 -1
- package/dist/ezui/p-8d0f02c7.entry.js +0 -309
- package/dist/ezui/p-91266ddd.entry.js +0 -1
- package/dist/ezui/p-97af4b13.entry.js +0 -1
- package/dist/ezui/p-a5b91a77.entry.js +0 -1
- package/dist/ezui/p-a80b1287.entry.js +0 -1
- package/dist/ezui/p-b54e17d2.entry.js +0 -1
- package/dist/ezui/p-bfad39eb.entry.js +0 -1
- package/dist/ezui/p-c27b2e17.entry.js +0 -1
- package/dist/ezui/p-cd2e78f0.entry.js +0 -1
- package/dist/ezui/p-d0ca26fe.entry.js +0 -1
- package/dist/ezui/p-dc628ed3.js +0 -1
- package/dist/ezui/p-ffd246f5.entry.js +0 -1
- package/dist/types/utils/FocusResolver.d.ts +0 -5
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const core = require('@sankhyalabs/core');
|
|
4
|
+
const ApplicationUtils = require('./ApplicationUtils-c9d1205c.js');
|
|
5
|
+
|
|
6
|
+
const buildFieldMetadata = (descriptor, config) => {
|
|
7
|
+
let { name, label, group } = Object.assign({}, config);
|
|
8
|
+
let { readOnly, required } = Object.assign({}, config);
|
|
9
|
+
let props;
|
|
10
|
+
let userInterface;
|
|
11
|
+
if (descriptor) {
|
|
12
|
+
label = label || descriptor.label;
|
|
13
|
+
name = name || descriptor.name;
|
|
14
|
+
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
15
|
+
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
16
|
+
props = descriptor.properties;
|
|
17
|
+
userInterface = descriptor.userInterface;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
name, label, group,
|
|
21
|
+
readOnly, required,
|
|
22
|
+
props,
|
|
23
|
+
userInterface: userInterface || core.UserInterface.SHORTTEXT
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
class RecordValidationProcessor {
|
|
28
|
+
constructor(dataUnit, validationSource, validator) {
|
|
29
|
+
this._dataUnit = dataUnit;
|
|
30
|
+
this._validationSource = validationSource;
|
|
31
|
+
this._validator = validator;
|
|
32
|
+
}
|
|
33
|
+
validate(isSaving = true) {
|
|
34
|
+
return new Promise((accept, reject) => {
|
|
35
|
+
const records = this._dataUnit.getModifiedRecords();
|
|
36
|
+
for (let i = 0; i < records.length; i++) {
|
|
37
|
+
const record = records[i];
|
|
38
|
+
const invalidResults = [];
|
|
39
|
+
let validationResult = this.validateRequired(record);
|
|
40
|
+
if (validationResult && !validationResult.isValid) {
|
|
41
|
+
invalidResults.push(validationResult);
|
|
42
|
+
}
|
|
43
|
+
if (this._validator) {
|
|
44
|
+
validationResult = this._validator.validateRecord(record);
|
|
45
|
+
if (validationResult && !validationResult.isValid) {
|
|
46
|
+
invalidResults.push(validationResult);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (invalidResults.length > 0) {
|
|
50
|
+
if (!isSaving && invalidResults[0].invalidFields.length > 0) {
|
|
51
|
+
this._validationSource.markAsInvalid(invalidResults[0].invalidFields[0], record.__record__id__);
|
|
52
|
+
reject();
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
this.processValidationResult(invalidResults, record.__record__id__);
|
|
56
|
+
reject();
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return accept();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
validateRequired(record) {
|
|
64
|
+
const requiredFields = this._validationSource.getRequiredFields();
|
|
65
|
+
const invalidFields = [];
|
|
66
|
+
new Set(requiredFields).forEach(field => {
|
|
67
|
+
const value = record[field];
|
|
68
|
+
if (value == undefined || value === "") {
|
|
69
|
+
const errorMessage = this._validationSource.getMessageForField(field, record.__record__id__);
|
|
70
|
+
if (errorMessage) {
|
|
71
|
+
invalidFields.push({ name: field, message: errorMessage });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
if (invalidFields.length > 0) {
|
|
79
|
+
return { isValid: false, invalidFields, infoMessage: "Há pelo menos um campo obrigatório não preenchido." };
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
processValidationResult(validationResult, recordId) {
|
|
84
|
+
validationResult.forEach(invalidResult => {
|
|
85
|
+
const invalidFields = invalidResult.invalidFields;
|
|
86
|
+
this._dataUnit.savingCanceled(invalidFields, recordId);
|
|
87
|
+
if (invalidFields) {
|
|
88
|
+
invalidFields.forEach(field => {
|
|
89
|
+
this.markAsInvalid(field, recordId);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (invalidResult.infoMessage) {
|
|
93
|
+
ApplicationUtils.ApplicationUtils.info(invalidResult.infoMessage);
|
|
94
|
+
}
|
|
95
|
+
if (invalidResult.errorMessage) {
|
|
96
|
+
const { errorTitle, errorMessage } = invalidResult;
|
|
97
|
+
ApplicationUtils.ApplicationUtils.error(errorTitle, errorMessage);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
markAsInvalid(field, recordId) {
|
|
102
|
+
this._dataUnit.setInvalidField(field.name, field.message, recordId);
|
|
103
|
+
this._validationSource.markAsInvalid(field, recordId);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
exports.RecordValidationProcessor = RecordValidationProcessor;
|
|
108
|
+
exports.buildFieldMetadata = buildFieldMetadata;
|
|
@@ -6,7 +6,7 @@ const index = require('./index-a7b0c73d.js');
|
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const CSSVarsUtils = require('./CSSVarsUtils-10c9d5b4.js');
|
|
8
8
|
|
|
9
|
-
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(--text-weight--medium, 400);\n\n /*@doc Define o peso da fonte do title do componente.*/\n --ez-card-item--font-weight-
|
|
9
|
+
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(--text-weight--medium, 400);\n\n /*@doc Define o peso da fonte do title do componente.*/\n --ez-card-item--font-weight-medium: var(--text-weight--medium, 400);\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 o espaçamento inferior dos detalhes do componente.*/\n --ez-card-item__detail--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: var(--opacity--soft);\n cursor: pointer;\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-medium);\n color: var(--ez-card-item--color);\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-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}\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, 8px) var(--space--3xs, 4px);\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
10
|
|
|
11
11
|
const EzCardItem = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -60,7 +60,7 @@ const EzCardItem = class {
|
|
|
60
60
|
};
|
|
61
61
|
EzCardItem.style = ezCardItemCss;
|
|
62
62
|
|
|
63
|
-
const ezFilterInputCss = ":host{display:block;width:100%}";
|
|
63
|
+
const ezFilterInputCss = ":host{--ez-filter-slot--right--width:70px;display:block;width:100%}.pointerCursor{cursor:pointer}ez-text-input{--ez-text-input__icon--right--width:var(--ez-filter-slot--right--width)}";
|
|
64
64
|
|
|
65
65
|
const EzFilterInput = class {
|
|
66
66
|
constructor(hostRef) {
|
|
@@ -68,15 +68,19 @@ const EzFilterInput = class {
|
|
|
68
68
|
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
69
69
|
this.ezSearching = index.createEvent(this, "ezSearching", 7);
|
|
70
70
|
this.ezFocusIn = index.createEvent(this, "ezFocusIn", 7);
|
|
71
|
+
this.ezIconClick = index.createEvent(this, "ezIconClick", 7);
|
|
71
72
|
this._searchingText = "";
|
|
72
73
|
this.handleFocus = () => {
|
|
74
|
+
this.ezFocusIn.emit();
|
|
75
|
+
if (!this.asyncSearch) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
73
78
|
if (this._searchingText === "") {
|
|
74
79
|
this._textInput.value = "";
|
|
75
80
|
}
|
|
76
81
|
else {
|
|
77
82
|
this._textInput.value = this._searchingText;
|
|
78
83
|
}
|
|
79
|
-
this.ezFocusIn.emit();
|
|
80
84
|
};
|
|
81
85
|
this.label = undefined;
|
|
82
86
|
this.value = undefined;
|
|
@@ -86,7 +90,7 @@ const EzFilterInput = class {
|
|
|
86
90
|
this.mode = "regular";
|
|
87
91
|
this.asyncSearch = false;
|
|
88
92
|
this.canShowError = true;
|
|
89
|
-
this.
|
|
93
|
+
this.enabledIconClick = false;
|
|
90
94
|
}
|
|
91
95
|
observeLabel() {
|
|
92
96
|
if (this._textInput) {
|
|
@@ -107,8 +111,8 @@ const EzFilterInput = class {
|
|
|
107
111
|
/**
|
|
108
112
|
* Aplica o foco no campo.
|
|
109
113
|
*/
|
|
110
|
-
async setFocus(
|
|
111
|
-
this._textInput.setFocus(
|
|
114
|
+
async setFocus() {
|
|
115
|
+
this._textInput.setFocus();
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
114
118
|
* Remove o foco do campo.
|
|
@@ -148,6 +152,14 @@ const EzFilterInput = class {
|
|
|
148
152
|
this._textInput.value = this.value;
|
|
149
153
|
}
|
|
150
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Método usado para emitir o evento de clique no ícone
|
|
157
|
+
*/
|
|
158
|
+
async handleIconClick() {
|
|
159
|
+
if (this.enabledIconClick) {
|
|
160
|
+
this.ezIconClick.emit(true);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
151
163
|
handleChange(evt) {
|
|
152
164
|
const newValue = evt.detail;
|
|
153
165
|
this.errorMessage = "";
|
|
@@ -161,15 +173,10 @@ const EzFilterInput = class {
|
|
|
161
173
|
}
|
|
162
174
|
componentDidLoad() {
|
|
163
175
|
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
164
|
-
if (this.autoFocus) {
|
|
165
|
-
requestAnimationFrame(() => {
|
|
166
|
-
this.setFocus({ selectText: true });
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
176
|
}
|
|
170
177
|
render() {
|
|
171
178
|
core.ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
172
|
-
return (index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" })));
|
|
179
|
+
return (index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, index.h("ez-icon", { slot: "leftIcon", iconName: "search", onClick: () => this.handleIconClick(), class: this.enabledIconClick ? 'pointerCursor' : '' }), index.h("slot", { name: "right", slot: "rightIcon" })));
|
|
173
180
|
}
|
|
174
181
|
get _elem() { return index.getElement(this); }
|
|
175
182
|
static get watchers() { return {
|