@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-50051.3 → 0.0.0-bugfix-dev-KB-39550.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.
Files changed (58) hide show
  1. package/dist/cjs/ez-alert-list.cjs.entry.js +5 -2
  2. package/dist/cjs/ez-grid.cjs.entry.js +20 -15
  3. package/dist/cjs/ez-modal-container.cjs.entry.js +5 -6
  4. package/dist/cjs/ez-popup.cjs.entry.js +5 -5
  5. package/dist/cjs/ez-scroller_3.cjs.entry.js +18 -4
  6. package/dist/cjs/ez-search.cjs.entry.js +5 -15
  7. package/dist/cjs/ez-split-button.cjs.entry.js +25 -6
  8. package/dist/cjs/ez-split-item.cjs.entry.js +2 -2
  9. package/dist/cjs/ezui.cjs.js +1 -1
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/collection/components/ez-alert-list/ez-alert-list.js +10 -2
  12. package/dist/collection/components/ez-grid/ez-grid.js +20 -15
  13. package/dist/collection/components/ez-modal-container/ez-modal-container.js +5 -15
  14. package/dist/collection/components/ez-popup/ez-popup.js +6 -15
  15. package/dist/collection/components/ez-search/ez-search.js +5 -15
  16. package/dist/collection/components/ez-split-button/ez-split-button.js +25 -6
  17. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +4 -0
  18. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +1 -1
  19. package/dist/collection/components/ez-tree/ez-tree.css +26 -0
  20. package/dist/collection/components/ez-tree/interfaces/ITreeItemBadge.js +1 -0
  21. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +15 -2
  22. package/dist/custom-elements/index.js +88 -59
  23. package/dist/esm/ez-alert-list.entry.js +5 -2
  24. package/dist/esm/ez-grid.entry.js +20 -15
  25. package/dist/esm/ez-modal-container.entry.js +5 -6
  26. package/dist/esm/ez-popup.entry.js +6 -6
  27. package/dist/esm/ez-scroller_3.entry.js +18 -4
  28. package/dist/esm/ez-search.entry.js +5 -15
  29. package/dist/esm/ez-split-button.entry.js +25 -6
  30. package/dist/esm/ez-split-item.entry.js +2 -2
  31. package/dist/esm/ezui.js +1 -1
  32. package/dist/esm/loader.js +1 -1
  33. package/dist/ezui/ezui.esm.js +1 -1
  34. package/dist/ezui/p-2eb8f73b.entry.js +1 -0
  35. package/dist/ezui/p-3faa2b46.entry.js +1 -0
  36. package/dist/ezui/p-701231f0.entry.js +1 -0
  37. package/dist/ezui/p-7a636dfc.entry.js +1 -0
  38. package/dist/ezui/p-91f626d3.entry.js +1 -0
  39. package/dist/ezui/p-a1ec32ef.entry.js +1 -0
  40. package/dist/ezui/p-e228ccb9.entry.js +1 -0
  41. package/dist/ezui/{p-031784b0.entry.js → p-fb5adf9e.entry.js} +1 -1
  42. package/dist/types/components/ez-grid/ez-grid.d.ts +1 -0
  43. package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +0 -1
  44. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +1 -1
  45. package/dist/types/components/ez-popup/ez-popup.d.ts +2 -1
  46. package/dist/types/components/ez-search/ez-search.d.ts +0 -1
  47. package/dist/types/components/ez-split-button/ez-split-button.d.ts +3 -0
  48. package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +3 -1
  49. package/dist/types/components/ez-tree/interfaces/ITreeItemBadge.d.ts +6 -0
  50. package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +0 -1
  51. package/package.json +1 -1
  52. package/dist/ezui/p-3376ad44.entry.js +0 -1
  53. package/dist/ezui/p-58fae29b.entry.js +0 -1
  54. package/dist/ezui/p-8c82374d.entry.js +0 -1
  55. package/dist/ezui/p-8e7031a0.entry.js +0 -1
  56. package/dist/ezui/p-9aefaa52.entry.js +0 -1
  57. package/dist/ezui/p-a08b309b.entry.js +0 -1
  58. package/dist/ezui/p-b9fbf4e7.entry.js +0 -1
