@sankhyalabs/ezui 5.11.0-dev.1 → 5.11.0-dev.11

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.
Files changed (83) hide show
  1. package/README.md +8 -10
  2. package/dist/cjs/{ApplicationUtils-2e444734.js → ApplicationUtils-88d75775.js} +7 -6
  3. package/dist/cjs/{RecordValidationProcessor-edd23705.js → RecordValidationProcessor-059f2d03.js} +1 -1
  4. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-combo-box.cjs.entry.js +12 -4
  8. package/dist/cjs/ez-form-view.cjs.entry.js +42 -1
  9. package/dist/cjs/ez-form.cjs.entry.js +4 -3
  10. package/dist/cjs/ez-grid.cjs.entry.js +89 -40
  11. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +3 -1
  12. package/dist/cjs/ez-search.cjs.entry.js +3 -1
  13. package/dist/cjs/ez-text-edit.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  15. package/dist/cjs/ezui.cjs.js +1 -1
  16. package/dist/cjs/filter-column.cjs.entry.js +30 -7
  17. package/dist/cjs/loader.cjs.js +1 -1
  18. package/dist/collection/components/ez-card-item/ez-card-item.css +1 -0
  19. package/dist/collection/components/ez-combo-box/ez-combo-box.js +47 -3
  20. package/dist/collection/components/ez-form/ez-form.js +20 -0
  21. package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
  22. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
  23. package/dist/collection/components/ez-form-view/structure/index.js +34 -0
  24. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
  25. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
  26. package/dist/collection/components/ez-grid/ez-grid.js +11 -39
  27. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +50 -8
  28. package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
  29. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +21 -1
  30. package/dist/collection/components/ez-search/ez-search.js +39 -1
  31. package/dist/collection/utils/ApplicationUtils.js +7 -6
  32. package/dist/collection/utils/form/DataBinder.js +1 -1
  33. package/dist/custom-elements/index.js +191 -64
  34. package/dist/esm/{ApplicationUtils-d9a34a16.js → ApplicationUtils-ae588c9c.js} +7 -6
  35. package/dist/esm/{RecordValidationProcessor-abc814af.js → RecordValidationProcessor-0c6f41a1.js} +1 -1
  36. package/dist/esm/ez-actions-button.entry.js +1 -1
  37. package/dist/esm/ez-card-item.entry.js +1 -1
  38. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  39. package/dist/esm/ez-combo-box.entry.js +12 -4
  40. package/dist/esm/ez-form-view.entry.js +42 -1
  41. package/dist/esm/ez-form.entry.js +4 -3
  42. package/dist/esm/ez-grid.entry.js +90 -41
  43. package/dist/esm/ez-multi-selection-list.entry.js +3 -1
  44. package/dist/esm/ez-search.entry.js +3 -1
  45. package/dist/esm/ez-text-edit.entry.js +1 -1
  46. package/dist/esm/ez-upload.entry.js +1 -1
  47. package/dist/esm/ezui.js +1 -1
  48. package/dist/esm/filter-column.entry.js +30 -7
  49. package/dist/esm/loader.js +1 -1
  50. package/dist/ezui/ezui.esm.js +1 -1
  51. package/dist/ezui/p-061f4d73.entry.js +1 -0
  52. package/dist/ezui/p-3078d25c.entry.js +1 -0
  53. package/dist/ezui/{p-37673563.entry.js → p-3e00263f.entry.js} +1 -1
  54. package/dist/ezui/{p-68352e41.entry.js → p-47afb974.entry.js} +1 -1
  55. package/dist/ezui/p-5e55a42b.entry.js +1 -0
  56. package/dist/ezui/{p-fd54b5b4.entry.js → p-6511add4.entry.js} +2 -2
  57. package/dist/ezui/p-67ecaeb4.entry.js +1 -0
  58. package/dist/ezui/p-6fbe368e.entry.js +1 -0
  59. package/dist/ezui/p-7526f2b6.entry.js +1 -0
  60. package/dist/ezui/{p-86a2036d.js → p-7bcb062d.js} +1 -1
  61. package/dist/ezui/{p-ff82b176.entry.js → p-bc4e0389.entry.js} +1 -1
  62. package/dist/ezui/{p-8bd3903b.entry.js → p-c6c645b0.entry.js} +1 -1
  63. package/dist/ezui/p-ca9aa20c.js +1 -0
  64. package/dist/ezui/{p-a5e09759.entry.js → p-f9fd8446.entry.js} +1 -1
  65. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +9 -0
  66. package/dist/types/components/ez-form/ez-form.d.ts +5 -0
  67. package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
  68. package/dist/types/components/ez-form-view/structure/index.d.ts +15 -0
  69. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  70. package/dist/types/components/ez-grid/ez-grid.d.ts +3 -5
  71. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
  72. package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
  73. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
  74. package/dist/types/components/ez-search/ez-search.d.ts +8 -0
  75. package/dist/types/components.d.ts +51 -0
  76. package/package.json +7 -9
  77. package/dist/ezui/p-2a0e1679.entry.js +0 -1
  78. package/dist/ezui/p-4535da17.entry.js +0 -1
  79. package/dist/ezui/p-4c8b029b.entry.js +0 -1
  80. package/dist/ezui/p-4e31b69b.entry.js +0 -1
  81. package/dist/ezui/p-90fa4cb3.entry.js +0 -1
  82. package/dist/ezui/p-9f41b414.entry.js +0 -1
  83. 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
  }
