@sankhyalabs/ezui 7.1.0-dev.1 → 7.1.0-dev.10

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 (65) hide show
  1. package/dist/cjs/ez-combo-box-list_4.cjs.entry.js +1 -1
  2. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-form.cjs.entry.js +110 -38
  4. package/dist/cjs/ez-grid.cjs.entry.js +3 -3
  5. package/dist/cjs/ez-modal-container.cjs.entry.js +2 -11
  6. package/dist/cjs/ez-popup.cjs.entry.js +9 -6
  7. package/dist/cjs/ez-tree.cjs.entry.js +154 -7
  8. package/dist/cjs/ezui.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{purify-47a2f27b.js → purify-453a8028.js} +35 -12
  11. package/dist/cjs/{search-column-9aa090ec.js → search-column-8bfee733.js} +1 -1
  12. package/dist/collection/components/ez-dialog/ez-dialog.css +6 -1
  13. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
  14. package/dist/collection/components/ez-modal-container/ez-modal-container.css +3 -9
  15. package/dist/collection/components/ez-modal-container/ez-modal-container.js +1 -10
  16. package/dist/collection/components/ez-popup/ez-popup.css +3 -2
  17. package/dist/collection/components/ez-popup/ez-popup.js +9 -6
  18. package/dist/collection/components/ez-tree/ez-tree.css +4 -0
  19. package/dist/collection/components/ez-tree/ez-tree.js +185 -6
  20. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +4 -1
  21. package/dist/collection/components/ez-tree/types/Node.js +7 -0
  22. package/dist/collection/components/ez-tree/types/Tree.js +19 -0
  23. package/dist/collection/components/ez-tree/types/UpdateItemConfig.js +1 -0
  24. package/dist/collection/utils/form/DataBinder.js +1 -1
  25. package/dist/collection/utils/form/FormMetadata.js +109 -37
  26. package/dist/custom-elements/index.js +313 -77
  27. package/dist/esm/ez-combo-box-list_4.entry.js +1 -1
  28. package/dist/esm/ez-dialog.entry.js +1 -1
  29. package/dist/esm/ez-form.entry.js +110 -38
  30. package/dist/esm/ez-grid.entry.js +3 -3
  31. package/dist/esm/ez-modal-container.entry.js +2 -11
  32. package/dist/esm/ez-popup.entry.js +9 -6
  33. package/dist/esm/ez-tree.entry.js +154 -7
  34. package/dist/esm/ezui.js +1 -1
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/esm/{purify-dc6814bf.js → purify-003c47e2.js} +35 -12
  37. package/dist/esm/{search-column-83562552.js → search-column-c00119ae.js} +1 -1
  38. package/dist/ezui/ezui.esm.js +1 -1
  39. package/dist/ezui/p-294f54fe.entry.js +1 -0
  40. package/dist/ezui/p-4f0632b4.js +1 -0
  41. package/dist/ezui/{p-d66bf34e.entry.js → p-8c57ffa4.entry.js} +2 -2
  42. package/dist/ezui/p-ae5f64cd.entry.js +1 -0
  43. package/dist/ezui/p-bb409cba.js +3 -0
  44. package/dist/ezui/p-c82acfc6.entry.js +1 -0
  45. package/dist/ezui/{p-c943f7c4.entry.js → p-e03b2f19.entry.js} +1 -1
  46. package/dist/ezui/p-e77610ef.entry.js +1 -0
  47. package/dist/ezui/p-ff4bde07.entry.js +1 -0
  48. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +0 -2
  49. package/dist/types/components/ez-popup/ez-popup.d.ts +1 -0
  50. package/dist/types/components/ez-tree/ez-tree.d.ts +20 -1
  51. package/dist/types/components/ez-tree/types/Node.d.ts +1 -0
  52. package/dist/types/components/ez-tree/types/Tree.d.ts +1 -0
  53. package/dist/types/components/ez-tree/types/UpdateItemConfig.d.ts +4 -0
  54. package/dist/types/components.d.ts +18 -1
  55. package/dist/types/utils/form/FormMetadata.d.ts +2 -1
  56. package/dist/types/utils/form/interfaces/IFormSheetMetadata.d.ts +3 -0
  57. package/dist/types/utils/form/interfaces/ITabConfig.d.ts +3 -0
  58. package/package.json +1 -1
  59. package/dist/ezui/p-02f6e3b0.entry.js +0 -1
  60. package/dist/ezui/p-191cfbc8.entry.js +0 -1
  61. package/dist/ezui/p-228a4d2f.js +0 -3
  62. package/dist/ezui/p-2df50161.entry.js +0 -1
  63. package/dist/ezui/p-4c4f0850.entry.js +0 -1
  64. package/dist/ezui/p-623161e2.js +0 -1
  65. package/dist/ezui/p-bd6146c5.entry.js +0 -1
