@sankhyalabs/ezui 2.7.6 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/cjs/ez-breadcrumb.cjs.entry.js +35 -0
  2. package/dist/cjs/ez-tree.cjs.entry.js +375 -0
  3. package/dist/cjs/ezui.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/collection/collection-manifest.json +2 -0
  6. package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.css +53 -0
  7. package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.js +80 -0
  8. package/dist/collection/components/ez-tree/ez-tree.css +154 -0
  9. package/dist/collection/components/ez-tree/ez-tree.js +428 -0
  10. package/dist/collection/components/ez-tree/interfaces/ITree.js +1 -0
  11. package/dist/collection/components/ez-tree/interfaces/ITreeItem.js +1 -0
  12. package/dist/collection/components/ez-tree/subcomponents/DefaultIconResolver.js +8 -0
  13. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +25 -0
  14. package/dist/collection/components/ez-tree/subcomponents/index.js +1 -0
  15. package/dist/collection/components/ez-tree/types/Node.js +72 -0
  16. package/dist/collection/components/ez-tree/types/Tree.js +70 -0
  17. package/dist/custom-elements/index.d.ts +12 -0
  18. package/dist/custom-elements/index.js +413 -11
  19. package/dist/esm/ez-breadcrumb.entry.js +31 -0
  20. package/dist/esm/ez-tree.entry.js +371 -0
  21. package/dist/esm/ezui.js +1 -1
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/ezui/ezui.esm.js +1 -1
  24. package/dist/ezui/p-171c3236.entry.js +1 -0
  25. package/dist/ezui/p-79e409c6.entry.js +1 -0
  26. package/dist/types/components/ez-breadcrumb/ez-breadcrumb.d.ts +20 -0
  27. package/dist/types/components/ez-tree/ez-tree.d.ts +66 -0
  28. package/dist/types/components/ez-tree/interfaces/ITree.d.ts +5 -0
  29. package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +10 -0
  30. package/dist/types/components/ez-tree/subcomponents/DefaultIconResolver.d.ts +2 -0
  31. package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +13 -0
  32. package/dist/types/components/ez-tree/subcomponents/index.d.ts +1 -0
  33. package/dist/types/components/ez-tree/types/Node.d.ts +20 -0
  34. package/dist/types/components/ez-tree/types/Tree.d.ts +16 -0
  35. package/dist/types/components.d.ts +92 -0
  36. package/package.json +1 -1
  37. package/react/components.d.ts +2 -0
  38. package/react/components.js +2 -0
  39. package/react/components.js.map +1 -1
@@ -407,6 +407,35 @@ let EzApplication$1 = class extends HTMLElement$1 {
407
407
  static get style() { return ezApplicationCss; }
408
408
  };
409
409
 
