@genexus/genexus-ide-ui 0.0.29 → 0.0.31

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 (82) hide show
  1. package/dist/cjs/ch-action-group_2.cjs.entry.js +2 -9
  2. package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
  3. package/dist/cjs/ch-dropdown-item.cjs.entry.js +8 -8
  4. package/dist/cjs/ch-dropdown.cjs.entry.js +11 -10
  5. package/dist/cjs/ch-suggest_4.cjs.entry.js +1 -0
  6. package/dist/cjs/ch-test-action-group.cjs.entry.js +2 -2
  7. package/dist/cjs/ch-test-tree-x.cjs.entry.js +150 -80
  8. package/dist/cjs/ch-tree-x_3.cjs.entry.js +211 -132
  9. package/dist/cjs/ch-window_2.cjs.entry.js +28 -12
  10. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  11. package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +3 -3
  12. package/dist/cjs/gxg-combo-box_6.cjs.entry.js +10 -4
  13. package/dist/cjs/gxg-date-picker.cjs.entry.js +4 -4
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/collection/components/team-dev-commit/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
  16. package/dist/collection/components/team-dev-commit/team-dev-commit.css +3 -0
  17. package/dist/collection/components/team-dev-commit/team-dev-commit.js +2 -2
  18. package/dist/components/action-group-item.js +1 -9
  19. package/dist/components/action-group.js +1 -1
  20. package/dist/components/ch-suggest2.js +1 -0
  21. package/dist/components/ch-test-action-group.js +2 -2
  22. package/dist/components/ch-test-tree-x.js +157 -83
  23. package/dist/components/ch-window2.js +31 -13
  24. package/dist/components/checkbox.js +1 -1
  25. package/dist/components/combo-box-item.js +2 -2
  26. package/dist/components/combo-box.js +8 -2
  27. package/dist/components/dropdown-item.js +8 -8
  28. package/dist/components/dropdown.js +11 -10
  29. package/dist/components/gx-ide-team-dev-commit.js +3 -3
  30. package/dist/components/gxg-date-picker.js +4 -4
  31. package/dist/components/tree-x-list-item.js +31 -17
  32. package/dist/components/tree-x-list.js +9 -4
  33. package/dist/components/tree-x.js +182 -117
  34. package/dist/esm/ch-action-group_2.entry.js +2 -9
  35. package/dist/esm/ch-checkbox.entry.js +1 -1
  36. package/dist/esm/ch-dropdown-item.entry.js +8 -8
  37. package/dist/esm/ch-dropdown.entry.js +11 -10
  38. package/dist/esm/ch-suggest_4.entry.js +1 -0
  39. package/dist/esm/ch-test-action-group.entry.js +2 -2
  40. package/dist/esm/ch-test-tree-x.entry.js +150 -80
  41. package/dist/esm/ch-tree-x_3.entry.js +211 -132
  42. package/dist/esm/ch-window_2.entry.js +28 -12
  43. package/dist/esm/genexus-ide-ui.js +1 -1
  44. package/dist/esm/gx-ide-team-dev-commit.entry.js +3 -3
  45. package/dist/esm/gxg-combo-box_6.entry.js +10 -4
  46. package/dist/esm/gxg-date-picker.entry.js +4 -4
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/genexus-ide-ui/genexus-ide-ui.css +1 -1
  49. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  50. package/dist/genexus-ide-ui/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
  51. package/dist/genexus-ide-ui/p-1fe05a05.entry.js +1 -0
  52. package/dist/genexus-ide-ui/p-24f47ee2.entry.js +1 -0
  53. package/dist/genexus-ide-ui/{p-54bab171.entry.js → p-28d0afda.entry.js} +1 -1
  54. package/dist/genexus-ide-ui/{p-6050cdba.entry.js → p-48412811.entry.js} +1 -1
  55. package/dist/genexus-ide-ui/p-714bd8ea.entry.js +1 -0
  56. package/dist/genexus-ide-ui/p-8c2ab053.entry.js +1 -0
  57. package/dist/genexus-ide-ui/p-976e8118.entry.js +1 -0
  58. package/dist/genexus-ide-ui/p-a5463fc9.entry.js +1 -0
  59. package/dist/genexus-ide-ui/p-b54f448c.entry.js +1 -0
  60. package/dist/genexus-ide-ui/p-bb1809cb.entry.js +1 -0
  61. package/dist/genexus-ide-ui/p-cf41f154.entry.js +1 -0
  62. package/dist/genexus-ide-ui/p-e8a21ed7.entry.js +1 -0
  63. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group-item/action-group-item.css +0 -1
  64. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/checkbox/checkbox.css +5 -3
  65. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown/dropdown.css +15 -33
  66. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown-item/dropdown-item.css +0 -4
  67. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-x.css +0 -10
  68. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x/tree-x.css +20 -3
  69. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x-list-item/tree-x-list-item.css +25 -8
  70. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/window/ch-window.css +51 -2
  71. package/dist/node_modules/@genexus/gemini/dist/collection/components/combo-box-item/combo-box-item.css +1 -1
  72. package/package.json +3 -3
  73. package/dist/genexus-ide-ui/p-097a3eeb.entry.js +0 -1
  74. package/dist/genexus-ide-ui/p-3d9a4ede.entry.js +0 -1
  75. package/dist/genexus-ide-ui/p-4bbe1c18.entry.js +0 -1
  76. package/dist/genexus-ide-ui/p-5c64c57f.entry.js +0 -1
  77. package/dist/genexus-ide-ui/p-5ff04ebe.entry.js +0 -1
  78. package/dist/genexus-ide-ui/p-757f8567.entry.js +0 -1
  79. package/dist/genexus-ide-ui/p-8d46f8d8.entry.js +0 -1
  80. package/dist/genexus-ide-ui/p-a0e85c2a.entry.js +0 -1
  81. package/dist/genexus-ide-ui/p-e4cac203.entry.js +0 -1
  82. package/dist/genexus-ide-ui/p-f8561da6.entry.js +0 -1