@@ -94,9 +94,6 @@ export class EzGrid {
94
94
  return Promise.resolve(this._gridController.getColumnsState().filter(col => matches(col.label, search)));
95
95
  }
96
96
  observeConfig(config) {
97
- if (!config) {
98
- return;
99
- }
100
97
  this._gridController.setColumnsState(config.columns);
101
98
  }
102
99
  updatePaginationTooltip() {
@@ -155,21 +152,29 @@ export class EzGrid {
155
152
  return newConfig;
156
153
  }
157
154
  positionSelectionCounter() {
158
- var _a;
159
- if (this._gridSelectionCounter == undefined) {
155
+ var _a, _b;
156
+ if (!this._gridSelectionCounter)
160
157
  return;
161
- }
162
- if (this._showSelectionCounter) {
163
- const boundingContainer = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
164
- if (boundingContainer == undefined) {
165
- return;
166
- }
167
- const limitBottom = boundingContainer.bottom - 30;
168
- this._gridSelectionCounter.style.bottom = document.body.clientHeight - limitBottom + 'px';
169
- }
170
- else {
158
+ if (!this._showSelectionCounter) {
171
159
  this._gridSelectionCounter.style.bottom = '';
160
+ return;
161
+ }
162
+ const containerRect = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
163
+ const selectionRect = (_b = this._gridSelectionCounter) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
164
+ if (!containerRect || !selectionRect)
165
+ return;
166
+ const positionBottom = containerRect.bottom - 30;
167
+ this._gridSelectionCounter.style.bottom = document.body.clientHeight - positionBottom + 'px';
168
+ this._gridSelectionCounter.style.left = this.calculatePositionLeft(containerRect, selectionRect);
169
+ }
170
+ calculatePositionLeft(containerRect, selectionRect) {
171
+ let selectionStart = containerRect.left + (containerRect.width / 2);
172
+ const containerRightEdge = containerRect.left + this._container.clientWidth;
173
+ const selectionEnd = (selectionStart - (selectionRect.width / 2)) + selectionRect.width;
174
+ if (selectionEnd > containerRightEdge) {
175
+ selectionStart = containerRightEdge - (selectionRect.width / 2);
172
176
  }
177
+ return `${selectionStart}px`;
173
178
  }
174
179
  setEvents() {
175
180
  window.removeEventListener('scroll', this.positionSelectionCounter.bind(this));
@@ -1,4 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
+ import { KeyboardManager } from "@sankhyalabs/core";
2
3
  import ModalAction from "./modal-action";
3
4
  import ModalButtonStatus from "./modal-button-status";
4
5
  export class EzModalContainer {
@@ -11,12 +12,6 @@ export class EzModalContainer {
11
12
  this.cancelButtonStatus = undefined;
12
13
  this.okButtonStatus = undefined;
13
14
  }
14
- handleKeyDown(event) {
15
- if (event.key === 'Escape' || event.key === 'Esc')
16
- this.ezModalAction.emit(ModalAction.CANCEL);
17
- if (event.key === 'Enter')
18
- this.ezModalAction.emit(ModalAction.OK);
19
- }
20
15
  cancelIsVisible() {
21
16
  return (this.cancelButtonStatus !== ModalButtonStatus.HIDDEN && this.cancelButtonLabel != undefined);
22
17
  }
@@ -27,6 +22,10 @@ export class EzModalContainer {
27
22
  window.requestAnimationFrame(() => {
28
23
  this.ezModalAction.emit(ModalAction.LOAD);
29
24
  });
25
+ new KeyboardManager({ propagate: false, element: this._element })
26
+ .bind("Enter", this.ezModalAction.emit.bind(ModalAction.OK))
27
+ .bind("Escape", this.ezModalAction.emit.bind(ModalAction.CANCEL))
28
+ .bind("Esc", this.ezModalAction.emit.bind(ModalAction.CANCEL));
30
29
  }
31
30
  focusLast() {
32
31
  if (this._okButton == undefined) {
@@ -194,13 +193,4 @@ export class EzModalContainer {
194
193
  }
195
194
  }];
196
195
  }
197
- static get listeners() {
198
- return [{
199
- "name": "keydown",
200
- "method": "handleKeyDown",
201
- "target": "window",
202
- "capture": false,
203
- "passive": false
204
- }];
205
- }
206
196
  }
@@ -1,5 +1,5 @@
1
1
  import { Host, h, Fragment } from "@stencil/core";
2
- import { FloatingManager } from '@sankhyalabs/core';
2
+ import { FloatingManager, KeyboardManager } from '@sankhyalabs/core';
3
3
  export class EzPopup {
4
4
  constructor() {
5
5
  this._sizeClasses = {
@@ -19,11 +19,11 @@ export class EzPopup {
19
19
  observeConfig() {
20
20
  this.manageOverflow();
21
21
  }
22
- handleKeyDown(event) {
23
- if (event.key === 'Escape' || event.key === 'Esc')
24
- this.opened = false;
25
- if (event.key === 'Enter')
26
- this.ezPopupAction.emit("OK");
22
+ componentDidLoad() {
23
+ new KeyboardManager({ propagate: false, element: this._element })
24
+ .bind("Enter", this.ezPopupAction.emit.bind("OK"))
25
+ .bind("Escape", () => this.opened = false)
26
+ .bind("Esc", () => this.opened = false);
27
27
  }
28
28
  manageOverflow() {
29
29
  if (this.opened) {
@@ -198,13 +198,4 @@ export class EzPopup {
198
198
  "methodName": "observeConfig"
199
199
  }];
200
200
  }
201
- static get listeners() {
202
- return [{
203
- "name": "keydown",
204
- "method": "handleKeyDown",
205
- "target": "window",
206
- "capture": false,
207
- "passive": false
208
- }];
209
- }
210
201
  }
@@ -207,9 +207,6 @@ export class EzSearch {
207
207
  if (typeof value === "string" || value instanceof String) {
208
208
  return this._visibleOptions.find(o => o.value === value);
209
209
  }
210
- if (value) {
211
- return Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value === null || value === void 0 ? void 0 : value.value), label: this.replaceHighlight(value === null || value === void 0 ? void 0 : value.label) });
212
- }
213
210
  return value;
214
211
  }
215
212
  updateVisibleOptions() {
@@ -308,7 +305,7 @@ export class EzSearch {
308
305
  }
309
306
  scrollToOption(opt) {
310
307
  window.requestAnimationFrame(() => {
311
- const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`div#item_${this.replaceHighlight(opt.value).replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
308
+ const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`div#item_${opt.value.replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
312
309
  if (liElem)
313
310
  liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
314
311
  });
@@ -351,22 +348,15 @@ export class EzSearch {
351
348
  this._source = [];
352
349
  this.updateVisibleOptions();
353
350
  }
354
- replaceHighlight(value) {
355
- const startHighlight = new RegExp(this._startHighlightTag, 'g');
356
- const endHighlight = new RegExp(this._endHighlightTag, 'g');
357
- return (value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
358
- }
359
351
  selectOption(newOption) {
360
352
  var _a, _b;
361
353
  const currentValue = this.getSelectedOption(this.value);
362
- const newOptionsReplaced = Object.assign(Object.assign({}, newOption), { value: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.value), label: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.label) });
363
- if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) === null || _b === void 0 ? void 0 : _b.toString()))
364
- || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
365
- const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
354
+ if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString()))
355
+ || (currentValue == undefined && newOption != undefined && "value" in newOption)) {
356
+ const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
366
357
  this.value = adjustedOpt;
367
358
  }