@@ -8,9 +8,11 @@
8
8
  /*@doc Define a cor de fundo do botão de fechar.*/
9
9
  --dialog__btn__close--background-color: var(--title--primary, #2b3a54);
10
10
  /*@doc Define o espaçamento direito do botão de negação.*/
11
- --dialog__btn__no--padding-right: var(--space--large, 24px);
11
+ --dialog__btn__no--padding-right: var(--space--8, 8px);
12
12
  /*@doc Contém a imagem do ícone de fechamento.*/
13
13
  --dialog__btn__close__image: url('data:image/svg+xml;utf8,<svg width="12" height="12" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg%22%3E<path d="M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z"/></svg>');
14
+ /*@doc Define a largura mínima dos botões.*/
15
+ --dialog__btn__min-width: 80px;
14
16
 
15
17
  /* Título */
16
18
  /*@doc Define o estilo da mensagem exibida no título.*/
@@ -245,6 +247,7 @@ h2 {
245
247
 
246
248
  .button__cancel {
247
249
  padding-right: var(--dialog__btn__no--padding-right);
250
+ --ez-button--min-width: var(--dialog__btn__min-width);
248
251
  }
249
252
 
250
253
  .button__confirm{
@@ -252,6 +255,7 @@ h2 {
252
255
  --ez-button--color: var(--color--inverted);
253
256
  --ez-button--hover--background-color: var(--color--primary-600);
254
257
  --ez-button--hover-color: var(--color--inverted);
258
+ --ez-button--min-width: var(--dialog__btn__min-width);
255
259
  }
256
260
 
257
261
  .button__confirm--danger{
@@ -259,6 +263,7 @@ h2 {
259
263
  --ez-button--color: var(--color--inverted);
260
264
  --ez-button--hover--background-color: var(--color-alert--error-900, #a10020);
261
265
  --ez-button--hover-color: var(--color--inverted);
266
+ --ez-button--min-width: var(--dialog__btn__min-width);
262
267
  }
263
268
 
264
269
  .button__confirm--container {
@@ -763,7 +763,7 @@ export default class AgGridController {
763
763
  const colDefsWithConfigs = this.getColsDefWithConfigApplied(colDefs, this._lastColsConfig);
764
764
  this._gridOptions.api.setColumnDefs(colDefsWithConfigs);
765
765
  }
766
- getColsDefWithConfigApplied(colDefs, colsConfig) {
766
+ getColsDefWithConfigApplied(colDefs, colsConfig = []) {
767
767
  //Cria map de colunas existentes na config e seu índice
768
768
  const orderMap = colsConfig.reduce((map, col, index) => {
769
769
  map[col.name] = index;
@@ -1,8 +1,8 @@
1
1
  :host {
2
2
  --ez-modal-container-overflow-y: auto;
3
3
  --ez-modal-container-overflow-x: hidden;
4
- display: grid;
5
- grid-template-rows: 0 auto 1fr auto 0;
4
+ display: flex;
5
+ flex-direction: column;
6
6
  width: 100%;
7
7
  height: 100%;
8
8
  }
@@ -35,7 +35,7 @@
35
35
  display: flex;
36
36
  flex-direction: row;
37
37
  justify-content: flex-end;
38
- gap: var(--space--medium);
38
+ gap: var(--space--8, 8px);
39
39
  width: 100%;
40
40
  padding-top: var(--space--small, 6px);
41
41
  }
@@ -55,9 +55,3 @@
55
55
  .ez-modal-container__close-icon {
56
56
  --icon--color: var(--title--primary, #2B3A54)
57
57
  }
58
-
59
- .ez-modal-container__focus-ctrl {
60
- height: 0px;
61
- background-color: transparent;
62
- border: none;
63
- }
@@ -46,17 +46,8 @@ export class EzModalContainer {
46
46
  closeModal() {
47
47
  this.ezModalAction.emit("CLOSE");
48
48
  }
49
- focusLast() {
50
- if (this._okButton == undefined) {
51
- return;
52
- }
53
- this._okButton.setFocus();
54
- }
55
- focusFirst() {
56
- this._closeButton.focus();
57
- }
58
49
  render() {
59
- return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE), "aria-label": this.i18n("app.close") }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("div", { tabIndex: -1, class: "ez-modal-container__content" }, h("slot", null)), h("div", { tabIndex: -1, class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel || this.i18n("app.cancel"), enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel || this.i18n("app.ok"), enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
50
+ return (h(Host, null, h("header", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE), "aria-label": this.i18n("app.close") }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("main", { tabIndex: -1, class: "ez-modal-container__content" }, h("slot", null)), h("footer", { tabIndex: -1, class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel || this.i18n("app.cancel"), isDisabled: this.cancelButtonStatus === ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel || this.i18n("app.ok"), isDisabled: this.okButtonStatus === ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) })))));
60
51
  }
61
52
  static get is() { return "ez-modal-container"; }
62
53
  static get encapsulation() { return "scoped"; }
@@ -72,17 +72,17 @@
72
72
  }
73
73
 
74
74
  .popup__expandable-content {
75
+ flex-grow: 1;
75
76
  box-sizing: border-box;
76
77
  width: 100%;
77
- flex: 1;
78
78
  font-family: var(--font--pattern, "Roboto");
79
79
  font-size: var(--font-size--default, 14px);
80
80
  color: var(--title--primary, #00281D);
81
81
  font-weight: var(--font-weight--regular, 400);
82
- line-height: var(--line-height--24, 24px);
83
82
  }
84
83
 
85
84
  .popup__header {
85
+ flex-shrink: 0;
86
86
  width: 100%;
87
87
  display: flex;
88
88
  align-items: center;
@@ -115,6 +115,7 @@
115
115
  }
116
116
 
117
117
  .popup__footer {
118
+ flex-shrink: 0;
118
119
  display: flex;
119
120
  width: 100%;
120
121
  flex-direction: row-reverse;
@@ -8,7 +8,7 @@ export class EzPopup {
8
8
  this.useHeader = true;
9
9
  this.heightMode = "full";
10
10
  this.ezTitle = undefined;
11
- this.enabledScroll = false;
11
+ this.enabledScroll = true;
12
12
  this.autoClose = true;
13
13
  this.footerButtons = [];
14
14
  }
@@ -78,9 +78,6 @@ export class EzPopup {
78
78
  if (this.heightMode === 'auto') {
79
79
  className += ' popup__container--auto';
80
80
  }
81
- if (this.enabledScroll) {
82
- className += ' popup__overflow-y--auto';
83
- }
84
81
  className += ` ${this.getGridSize()}`;
85
82
  return className;
86
83
  }
@@ -141,9 +138,15 @@ export class EzPopup {
141
138
  };
142
139
  }
143
140
  }
141
+ renderFooterButtons() {
142
+ return this.footerButtons.slice(0, 3).map((buttonProps, index) => (h("ez-button", Object.assign({ key: index }, this.handleDefaultPropsButtonsByIndex(index), buttonProps))));
143
+ }
144
144
  render() {
145
145
  return (h(Host, null, this.opened && (h("div", { class: "overlay", tabIndex: -1, onClick: this.handleAutoClose.bind(this) }, h("dialog", { ref: ref => this._popupRef = ref, class: this.getDialogClass() }, this.useHeader &&
146
- h("header", { class: "popup__header" }, !!this.ezTitle && h("h1", { class: "popup__title" }, this.ezTitle), h("ez-button", { class: this.ezTitle ? "btn-close" : "btn-close btn-close--solo", variant: "tertiary", mode: "icon", iconName: "close", size: "small", onClick: this.closePopup.bind(this) })), h("main", { class: "popup__expandable-content" }, h("slot", null)), this.footerButtons.length > 0 && (h("footer", { class: "popup__footer" }, this.footerButtons.slice(0, 3).map((buttonProps, index) => (h("ez-button", Object.assign({ key: index }, this.handleDefaultPropsButtonsByIndex(index), buttonProps)))))))))));
146
+ h("header", { class: "popup__header" }, !!this.ezTitle && h("h1", { class: "popup__title" }, this.ezTitle), h("ez-button", { class: this.ezTitle ? "btn-close" : "btn-close btn-close--solo", variant: "tertiary", mode: "icon", iconName: "close", size: "small", onClick: this.closePopup.bind(this) })), h("main", { class: {
147
+ "popup__expandable-content": true,
148
+ "popup__overflow-y--auto": this.enabledScroll
149
+ } }, h("slot", null)), h("footer", { class: "popup__footer" }, this.footerButtons.length > 0 && (this.renderFooterButtons()), h("slot", { name: 'footer' })))))));
147
150
  }
148
151
  static get is() { return "ez-popup"; }
149
152
  static get encapsulation() { return "shadow"; }
@@ -264,7 +267,7 @@ export class EzPopup {
264
267
  },
265
268
  "attribute": "enabled-scroll",
266
269
  "reflect": false,
267
- "defaultValue": "false"
270
+ "defaultValue": "true"
268
271
  },