410
+ const ezBreadcrumbCss = ":host{--breadcrumb__item--label--color--title-primary:var(--color--title-primary, #2B3A54);--breadcrumb__item--label--color--active:var(--color--primary, '#008561');--breadcrumb__item--label--font-weight:var(--text-weight--large, 600);display:block;font-size:var(--text--medium, 14px);font-family:var(--font-pattern, \"Roboto\");font-weight:var(--text-weight--medium, 400)}.breadcrumb__list{list-style-type:none;display:inline-block;margin:0;padding:0}.breadcrumb__item{display:inline-flex;align-items:center;cursor:pointer}.breadcrumb__item--label{color:var(--breadcrumb__item--label--color--title-primary);margin:0px}.breadcrumb__item--icon{padding-right:3px;color:var(--breadcrumb__item--label--color--title-primary)}.breadcrumb__item--chevron{padding:0px 6px;cursor:default}.active{color:var(--breadcrumb__item--label--color--active);font-weight:var(--breadcrumb__item--label--font-weight);cursor:default}.active-icon{--icon--color:var(--breadcrumb__item--label--color--active);cursor:default}";
411
+
412
+ let EzBreadcrumb$1 = class extends HTMLElement$1 {
413
+ constructor() {
414
+ super();
415
+ this.__registerHost();
416
+ this.__attachShadow();
417
+ this.ezClick = createEvent(this, "ezClick", 7);
418
+ /**
419
+ * Lista de itens do breadcrumb.
420
+ */
421
+ this.items = [];
422
+ }
423
+ componentDidLoad() {
424
+ ElementIDUtils.addIDInfo(this._element);
425
+ }
426
+ handleItemClick(itemSelected) {
427
+ this.ezClick.emit(itemSelected);
428
+ }
429
+ render() {
430
+ return (h("nav", { class: "breadcrumb" }, h("ol", { class: "breadcrumb__list" }, this.items.map((item, index) => {
431
+ const isLastItem = index === (this.items.length - 1);
432
+ return (h("li", Object.assign({ class: "breadcrumb__item", id: item.id }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezBreadcrumbItem_${item.id}`) }), item.iconName && h("ez-icon", Object.assign({ class: `breadcrumb__item--icon ${isLastItem ? 'active-icon' : ''}`, size: "small", iconName: item.iconName }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`iconItem${item.id}`)}` })), h("p", { class: `breadcrumb__item--label ${isLastItem ? 'active' : ''}`, onClick: !isLastItem ? () => this.handleItemClick(item) : undefined }, item.label), !isLastItem && h("ez-icon", Object.assign({ class: "breadcrumb__item--chevron", size: "small", iconName: "chevron-right" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`iconPath${item.id}`)}` }))));
433
+ }))));
434
+ }
435
+ get _element() { return this; }
436
+ static get style() { return ezBreadcrumbCss; }
437
+ };
438
+
410
439
  const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--width:'auto';--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:0px;--ez-button--padding-bottom:0px;--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--title--primary, #FFF);--ez-button--font-size:var(--text--medium, 14px);--ez-button--font-family:var(--font-pattern, Arial);--ez-button--font-weight:var(--text-weight--large);--ez-button--background-color:var(--background--medium, #c0c0c0);--ez-button--border-radius:var(--border--radius-large, 12px);--ez-button--border:none;--ez-button--justify-content:center;--ez-button--hover-color:var(--color--primary-600);--ez-button--hover--background-color:var(--background--medium, var(--ez-button--background-color));--ez-button--disabled-color:var(--text--disable);--ez-button--disabled--background-color:var(--color--disable-secondary);--ez-button--focus--border:var(--border--xlarge, 4px solid) var(--color--primary-300);--ez-button--focus--box-shadow:none;--ez-button--active-color:var(--color--primary-700);--ez-button--active--background-color:var(--background--strong);--ez-button--link-color:var(--color--primary, '#008561');--ez-button--link--hover-color:var(--color--primary-700, '#1C1D22');--ez-button--link--small--font-size:var(--text--small, 12px);--ez-button--link--medium--font-size:var(--text--medium, 14px);--ez-button--link--large--font-size:var(--text--large, 16px)}ez-icon{--ez-icon--color:inherit}button{position:relative;display:flex;align-items:center;margin:0;cursor:pointer;transition:background-color 0.2s linear;white-space:nowrap;min-width:var(--ez-button--min-width);width:var(--ez-button--width);height:var(--ez-button--height);font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);padding:var(--ez-button--padding-top) var(--ez-button--padding-right) var(--ez-button--padding-bottom) var(--ez-button--padding-left);border-radius:var(--ez-button--border-radius);background-color:var(--ez-button--background-color);color:var(--ez-button--color);fill:var(--ez-button--color);border:var(--ez-button--border);justify-content:var(--ez-button--justify-content)}button:focus{outline:var(--ez-button--focus--border);box-shadow:var(--ez-button--focus--box-shadow)}button:hover{outline:none;background-color:var(--ez-button--hover--background-color);color:var(--ez-button--hover-color);fill:var(--ez-button--hover-color);--ez-icon--color:var(--ez-button--hover-color)}button:active{outline:none;box-shadow:none;background-color:var(--ez-button--active--background-color);color:var(--ez-button--active-color);fill:var(--ez-button--active-color);--ez-icon--color:var(--ez-button--active-color)}button:disabled{background-color:var(--ez-button--disabled--background-color);color:var(--ez-button--disabled-color);fill:var(--ez-button--disabled-color);border:none;--ez-icon--color:var(--ez-button--disabled-color);cursor:no-drop}.small{height:32px;--ez-button--font-size:var(--text--small, 12px)}.medium{height:42px}.large{height:46px}.btn-icon{padding:0px}.btn-icon--medium{width:42px;min-width:42px;height:42px}.btn-icon--small{width:32px;min-width:32px;height:32px}.btn-icon--large{width:46px;min-width:46px;height:46px}.label-icon{display:flex;flex-direction:column;align-items:center;color:var(--ez-button--color)}.label-icon:hover{color:var(--ez-button--hover-color);fill:var(--ez-button--hover-color);--ez-icon--color:var(--ez-button--hover-color)}.label-icon:active{color:var(--ez-button--active-color);fill:var(--ez-button--active-color);--ez-icon--color:var(--ez-button--active-color)}.label-icon label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);user-select:none}button:disabled+label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);color:var(--ez-button--disabled-color);cursor:no-drop}div.label-icon{cursor:pointer}div.label-icon,button:disabled{cursor:no-drop}a{font-family:var(--ez-button--font-family);font-weight:var(--ez-button--font-weight);color:var(--ez-button--link-color);cursor:pointer;display:flex;align-items:center;justify-content:center;}a:hover{color:var(--ez-button--link--hover-color)}a.small{font-size:var(--ez-button--link--small--font-size);line-height:var(--ez-button--link--small--font-size)}a.medium{font-size:var(--ez-button--link--medium--font-size);line-height:var(--ez-button--link--medium--font-size)}a.large{font-size:var(--ez-button--link--large--font-size);line-height:var(--ez-button--link--large--font-size)}";
411
440
 
412
441
  let EzButton$1 = class extends HTMLElement$1 {
@@ -69111,7 +69140,7 @@ var zIndexChangedCallback = function (o) {
69111
69140
  * Abstract scene graph node.
69112
69141
  * Each node can have zero or one parent and belong to zero or one scene.
69113
69142
  */
69114
- var Node$1 = /** @class */ (function (_super) {
69143
+ var Node$1$1 = /** @class */ (function (_super) {
69115
69144
  __extends$2N(Node, _super);
69116
69145
  function Node() {
69117
69146
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -70001,7 +70030,7 @@ var Shape$1 = /** @class */ (function (_super) {
70001
70030
  SceneChangeDetection({ redraw: RedrawType.MINOR, checkDirtyOnAssignment: true })
70002
70031
  ], Shape.prototype, "fillShadow", void 0);
70003
70032
  return Shape;
70004
- }(Node$1));
70033
+ }(Node$1$1));
70005
70034
 
70006
70035
  /**
70007
70036
  * Wraps the native Canvas element and overrides its CanvasRenderingContext2D to
@@ -73620,7 +73649,7 @@ var Group$1 = /** @class */ (function (_super) {
73620
73649
  })
73621
73650
  ], Group.prototype, "opacity", void 0);
73622
73651
  return Group;
73623
- }(Node$1));
73652
+ }(Node$1$1));
73624
73653
 
73625
73654
  var __values$o = function(o) {
73626
73655
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
@@ -73649,7 +73678,7 @@ var EnterNode$1 = /** @class */ (function () {
73649
73678
  if (this.next === null) {
73650
73679
  return this.parent.insertBefore(node, null);
73651
73680
  }
73652
- if (!Node$1.isNode(this.next)) {
73681
+ if (!Node$1$1.isNode(this.next)) {
73653
73682
  throw new Error(this.next + " is not a Node.");
73654
73683
  }
73655
73684
  return this.parent.insertBefore(node, this.next);
@@ -73723,7 +73752,7 @@ var Selection$1 = /** @class */ (function () {
73723
73752
  */
73724
73753
  Selection.prototype.selectByClass = function (Class) {
73725
73754
  return this.select(function (node) {
73726
- if (Node$1.isNode(node)) {
73755
+ if (Node$1$1.isNode(node)) {
73727
73756
  var children = node.children;
73728
73757
  var n = children.length;
73729
73758
  for (var i = 0; i < n; i++) {
@@ -73737,7 +73766,7 @@ var Selection$1 = /** @class */ (function () {
73737
73766
  };
73738
73767
  Selection.prototype.selectByTag = function (tag) {
73739
73768
  return this.select(function (node) {
73740
- if (Node$1.isNode(node)) {
73769
+ if (Node$1$1.isNode(node)) {
73741
73770
  var children = node.children;
73742
73771
  var n = children.length;
73743
73772
  for (var i = 0; i < n; i++) {
@@ -73752,7 +73781,7 @@ var Selection$1 = /** @class */ (function () {
73752
73781
  Selection.prototype.selectAllByClass = function (Class) {
73753
73782
  return this.selectAll(function (node) {
73754
73783
  var nodes = [];
73755
- if (Node$1.isNode(node)) {
73784
+ if (Node$1$1.isNode(node)) {
73756
73785
  var children = node.children;
73757
73786
  var n = children.length;
73758
73787
  for (var i = 0; i < n; i++) {
@@ -73768,7 +73797,7 @@ var Selection$1 = /** @class */ (function () {
73768
73797
  Selection.prototype.selectAllByTag = function (tag) {
73769
73798
  return this.selectAll(function (node) {
73770
73799
  var nodes = [];
73771
- if (Node$1.isNode(node)) {
73800
+ if (Node$1$1.isNode(node)) {
73772
73801
  var children = node.children;
73773
73802
  var n = children.length;
73774
73803
  for (var i = 0; i < n; i++) {
@@ -73855,7 +73884,7 @@ var Selection$1 = /** @class */ (function () {
73855
73884
  };
73856
73885
  Selection.prototype.remove = function () {
73857
73886
  return this.each(function (node) {
73858
- if (Node$1.isNode(node)) {
73887
+ if (Node$1$1.isNode(node)) {
73859
73888
  var parent_1 = node.parent;
73860
73889
  if (parent_1) {
73861
73890
  parent_1.removeChild(node);
@@ -82601,7 +82630,7 @@ var ClipRect = /** @class */ (function (_super) {
82601
82630
  ScenePathChangeDetection()
82602
82631
  ], ClipRect.prototype, "height", void 0);
82603
82632
  return ClipRect;
82604
- }(Node$1));
82633
+ }(Node$1$1));
82605
82634
 
82606
82635
  var __extends$2f = (function () {
82607
82636
  var extendStatics = function (d, b) {
@@ -121058,6 +121087,375 @@ let EzToast$1 = class extends HTMLElement$1 {
121058
121087
  static get style() { return ezToastCss; }
121059
121088
  };
121060
121089
 
121090
+ const ICON_EXPANDED = "chevron-down";
121091
+ const ICON_COLAPSED = "chevron-right";
121092
+ const defaultIconResolver = (item, expanded, _level) => {
121093
+ if (expanded) {
121094
+ return item.iconExpanded || ICON_EXPANDED;
121095
+ }
121096
+ return item.iconContracted || ICON_COLAPSED;
121097
+ };
121098
+
121099
+ const TreeItem = (props) => {
121100
+ const { node, selectedId, itemClick, iconResolver, itemsList } = props;
121101
+ const treeItem = node.item;
121102
+ const level = props.level || 1;
121103
+ const disabled = node.isDisabled();
121104
+ const expanded = !disabled && treeItem.expanded;
121105
+ const expandable = node.isExpandable();
121106
+ const available = !disabled && !node.isPlaceHolder;
121107
+ if (available) {
121108
+ itemsList.push(treeItem);
121109
+ }
121110
+ return (h("ul", { title: treeItem.label, class: level === 1 ? "first-level" : undefined },
121111
+ h("li", Object.assign({ class: "tree-item", onClick: () => available && itemClick(treeItem) }, {
121112
+ disabled,
121113
+ selected: treeItem.id === selectedId,
121114
+ [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezTreeItem_${treeItem.id}`)
121115
+ }),
121116
+ h("div", { class: "item-icon-box" }, expandable &&
121117
+ h("ez-icon", { id: treeItem.id, class: "item-icon", size: "small", iconName: iconResolver(treeItem, expanded, level) })),
121118
+ h("label", { class: "item-label" }, treeItem.label)),
121119
+ expanded
121120
+ && node.getChildren().map(child => h(TreeItem, { selectedId: selectedId, node: child, itemClick: itemClick, level: level + 1, iconResolver: iconResolver, itemsList: itemsList }))));
121121
+ };
121122
+
121123
+ class Node$1 {
121124
+ constructor(tree, item, parent, isPlaceHolder = false) {
121125
+ this.children = new Map();
121126
+ this.item = item;
121127
+ this.parent = parent;
121128
+ this._tree = tree;
121129
+ this.isPlaceHolder = isPlaceHolder;
121130
+ if (item && !isPlaceHolder) {
121131
+ this._isLazyLoad = typeof item.children === "function" || item.childrenCount > 0;
121132
+ if (Array.isArray(item.children)) {
121133
+ Array.from(item.children).forEach(item => this.addChild(this._tree, item));
121134
+ this._childrenLoaded = true;
121135
+ }
121136
+ }
121137
+ else {
121138
+ this._isLazyLoad = false;
121139
+ this._childrenLoaded = true;
121140
+ }
121141
+ }
121142
+ isDisabled() {
121143
+ if (this.isPlaceHolder) {
121144
+ return false;
121145
+ }
121146
+ return this._tree.isNodeDisabled(this.item.id, this.item.disabled);
121147
+ }
121148
+ updateChildren(children) {
121149
+ if (this.isPlaceHolder) {
121150
+ return;
121151
+ }
121152
+ this.item.children = children;
121153
+ this._childrenLoaded = true;
121154
+ this.children.clear();
121155
+ children.forEach(item => this.addChild(this._tree, Object.assign({}, item)));
121156
+ }
121157
+ addChild(tree, item) {
121158
+ if (!this.children.has(item.id)) {
121159
+ this.children.set(item.id, new Node$1(tree, item, this));
121160
+ }
121161
+ }
121162
+ addPlaceHolder() {
121163
+ this.children.clear();
121164
+ const id = this.item.id;
121165
+ this.children.set(id, new Node$1(undefined, { id: `placeholder_${id}`, label: "Carregando..." }, this, true));
121166
+ }
121167
+ getNode(id) {
121168
+ if (this.children.has(id)) {
121169
+ return this.children.get(id);
121170
+ }
121171
+ const childrenArray = Array.from(this.children.values());
121172
+ for (const child of childrenArray) {
121173
+ const result = child.getNode(id);
121174
+ if (result) {
121175
+ return result;
121176
+ }
121177
+ }
121178
+ }
121179
+ needLoad() {
121180
+ return this._isLazyLoad && !this._childrenLoaded;
121181
+ }
121182
+ isExpandable() {
121183
+ return this._isLazyLoad || this.children.size > 0 || Array.isArray(this.item.children);
121184
+ }
121185
+ getChildren() {
121186
+ if (this.isPlaceHolder) {
121187
+ return [];
121188
+ }
121189
+ if (this.needLoad()) {
121190
+ this._tree.loadChildren(this);
121191
+ }
121192
+ return Array.from(this.children.values());
121193
+ }
121194
+ }
121195
+
121196
+ class Tree extends Node$1 {
121197
+ constructor(changeCallback) {
121198
+ super(undefined);
121199
+ this._disabledValues = new Map();
121200
+ this._changeCallback = changeCallback;
121201
+ }
121202
+ async addChildAt(parentId, item) {
121203
+ const parent = this.getNode(parentId);
121204
+ if (parent == undefined) {
121205
+ return;
121206
+ }
121207
+ parent.addChild(this, item);
121208
+ this._changeCallback();
121209
+ }
121210
+ setDisabled(id, value) {
121211
+ this._disabledValues.set(id, value);
121212
+ this._changeCallback();
121213
+ }
121214
+ isNodeDisabled(id, defaultValue) {
121215
+ if (!this._disabledValues.has(id)) {
121216
+ return defaultValue;
121217
+ }
121218
+ return this._disabledValues.get(id);
121219
+ }
121220
+ load(items) {
121221
+ this.children.clear();
121222
+ items.forEach(item => this.addChild(this, Object.assign({}, item)));
121223
+ }
121224
+ async open(path) {
121225
+ return new Promise(async (resolve) => {
121226
+ await this.walk(this, path, node => node.item.expanded = true);
121227
+ resolve();
121228
+ });
121229
+ }
121230
+ async walk(parent, path, callback, currentLevel = 0) {
121231
+ return new Promise(async (resolve) => {
121232
+ const levels = path.split(">>").map(item => item.trim());
121233
+ if (levels.length > currentLevel) {
121234
+ const node = parent.getNode(levels[currentLevel]);
121235
+ if (node) {
121236
+ if (node.needLoad()) {
121237
+ await this.loadLevel(node);
121238
+ }
121239
+ callback(node);
121240
+ await this.walk(node, path, callback, currentLevel + 1);
121241
+ }
121242
+ }
121243
+ resolve();
121244
+ });
121245
+ }
121246
+ async loadChildren(node) {
121247
+ return new Promise(resolve => {
121248
+ this.loadLevel(node).then(() => {
121249
+ resolve();
121250
+ this._changeCallback();
121251
+ });
121252
+ });
121253
+ }
121254
+ async loadLevel(node) {
121255
+ return new Promise(resolve => {
121256
+ node.addPlaceHolder();
121257
+ const loader = node.item.children;
121258
+ loader(node.item).then(result => {
121259
+ node.updateChildren(result);
121260
+ resolve();
121261
+ });
121262
+ });
121263
+ }
121264
+ }
121265
+
121266
+ const ezTreeCss = ":host{--ez-tree--border-radius:var(--border--radius-small, 8px);--ez-tree--padding-inline-start:20px;--ez-tree--margin:var(--space--extra-small, 3px);--ez-tree--font-family:var(--font-pattern, Arial);--ez-tree--font-size:var(--text--medium, 14px);--ez-tree--selected--font-weight:var(--text-weight--large, 600);--ez-tree--font-weight:var(--text-weight--small, 400);--ez-tree--color:var(--title--primary, #2B3A54);--ez-tree--selected--color:var(--color--primary, #008561);--ez-tree--disabled--color:var(--text--disable, #AFB6C0);--ez-tree__tree-item--height:var(--size-medium, 18px);--ez-tree__tree-item--padding:var(--space--small, 6px);--ez-tree__tree-item--background-color:var(--background--xlight, #FFFFFF);--ez-tree__tree-item--selected--background-color:var(--color--primary-300, #E2F4EF);--ez-tree__tree-item--hover--background-color:var(--background--medium, #F0F3F7);--ez-tree__tree-item--disabled--background-color:var(--ez-tree__tree-Item--background-color);--ez-tree__item-icon-box--height:var(--ez-tree__tree-item--height);--ez-tree__item-icon-box--width:var(--size-medium, 18px);--ez-tree__item-icon-box--padding:var(--ez-tree__tree-item--padding);display:flex;flex-direction:column;margin:0 var(--ez-tree--margin) var(--ez-tree--margin) var(--ez-tree--margin);outline:none}ul{list-style-type:none;margin:0;padding-inline-start:var(--ez-tree--padding-inline-start)}ul.first-level{padding-inline-start:0}.tree-item{display:flex;align-items:center;margin-top:var(--ez-tree--margin);border-radius:var(--ez-tree--border-radius);height:var(--ez-tree__tree-item--height);padding:var(--ez-tree__tree-item--padding)}.tree-item[selected]{background-color:var(--ez-tree__tree-item--selected--background-color)}.tree-item:hover{cursor:pointer;background-color:var(--ez-tree__tree-item--hover--background-color)}.tree-item[disabled],.tree-item[disabled]:hover{cursor:unset;background-color:var(--ez-tree__tree-item--disabled--background-color)}.item-icon-box{display:flex;align-items:center;justify-content:center;width:var(--ez-tree__item-icon-box--width);height:var(--ez-tree__item-icon-box--height);padding:var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) 0}.item-icon{--ez-icon--color:var(--ez-tree--color)}.tree-item[selected] .item-icon{--ez-icon--color:var(--ez-tree--selected--color)}.tree-item[disabled] .item-icon{--ez-icon--color:var(--ez-tree--disabled--color)}.item-label{cursor:inherit;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-tree--font-family);font-size:var(--ez-tree--font-size);font-weight:var(--ez-tree--font-weight);color:var(--ez-tree--color)}.tree-item[selected] .item-label{color:var(--ez-tree--selected--color);font-weight:var(--ez-tree--selected--font-weight)}.tree-item[disabled] .item-label{color:var(--ez-tree--disabled--color)}";
121267
+
121268
+ let EzTree$1 = class extends HTMLElement$1 {
121269
+ constructor() {
121270
+ super();
121271
+ this.__registerHost();
121272
+ this.__attachShadow();
121273
+ this.ezChange = createEvent(this, "ezChange", 7);
121274
+ this.ezOpenItem = createEvent(this, "ezOpenItem", 7);
121275
+ this._tree = new Tree(() => forceUpdate(this));
121276
+ this._onItemClick = (item) => {
121277
+ this.openClose(item);
121278
+ this.value = item;
121279
+ };
121280
+ /**
121281
+ * Define os itens apresentados na árvore.
121282
+ */
121283
+ this.items = [];
121284
+ /**
121285
+ * Define uma função que vai resolver o ícone daquele item. Retorna o nome do ícone da lib de icones do DS.
121286
+ */
121287
+ this.iconResolver = defaultIconResolver;
121288
+ }
121289
+ /**
121290
+ * Efetua a seleção de um item.
121291
+ */
121292
+ async selectItem(id) {
121293
+ const node = this._tree.getNode(id);
121294
+ if (node) {
121295
+ this.value = node.item;
121296
+ }
121297
+ else {
121298
+ this.value = undefined;
121299
+ }
121300
+ }
121301
+ /**
121302
+ * Realiza a abertura de um item, incluindo a hieraquia acima.
121303
+ * Observação para carga dinâmica (Lazyload): O item solicitado já deve
121304
+ * estar carregado na lista. Nos casos onde o item ainda não esteja
121305
+ * carregado o id pode ser uma string no formato "id1>>id2>>id3",
121306
+ * tornando possível a carga a partir de um ponto já carregado.
121307
+ */
121308
+ async openItem(id) {
121309
+ this._waintingForLoad = true;
121310
+ await this._tree.open(id);
121311
+ this._waintingForLoad = false;
121312
+ }
121313
+ /**
121314
+ * Desabilita um ou mais itens.
121315
+ */
121316
+ async disableItem(id) {
121317
+ [].concat(id).forEach(item => this._tree.setDisabled(item, true));
121318
+ }
121319
+ /**
121320
+ * Habilita um ou mais itens.
121321
+ */
121322
+ async enableItem(id) {
121323
+ [].concat(id).forEach(item => this._tree.setDisabled(item, false));
121324
+ }
121325
+ /**
121326
+ * Adiciona um ou mais itens. Opcionalmente pode-se determinar a qual
121327
+ * item da árvore será anexado o item. Caso não informado parentId,
121328
+ * adiciona no item selecionado.
121329
+ * Observação para carga dinâmica (Lazyload): O parentId deve ser
121330
+ * um item carregado atualmente na árvore.
121331
+ */
121332
+ async addChild(item, parentId) {
121333
+ var _a;
121334
+ if (parentId == undefined) {
121335
+ parentId = (_a = this.value) === null || _a === void 0 ? void 0 : _a.id;
121336
+ }
121337
+ this._tree.addChildAt(parentId, item);
121338
+ const node = this._tree.getNode(parentId);
121339
+ if (node) {
121340
+ node.item.expanded = true;
121341
+ }
121342
+ }
121343
+ observeItems() {
121344
+ this._tree.load(this.items);
121345
+ }
121346
+ observeValue() {
121347
+ this.ezChange.emit(this.value);
121348
+ }
121349
+ onKeyDownListener(event) {
121350
+ if (!this.value) {
121351
+ return;
121352
+ }
121353
+ let stop = false;
121354
+ switch (event.key) {
121355
+ case "ArrowUp":
121356
+ this.previousItem();
121357
+ stop = true;
121358
+ break;
121359
+ case "ArrowDown":
121360
+ this.nextItem();
121361
+ stop = true;
121362
+ break;
121363
+ case "ArrowLeft":
121364
+ this.previousLevel();
121365
+ stop = true;
121366
+ break;
121367
+ case "ArrowRight":
121368
+ this.nextLevel();
121369
+ stop = true;
121370
+ break;
121371
+ case " ":
121372
+ this.openClose(this.value);
121373
+ stop = true;
121374
+ break;
121375
+ }
121376
+ if (stop) {
121377
+ event.stopPropagation();
121378
+ event.preventDefault();
121379
+ }
121380
+ }
121381
+ openClose(item) {
121382
+ if (item == undefined) {
121383
+ return;
121384
+ }
121385
+ const expanded = !item.expanded;
121386
+ item.expanded = expanded;
121387
+ if (expanded) {
121388
+ this.ezOpenItem.emit(item);
121389
+ }
121390
+ forceUpdate(this);
121391
+ }
121392
+ previousLevel() {
121393
+ var _a;
121394
+ if (!this.value) {
121395
+ return;
121396
+ }
121397
+ if (this.value.expanded) {
121398
+ this.value.expanded = false;
121399
+ forceUpdate(this);
121400
+ }
121401
+ else {
121402
+ const node = this._tree.getNode(this.value.id);
121403
+ const parentItem = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.item;
121404
+ if (parentItem) {
121405
+ this.value = parentItem;
121406
+ }
121407
+ }
121408
+ }
121409
+ nextLevel() {
121410
+ if (!this.value) {
121411
+ return;
121412
+ }
121413
+ const node = this._tree.getNode(this.value.id);
121414
+ if (!node.isExpandable()) {
121415
+ return;
121416
+ }
121417
+ if (this.value.expanded) {
121418
+ this.nextItem();
121419
+ }
121420
+ else {
121421
+ this.value.expanded = true;
121422
+ forceUpdate(this);
121423
+ }
121424
+ }
121425
+ nextItem() {
121426
+ const nextIndex = this._visibleItems.indexOf(this.value) + 1;
121427
+ if (nextIndex < this._visibleItems.length) {
121428
+ this.value = this._visibleItems[nextIndex];
121429
+ }
121430
+ }
121431
+ previousItem() {
121432
+ const nextIndex = this._visibleItems.indexOf(this.value) - 1;
121433
+ if (nextIndex > -1) {
121434
+ this.value = this._visibleItems[nextIndex];
121435
+ }
121436
+ }
121437
+ render() {
121438
+ ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezTree');
121439
+ if (this.items == undefined) {
121440
+ return;
121441
+ }
121442
+ this._visibleItems = [];
121443
+ return (h(Host, { tabindex: "-1" }, this._waintingForLoad ?
121444
+ h("label", null, "Carregando...")
121445
+ :
121446
+ this._tree.getChildren().map(node => {
121447
+ var _a;
121448
+ return h(TreeItem, { selectedId: (_a = this.value) === null || _a === void 0 ? void 0 : _a.id, node: node, itemClick: this._onItemClick, iconResolver: this.iconResolver, itemsList: this._visibleItems });
121449
+ })));
121450
+ }
121451
+ get _element() { return this; }
121452
+ static get watchers() { return {
121453
+ "items": ["observeItems"],
121454
+ "value": ["observeValue"]
121455
+ }; }
121456
+ static get style() { return ezTreeCss; }
121457
+ };
121458
+
121061
121459
  class RemoteFile {
121062
121460
  constructor(file) {
121063
121461
  this.file = file;
@@ -121518,6 +121916,7 @@ let EzViewStack$1 = class extends HTMLElement$1 {
121518
121916
  const EzActionsButton = /*@__PURE__*/proxyCustomElement(EzActionsButton$1, [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]}]);
121519
121917
  const EzAlert = /*@__PURE__*/proxyCustomElement(EzAlert$1, [1,"ez-alert",{"alertType":[513,"alert-type"]}]);
121520
121918
  const EzApplication = /*@__PURE__*/proxyCustomElement(EzApplication$1, [0,"ez-application"]);
121919
+ const EzBreadcrumb = /*@__PURE__*/proxyCustomElement(EzBreadcrumb$1, [1,"ez-breadcrumb",{"items":[1040]}]);
121521
121920
  const EzButton = /*@__PURE__*/proxyCustomElement(EzButton$1, [1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513]}]);
