@genexus/genexus-ide-ui 0.0.85 → 0.0.86

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 (114) hide show
  1. package/dist/cjs/ch-action-group-render.cjs.entry.js +112 -0
  2. package/dist/cjs/ch-checkbox_3.cjs.entry.js +21 -10
  3. package/dist/cjs/ch-dropdown-item.cjs.entry.js +1 -1
  4. package/dist/cjs/ch-dropdown-render.cjs.entry.js +73 -0
  5. package/dist/cjs/ch-shortcuts_2.cjs.entry.js +99 -20
  6. package/dist/cjs/ch-tree-view-render_2.cjs.entry.js +49 -92
  7. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  8. package/dist/cjs/genexus-implementation-664b13f0.js +76 -0
  9. package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +2 -5
  10. package/dist/cjs/gx-ide-new-environment.cjs.entry.js +16 -9
  11. package/dist/cjs/gx-ide-new-kb.cjs.entry.js +14 -3
  12. package/dist/cjs/gx-ide-new-object.cjs.entry.js +21 -3
  13. package/dist/cjs/gx-ide-object-selector.cjs.entry.js +87 -59
  14. package/dist/cjs/gx-ide-recent-news.cjs.entry.js +2 -3
  15. package/dist/cjs/gx-ide-references.cjs.entry.js +2 -7
  16. package/dist/cjs/gxg-combo-box_2.cjs.entry.js +1 -7
  17. package/dist/cjs/loader.cjs.js +1 -1
  18. package/dist/collection/collection-manifest.json +2 -2
  19. package/dist/collection/components/kb-manager-import/kb-manager-import.js +2 -5
  20. package/dist/collection/components/new-environment/new-environment.js +39 -9
  21. package/dist/collection/components/new-kb/gx-ide-assets/new-kb/shortcuts.json +1 -4
  22. package/dist/collection/components/new-kb/new-kb.js +37 -3
  23. package/dist/collection/components/new-object/gx-ide-assets/new-object/shortcuts.json +1 -4
  24. package/dist/collection/components/new-object/new-object.js +44 -3
  25. package/dist/collection/components/object-selector/gx-ide-assets/object-selector/langs/object-selector.lang.en.json +4 -0
  26. package/dist/collection/components/object-selector/object-selector.css +4 -0
  27. package/dist/collection/components/object-selector/object-selector.js +123 -58
  28. package/dist/collection/components/references/references.js +3 -10
  29. package/dist/collection/components/start-page/recent-news.js +2 -3
  30. package/dist/components/ch-action-group-render.js +175 -0
  31. package/dist/components/ch-dropdown-item-separator.js +28 -1
  32. package/dist/components/ch-dropdown-render.js +121 -0
  33. package/dist/components/ch-shortcuts2.js +97 -19
  34. package/dist/components/combo-box.js +1 -8
  35. package/dist/components/dropdown-item.js +1 -1
  36. package/dist/components/genexus-implementation.js +74 -0
  37. package/dist/components/gx-ide-kb-manager-import.js +2 -5
  38. package/dist/components/gx-ide-new-environment.js +18 -10
  39. package/dist/components/gx-ide-new-kb.js +16 -4
  40. package/dist/components/gx-ide-new-object.js +24 -5
  41. package/dist/components/gx-ide-object-selector.js +140 -104
  42. package/dist/components/gx-ide-references.js +3 -10
  43. package/dist/components/index.js +2 -2
  44. package/dist/components/recent-news.js +2 -3
  45. package/dist/components/shortcuts.js +4 -1
  46. package/dist/components/tree-view-item.js +21 -10
  47. package/dist/components/tree-view-render.js +49 -91
  48. package/dist/esm/ch-action-group-render.entry.js +108 -0
  49. package/dist/esm/ch-checkbox_3.entry.js +21 -10
  50. package/dist/esm/ch-dropdown-item.entry.js +1 -1
  51. package/dist/esm/ch-dropdown-render.entry.js +69 -0
  52. package/dist/esm/ch-shortcuts_2.entry.js +99 -20
  53. package/dist/esm/ch-tree-view-render_2.entry.js +48 -91
  54. package/dist/esm/genexus-ide-ui.js +1 -1
  55. package/dist/esm/genexus-implementation-3b347d88.js +74 -0
  56. package/dist/esm/gx-ide-kb-manager-import.entry.js +2 -5
  57. package/dist/esm/gx-ide-new-environment.entry.js +16 -9
  58. package/dist/esm/gx-ide-new-kb.entry.js +14 -3
  59. package/dist/esm/gx-ide-new-object.entry.js +21 -3
  60. package/dist/esm/gx-ide-object-selector.entry.js +87 -59
  61. package/dist/esm/gx-ide-recent-news.entry.js +2 -3
  62. package/dist/esm/gx-ide-references.entry.js +2 -7
  63. package/dist/esm/gxg-combo-box_2.entry.js +1 -7
  64. package/dist/esm/loader.js +1 -1
  65. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  66. package/dist/genexus-ide-ui/gx-ide-assets/new-kb/shortcuts.json +1 -4
  67. package/dist/genexus-ide-ui/gx-ide-assets/new-object/shortcuts.json +1 -4
  68. package/dist/genexus-ide-ui/gx-ide-assets/object-selector/langs/object-selector.lang.en.json +4 -0
  69. package/dist/genexus-ide-ui/p-021e21a0.entry.js +1 -0
  70. package/dist/genexus-ide-ui/p-068b6b8d.entry.js +1 -0
  71. package/dist/genexus-ide-ui/p-06d9d6ff.entry.js +1 -0
  72. package/dist/genexus-ide-ui/p-356ee19a.js +1 -0
  73. package/dist/genexus-ide-ui/p-49333316.entry.js +1 -0
  74. package/dist/genexus-ide-ui/p-4bd7c59a.entry.js +1 -0
  75. package/dist/genexus-ide-ui/p-54b5628c.entry.js +1 -0
  76. package/dist/genexus-ide-ui/p-65b5622e.entry.js +1 -0
  77. package/dist/genexus-ide-ui/p-70b33bae.entry.js +1 -0
  78. package/dist/genexus-ide-ui/p-8a18798d.entry.js +1 -0
  79. package/dist/genexus-ide-ui/p-8f022c0e.entry.js +1 -0
  80. package/dist/genexus-ide-ui/{p-20fab805.entry.js → p-90806539.entry.js} +1 -1
  81. package/dist/genexus-ide-ui/p-cadcd655.entry.js +1 -0
  82. package/dist/genexus-ide-ui/p-cfbd5a0e.entry.js +1 -0
  83. package/dist/genexus-ide-ui/{p-005970ac.entry.js → p-eaae6676.entry.js} +1 -1
  84. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/renders/action-group/action-group-render.css +3 -0
  85. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/renders/dropdown/dropdown-render.css +3 -0
  86. package/dist/types/components/new-environment/new-environment.d.ts +5 -1
  87. package/dist/types/components/new-kb/new-kb.d.ts +5 -0
  88. package/dist/types/components/new-object/new-object.d.ts +6 -0
  89. package/dist/types/components/object-selector/object-selector.d.ts +14 -3
  90. package/dist/types/components/references/references.d.ts +0 -9
  91. package/dist/types/components/start-page/recent-news.d.ts +1 -1
  92. package/dist/types/components.d.ts +24 -0
  93. package/package.json +3 -3
  94. package/dist/cjs/ch-test-action-group.cjs.entry.js +0 -79
  95. package/dist/cjs/ch-test-dropdown.cjs.entry.js +0 -54
  96. package/dist/components/ch-test-action-group.js +0 -137
  97. package/dist/components/ch-test-dropdown.js +0 -104
  98. package/dist/components/dropdown-item-separator.js +0 -30
  99. package/dist/esm/ch-test-action-group.entry.js +0 -75
  100. package/dist/esm/ch-test-dropdown.entry.js +0 -50
  101. package/dist/genexus-ide-ui/p-2d77e2a3.entry.js +0 -1
  102. package/dist/genexus-ide-ui/p-5757e203.entry.js +0 -1
  103. package/dist/genexus-ide-ui/p-7a03aa05.entry.js +0 -1
  104. package/dist/genexus-ide-ui/p-7ae11b35.entry.js +0 -1
  105. package/dist/genexus-ide-ui/p-85b78e25.entry.js +0 -1
  106. package/dist/genexus-ide-ui/p-9f08b2a4.entry.js +0 -1
  107. package/dist/genexus-ide-ui/p-a2c7dc8a.entry.js +0 -1
  108. package/dist/genexus-ide-ui/p-a69aaabc.entry.js +0 -1
  109. package/dist/genexus-ide-ui/p-c00aa636.entry.js +0 -1
  110. package/dist/genexus-ide-ui/p-d3428456.entry.js +0 -1
  111. package/dist/genexus-ide-ui/p-d9910218.entry.js +0 -1
  112. package/dist/genexus-ide-ui/p-da8ad725.entry.js +0 -1
  113. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-action-group/test-action-group.css +0 -52
  114. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-dropdown/test-dropdown.css +0 -36
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-f9bb1815.js');
6
+ const genexusImplementation = require('./genexus-implementation-664b13f0.js');
7
+
8
+ const actionGroupRenderCss = "ch-action-group-render{display:contents}";
9
+
10
+ const DEFAULT_ACTION_CLASS = "action-group-item";
11
+ const DEFAULT_SUB_ACTION_CLASS = "dropdown-item";
12
+ const ChActionGroupRender = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ this.displayedItemsCount = -1;
16
+ /**
17
+ * This attribute lets you specify the label for the expandable button.
18
+ * Important for accessibility.
19
+ */
20
+ this.buttonLabel = "Show options";
21
+ /**
22
+ * A CSS class to set as the `ch-action-group` element class.
23
+ */
24
+ this.cssClass = "action-group";
25
+ /**
26
+ * Determine which actions on the expandable button display the dropdown
27
+ * section.
28
+ */
29
+ this.expandBehavior = "ClickOrHover";
30
+ /**
31
+ * This attribute determines how items behave when the content of the ActionGroup overflows horizontal. This property is needed
32
+ * to make the control responsive to changes in the Width of the container of ActionGroup.
33
+ *
34
+ * | Value | Details |
35
+ * | --------------------- | ------------------------------------------------------------------------------------------------ |
36
+ * | `Add Scroll` | The items of the ActionGroup that overflow horizontally are shown by means of a scroll. |
37
+ * | `Multiline` | The ActionGroup items that overflow horizontally are shown in a second line of the control. |
38
+ * | `Responsive Collapse` | The Action Group items, when they start to overflow the control, are placed in the More Actions. |
39
+ */
40
+ this.itemsOverflowBehavior = "ResponsiveCollapse";
41
+ /**
42
+ * Determine if the dropdown section should be opened when the expandable
43
+ * button of the control is focused.
44
+ */
45
+ this.openOnFocus = false;
46
+ /**
47
+ * Specifies the position of the dropdown section that is placed relative to
48
+ * the more actions button.
49
+ */
50
+ this.moreActionsDropdownPosition = "InsideStart_OutsideEnd";
51
+ /**
52
+ * Specifies the separation (in pixels) between the expandable button and the
53
+ * dropdown section of the control.
54
+ */
55
+ this.separation = 0;
56
+ /**
57
+ * This property is a WA to implement the Tree View as a UC 2.0 in GeneXus.
58
+ */
59
+ this.useGxRender = false;
60
+ // /**
61
+ // * Fired when the visibility of the dropdown section is changed
62
+ // */
63
+ // @Event() expandedChange: EventEmitter<boolean>;
64
+ this.handleItemClick = (target, itemId) => (event) => {
65
+ this.itemClickCallback(event, target, itemId);
66
+ };
67
+ this.renderImg = (img) => this.useGxRender
68
+ ? genexusImplementation.fromGxImageToURL(img, this.gxSettings, this.gxImageConstructor)
69
+ : img;
70
+ this.renderItem = (responsiveCollapse) => (item, index$1) => {
71
+ var _a, _b;
72
+ return (index.h("ch-dropdown-item", { slot: "items", key: item.id || item.caption || index$1, id: item.id, class: item.subActionClass || DEFAULT_SUB_ACTION_CLASS, expandBehavior: this.expandBehavior, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.renderImg(item.startImage), openOnFocus: this.openOnFocus, position: (responsiveCollapse
73
+ ? item.itemsResponsiveCollapsePosition
74
+ : item.itemsPosition) || "OutsideEnd_InsideStart", rightImgSrc: this.renderImg(item.endImage), onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, item.items != null &&
75
+ item.items.map(this.renderItem(responsiveCollapse))));
76
+ };
77
+ this.firstLevelRenderItem = (item, index$1) => {
78
+ var _a, _b;
79
+ return (index.h("ch-dropdown-item", { key: item.id || item.caption || index$1, id: item.id, class: item.actionClass || DEFAULT_ACTION_CLASS, expandBehavior: this.expandBehavior, forceContainingBlock: false, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.renderImg(item.startImage), openOnFocus: this.openOnFocus, position: item.itemsPosition || "Center_OutsideEnd", rightImgSrc: this.renderImg(item.endImage), onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, this.itemsOverflowBehavior === "ResponsiveCollapse" &&
80
+ (this.displayedItemsCount === -1 || index$1 < this.displayedItemsCount) &&
81
+ item.items != null &&
82
+ item.items.map(this.renderItem(false)),
83
+ // Dummy dropdown item to avoid issues when removing all items from the
84
+ // first level. E. g., if the first level adds a chevron when the item is
85
+ // a dropdown, by removing all items the chevron won't be displayed
86
+ this.itemsOverflowBehavior === "ResponsiveCollapse" &&
87
+ this.displayedItemsCount !== -1 &&
88
+ index$1 >= this.displayedItemsCount &&
89
+ item.items != null &&
90
+ item.items.length !== 0 && index.h("ch-dropdown-item", null)));
91
+ };
92
+ this.firstLevelRenderCollapsedItem = (item, index$1) => {
93
+ var _a, _b;
94
+ return (index.h("ch-dropdown-item", { slot: "more-items", key: item.id || item.caption || index$1, id: item.id, class: item.subActionClass || DEFAULT_SUB_ACTION_CLASS, expandBehavior: this.expandBehavior, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.renderImg(item.startImage), openOnFocus: this.openOnFocus, position: item.itemsResponsiveCollapsePosition || "OutsideEnd_InsideStart", rightImgSrc: this.renderImg(item.endImage), onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, item.items != null && item.items.map(this.renderItem(true))));
95
+ };
96
+ this.handleDisplayedItemsCountChange = (event) => {
97
+ this.displayedItemsCount = event.detail;
98
+ };
99
+ }
100
+ render() {
101
+ return (index.h("ch-action-group", { buttonLabel: this.buttonLabel, class: this.cssClass || null, expandBehavior: this.expandBehavior, itemsOverflowBehavior: this.itemsOverflowBehavior, moreActionsDropdownPosition: this.moreActionsDropdownPosition, openOnFocus: this.openOnFocus, onDisplayedItemsCountChange: this.handleDisplayedItemsCountChange }, this.model != null &&
102
+ this.model.map((item, index$1) => (index.h("ch-action-group-item", { slot: "items", key: item.id || item.caption || index$1 }, this.firstLevelRenderItem(item, index$1)))), this.itemsOverflowBehavior === "ResponsiveCollapse" &&
103
+ this.model != null &&
104
+ this.model
105
+ .filter((_, index) => this.displayedItemsCount !== -1 &&
106
+ index >= this.displayedItemsCount)
107
+ .map(this.firstLevelRenderCollapsedItem)));
108
+ }
109
+ };
110
+ ChActionGroupRender.style = actionGroupRenderCss;
111
+
112
+ exports.ch_action_group_render = ChActionGroupRender;
@@ -750,15 +750,18 @@ const ChTreeViewItem = class {
750
750
  this.selected = true;
751
751
  this.selectedItemChange.emit(this.getSelectedInfo(helpers.mouseEventModifierKey(event), true));
752
752
  };
753
- this.getSelectedInfo = (ctrlKeyPressed, selected) => ({
754
- ctrlKeyPressed: ctrlKeyPressed,
755
- expanded: this.expanded,
756
- id: this.el.id,
757
- itemRef: this.el,
758
- metadata: this.metadata,
759
- parentId: this.el.parentElement.id,
760
- selected: selected
761
- });
753
+ this.getSelectedInfo = (ctrlKeyPressed, selected) => {
754
+ var _a;
755
+ return ({
756
+ ctrlKeyPressed: ctrlKeyPressed,
757
+ expanded: this.expanded,
758
+ id: this.el.id,
759
+ itemRef: this.el,
760
+ metadata: this.metadata,
761
+ parentId: (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.id,
762
+ selected: selected
763
+ });
764
+ };
762
765
  this.handleActionDblClick = (event) => {
763
766
  event.stopPropagation();
764
767
  if (helpers.mouseEventModifierKey(event)) {
@@ -870,7 +873,11 @@ const ChTreeViewItem = class {
870
873
  });
871
874
  }
872
875
  handleExpandedChange(isExpanded) {
873
- this.lazyLoadItems(isExpanded);
876
+ // Wait until all properties are updated before lazy loading. Otherwise, the
877
+ // lazyLoad property could be updated just after the executing of the function
878
+ setTimeout(() => {
879
+ this.lazyLoadItems(isExpanded);
880
+ });
874
881
  }
875
882
  handleLasItemChange(isLastItem) {
876
883
  if (isLastItem && this.showLines) {
@@ -1100,6 +1107,10 @@ const ChTreeViewItem = class {
1100
1107
  if (this.editing) {
1101
1108
  this.removeEditMode(false);
1102
1109
  }
1110
+ // Sync selected state with the main tree
1111
+ if (this.selected) {
1112
+ this.selectedItemChange.emit(this.getSelectedInfo(true, false));
1113
+ }
1103
1114
  this.disconnectObserver();
1104
1115
  }
1105
1116
  render() {
@@ -42,7 +42,7 @@ const ChDropDownItem = class {
42
42
  this.checkItems = () => {
43
43
  this.hasItems = !!this.el.querySelector(`:scope>${DROPDOWN_ITEM}`);
44
44
  };
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 })));
45
+ this.noItemsRender = () => this.href ? (index.h("a", { class: "action", part: "action link", 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
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
48
  this.actionClick.emit(this.el.id);
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-f9bb1815.js');
6
+ const genexusImplementation = require('./genexus-implementation-664b13f0.js');
7
+
8
+ const dropdownRenderCss = "ch-dropdown-render{display:contents}";
9
+
10
+ const DEFAULT_DROPDOWN_ITEM_CLASS = "dropdown-item";
11
+ const ChDropdownRender = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.showHeader = false;
15
+ this.showFooter = false;
16
+ /**
17
+ * This attribute lets you specify the label for the expandable button.
18
+ * Important for accessibility.
19
+ */
20
+ this.buttonLabel = "Show options";
21
+ /**
22
+ * A CSS class to set as the `ch-dropdown` element class.
23
+ */
24
+ this.cssClass = "dropdown";
25
+ /**
26
+ * Determine which actions on the expandable button display the dropdown
27
+ * section.
28
+ */
29
+ this.expandBehavior = "ClickOrHover";
30
+ /**
31
+ * Determine if the dropdown section should be opened when the expandable
32
+ * button of the control is focused.
33
+ */
34
+ this.openOnFocus = false;
35
+ /**
36
+ * Specifies the position of the dropdown section that is placed relative to
37
+ * the expandable button.
38
+ */
39
+ this.position = "Center_OutsideEnd";
40
+ /**
41
+ * This property is a WA to implement the Tree View as a UC 2.0 in GeneXus.
42
+ */
43
+ this.useGxRender = false;
44
+ // /**
45
+ // * Fired when the visibility of the dropdown section is changed
46
+ // */
47
+ // @Event() expandedChange: EventEmitter<boolean>;
48
+ this.handleItemClick = (target, itemId) => (event) => {
49
+ this.itemClickCallback(event, target, itemId);
50
+ };
51
+ this.renderItem = (item) => {
52
+ var _a, _b;
53
+ return [
54
+ index.h("ch-dropdown-item", { slot: "items", id: item.id, class: item.class || DEFAULT_DROPDOWN_ITEM_CLASS, expandBehavior: this.expandBehavior, href: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, leftImgSrc: this.useGxRender
55
+ ? genexusImplementation.fromGxImageToURL(item.startImage, this.gxSettings, this.gxImageConstructor)
56
+ : item.startImage, openOnFocus: this.openOnFocus, position: item.itemsPosition || "OutsideEnd_InsideStart", rightImgSrc: this.useGxRender
57
+ ? genexusImplementation.fromGxImageToURL(item.endImage, this.gxSettings, this.gxImageConstructor)
58
+ : item.endImage, onClick: this.handleItemClick((_b = item.link) === null || _b === void 0 ? void 0 : _b.url, item.id) }, item.caption, item.items != null && item.items.map(this.renderItem))
59
+ ];
60
+ };
61
+ }
62
+ componentWillLoad() {
63
+ this.showHeader = !!this.el.querySelector(':scope>[slot="header"]');
64
+ this.showFooter = !!this.el.querySelector(':scope>[slot="footer"]');
65
+ }
66
+ render() {
67
+ return (index.h("ch-dropdown", { buttonLabel: this.buttonLabel, class: this.cssClass || null, expandBehavior: this.expandBehavior, openOnFocus: this.openOnFocus, position: this.position }, index.h("slot", { name: "action", slot: "action" }), this.showHeader && index.h("slot", { name: "header", slot: "header" }), this.model != null && this.model.map(this.renderItem), this.showFooter && index.h("slot", { name: "footer", slot: "footer" })));
68
+ }
69
+ get el() { return index.getElement(this); }
70
+ };
71
+ ChDropdownRender.style = dropdownRenderCss;
72
+
73
+ exports.ch_dropdown_render = ChDropdownRender;
@@ -11,7 +11,8 @@ function loadShortcuts(name, root, shortcuts) {
11
11
  shortcuts.forEach(shortcut => {
12
12
  const keyShortcuts = parseKeyShortcuts(shortcut.keyShortcuts);
13
13
  keyShortcuts.forEach(keyShortcut => {
14
- SHORTCUTS.set(normalize(keyShortcut.ctrl, keyShortcut.alt, keyShortcut.shift, keyShortcut.meta, keyShortcut.key), {
14
+ const normalizedKeyShortcut = normalize(keyShortcut.ctrl, keyShortcut.alt, keyShortcut.shift, keyShortcut.meta, keyShortcut.key);
15
+ SHORTCUTS.set(normalizedKeyShortcut, {
15
16
  name,
16
17
  root,
17
18
  shortcut
@@ -30,11 +31,12 @@ function unloadShortcuts(name) {
30
31
  removeKeyShortcuts.forEach(key => SHORTCUTS.delete(key));
31
32
  removeListener();
32
33
  }
33
- function getShortcuts() {
34
+ function getShortcuts(name) {
34
35
  return Array.from(SHORTCUTS.values())
35
36
  .filter(shortcutMap => {
36
37
  var _a;
37
- return !((_a = shortcutMap.shortcut.conditions) === null || _a === void 0 ? void 0 : _a.focusInclude);
38
+ return (shortcutMap.name === name &&
39
+ !((_a = shortcutMap.shortcut.conditions) === null || _a === void 0 ? void 0 : _a.focusInclude));
38
40
  })
39
41
  .map(shortcutMap => ({
40
42
  element: querySelectorPlus(shortcutMap.shortcut.selector, shortcutMap.root),
@@ -60,27 +62,33 @@ function keydownHandler(eventInfo) {
60
62
  }
61
63
  }
62
64
  function triggerShortcut(eventInfo) {
63
- const shortcutMap = SHORTCUTS.get(normalize(eventInfo.ctrlKey, eventInfo.altKey, eventInfo.shiftKey, eventInfo.metaKey, eventInfo.key));
64
- if (shortcutMap && conditions(shortcutMap)) {
65
+ const shortcut = normalize(eventInfo.ctrlKey, eventInfo.altKey, eventInfo.shiftKey, eventInfo.metaKey, eventInfo.key);
66
+ const shortcutMap = SHORTCUTS.get(shortcut);
67
+ const focus = helpers.focusComposedPath();
68
+ if (shortcutMap && conditions(shortcutMap, focus)) {
65
69
  const element = querySelectorPlus(shortcutMap.shortcut.selector, shortcutMap.root);
66
- if (element) {
70
+ const keyShortcutPressedEvent = createEvent(shortcut, shortcutMap.shortcut.id, element, focus);
71
+ if (shortcutMap.root.dispatchEvent(keyShortcutPressedEvent)) {
67
72
  switch (shortcutMap.shortcut.action) {
68
73
  case "click":
69
- element.dispatchEvent(new Event("click"));
74
+ element === null || element === void 0 ? void 0 : element.dispatchEvent(new Event("click"));
70
75
  break;
71
76
  default:
72
- element.focus();
77
+ element === null || element === void 0 ? void 0 : element.focus();
73
78
  }
74
79
  if (shortcutMap.shortcut.preventDefault !== false) {
75
80
  eventInfo.preventDefault();
76
81
  }
77
82
  }
83
+ else {
84
+ eventInfo.preventDefault();
85
+ }
78
86
  }
79
87
  return shortcutMap;
80
88
  }
81
89
  function parseKeyShortcuts(value = "") {
82
- return value.split(" ").map(item => {
83
- return item.split("+").reduce((keyShortcut, key) => {
90
+ return value.split(/(?<!(?:[+]|^))\s/).map(item => {
91
+ return item.split(/(?<!(?:[+]|^))[+]/).reduce((keyShortcut, key) => {
84
92
  switch (key.toLowerCase()) {
85
93
  case "ctrl":
86
94
  keyShortcut.ctrl = true;
@@ -120,17 +128,40 @@ function normalize(ctrl, alt, shift, meta, key) {
120
128
  })
121
129
  .join("+");
122
130
  }
123
- function conditions(shortcutMap) {
124
- var _a, _b, _c, _d;
125
- const focus = helpers.focusComposedPath();
131
+ function conditions(shortcutMap, focus) {
132
+ var _a, _b;
126
133
  if ((_a = shortcutMap.shortcut.conditions) === null || _a === void 0 ? void 0 : _a.focusInclude) {
127
- return Array.from(shortcutMap.root.querySelectorAll((_b = shortcutMap.shortcut.conditions) === null || _b === void 0 ? void 0 : _b.focusInclude)).some((el) => focus.includes(el));
134
+ return querySelectorAllPlus(shortcutMap.shortcut.conditions.focusInclude, shortcutMap.root).some((el) => focus.includes(el));
128
135
  }
129
- if ((_c = shortcutMap.shortcut.conditions) === null || _c === void 0 ? void 0 : _c.focusExclude) {
130
- return !Array.from(shortcutMap.root.querySelectorAll((_d = shortcutMap.shortcut.conditions) === null || _d === void 0 ? void 0 : _d.focusExclude)).some((el) => focus.includes(el));
136
+ if ((_b = shortcutMap.shortcut.conditions) === null || _b === void 0 ? void 0 : _b.focusExclude) {
137
+ return !querySelectorAllPlus(shortcutMap.shortcut.conditions.focusExclude, shortcutMap.root).some((el) => focus.includes(el));
131
138
  }
132
139
  return true;
133
140
  }
141
+ function createEvent(keyShortcut, id, target, focusComposedPath) {
142
+ return new CustomEvent("keyShortcutPressed", {
143
+ bubbles: true,
144
+ cancelable: true,
145
+ composed: false,
146
+ detail: {
147
+ keyShortcut,
148
+ id: id,
149
+ target,
150
+ focusComposedPath
151
+ }
152
+ });
153
+ }
154
+ function querySelectorAllPlus(selector, root) {
155
+ var _a;
156
+ return ((_a = selector === null || selector === void 0 ? void 0 : selector.split(",").map(selectorItem => {
157
+ if (selector.includes("::part")) {
158
+ return querySelectorPlus(selectorItem, root);
159
+ }
160
+ else {
161
+ return Array.from(root.querySelectorAll(selector));
162
+ }
163
+ }).flat()) !== null && _a !== void 0 ? _a : []);
164
+ }
134
165
  function querySelectorPlus(selector, root) {
135
166
  const querySelectorDeep = (element, parts) => {
136
167
  const shadow = element.shadowRoot;
@@ -155,7 +186,7 @@ function querySelectorPlus(selector, root) {
155
186
  }
156
187
  return null;
157
188
  };
158
- if (selector.includes("::part")) {
189
+ if (selector === null || selector === void 0 ? void 0 : selector.includes("::part")) {
159
190
  const selectorItems = selector.match("(.*)::part\\(([^)]+)\\)");
160
191
  const entity = selectorItems[1];
161
192
  const partName = selectorItems[2];
@@ -168,22 +199,42 @@ function querySelectorPlus(selector, root) {
168
199
 
169
200
  const chShortcutsCss = ":host{display:contents}";
170
201
 
202
+ const KEY_SYMBOL = {
203
+ " ": "\u2334"
204
+ };
171
205
  const ChShortcuts = class {
172
206
  constructor(hostRef) {
173
207
  index.registerInstance(this, hostRef);
174
208
  this.showShortcuts = false;
209
+ /**
210
+ * Key to show shortcut tooltips.
211
+ */
175
212
  this.showKey = "F10";
213
+ /**
214
+ * Suspend shortcuts.
215
+ */
216
+ this.suspend = false;
176
217
  this.windowClosedHandler = () => {
177
218
  this.showShortcuts = false;
178
219
  };
179
220
  }
221
+ suspendHandler() {
222
+ if (this.suspend) {
223
+ unloadShortcuts(this.src);
224
+ }
225
+ else {
226
+ const root = this.el.getRootNode();
227
+ loadShortcuts(this.src, root, this.shortcuts);
228
+ }
229
+ }
180
230
  componentDidLoad() {
181
231
  if (this.src) {
182
232
  fetch(this.src).then(response => {
183
233
  if (response.ok) {
184
234
  response.json().then(json => {
185
235
  const root = this.el.getRootNode();
186
- loadShortcuts(this.src, root, json);
236
+ this.shortcuts = json;
237
+ loadShortcuts(this.src, root, this.shortcuts);
187
238
  });
188
239
  }
189
240
  });
@@ -193,18 +244,44 @@ const ChShortcuts = class {
193
244
  unloadShortcuts(this.src);
194
245
  }
195
246
  windowKeyDownHandler(eventInfo) {
247
+ const modifierKeys = ["Ctrl", "Alt", "Shift", "Meta"];
248
+ if (eventInfo.repeat || this.suspend) {
249
+ return;
250
+ }
196
251
  if (eventInfo.key === this.showKey) {
197
252
  this.showShortcuts = !this.showShortcuts;
198
253
  eventInfo.preventDefault();
199
254
  }
255
+ else if (this.showShortcuts && !modifierKeys.includes(eventInfo.key)) {
256
+ this.showShortcuts = false;
257
+ }
200
258
  }
201
259
  renderShortcuts() {
202
- return getShortcuts().map(shortcut => (index.h("ch-window", { container: shortcut.element, modal: false, hidden: false, closeOnEscape: true, closeOnOutsideClick: true, xAlign: "outside-end", yAlign: "inside-start", onWindowClosed: this.windowClosedHandler, exportparts: "mask:element" }, index.h("span", { part: "tooltip" }, shortcut.keyShortcuts))));
260
+ return getShortcuts(this.src)
261
+ .filter(shortcut => shortcut.element)
262
+ .map(shortcut => (index.h("ch-window", { container: shortcut.element, modal: false, hidden: false, closeOnEscape: true, closeOnOutsideClick: true, xAlign: "outside-end", yAlign: "inside-start", onWindowClosed: this.windowClosedHandler, exportparts: "mask:element, main:tooltip" }, this.renderKeyShortcuts(shortcut.keyShortcuts))));
263
+ }
264
+ renderKeyShortcuts(keyShortcuts) {
265
+ return keyShortcuts.split(/(?<!(?:[+]|^))([+\s])/).map((key, i, items) => {
266
+ var _a;
267
+ if (key === "+" && i > 0 && items[i - 1] !== "+") {
268
+ return index.h("span", { part: "plus" }, "+");
269
+ }
270
+ else if (key === " " && i > 0 && items[i - 1] !== "+") {
271
+ return index.h("span", { part: "slash" }, "/");
272
+ }
273
+ else {
274
+ return index.h("kbd", { part: `key` }, (_a = KEY_SYMBOL[key]) !== null && _a !== void 0 ? _a : key);
275
+ }
276
+ });
203
277
  }
204
278
  render() {
205
279
  return index.h(index.Host, null, this.showShortcuts && this.renderShortcuts());
206
280
  }
207
281
  get el() { return index.getElement(this); }
282
+ static get watchers() { return {
283
+ "suspend": ["suspendHandler"]
284
+ }; }
208
285
  };
209
286
  ChShortcuts.style = chShortcutsCss;
210
287
 
@@ -214,6 +291,7 @@ const GxgShortcuts = class {
214
291
  constructor(hostRef) {
215
292
  index.registerInstance(this, hostRef);
216
293
  this.showKey = "F10";
294
+ this.suspend = false;
217
295
  this.showTooltip = false;
218
296
  this.show = false;
219
297
  }
@@ -221,7 +299,8 @@ const GxgShortcuts = class {
221
299
  this.showTooltip = true;
222
300
  }
223
301
  render() {
224
- return (index.h(index.Host, null, index.h("ch-shortcuts", { src: this.src, showKey: this.showKey })));
302
+ console.log("render");
303
+ return (index.h(index.Host, null, index.h("ch-shortcuts", { suspend: this.suspend, src: this.src, showKey: this.showKey })));
225
304
  }
226
305
  };
227
306
  GxgShortcuts.style = shortcutsCss;