269
272
  "autoClose": {
270
273
  "type": "boolean",
@@ -8,6 +8,9 @@
8
8
  --ez-tree--margin: var(--space--extra-small, 3px);
9
9
  /*@doc Define a margem da direita do componente.*/
10
10
  --ez-tree--margin-right: 0px;
11
+
12
+ /*@doc Define se o texto dos itens pode ser selecionado pelo usuário.*/
13
+ --ez-tree--user-select: auto;
11
14
 
12
15
  /* Fontes e cor de ícones*/
13
16
  /*@doc Define a família da fonte.*/
@@ -197,6 +200,7 @@ ul.first-level {
197
200
  text-overflow: ellipsis;
198
201
  overflow: hidden;
199
202
  white-space: nowrap;
203
+ user-select: var(--ez-tree--user-select);
200
204
 
201
205
  /*public*/
202
206
  font-family: var(--ez-tree--font-family);
@@ -7,11 +7,18 @@ import initI18n from '../../utils/i18n';
7
7
  export class EzTree {
8
8
  constructor() {
9
9
  this._onItemClick = (item) => {
10
- this._onIconClick(item);
10
+ if (!this.selectable) {
11
+ this.openClose(item);
12
+ return;
13
+ }
14
+ if (this.value && this.value.id === item.id) {
15
+ this.value = undefined;
16
+ return;
17
+ }
18
+ this.value = item;
11
19
  };
12
20
  this._onIconClick = (item) => {
13
21
  this.openClose(item);
14
- this.value = item;
15
22
  };
16
23
  this._tree = new Tree(() => forceUpdate(this));
17
24
  this._waintingForLoad = undefined;
@@ -21,6 +28,7 @@ export class EzTree {
21
28
  this.iconResolver = defaultIconResolver;
22
29
  this.tooltipResolver = undefined;
23
30
  this.enableHierarchicalFilter = true;
31
+ this.selectable = true;
24
32
  }
25
33
  /**
26
34
  * Efetua a seleção de um item.
@@ -71,10 +79,14 @@ export class EzTree {
71
79
  parentId = (_a = this.value) === null || _a === void 0 ? void 0 : _a.id;
72
80
  }
73
81
  this._tree.addChildAt(parentId, item);
82
+ this.addItemInIndexedList(parentId, item);
74
83
  const node = this._tree.getNode(parentId);
75
84
  if (node) {
76
85
  node.item.expanded = true;
77
86
  }
87
+ else {
88
+ this.collapseAll();
89
+ }
78
90
  }
79
91
  /**
80
92
  * Efetua a seleção de um item.
@@ -97,12 +109,48 @@ export class EzTree {
97
109
  /**
98
110
  * Atualiza um item
99
111
  */
100
- async updateItem(item) {
101
- var _a;
102
- this._tree.updateItem(item);
112
+ async updateItem(item, config) {
113
+ var _a, _b, _c;
114
+ if (Array.isArray(item)) {
115
+ item.forEach(i => this.updateItem(i, config));
116
+ return;
117
+ }
118
+ if (config === null || config === void 0 ? void 0 : config.updatedBySelectedId) {
119
+ Object.assign(item, { id: this.selectedId });
120
+ }
121
+ this._tree.updateItem((config === null || config === void 0 ? void 0 : config.forceDefaultValues) ? this.applyDefaultValues(item) : item);
122
+ this.updateItemInIndexedList(item, config === null || config === void 0 ? void 0 : config.forceDefaultValues);
103
123
  const node = (_a = this._tree) === null || _a === void 0 ? void 0 : _a.getNode(this.selectedId);
104
124
  if (node == undefined) {
105
125
  this.value = this._visibleItems ? this._visibleItems[0] : undefined;
126
+ this._tree.collapseAll();
127
+ }
128
+ if (((_b = this.value) === null || _b === void 0 ? void 0 : _b.id) === item.id) {
129
+ this.value = item;
130
+ this.ezChange.emit(this.value);
131
+ return;
132
+ }
133
+ const childSelected = this.getItemById((_c = this.value) === null || _c === void 0 ? void 0 : _c.id, [item]);
134
+ if (childSelected) {
135
+ this.value = childSelected;
136
+ this.ezChange.emit(this.value);
137
+ }
138
+ }
139
+ /**
140
+ * Remove um item da árvore pelo seu ID.
141
+ * Se o item removido estiver selecionado, a seleção será limpa.
142
+ */
143
+ async removeItem(id) {
144
+ var _a;
145
+ id = id !== null && id !== void 0 ? id : this.selectedId;
146
+ if (!id) {
147
+ return;
148
+ }
149
+ this._tree.removeItem(id);
150
+ this.removeItemFromIndexedList(id);
151
+ this.ezRemoveItem.emit(id);
152
+ if (((_a = this.value) === null || _a === void 0 ? void 0 : _a.id) === id) {
153
+ this.value = undefined;
106
154
  }
107
155
  }
108
156
  /**
@@ -190,6 +238,75 @@ export class EzTree {
190
238
  event.preventDefault();
191
239
  }
192
240
  }
241
+ getItemById(id, items) {
242
+ for (const treeItem of items) {
243
+ if (treeItem.id === id) {
244
+ return treeItem;
245
+ }
246
+ else if (treeItem.children && Array.isArray(treeItem.children)) {
247
+ const itemFound = this.getItemById(id, treeItem.children);
248
+ if (itemFound) {
249
+ return itemFound;
250
+ }
251
+ }
252
+ }
253
+ return undefined;
254
+ }
255
+ addItemInIndexedList(parentId, item, items) {
256
+ var _a, _b;
257
+ items = (_a = items !== null && items !== void 0 ? items : this.items) !== null && _a !== void 0 ? _a : [];
258
+ if (!parentId) {
259
+ items.push(item);
260
+ }
261
+ const itemFound = this.getItemById(parentId, items);
262
+ itemFound.children = ((_b = itemFound.children) !== null && _b !== void 0 ? _b : []);
263
+ itemFound.children.push(item);
264
+ itemFound.childrenCount = itemFound.children.length;
265
+ }
266
+ applyDefaultValues(item) {
267
+ if (item.disabled === undefined) {
268
+ item.disabled = false;
269
+ }
270
+ if (item.expanded === undefined) {
271
+ item.expanded = false;
272
+ }
273
+ return item;
274
+ }
275
+ updateItemInIndexedList(item, forceDefaultValues = false) {
276
+ if (!item || !this.items) {
277
+ return;
278
+ }
279
+ const itemFound = this.getItemById(item.id, this.items);
280
+ if (itemFound) {
281
+ Object.assign(itemFound, forceDefaultValues ? this.applyDefaultValues(item) : item);
282
+ }
283
+ }
284
+ removeItemFromIndexedList(id, items) {
285
+ var _a;
286
+ items = (_a = items !== null && items !== void 0 ? items : this.items) !== null && _a !== void 0 ? _a : [];
287
+ if (!id) {
288
+ return false;
289
+ }
290
+ const rootIndex = items.findIndex(item => item.id === id);
291
+ if (rootIndex !== -1) {
292
+ items.splice(rootIndex, 1);
293
+ return true;
294
+ }
295
+ for (const treeItem of items) {
296
+ if (treeItem.children && Array.isArray(treeItem.children)) {
297
+ const childIndex = treeItem.children.findIndex(child => child.id === id);
298
+ if (childIndex !== -1) {
299
+ treeItem.children.splice(childIndex, 1);
300
+ treeItem.childrenCount = treeItem.children.length;
301
+ return true;
302
+ }
303
+ if (this.removeItemFromIndexedList(id, treeItem.children)) {
304
+ return true;
305
+ }
306
+ }
307
+ }
308
+ return false;
309
+ }
193
310
  getItemPathAttrs({ id, label }) {
194
311
  return { id, label };
195
312
  }
@@ -427,6 +544,24 @@ export class EzTree {
427
544
  "attribute": "enable-hierarchical-filter",
428
545
  "reflect": false,
429
546
  "defaultValue": "true"
547
+ },
548
+ "selectable": {
549
+ "type": "boolean",
550
+ "mutable": false,
551
+ "complexType": {
552
+ "original": "boolean",
553
+ "resolved": "boolean",
554
+ "references": {}
555
+ },
556
+ "required": false,
557
+ "optional": false,
558
+ "docs": {
559
+ "tags": [],
560
+ "text": "Define se os itens da \u00E1rvore s\u00E3o selecion\u00E1veis."
561
+ },
562
+ "attribute": "selectable",
563
+ "reflect": false,
564
+ "defaultValue": "true"
430
565
  }
431
566
  };
432
567
  }
@@ -497,6 +632,21 @@ export class EzTree {
497
632
  }
498
633
  }
499
634
  }
635
+ }, {
636
+ "method": "ezRemoveItem",
637
+ "name": "ezRemoveItem",
638
+ "bubbles": true,
639
+ "cancelable": true,
640
+ "composed": true,
641
+ "docs": {
642
+ "tags": [],
643
+ "text": "Emitido ao remover um item da \u00E1rvore."
644
+ },
645
+ "complexType": {
646
+ "original": "string",
647
+ "resolved": "string",
648
+ "references": {}
649
+ }
500
650
  }];
501
651
  }
502
652
  static get methods() {
@@ -662,10 +812,13 @@ export class EzTree {
662
812
  },
663
813
  "updateItem": {
664
814
  "complexType": {
665
- "signature": "(item: ITreeItem) => Promise<void>",
815
+ "signature": "(item: ITreeItem | ITreeItem[], config?: Partial<UpdateItemConfig>) => Promise<void>",
666
816
  "parameters": [{
667
817
  "tags": [],
668
818
  "text": ""
819
+ }, {
820
+ "tags": [],
821
+ "text": ""
669
822
  }],
670
823
  "references": {
671
824
  "Promise": {
@@ -674,6 +827,13 @@ export class EzTree {
674
827
  "ITreeItem": {
675
828
  "location": "import",
676
829
  "path": "./interfaces/ITreeItem"
830
+ },
831
+ "Partial": {
832
+ "location": "global"
833
+ },
834
+ "UpdateItemConfig": {
835
+ "location": "import",
836
+ "path": "./types/UpdateItemConfig"
677
837
  }
678
838
  },
679
839
  "return": "Promise<void>"
@@ -683,6 +843,25 @@ export class EzTree {
683
843
  "tags": []
684
844
  }
685
845
  },
846
+ "removeItem": {
847
+ "complexType": {
848
+ "signature": "(id?: string) => Promise<void>",
849
+ "parameters": [{
850
+ "tags": [],
851
+ "text": ""
852
+ }],
853
+ "references": {
854
+ "Promise": {
855
+ "location": "global"
856
+ }
857
+ },
858
+ "return": "Promise<void>"
859
+ },
860
+ "docs": {
861
+ "text": "Remove um item da \u00E1rvore pelo seu ID.\nSe o item removido estiver selecionado, a sele\u00E7\u00E3o ser\u00E1 limpa.",
862
+ "tags": []
863
+ }
864
+ },
686
865
  "getItem": {
687
866
  "complexType": {
688
867
  "signature": "(id: string) => Promise<ITreeItem>",
@@ -20,12 +20,15 @@ export const TreeItem = (props) => {
20
20
  iconClick(treeItem);
21
21
  }
22
22
  }
23
+ function handleIconDoubleClick(event) {
24
+ event.stopPropagation();
25
+ }
23
26
  return (h("ul", { class: level === 1 ? "first-level" : undefined }, h("li", Object.assign({ title: tooltipResolver(treeItem, !disabled, level), class: `tree-item ${treeItem.id !== selectedId ? "tree-item-error" : ""}`, onClick: () => available && itemClick(treeItem), onDblClick: () => available && itemDoubleClick(treeItem) }, {
24
27
  disabled,
25
28
  selected: treeItem.id === selectedId,
26
29
  [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezTreeItem_${treeItem.id}`)
27
30
  }), h("div", { class: "item-label-container" }, h("div", { class: "item-icon-box" }, expandable &&
28
- h("ez-icon", { id: treeItem.id, class: "item-icon", size: "small", iconName: iconResolver(treeItem, expanded, level), onClick: (event) => handleIconClick(event) })), h("label", { class: `item-label ${treeItem.bold ? "item-label--bold" : ""}` }, treeItem.label)), getBadgeElement(treeItem.id, treeItem.badge, treeItem.id === selectedId)), expanded
31
+ h("ez-icon", { id: treeItem.id, class: "item-icon", size: "small", iconName: iconResolver(treeItem, expanded, level), onClick: (event) => handleIconClick(event), onDblClick: (event) => handleIconDoubleClick(event) })), h("label", { class: `item-label ${treeItem.bold ? "item-label--bold" : ""}` }, treeItem.label)), getBadgeElement(treeItem.id, treeItem.badge, treeItem.id === selectedId)), expanded
29
32
  && node.getChildren().map(child => h(TreeItem, { selectedId: selectedId, node: child, itemClick: itemClick, iconClick: iconClick, level: level + 1, iconResolver: iconResolver, tooltipResolver: tooltipResolver, itemsList: itemsList, itemDoubleClick: itemDoubleClick }))));
30
33
  };
31
34
  function getBadgeElement(itemId, badge, isSelectedItem) {
@@ -69,6 +69,13 @@ export class Node {
69
69
  this.children.set(item.id, new Node(tree, item, this));
70
70
  }
71
71
  }
72
+ removeChild(id) {
73
+ if (this.children.has(id)) {
74
+ this.children.delete(id);
75
+ return true;
76
+ }
77
+ return false;
78
+ }
72
79
  addPlaceHolder() {
73
80
  this.children.clear();
74
81
  const id = this.item.id;
@@ -9,6 +9,8 @@ export class Tree extends Node {
9
9
  async addChildAt(parentId, item) {
10
10
  const parent = this.getNode(parentId);
11
11
  if (parent == undefined) {
12
+ this.addChild(this, item);
13
+ this._changeCallback();
12
14
  return;
13
15
  }
14
16
  parent.addChild(this, item);
@@ -72,6 +74,23 @@ export class Tree extends Node {
72
74
  }
73
75
  this._changeCallback();
74
76
  }
77
+ removeItem(id) {
78
+ if (!id) {
79
+ return;
80
+ }
81
+ const node = this.getNode(id);
82
+ if (!node) {
83
+ return;
84
+ }
85
+ if (node.parent) {
86
+ node.parent.removeChild(id);
87
+ }
88
+ else {
89
+ this.children.delete(id);
90
+ }
91
+ this._disabledValues.delete(id);
92
+ this._changeCallback();
93
+ }
75
94
  async open(path) {
76
95
  return new Promise(async (resolve) => {
77
96
  await this.walkPath(this, path, node => node.item.expanded = true);
@@ -120,7 +120,7 @@ export default class DataBinder {
120
120
  clearFieldError(fieldName) {
121
121
  var _a;
122
122
  const field = (_a = this._fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.field;
123
- if (field["errorMessage"]) {
123
+ if (field && field["errorMessage"]) {
124
124
  field["errorMessage"] = "";
125
125
  this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
126
126
  }