121522
121921
  const EzCalendar = /*@__PURE__*/proxyCustomElement(EzCalendar$1, [1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"]}]);
121523
121922
  const EzCardItem = /*@__PURE__*/proxyCustomElement(EzCardItem$1, [1,"ez-card-item",{"item":[16]}]);
@@ -121549,6 +121948,7 @@ const EzTextEdit = /*@__PURE__*/proxyCustomElement(EzTextEdit$1, [1,"ez-text-edi
121549
121948
  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"]}]);
121550
121949
  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]}]);
121551
121950
  const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"]}]);
121951
+ const EzTree = /*@__PURE__*/proxyCustomElement(EzTree$1, [1,"ez-tree",{"items":[16],"value":[1040],"iconResolver":[16],"_waintingForLoad":[32]},[[2,"keydown","onKeyDownListener"]]]);
121552
121952
  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]}]);
121553
121953
  const EzViewStack = /*@__PURE__*/proxyCustomElement(EzViewStack$1, [0,"ez-view-stack"]);
121554
121954
  const defineCustomElements = (opts) => {
@@ -121557,6 +121957,7 @@ const defineCustomElements = (opts) => {
121557
121957
  EzActionsButton,
121558
121958
  EzAlert,
121559
121959
  EzApplication,
121960
+ EzBreadcrumb,
121560
121961
  EzButton,
121561
121962
  EzCalendar,
121562
121963
  EzCardItem,
@@ -121588,6 +121989,7 @@ const defineCustomElements = (opts) => {
121588
121989
  EzTextInput,
121589
121990
  EzTimeInput,
121590
121991
  EzToast,
121992
+ EzTree,
121591
121993
  EzUpload,
121592
121994
  EzViewStack
121593
121995
  ].forEach(cmp => {
@@ -121598,4 +122000,4 @@ const defineCustomElements = (opts) => {
121598
122000
  }
121599
122001
  };
121600
122002
 
121601
- export { EzActionsButton, EzAlert, EzApplication, EzButton, EzCalendar, EzCardItem, EzCheck, EzChip, EzCollapsibleBox, EzComboBox, EzDateInput, EzDateTimeInput, EzDialog, EzFileItem, EzFilterInput, EzForm, EzGrid, EzIcon, EzList, EzLoadingBar, EzModal, EzModalContainer, EzNumberInput, EzPopover, EzPopup, EzRadioButton, EzScroller, EzSearch, EzTabselector, EzTextArea, EzTextEdit, EzTextInput, EzTimeInput, EzToast, EzUpload, EzViewStack, defineCustomElements };
122003
+ export { EzActionsButton, EzAlert, EzApplication, EzBreadcrumb, EzButton, EzCalendar, EzCardItem, EzCheck, EzChip, EzCollapsibleBox, EzComboBox, EzDateInput, EzDateTimeInput, EzDialog, EzFileItem, EzFilterInput, EzForm, EzGrid, EzIcon, EzList, EzLoadingBar, EzModal, EzModalContainer, EzNumberInput, EzPopover, EzPopup, EzRadioButton, EzScroller, EzSearch, EzTabselector, EzTextArea, EzTextEdit, EzTextInput, EzTimeInput, EzToast, EzTree, EzUpload, EzViewStack, defineCustomElements };
@@ -0,0 +1,31 @@
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-7bc778b3.js';
2
+ import { ElementIDUtils } from '@sankhyalabs/core';
3
+
4
+ const ezBreadcrumbCss = ":host{--breadcrumb__item--label--color--title-primary:var(--color--title-primary, #2B3A54);--breadcrumb__item--label--color--active:var(--color--primary, '#008561');--breadcrumb__item--label--font-weight:var(--text-weight--large, 600);display:block;font-size:var(--text--medium, 14px);font-family:var(--font-pattern, \"Roboto\");font-weight:var(--text-weight--medium, 400)}.breadcrumb__list{list-style-type:none;display:inline-block;margin:0;padding:0}.breadcrumb__item{display:inline-flex;align-items:center;cursor:pointer}.breadcrumb__item--label{color:var(--breadcrumb__item--label--color--title-primary);margin:0px}.breadcrumb__item--icon{padding-right:3px;color:var(--breadcrumb__item--label--color--title-primary)}.breadcrumb__item--chevron{padding:0px 6px;cursor:default}.active{color:var(--breadcrumb__item--label--color--active);font-weight:var(--breadcrumb__item--label--font-weight);cursor:default}.active-icon{--icon--color:var(--breadcrumb__item--label--color--active);cursor:default}";
5
+
6
+ let EzBreadcrumb = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.ezClick = createEvent(this, "ezClick", 7);
10
+ /**
11
+ * Lista de itens do breadcrumb.
12
+ */
13
+ this.items = [];
14
+ }
15
+ componentDidLoad() {
16
+ ElementIDUtils.addIDInfo(this._element);
17
+ }
18
+ handleItemClick(itemSelected) {
19
+ this.ezClick.emit(itemSelected);
20
+ }
21
+ render() {
22
+ return (h("nav", { class: "breadcrumb" }, h("ol", { class: "breadcrumb__list" }, this.items.map((item, index) => {
23
+ const isLastItem = index === (this.items.length - 1);
24
+ return (h("li", Object.assign({ class: "breadcrumb__item", id: item.id }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezBreadcrumbItem_${item.id}`) }), item.iconName && h("ez-icon", Object.assign({ class: `breadcrumb__item--icon ${isLastItem ? 'active-icon' : ''}`, size: "small", iconName: item.iconName }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`iconItem${item.id}`)}` })), h("p", { class: `breadcrumb__item--label ${isLastItem ? 'active' : ''}`, onClick: !isLastItem ? () => this.handleItemClick(item) : undefined }, item.label), !isLastItem && h("ez-icon", Object.assign({ class: "breadcrumb__item--chevron", size: "small", iconName: "chevron-right" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`iconPath${item.id}`)}` }))));
25
+ }))));
26
+ }
27
+ get _element() { return getElement(this); }
28
+ };
29
+ EzBreadcrumb.style = ezBreadcrumbCss;
30
+
31
+ export { EzBreadcrumb as ez_breadcrumb };