368
359
  else {
369
- this.setInputValue();
370
360
  this.resetOptions();
371
361
  }
372
362
  this._visibleOptions = [];
@@ -476,7 +466,7 @@ export class EzSearch {
476
466
  return;
477
467
  }
478
468
  this._lookupMode = true;
479
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
469
+ this.value = value;
480
470
  }
481
471
  loadOptionValue(argument) {
482
472
  var _a;
@@ -65,22 +65,38 @@ export class EzSplitButton {
65
65
  evt.stopPropagation();
66
66
  this.closeDropdown();
67
67
  }
68
+ resolveOffsetParentRect() {
69
+ var _a, _b;
70
+ const offsetParentRect = (_b = (_a = this.dropdownParent) === null || _a === void 0 ? void 0 : _a.offsetParent) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
71
+ const scrollLeft = window.scrollX || document.documentElement.scrollLeft;
72
+ const scrollTop = window.scrollY || document.documentElement.scrollTop;
73
+ const rectWithoutScroll = {
74
+ top: (offsetParentRect === null || offsetParentRect === void 0 ? void 0 : offsetParentRect.top) + scrollTop,
75
+ left: (offsetParentRect === null || offsetParentRect === void 0 ? void 0 : offsetParentRect.left) + scrollLeft,
76
+ bottom: (offsetParentRect === null || offsetParentRect === void 0 ? void 0 : offsetParentRect.bottom) + scrollTop,
77
+ right: (offsetParentRect === null || offsetParentRect === void 0 ? void 0 : offsetParentRect.right) + scrollLeft,
78
+ width: offsetParentRect === null || offsetParentRect === void 0 ? void 0 : offsetParentRect.width,
79
+ height: offsetParentRect === null || offsetParentRect === void 0 ? void 0 : offsetParentRect.height
80
+ };
81
+ this.offsetParentRect = rectWithoutScroll;
82
+ }
68
83
  /**
69
84
  * Método responsável em posicionar o dropdown na tela.
70
85
  * Faz com que o dropdown se ajuste automaticamente ao espaco na tela
71
86
  */
72
87
  positionDropdown() {
88
+ var _a, _b, _c, _d, _e, _f;
73
89
  const { rightButton: _rightButton, dropdownParent: _dropdownParent } = this;
74
90
  const rightButtonRect = _rightButton.getBoundingClientRect();
75
91
  const dropdownParentRect = _dropdownParent.getBoundingClientRect();
76
- const spaceBelow = window.innerHeight - rightButtonRect.bottom;
77
- const spaceAbove = rightButtonRect.top;
78
- const spaceRight = window.innerWidth - rightButtonRect.right;
92
+ const spaceBelow = window.innerHeight - (rightButtonRect.bottom + ((_a = this.offsetParentRect) === null || _a === void 0 ? void 0 : _a.top));
93
+ const spaceAbove = rightButtonRect.top + ((_b = this.offsetParentRect) === null || _b === void 0 ? void 0 : _b.top);
94
+ const spaceRight = window.innerWidth - (rightButtonRect.left + ((_c = this.offsetParentRect) === null || _c === void 0 ? void 0 : _c.left));
79
95
  const spaceLeft = rightButtonRect.left;
80
96
  const hasSpaceBelow = spaceBelow < dropdownParentRect.height && spaceAbove > dropdownParentRect.height;
81
97
  const hasSpaceRight = spaceRight < dropdownParentRect.width && spaceLeft > dropdownParentRect.width;
82
- let top = `${rightButtonRect.bottom + window.scrollY}px`;
83
- let left = `${rightButtonRect.left + window.scrollX}px`;
98
+ let top = `${rightButtonRect.bottom - ((_d = this.offsetParentRect) === null || _d === void 0 ? void 0 : _d.top) + window.scrollY}px`;
99
+ let left = `${rightButtonRect.left - ((_e = this.offsetParentRect) === null || _e === void 0 ? void 0 : _e.left) + window.scrollX}px`;
84
100
  let bottom = 'auto';
85
101
  if (hasSpaceBelow) {
86
102
  bottom = `${window.innerHeight - rightButtonRect.top - window.scrollY}px`;
@@ -88,7 +104,7 @@ export class EzSplitButton {
88
104
  _dropdownParent.style.maxHeight = `${spaceAbove}px`;
89
105
  }
90
106
  if (hasSpaceRight) {
91
- left = `${rightButtonRect.right - dropdownParentRect.width + window.scrollX}px`;
107
+ left = `${rightButtonRect.right - dropdownParentRect.width - ((_f = this.offsetParentRect) === null || _f === void 0 ? void 0 : _f.left) + window.scrollX}px`;
92
108
  }
93
109
  _dropdownParent.style.top = top;
94
110
  _dropdownParent.style.bottom = bottom;
@@ -101,6 +117,9 @@ export class EzSplitButton {
101
117
  componentWillLoad() {
102
118
  this.setEvents();
103
119
  }
120
+ componentWillRender() {
121
+ this.resolveOffsetParentRect();
122
+ }
104
123
  componentDidLoad() {
105
124
  if (this._element)
106
125
  ElementIDUtils.addIDInfo(this._element);
@@ -59,4 +59,8 @@ ez-split-item {
59
59
  height: 100%;
60
60
  }
61
61
 
62
+ h3.ez-margin--small {
63
+ margin-left: var(--space--small);
64
+ }
65
+
62
66
 
@@ -17,7 +17,7 @@ export class SplitItem {
17
17
  CSSVarsUtils.applyVarsGrid(this._element, this._slot.children[0]);
18
18
  }
19
19
  render() {
20
- return (h(Host, { class: `box_split-item ${this._expanded ? 'expanded__item' : ''}`, ref: el => (this._element = el) }, h("div", { class: "ez-split-item--header" }, h("slot", { name: "leftButtons" }), h("div", { class: "ez-split-item--header-title" }, this.label && (h("h3", { class: "ez-margin--small ez-title ez-title--small", title: this.label }, this.label))), h("div", { class: "ez-split-item--header-buttons" }, this.enableExpand && (h("ez-button", { size: "small", mode: "icon", iconName: "expand", class: 'ez-button--tertiary', onClick: () => this.toggleExpandItem(), title: this._expanded ? 'Resumir' : 'Expandir' })), h("slot", { name: "rightButtons" }))), h("div", { class: "ez-split-item--content", ref: el => (this._slot = el) }, h("slot", null))));
20
+ return (h(Host, { class: `box_split-item ${this._expanded ? 'expanded__item' : ''}`, ref: el => (this._element = el) }, h("div", { class: "ez-split-item--header" }, h("slot", { name: "leftButtons" }), h("div", { class: "ez-split-item--header-title" }, this.label && (h("h3", { class: "ez-text ez-text--primary ez-title ez-title--small ez-margin--small", title: this.label }, this.label))), h("div", { class: "ez-split-item--header-buttons" }, this.enableExpand && (h("ez-button", { size: "small", mode: "icon", iconName: "expand", class: 'ez-button--tertiary', onClick: () => this.toggleExpandItem(), title: this._expanded ? 'Resumir' : 'Expandir' })), h("slot", { name: "rightButtons" }))), h("div", { class: "ez-split-item--content", ref: el => (this._slot = el) }, h("slot", null))));
21
21
  }
22
22
  static get is() { return "ez-split-item"; }
23
23
  static get originalStyleUrls() {
@@ -24,6 +24,8 @@
24
24
  --ez-tree--selected--color: var(--color--primary, #008561);
25
25
  /*@doc Define a cor da fonte e do ícone quando desabilitado.*/
26
26
  --ez-tree--disabled--color: var(--text--disable, #AFB6C0);
27
+ /*@doc Usado em fontes com peso maior (bold)*/
28
+ --ez-tree--font-weight--bold: var(--text-weight--large, 600);
27
29
 
28
30
  /* Item */
29
31
  /*@doc Define a altura de cada item.*/
@@ -47,6 +49,18 @@
47
49
  /*@doc Define o espaçamento interno do ícone.*/
48
50
  --ez-tree__item-icon-box--padding: var(--ez-tree__tree-item--padding);
49
51
 
52
+ /* Badge ícone - Cores */
53
+ /*@doc Cor de ícone de badge padrão.*/
54
+ --ez-tree__badge--icon-color--default: var(--title--primary, #2B3A54);
55
+ /*@doc Cor de ícone de badge de erro.*/
56
+ --ez-tree__badge--icon-color--error: var(--color--error, #da4453);
57
+ /*@doc Cor de ícone de badge sucesso.*/
58
+ --ez-tree__badge--icon-color--success: var(--color-alert--success-800, #157a00);
59
+ /*@doc Cor de ícone de badge de aviso.*/
60
+ --ez-tree__badge--icon-color--warning: var(--color--warning, #f2d410);
61
+ /*@doc Cor de ícone de badge desabilitado.*/
62
+ --ez-tree__badge--icon-color--disabled: var(--text--disable, #AFB6C0);
63
+
50
64
  /*private*/
51
65
  display: flex;
52
66
  flex-direction: column;
@@ -85,6 +99,14 @@ ul.first-level {
85
99
  --ez-icon--color: white;
86
100
  }
87
101
 
102
+ .tree-item-badge-text{
103
+ /*public*/
104
+ font-family: var(--ez-tree--font-family);
105
+ font-size: var(--ez-tree--font-size);
106
+ font-weight: var(--ez-tree--font-weight);
107
+ color: var(--ez-tree--color);
108
+ }
109
+
88
110
  .tree-item-badge.error{
89
111
  background: var(--color--error);
90
112
  }
@@ -180,6 +202,10 @@ ul.first-level {
180
202
  color: var(--ez-tree--color);
181
203
  }
182
204
 
205
+ .item-label--bold {
206
+ font-weight: var(--ez-tree--font-weight--bold);
207
+ }
208
+
183
209
  .tree-item[selected] .item-label {
184
210
  /*public*/
185
211
  color: var(--ez-tree--selected--color);
@@ -14,11 +14,24 @@ export const TreeItem = (props) => {
14
14
  if (available) {
15
15
  itemsList.push(treeItem);
16
16
  }
17
- 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) }, {
17
+ 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) }, {
18
18
  disabled,
19
19
  selected: treeItem.id === selectedId,
20
20
  [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezTreeItem_${treeItem.id}`)
21
21
  }), h("div", { class: "item-label-container" }, h("div", { class: "item-icon-box" }, expandable &&
22
- h("ez-icon", { id: treeItem.id, class: "item-icon", size: "small", iconName: iconResolver(treeItem, expanded, level), onClick: () => available && iconClick(treeItem) })), h("label", { class: "item-label" }, treeItem.label)), h("div", { class: `tree-item-badge ${(treeItem.id !== selectedId) ? treeItem.badge : null}` }, treeItem.badge === 'error' ? (h("ez-icon", { id: `${treeItem.id}-badge-error`, class: "tree-item-badge-error-icon", size: "x-small", style: { color: 'white' }, iconName: "alert-circle" })) : null)), expanded
22
+ h("ez-icon", { id: treeItem.id, class: "item-icon", size: "small", iconName: iconResolver(treeItem, expanded, level), onClick: () => available && iconClick(treeItem) })), h("label", { class: `item-label ${treeItem.bold ? "item-label--bold" : ""}` }, treeItem.label)), getBadgeElement(treeItem.id, treeItem.badge, treeItem.id === selectedId)), expanded
23
23
  && node.getChildren().map(child => h(TreeItem, { selectedId: selectedId, node: child, itemClick: itemClick, iconClick: iconClick, level: level + 1, iconResolver: iconResolver, tooltipResolver: tooltipResolver, itemsList: itemsList }))));
24
24
  };
25
+ function getBadgeElement(itemId, badge, isSelectedItem) {
26
+ if (badge == undefined) {
27
+ return;
28
+ }
29
+ if (typeof badge === "string") {
30
+ return h("div", { class: `tree-item-badge ${isSelectedItem ? null : badge}` }, badge === "error" &&
31
+ h("ez-icon", { id: `${itemId}-badge-error`, class: "tree-item-badge-error-icon", size: "x-small", style: { color: 'white' }, iconName: "alert-circle" }));
32
+ }
33
+ if (badge.type === "text") {
34
+ return h("div", { id: `${itemId}-badge-text`, class: "tree-item-badge-text" }, badge.text);
35
+ }
36
+ return h("div", null, h("ez-icon", { id: `${itemId}-badge-icon`, class: "tree-item-badge-icon", style: { "--ez-icon--color": `var(--ez-tree__badge--icon-color--${badge.iconColor || "default"})` }, iconName: badge.iconName }));
37
+ }