@sankhyalabs/ezui 2.14.0 → 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
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["ez-guide-navigator.cjs",[[1,"ez-guide-navigator",{"
|
|
17
|
+
return index.bootstrapLazy([["ez-guide-navigator.cjs",[[1,"ez-guide-navigator",{"open":[1540],"items":[16],"tooltipResolver":[16],"filterText":[32],"disableItem":[64],"enableItem":[64]}]]],["ez-actions-button.cjs",[[1,"ez-actions-button",{"enabled":[516],"actions":[1040],"size":[513],"showLabel":[516,"show-label"],"displayIcon":[513,"display-icon"],"checkOption":[516,"check-option"],"value":[513],"isTransparent":[516,"is-transparent"],"arrowActive":[516,"arrow-active"],"_selectedAction":[32],"hideActions":[64],"isOpened":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"dialogType":[1025,"dialog-type"],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"show":[64]}]]],["ez-grid.cjs",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"quickFilter":[64]},[[0,"ezSelectionChange","onSelectionChange"]]]]],["ez-modal-container.cjs",[[6,"ez-modal-container",{"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"showTitleBar":[4,"show-title-bar"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"cancelButtonStatus":[1,"cancel-button-status"],"okButtonStatus":[1,"ok-button-status"]}]]],["ez-alert.cjs",[[1,"ez-alert",{"alertType":[513,"alert-type"]}]]],["ez-breadcrumb.cjs",[[1,"ez-breadcrumb",{"items":[1040]}]]],["ez-chip.cjs",[[1,"ez-chip",{"label":[513],"enabled":[516],"removePosition":[513,"remove-position"],"mode":[513],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-dropdown.cjs",[[1,"ez-dropdown",{"items":[1040],"value":[1040],"itemBuilder":[16]}]]],["ez-file-item.cjs",[[1,"ez-file-item",{"canRemove":[4,"can-remove"],"fileName":[1,"file-name"],"iconName":[1,"icon-name"],"fileSize":[2,"file-size"],"progress":[2]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-card-item.cjs",[[1,"ez-card-item",{"item":[16]}]]],["ez-list.cjs",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"clearHistory":[64],"scrollToTop":[64],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-loading-bar.cjs",[[1,"ez-loading-bar",{"_showLoading":[32],"hide":[64],"show":[64]}]]],["ez-modal.cjs",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"overlayType":[513,"overlay-type"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[516,"use-header"],"heightMode":[513,"height-mode"],"ezTitle":[1,"ez-title"]}]]],["ez-radio-button.cjs",[[1,"ez-radio-button",{"value":[1544],"options":[1040],"enabled":[516],"label":[513],"direction":[1537]}]]],["ez-scroller.cjs",[[1,"ez-scroller",{"direction":[1],"locked":[4],"activeShadow":[4,"active-shadow"],"isActive":[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["ez-view-stack.cjs",[[0,"ez-view-stack",{"show":[64],"getSelectedIndex":[64]}]]],["ez-tabselector.cjs",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32]}]]],["ez-text-input.cjs",[[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"],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-collapsible-box.cjs",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"headerAlign":[513,"header-align"],"removable":[516],"editable":[516],"conditionalSave":[16],"_activeEditText":[32],"showHide":[64],"applyFocusTextEdit":[64],"cancelEdition":[64]}]]],["ez-search.cjs",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-date-input.cjs",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-date-time-input.cjs",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-number-input.cjs",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-check.cjs",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"indeterminate":[516],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-text-area.cjs",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-upload.cjs",[[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],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-text-edit.cjs",[[1,"ez-text-edit",{"value":[1],"styled":[16],"_newValue":[32],"applyFocusSelect":[64]}]]],["ez-combo-box.cjs",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["ez-filter-input_3.cjs",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}],[1,"ez-sidebar-button"],[1,"ez-tree",{"items":[1040],"value":[1040],"selectedId":[1537,"selected-id"],"iconResolver":[16],"tooltipResolver":[16],"_tree":[32],"_waintingForLoad":[32],"selectItem":[64],"openItem":[64],"disableItem":[64],"enableItem":[64],"addChild":[64],"applyFilter":[64]},[[2,"keydown","onKeyDownListener"]]]]],["ez-calendar.cjs",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-icon.cjs",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-button.cjs",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-form-view.cjs",[[2,"ez-form-view",{"fields":[16]}]]],["ez-form.cjs",[[2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16],"multiLevel":[4,"multi-level"],"levelResolver":[16],"contentBuilder":[16],"validate":[64]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,131 +1,50 @@
|
|
|
1
|
-
import { Component, Prop, State, h, Host, Method, Element
|
|
2
|
-
import { ElementIDUtils } from
|
|
3
|
-
|
|
4
|
-
const ENTER_KEY = 'Enter';
|
|
1
|
+
import { Component, Prop, State, h, Host, Method, Element } from "@stencil/core";
|
|
2
|
+
import { ElementIDUtils } from "@sankhyalabs/core";
|
|
3
|
+
const ENTER_KEY = "Enter";
|
|
5
4
|
export class EzGuideNavigator {
|
|
6
5
|
constructor() {
|
|
7
|
-
//TODO: Quando a filtragem for feita dentro da árvore, não será mais necessário
|
|
8
|
-
this.guide = new Guide();
|
|
9
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
10
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
11
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
12
|
-
/**
|
|
13
|
-
* Provedor de dados para o guide navigator.
|
|
14
|
-
*/
|
|
15
|
-
this.binder = null;
|
|
16
6
|
/**
|
|
17
7
|
* Define se o menu de navegação está aberto.
|
|
18
|
-
|
|
8
|
+
*/
|
|
19
9
|
this.open = true;
|
|
20
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
21
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
22
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
23
10
|
/**
|
|
24
11
|
* Lista de itens do menu de navegação.
|
|
25
|
-
|
|
12
|
+
*/
|
|
26
13
|
this.items = [];
|
|
27
14
|
/**
|
|
28
15
|
* Valor do campo de pesquisa usado na filtragem de guias.
|
|
29
16
|
*/
|
|
30
|
-
this.filterText =
|
|
17
|
+
this.filterText = "";
|
|
31
18
|
}
|
|
32
19
|
/**
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
async
|
|
36
|
-
|
|
37
|
-
this._tree.items = await this.guide.enableItemsById(id, customTooltip);
|
|
20
|
+
* Desabilita um ou mais itens.
|
|
21
|
+
*/
|
|
22
|
+
async disableItem(id) {
|
|
23
|
+
[].concat(id).forEach(item => this._tree.disableItem(item));
|
|
38
24
|
}
|
|
39
25
|
/**
|
|
40
|
-
* Habilita
|
|
41
|
-
|
|
42
|
-
async
|
|
43
|
-
|
|
44
|
-
this._tree.items = await this.guide.enableAllItems();
|
|
45
|
-
}
|
|
46
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
47
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
48
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
49
|
-
handleBinderChange(newBinder, oldBinder) {
|
|
50
|
-
if (newBinder != oldBinder) {
|
|
51
|
-
this.initTree();
|
|
52
|
-
}
|
|
26
|
+
* Habilita um ou mais itens.
|
|
27
|
+
*/
|
|
28
|
+
async enableItem(id) {
|
|
29
|
+
[].concat(id).forEach(item => this._tree.enableItem(item));
|
|
53
30
|
}
|
|
54
31
|
async handleToggleSidebar() {
|
|
55
32
|
this.open = !this.open;
|
|
56
|
-
if (this.open) {
|
|
57
|
-
await this.initTree();
|
|
58
|
-
this.filterItems();
|
|
59
|
-
}
|
|
60
|
-
;
|
|
61
33
|
}
|
|
62
|
-
handleSelectTreeItem({ detail: parent }) {
|
|
63
|
-
if (!parent.expanded)
|
|
64
|
-
return;
|
|
65
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
66
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
67
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
68
|
-
this.binder.fetchItems(parent.id).then(async (children) => {
|
|
69
|
-
if (!(children === null || children === void 0 ? void 0 : children.length))
|
|
70
|
-
return;
|
|
71
|
-
await this.guide.addChildren(parent, children);
|
|
72
|
-
const { list } = await this.guide.getItemsByLabel(this.filterText, 'label', parent);
|
|
73
|
-
this._tree.items = list;
|
|
74
|
-
this._tree.openItem(parent.hierarchyId || parent.id);
|
|
75
|
-
});
|
|
76
|
-
this.binder.onSelectItem(parent);
|
|
77
|
-
}
|
|
78
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
79
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
80
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
81
34
|
handleFilterTree(event) {
|
|
82
|
-
if (event.key === ENTER_KEY)
|
|
83
|
-
this.
|
|
84
|
-
}
|
|
85
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
86
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
87
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
88
|
-
async setTreeIems(list, first) {
|
|
89
|
-
var _a;
|
|
90
|
-
this._tree.items = list;
|
|
91
|
-
if (first && !(first === null || first === void 0 ? void 0 : first.disabled)) {
|
|
92
|
-
const parentHierarchyId = ((_a = first.hierarchy) === null || _a === void 0 ? void 0 : _a.slice(0, -1).join(HIERARCHY_SEPARATOR)) || first.id;
|
|
93
|
-
await this._tree.openItem(parentHierarchyId);
|
|
94
|
-
await this._tree.selectItem(first.id);
|
|
35
|
+
if (event.key === ENTER_KEY) {
|
|
36
|
+
this._tree.applyFilter(this.filterText);
|
|
95
37
|
}
|
|
96
|
-
else {
|
|
97
|
-
this._tree.selectItem(null);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
101
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
102
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
103
|
-
filterItems() {
|
|
104
|
-
this.guide.getItemsByLabel(this.filterText).then(async ({ list, first }) => {
|
|
105
|
-
this.setTreeIems(list, first);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
//TODO: Destituir esse binder. Rediscutida a arquitetura desse componente
|
|
109
|
-
//vimos que o binder só dificulta a vida de quem vai usar... assim teremos
|
|
110
|
-
//apenas uma lista de IGuideItems e o resto fica como a própria árvore...
|
|
111
|
-
async initTree() {
|
|
112
|
-
if (!this.binder)
|
|
113
|
-
return;
|
|
114
|
-
const binderItems = await this.binder.fetchItems();
|
|
115
|
-
await this.guide.setList(binderItems);
|
|
116
|
-
const guideItems = await this.guide.getList();
|
|
117
|
-
this.setTreeIems(guideItems);
|
|
118
|
-
}
|
|
119
|
-
componentDidLoad() {
|
|
120
|
-
ElementIDUtils.addIDInfoIfNotExists(this._element);
|
|
121
|
-
this.initTree();
|
|
122
38
|
}
|
|
123
39
|
render() {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
40
|
+
ElementIDUtils.addIDInfoIfNotExists(this._element);
|
|
41
|
+
return (h(Host, null,
|
|
42
|
+
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") }),
|
|
43
|
+
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") },
|
|
44
|
+
h("div", { role: "search", class: "ez-guide-navigator__actions" },
|
|
45
|
+
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") }),
|
|
46
|
+
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") })),
|
|
47
|
+
h("ez-tree", { ref: element => (this._tree = element), items: this.items, "data-element-id": ElementIDUtils.getInternalIDInfo("tree"), tooltipResolver: this.tooltipResolver }))));
|
|
129
48
|
}
|
|
130
49
|
static get is() { return "ez-guide-navigator"; }
|
|
131
50
|
static get encapsulation() { return "shadow"; }
|
|
@@ -136,15 +55,37 @@ export class EzGuideNavigator {
|
|
|
136
55
|
"$": ["ez-guide-navigator.css"]
|
|
137
56
|
}; }
|
|
138
57
|
static get properties() { return {
|
|
139
|
-
"
|
|
58
|
+
"open": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"mutable": true,
|
|
61
|
+
"complexType": {
|
|
62
|
+
"original": "boolean",
|
|
63
|
+
"resolved": "boolean",
|
|
64
|
+
"references": {}
|
|
65
|
+
},
|
|
66
|
+
"required": false,
|
|
67
|
+
"optional": false,
|
|
68
|
+
"docs": {
|
|
69
|
+
"tags": [],
|
|
70
|
+
"text": "Define se o menu de navega\u00E7\u00E3o est\u00E1 aberto."
|
|
71
|
+
},
|
|
72
|
+
"attribute": "open",
|
|
73
|
+
"reflect": true,
|
|
74
|
+
"defaultValue": "true"
|
|
75
|
+
},
|
|
76
|
+
"items": {
|
|
140
77
|
"type": "unknown",
|
|
141
78
|
"mutable": false,
|
|
142
79
|
"complexType": {
|
|
143
|
-
"original": "
|
|
144
|
-
"resolved": "
|
|
80
|
+
"original": "Array<IGuideItem>",
|
|
81
|
+
"resolved": "IGuideItem[]",
|
|
145
82
|
"references": {
|
|
146
|
-
"
|
|
147
|
-
"location": "
|
|
83
|
+
"Array": {
|
|
84
|
+
"location": "global"
|
|
85
|
+
},
|
|
86
|
+
"IGuideItem": {
|
|
87
|
+
"location": "import",
|
|
88
|
+
"path": "./interfaces"
|
|
148
89
|
}
|
|
149
90
|
}
|
|
150
91
|
},
|
|
@@ -152,43 +93,41 @@ export class EzGuideNavigator {
|
|
|
152
93
|
"optional": false,
|
|
153
94
|
"docs": {
|
|
154
95
|
"tags": [],
|
|
155
|
-
"text": "
|
|
96
|
+
"text": "Lista de itens do menu de navega\u00E7\u00E3o."
|
|
156
97
|
},
|
|
157
|
-
"defaultValue": "
|
|
98
|
+
"defaultValue": "[]"
|
|
158
99
|
},
|
|
159
|
-
"
|
|
160
|
-
"type": "
|
|
161
|
-
"mutable":
|
|
100
|
+
"tooltipResolver": {
|
|
101
|
+
"type": "unknown",
|
|
102
|
+
"mutable": false,
|
|
162
103
|
"complexType": {
|
|
163
|
-
"original": "boolean",
|
|
164
|
-
"resolved": "boolean",
|
|
165
|
-
"references": {
|
|
104
|
+
"original": "(item: IGuideItem, enabled: boolean, level: number) => string",
|
|
105
|
+
"resolved": "(item: IGuideItem, enabled: boolean, level: number) => string",
|
|
106
|
+
"references": {
|
|
107
|
+
"IGuideItem": {
|
|
108
|
+
"location": "import",
|
|
109
|
+
"path": "./interfaces"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
166
112
|
},
|
|
167
113
|
"required": false,
|
|
168
114
|
"optional": false,
|
|
169
115
|
"docs": {
|
|
170
116
|
"tags": [],
|
|
171
|
-
"text": "Define
|
|
172
|
-
}
|
|
173
|
-
"attribute": "open",
|
|
174
|
-
"reflect": true,
|
|
175
|
-
"defaultValue": "true"
|
|
117
|
+
"text": "Define uma fun\u00E7\u00E3o que vai resolver o `tooltip` ou `title` daquele item."
|
|
118
|
+
}
|
|
176
119
|
}
|
|
177
120
|
}; }
|
|
178
121
|
static get states() { return {
|
|
179
|
-
"items": {},
|
|
180
122
|
"filterText": {}
|
|
181
123
|
}; }
|
|
182
124
|
static get methods() { return {
|
|
183
|
-
"
|
|
125
|
+
"disableItem": {
|
|
184
126
|
"complexType": {
|
|
185
|
-
"signature": "(id:
|
|
127
|
+
"signature": "(id: string | Array<string>) => Promise<void>",
|
|
186
128
|
"parameters": [{
|
|
187
129
|
"tags": [],
|
|
188
130
|
"text": ""
|
|
189
|
-
}, {
|
|
190
|
-
"tags": [],
|
|
191
|
-
"text": ""
|
|
192
131
|
}],
|
|
193
132
|
"references": {
|
|
194
133
|
"Promise": {
|
|
@@ -201,30 +140,32 @@ export class EzGuideNavigator {
|
|
|
201
140
|
"return": "Promise<void>"
|
|
202
141
|
},
|
|
203
142
|
"docs": {
|
|
204
|
-
"text": "
|
|
143
|
+
"text": "Desabilita um ou mais itens.",
|
|
205
144
|
"tags": []
|
|
206
145
|
}
|
|
207
146
|
},
|
|
208
|
-
"
|
|
147
|
+
"enableItem": {
|
|
209
148
|
"complexType": {
|
|
210
|
-
"signature": "() => Promise<void>",
|
|
211
|
-
"parameters": [
|
|
149
|
+
"signature": "(id: string | Array<string>) => Promise<void>",
|
|
150
|
+
"parameters": [{
|
|
151
|
+
"tags": [],
|
|
152
|
+
"text": ""
|
|
153
|
+
}],
|
|
212
154
|
"references": {
|
|
213
155
|
"Promise": {
|
|
214
156
|
"location": "global"
|
|
157
|
+
},
|
|
158
|
+
"Array": {
|
|
159
|
+
"location": "global"
|
|
215
160
|
}
|
|
216
161
|
},
|
|
217
162
|
"return": "Promise<void>"
|
|
218
163
|
},
|
|
219
164
|
"docs": {
|
|
220
|
-
"text": "Habilita
|
|
165
|
+
"text": "Habilita um ou mais itens.",
|
|
221
166
|
"tags": []
|
|
222
167
|
}
|
|
223
168
|
}
|
|
224
169
|
}; }
|
|
225
170
|
static get elementRef() { return "_element"; }
|
|
226
|
-
static get watchers() { return [{
|
|
227
|
-
"propName": "binder",
|
|
228
|
-
"methodName": "handleBinderChange"
|
|
229
|
-
}]; }
|
|
230
171
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/*@doc Define a cor de fundo do popover.*/
|
|
9
9
|
--ez-popover__box--background-color: var(--background--xlight, #fff);
|
|
10
10
|
/*@doc Define a camada de visibilidade do popover.*/
|
|
11
|
-
--ez-popover__box--z-index: var(--
|
|
11
|
+
--ez-popover__box--z-index: var(--most-visible, 3);
|
|
12
12
|
|
|
13
13
|
/***************
|
|
14
14
|
host style
|
|
@@ -98,7 +98,7 @@ export class EzPopover {
|
|
|
98
98
|
*/
|
|
99
99
|
async show(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
100
100
|
const useOverlay = this.overlayType !== "none";
|
|
101
|
-
const overlayClassName = `ez-scrim ez-scrim
|
|
101
|
+
const overlayClassName = `ez-scrim ez-scrim--${this.overlayType}`;
|
|
102
102
|
let floatingOptions = {
|
|
103
103
|
autoClose: this.autoClose,
|
|
104
104
|
top,
|
|
@@ -5,7 +5,6 @@ import { TreeItem } from './subcomponents/TreeItem';
|
|
|
5
5
|
import { Tree } from './types/Tree';
|
|
6
6
|
export class EzTree {
|
|
7
7
|
constructor() {
|
|
8
|
-
this._tree = new Tree(() => forceUpdate(this));
|
|
9
8
|
this._onItemClick = (item) => {
|
|
10
9
|
this.value = item;
|
|
11
10
|
};
|
|
@@ -13,6 +12,7 @@ export class EzTree {
|
|
|
13
12
|
this.openClose(item);
|
|
14
13
|
this.value = item;
|
|
15
14
|
};
|
|
15
|
+
this._tree = new Tree(() => forceUpdate(this));
|
|
16
16
|
/**
|
|
17
17
|
* Define os itens apresentados na árvore.
|
|
18
18
|
*/
|
|
@@ -21,10 +21,6 @@ export class EzTree {
|
|
|
21
21
|
* Define uma função que vai resolver o ícone daquele item. Retorna o nome do ícone da lib de icones do DS.
|
|
22
22
|
*/
|
|
23
23
|
this.iconResolver = defaultIconResolver;
|
|
24
|
-
/**
|
|
25
|
-
* Define uma função que vai resolver o `tooltip` ou `title` daquele item.
|
|
26
|
-
*/
|
|
27
|
-
this.tooltipResolver = defaultTooltipResolver;
|
|
28
24
|
}
|
|
29
25
|
/**
|
|
30
26
|
* Efetua a seleção de um item.
|
|
@@ -80,8 +76,16 @@ export class EzTree {
|
|
|
80
76
|
node.item.expanded = true;
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Efetua a seleção de um item.
|
|
81
|
+
*/
|
|
82
|
+
async applyFilter(pattern) {
|
|
83
|
+
this._tree.setFilterPattern(pattern);
|
|
84
|
+
}
|
|
85
|
+
observeItems(newValue, oldValue) {
|
|
86
|
+
if (newValue != oldValue) {
|
|
87
|
+
this._tree.load(this.items || []);
|
|
88
|
+
}
|
|
85
89
|
}
|
|
86
90
|
observeValue() {
|
|
87
91
|
var _a;
|
|
@@ -218,7 +222,7 @@ export class EzTree {
|
|
|
218
222
|
:
|
|
219
223
|
this._tree.getChildren().map(node => {
|
|
220
224
|
var _a;
|
|
221
|
-
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 });
|
|
225
|
+
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 });
|
|
222
226
|
})));
|
|
223
227
|
}
|
|
224
228
|
static get is() { return "ez-tree"; }
|
|
@@ -330,11 +334,11 @@ export class EzTree {
|
|
|
330
334
|
"docs": {
|
|
331
335
|
"tags": [],
|
|
332
336
|
"text": "Define uma fun\u00E7\u00E3o que vai resolver o `tooltip` ou `title` daquele item."
|
|
333
|
-
}
|
|
334
|
-
"defaultValue": "defaultTooltipResolver"
|
|
337
|
+
}
|
|
335
338
|
}
|
|
336
339
|
}; }
|
|
337
340
|
static get states() { return {
|
|
341
|
+
"_tree": {},
|
|
338
342
|
"_waintingForLoad": {}
|
|
339
343
|
}; }
|
|
340
344
|
static get events() { return [{
|
|
@@ -486,6 +490,25 @@ export class EzTree {
|
|
|
486
490
|
"text": "Adiciona um ou mais itens. Opcionalmente pode-se determinar a qual\nitem da \u00E1rvore ser\u00E1 anexado o item. Caso n\u00E3o informado parentId,\nadiciona no item selecionado.\nObserva\u00E7\u00E3o para carga din\u00E2mica (Lazyload): O parentId deve ser\num item carregado atualmente na \u00E1rvore.",
|
|
487
491
|
"tags": []
|
|
488
492
|
}
|
|
493
|
+
},
|
|
494
|
+
"applyFilter": {
|
|
495
|
+
"complexType": {
|
|
496
|
+
"signature": "(pattern: string) => Promise<void>",
|
|
497
|
+
"parameters": [{
|
|
498
|
+
"tags": [],
|
|
499
|
+
"text": ""
|
|
500
|
+
}],
|
|
501
|
+
"references": {
|
|
502
|
+
"Promise": {
|
|
503
|
+
"location": "global"
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
"return": "Promise<void>"
|
|
507
|
+
},
|
|
508
|
+
"docs": {
|
|
509
|
+
"text": "Efetua a sele\u00E7\u00E3o de um item.",
|
|
510
|
+
"tags": []
|
|
511
|
+
}
|
|
489
512
|
}
|
|
490
513
|
}; }
|
|
491
514
|
static get elementRef() { return "_element"; }
|
|
@@ -2,6 +2,9 @@ import { ElementIDUtils } from "@sankhyalabs/core";
|
|
|
2
2
|
import { h } from "@stencil/core";
|
|
3
3
|
export const TreeItem = (props) => {
|
|
4
4
|
const { node, selectedId, itemClick, iconClick, iconResolver, tooltipResolver, itemsList } = props;
|
|
5
|
+
if (!node.visible) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
5
8
|
const treeItem = node.item;
|
|
6
9
|
const level = props.level || 1;
|
|
7
10
|
const disabled = node.isDisabled();
|
|
@@ -11,15 +14,15 @@ export const TreeItem = (props) => {
|
|
|
11
14
|
if (available) {
|
|
12
15
|
itemsList.push(treeItem);
|
|
13
16
|
}
|
|
14
|
-
return (h("ul", {
|
|
15
|
-
h("li", Object.assign({ class: "tree-item", onClick: () => available && itemClick(treeItem) }, {
|
|
17
|
+
return (h("ul", { class: level === 1 ? "first-level" : undefined },
|
|
18
|
+
h("li", Object.assign({ title: tooltipResolver(treeItem, !disabled, level), class: "tree-item", onClick: () => available && itemClick(treeItem) }, {
|
|
16
19
|
disabled,
|
|
17
20
|
selected: treeItem.id === selectedId,
|
|
18
21
|
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezTreeItem_${treeItem.id}`)
|
|
19
22
|
}),
|
|
20
23
|
h("div", { class: "item-icon-box" }, expandable &&
|
|
21
24
|
h("ez-icon", { id: treeItem.id, class: "item-icon", size: "small", iconName: iconResolver(treeItem, expanded, level), onClick: () => available && iconClick(treeItem) })),
|
|
22
|
-
h("label", { class: "item-label"
|
|
25
|
+
h("label", { class: "item-label" }, treeItem.label)),
|
|
23
26
|
expanded
|
|
24
27
|
&& node.getChildren().map(child => h(TreeItem, { selectedId: selectedId, node: child, itemClick: itemClick, iconClick: iconClick, level: level + 1, iconResolver: iconResolver, tooltipResolver: tooltipResolver, itemsList: itemsList }))));
|
|
25
28
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export class Node {
|
|
2
2
|
constructor(tree, item, parent, isPlaceHolder = false) {
|
|
3
3
|
this.children = new Map();
|
|
4
|
+
this.visible = true;
|
|
4
5
|
this.item = item;
|
|
5
6
|
this.parent = parent;
|
|
6
7
|
this._tree = tree;
|
|
@@ -21,7 +22,7 @@ export class Node {
|
|
|
21
22
|
if (this.isPlaceHolder) {
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
|
-
this.item = Object.assign(
|
|
25
|
+
this.item = Object.assign({}, newItem);
|
|
25
26
|
this._isLazyLoad = typeof this.item.children === "function" || this.item.childrenCount > 0;
|
|
26
27
|
const oldChildren = this.children;
|
|
27
28
|
this.children = new Map();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StringUtils } from "@sankhyalabs/core";
|
|
1
2
|
import { Node } from "./Node";
|
|
2
3
|
export class Tree extends Node {
|
|
3
4
|
constructor(changeCallback) {
|
|
@@ -24,8 +25,13 @@ export class Tree extends Node {
|
|
|
24
25
|
return this._disabledValues.get(id);
|
|
25
26
|
}
|
|
26
27
|
load(items) {
|
|
28
|
+
if (items === this._currentItems) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
this._currentItems = items;
|
|
27
32
|
const oldChildren = this.children;
|
|
28
33
|
this.children = new Map();
|
|
34
|
+
this._disabledValues.clear();
|
|
29
35
|
items.forEach(item => {
|
|
30
36
|
const node = oldChildren.get(item.id);
|
|
31
37
|
if (node) {
|
|
@@ -37,6 +43,11 @@ export class Tree extends Node {
|
|
|
37
43
|
}
|
|
38
44
|
});
|
|
39
45
|
}
|
|
46
|
+
setFilterPattern(pattern) {
|
|
47
|
+
this._filterPattern = StringUtils.replaceAccentuatedCharsKeepSymbols(pattern);
|
|
48
|
+
this.applyFilter(this);
|
|
49
|
+
this._changeCallback();
|
|
50
|
+
}
|
|
40
51
|
updateItem(item) {
|
|
41
52
|
if (item == undefined) {
|
|
42
53
|
return;
|
|
@@ -50,11 +61,35 @@ export class Tree extends Node {
|
|
|
50
61
|
}
|
|
51
62
|
async open(path) {
|
|
52
63
|
return new Promise(async (resolve) => {
|
|
53
|
-
await this.
|
|
64
|
+
await this.walkPath(this, path, node => node.item.expanded = true);
|
|
54
65
|
resolve();
|
|
55
66
|
});
|
|
56
67
|
}
|
|
57
|
-
|
|
68
|
+
applyFilter(node) {
|
|
69
|
+
node.children.forEach((value) => {
|
|
70
|
+
this.applyFilter(value);
|
|
71
|
+
});
|
|
72
|
+
if (node.item == undefined) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const normalizedLabel = StringUtils.replaceAccentuatedCharsKeepSymbols(node.item.label);
|
|
76
|
+
let isVisible = false;
|
|
77
|
+
if (normalizedLabel.includes(this._filterPattern)) {
|
|
78
|
+
isVisible = true;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const childrenArray = Array.from(node.children.values());
|
|
82
|
+
for (let i = 0; i < childrenArray.length; i++) {
|
|
83
|
+
if (childrenArray[i].visible) {
|
|
84
|
+
isVisible = true;
|
|
85
|
+
node.item.expanded = true;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
node.visible = isVisible;
|
|
91
|
+
}
|
|
92
|
+
async walkPath(parent, path, callback, currentLevel = 0) {
|
|
58
93
|
return new Promise(async (resolve) => {
|
|
59
94
|
const levels = path.split(">>").map(item => item.trim());
|
|
60
95
|
if (levels.length > currentLevel) {
|
|
@@ -64,7 +99,7 @@ export class Tree extends Node {
|
|
|
64
99
|
await this.loadLevel(node);
|
|
65
100
|
}
|
|
66
101
|
callback(node);
|
|
67
|
-
await this.
|
|
102
|
+
await this.walkPath(node, path, callback, currentLevel + 1);
|
|
68
103
|
}
|
|
69
104
|
}
|
|
70
105
|
resolve();
|