@@ -13,7 +13,9 @@ export class EzSearch {
13
13
  this.suppressEmptyOption = false;
14
14
  this.mode = "regular";
15
15
  this.canShowError = true;
16
+ this.hideErrorOnFocusOut = true;
16
17
  this.listOptionsPosition = undefined;
18
+ this.isTextSearch = false;
17
19
  }
18
20
  observeErrorMessage() {
19
21
  if (this._comboElement) {
@@ -71,7 +73,7 @@ export class EzSearch {
71
73
  }
72
74
  render() {
73
75
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
74
- 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, 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 }));
75
77
  }
76
78
  ;
77
79
  static get is() { return "ez-search"; }
@@ -282,6 +284,24 @@ export class EzSearch {
282
284
  "reflect": true,
283
285
  "defaultValue": "true"
284
286
  },
287
+ "hideErrorOnFocusOut": {
288
+ "type": "boolean",
289
+ "mutable": false,
290
+ "complexType": {
291
+ "original": "boolean",
292
+ "resolved": "boolean",
293
+ "references": {}
294
+ },
295
+ "required": false,
296
+ "optional": false,
297
+ "docs": {
298
+ "tags": [],
299
+ "text": "Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente."
300
+ },
301
+ "attribute": "hide-error-on-focus-out",
302
+ "reflect": false,
303
+ "defaultValue": "true"
304
+ },
285
305
  "listOptionsPosition": {
286
306
  "type": "unknown",
287
307
  "mutable": false,
@@ -301,6 +321,24 @@ export class EzSearch {
301
321
  "tags": [],
302
322
  "text": "Define um posicionamento fixo para a lista de op\u00E7\u00F5es do CheckBox."
303
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"
304
342
  }
305
343
  };
306
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.querySelector("ez-dialog");
10
- if (!dialog) {
11
- dialog = document.createElement("ez-dialog");
12
- window.document.body.appendChild(dialog);
13
- }
14
- dialog.show(title, message, dialogType, confirm, icon, options.labelCancel, options.labelConfirm, options.btnConfirmDanger, options.beforeClose).then(ok => resolve(ok));
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) {
@@ -163,7 +163,7 @@ export default class DataBinder {
163
163
  this._dataUnit.addRecord();
164
164
  }
165
165
  this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
166
- this._dataUnit.setFieldValue(fieldName, newValue);
166
+ this._dataUnit.setFieldValue(fieldName, newValue, [this.getCurrentRecordId()]);
167
167
  if (this._dataUnit.waitingForChange(fieldName)) {
168
168
  const bind = this._fields.get(fieldName);
169
169
  if (bind) {