@sankhyalabs/ezui 5.11.0 → 5.12.0-dev.2
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-2e444734.js → ApplicationUtils-88d75775.js} +7 -6
- package/dist/cjs/{RecordValidationProcessor-edd23705.js → RecordValidationProcessor-059f2d03.js} +1 -1
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +9 -3
- package/dist/cjs/ez-form-view.cjs.entry.js +42 -1
- package/dist/cjs/ez-form.cjs.entry.js +3 -2
- package/dist/cjs/ez-grid.cjs.entry.js +90 -41
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +3 -1
- package/dist/cjs/ez-search.cjs.entry.js +2 -1
- package/dist/cjs/ez-text-edit.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +30 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-card-item/ez-card-item.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +26 -2
- package/dist/collection/components/ez-form/ez-form.js +20 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
- package/dist/collection/components/ez-form-view/structure/index.js +34 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
- package/dist/collection/components/ez-grid/ez-grid.css +1 -1
- package/dist/collection/components/ez-grid/ez-grid.js +11 -39
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +50 -8
- package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +21 -1
- package/dist/collection/components/ez-search/ez-search.js +20 -1
- package/dist/collection/utils/ApplicationUtils.js +7 -6
- package/dist/custom-elements/index.js +187 -63
- package/dist/esm/{ApplicationUtils-d9a34a16.js → ApplicationUtils-ae588c9c.js} +7 -6
- package/dist/esm/{RecordValidationProcessor-abc814af.js → RecordValidationProcessor-0c6f41a1.js} +1 -1
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-card-item.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +9 -3
- package/dist/esm/ez-form-view.entry.js +42 -1
- package/dist/esm/ez-form.entry.js +3 -2
- package/dist/esm/ez-grid.entry.js +91 -42
- package/dist/esm/ez-multi-selection-list.entry.js +3 -1
- package/dist/esm/ez-search.entry.js +2 -1
- package/dist/esm/ez-text-edit.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +30 -7
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-061f4d73.entry.js +1 -0
- package/dist/ezui/p-3078d25c.entry.js +1 -0
- package/dist/ezui/{p-37673563.entry.js → p-3e00263f.entry.js} +1 -1
- package/dist/ezui/{p-68352e41.entry.js → p-47afb974.entry.js} +1 -1
- package/dist/ezui/p-5e55a42b.entry.js +1 -0
- package/dist/ezui/p-6fbe368e.entry.js +1 -0
- package/dist/ezui/p-7526f2b6.entry.js +1 -0
- package/dist/ezui/{p-86a2036d.js → p-7bcb062d.js} +1 -1
- package/dist/ezui/{p-fd54b5b4.entry.js → p-833bb237.entry.js} +2 -2
- package/dist/ezui/{p-ff82b176.entry.js → p-bc4e0389.entry.js} +1 -1
- package/dist/ezui/{p-8bd3903b.entry.js → p-c6c645b0.entry.js} +1 -1
- package/dist/ezui/p-ca9aa20c.js +1 -0
- package/dist/ezui/{p-9f41b414.entry.js → p-f7127e0f.entry.js} +1 -1
- package/dist/ezui/{p-a5e09759.entry.js → p-f9fd8446.entry.js} +1 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -0
- package/dist/types/components/ez-form/ez-form.d.ts +5 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
- package/dist/types/components/ez-form-view/structure/index.d.ts +15 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +3 -5
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
- package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
- package/dist/types/components/ez-search/ez-search.d.ts +4 -0
- package/dist/types/components.d.ts +35 -0
- package/package.json +1 -1
- package/dist/ezui/p-2a0e1679.entry.js +0 -1
- package/dist/ezui/p-411f3579.entry.js +0 -1
- package/dist/ezui/p-4c8b029b.entry.js +0 -1
- package/dist/ezui/p-4e31b69b.entry.js +0 -1
- package/dist/ezui/p-5a1d8bf8.entry.js +0 -1
- package/dist/ezui/p-f15ec3bb.js +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Action, DataType, DateUtils, UserInterface } from '@sankhyalabs/core';
|
|
2
|
+
export default class InMemoryFilterColumnDataSource {
|
|
3
|
+
constructor(dataUnit) {
|
|
4
|
+
var _a;
|
|
5
|
+
this.onDataUnitAction = (action) => {
|
|
6
|
+
if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
|
|
7
|
+
this.originalRecords = this.dataUnit.records;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
this.dataUnit = dataUnit;
|
|
11
|
+
this.originalRecords = (_a = this.dataUnit.records) !== null && _a !== void 0 ? _a : [];
|
|
12
|
+
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
13
|
+
}
|
|
14
|
+
fetchData(filterTerm, fieldName) {
|
|
15
|
+
return new Promise(resolve => {
|
|
16
|
+
const filteredRecords = this.originalRecords.filter(record => this.includesSearchTerm(record, fieldName, filterTerm));
|
|
17
|
+
const options = filteredRecords.map(item => this.buildFieldOption(item, fieldName));
|
|
18
|
+
resolve(this.removeDuplicatedOptions(options));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
buildFieldOption(item, fieldName) {
|
|
22
|
+
return {
|
|
23
|
+
value: this.buildValue(item, fieldName),
|
|
24
|
+
label: this.formatLabel(fieldName, item[fieldName]),
|
|
25
|
+
check: true,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
buildValue(item, fieldName) {
|
|
29
|
+
var _a;
|
|
30
|
+
let value = item[fieldName];
|
|
31
|
+
if (((_a = this.dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.dataType) === DataType.OBJECT) {
|
|
32
|
+
value = value.value;
|
|
33
|
+
}
|
|
34
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
|
35
|
+
}
|
|
36
|
+
removeDuplicatedOptions(options) {
|
|
37
|
+
const noDuplicatedOptions = [];
|
|
38
|
+
options.forEach(option => {
|
|
39
|
+
if (!noDuplicatedOptions.find(({ label }) => label === option.label)) {
|
|
40
|
+
noDuplicatedOptions.push(option);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return noDuplicatedOptions;
|
|
44
|
+
}
|
|
45
|
+
includesSearchTerm(record, fieldName, filterTerm) {
|
|
46
|
+
let label = this.buildLabel(fieldName, record[fieldName]);
|
|
47
|
+
return label.toLowerCase().includes(filterTerm.toLowerCase());
|
|
48
|
+
}
|
|
49
|
+
buildLabel(fieldName, value) {
|
|
50
|
+
var _a;
|
|
51
|
+
const { dataType } = this.dataUnit.getField(fieldName);
|
|
52
|
+
if (dataType === DataType.NUMBER) {
|
|
53
|
+
return value === null || value === void 0 ? void 0 : value.toString().replace('.', ',');
|
|
54
|
+
}
|
|
55
|
+
if (dataType === DataType.DATE) {
|
|
56
|
+
return (typeof value === 'object')
|
|
57
|
+
? (_a = DateUtils.formatDate(this.dataUnit.valueFromString(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString()
|
|
58
|
+
: value === null || value === void 0 ? void 0 : value.toString();
|
|
59
|
+
}
|
|
60
|
+
if (dataType === DataType.OBJECT) {
|
|
61
|
+
return `${value === null || value === void 0 ? void 0 : value.value} - ${value === null || value === void 0 ? void 0 : value.label}`;
|
|
62
|
+
}
|
|
63
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
|
64
|
+
}
|
|
65
|
+
formatLabel(fieldName, value) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
const { userInterface, dataType } = this.dataUnit.getField(fieldName);
|
|
68
|
+
if (dataType === DataType.DATE) {
|
|
69
|
+
return (typeof value === 'object')
|
|
70
|
+
? DateUtils.formatDate(this.dataUnit.valueFromString(fieldName, value))
|
|
71
|
+
: value === null || value === void 0 ? void 0 : value.toString();
|
|
72
|
+
}
|
|
73
|
+
if (dataType === DataType.NUMBER && userInterface !== UserInterface.DECIMALNUMBER) {
|
|
74
|
+
return (_a = parseInt(this.dataUnit.getFormattedValue(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString();
|
|
75
|
+
}
|
|
76
|
+
return (_b = this.dataUnit.getFormattedValue(fieldName, value)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -14,6 +14,7 @@ export class EzMuiltiSelectionList {
|
|
|
14
14
|
this.dataSource = undefined;
|
|
15
15
|
this.useOptions = false;
|
|
16
16
|
this.options = undefined;
|
|
17
|
+
this.isTextSearch = false;
|
|
17
18
|
this.filteredOptions = undefined;
|
|
18
19
|
this.displayOptions = undefined;
|
|
19
20
|
this.viewScenario = undefined;
|
|
@@ -96,6 +97,7 @@ export class EzMuiltiSelectionList {
|
|
|
96
97
|
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
|
|
97
98
|
}
|
|
98
99
|
this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
|
|
100
|
+
this.searchInput.value = "";
|
|
99
101
|
}
|
|
100
102
|
handleRemoveItemFromOptions(item) {
|
|
101
103
|
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
|
|
@@ -159,7 +161,7 @@ export class EzMuiltiSelectionList {
|
|
|
159
161
|
return scenarios[view];
|
|
160
162
|
}
|
|
161
163
|
render() {
|
|
162
|
-
return (h(Host, null, h("div", { class: "multi-selection" }, this.useOptions ? (h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this) })), h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
|
|
164
|
+
return (h(Host, null, h("div", { class: "multi-selection" }, this.useOptions ? (h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this), isTextSearch: this.isTextSearch })), h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
|
|
163
165
|
}
|
|
164
166
|
static get is() { return "ez-multi-selection-list"; }
|
|
165
167
|
static get encapsulation() { return "scoped"; }
|
|
@@ -249,6 +251,24 @@ export class EzMuiltiSelectionList {
|
|
|
249
251
|
"tags": [],
|
|
250
252
|
"text": "Op\u00E7\u00F5es de filtros a serem exibidas na listagem."
|
|
251
253
|
}
|
|
254
|
+
},
|
|
255
|
+
"isTextSearch": {
|
|
256
|
+
"type": "boolean",
|
|
257
|
+
"mutable": false,
|
|
258
|
+
"complexType": {
|
|
259
|
+
"original": "boolean",
|
|
260
|
+
"resolved": "boolean",
|
|
261
|
+
"references": {}
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"optional": false,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [],
|
|
267
|
+
"text": "Informa se a pesquisa \u00E9 do tipo texto."
|
|
268
|
+
},
|
|
269
|
+
"attribute": "is-text-search",
|
|
270
|
+
"reflect": false,
|
|
271
|
+
"defaultValue": "false"
|
|
252
272
|
}
|
|
253
273
|
};
|
|
254
274
|
}
|
|
@@ -15,6 +15,7 @@ export class EzSearch {
|
|
|
15
15
|
this.canShowError = true;
|
|
16
16
|
this.hideErrorOnFocusOut = true;
|
|
17
17
|
this.listOptionsPosition = undefined;
|
|
18
|
+
this.isTextSearch = false;
|
|
18
19
|
}
|
|
19
20
|
observeErrorMessage() {
|
|
20
21
|
if (this._comboElement) {
|
|
@@ -72,7 +73,7 @@ export class EzSearch {
|
|
|
72
73
|
}
|
|
73
74
|
render() {
|
|
74
75
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
75
|
-
return (h("ez-combo-box", { "data-element-id": ElementIDUtils.getInternalIDInfo("combo"), ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, hideErrorOnFocusOut: this.hideErrorOnFocusOut, optionLoader: this.optionLoader, searchMode: true, onEzChange: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode, canShowError: this.canShowError, listOptionsPosition: this.listOptionsPosition }));
|
|
76
|
+
return (h("ez-combo-box", { "data-element-id": ElementIDUtils.getInternalIDInfo("combo"), ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, hideErrorOnFocusOut: this.hideErrorOnFocusOut, optionLoader: this.optionLoader, searchMode: true, onEzChange: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode, canShowError: this.canShowError, listOptionsPosition: this.listOptionsPosition, isTextSearch: this.isTextSearch }));
|
|
76
77
|
}
|
|
77
78
|
;
|
|
78
79
|
static get is() { return "ez-search"; }
|
|
@@ -320,6 +321,24 @@ export class EzSearch {
|
|
|
320
321
|
"tags": [],
|
|
321
322
|
"text": "Define um posicionamento fixo para a lista de op\u00E7\u00F5es do CheckBox."
|
|
322
323
|
}
|
|
324
|
+
},
|
|
325
|
+
"isTextSearch": {
|
|
326
|
+
"type": "boolean",
|
|
327
|
+
"mutable": false,
|
|
328
|
+
"complexType": {
|
|
329
|
+
"original": "boolean",
|
|
330
|
+
"resolved": "boolean",
|
|
331
|
+
"references": {}
|
|
332
|
+
},
|
|
333
|
+
"required": false,
|
|
334
|
+
"optional": false,
|
|
335
|
+
"docs": {
|
|
336
|
+
"tags": [],
|
|
337
|
+
"text": "Informa se a pesquisa \u00E9 do tipo texto."
|
|
338
|
+
},
|
|
339
|
+
"attribute": "is-text-search",
|
|
340
|
+
"reflect": false,
|
|
341
|
+
"defaultValue": "false"
|
|
323
342
|
}
|
|
324
343
|
};
|
|
325
344
|
}
|
|
@@ -6,12 +6,13 @@ export default class ApplicationUtils {
|
|
|
6
6
|
options = Object.assign(Object.assign({}, ApplicationUtils.defaultMessageOptions), options);
|
|
7
7
|
}
|
|
8
8
|
return new Promise(resolve => {
|
|
9
|
-
let dialog = document.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
let dialog = document.createElement("ez-dialog");
|
|
10
|
+
window.document.body.appendChild(dialog);
|
|
11
|
+
dialog.show(title, message, dialogType, confirm, icon, options.labelCancel, options.labelConfirm, options.btnConfirmDanger, options.beforeClose)
|
|
12
|
+
.then(ok => {
|
|
13
|
+
dialog.remove();
|
|
14
|
+
return resolve(ok);
|
|
15
|
+
});
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
static async alert(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|