@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-50898.0 → 0.0.0-bugfix-dev-KB-50898.1
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/ez-alert-list.cjs.entry.js +5 -2
- package/dist/cjs/ez-grid.cjs.entry.js +21 -16
- package/dist/cjs/ez-modal-container.cjs.entry.js +5 -6
- package/dist/cjs/ez-popup.cjs.entry.js +5 -5
- package/dist/cjs/ez-scroller_3.cjs.entry.js +18 -4
- package/dist/cjs/ez-search.cjs.entry.js +15 -5
- package/dist/cjs/ez-split-button.cjs.entry.js +25 -6
- package/dist/cjs/ez-split-panel.cjs.entry.js +13 -5
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +10 -2
- package/dist/collection/components/ez-grid/ez-grid.js +21 -16
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +5 -15
- package/dist/collection/components/ez-popup/ez-popup.js +6 -15
- package/dist/collection/components/ez-search/ez-search.js +15 -5
- package/dist/collection/components/ez-split-button/ez-split-button.js +25 -6
- package/dist/collection/components/ez-split-panel/ez-split-panel.js +13 -5
- package/dist/collection/components/ez-tree/ez-tree.css +26 -0
- package/dist/collection/components/ez-tree/interfaces/ITreeItemBadge.js +1 -0
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +15 -2
- package/dist/custom-elements/index.js +110 -53
- package/dist/esm/ez-alert-list.entry.js +5 -2
- package/dist/esm/ez-grid.entry.js +21 -16
- package/dist/esm/ez-modal-container.entry.js +5 -6
- package/dist/esm/ez-popup.entry.js +6 -6
- package/dist/esm/ez-scroller_3.entry.js +18 -4
- package/dist/esm/ez-search.entry.js +15 -5
- package/dist/esm/ez-split-button.entry.js +25 -6
- package/dist/esm/ez-split-panel.entry.js +13 -5
- 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-031784b0.entry.js → p-384247cd.entry.js} +1 -1
- package/dist/ezui/p-3faa2b46.entry.js +1 -0
- package/dist/ezui/p-701231f0.entry.js +1 -0
- package/dist/ezui/p-91f626d3.entry.js +1 -0
- package/dist/ezui/p-9aefaa52.entry.js +1 -0
- package/dist/ezui/p-a1ec32ef.entry.js +1 -0
- package/dist/ezui/{p-65b3c23b.entry.js → p-af2ecb1b.entry.js} +1 -1
- package/dist/ezui/p-e228ccb9.entry.js +1 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +1 -0
- package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +0 -1
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +1 -1
- package/dist/types/components/ez-popup/ez-popup.d.ts +2 -1
- package/dist/types/components/ez-search/ez-search.d.ts +1 -0
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +3 -0
- package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +1 -0
- package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +3 -1
- package/dist/types/components/ez-tree/interfaces/ITreeItemBadge.d.ts +6 -0
- package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +0 -1
- package/package.json +1 -1
- package/dist/ezui/p-2eb8f73b.entry.js +0 -1
- package/dist/ezui/p-58fae29b.entry.js +0 -1
- package/dist/ezui/p-8c82374d.entry.js +0 -1
- package/dist/ezui/p-8e7031a0.entry.js +0 -1
- package/dist/ezui/p-a08b309b.entry.js +0 -1
- package/dist/ezui/p-b9fbf4e7.entry.js +0 -1
|
@@ -94,10 +94,7 @@ export class EzGrid {
|
|
|
94
94
|
return Promise.resolve(this._gridController.getColumnsState().filter(col => matches(col.label, search)));
|
|
95
95
|
}
|
|
96
96
|
observeConfig(config) {
|
|
97
|
-
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
this._gridController.setColumnsState(config.columns);
|
|
97
|
+
this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
|
|
101
98
|
}
|
|
102
99
|
updatePaginationTooltip() {
|
|
103
100
|
if (!this._refPaginationLabelTooltip)
|
|
@@ -155,21 +152,29 @@ export class EzGrid {
|
|
|
155
152
|
return newConfig;
|
|
156
153
|
}
|
|
157
154
|
positionSelectionCounter() {
|
|
158
|
-
var _a;
|
|
159
|
-
if (this._gridSelectionCounter
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
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,6 +207,9 @@ 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
|
+
}
|
|
210
213
|
return value;
|
|
211
214
|
}
|
|
212
215
|
updateVisibleOptions() {
|
|
@@ -305,7 +308,7 @@ export class EzSearch {
|
|
|
305
308
|
}
|
|
306
309
|
scrollToOption(opt) {
|
|
307
310
|
window.requestAnimationFrame(() => {
|
|
308
|
-
const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`div#item_${opt.value.replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
|
|
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;
|
|
309
312
|
if (liElem)
|
|
310
313
|
liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
311
314
|
});
|
|
@@ -348,15 +351,22 @@ export class EzSearch {
|
|
|
348
351
|
this._source = [];
|
|
349
352
|
this.updateVisibleOptions();
|
|
350
353
|
}
|
|
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
|
+
}
|
|
351
359
|
selectOption(newOption) {
|
|
352
360
|
var _a, _b;
|
|
353
361
|
const currentValue = this.getSelectedOption(this.value);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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;
|
|
357
366
|
this.value = adjustedOpt;
|
|
358
367
|
}
|
|
359
368
|
else {
|
|
369
|
+
this.setInputValue();
|
|
360
370
|
this.resetOptions();
|
|
361
371
|
}
|
|
362
372
|
this._visibleOptions = [];
|
|
@@ -466,7 +476,7 @@ export class EzSearch {
|
|
|
466
476
|
return;
|
|
467
477
|
}
|
|
468
478
|
this._lookupMode = true;
|
|
469
|
-
this.value = value;
|
|
479
|
+
this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
|
|
470
480
|
}
|
|
471
481
|
loadOptionValue(argument) {
|
|
472
482
|
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.
|
|
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);
|
|
@@ -104,17 +104,25 @@ export class SplitPanel {
|
|
|
104
104
|
};
|
|
105
105
|
return style;
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
let template = '';
|
|
107
|
+
calcFreeSpacePercentage() {
|
|
109
108
|
const inUseSpacePercentage = this._items.reduce((accumulator, currentValue) => {
|
|
110
109
|
var _a;
|
|
111
110
|
return accumulator + (((_a = currentValue.size) === null || _a === void 0 ? void 0 : _a.includes('%')) ? Number(currentValue.size.replace("%", "")) : 0);
|
|
112
111
|
}, 0);
|
|
113
|
-
const
|
|
112
|
+
const itemsWithoutSizeAmount = this._items.filter((item) => item.size === undefined).length;
|
|
113
|
+
if (!itemsWithoutSizeAmount || !inUseSpacePercentage) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
const freeSpacePercentage = ((100 - inUseSpacePercentage) / itemsWithoutSizeAmount);
|
|
117
|
+
return freeSpacePercentage;
|
|
118
|
+
}
|
|
119
|
+
getGridTemplate() {
|
|
120
|
+
let template = '';
|
|
121
|
+
const freeSpacePercentage = this.calcFreeSpacePercentage();
|
|
114
122
|
this._items.forEach((col, index) => {
|
|
115
123
|
let size = col.size || '1fr';
|
|
116
|
-
if (!col.size &&
|
|
117
|
-
size = `${
|
|
124
|
+
if (!col.size && freeSpacePercentage) {
|
|
125
|
+
size = `${freeSpacePercentage}%`;
|
|
118
126
|
}
|
|
119
127
|
if (index === this._items.length - 1) {
|
|
120
128
|
template += ` ${size}`;
|
|
@@ -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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 ?
|
|
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:
|
|
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
|
+
}
|