@sankhyalabs/ezui 2.14.1 → 2.14.2
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-filter-input_3.cjs.entry.js +57 -15
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +17 -301
- package/dist/cjs/ez-popover.cjs.entry.js +2 -2
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.css +4 -0
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.js +79 -138
- package/dist/collection/components/ez-guide-navigator/interfaces/IGuideItem.js +1 -0
- package/dist/collection/components/ez-guide-navigator/interfaces/index.js +1 -0
- package/dist/collection/components/ez-popover/ez-popover.css +1 -1
- package/dist/collection/components/ez-popover/ez-popover.js +1 -1
- package/dist/collection/components/ez-tree/ez-tree.js +33 -10
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +6 -3
- package/dist/collection/components/ez-tree/types/Node.js +2 -1
- package/dist/collection/components/ez-tree/types/Tree.js +38 -3
- package/dist/custom-elements/index.js +78 -320
- package/dist/esm/ez-filter-input_3.entry.js +58 -16
- package/dist/esm/ez-guide-navigator.entry.js +18 -302
- package/dist/esm/ez-popover.entry.js +2 -2
- 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-368037b9.entry.js +1 -0
- package/dist/ezui/p-73eb147d.entry.js +1 -0
- package/dist/ezui/p-ca8f7199.entry.js +1 -0
- package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +3 -0
- package/dist/types/components/ez-guide-navigator/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-tree/ez-tree.d.ts +6 -2
- package/dist/types/components/ez-tree/types/Node.d.ts +1 -0
- package/dist/types/components/ez-tree/types/Tree.d.ts +5 -1
- package/dist/types/components.d.ts +21 -9
- package/package.json +1 -1
- package/dist/collection/components/ez-guide-navigator/Guide.js +0 -200
- package/dist/ezui/p-98c448c9.entry.js +0 -1
- package/dist/ezui/p-a47b3526.entry.js +0 -1
- package/dist/ezui/p-fa2f4ea5.entry.js +0 -1
- package/dist/types/components/ez-guide-navigator/Guide.d.ts +0 -69
|
@@ -119262,336 +119262,52 @@ let EzGrid$1 = class extends HTMLElement$1 {
|
|
|
119262
119262
|
static get style() { return ezGridCss; }
|
|
119263
119263
|
};
|
|
119264
119264
|
|
|
119265
|
-
const
|
|
119266
|
-
class Guide {
|
|
119267
|
-
constructor(list) {
|
|
119268
|
-
this.originalList = [];
|
|
119269
|
-
this.guideMap = new Map();
|
|
119270
|
-
this.hierarchiesAlreadyLoaded = new Set();
|
|
119271
|
-
if (list === null || list === void 0 ? void 0 : list.length)
|
|
119272
|
-
this.setList(list);
|
|
119273
|
-
}
|
|
119274
|
-
/**
|
|
119275
|
-
* Converte uma lista de objetos IGuideItem em um objeto IGuideMap com sua hierarquia.
|
|
119276
|
-
* @param list Uma lista de objetos IGuideItem representando a lista de itens.
|
|
119277
|
-
* @param hierarquiaList Uma lista opcional de strings que representa a hierarquia dos itens pai.
|
|
119278
|
-
* @param indexReferences Uma lista opcional de números que representa as referências de índice da lista original.
|
|
119279
|
-
* @returns Uma Promise que resolve para um objeto IGuideMap com os itens e sua hierarquia.
|
|
119280
|
-
*/
|
|
119281
|
-
convertArrayToMap(list, hierarchyList = [], indexReferences = []) {
|
|
119282
|
-
return new Promise(resolve => {
|
|
119283
|
-
list.forEach(async (item, index) => {
|
|
119284
|
-
const updatedHierarchyList = [...hierarchyList, item.id];
|
|
119285
|
-
const key = updatedHierarchyList.join(HIERARCHY_SEPARATOR);
|
|
119286
|
-
const currentIndexReferences = [...indexReferences, index];
|
|
119287
|
-
const children = Array.isArray(item.children) ? item.children : [];
|
|
119288
|
-
item = Object.assign(Object.assign({}, item), { parentId: hierarchyList[hierarchyList.length - 1], indexReferences: currentIndexReferences, hierarchy: updatedHierarchyList, hierarchyId: key });
|
|
119289
|
-
delete item.children;
|
|
119290
|
-
this.guideMap.set(key, item);
|
|
119291
|
-
if (children.length)
|
|
119292
|
-
await this.convertArrayToMap(children, updatedHierarchyList, currentIndexReferences);
|
|
119293
|
-
});
|
|
119294
|
-
resolve(this.guideMap);
|
|
119295
|
-
});
|
|
119296
|
-
}
|
|
119297
|
-
/**
|
|
119298
|
-
* Converte um objeto IGuideMap em uma lista de objetos IGuideItem com sua hierarquia.
|
|
119299
|
-
* @param map Um objeto IGuideMap opcional que representa o mapa de itens com sua hierarquia.
|
|
119300
|
-
* @returns Uma Promise que resolve para uma lista de objetos IGuideItem com sua hierarquia.
|
|
119301
|
-
*/
|
|
119302
|
-
convertMapToArray(map = this.guideMap) {
|
|
119303
|
-
return new Promise(resolve => {
|
|
119304
|
-
const array = [];
|
|
119305
|
-
const itemsById = {};
|
|
119306
|
-
map.forEach(value => {
|
|
119307
|
-
var _a;
|
|
119308
|
-
const item = Object.assign({}, value);
|
|
119309
|
-
if (((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
119310
|
-
delete item.children;
|
|
119311
|
-
}
|
|
119312
|
-
itemsById[item.id] = item;
|
|
119313
|
-
});
|
|
119314
|
-
Object.values(itemsById).forEach(item => {
|
|
119315
|
-
if (item.parentId) {
|
|
119316
|
-
const parent = itemsById[item.parentId];
|
|
119317
|
-
if (Array.isArray(parent.children)) {
|
|
119318
|
-
parent.children.push(item);
|
|
119319
|
-
}
|
|
119320
|
-
else {
|
|
119321
|
-
parent.children = [item];
|
|
119322
|
-
}
|
|
119323
|
-
}
|
|
119324
|
-
else {
|
|
119325
|
-
array.push(item);
|
|
119326
|
-
}
|
|
119327
|
-
});
|
|
119328
|
-
resolve(array);
|
|
119329
|
-
});
|
|
119330
|
-
}
|
|
119331
|
-
/**
|
|
119332
|
-
* Obtém a lista selecionada de itens com base na lista original e na lista de índice selecionada.
|
|
119333
|
-
* @param originalList Uma lista de objetos IGuideItem representando a lista original de itens.
|
|
119334
|
-
* @param selectedIndexList Uma matriz representando a lista de índices selecionada.
|
|
119335
|
-
* @returns Uma lista de objetos IGuideItem representando a lista selecionada de itens.
|
|
119336
|
-
*/
|
|
119337
|
-
getSelectedList(originalList, selectedIndexList) {
|
|
119338
|
-
const selectedList = [];
|
|
119339
|
-
selectedIndexList.forEach(selectedIndex => {
|
|
119340
|
-
if (!selectedIndex.length)
|
|
119341
|
-
return;
|
|
119342
|
-
const [parentIndex, childIndex] = selectedIndex;
|
|
119343
|
-
if (childIndex === undefined) {
|
|
119344
|
-
selectedList.push(originalList[parentIndex]);
|
|
119345
|
-
}
|
|
119346
|
-
else {
|
|
119347
|
-
const parent = originalList[parentIndex];
|
|
119348
|
-
const child = parent.children[childIndex];
|
|
119349
|
-
const selectedParent = selectedList.find(item => item.id === parent.id);
|
|
119350
|
-
if (selectedParent) {
|
|
119351
|
-
selectedParent.children.push(child);
|
|
119352
|
-
}
|
|
119353
|
-
else {
|
|
119354
|
-
selectedList.push(Object.assign(Object.assign({}, parent), { children: [child] }));
|
|
119355
|
-
}
|
|
119356
|
-
}
|
|
119357
|
-
});
|
|
119358
|
-
return selectedList;
|
|
119359
|
-
}
|
|
119360
|
-
/**
|
|
119361
|
-
* Define a lista de itens para o Map guideMap.
|
|
119362
|
-
* @param list Uma lista de objetos IGuideItem representando a lista de itens.
|
|
119363
|
-
* @returns Uma Promise que resolve quando a lista é convertida para o Map.
|
|
119364
|
-
*/
|
|
119365
|
-
setList(list) {
|
|
119366
|
-
return new Promise(async (resolve) => {
|
|
119367
|
-
this.guideMap.clear();
|
|
119368
|
-
if (!this.originalList.length) {
|
|
119369
|
-
this.originalList = ObjectUtils$1.copy(list);
|
|
119370
|
-
}
|
|
119371
|
-
await this.convertArrayToMap(list);
|
|
119372
|
-
resolve();
|
|
119373
|
-
});
|
|
119374
|
-
}
|
|
119375
|
-
/**
|
|
119376
|
-
* Obtém a lista de itens com sua hierarquia.
|
|
119377
|
-
* @returns Uma Promise que resolve para uma lista de objetos IGuideItem com sua hierarquia.
|
|
119378
|
-
*/
|
|
119379
|
-
getList() {
|
|
119380
|
-
return this.convertMapToArray();
|
|
119381
|
-
}
|
|
119382
|
-
/**
|
|
119383
|
-
* Adiciona filhos a um item pai no guia.
|
|
119384
|
-
* @param parent Um objeto IGuideItem que representa o item pai.
|
|
119385
|
-
* @param children Uma lista de objetos IGuideItem representando os itens filhos.
|
|
119386
|
-
* @returns Uma Promise que resolve para uma lista de objetos IGuideItem com sua hierarquia.
|
|
119387
|
-
*/
|
|
119388
|
-
addChildren(parent, children) {
|
|
119389
|
-
return new Promise(async (resolve, reject) => {
|
|
119390
|
-
if (parent.disabled)
|
|
119391
|
-
return reject('Parent is disabled');
|
|
119392
|
-
if (!parent.hierarchy || !parent.hierarchyId)
|
|
119393
|
-
return reject('Hierarchy not found');
|
|
119394
|
-
if (this.hierarchiesAlreadyLoaded.has(parent.hierarchyId))
|
|
119395
|
-
return resolve([]);
|
|
119396
|
-
await this.convertArrayToMap(children, parent.hierarchy);
|
|
119397
|
-
const list = await this.getList();
|
|
119398
|
-
this.originalList = ObjectUtils$1.copy(list);
|
|
119399
|
-
this.hierarchiesAlreadyLoaded.add(parent.hierarchyId);
|
|
119400
|
-
resolve(list);
|
|
119401
|
-
});
|
|
119402
|
-
}
|
|
119403
|
-
/**
|
|
119404
|
-
* Obtém os itens a partir de um campo corresponde à string de consulta.
|
|
119405
|
-
* @param query Uma string que representa a consulta para corresponder ao rótulo.
|
|
119406
|
-
* @param fieldName Uma string opcional que representa o nome do campo para corresponder à consulta.
|
|
119407
|
-
* @returns Uma Promise que resolve para um objeto com o primeiro item encontrado e uma matriz de itens correspondentes com sua hierarquia.
|
|
119408
|
-
*/
|
|
119409
|
-
getItemsByLabel(query, fieldName = 'label', selectedItem) {
|
|
119410
|
-
return new Promise(async (resolve) => {
|
|
119411
|
-
var _a;
|
|
119412
|
-
const mapResults = [];
|
|
119413
|
-
let firstOcorrence;
|
|
119414
|
-
const itemFromMap = this.guideMap.get(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.hierarchyId);
|
|
119415
|
-
if (itemFromMap)
|
|
119416
|
-
itemFromMap.expanded = true;
|
|
119417
|
-
for (const item of this.guideMap.values()) {
|
|
119418
|
-
const label = ((_a = item === null || item === void 0 ? void 0 : item[fieldName]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
119419
|
-
if (label.includes(query.toLowerCase())) {
|
|
119420
|
-
if (!firstOcorrence)
|
|
119421
|
-
firstOcorrence = item;
|
|
119422
|
-
mapResults.push(item.indexReferences);
|
|
119423
|
-
}
|
|
119424
|
-
}
|
|
119425
|
-
const updatedList = this.getSelectedList(this.originalList, mapResults);
|
|
119426
|
-
resolve({
|
|
119427
|
-
first: firstOcorrence,
|
|
119428
|
-
list: updatedList,
|
|
119429
|
-
});
|
|
119430
|
-
});
|
|
119431
|
-
}
|
|
119432
|
-
/**
|
|
119433
|
-
* Habilita todos os objetos IGuideItem.
|
|
119434
|
-
* @returns Uma Promise que resolve com o array atualizado de objetos IGuideItem.
|
|
119435
|
-
*/
|
|
119436
|
-
enableAllItems() {
|
|
119437
|
-
return new Promise(async (resolve) => {
|
|
119438
|
-
for (const item of this.guideMap.values())
|
|
119439
|
-
item.disabled = false;
|
|
119440
|
-
const list = await this.getList();
|
|
119441
|
-
this.originalList = ObjectUtils$1.copy(list);
|
|
119442
|
-
resolve(list);
|
|
119443
|
-
});
|
|
119444
|
-
}
|
|
119445
|
-
/**
|
|
119446
|
-
* Ativa somente objetos IGuideItem com base em uma matriz de IDs.
|
|
119447
|
-
* @param ids Um array de IDs para habilitar.
|
|
119448
|
-
* @param customTooltip Uma string para definir o tooltip de itens desabilitados.
|
|
119449
|
-
* @returns Uma Promise que resolve com o array atualizado de objetos IGuideItem.
|
|
119450
|
-
*/
|
|
119451
|
-
enableItemsById(ids = [], customTooltip = '') {
|
|
119452
|
-
return new Promise(async (resolve) => {
|
|
119453
|
-
for (const item of this.guideMap.values()) {
|
|
119454
|
-
const isEnabled = ids.includes(item.id);
|
|
119455
|
-
item.disabled = !isEnabled;
|
|
119456
|
-
item.tooltip = isEnabled ? item.tooltip : customTooltip;
|
|
119457
|
-
}
|
|
119458
|
-
const list = await this.getList();
|
|
119459
|
-
this.originalList = ObjectUtils$1.copy(list);
|
|
119460
|
-
resolve(list);
|
|
119461
|
-
});
|
|
119462
|
-
}
|
|
119463
|
-
}
|
|
119464
|
-
|
|
119465
|
-
const ezGuideNavigatorCss = ":host{--ez-guide-navigator--padding:0 var(--space--large);--ez-guide-navigator--box-shadow:var(--shadow, 0px 0px 24px 0px #000);--ez-guide-navigator--background-color:var(--color--inverted);--ez-guide-navigator--border-radius:0px var(--border--radius-medium) var(--border--radius-medium) 0px;--ez-guide-navigator--actions-gap:var(--space--medium);--ez-guide-navigator--actions-margin:var(--space--medium) 0 var(--space--medium)}.inverted{transform:rotate(180deg)}.ez-guide-navigator{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:var(--ez-guide-navigator--padding);background-color:var(--ez-guide-navigator--background-color);-webkit-box-shadow:var(--ez-guide-navigator--box-shadow);box-shadow:var(--ez-guide-navigator--box-shadow);border-radius:var(--ez-guide-navigator--border-radius)}.ez-guide-navigator__actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--ez-guide-navigator--actions-gap);margin:var(--ez-guide-navigator--actions-margin)}";
|
|
119265
|
+
const ezGuideNavigatorCss = ":host{--ez-guide-navigator--padding:0 var(--space--large);--ez-guide-navigator--box-shadow:var(--shadow, 0px 0px 24px 0px #000);--ez-guide-navigator--background-color:var(--color--inverted);--ez-guide-navigator--border-radius:0px var(--border--radius-medium) var(--border--radius-medium) 0px;--ez-guide-navigator--actions-gap:var(--space--medium);--ez-guide-navigator--actions-margin:var(--space--medium) 0 var(--space--medium)}.inverted{transform:rotate(180deg)}.ez-guide-navigator{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:var(--ez-guide-navigator--padding);background-color:var(--ez-guide-navigator--background-color);-webkit-box-shadow:var(--ez-guide-navigator--box-shadow);box-shadow:var(--ez-guide-navigator--box-shadow);border-radius:var(--ez-guide-navigator--border-radius)}.ez-guide-navigator__actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--ez-guide-navigator--actions-gap);margin:var(--ez-guide-navigator--actions-margin)}.hidden{display:none}";
|
|
119466
119266
|
|
|
119467
|
-
const ENTER_KEY =
|
|
119267
|
+
const ENTER_KEY = "Enter";
|
|
119468
119268
|
let EzGuideNavigator$1 = class extends HTMLElement$1 {
|
|
119469
119269
|
constructor() {
|
|
119470
119270
|
super();
|
|
119471
119271
|
this.__registerHost();
|
|
119472
119272
|
this.__attachShadow();
|
|
119473
|
-
//TODO: Quando a filtragem for feita dentro da árvore, não será mais necessário
|
|
119474
|
-
this.guide = new Guide();
|
|
119475
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119476
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119477
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119478
|
-
/**
|
|
119479
|
-
* Provedor de dados para o guide navigator.
|
|
119480
|
-
*/
|
|
119481
|
-
this.binder = null;
|
|
119482
119273
|
/**
|
|
119483
119274
|
* Define se o menu de navegação está aberto.
|
|
119484
|
-
|
|
119275
|
+
*/
|
|
119485
119276
|
this.open = true;
|
|
119486
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119487
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119488
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119489
119277
|
/**
|
|
119490
119278
|
* Lista de itens do menu de navegação.
|
|
119491
|
-
|
|
119279
|
+
*/
|
|
119492
119280
|
this.items = [];
|
|
119493
119281
|
/**
|
|
119494
119282
|
* Valor do campo de pesquisa usado na filtragem de guias.
|
|
119495
119283
|
*/
|
|
119496
|
-
this.filterText =
|
|
119284
|
+
this.filterText = "";
|
|
119497
119285
|
}
|
|
119498
119286
|
/**
|
|
119499
|
-
*
|
|
119500
|
-
|
|
119501
|
-
async
|
|
119502
|
-
|
|
119503
|
-
this._tree.items = await this.guide.enableItemsById(id, customTooltip);
|
|
119287
|
+
* Desabilita um ou mais itens.
|
|
119288
|
+
*/
|
|
119289
|
+
async disableItem(id) {
|
|
119290
|
+
[].concat(id).forEach(item => this._tree.disableItem(item));
|
|
119504
119291
|
}
|
|
119505
119292
|
/**
|
|
119506
|
-
* Habilita
|
|
119507
|
-
|
|
119508
|
-
async
|
|
119509
|
-
|
|
119510
|
-
this._tree.items = await this.guide.enableAllItems();
|
|
119511
|
-
}
|
|
119512
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119513
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119514
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119515
|
-
handleBinderChange(newBinder, oldBinder) {
|
|
119516
|
-
if (newBinder != oldBinder) {
|
|
119517
|
-
this.initTree();
|
|
119518
|
-
}
|
|
119293
|
+
* Habilita um ou mais itens.
|
|
119294
|
+
*/
|
|
119295
|
+
async enableItem(id) {
|
|
119296
|
+
[].concat(id).forEach(item => this._tree.enableItem(item));
|
|
119519
119297
|
}
|
|
119520
119298
|
async handleToggleSidebar() {
|
|
119521
119299
|
this.open = !this.open;
|
|
119522
|
-
if (this.open) {
|
|
119523
|
-
await this.initTree();
|
|
119524
|
-
this.filterItems();
|
|
119525
|
-
}
|
|
119526
|
-
}
|
|
119527
|
-
handleSelectTreeItem({ detail: parent }) {
|
|
119528
|
-
if (!parent.expanded)
|
|
119529
|
-
return;
|
|
119530
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119531
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119532
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119533
|
-
this.binder.fetchItems(parent.id).then(async (children) => {
|
|
119534
|
-
if (!(children === null || children === void 0 ? void 0 : children.length))
|
|
119535
|
-
return;
|
|
119536
|
-
await this.guide.addChildren(parent, children);
|
|
119537
|
-
const { list } = await this.guide.getItemsByLabel(this.filterText, 'label', parent);
|
|
119538
|
-
this._tree.items = list;
|
|
119539
|
-
this._tree.openItem(parent.hierarchyId || parent.id);
|
|
119540
|
-
});
|
|
119541
|
-
this.binder.onSelectItem(parent);
|
|
119542
119300
|
}
|
|
119543
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119544
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119545
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119546
119301
|
handleFilterTree(event) {
|
|
119547
|
-
if (event.key === ENTER_KEY)
|
|
119548
|
-
this.
|
|
119549
|
-
}
|
|
119550
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119551
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119552
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119553
|
-
async setTreeIems(list, first) {
|
|
119554
|
-
var _a;
|
|
119555
|
-
this._tree.items = list;
|
|
119556
|
-
if (first && !(first === null || first === void 0 ? void 0 : first.disabled)) {
|
|
119557
|
-
const parentHierarchyId = ((_a = first.hierarchy) === null || _a === void 0 ? void 0 : _a.slice(0, -1).join(HIERARCHY_SEPARATOR)) || first.id;
|
|
119558
|
-
await this._tree.openItem(parentHierarchyId);
|
|
119559
|
-
await this._tree.selectItem(first.id);
|
|
119560
|
-
}
|
|
119561
|
-
else {
|
|
119562
|
-
this._tree.selectItem(null);
|
|
119302
|
+
if (event.key === ENTER_KEY) {
|
|
119303
|
+
this._tree.applyFilter(this.filterText);
|
|
119563
119304
|
}
|
|
119564
119305
|
}
|
|
119565
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119566
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119567
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119568
|
-
filterItems() {
|
|
119569
|
-
this.guide.getItemsByLabel(this.filterText).then(async ({ list, first }) => {
|
|
119570
|
-
this.setTreeIems(list, first);
|
|
119571
|
-
});
|
|
119572
|
-
}
|
|
119573
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
119574
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
119575
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
119576
|
-
async initTree() {
|
|
119577
|
-
if (!this.binder)
|
|
119578
|
-
return;
|
|
119579
|
-
const binderItems = await this.binder.fetchItems();
|
|
119580
|
-
await this.guide.setList(binderItems);
|
|
119581
|
-
const guideItems = await this.guide.getList();
|
|
119582
|
-
this.setTreeIems(guideItems);
|
|
119583
|
-
}
|
|
119584
|
-
componentDidLoad() {
|
|
119585
|
-
ElementIDUtils.addIDInfoIfNotExists(this._element);
|
|
119586
|
-
this.initTree();
|
|
119587
|
-
}
|
|
119588
119306
|
render() {
|
|
119589
|
-
|
|
119307
|
+
ElementIDUtils.addIDInfoIfNotExists(this._element);
|
|
119308
|
+
return (h(Host, null, h("ez-sidebar-button", { class: this.open ? "hidden" : "", onEzClick: this.handleToggleSidebar.bind(this), "aria-controls": "navigator", "aria-expanded": this.open, "data-element-id": ElementIDUtils.getInternalIDInfo("openButton") }), h("aside", { tabIndex: -1, id: "navigator", class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-guide-navigator " + (this.open ? "" : "hidden"), "data-element-id": ElementIDUtils.getInternalIDInfo("sidebar") }, h("div", { role: "search", class: "ez-guide-navigator__actions" }, h("ez-filter-input", { mode: "slim", value: this.filterText, onEzChange: (event) => (this.filterText = event.detail), label: "Buscar guia", "aria-placeholder": "Buscar guia", onKeyUp: this.handleFilterTree.bind(this), "data-element-id": ElementIDUtils.getInternalIDInfo("textinput") }), h("ez-button", { onClick: this.handleToggleSidebar.bind(this), class: "inverted", mode: "icon", size: "small", iconName: "show_menu", title: "Ocultar menu", "aria-label": "Ocultar menu", "aria-controls": "navigator", "data-element-id": ElementIDUtils.getInternalIDInfo("closeButton") })), h("ez-tree", { ref: element => (this._tree = element), items: this.items, "data-element-id": ElementIDUtils.getInternalIDInfo("tree"), tooltipResolver: this.tooltipResolver }))));
|
|
119590
119309
|
}
|
|
119591
119310
|
get _element() { return this; }
|
|
119592
|
-
static get watchers() { return {
|
|
119593
|
-
"binder": ["handleBinderChange"]
|
|
119594
|
-
}; }
|
|
119595
119311
|
static get style() { return ezGuideNavigatorCss; }
|
|
119596
119312
|
};
|
|
119597
119313
|
|
|
@@ -120462,7 +120178,7 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
|
|
|
120462
120178
|
static get style() { return ezNumberInputCss; }
|
|
120463
120179
|
};
|
|
120464
120180
|
|
|
120465
|
-
const ezPopoverCss = ":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--
|
|
120181
|
+
const ezPopoverCss = ":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--most-visible, 3);position:relative;display:flex;user-select:none}.popover__box{z-index:var(--ez-popover__box--z-index);display:flex;flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.popover__box--fit-content{width:fit-content}.popover__box--full-width{width:100%}";
|
|
120466
120182
|
|
|
120467
120183
|
let EzPopover$1 = class extends HTMLElement$1 {
|
|
120468
120184
|
constructor() {
|
|
@@ -120566,7 +120282,7 @@ let EzPopover$1 = class extends HTMLElement$1 {
|
|
|
120566
120282
|
*/
|
|
120567
120283
|
async show(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
120568
120284
|
const useOverlay = this.overlayType !== "none";
|
|
120569
|
-
const overlayClassName = `ez-scrim ez-scrim
|
|
120285
|
+
const overlayClassName = `ez-scrim ez-scrim--${this.overlayType}`;
|
|
120570
120286
|
let floatingOptions = {
|
|
120571
120287
|
autoClose: this.autoClose,
|
|
120572
120288
|
top,
|
|
@@ -122001,6 +121717,9 @@ const defaultTooltipResolver = (item, _enabled, _level) => {
|
|
|
122001
121717
|
|
|
122002
121718
|
const TreeItem = (props) => {
|
|
122003
121719
|
const { node, selectedId, itemClick, iconClick, iconResolver, tooltipResolver, itemsList } = props;
|
|
121720
|
+
if (!node.visible) {
|
|
121721
|
+
return;
|
|
121722
|
+
}
|
|
122004
121723
|
const treeItem = node.item;
|
|
122005
121724
|
const level = props.level || 1;
|
|
122006
121725
|
const disabled = node.isDisabled();
|
|
@@ -122010,15 +121729,15 @@ const TreeItem = (props) => {
|
|
|
122010
121729
|
if (available) {
|
|
122011
121730
|
itemsList.push(treeItem);
|
|
122012
121731
|
}
|
|
122013
|
-
return (h("ul", {
|
|
122014
|
-
h("li", Object.assign({ class: "tree-item", onClick: () => available && itemClick(treeItem) }, {
|
|
121732
|
+
return (h("ul", { class: level === 1 ? "first-level" : undefined },
|
|
121733
|
+
h("li", Object.assign({ title: tooltipResolver(treeItem, !disabled, level), class: "tree-item", onClick: () => available && itemClick(treeItem) }, {
|
|
122015
121734
|
disabled,
|
|
122016
121735
|
selected: treeItem.id === selectedId,
|
|
122017
121736
|
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezTreeItem_${treeItem.id}`)
|
|
122018
121737
|
}),
|
|
122019
121738
|
h("div", { class: "item-icon-box" }, expandable &&
|
|
122020
121739
|
h("ez-icon", { id: treeItem.id, class: "item-icon", size: "small", iconName: iconResolver(treeItem, expanded, level), onClick: () => available && iconClick(treeItem) })),
|
|
122021
|
-
h("label", { class: "item-label"
|
|
121740
|
+
h("label", { class: "item-label" }, treeItem.label)),
|
|
122022
121741
|
expanded
|
|
122023
121742
|
&& node.getChildren().map(child => h(TreeItem, { selectedId: selectedId, node: child, itemClick: itemClick, iconClick: iconClick, level: level + 1, iconResolver: iconResolver, tooltipResolver: tooltipResolver, itemsList: itemsList }))));
|
|
122024
121743
|
};
|
|
@@ -122026,6 +121745,7 @@ const TreeItem = (props) => {
|
|
|
122026
121745
|
class Node$1 {
|
|
122027
121746
|
constructor(tree, item, parent, isPlaceHolder = false) {
|
|
122028
121747
|
this.children = new Map();
|
|
121748
|
+
this.visible = true;
|
|
122029
121749
|
this.item = item;
|
|
122030
121750
|
this.parent = parent;
|
|
122031
121751
|
this._tree = tree;
|
|
@@ -122046,7 +121766,7 @@ class Node$1 {
|
|
|
122046
121766
|
if (this.isPlaceHolder) {
|
|
122047
121767
|
return;
|
|
122048
121768
|
}
|
|
122049
|
-
this.item = Object.assign(
|
|
121769
|
+
this.item = Object.assign({}, newItem);
|
|
122050
121770
|
this._isLazyLoad = typeof this.item.children === "function" || this.item.childrenCount > 0;
|
|
122051
121771
|
const oldChildren = this.children;
|
|
122052
121772
|
this.children = new Map();
|
|
@@ -122143,8 +121863,13 @@ class Tree extends Node$1 {
|
|
|
122143
121863
|
return this._disabledValues.get(id);
|
|
122144
121864
|
}
|
|
122145
121865
|
load(items) {
|
|
121866
|
+
if (items === this._currentItems) {
|
|
121867
|
+
return;
|
|
121868
|
+
}
|
|
121869
|
+
this._currentItems = items;
|
|
122146
121870
|
const oldChildren = this.children;
|
|
122147
121871
|
this.children = new Map();
|
|
121872
|
+
this._disabledValues.clear();
|
|
122148
121873
|
items.forEach(item => {
|
|
122149
121874
|
const node = oldChildren.get(item.id);
|
|
122150
121875
|
if (node) {
|
|
@@ -122156,6 +121881,11 @@ class Tree extends Node$1 {
|
|
|
122156
121881
|
}
|
|
122157
121882
|
});
|
|
122158
121883
|
}
|
|
121884
|
+
setFilterPattern(pattern) {
|
|
121885
|
+
this._filterPattern = StringUtils$1.replaceAccentuatedCharsKeepSymbols(pattern);
|
|
121886
|
+
this.applyFilter(this);
|
|
121887
|
+
this._changeCallback();
|
|
121888
|
+
}
|
|
122159
121889
|
updateItem(item) {
|
|
122160
121890
|
if (item == undefined) {
|
|
122161
121891
|
return;
|
|
@@ -122169,11 +121899,35 @@ class Tree extends Node$1 {
|
|
|
122169
121899
|
}
|
|
122170
121900
|
async open(path) {
|
|
122171
121901
|
return new Promise(async (resolve) => {
|
|
122172
|
-
await this.
|
|
121902
|
+
await this.walkPath(this, path, node => node.item.expanded = true);
|
|
122173
121903
|
resolve();
|
|
122174
121904
|
});
|
|
122175
121905
|
}
|
|
122176
|
-
|
|
121906
|
+
applyFilter(node) {
|
|
121907
|
+
node.children.forEach((value) => {
|
|
121908
|
+
this.applyFilter(value);
|
|
121909
|
+
});
|
|
121910
|
+
if (node.item == undefined) {
|
|
121911
|
+
return;
|
|
121912
|
+
}
|
|
121913
|
+
const normalizedLabel = StringUtils$1.replaceAccentuatedCharsKeepSymbols(node.item.label);
|
|
121914
|
+
let isVisible = false;
|
|
121915
|
+
if (normalizedLabel.includes(this._filterPattern)) {
|
|
121916
|
+
isVisible = true;
|
|
121917
|
+
}
|
|
121918
|
+
else {
|
|
121919
|
+
const childrenArray = Array.from(node.children.values());
|
|
121920
|
+
for (let i = 0; i < childrenArray.length; i++) {
|
|
121921
|
+
if (childrenArray[i].visible) {
|
|
121922
|
+
isVisible = true;
|
|
121923
|
+
node.item.expanded = true;
|
|
121924
|
+
break;
|
|
121925
|
+
}
|
|
121926
|
+
}
|
|
121927
|
+
}
|
|
121928
|
+
node.visible = isVisible;
|
|
121929
|
+
}
|
|
121930
|
+
async walkPath(parent, path, callback, currentLevel = 0) {
|
|
122177
121931
|
return new Promise(async (resolve) => {
|
|
122178
121932
|
const levels = path.split(">>").map(item => item.trim());
|
|
122179
121933
|
if (levels.length > currentLevel) {
|
|
@@ -122183,7 +121937,7 @@ class Tree extends Node$1 {
|
|
|
122183
121937
|
await this.loadLevel(node);
|
|
122184
121938
|
}
|
|
122185
121939
|
callback(node);
|
|
122186
|
-
await this.
|
|
121940
|
+
await this.walkPath(node, path, callback, currentLevel + 1);
|
|
122187
121941
|
}
|
|
122188
121942
|
}
|
|
122189
121943
|
resolve();
|
|
@@ -122218,7 +121972,6 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122218
121972
|
this.__attachShadow();
|
|
122219
121973
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
122220
121974
|
this.ezOpenItem = createEvent(this, "ezOpenItem", 7);
|
|
122221
|
-
this._tree = new Tree(() => forceUpdate(this));
|
|
122222
121975
|
this._onItemClick = (item) => {
|
|
122223
121976
|
this.value = item;
|
|
122224
121977
|
};
|
|
@@ -122226,6 +121979,7 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122226
121979
|
this.openClose(item);
|
|
122227
121980
|
this.value = item;
|
|
122228
121981
|
};
|
|
121982
|
+
this._tree = new Tree(() => forceUpdate(this));
|
|
122229
121983
|
/**
|
|
122230
121984
|
* Define os itens apresentados na árvore.
|
|
122231
121985
|
*/
|
|
@@ -122234,10 +121988,6 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122234
121988
|
* Define uma função que vai resolver o ícone daquele item. Retorna o nome do ícone da lib de icones do DS.
|
|
122235
121989
|
*/
|
|
122236
121990
|
this.iconResolver = defaultIconResolver;
|
|
122237
|
-
/**
|
|
122238
|
-
* Define uma função que vai resolver o `tooltip` ou `title` daquele item.
|
|
122239
|
-
*/
|
|
122240
|
-
this.tooltipResolver = defaultTooltipResolver;
|
|
122241
121991
|
}
|
|
122242
121992
|
/**
|
|
122243
121993
|
* Efetua a seleção de um item.
|
|
@@ -122293,8 +122043,16 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122293
122043
|
node.item.expanded = true;
|
|
122294
122044
|
}
|
|
122295
122045
|
}
|
|
122296
|
-
|
|
122297
|
-
|
|
122046
|
+
/**
|
|
122047
|
+
* Efetua a seleção de um item.
|
|
122048
|
+
*/
|
|
122049
|
+
async applyFilter(pattern) {
|
|
122050
|
+
this._tree.setFilterPattern(pattern);
|
|
122051
|
+
}
|
|
122052
|
+
observeItems(newValue, oldValue) {
|
|
122053
|
+
if (newValue != oldValue) {
|
|
122054
|
+
this._tree.load(this.items || []);
|
|
122055
|
+
}
|
|
122298
122056
|
}
|
|
122299
122057
|
observeValue() {
|
|
122300
122058
|
var _a;
|
|
@@ -122431,7 +122189,7 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122431
122189
|
:
|
|
122432
122190
|
this._tree.getChildren().map(node => {
|
|
122433
122191
|
var _a;
|
|
122434
|
-
return h(TreeItem, { selectedId: (_a = this.value) === null || _a === void 0 ? void 0 : _a.id, node: node, itemClick: this._onItemClick, iconClick: this._onIconClick, iconResolver: this.iconResolver, tooltipResolver: this.tooltipResolver, itemsList: this._visibleItems });
|
|
122192
|
+
return h(TreeItem, { selectedId: (_a = this.value) === null || _a === void 0 ? void 0 : _a.id, node: node, itemClick: this._onItemClick, iconClick: this._onIconClick, iconResolver: this.iconResolver, tooltipResolver: this.tooltipResolver || defaultTooltipResolver, itemsList: this._visibleItems });
|
|
122435
122193
|
})));
|
|
122436
122194
|
}
|
|
122437
122195
|
get _element() { return this; }
|
|
@@ -122919,7 +122677,7 @@ const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-fi
|
|
|
122919
122677
|
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16],"multiLevel":[4,"multi-level"],"levelResolver":[16],"contentBuilder":[16]}]);
|
|
122920
122678
|
const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16]}]);
|
|
122921
122679
|
const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32]},[[0,"ezSelectionChange","onSelectionChange"]]]);
|
|
122922
|
-
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"
|
|
122680
|
+
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
|
|
122923
122681
|
const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
|
|
122924
122682
|
const EzList = /*@__PURE__*/proxyCustomElement(EzList$1, [1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32]}]);
|
|
122925
122683
|
const EzLoadingBar = /*@__PURE__*/proxyCustomElement(EzLoadingBar$1, [1,"ez-loading-bar",{"_showLoading":[32]}]);
|
|
@@ -122938,7 +122696,7 @@ const EzTextEdit = /*@__PURE__*/proxyCustomElement(EzTextEdit$1, [1,"ez-text-edi
|
|
|
122938
122696
|
const EzTextInput = /*@__PURE__*/proxyCustomElement(EzTextInput$1, [1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"noBorder":[516,"no-border"]}]);
|
|
122939
122697
|
const EzTimeInput = /*@__PURE__*/proxyCustomElement(EzTimeInput$1, [1,"ez-time-input",{"label":[513],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513]}]);
|
|
122940
122698
|
const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"]}]);
|
|
122941
|
-
const EzTree = /*@__PURE__*/proxyCustomElement(EzTree$1, [1,"ez-tree",{"items":[1040],"value":[1040],"selectedId":[1537,"selected-id"],"iconResolver":[16],"tooltipResolver":[16],"_waintingForLoad":[32]},[[2,"keydown","onKeyDownListener"]]]);
|
|
122699
|
+
const EzTree = /*@__PURE__*/proxyCustomElement(EzTree$1, [1,"ez-tree",{"items":[1040],"value":[1040],"selectedId":[1537,"selected-id"],"iconResolver":[16],"tooltipResolver":[16],"_tree":[32],"_waintingForLoad":[32]},[[2,"keydown","onKeyDownListener"]]]);
|
|
122942
122700
|
const EzUpload = /*@__PURE__*/proxyCustomElement(EzUpload$1, [1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040]}]);
|
|
122943
122701
|
const EzViewStack = /*@__PURE__*/proxyCustomElement(EzViewStack$1, [0,"ez-view-stack"]);
|
|
122944
122702
|
const defineCustomElements = (opts) => {
|