@sankhyalabs/ezui 7.1.0-dev.2 → 7.1.0-dev.20
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-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box-list_4.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-input.cjs.entry.js +10 -3
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +3 -2
- package/dist/cjs/ez-form.cjs.entry.js +13 -3
- package/dist/cjs/ez-grid.cjs.entry.js +7 -3
- package/dist/cjs/ez-modal-container.cjs.entry.js +15 -16
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +2 -0
- package/dist/cjs/ez-popup.cjs.entry.js +19 -7
- package/dist/cjs/ez-search-plus.cjs.entry.js +16 -2
- package/dist/cjs/ez-search.cjs.entry.js +28 -24
- package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-tooltip.cjs.entry.js +13 -2
- package/dist/cjs/ez-tree.cjs.entry.js +154 -7
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{purify-47a2f27b.js → purify-b30a5718.js} +41 -12
- package/dist/cjs/{search-column-9aa090ec.js → search-column-8bfee733.js} +1 -1
- package/dist/collection/components/ez-chip/ez-chip.css +3 -0
- package/dist/collection/components/ez-date-input/ez-date-input.js +28 -3
- package/dist/collection/components/ez-dialog/ez-dialog.css +6 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +3 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +5 -1
- package/dist/collection/components/ez-modal/ez-modal.css +3 -0
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +4 -9
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +32 -15
- package/dist/collection/components/ez-number-input/ez-number-input.js +16 -0
- package/dist/collection/components/ez-popup/ez-popup.css +9 -4
- package/dist/collection/components/ez-popup/ez-popup.js +24 -7
- package/dist/collection/components/ez-search/ez-search.js +41 -19
- package/dist/collection/components/ez-search-plus/ez-search-plus.js +16 -2
- package/dist/collection/components/ez-split-button/ez-split-button.css +7 -2
- package/dist/collection/components/ez-text-input/ez-text-input.css +3 -3
- package/dist/collection/components/ez-tooltip/ez-tooltip.js +13 -2
- package/dist/collection/components/ez-tree/ez-tree.css +4 -0
- package/dist/collection/components/ez-tree/ez-tree.js +185 -6
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +4 -1
- package/dist/collection/components/ez-tree/types/Node.js +7 -0
- package/dist/collection/components/ez-tree/types/Tree.js +19 -0
- package/dist/collection/components/ez-tree/types/UpdateItemConfig.js +1 -0
- package/dist/collection/utils/form/DataBinder.js +1 -1
- package/dist/collection/utils/form/FormMetadata.js +12 -2
- package/dist/custom-elements/index.js +337 -97
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-combo-box-list_4.entry.js +1 -1
- package/dist/esm/ez-date-input.entry.js +10 -3
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +3 -2
- package/dist/esm/ez-form.entry.js +13 -3
- package/dist/esm/ez-grid.entry.js +7 -3
- package/dist/esm/ez-modal-container.entry.js +15 -16
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +2 -0
- package/dist/esm/ez-popup.entry.js +19 -7
- package/dist/esm/ez-search-plus.entry.js +16 -2
- package/dist/esm/ez-search.entry.js +23 -19
- package/dist/esm/ez-split-button.entry.js +1 -1
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-tooltip.entry.js +13 -2
- package/dist/esm/ez-tree.entry.js +154 -7
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{purify-dc6814bf.js → purify-9357603c.js} +41 -12
- package/dist/esm/{search-column-83562552.js → search-column-c00119ae.js} +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-19cf13bc.entry.js +1 -0
- package/dist/ezui/p-2854f087.entry.js +1 -0
- package/dist/ezui/p-294f54fe.entry.js +1 -0
- package/dist/ezui/{p-d66bf34e.entry.js → p-377768bd.entry.js} +2 -2
- package/dist/ezui/{p-2ba2d792.entry.js → p-44ad16df.entry.js} +1 -1
- package/dist/ezui/p-4f0632b4.js +1 -0
- package/dist/ezui/p-7b999377.entry.js +1 -0
- package/dist/ezui/{p-0e49c0ff.entry.js → p-8d626d2b.entry.js} +1 -1
- package/dist/ezui/p-96b33264.entry.js +1 -0
- package/dist/ezui/{p-c943f7c4.entry.js → p-adaa2a81.entry.js} +1 -1
- package/dist/ezui/{p-f958dcb1.entry.js → p-c82acfc6.entry.js} +1 -1
- package/dist/ezui/p-cd6f5783.entry.js +1 -0
- package/dist/ezui/p-cfa26133.entry.js +1 -0
- package/dist/ezui/p-da585ff3.entry.js +1 -0
- package/dist/ezui/p-df316d40.entry.js +1 -0
- package/dist/ezui/p-dff9862b.js +3 -0
- package/dist/ezui/p-eca050b4.entry.js +1 -0
- package/dist/ezui/p-f34ec732.entry.js +1 -0
- package/dist/ezui/p-ff4bde07.entry.js +1 -0
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +5 -1
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +6 -2
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +3 -0
- package/dist/types/components/ez-search/ez-search.d.ts +5 -6
- package/dist/types/components/ez-search-plus/ez-search-plus.d.ts +1 -0
- package/dist/types/components/ez-tooltip/ez-tooltip.d.ts +3 -0
- package/dist/types/components/ez-tree/ez-tree.d.ts +20 -1
- package/dist/types/components/ez-tree/types/Node.d.ts +1 -0
- package/dist/types/components/ez-tree/types/Tree.d.ts +1 -0
- package/dist/types/components/ez-tree/types/UpdateItemConfig.d.ts +4 -0
- package/dist/types/components.d.ts +42 -1
- package/dist/types/utils/form/interfaces/IFormSheetMetadata.d.ts +1 -0
- package/dist/types/utils/form/interfaces/ITabConfig.d.ts +1 -0
- package/package.json +1 -1
- package/dist/ezui/p-02f6e3b0.entry.js +0 -1
- package/dist/ezui/p-0b333f09.entry.js +0 -1
- package/dist/ezui/p-191cfbc8.entry.js +0 -1
- package/dist/ezui/p-1bfef8e5.entry.js +0 -1
- package/dist/ezui/p-228a4d2f.js +0 -3
- package/dist/ezui/p-2df50161.entry.js +0 -1
- package/dist/ezui/p-4e1df756.entry.js +0 -1
- package/dist/ezui/p-623161e2.js +0 -1
- package/dist/ezui/p-7f8c1fce.entry.js +0 -1
- package/dist/ezui/p-8bb3aeb0.entry.js +0 -1
- package/dist/ezui/p-ba7e908a.entry.js +0 -1
- package/dist/ezui/p-bd6146c5.entry.js +0 -1
- package/dist/ezui/p-d0e6911e.entry.js +0 -1
- package/dist/ezui/p-e46a4d06.entry.js +0 -1
|
@@ -213,7 +213,7 @@ input:read-only {
|
|
|
213
213
|
white-space: nowrap;
|
|
214
214
|
-webkit-transition: font-size .05s, top .05s;
|
|
215
215
|
transition: font-size .05s, top .05s;
|
|
216
|
-
width: calc(100% - var(--ez-text-input__label--padding-right));
|
|
216
|
+
width: calc(100% - (var(--ez-text-input__label--padding-right) + var(--ez-text-input__label--padding-left)));
|
|
217
217
|
left: var(--ez-text-input--space--medium);
|
|
218
218
|
|
|
219
219
|
/*public*/
|
|
@@ -245,7 +245,7 @@ input:read-only {
|
|
|
245
245
|
text-align: left;
|
|
246
246
|
left: calc(var(--ez-text-input__icon--width) + 2px);
|
|
247
247
|
/*borda*/
|
|
248
|
-
width: calc(100% - var(--ez-text-input__icon--width));
|
|
248
|
+
width: calc(100% - (var(--ez-text-input__icon--width) + var(--ez-text-input__label--padding-right)));
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
.input__label--left.hasError {
|
|
@@ -255,7 +255,7 @@ input:read-only {
|
|
|
255
255
|
.input__label--right {
|
|
256
256
|
/*public*/
|
|
257
257
|
right: var(--ez-text-input__icon--width);
|
|
258
|
-
width: calc(100% - var(--ez-text-input__icon--width));
|
|
258
|
+
width: calc(100% - (var(--ez-text-input__icon--width) + var(--ez-text-input__label--padding-left)));
|
|
259
259
|
}
|
|
260
260
|
.input__label--right.hasError {
|
|
261
261
|
width: calc(100% - var(--ez-text-input__icon--width) - var(--ez-text-input__tooltip-icon--spacing));
|
|
@@ -4,6 +4,7 @@ import { h, Host } from "@stencil/core";
|
|
|
4
4
|
export class EzTooltip {
|
|
5
5
|
constructor() {
|
|
6
6
|
this._opened = false;
|
|
7
|
+
this._eventsRegistered = false;
|
|
7
8
|
this.message = undefined;
|
|
8
9
|
this.anchoringElement = undefined;
|
|
9
10
|
this.placement = 'bottom';
|
|
@@ -99,6 +100,7 @@ export class EzTooltip {
|
|
|
99
100
|
this._mouseLeaveHandler = () => this.closeTooltip();
|
|
100
101
|
element.addEventListener('mouseenter', this._mouseEnterHandler);
|
|
101
102
|
element.addEventListener('mouseleave', this._mouseLeaveHandler);
|
|
103
|
+
this._eventsRegistered = true;
|
|
102
104
|
}
|
|
103
105
|
removeEvents(element = this.anchoringElement) {
|
|
104
106
|
if (!element) {
|
|
@@ -110,10 +112,19 @@ export class EzTooltip {
|
|
|
110
112
|
if (this._mouseLeaveHandler) {
|
|
111
113
|
element.removeEventListener('mouseleave', this._mouseLeaveHandler);
|
|
112
114
|
}
|
|
115
|
+
this._eventsRegistered = false;
|
|
116
|
+
}
|
|
117
|
+
initializeTooltip() {
|
|
118
|
+
if (this._element && this.anchoringElement && !this._eventsRegistered) {
|
|
119
|
+
this.setEvents();
|
|
120
|
+
this.addInfoId();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
connectedCallback() {
|
|
124
|
+
this.initializeTooltip();
|
|
113
125
|
}
|
|
114
126
|
componentDidLoad() {
|
|
115
|
-
this.
|
|
116
|
-
this.addInfoId();
|
|
127
|
+
this.initializeTooltip();
|
|
117
128
|
}
|
|
118
129
|
addInfoId() {
|
|
119
130
|
if (this._element) {
|
|
@@ -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.
|
|
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
|
-
|
|
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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
}
|
|
@@ -91,14 +91,23 @@ function handleDetailTabs(dataUnit, config, sheets) {
|
|
|
91
91
|
function handleCustomTabs(customGuides, config, sheets) {
|
|
92
92
|
customGuides.forEach((guide) => {
|
|
93
93
|
const tabConfig = getTabFromConfig(guide.label, config);
|
|
94
|
+
const ctxProps = {};
|
|
95
|
+
Object.entries(guide).forEach(([key, value]) => {
|
|
96
|
+
if (!isReservedKey(key)) {
|
|
97
|
+
ctxProps[key] = value;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
94
100
|
if (tabConfig) {
|
|
95
|
-
sheets.set(Object.assign(tabConfig, { name: guide.id, isCustom: true }), []);
|
|
101
|
+
sheets.set(Object.assign(tabConfig, { name: guide.id, isCustom: true, ctxProps }), []);
|
|
96
102
|
return;
|
|
97
103
|
}
|
|
98
|
-
const sheet = { label: guide.label, name: guide.id, isCustom: true, visible: true };
|
|
104
|
+
const sheet = { label: guide.label, name: guide.id, isCustom: true, visible: true, ctxProps };
|
|
99
105
|
sheets.set(sheet, []);
|
|
100
106
|
});
|
|
101
107
|
}
|
|
108
|
+
function isReservedKey(key) {
|
|
109
|
+
return ['id', 'label'].includes(key);
|
|
110
|
+
}
|
|
102
111
|
function parseTabToFormSheet(key, fields) {
|
|
103
112
|
const i18n = getI18n();
|
|
104
113
|
return {
|
|
@@ -106,6 +115,7 @@ function parseTabToFormSheet(key, fields) {
|
|
|
106
115
|
name: key.name || key.label,
|
|
107
116
|
isCustom: key.isCustom,
|
|
108
117
|
isDetail: key.isDetail,
|
|
118
|
+
ctxProps: key.ctxProps,
|
|
109
119
|
fields
|
|
110
120
|
};
|
|
111
121
|
}
|