@@ -126,7 +126,7 @@ const ChActionGroup = class {
126
126
  }
127
127
  connectActionsContainerObserver() {
128
128
  this.actionsContainerWatcher = new ResizeObserver(this.updateDisplayedActionInFrame);
129
- this.actionsContainerWatcher.observe(this.el);
129
+ this.actionsContainerWatcher.observe(this.actionsContainer);
130
130
  }
131
131
  disconnectActionsObserver() {
132
132
  if (this.actionsWatcher) {
@@ -173,15 +173,11 @@ const ChActionGroup = class {
173
173
  };
174
174
  ChActionGroup.style = actionGroupCss;
175
175
 
176
- const actionGroupItemCss = "ch-action-group-item[floating]{position:absolute;visibility:hidden}";
176
+ const actionGroupItemCss = "ch-action-group-item[floating]{visibility:hidden}";
177
177
 
178
178
  const ChActionGroupItem = class {
179
179
  constructor(hostRef) {
180
180
  index.registerInstance(this, hostRef);
181
- /**
182
- * `true` to ignore the floating property value.
183
- */
184
- this.avoidFloating = false;
185
181
  /**
186
182
  * `true` if the control is floating. Useful to implement the
187
183
  * `"ResponsiveCollapse"` value for the `itemsOverflowBehavior` property of
@@ -190,9 +186,6 @@ const ChActionGroupItem = class {
190
186
  this.floating = false;
191
187
  }
192
188
  componentWillLoad() {
193
- if (this.avoidFloating) {
194
- return;
195
- }
196
189
  const parentAction = this.el.closest("ch-action-group");
197
190
  // Hide items at the start to improve CLS
198
191
  if (parentAction) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-5a32426a.js');
6
6
  const reserverdNames = require('./reserverd-names-1b00889a.js');
7
7
 
8
- const checkboxCss = "*,::before,::after{box-sizing:border-box}:host{display:flex;align-items:center;align-self:stretch;outline:unset;touch-action:manipulation;user-select:none}:host(.ch-checkbox--actionable) :is(.input,.label){cursor:pointer}.container{position:relative;width:min(1em, 20px);height:min(1em, 20px);border:1px solid var(--option-border-color, #000);border-radius:18.75%}.container--checked{background-color:var(--option-checked-color, #ffffff00)}.container:focus-within{box-shadow:0 0 1px 1px #00000040}.input{display:flex;width:100%;height:100%;opacity:0;margin:0;padding:0}.option{position:absolute;inset:calc(50% - min(0.25em, 5px));width:min(0.5em, 10px);height:min(0.5em, 10px);background-color:#000;opacity:0;pointer-events:none}.option--checked{opacity:1;-webkit-mask:url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' %3E%3Cpath fill='currentColor' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z' /%3E%3C/svg%3E\")}.option--indeterminate{opacity:1}.label{margin-inline-start:min(0.35em, 7px)}";
8
+ const checkboxCss = "*,::before,::after{box-sizing:border-box}:host{display:flex;align-items:center;align-self:stretch;outline:unset;touch-action:manipulation;user-select:none}:host(.ch-checkbox--actionable) :is(.input,.label){cursor:pointer}.container{position:relative;width:min(1em, 20px);height:min(1em, 20px);border:1px solid var(--option-border-color, #000);border-radius:18.75%}.container--checked{background-color:var(--option-checked-color, #ffffff00)}.container:focus-within{box-shadow:0 0 1px 1px #00000040}.input{display:flex;width:100%;height:100%;opacity:0;margin:0;padding:0}.option{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);width:50%;height:50%;background-color:#000;opacity:0;pointer-events:none}.option--checked{opacity:1;-webkit-mask:url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' %3E%3Cpath fill='currentColor' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z' /%3E%3C/svg%3E\")}.option--indeterminate{opacity:1}.label{margin-inline-start:min(0.35em, 7px)}";
9
9
 
10
10
  const CHECKBOX_ID = "checkbox";
11
11
  const PARTS = (checked, indeterminate) => `${checked ? " checked" : ""}${indeterminate ? " indeterminate" : ""}`;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-5a32426a.js');
6
6
 
7
- const dropdownItemCss = ":where(a,button){all:unset}*,::before,::after{box-sizing:border-box}:host{display:flex;width:100%;height:100%}:host([force-containing-block]){transform:translateX(0);--ch-window-relative-position:true}.action{display:flex;align-items:center;width:100%;height:100%;cursor:pointer;text-align:start}.left-img,.right-img{display:block;width:24px;height:24px;min-width:24px}.content{width:100%}.dummy-wrapper{display:contents}";
7
+ const dropdownItemCss = ":where(a,button){all:unset}*,::before,::after{box-sizing:border-box}:host{display:flex;width:100%;height:100%}:host([force-containing-block]){transform:translateX(0);--ch-window-relative-position:true}.action{display:flex;align-items:center;width:100%;height:100%;cursor:pointer;text-align:start}.left-img,.right-img{display:block;width:24px;height:24px;min-width:24px}.content{width:100%}";
8
8
 
9
9
  const DROPDOWN_ITEM = "ch-dropdown-item";
10
10
  const ChDropDownItem = class {
@@ -35,17 +35,17 @@ const ChDropDownItem = class {
35
35
  */
36
36
  this.position = "Center_OutsideEnd";
37
37
  this.dropDownItemContent = () => [
38
- !!this.leftImgSrc && (index.h("img", { "aria-hidden": "true", class: "left-img", part: "left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
39
- index.h("span", { class: "content", part: "content" }, index.h("slot", null)),
40
- !!this.rightImgSrc && (index.h("img", { "aria-hidden": "true", class: "right-img", part: "right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
38
+ !!this.leftImgSrc && (index.h("img", { slot: "action", "aria-hidden": "true", class: "left-img", part: "left-img", alt: "", src: this.leftImgSrc, loading: "lazy" })),
39
+ index.h("span", { slot: "action", class: "content", part: "content" }, index.h("slot", null)),
40
+ !!this.rightImgSrc && (index.h("img", { slot: "action", "aria-hidden": "true", class: "right-img", part: "right-img", alt: "", src: this.rightImgSrc, loading: "lazy" }))
41
41
  ];
42
42
  this.checkItems = () => {
43
- this.hasItems = !!this.element.querySelector(`:scope>${DROPDOWN_ITEM}`);
43
+ this.hasItems = !!this.el.querySelector(`:scope>${DROPDOWN_ITEM}`);
44
44
  };
45
45
  this.noItemsRender = () => this.href ? (index.h("a", { class: "action", part: "action target", href: this.href, onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), index.h("slot", { name: "items", onSlotchange: this.checkItems }))) : (index.h("button", { class: "action", part: "action button", type: "button", onClick: this.handleActionClick, onFocus: this.handleFocus, ref: el => (this.mainElement = el) }, this.dropDownItemContent(), index.h("slot", { name: "items", onSlotchange: this.checkItems })));
46
- this.itemsRender = () => (index.h("ch-dropdown", { class: "action", exportparts: "expandable-button:action,expandable-button:button,expandable-button:expandable-action,separation,list,section,mask,header,footer,window", expandBehavior: this.expandBehavior, nestedDropdown: true, openOnFocus: this.openOnFocus, position: this.position }, index.h("div", { class: "dummy-wrapper", slot: "action" }, this.dropDownItemContent()), index.h("slot", { name: "items", slot: "items", onSlotchange: this.checkItems })));
46
+ this.itemsRender = () => (index.h("ch-dropdown", { class: "action", exportparts: "expandable-button:action,expandable-button:button,expandable-button:expandable-action,separation,list,section,mask,header,footer,window", expandBehavior: this.expandBehavior, nestedDropdown: true, openOnFocus: this.openOnFocus, position: this.position }, this.dropDownItemContent(), index.h("slot", { name: "items", slot: "items", onSlotchange: this.checkItems })));
47
47
  this.handleActionClick = () => {
48
- this.actionClick.emit(this.element.id);
48
+ this.actionClick.emit(this.el.id);
49
49
  };
50
50
  this.handleFocus = () => {
51
51
  this.focusChange.emit();
@@ -63,7 +63,7 @@ const ChDropDownItem = class {
63
63
  render() {
64
64
  return (index.h(index.Host, { role: "listitem" }, this.hasItems ? this.itemsRender() : this.noItemsRender()));
65
65
  }
66
- get element() { return index.getElement(this); }
66
+ get el() { return index.getElement(this); }
67
67
  };
68
68
  ChDropDownItem.style = dropdownItemCss;
69
69
 
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-5a32426a.js');
6
6
 
7
- const dropdownCss = ":where(button){all:unset}*,::before,::after{box-sizing:border-box}:host{--separation:0px;--separation-x:var(--separation);--separation-y:var(--separation);display:flex;position:relative;width:100%;height:100%}.expandable-button{display:flex;align-items:center;justify-content:center;position:relative;width:100%;height:100%;cursor:pointer;z-index:108}.expandable-button:focus-within{transition:box-shadow 250ms}::slotted([slot=action]){pointer-events:none}.separation{display:flex;position:absolute;z-index:107}.separation--y{width:100%;height:var(--separation-y)}.separation--y-outside-start{inset-block-start:calc(var(--separation-y) * -1)}.separation--y-outside-start+ch-window{--ch-window-offset-y:calc(var(--separation-y) * -1)}.separation--y-outside-end{inset-block-end:calc(var(--separation-y) * -1)}.separation--y-outside-end+ch-window{--ch-window-offset-y:var(--separation-y)}.separation--x{width:var(--separation-x);height:100%}.separation--x-outside-start{inset-inline-start:calc(var(--separation-x) * -1)}.separation--x-outside-start+ch-window{--ch-window-offset-x:calc(var(--separation-x) * -1)}.separation--x-outside-end{inset-inline-end:calc(var(--separation-x) * -1)}.separation--x-outside-end+ch-window{--ch-window-offset-x:var(--separation-x)}.list{display:flex;flex-direction:column}";
7
+ const dropdownCss = ":where(button){all:unset}*,::before,::after{box-sizing:border-box}:host{--separation:0px;--separation-x:var(--separation);--separation-y:var(--separation);display:flex;position:relative;width:100%;height:100%}.expandable-button{display:flex;align-items:center;justify-content:center;position:relative;width:100%;height:100%;cursor:pointer;z-index:108}.expandable-button:focus-within{transition:box-shadow 250ms}::slotted([slot=action]){pointer-events:none}ch-window[y-align=outside-start]{--ch-window-separation:var(--separation-y);--ch-window-separation-y:calc(var(--separation-y) * -1)}ch-window[y-align=outside-end]{--ch-window-separation:var(--separation-y);--ch-window-separation-y:var(--separation-y)}ch-window[x-align=outside-start]{--ch-window-separation:var(--separation-x);--ch-window-separation-x:calc(var(--separation-x) * -1)}ch-window[x-align=outside-end]{--ch-window-separation:var(--separation-x);--ch-window-separation-x:var(--separation-x)}.list{display:flex;flex-direction:column}";
8
8
 
9
9
  const mapDropdownAlignToChWindowAlign = {
10
10
  OutsideStart: "outside-start",
@@ -55,6 +55,7 @@ const ChDropDown = class {
55
55
  };
56
56
  this.showHeader = false;
57
57
  this.showFooter = false;
58
+ this.firstExpanded = false;
58
59
  this.expanded = false;
59
60
  this.expandedWithHover = false;
60
61
  /**
@@ -236,22 +237,22 @@ const ChDropDown = class {
236
237
  const aligns = this.position.split("_");
237
238
  const alignX = aligns[0];
238
239
  const alignY = aligns[1];
239
- const hasVerticalPosition = alignY === "OutsideStart" || alignY === "OutsideEnd";
240
240
  const xAlignMapping = mapDropdownAlignToChWindowAlign[alignX];
241
241
  const yAlignMapping = mapDropdownAlignToChWindowAlign[alignY];
242
242
  const isExpanded = this.expanded || this.expandedWithHover;
243
+ this.firstExpanded || (this.firstExpanded = isExpanded);
243
244
  return (index.h(index.Host, { onMouseLeave: this.expandBehavior === "ClickOrHover"
244
245
  ? this.handleMouseLeave
245
246
  : undefined }, index.h("button", { id: EXPANDABLE_BUTTON_ID, "aria-controls": SECTION_ID, "aria-expanded": this.expanded.toString(), "aria-haspopup": "true", "aria-label": this.buttonLabel, class: "expandable-button", part: "expandable-button", type: "button", onClick: this.handleButtonClick, onFocus: this.openOnFocus ? this.handleButtonFocus : undefined, onMouseEnter: this.expandBehavior === "ClickOrHover"
246
247
  ? this.handleMouseEnter
247
- : undefined, ref: el => (this.expandableButton = el) }, index.h("slot", { name: "action" })), this.expandBehavior === "ClickOrHover" && (
248
- // Necessary since the separation between the button and the section
249
- // triggers the onMouseLeave event
250
- index.h("div", { "aria-hidden": "true", class: {
251
- separation: true,
252
- [`separation--y separation--y-${yAlignMapping}`]: hasVerticalPosition,
253
- [`separation--x separation--x-${xAlignMapping}`]: !hasVerticalPosition
254
- }, part: "separation" })), index.h("ch-window", { part: "window", exportparts: "window:section,mask,header,footer", container: this.el, closeOnEscape: true, hidden: !isExpanded, modal: false, showFooter: this.showFooter, showHeader: this.showHeader, xAlign: xAlignMapping, yAlign: yAlignMapping }, this.showHeader && index.h("slot", { name: "header", slot: "header" }), index.h("div", { role: "list", class: "list", part: "list" }, index.h("slot", { name: "items" })), this.showFooter && index.h("slot", { name: "footer", slot: "footer" }))));
248
+ : undefined, ref: el => (this.expandableButton = el) }, index.h("slot", { name: "action" })), index.h("ch-window", { part: "window", exportparts: "window:section,mask,header,footer,separation", container: this.expandableButton, closeOnEscape: true, hidden: !isExpanded, modal: false, showFooter: this.showFooter, showHeader: this.showHeader, showMain: false,
249
+ // Necessary since the separation between the button and the section
250
+ // triggers the onMouseLeave event
251
+ showSeparation: this.expandBehavior === "ClickOrHover", xAlign: xAlignMapping, yAlign: yAlignMapping }, this.firstExpanded && [
252
+ this.showHeader && index.h("slot", { name: "header", slot: "header" }),
253
+ index.h("div", { role: "list", class: "list", part: "list" }, index.h("slot", { name: "items" })),
254
+ this.showFooter && index.h("slot", { name: "footer", slot: "footer" })
255
+ ])));
255
256
  }
256
257
  get el() { return index.getElement(this); }
257
258
  static get watchers() { return {
@@ -129,6 +129,7 @@ const ChSuggest = class {
129
129
  */
130
130
  this.handleInput = (e) => {
131
131
  const inputValue = e.target.value;
132
+ this.caption = inputValue;
132
133
  if (this.timeoutReference) {
133
134
  clearTimeout(this.timeoutReference);
134
135
  }
@@ -55,7 +55,7 @@ const ChTestActionGroup = class {
55
55
  (this.displayedItemsCount === -1 || index$1 < this.displayedItemsCount) &&
56
56
  item.items != null &&
57
57
  item.items.map(this.renderItem)));
58
- this.firstLevelRenderCollapsedItem = (item) => (index.h("ch-dropdown-item", { id: item.id, class: item.class, expandBehavior: this.expandBehavior, href: item.target, leftImgSrc: item.leftIcon, openOnFocus: this.openOnFocus, position: item.responsiveCollapsePosition || "OutsideEnd_InsideStart", rightImgSrc: item.rightIcon }, item.title, item.items != null && item.items.map(this.renderItem)));
58
+ this.firstLevelRenderCollapsedItem = (item) => (index.h("ch-dropdown-item", { slot: "more-items", id: item.id, class: item.class, expandBehavior: this.expandBehavior, href: item.target, leftImgSrc: item.leftIcon, openOnFocus: this.openOnFocus, position: item.responsiveCollapsePosition || "OutsideEnd_InsideStart", rightImgSrc: item.rightIcon }, item.title, item.items != null && item.items.map(this.renderItem)));
59
59
  this.handleDisplayedItemsCountChange = (event) => {
60
60
  this.displayedItemsCount = event.detail;
61
61
  };
@@ -71,7 +71,7 @@ const ChTestActionGroup = class {
71
71
  this.itemsModel
72
72
  .filter((_, index) => this.displayedItemsCount !== -1 &&
73
73
  index >= this.displayedItemsCount)
74
- .map(item => (index.h("ch-action-group-item", { slot: "more-items", avoidFloating: true }, this.firstLevelRenderCollapsedItem(item)))))));
74
+ .map(this.firstLevelRenderCollapsedItem))));
75
75
  }
76
76
  };
77
77
  ChTestActionGroup.style = testActionGroupCss;
@@ -4,9 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-5a32426a.js');
6
6
 
7
- const testTreeXCss = "ch-test-tree-x{display:grid;grid-template-columns:350px max-content;grid-template-rows:1fr;height:100%}ch-test-tree-x>.test-tree-x-scroll{position:relative;overflow-y:auto;margin-inline-end:16px}ch-test-tree-x>.test-tree-x-scroll>ch-tree-x{position:absolute;inset:0;margin:2px}.tree-buttons{display:grid;grid-auto-rows:max-content;row-gap:8px}:not(.ch-tree-x-dragging-item) ch-tree-x-list-item:not([selected])::part(header):hover{background-color:#e8e8e9}.ch-tree-x-list-item--drag-enter{background-color:#eee;box-shadow:inset 0 0 1px 0px black}.ch-tree-x-list-item--drag-enter[selected]::part(header){background-color:#eee}ch-tree-x-list-item::part(header){border:1px solid transparent}ch-tree-x-list-item[selected]::part(header){background-color:#cfdee6;border-color:#0266a0}ch-tree-x-list-item.ch-tree-x-list-item--editing::part(header){background-color:rgba(207, 222, 230, 0.5);border-color:transparent}ch-tree-x-list-item:not(.ch-tree-x-list-item--editing)::part(header):focus-visible{border-color:black;z-index:1}.ch-tree-x-drag-info{padding-inline:6px;padding-block:2px;background-color:#cfdee6;border:1px solid #0266a0;border-radius:10px;font-size:8px}";
7
+ const testTreeXCss = "ch-test-tree-x{display:grid;grid-template-columns:350px max-content;grid-template-rows:1fr;height:100%}.tree-buttons{display:grid;grid-auto-rows:max-content;row-gap:8px}:not(.ch-tree-x-dragging-item) ch-tree-x-list-item:not([selected])::part(header):hover{background-color:#e8e8e9}.ch-tree-x-list-item--drag-enter{background-color:#eee;box-shadow:inset 0 0 1px 0px black}.ch-tree-x-list-item--drag-enter[selected]::part(header){background-color:#eee}ch-tree-x-list-item::part(header){border:1px solid transparent}ch-tree-x-list-item[selected]::part(header){background-color:#cfdee6;border-color:#0266a0}ch-tree-x-list-item.ch-tree-x-list-item--editing::part(header){background-color:rgba(207, 222, 230, 0.5);border-color:transparent}ch-tree-x-list-item:not(.ch-tree-x-list-item--editing)::part(header):focus-visible{border-color:black;z-index:1}.ch-tree-x-drag-info{padding-inline:6px;padding-block:2px;background-color:#cfdee6;border:1px solid #0266a0;border-radius:10px;font-size:8px}";
8
8
 
9
9
  const DEFAULT_EXPANDED_VALUE = false;
10
+ const DEFAULT_INDETERMINATE_VALUE = false;
10
11
  const DEFAULT_LAZY_VALUE = false;
11
12
  const DEFAULT_SELECTED_VALUE = false;
12
13
  const ChTestTreeX = class {
@@ -30,18 +31,20 @@ const ChTestTreeX = class {
30
31
  */
31
32
  this.multiSelection = false;
32
33
  /**
33
- * Set this attribute if you want to display the relation between tree items and tree lists using
34
+ * `true` to display the relation between tree items and tree lists using
34
35
  * lines.
35
36
  */
36
- this.showLines = true;
37
- this.closeTreeNodeHandler = () => {
38
- // this.tree.toggleItems(["number-1-1-2"], false);
39
- };
40
- this.openTreeNodeHandler = () => {
41
- // this.tree.toggleItems(["number-1-1-2"], true);
42
- };
43
- this.toggleTreeNodeHandler = () => {
44
- // this.tree.toggleItems(["number-1-1-2"]);
37
+ this.showLines = "none";
38
+ this.handleDroppableZoneEnter = (event) => {
39
+ const dropInformation = event.detail;
40
+ if (!this.checkDroppableZoneCallback) {
41
+ return;
42
+ }
43
+ const requestTimestamp = new Date().getTime();
44
+ const promise = this.checkDroppableZoneCallback(dropInformation);
45
+ promise.then(validDrop => {
46
+ this.treeRef.updateValidDroppableZone(requestTimestamp, dropInformation.newContainer.id, dropInformation.draggedItems, validDrop);
47
+ });
45
48
  };
46
49
  this.handleSelectedItemsChange = (event) => {
47
50
  const itemsToProcess = new Map(event.detail);
@@ -68,22 +71,87 @@ const ChTestTreeX = class {
68
71
  this.selectedItems.add(itemId);
69
72
  });
70
73
  };
71
- this.getCheckedItemsHandler = async () => {
72
- // const checked = await this.tree.getCheckedItems();
74
+ this.handleExpandedItemChange = (event) => {
75
+ const detail = event.detail;
76
+ const itemInfo = this.flattenedTreeModel.get(detail.id).item;
77
+ itemInfo.expanded = detail.expanded;
78
+ };
79
+ this.handleItemsDropped = (event) => {
80
+ const dataTransferInfo = event.detail;
81
+ const newContainer = dataTransferInfo.newContainer;
82
+ const newParentId = newContainer.id;
83
+ // Check if the parent exists in the UI Model
84
+ if (!this.flattenedTreeModel.get(newParentId)) {
85
+ return;
86
+ }
87
+ const draggedItems = dataTransferInfo.draggedItems;
88
+ if (draggedItems.length === 0 || !this.dropItemsCallback) {
89
+ return;
90
+ }
91
+ const promise = this.dropItemsCallback(dataTransferInfo);
92
+ this.waitDropProcessing = true;
93
+ promise.then(response => {
94
+ this.waitDropProcessing = false;
95
+ if (!response.acceptDrop) {
96
+ return;
97
+ }
98
+ const newParentUIModel = this.flattenedTreeModel.get(newParentId).item;
99
+ // Only move the items to the new parent, keeping the state
100
+ if (dataTransferInfo.dropInTheSameTree) {
101
+ // Add the UI models to the new container and remove the UI models from
102
+ // the old containers
103
+ draggedItems.forEach(this.moveItemToNewParent(newParentUIModel));
104
+ }
105
+ // Add the new items
106
+ else {
107
+ if (response.items == null) {
108
+ return;
109
+ }
110
+ // Add new items to the parent
111
+ newParentUIModel.items.push(...response.items);
112
+ // Flatten the new UI models
113
+ response.items.forEach(this.flattenItemUIModel(newParentUIModel));
114
+ }
115
+ this.sortItems(newParentUIModel.items);
116
+ // Open the item to visualize the new subitems
117
+ newParentUIModel.expanded = true;
118
+ // There is no need to force and update, since the waitDropProcessing
119
+ // prop was modified
120
+ });
121
+ };
122
+ this.moveItemToNewParent = (newParentUIModel) => (dataTransferInfo) => {
123
+ const itemUIModelExtended = this.flattenedTreeModel.get(dataTransferInfo.id);
124
+ const item = itemUIModelExtended.item;
125
+ const oldParentItem = itemUIModelExtended.parentItem;
126
+ // Remove the UI model from the previous parent
127
+ oldParentItem.items.splice(oldParentItem.items.indexOf(item), 1);
128
+ // Add the UI Model to the new parent
129
+ newParentUIModel.items.push(item);
130
+ // Reference the new parent in the item
131
+ itemUIModelExtended.parentItem = newParentUIModel;
73
132
  };
74
- // private deleteNodeHandler = () => {
75
- // this.treeItemsModel = [];
76
- // };
77
- this.renderSubModel = (treeSubModel) => (index.h("ch-tree-x-list-item", { id: treeSubModel.id, caption: treeSubModel.caption, checkbox: treeSubModel.checkbox, checked: treeSubModel.checked, class: treeSubModel.class, disabled: treeSubModel.disabled, expanded: treeSubModel.expanded, lazyLoad: treeSubModel.lazy, leaf: treeSubModel.leaf, leftImgSrc: treeSubModel.leftImgSrc, rightImgSrc: treeSubModel.rightImgSrc, selected: treeSubModel.selected, showExpandableButton: treeSubModel.showExpandableButton, toggleCheckboxes: treeSubModel.toggleCheckboxes }, !treeSubModel.leaf &&
133
+ this.renderSubModel = (treeSubModel) => (index.h("ch-tree-x-list-item", { id: treeSubModel.id, caption: treeSubModel.caption, checkbox: treeSubModel.checkbox, checked: treeSubModel.checked, class: treeSubModel.class, disabled: treeSubModel.disabled, expanded: treeSubModel.expanded, indeterminate: treeSubModel.indeterminate, lazyLoad: treeSubModel.lazy, leaf: treeSubModel.leaf, leftImgSrc: treeSubModel.leftImgSrc, metadata: treeSubModel.metadata, rightImgSrc: treeSubModel.rightImgSrc, selected: treeSubModel.selected, showExpandableButton: treeSubModel.showExpandableButton, toggleCheckboxes: treeSubModel.toggleCheckboxes }, !treeSubModel.leaf &&
78
134
  treeSubModel.items != null &&
79
135
  treeSubModel.items.length !== 0 && (index.h("ch-tree-x-list", { slot: "tree" }, treeSubModel.items.map(this.renderSubModel)))));
80
- this.handleMultiSelectionChange = (event) => {
81
- const checked = event.target.checked;
82
- this.multiSelection = checked;
83
- };
84
- this.handleShowLinesChange = (event) => {
85
- const checked = event.target.checked;
86
- this.showLines = checked;
136
+ this.flattenItemUIModel = (parentModel) => (item) => {
137
+ var _a, _b, _c, _d;
138
+ this.flattenedTreeModel.set(item.id, {
139
+ parentItem: parentModel,
140
+ item: item
141
+ });
142
+ // Make sure the properties are with their default values to avoid issues
143
+ // when reusing DOM nodes
144
+ (_a = item.expanded) !== null && _a !== void 0 ? _a : (item.expanded = DEFAULT_EXPANDED_VALUE);
145
+ (_b = item.indeterminate) !== null && _b !== void 0 ? _b : (item.indeterminate = DEFAULT_INDETERMINATE_VALUE);
146
+ (_c = item.lazy) !== null && _c !== void 0 ? _c : (item.lazy = DEFAULT_LAZY_VALUE);
147
+ (_d = item.selected) !== null && _d !== void 0 ? _d : (item.selected = DEFAULT_SELECTED_VALUE);
148
+ if (item.lazy) {
149
+ this.flattenedLazyTreeModel.set(item.id, item);
150
+ }
151
+ if (item.selected) {
152
+ this.selectedItems.add(item.id);
153
+ }
154
+ this.flattenSubModel(item);
87
155
  };
88
156
  }
89
157
  handleTreeModelChange() {
@@ -112,45 +180,65 @@ const ChTestTreeX = class {
112
180
  // expand the items, we have to delegate the responsibility to the tree-x
113
181
  this.treeRef.scrollIntoVisible(treeItemId);
114
182
  }
115
- handleDrop(event) {
116
- var _a;
117
- const detail = event.detail;
118
- const dropItemId = detail.dropItemId;
119
- // Check if the parent exists in the UI Model
120
- if (!this.flattenedTreeModel.get(dropItemId)) {
121
- return;
183
+ /**
184
+ * This method is used to toggle a tree item by the tree item id/ids.
185
+ *
186
+ * @param treeItemIds An array id the tree items to be toggled.
187
+ * @param expand A boolean indicating that the tree item should be expanded or collapsed. (optional)
188
+ * @returns The modified items after the method was called.
189
+ */
190
+ async toggleItems(treeItemIds, expand) {
191
+ if (!treeItemIds) {
192
+ return [];
122
193
  }
123
- const data = detail.dataTransfer.getData("text/plain");
124
- const draggedIds = (_a = data === null || data === void 0 ? void 0 : data.split(",")) !== null && _a !== void 0 ? _a : [];
125
- if (draggedIds.length === 0 || !this.dropItemsCallback) {
194
+ const modifiedTreeItems = [];
195
+ treeItemIds.forEach(treeItemId => {
196
+ const itemInfo = this.flattenedTreeModel.get(treeItemId).item;
197
+ if (itemInfo) {
198
+ itemInfo.expanded = expand !== null && expand !== void 0 ? expand : !itemInfo.expanded;
199
+ modifiedTreeItems.push({
200
+ id: itemInfo.id,
201
+ expanded: itemInfo.expanded
202
+ });
203
+ }
204
+ });
205
+ // Force re-render
206
+ index.forceUpdate(this);
207
+ return modifiedTreeItems;
208
+ }
209
+ /**
210
+ * Given a subset of item's properties, it updates all item UI models.
211
+ */
212
+ async updateAllItemsProperties(properties) {
213
+ [...this.flattenedTreeModel.values()].forEach(itemUIModel => {
214
+ if (properties.expanded != null) {
215
+ itemUIModel.item.expanded = properties.expanded;
216
+ }
217
+ if (properties.checked != null) {
218
+ itemUIModel.item.checked = properties.checked;
219
+ itemUIModel.item.indeterminate = false;
220
+ }
221
+ });
222
+ index.forceUpdate(this);
223
+ }
224
+ /**
225
+ * Given a item list and the properties to update, it updates the properties
226
+ * of the items in the list.
227
+ */
228
+ async updateItemsProperties(items, properties) {
229
+ items.forEach(item => {
230
+ const itemUIModel = this.flattenedTreeModel.get(item);
231
+ this.updateItemProperty(itemUIModel, properties);
232
+ });
233
+ index.forceUpdate(this);
234
+ }
235
+ updateItemProperty(itemUIModel, properties) {
236
+ if (!itemUIModel) {
126
237
  return;
127
238
  }
128
- const promise = this.dropItemsCallback(dropItemId, draggedIds);
129
- this.waitDropProcessing = true;
130
- promise.then(acceptDrop => {
131
- this.waitDropProcessing = false;
132
- if (!acceptDrop) {
133
- return;
134
- }
135
- const newParentItem = this.flattenedTreeModel.get(dropItemId).item;
136
- // Add the UI models to the new container and remove the UI models from
137
- // the old containers
138
- draggedIds.forEach(itemId => {
139
- const itemUIModelExtended = this.flattenedTreeModel.get(itemId);
140
- const item = itemUIModelExtended.item;
141
- const oldParentItem = itemUIModelExtended.parentItem;
142
- // Remove the UI model from the previous parent
143
- oldParentItem.items.splice(oldParentItem.items.indexOf(item), 1);
144
- // Add the UI Model to the new parent
145
- newParentItem.items.push(item);
146
- // Reference the new parent in the item
147
- itemUIModelExtended.parentItem = newParentItem;
148
- });
149
- this.sortItems(newParentItem.items);
150
- // Open the item to visualize the new subitems
151
- newParentItem.expanded = true;
152
- // There is no need to force and update, since the waitDropProcessing
153
- // prop was modified
239
+ const itemInfo = itemUIModel.item;
240
+ Object.keys(properties).forEach(propertyName => {
241
+ itemInfo[propertyName] = properties[propertyName];
154
242
  });
155
243
  }
156
244
  loadLazyChildrenHandler(event) {
@@ -220,25 +308,7 @@ const ChTestTreeX = class {
220
308
  return;
221
309
  }
222
310
  this.sortItems(items);
223
- items.forEach(item => {
224
- var _a, _b, _c;
225
- this.flattenedTreeModel.set(item.id, {
226
- parentItem: model,
227
- item: item
228
- });
229
- // Make sure the properties are with their default values to avoid issues
230
- // when reusing DOM nodes
231
- (_a = item.expanded) !== null && _a !== void 0 ? _a : (item.expanded = DEFAULT_EXPANDED_VALUE);
232
- (_b = item.lazy) !== null && _b !== void 0 ? _b : (item.lazy = DEFAULT_LAZY_VALUE);
233
- (_c = item.selected) !== null && _c !== void 0 ? _c : (item.selected = DEFAULT_SELECTED_VALUE);
234
- if (item.lazy) {
235
- this.flattenedLazyTreeModel.set(item.id, item);
236
- }
237
- if (item.selected) {
238
- this.selectedItems.add(item.id);
239
- }
240
- this.flattenSubModel(item);
241
- });
311
+ items.forEach(this.flattenItemUIModel(model));
242
312
  }
243
313
  sortItems(items) {
244
314
  // Ensure that items are sorted
@@ -255,7 +325,7 @@ const ChTestTreeX = class {
255
325
  this.flattenModel();
256
326
  }
257
327
  render() {
258
- return (index.h(index.Host, null, index.h("div", { class: "test-tree-x-scroll" }, index.h("ch-tree-x", { multiSelection: this.multiSelection, showLines: this.showLines, waitDropProcessing: this.waitDropProcessing, onSelectedItemsChange: this.handleSelectedItemsChange, ref: el => (this.treeRef = el) }, index.h("ch-tree-x-list", null, this.treeModel.items.map(this.renderSubModel)))), index.h("div", { class: "tree-buttons" }, index.h("button", { type: "button", onClick: this.closeTreeNodeHandler }, "Close 1-1-2"), index.h("button", { type: "button", onClick: this.openTreeNodeHandler }, "Open 1-1-2"), index.h("button", { type: "button", onClick: this.toggleTreeNodeHandler }, "Toggle 1-1-2"), index.h("button", { type: "button", onClick: this.getCheckedItemsHandler }, "Get Checked Items"), index.h("ch-checkbox", { caption: "Check / uncheck all" }), index.h("ch-checkbox", { checkedValue: "true", unCheckedValue: "false", value: this.multiSelection.toString(), caption: "Multi selection", onInput: this.handleMultiSelectionChange }), index.h("ch-checkbox", { checkedValue: "true", unCheckedValue: "false", value: this.showLines.toString(), caption: "Show lines", onInput: this.handleShowLinesChange }))));
328
+ return (index.h(index.Host, null, index.h("ch-tree-x", { multiSelection: this.multiSelection, showLines: this.showLines, waitDropProcessing: this.waitDropProcessing, onDroppableZoneEnter: this.handleDroppableZoneEnter, onExpandedItemChange: this.handleExpandedItemChange, onItemsDropped: this.handleItemsDropped, onSelectedItemsChange: this.handleSelectedItemsChange, ref: el => (this.treeRef = el) }, index.h("ch-tree-x-list", null, this.treeModel.items.map(this.renderSubModel))), index.h("div", { class: "tree-buttons" })));
259
329
  }
260
330
  static get watchers() { return {
261
331
  "treeModel": ["handleTreeModelChange"]