@genexus/genexus-ide-ui 0.0.83 → 0.0.84

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 (208) hide show
  1. package/dist/cjs/{ch-checkbox_4.cjs.entry.js → ch-checkbox_3.cjs.entry.js} +0 -768
  2. package/dist/cjs/ch-tree-view-render_2.cjs.entry.js +942 -0
  3. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  4. package/dist/cjs/gx-ide-ai-assistant.cjs.entry.js +1 -1
  5. package/dist/cjs/gx-ide-ai-message.cjs.entry.js +1 -1
  6. package/dist/cjs/gx-ide-bpm-app-declaration.cjs.entry.js +1 -1
  7. package/dist/cjs/gx-ide-card.cjs.entry.js +41 -0
  8. package/dist/cjs/gx-ide-container_3.cjs.entry.js +2 -2
  9. package/dist/cjs/gx-ide-create-kb-from-server.cjs.entry.js +1 -1
  10. package/dist/cjs/gx-ide-dashboard-home.cjs.entry.js +3 -3
  11. package/dist/cjs/gx-ide-kb-manager-export.cjs.entry.js +1 -1
  12. package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +2 -2
  13. package/dist/cjs/gx-ide-new-environment.cjs.entry.js +2 -2
  14. package/dist/cjs/gx-ide-new-kb.cjs.entry.js +1 -1
  15. package/dist/cjs/gx-ide-new-object.cjs.entry.js +1 -1
  16. package/dist/cjs/gx-ide-object-selector.cjs.entry.js +2 -2
  17. package/dist/cjs/gx-ide-recent-news.cjs.entry.js +112 -0
  18. package/dist/cjs/gx-ide-references.cjs.entry.js +1 -1
  19. package/dist/cjs/gx-ide-share-kb.cjs.entry.js +1 -1
  20. package/dist/cjs/gx-ide-start-page.cjs.entry.js +111 -0
  21. package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +2 -2
  22. package/dist/cjs/gx-ide-team-dev-select-recent-comment.cjs.entry.js +1 -1
  23. package/dist/cjs/gx-ide-team-dev-update-partial-selection.cjs.entry.js +1 -1
  24. package/dist/cjs/gx-ide-team-dev-update-to-revision.cjs.entry.js +1 -1
  25. package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +2 -2
  26. package/dist/cjs/gx-ide-template.cjs.entry.js +1 -1
  27. package/dist/cjs/gx-ide-ww-images.cjs.entry.js +2 -2
  28. package/dist/cjs/gxg-button-group.cjs.entry.js +190 -0
  29. package/dist/cjs/gxg-card_2.cjs.entry.js +196 -52
  30. package/dist/cjs/gxg-ide-loader.cjs.entry.js +112 -0
  31. package/dist/cjs/gxg-pill.cjs.entry.js +86 -0
  32. package/dist/cjs/gxg-tab_4.cjs.entry.js +1 -1
  33. package/dist/cjs/{helpers-8d026db9.js → helpers-cd8bd90a.js} +80 -6
  34. package/dist/cjs/loader.cjs.js +1 -1
  35. package/dist/collection/collection-manifest.json +4 -1
  36. package/dist/collection/common/helpers.js +80 -9
  37. package/dist/collection/components/_helpers/card/card.css +213 -0
  38. package/dist/collection/components/_helpers/card/card.js +120 -0
  39. package/dist/collection/components/_helpers/card/gx-ide-assets/card/langs/card.lang.en.json +10 -0
  40. package/dist/collection/components/_helpers/card/gx-ide-assets/card/langs/card.lang.ja.json +3 -0
  41. package/dist/collection/components/_helpers/card/gx-ide-assets/card/langs/card.lang.zh.json +3 -0
  42. package/dist/collection/components/_helpers/title/title.js +1 -1
  43. package/dist/collection/components/_starting-template/template.css +14 -1
  44. package/dist/collection/components/ai-assistant/ai-assistant.css +14 -1
  45. package/dist/collection/components/bpm-application-declaration/bpm-app-declaration.css +14 -1
  46. package/dist/collection/components/create-kb-from-server/create-kb-from-server.css +14 -1
  47. package/dist/collection/components/dashboard-home/dashboard-home.css +14 -1
  48. package/dist/collection/components/dashboard-home/dashboard-home.js +1 -1
  49. package/dist/collection/components/kb-manager-export/kb-manager-export.css +14 -1
  50. package/dist/collection/components/kb-manager-import/kb-manager-import.css +14 -1
  51. package/dist/collection/components/new-environment/new-environment.css +14 -1
  52. package/dist/collection/components/new-kb/new-kb.css +14 -1
  53. package/dist/collection/components/new-object/new-object.css +14 -1
  54. package/dist/collection/components/object-selector/object-selector.css +14 -1
  55. package/dist/collection/components/references/references.css +14 -1
  56. package/dist/collection/components/share-kb/share-kb.css +14 -1
  57. package/dist/collection/components/start-page/gx-ide-assets/recent-news/langs/recent-news.lang.en.json +14 -0
  58. package/dist/collection/components/start-page/gx-ide-assets/recent-news/langs/recent-news.lang.ja.json +3 -0
  59. package/dist/collection/components/start-page/gx-ide-assets/recent-news/langs/recent-news.lang.zh.json +3 -0
  60. package/dist/collection/components/start-page/gx-ide-assets/start-page/langs/start-page.lang.en.json +23 -0
  61. package/dist/collection/components/start-page/gx-ide-assets/start-page/langs/start-page.lang.ja.json +3 -0
  62. package/dist/collection/components/start-page/gx-ide-assets/start-page/langs/start-page.lang.zh.json +3 -0
  63. package/dist/collection/components/start-page/recent-news.css +270 -0
  64. package/dist/collection/components/start-page/recent-news.js +169 -0
  65. package/dist/collection/components/start-page/start-page.css +256 -0
  66. package/dist/collection/components/start-page/start-page.js +240 -0
  67. package/dist/collection/components/team-dev/commit/commit.css +14 -1
  68. package/dist/collection/components/team-dev/select-recent-comment/select-recent-comment.css +14 -1
  69. package/dist/collection/components/team-dev/update/update.css +14 -1
  70. package/dist/collection/components/team-dev/update-partial-selection/update-partial-selection.css +14 -1
  71. package/dist/collection/components/team-dev/update-to-revision/update-to-revision.css +14 -1
  72. package/dist/collection/components/ww-images/ww-images.css +14 -1
  73. package/dist/components/card.js +85 -3
  74. package/dist/components/gx-ide-ai-assistant.js +1 -1
  75. package/dist/components/gx-ide-bpm-app-declaration.js +1 -1
  76. package/dist/components/gx-ide-card.d.ts +11 -0
  77. package/dist/components/gx-ide-card.js +59 -0
  78. package/dist/components/gx-ide-create-kb-from-server.js +1 -1
  79. package/dist/components/gx-ide-dashboard-home.js +2 -2
  80. package/dist/components/gx-ide-kb-manager-export.js +1 -1
  81. package/dist/components/gx-ide-kb-manager-import.js +1 -1
  82. package/dist/components/gx-ide-new-environment.js +1 -1
  83. package/dist/components/gx-ide-new-kb.js +1 -1
  84. package/dist/components/gx-ide-new-object.js +1 -1
  85. package/dist/components/gx-ide-object-selector.js +1 -1
  86. package/dist/components/gx-ide-recent-news.d.ts +11 -0
  87. package/dist/components/gx-ide-recent-news.js +6 -0
  88. package/dist/components/gx-ide-references.js +1 -1
  89. package/dist/components/gx-ide-share-kb.js +1 -1
  90. package/dist/components/gx-ide-start-page.d.ts +11 -0
  91. package/dist/components/gx-ide-start-page.js +247 -0
  92. package/dist/components/gx-ide-team-dev-commit.js +1 -1
  93. package/dist/components/gx-ide-team-dev-select-recent-comment.js +1 -1
  94. package/dist/components/gx-ide-team-dev-update-partial-selection.js +1 -1
  95. package/dist/components/gx-ide-team-dev-update-to-revision.js +1 -1
  96. package/dist/components/gx-ide-team-dev-update.js +1 -1
  97. package/dist/components/gx-ide-template.js +1 -1
  98. package/dist/components/gx-ide-ww-images.js +1 -1
  99. package/dist/components/helpers2.js +80 -6
  100. package/dist/components/ide-loader.js +5 -4
  101. package/dist/components/index.d.ts +3 -0
  102. package/dist/components/index.js +3 -0
  103. package/dist/components/recent-news.js +194 -0
  104. package/dist/components/tab-bar.js +1 -1
  105. package/dist/components/title.js +1 -1
  106. package/dist/components/title2.js +1 -1
  107. package/dist/esm/{ch-checkbox_4.entry.js → ch-checkbox_3.entry.js} +2 -769
  108. package/dist/esm/ch-tree-view-render_2.entry.js +937 -0
  109. package/dist/esm/genexus-ide-ui.js +1 -1
  110. package/dist/esm/gx-ide-ai-assistant.entry.js +1 -1
  111. package/dist/esm/gx-ide-ai-message.entry.js +1 -1
  112. package/dist/esm/gx-ide-bpm-app-declaration.entry.js +1 -1
  113. package/dist/esm/gx-ide-card.entry.js +37 -0
  114. package/dist/esm/gx-ide-container_3.entry.js +2 -2
  115. package/dist/esm/gx-ide-create-kb-from-server.entry.js +1 -1
  116. package/dist/esm/gx-ide-dashboard-home.entry.js +3 -3
  117. package/dist/esm/gx-ide-kb-manager-export.entry.js +1 -1
  118. package/dist/esm/gx-ide-kb-manager-import.entry.js +2 -2
  119. package/dist/esm/gx-ide-new-environment.entry.js +2 -2
  120. package/dist/esm/gx-ide-new-kb.entry.js +1 -1
  121. package/dist/esm/gx-ide-new-object.entry.js +1 -1
  122. package/dist/esm/gx-ide-object-selector.entry.js +2 -2
  123. package/dist/esm/gx-ide-recent-news.entry.js +108 -0
  124. package/dist/esm/gx-ide-references.entry.js +1 -1
  125. package/dist/esm/gx-ide-share-kb.entry.js +1 -1
  126. package/dist/esm/gx-ide-start-page.entry.js +107 -0
  127. package/dist/esm/gx-ide-team-dev-commit.entry.js +2 -2
  128. package/dist/esm/gx-ide-team-dev-select-recent-comment.entry.js +1 -1
  129. package/dist/esm/gx-ide-team-dev-update-partial-selection.entry.js +1 -1
  130. package/dist/esm/gx-ide-team-dev-update-to-revision.entry.js +1 -1
  131. package/dist/esm/gx-ide-team-dev-update.entry.js +2 -2
  132. package/dist/esm/gx-ide-template.entry.js +1 -1
  133. package/dist/esm/gx-ide-ww-images.entry.js +2 -2
  134. package/dist/esm/gxg-button-group.entry.js +186 -0
  135. package/dist/esm/gxg-card_2.entry.js +197 -53
  136. package/dist/esm/gxg-ide-loader.entry.js +108 -0
  137. package/dist/{genexus-ide-ui/p-ca28bfdf.entry.js → esm/gxg-pill.entry.js} +82 -1
  138. package/dist/esm/gxg-tab_4.entry.js +1 -1
  139. package/dist/esm/{helpers-2607df78.js → helpers-810132db.js} +80 -6
  140. package/dist/esm/loader.js +1 -1
  141. package/dist/genexus-ide-ui/genexus-ide-ui.css +3 -3
  142. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  143. package/dist/genexus-ide-ui/gx-ide-assets/card/langs/card.lang.en.json +10 -0
  144. package/dist/genexus-ide-ui/gx-ide-assets/card/langs/card.lang.ja.json +3 -0
  145. package/dist/genexus-ide-ui/gx-ide-assets/card/langs/card.lang.zh.json +3 -0
  146. package/dist/genexus-ide-ui/gx-ide-assets/recent-news/langs/recent-news.lang.en.json +14 -0
  147. package/dist/genexus-ide-ui/gx-ide-assets/recent-news/langs/recent-news.lang.ja.json +3 -0
  148. package/dist/genexus-ide-ui/gx-ide-assets/recent-news/langs/recent-news.lang.zh.json +3 -0
  149. package/dist/genexus-ide-ui/gx-ide-assets/start-page/langs/start-page.lang.en.json +23 -0
  150. package/dist/genexus-ide-ui/gx-ide-assets/start-page/langs/start-page.lang.ja.json +3 -0
  151. package/dist/genexus-ide-ui/gx-ide-assets/start-page/langs/start-page.lang.zh.json +3 -0
  152. package/dist/genexus-ide-ui/p-005970ac.entry.js +1 -0
  153. package/dist/genexus-ide-ui/{p-399217ed.entry.js → p-16b40d12.entry.js} +1 -1
  154. package/dist/genexus-ide-ui/{p-2e599385.entry.js → p-20978da8.entry.js} +1 -1
  155. package/dist/genexus-ide-ui/{p-382a461c.entry.js → p-20fab805.entry.js} +1 -1
  156. package/dist/genexus-ide-ui/{p-26c275b5.entry.js → p-37ddc5f6.entry.js} +1 -1
  157. package/dist/genexus-ide-ui/{p-cf72f115.entry.js → p-3d2a89d2.entry.js} +1 -1
  158. package/dist/genexus-ide-ui/p-49ae7773.entry.js +1 -0
  159. package/dist/genexus-ide-ui/p-4de6b0f4.entry.js +1 -0
  160. package/dist/genexus-ide-ui/p-4f631c2a.entry.js +1 -0
  161. package/dist/genexus-ide-ui/p-5757e203.entry.js +1 -0
  162. package/dist/genexus-ide-ui/p-59355863.entry.js +1 -0
  163. package/dist/genexus-ide-ui/p-5ce9c310.entry.js +1 -0
  164. package/dist/genexus-ide-ui/p-67869d00.entry.js +1 -0
  165. package/dist/genexus-ide-ui/p-67b0f211.entry.js +1 -0
  166. package/dist/genexus-ide-ui/p-76d27117.entry.js +1 -0
  167. package/dist/genexus-ide-ui/{p-16532b36.entry.js → p-7745e8fb.entry.js} +1 -1
  168. package/dist/genexus-ide-ui/{p-40cba1ef.entry.js → p-7a03aa05.entry.js} +1 -1
  169. package/dist/genexus-ide-ui/{p-31a0baf1.entry.js → p-85b78e25.entry.js} +1 -1
  170. package/dist/genexus-ide-ui/{p-7e3f439e.entry.js → p-86d30386.entry.js} +1 -1
  171. package/dist/genexus-ide-ui/p-893efb21.entry.js +1 -0
  172. package/dist/genexus-ide-ui/{p-e43f7f5f.entry.js → p-9f08b2a4.entry.js} +1 -1
  173. package/dist/genexus-ide-ui/{p-00b9fa56.entry.js → p-a1cce7b8.entry.js} +1 -1
  174. package/dist/genexus-ide-ui/p-a5d4e357.entry.js +1 -0
  175. package/dist/genexus-ide-ui/p-bf54ee78.entry.js +1 -0
  176. package/dist/genexus-ide-ui/p-bf672a51.entry.js +1 -0
  177. package/dist/genexus-ide-ui/{p-df8b9e5f.entry.js → p-d02372e0.entry.js} +1 -1
  178. package/dist/genexus-ide-ui/{p-bb842602.entry.js → p-d3428456.entry.js} +1 -1
  179. package/dist/genexus-ide-ui/{p-2c384ea8.entry.js → p-d9910218.entry.js} +1 -1
  180. package/dist/genexus-ide-ui/p-da8ad725.entry.js +1 -0
  181. package/dist/genexus-ide-ui/p-e00411a8.entry.js +1 -0
  182. package/dist/genexus-ide-ui/p-e79f34d7.js +1 -0
  183. package/dist/genexus-ide-ui/{p-a2a856d8.entry.js → p-fd18305d.entry.js} +1 -1
  184. package/dist/node_modules/@genexus/gemini/dist/collection/components/card/card.css +189 -56
  185. package/dist/node_modules/@genexus/gemini/dist/collection/components/ide-loader/ide-loader.css +1 -1
  186. package/dist/node_modules/@genexus/gemini/dist/collection/components/tab-bar/tab-bar.css +0 -1
  187. package/dist/node_modules/@genexus/gemini/dist/collection/components/title/title.css +1 -0
  188. package/dist/types/common/helpers.d.ts +1 -2
  189. package/dist/types/components/_helpers/card/card.d.ts +28 -0
  190. package/dist/types/components/start-page/recent-news.d.ts +39 -0
  191. package/dist/types/components/start-page/start-page.d.ts +59 -0
  192. package/dist/types/components.d.ts +137 -0
  193. package/package.json +3 -3
  194. package/dist/cjs/gxg-button-group_3.cjs.entry.js +0 -463
  195. package/dist/cjs/gxg-title-editable.cjs.entry.js +0 -157
  196. package/dist/esm/gxg-button-group_3.entry.js +0 -457
  197. package/dist/esm/gxg-title-editable.entry.js +0 -153
  198. package/dist/genexus-ide-ui/p-3e713453.entry.js +0 -1
  199. package/dist/genexus-ide-ui/p-4a337d35.entry.js +0 -1
  200. package/dist/genexus-ide-ui/p-68f2bdb2.entry.js +0 -1
  201. package/dist/genexus-ide-ui/p-99bdb8f7.entry.js +0 -1
  202. package/dist/genexus-ide-ui/p-acea5e0c.entry.js +0 -1
  203. package/dist/genexus-ide-ui/p-b600039f.entry.js +0 -1
  204. package/dist/genexus-ide-ui/p-b71f6a1f.entry.js +0 -1
  205. package/dist/genexus-ide-ui/p-bbe82a47.entry.js +0 -1
  206. package/dist/genexus-ide-ui/p-ce98ad84.entry.js +0 -1
  207. package/dist/genexus-ide-ui/p-d410aa15.js +0 -1
  208. package/dist/genexus-ide-ui/p-f1922c2f.entry.js +0 -1
@@ -0,0 +1,937 @@
1
+ import { r as registerInstance, c as createEvent, f as forceUpdate, h, a as getAssetPath } from './index-0aa3977d.js';
2
+
3
+ const filterWithCase = (stringToFilter, filter, matchCase) => matchCase
4
+ ? stringToFilter.includes(filter)
5
+ : stringToFilter.toLowerCase().includes(filter.toLowerCase());
6
+ const filterWithString = (stringToFilter, filter, filterOptions) => (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.regularExpression)
7
+ ? stringToFilter.match(filter) !== null
8
+ : filterWithCase(stringToFilter, filter, filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.matchCase);
9
+ const filterDictionary = {
10
+ caption: (item, filterInfo) => {
11
+ var _a;
12
+ return filterInfo.filter
13
+ ? filterWithString((_a = item.caption) !== null && _a !== void 0 ? _a : "", filterInfo.filter, filterInfo.filterOptions)
14
+ : true;
15
+ },
16
+ checked: (item, filterInfo) => {
17
+ var _a, _b;
18
+ return ((_a = item.checkbox) !== null && _a !== void 0 ? _a : filterInfo.defaultCheckbox) &&
19
+ !item.indeterminate &&
20
+ ((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
21
+ },
22
+ "id-list": (item, filterInfo) => filterInfo.filterList.includes(item.id),
23
+ metadata: (item, filterInfo) => {
24
+ var _a;
25
+ return filterInfo.filter
26
+ ? filterWithString((_a = item.metadata) !== null && _a !== void 0 ? _a : "", filterInfo.filter, filterInfo.filterOptions)
27
+ : true;
28
+ },
29
+ none: () => true,
30
+ unchecked: (item, filterInfo) => {
31
+ var _a, _b;
32
+ return ((_a = item.checkbox) !== null && _a !== void 0 ? _a : filterInfo.defaultCheckbox) &&
33
+ !item.indeterminate &&
34
+ !((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
35
+ }
36
+ };
37
+
38
+ const URL_REGEX = /url\((["']?)([^\)]*)\)(?:\s+([\d.]+)x)?/i;
39
+ let computedStyle;
40
+ function normalizeUri(uri) {
41
+ if (uri.startsWith("data:image/svg+xml;utf8,")) {
42
+ uri = `data:image/svg+xml;base64,${btoa(uri.slice(24).replace(/\\"/g, '"'))}`;
43
+ }
44
+ uri = uri.replace(/\\/g, "");
45
+ uri = uri.replace(/\s/g, "%20");
46
+ return uri;
47
+ }
48
+ function getImage(name, gxImageConstructor) {
49
+ if (!computedStyle) {
50
+ computedStyle = getComputedStyle(document.documentElement);
51
+ }
52
+ let value = computedStyle.getPropertyValue(`--gx-image_${name}`);
53
+ if (value) {
54
+ let matches;
55
+ const gximage = gxImageConstructor(name);
56
+ while ((matches = value.match(URL_REGEX))) {
57
+ gximage.densitySet.push({
58
+ uri: normalizeUri(matches[1] ? matches[2].slice(0, -1) : matches[2]),
59
+ density: matches[3] ? parseFloat(matches[3]) : 1
60
+ });
61
+ value = value.slice(matches[0].length);
62
+ }
63
+ if (gximage.densitySet.length > 0) {
64
+ gximage.uri = gximage.densitySet.reduce((previousValue, currentValue) => {
65
+ return previousValue.density === 1 ||
66
+ previousValue.density < currentValue.density
67
+ ? previousValue
68
+ : currentValue;
69
+ }).uri;
70
+ }
71
+ return gximage;
72
+ }
73
+ }
74
+ const fromGxImageToURL = (gxImage, Settings, gxImageConstructor) => {
75
+ if (!gxImage) {
76
+ return;
77
+ }
78
+ let url = "";
79
+ if (gxImage.id) {
80
+ url = getImage(gxImage.id, gxImageConstructor).uri;
81
+ }
82
+ else {
83
+ url = gxImage.uri;
84
+ }
85
+ if (!url) {
86
+ return "";
87
+ }
88
+ const baseUrl = Settings.WEBAPP_BASE;
89
+ const urlLower = url.toLowerCase();
90
+ if (urlLower.startsWith("assets/")) {
91
+ // Relative URL to local assets
92
+ return url;
93
+ }
94
+ else if (urlLower.startsWith("http://") ||
95
+ urlLower.startsWith("https://") ||
96
+ urlLower.startsWith("blob:") ||
97
+ urlLower.startsWith("file:") ||
98
+ urlLower.startsWith("data:")) {
99
+ // Absolute URL
100
+ return url;
101
+ }
102
+ else if (urlLower.startsWith(Settings.BASE_PATH.toLowerCase())) {
103
+ // Host relative URL
104
+ return baseUrl + url.substring(Settings.BASE_PATH.length);
105
+ }
106
+ else {
107
+ return baseUrl + url;
108
+ }
109
+ };
110
+
111
+ const treeViewRenderCss = "ch-tree-view-render{display:contents}";
112
+
113
+ const DEFAULT_DRAG_DISABLED_VALUE$1 = false;
114
+ const DEFAULT_DROP_DISABLED_VALUE$1 = false;
115
+ const DEFAULT_CLASS_VALUE = "tree-view-item";
116
+ const DEFAULT_EDITABLE_ITEMS_VALUE$1 = true;
117
+ const DEFAULT_EXPANDED_VALUE = false;
118
+ const DEFAULT_INDETERMINATE_VALUE = false;
119
+ const DEFAULT_LAZY_VALUE = false;
120
+ const DEFAULT_ORDER_VALUE = 0;
121
+ const DEFAULT_SELECTED_VALUE = false;
122
+ const defaultRenderItem$1 = (itemModel, treeState, treeHasFilter, lastItem, level) => {
123
+ var _a, _b, _c, _d, _e, _f;
124
+ return (treeState.filterType === "none" || itemModel.render !== false) && (h("ch-tree-view-item", { id: itemModel.id, caption: itemModel.caption, checkbox: (_a = itemModel.checkbox) !== null && _a !== void 0 ? _a : treeState.checkbox, checked: (_b = itemModel.checked) !== null && _b !== void 0 ? _b : treeState.checked, class: itemModel.class, disabled: itemModel.disabled, downloading: itemModel.downloading, dragDisabled: (_c = itemModel.dragDisabled) !== null && _c !== void 0 ? _c : treeState.dragDisabled, dropDisabled: (_d = itemModel.dropDisabled) !== null && _d !== void 0 ? _d : treeState.dropDisabled, editable: (_e = itemModel.editable) !== null && _e !== void 0 ? _e : treeState.editableItems, expanded: itemModel.expanded, indeterminate: itemModel.indeterminate, lastItem: lastItem, lazyLoad: itemModel.lazy, leaf: itemModel.leaf, leftImgSrc: itemModel.leftImgSrc, level: level, metadata: itemModel.metadata, rightImgSrc: itemModel.rightImgSrc, selected: itemModel.selected, showExpandableButton: itemModel.showExpandableButton, showLines: treeState.showLines, toggleCheckboxes: (_f = itemModel.toggleCheckboxes) !== null && _f !== void 0 ? _f : treeState.toggleCheckboxes }, !itemModel.leaf &&
125
+ itemModel.items != null &&
126
+ itemModel.items.map((subModel, index) => defaultRenderItem$1(subModel, treeState, treeHasFilter, treeState.showLines !== "none" &&
127
+ // If there is a filter applied in the current list, use the
128
+ // lastItemId value to calculate the last item
129
+ (treeHasFilter && itemModel.lastItemId !== ""
130
+ ? subModel.id === itemModel.lastItemId
131
+ : index === itemModel.items.length - 1), level + 1))));
132
+ };
133
+ const GXRenderItem = (itemModel, treeState, treeHasFilter, lastItem, level) => {
134
+ var _a, _b, _c, _d;
135
+ return (treeState.filterType === "none" || itemModel.render !== false) && (h("ch-tree-view-item", { id: itemModel.id, caption: itemModel.caption, checkbox: (_a = itemModel.checkbox) !== null && _a !== void 0 ? _a : treeState.checkbox, checked: (_b = itemModel.checked) !== null && _b !== void 0 ? _b : treeState.checked, class: itemModel.class, downloading: itemModel.downloading, dragDisabled: itemModel.dragEnabled != null
136
+ ? !itemModel.dragEnabled
137
+ : treeState.dragDisabled, dropDisabled: itemModel.dropEnabled != null
138
+ ? !itemModel.dropEnabled
139
+ : treeState.dropDisabled, editable: (_c = itemModel.editable) !== null && _c !== void 0 ? _c : treeState.editableItems, expanded: itemModel.expanded, indeterminate: itemModel.indeterminate, lastItem: lastItem, lazyLoad: itemModel.lazy, leaf: itemModel.leaf, leftImgSrc: fromGxImageToURL(itemModel.leftImage, treeState.gxSettings, treeState.gxImageConstructor), level: level, metadata: itemModel.metadata, selected: itemModel.selected, showLines: treeState.showLines, toggleCheckboxes: (_d = itemModel.toggleCheckboxes) !== null && _d !== void 0 ? _d : treeState.toggleCheckboxes }, !itemModel.leaf &&
140
+ itemModel.items != null &&
141
+ itemModel.items.map((subModel, index) => GXRenderItem(subModel, treeState, treeHasFilter, treeState.showLines !== "none" &&
142
+ // If there is a filter applied in the current list, use the
143
+ // lastItemId value to calculate the last item
144
+ (treeHasFilter && itemModel.lastItemId !== ""
145
+ ? subModel.id === itemModel.lastItemId
146
+ : index === itemModel.items.length - 1), level + 1))));
147
+ };
148
+ const defaultSortItemsCallback = (subModel) => {
149
+ subModel.sort((a, b) => {
150
+ if (a.order < b.order) {
151
+ return -1;
152
+ }
153
+ if (a.order > b.order) {
154
+ return 0;
155
+ }
156
+ return a.caption <= b.caption ? -1 : 0;
157
+ });
158
+ };
159
+ const ChTreeViewRender = class {
160
+ constructor(hostRef) {
161
+ registerInstance(this, hostRef);
162
+ this.checkedItemsChange = createEvent(this, "checkedItemsChange", 7);
163
+ this.itemContextmenu = createEvent(this, "itemContextmenu", 7);
164
+ this.itemOpenReference = createEvent(this, "itemOpenReference", 7);
165
+ this.selectedItemsChange = createEvent(this, "selectedItemsChange", 7);
166
+ // UI Models
167
+ this.flattenedTreeModel = new Map();
168
+ this.flattenedCheckboxTreeModel = new Map();
169
+ this.selectedItems = new Set();
170
+ this.applyFilters = false;
171
+ this.emitCheckedChange = false;
172
+ /**
173
+ * This property lets you specify if the tree is waiting to process the drop
174
+ * of items.
175
+ */
176
+ this.waitDropProcessing = false;
177
+ /**
178
+ * Set this attribute if you want display a checkbox in all items by default.
179
+ */
180
+ this.checkbox = false;
181
+ /**
182
+ * Set this attribute if you want the checkbox to be checked in all items by
183
+ * default.
184
+ * Only works if `checkbox = true`
185
+ */
186
+ this.checked = false;
187
+ /**
188
+ * A CSS class to set as the `ch-tree-view` element class.
189
+ */
190
+ this.cssClass = "tree-view";
191
+ /**
192
+ * This attribute lets you specify if the drag operation is disabled in all
193
+ * items by default. If `true`, the items can't be dragged.
194
+ */
195
+ this.dragDisabled = DEFAULT_DRAG_DISABLED_VALUE$1;
196
+ /**
197
+ * This attribute lets you specify if the drop operation is disabled in all
198
+ * items by default. If `true`, the items won't accept any drops.
199
+ */
200
+ this.dropDisabled = DEFAULT_DROP_DISABLED_VALUE$1;
201
+ /**
202
+ * This attribute lets you specify if the edit operation is enabled in all
203
+ * items by default. If `true`, the items can edit its caption in place.
204
+ */
205
+ this.editableItems = DEFAULT_EDITABLE_ITEMS_VALUE$1;
206
+ /**
207
+ * This property lets you determine the debounce time (in ms) that the
208
+ * control waits until it processes the changes to the filter property.
209
+ * Consecutive changes to the `filter` property between this range, reset the
210
+ * timeout to process the filter.
211
+ * Only works if `filterType = "caption" | "metadata"`.
212
+ */
213
+ this.filterDebounce = 250;
214
+ /**
215
+ * This property lets you determine the list of items that will be filtered.
216
+ * Only works if `filterType = "id-list"`.
217
+ */
218
+ this.filterList = [];
219
+ /**
220
+ * This property lets you determine the options that will be applied to the
221
+ * filter.
222
+ * Only works if `filterType = "caption" | "metadata"`.
223
+ */
224
+ this.filterOptions = {};
225
+ /**
226
+ * This attribute lets you define what kind of filter is applied to items.
227
+ * Only items that satisfy the filter predicate will be displayed.
228
+ *
229
+ * | Value | Details |
230
+ * | ----------- | ---------------------------------------------------------------------------------------------- |
231
+ * | `checked` | Show only the items that have a checkbox and are checked. |
232
+ * | `unchecked` | Show only the items that have a checkbox and are not checked. |
233
+ * | `caption` | Show only the items whose `caption` satisfies the regex determinate by the `filter` property. |
234
+ * | `metadata` | Show only the items whose `metadata` satisfies the regex determinate by the `filter` property. |
235
+ * | `id-list` | Show only the items that are contained in the array determinate by the `filterList` property. |
236
+ * | `none` | Show all items. |
237
+ */
238
+ this.filterType = "none";
239
+ /**
240
+ * Set this attribute if you want to allow multi selection of the items.
241
+ */
242
+ this.multiSelection = false;
243
+ /**
244
+ * This property allows us to implement custom rendering of tree items.
245
+ */
246
+ this.renderItem = defaultRenderItem$1;
247
+ /**
248
+ * `true` to display the relation between tree items and tree lists using
249
+ * lines.
250
+ */
251
+ this.showLines = "none";
252
+ /**
253
+ * Callback that is executed when the treeModel is changed to order its items.
254
+ */
255
+ this.sortItemsCallback = defaultSortItemsCallback;
256
+ /**
257
+ * Set this attribute if you want all the children item's checkboxes to be
258
+ * checked when the parent item checkbox is checked, or to be unchecked when
259
+ * the parent item checkbox is unchecked.
260
+ * This attribute will be used in all items by default.
261
+ */
262
+ this.toggleCheckboxes = false;
263
+ /**
264
+ * This property lets you define the model of the ch-tree-x control.
265
+ */
266
+ this.treeModel = [];
267
+ /**
268
+ * This property is a WA to implement the Tree View as a UC 2.0 in GeneXus.
269
+ */
270
+ this.useGxRender = false;
271
+ this.handleDroppableZoneEnter = (event) => {
272
+ if (!this.checkDroppableZoneCallback) {
273
+ return;
274
+ }
275
+ event.stopPropagation();
276
+ // Suppose the request is made immediately by executing the callback
277
+ const requestTimestamp = new Date().getTime();
278
+ const dropInformation = event.detail;
279
+ const promise = this.checkDroppableZoneCallback(dropInformation);
280
+ promise.then(validDrop => {
281
+ this.updateValidDropZone(requestTimestamp, dropInformation.newContainer.id, dropInformation.draggedItems, validDrop);
282
+ });
283
+ };
284
+ this.handleSelectedItemsChange = (event) => {
285
+ event.stopPropagation();
286
+ const itemsToProcess = new Map(event.detail);
287
+ // Remove no longer selected items
288
+ this.selectedItems.forEach(selectedItemId => {
289
+ const itemUIModel = this.flattenedTreeModel.get(selectedItemId).item;
290
+ const itemIsStillSelected = itemsToProcess.get(selectedItemId);
291
+ // The item does not need to be added. Remove it from the processed list
292
+ if (itemIsStillSelected) {
293
+ itemUIModel.expanded = itemIsStillSelected.expanded; // Update expanded state
294
+ itemsToProcess.delete(selectedItemId);
295
+ }
296
+ // The item must be un-selected in the UI Model
297
+ else {
298
+ itemUIModel.selected = false;
299
+ this.selectedItems.delete(selectedItemId);
300
+ }
301
+ });
302
+ // Add new selected items
303
+ itemsToProcess.forEach((newSelectedItemInfo, itemId) => {
304
+ const newSelectedItem = this.flattenedTreeModel.get(itemId).item;
305
+ newSelectedItem.selected = true;
306
+ newSelectedItem.expanded = newSelectedItemInfo.expanded;
307
+ this.selectedItems.add(itemId);
308
+ });
309
+ this.selectedItemsChange.emit(event.detail);
310
+ };
311
+ this.handleExpandedItemChange = (event) => {
312
+ const detail = event.detail;
313
+ const itemInfo = this.flattenedTreeModel.get(detail.id).item;
314
+ itemInfo.expanded = detail.expanded;
315
+ };
316
+ this.handleItemContextmenu = (event) => {
317
+ event.stopPropagation();
318
+ this.itemContextmenu.emit(event.detail);
319
+ };
320
+ this.handleItemsDropped = (event) => {
321
+ const dataTransferInfo = event.detail;
322
+ const newContainer = dataTransferInfo.newContainer;
323
+ const newParentId = newContainer.id;
324
+ // Check if the parent exists in the UI Model
325
+ if (!this.flattenedTreeModel.get(newParentId)) {
326
+ return;
327
+ }
328
+ const draggedItems = dataTransferInfo.draggedItems;
329
+ if (draggedItems.length === 0 || !this.dropItemsCallback) {
330
+ return;
331
+ }
332
+ event.stopPropagation();
333
+ const promise = this.dropItemsCallback(dataTransferInfo);
334
+ this.waitDropProcessing = true;
335
+ promise.then(async (response) => {
336
+ this.dropItems(response.acceptDrop, dataTransferInfo, response.items);
337
+ this.waitDropProcessing = false;
338
+ });
339
+ };
340
+ this.moveItemToNewParent = (newParentUIModel) => (dataTransferInfo) => {
341
+ const itemUIModelExtended = this.flattenedTreeModel.get(dataTransferInfo.id);
342
+ const item = itemUIModelExtended.item;
343
+ const oldParentItem = itemUIModelExtended.parentItem;
344
+ // Remove the UI model from the previous parent. The equality function
345
+ // must be by index, not by object reference
346
+ oldParentItem.items.splice(oldParentItem.items.findIndex(el => el.id === item.id), 1);
347
+ // Add the UI Model to the new parent
348
+ newParentUIModel.items.push(item);
349
+ // Reference the new parent in the item
350
+ itemUIModelExtended.parentItem = newParentUIModel;
351
+ };
352
+ this.flattenItemUIModel = (parentModel) => (item) => {
353
+ var _a, _b, _c, _d, _e, _f;
354
+ this.flattenedTreeModel.set(item.id, {
355
+ parentItem: parentModel,
356
+ item: item
357
+ });
358
+ // Add the items that have a checkbox in a separate Map
359
+ if ((_a = item.checkbox) !== null && _a !== void 0 ? _a : this.checkbox) {
360
+ this.flattenedCheckboxTreeModel.set(item.id, {
361
+ parentItem: parentModel,
362
+ item: item
363
+ });
364
+ }
365
+ // Make sure the properties are with their default values to avoid issues
366
+ // when reusing DOM nodes
367
+ item.class || (item.class = DEFAULT_CLASS_VALUE);
368
+ (_b = item.expanded) !== null && _b !== void 0 ? _b : (item.expanded = DEFAULT_EXPANDED_VALUE);
369
+ (_c = item.indeterminate) !== null && _c !== void 0 ? _c : (item.indeterminate = DEFAULT_INDETERMINATE_VALUE);
370
+ (_d = item.lazy) !== null && _d !== void 0 ? _d : (item.lazy = DEFAULT_LAZY_VALUE);
371
+ (_e = item.order) !== null && _e !== void 0 ? _e : (item.order = DEFAULT_ORDER_VALUE);
372
+ (_f = item.selected) !== null && _f !== void 0 ? _f : (item.selected = DEFAULT_SELECTED_VALUE);
373
+ if (item.selected) {
374
+ this.selectedItems.add(item.id);
375
+ }
376
+ this.flattenSubModel(item);
377
+ };
378
+ }
379
+ handleFilterChange() {
380
+ if (this.filterType === "caption" || this.filterType === "metadata") {
381
+ this.processFilters();
382
+ }
383
+ }
384
+ handleFilterDebounceChange() {
385
+ if (this.filterType === "caption" || this.filterType === "metadata") {
386
+ this.processFilters();
387
+ }
388
+ }
389
+ handleFilterListChange() {
390
+ if (this.filterType === "id-list") {
391
+ this.processFilters();
392
+ }
393
+ }
394
+ handleFilterOptionsChange() {
395
+ if (this.filterType === "caption" || this.filterType === "metadata") {
396
+ this.processFilters();
397
+ }
398
+ }
399
+ handleFilterTypeChange() {
400
+ this.processFilters();
401
+ }
402
+ handleTreeModelChange() {
403
+ this.flattenModel();
404
+ }
405
+ /**
406
+ * Given the drop accepting, the data transfer info and the external items,
407
+ * it process the drops of the items in the tree.
408
+ */
409
+ async dropItems(acceptDrop, dataTransferInfo, items) {
410
+ if (!acceptDrop) {
411
+ return;
412
+ }
413
+ const newParentId = dataTransferInfo.newContainer.id;
414
+ const newParentUIModel = this.flattenedTreeModel.get(newParentId).item;
415
+ // Only move the items to the new parent, keeping the state
416
+ if (dataTransferInfo.dropInTheSameTree) {
417
+ // Add the UI models to the new container and remove the UI models from
418
+ // the old containers
419
+ dataTransferInfo.draggedItems.forEach(this.moveItemToNewParent(newParentUIModel));
420
+ // When the selected items are moved, the tree must remove its internal
421
+ // state to not have undefined references
422
+ if (dataTransferInfo.draggingSelectedItems) {
423
+ await this.treeRef.clearSelectedItemsInfo();
424
+ }
425
+ }
426
+ // Add the new items
427
+ else {
428
+ if (items == null) {
429
+ return;
430
+ }
431
+ // Add new items to the parent
432
+ newParentUIModel.items.push(...items);
433
+ // Flatten the new UI models
434
+ items.forEach(this.flattenItemUIModel(newParentUIModel));
435
+ }
436
+ this.sortItems(newParentUIModel.items);
437
+ // Open the item to visualize the new subitems
438
+ newParentUIModel.expanded = true;
439
+ // Re-sync checked items
440
+ this.emitCheckedItemsChange();
441
+ // Update filters
442
+ this.processFilters();
443
+ // Force re-render
444
+ forceUpdate(this);
445
+ }
446
+ /**
447
+ * Given an item id, an array of items to add, the download status and the
448
+ * lazy state, updates the item's UI Model.
449
+ */
450
+ async loadLazyContent(itemId, items, downloading = false, lazy = false) {
451
+ const itemToLazyLoadContent = this.flattenedTreeModel.get(itemId).item;
452
+ // Establish that the content was lazy loaded
453
+ itemToLazyLoadContent.downloading = downloading;
454
+ itemToLazyLoadContent.lazy = lazy;
455
+ // Check if there is items to add
456
+ if (items == null) {
457
+ return;
458
+ }
459
+ // @todo What happens in the server when dropping items on a lazy node?
460
+ itemToLazyLoadContent.items = items;
461
+ this.sortItems(itemToLazyLoadContent.items);
462
+ this.flattenSubModel(itemToLazyLoadContent);
463
+ // Re-sync checked items
464
+ this.emitCheckedItemsChange();
465
+ // Update filters
466
+ this.processFilters();
467
+ // Force re-render
468
+ forceUpdate(this);
469
+ }
470
+ /**
471
+ * Given an item id, it displays and scrolls into the item view.
472
+ */
473
+ async scrollIntoVisible(treeItemId) {
474
+ const itemUIModel = this.flattenedTreeModel.get(treeItemId);
475
+ if (!itemUIModel) {
476
+ // @todo Check if the item is on the server?
477
+ return;
478
+ }
479
+ let visitedNode = itemUIModel.parentItem;
480
+ // While the parent is not the root, update the UI Models
481
+ while (visitedNode && visitedNode.id != null) {
482
+ // Expand the item
483
+ visitedNode.expanded = true;
484
+ const visitedNodeUIModel = this.flattenedTreeModel.get(visitedNode.id);
485
+ visitedNode = visitedNodeUIModel.parentItem;
486
+ }
487
+ forceUpdate(this);
488
+ // @todo For some reason, when the model is created using the "big model" option,
489
+ // this implementation does not work when only the UI Model is updated. So, to
490
+ // expand the items, we have to delegate the responsibility to the tree-x
491
+ this.treeRef.scrollIntoVisible(treeItemId);
492
+ }
493
+ /**
494
+ * This method is used to toggle a tree item by the tree item id/ids.
495
+ *
496
+ * @param treeItemIds An array id the tree items to be toggled.
497
+ * @param expand A boolean indicating that the tree item should be expanded or collapsed. (optional)
498
+ * @returns The modified items after the method was called.
499
+ */
500
+ async toggleItems(treeItemIds, expand) {
501
+ if (!treeItemIds) {
502
+ return [];
503
+ }
504
+ const modifiedTreeItems = [];
505
+ treeItemIds.forEach(treeItemId => {
506
+ const itemInfo = this.flattenedTreeModel.get(treeItemId).item;
507
+ if (itemInfo) {
508
+ itemInfo.expanded = expand !== null && expand !== void 0 ? expand : !itemInfo.expanded;
509
+ modifiedTreeItems.push({
510
+ id: itemInfo.id,
511
+ expanded: itemInfo.expanded
512
+ });
513
+ }
514
+ });
515
+ // Force re-render
516
+ forceUpdate(this);
517
+ return modifiedTreeItems;
518
+ }
519
+ /**
520
+ * Given a subset of item's properties, it updates all item UI models.
521
+ */
522
+ async updateAllItemsProperties(properties) {
523
+ [...this.flattenedTreeModel.values()].forEach(itemUIModel => {
524
+ if (properties.expanded != null) {
525
+ itemUIModel.item.expanded = properties.expanded;
526
+ }
527
+ if (properties.checked != null) {
528
+ itemUIModel.item.checked = properties.checked;
529
+ itemUIModel.item.indeterminate = false;
530
+ }
531
+ });
532
+ // Update filters
533
+ if (properties.checked != null) {
534
+ this.processFilters();
535
+ }
536
+ forceUpdate(this);
537
+ }
538
+ /**
539
+ * Given a item list and the properties to update, it updates the properties
540
+ * of the items in the list.
541
+ */
542
+ async updateItemsProperties(items, properties) {
543
+ items.forEach(item => {
544
+ const itemUIModel = this.flattenedTreeModel.get(item);
545
+ this.updateItemProperty(itemUIModel, properties);
546
+ });
547
+ // Update filters
548
+ this.processFilters();
549
+ forceUpdate(this);
550
+ }
551
+ /**
552
+ * Update the information about the valid droppable zones.
553
+ * @param requestTimestamp Time where the request to the server was made. Useful to avoid having old information.
554
+ * @param newContainerId ID of the container where the drag is trying to be made.
555
+ * @param draggedItems Information about the dragged items.
556
+ * @param validDrop Current state of the droppable zone.
557
+ */
558
+ async updateValidDropZone(requestTimestamp, newContainerId, draggedItems, validDrop) {
559
+ this.treeRef.updateValidDropZone(requestTimestamp, newContainerId, draggedItems, validDrop);
560
+ }
561
+ updateItemProperty(itemUIModel, properties) {
562
+ if (!itemUIModel) {
563
+ return;
564
+ }
565
+ const itemInfo = itemUIModel.item;
566
+ Object.keys(properties).forEach(propertyName => {
567
+ itemInfo[propertyName] = properties[propertyName];
568
+ });
569
+ }
570
+ updateCheckboxValue(event) {
571
+ event.stopPropagation();
572
+ const detail = event.detail;
573
+ const treeItemId = detail.id;
574
+ const itemUIModel = this.flattenedCheckboxTreeModel.get(treeItemId);
575
+ // In some cases, when the `treeModel` and `checked` properties are updated
576
+ // outside of the tree control, some events are fired with undefined references
577
+ if (!itemUIModel) {
578
+ return;
579
+ }
580
+ const itemInfo = itemUIModel.item;
581
+ itemInfo.checked = detail.checked;
582
+ itemInfo.indeterminate = detail.indeterminate;
583
+ this.emitCheckedItemsChange();
584
+ // Update filters
585
+ if (this.filterType === "checked" || this.filterType === "unchecked") {
586
+ this.processFilters();
587
+ }
588
+ // Force re-render
589
+ forceUpdate(this);
590
+ }
591
+ loadLazyChildrenHandler(event) {
592
+ if (!this.lazyLoadTreeItemsCallback) {
593
+ return;
594
+ }
595
+ event.stopPropagation();
596
+ const treeItemId = event.detail;
597
+ const promise = this.lazyLoadTreeItemsCallback(treeItemId);
598
+ event.target.downloading = true;
599
+ promise.then(result => {
600
+ this.loadLazyContent(treeItemId, result);
601
+ });
602
+ }
603
+ handleCaptionModification(event) {
604
+ if (!this.modifyItemCaptionCallback) {
605
+ return;
606
+ }
607
+ event.stopPropagation();
608
+ const itemRef = event.target;
609
+ const itemId = event.detail.id;
610
+ const itemUIModel = this.flattenedTreeModel.get(itemId);
611
+ const itemInfo = itemUIModel.item;
612
+ const newCaption = event.detail.caption;
613
+ const oldCaption = itemInfo.caption;
614
+ // Optimistic UI: Update the caption in the UI Model before the change is
615
+ // completed in the server
616
+ itemInfo.caption = newCaption;
617
+ // Due to performance reasons, we don't make a shallow copy of the
618
+ // treeModel to force a re-render
619
+ itemRef.caption = newCaption;
620
+ const promise = this.modifyItemCaptionCallback(itemId, newCaption);
621
+ promise.then(status => {
622
+ if (status.success) {
623
+ this.sortItems(itemUIModel.parentItem.items);
624
+ // Update filters
625
+ this.processFilters();
626
+ // Force re-render
627
+ forceUpdate(this);
628
+ }
629
+ else {
630
+ itemRef.caption = oldCaption;
631
+ itemInfo.caption = oldCaption;
632
+ // Do something with the error message
633
+ }
634
+ });
635
+ }
636
+ handleOpenReference(event) {
637
+ event.stopPropagation();
638
+ this.itemOpenReference.emit(event.detail);
639
+ }
640
+ flattenSubModel(model) {
641
+ const items = model.items;
642
+ if (!items) {
643
+ // Make sure that subtrees don't have an undefined array
644
+ if (model.leaf !== true) {
645
+ model.items = [];
646
+ }
647
+ return;
648
+ }
649
+ this.sortItems(items);
650
+ items.forEach(this.flattenItemUIModel(model));
651
+ }
652
+ sortItems(items) {
653
+ // Ensure that items are sorted
654
+ if (this.sortItemsCallback) {
655
+ this.sortItemsCallback(items);
656
+ }
657
+ }
658
+ flattenModel() {
659
+ this.flattenedTreeModel.clear();
660
+ this.flattenedCheckboxTreeModel.clear();
661
+ this.selectedItems.clear();
662
+ // The model was updated at runtime, so we need to clear the references
663
+ if (this.treeRef) {
664
+ this.treeRef.clearSelectedItemsInfo();
665
+ }
666
+ this.flattenSubModel({ id: null, caption: null, items: this.treeModel });
667
+ // Re-sync checked items
668
+ this.emitCheckedItemsChange();
669
+ }
670
+ filterSubModel(item, filterInfo) {
671
+ let aSubItemIsRendered = false;
672
+ // Check if a subitem is rendered
673
+ if (item.leaf !== true && item.items != null) {
674
+ let lastItemId = "";
675
+ item.items.forEach(subItem => {
676
+ const itemSatisfiesFilter = this.filterSubModel(subItem, filterInfo);
677
+ aSubItemIsRendered || (aSubItemIsRendered = itemSatisfiesFilter);
678
+ if (itemSatisfiesFilter) {
679
+ lastItemId = subItem.id;
680
+ }
681
+ });
682
+ item.lastItemId = lastItemId;
683
+ }
684
+ // The current item is rendered if it satisfies the filter condition or a
685
+ // subitem exists that needs to be rendered
686
+ const satisfiesFilter = filterDictionary[this.filterType](item, filterInfo) || aSubItemIsRendered;
687
+ item.render = satisfiesFilter; // Update item render
688
+ return satisfiesFilter;
689
+ }
690
+ emitCheckedItemsChange() {
691
+ this.emitCheckedChange = true;
692
+ }
693
+ updateCheckedItems() {
694
+ // New copy of the checked items
695
+ const allItemsWithCheckbox = new Map(this.flattenedCheckboxTreeModel);
696
+ // Update the checked value if not defined
697
+ allItemsWithCheckbox.forEach(itemUIModel => {
698
+ var _a;
699
+ var _b;
700
+ (_a = (_b = itemUIModel.item).checked) !== null && _a !== void 0 ? _a : (_b.checked = this.checked);
701
+ });
702
+ this.checkedItemsChange.emit(allItemsWithCheckbox);
703
+ }
704
+ processFilters() {
705
+ this.applyFilters = true;
706
+ }
707
+ updateFilters() {
708
+ if (this.filterType === "none") {
709
+ return;
710
+ }
711
+ // Remove queued filter processing
712
+ clearTimeout(this.filterTimeout);
713
+ const processWithDebounce = this.filterDebounce > 0 &&
714
+ (this.filterType === "caption" || this.filterType === "metadata");
715
+ const filterFunction = () => this.filterSubModel({
716
+ id: null,
717
+ caption: null,
718
+ items: this.treeModel
719
+ }, {
720
+ defaultCheckbox: this.checkbox,
721
+ defaultChecked: this.checked,
722
+ filter: this.filter,
723
+ filterList: this.filterList,
724
+ filterOptions: this.filterOptions
725
+ });
726
+ // Check if should filter with debounce
727
+ if (processWithDebounce) {
728
+ this.filterTimeout = setTimeout(() => {
729
+ filterFunction();
730
+ forceUpdate(this); // After the filter processing is completed, force a re-render
731
+ }, this.filterDebounce);
732
+ }
733
+ else {
734
+ filterFunction();
735
+ }
736
+ }
737
+ componentWillLoad() {
738
+ if (this.useGxRender) {
739
+ this.renderItem = GXRenderItem;
740
+ }
741
+ this.flattenModel();
742
+ this.updateCheckedItems();
743
+ this.updateFilters();
744
+ }
745
+ componentWillUpdate() {
746
+ if (this.emitCheckedChange) {
747
+ this.updateCheckedItems();
748
+ this.emitCheckedChange = false;
749
+ }
750
+ if (this.applyFilters) {
751
+ this.updateFilters();
752
+ this.applyFilters = false;
753
+ }
754
+ }
755
+ render() {
756
+ return (h("ch-tree-view", { class: this.cssClass || null, multiSelection: this.multiSelection, waitDropProcessing: this.waitDropProcessing, onDroppableZoneEnter: this.handleDroppableZoneEnter, onExpandedItemChange: this.handleExpandedItemChange, onItemContextmenu: this.handleItemContextmenu, onItemsDropped: this.handleItemsDropped, onSelectedItemsChange: this.handleSelectedItemsChange, ref: el => (this.treeRef = el) }, this.treeModel.map((itemModel, index) => this.renderItem(itemModel, this, (this.filterType === "caption" || this.filterType === "metadata") &&
757
+ this.filter != null, this.showLines !== "none" && index === this.treeModel.length - 1, 0))));
758
+ }
759
+ static get watchers() { return {
760
+ "filter": ["handleFilterChange"],
761
+ "filterDebounce": ["handleFilterDebounceChange"],
762
+ "filterList": ["handleFilterListChange"],
763
+ "filterOptions": ["handleFilterOptionsChange"],
764
+ "filterType": ["handleFilterTypeChange"],
765
+ "treeModel": ["handleTreeModelChange"]
766
+ }; }
767
+ };
768
+ ChTreeViewRender.style = treeViewRenderCss;
769
+
770
+ const resolveImgPath = (iconAssetsPath, img) => `${iconAssetsPath}/${img}.svg`;
771
+
772
+ const treeViewCss = ":root{--ui-animaton-speed:0.2s}.gxg-title-01{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-title-01--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-title-02{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em}.gxg-title-02--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em;color:var(--color-on-primary)}.gxg-title-03{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-xs);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em}.gxg-title-03--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-xs);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em;color:var(--color-on-primary)}.gxg-title-04{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-title-04--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-title-05{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;line-height:1.556em}.gxg-title-05--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;line-height:1.556em;color:var(--color-on-primary)}.gxg-text{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-text--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-text--gray{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--gray-05)}.gxg-quote{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;font-style:italic}.gxg-quote--negative{color:var(--color-on-primary)}.gxg-link{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block}.gxg-link:hover{color:var(--color-primary-hover)}.gxg-link:active{color:var(--color-primary-active)}.gxg-link-gray{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block;color:var(--gray-04)}.gxg-link-gray:hover{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block;color:var(--gray-04);color:var(--gray-06)}.gxg-alert-error{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-error-dark);display:inline-block}.gxg-alert-warning{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-warning-dark);display:inline-block}.gxg-alert-success{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-success-dark);display:inline-block}.gxg-tab--disabled{color:var(--color-primary-disabled);pointer-events:none}.gxg-tab--disabled[disabled]{color:var(--color-primary-disabled);pointer-events:none}.gxg-label{font-family:var(--font-family-primary) !important;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm) !important;letter-spacing:var(--letter-spacing-xs);color:var(--color-primary-enabled);text-align:center;line-height:1.455em}.gxg-label:hover{color:var(--color-primary-hover)}.gxg-label:focus{color:var(--color-primary-active)}.gxg-label:active{color:var(--color-primary-active)}.gxg-label[disabled]{color:var(--color-primary-disabled)}.gxg-label--negative{color:var(--color-on-primary)}.gxg-label--negative[disabled]{color:var(--color-on-disabled)}.gxg-button-styles{font-family:var(--font-family-primary) !important;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm) !important;letter-spacing:var(--letter-spacing-xs);color:var(--color-primary-enabled);text-align:center;line-height:1.455em}.gxg-scrollbar{cursor:initial}.gxg-scrollbar::-webkit-scrollbar{width:var(--gxg-scrollbar-width, 6px);height:var(--gxg-scrollbar-width, 6px)}.gxg-scrollbar::-webkit-scrollbar-track{background-color:var(--gxg-scrollbar-track-background, --gray-02);border-radius:var(--gxg-scrollbar-track-border-radius, 10px)}.gxg-scrollbar::-webkit-scrollbar-thumb{background-color:var(--gxg-scrollbar-track-thumb-background, --gray-05);border-radius:var(--gxg-scrollbar-track-thumb-radius, 10px);border:var(--gxg-scrollbar-track-thumb-border);background-clip:padding-box}.gxg-scrollbar::-webkit-scrollbar-thumb:hover{background-color:var(--gxg-scrollbar-track-thumb-hover-background, --gray-04)}gxg-tree-view{--gxg-tree-view-icon-size:var(--spacing-comp-04);font-family:var(--font-family-primary);font-size:var(--font-size-lg);font-weight:var(--font-weight-regular);color:var(--color-on-background);display:contents}.tree-view{cursor:initial}.tree-view::-webkit-scrollbar{width:var(--gxg-scrollbar-width, 6px);height:var(--gxg-scrollbar-width, 6px)}.tree-view::-webkit-scrollbar-track{background-color:var(--gxg-scrollbar-track-background, --gray-02);border-radius:var(--gxg-scrollbar-track-border-radius, 10px)}.tree-view::-webkit-scrollbar-thumb{background-color:var(--gxg-scrollbar-track-thumb-background, --gray-05);border-radius:var(--gxg-scrollbar-track-thumb-radius, 10px);border:var(--gxg-scrollbar-track-thumb-border);background-clip:padding-box}.tree-view::-webkit-scrollbar-thumb:hover{background-color:var(--gxg-scrollbar-track-thumb-hover-background, --gray-04)}.tree-view .ch-tree-view-container{padding:7px;}.tree-view-item{--ch-tree-view-view__checkbox-size:var(--gxg-checkbox-size);--ch-tree-view-view__expandable-button-width:var(--gxg-tree-view-icon-size);--ch-tree-view-item-gap:var(--spacing-comp-02);--ch-tree-view-item-custom-padding-inline-start:var(--spacing-comp-01);--ch-tree-view-item-custom-padding-inline-end:var(--spacing-comp-01);}.tree-view-item::part(dashed-line){border-color:var(--gray-02)}.tree-view-item::part(header){min-height:var(--spacing-comp-05);padding-top:var(--spacing-comp-00);padding-bottom:var(--spacing-comp-00);padding-inline-end:var(--spacing-comp-02)}.tree-view-item::part(header):before{content:\"\";display:block}.tree-view-item::part(header):hover{background-color:var(--gxg-background-color--hover);color:var(--gxg-color--hover)}.tree-view-item::part(header):focus{outline:var(--border-width-md) solid var(--gxg-border-color--focused);outline-offset:-2px}.tree-view-item[selected]::part(header){background-color:var(--gxg-background-color--selected)}.tree-view-item[selected]::part(header):hover{background-color:var(--gxg-background-color--selected-hover)}.tree-view-item::part(expandable-button){background-color:var(--gray-00)}.tree-view-item::part(expandable-button)::before{background-color:var(--gray-04);-webkit-mask-position:center;-webkit-mask-repeat:no-repeat}.tree-view-item::part(expandable-button):hover{background-color:var(--color-background)}.tree-view-item::part(expandable-button):focus{outline:var(--border-width-md) solid var(--gxg-border-color--focused);outline-offset:0}.tree-view-item::part(left-img){width:var(--spacing-comp-04);height:var(--spacing-comp-04)}.tree-view-item::part(downloading){width:var(--spacing-comp-03);height:var(--spacing-comp-03);border:var(--border-width-md) solid var(--color-primary-enabled);border-inline-start-color:transparent}.tree-view-item::part(checkbox__container){border-color:var(--gray-04);background-color:var(--color-background)}.tree-view-item::part(checkbox__container):after{content:\"\";position:absolute;display:block;border:solid;border-color:transparent;z-index:0}.tree-view-item::part(checkbox__container):focus-within{box-shadow:none;outline:var(--border-width-md) solid var(--gxg-border-color--focused);outline-offset:-2px}.tree-view-item::part(checkbox__option){display:none}.tree-view-item::part(checkbox__container checkbox__checked):after{left:5.5px;top:3px;width:4px;height:7px;border-width:0 2px 2px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);border-color:var(--color-primary-active);transition-property:border-color;transition-duration:var(--ui-animaton-speed);transition-timing-function:ease}.tree-view-item::part(checkbox__container checkbox__indeterminate):after{left:50%;top:50%;width:8px;height:1.5px;border:0;background-color:var(--color-primary-active);-webkit-transform:rotate(0) translateY(-50%) translateX(-50%);-ms-transform:rotate(0) translateY(-50%) translateX(-50%);transform:rotate(0) translateY(-50%) translateX(-50%)}.tree-view-item::part(checkbox__input){position:relative;z-index:1}.tree-view-item--folder::part(action)::before,.tree-view-item--module::part(action)::before{grid-area:left-img;content:\"\";width:var(--gxg-tree-view-icon-size);height:var(--gxg-tree-view-icon-size);margin-inline-end:var(--ch-tree-view-item-gap);background-repeat:no-repeat}.tree-view-item--folder::part(action)::before{background-image:url(\"/build/icon-assets/objects/folder.svg\")}.tree-view-item--folder::part(action expanded)::before{background-image:url(\"/build/icon-assets/objects/folder-open.svg\")}.tree-view-item--module::part(action)::before{background-image:url(\"/build/icon-assets/objects/module.svg\")}.tree-view-item--module::part(action expanded)::before{background-image:url(\"/build/icon-assets/objects/module-open.svg\")}.tree-view-item--pending-commit::part(action)::before{content:\"\";position:relative;z-index:1;grid-area:left-img;width:5px;height:5px;align-self:end;margin-block-end:3px;margin-inline-start:1px;background-color:var(--color-primary-enabled);border-radius:50%}.tree-view-item--editing::part(header){border:2px solid transparent}.tree-view .ch-tree-view-drag-info{padding-inline:6px;padding-block:2px;background-color:#cfdee6;border:1px solid #0266a0;border-radius:10px;font-size:8px}";
773
+
774
+ const DEFAULT_DRAG_DISABLED_VALUE = false;
775
+ const DEFAULT_DROP_DISABLED_VALUE = false;
776
+ const DEFAULT_EDITABLE_ITEMS_VALUE = true;
777
+ const iconAssetsPath = getAssetPath(`./icon-assets`);
778
+ const defaultRenderItem = (itemModel, treeState, treeHasFilter, lastItem, level) => {
779
+ var _a, _b, _c, _d, _e, _f;
780
+ return (treeState.filterType === "none" || itemModel.render !== false) && (h("ch-tree-view-item", { id: itemModel.id, caption: itemModel.caption, checkbox: (_a = itemModel.checkbox) !== null && _a !== void 0 ? _a : treeState.checkbox, checked: (_b = itemModel.checked) !== null && _b !== void 0 ? _b : treeState.checked, class: itemModel.class, disabled: itemModel.disabled, downloading: itemModel.downloading, dragDisabled: (_c = itemModel.dragDisabled) !== null && _c !== void 0 ? _c : treeState.dragDisabled, dropDisabled: (_d = itemModel.dropDisabled) !== null && _d !== void 0 ? _d : treeState.dropDisabled, editable: (_e = itemModel.editable) !== null && _e !== void 0 ? _e : treeState.editableItems, expanded: itemModel.expanded, indeterminate: itemModel.indeterminate, lastItem: lastItem, lazyLoad: itemModel.lazy, leaf: itemModel.leaf, leftImgSrc: itemModel.leftImgSrc
781
+ ? resolveImgPath(iconAssetsPath, itemModel.leftImgSrc)
782
+ : null, level: level, metadata: itemModel.metadata, rightImgSrc: itemModel.rightImgSrc, selected: itemModel.selected, showExpandableButton: itemModel.showExpandableButton, showLines: treeState.showLines, toggleCheckboxes: (_f = itemModel.toggleCheckboxes) !== null && _f !== void 0 ? _f : treeState.toggleCheckboxes }, !itemModel.leaf &&
783
+ itemModel.items != null &&
784
+ itemModel.items.map((subModel, index) => defaultRenderItem(subModel, treeState, treeHasFilter, treeState.showLines !== "none" &&
785
+ // If there is a filter applied in the current list, use the
786
+ // lastItemId value to calculate the last item
787
+ (treeHasFilter && itemModel.lastItemId !== ""
788
+ ? subModel.id === itemModel.lastItemId
789
+ : index === itemModel.items.length - 1), level + 1))));
790
+ };
791
+ const ChTreeViewRenderWrapper = class {
792
+ constructor(hostRef) {
793
+ registerInstance(this, hostRef);
794
+ this.checkedItemsChange = createEvent(this, "checkedItemsChange", 7);
795
+ this.itemContextmenu = createEvent(this, "itemContextmenu", 7);
796
+ this.itemOpenReference = createEvent(this, "itemOpenReference", 7);
797
+ this.selectedItemsChange = createEvent(this, "selectedItemsChange", 7);
798
+ /**
799
+ * Set this attribute if you want display a checkbox in all items by default.
800
+ */
801
+ this.checkbox = false;
802
+ /**
803
+ * Set this attribute if you want the checkbox to be checked in all items by
804
+ * default.
805
+ * Only works if `checkbox = true`
806
+ */
807
+ this.checked = false;
808
+ /**
809
+ * A CSS class to set as the `ch-tree-view` element class.
810
+ */
811
+ this.cssClass = "tree-view";
812
+ /**
813
+ * This attribute lets you specify if the drag operation is disabled in all
814
+ * items by default. If `true`, the items can't be dragged.
815
+ */
816
+ this.dragDisabled = DEFAULT_DRAG_DISABLED_VALUE;
817
+ /**
818
+ * This attribute lets you specify if the drop operation is disabled in all
819
+ * items by default. If `true`, the items won't accept any drops.
820
+ */
821
+ this.dropDisabled = DEFAULT_DROP_DISABLED_VALUE;
822
+ /**
823
+ * This attribute lets you specify if the edit operation is enabled in all
824
+ * items by default. If `true`, the items can edit its caption in place.
825
+ */
826
+ this.editableItems = DEFAULT_EDITABLE_ITEMS_VALUE;
827
+ /**
828
+ * This property lets you determine the debounce time (in ms) that the
829
+ * control waits until it processes the changes to the filter property.
830
+ * Consecutive changes to the `filter` property between this range, reset the
831
+ * timeout to process the filter.
832
+ * Only works if `filterType = "caption" | "metadata"`.
833
+ */
834
+ this.filterDebounce = 0;
835
+ /**
836
+ * This property lets you determine the list of items that will be filtered.
837
+ * Only works if `filterType = "id-list"`.
838
+ */
839
+ this.filterList = [];
840
+ /**
841
+ * This property lets you determine the options that will be applied to the
842
+ * filter.
843
+ * Only works if `filterType = "caption" | "metadata"`.
844
+ */
845
+ this.filterOptions = {};
846
+ /**
847
+ * This attribute lets you define what kind of filter is applied to items.
848
+ * Only items that satisfy the filter predicate will be displayed.
849
+ *
850
+ * | Value | Details |
851
+ * | ----------- | ---------------------------------------------------------------------------------------------- |
852
+ * | `checked` | Show only the items that have a checkbox and are checked. |
853
+ * | `unchecked` | Show only the items that have a checkbox and are not checked. |
854
+ * | `caption` | Show only the items whose `caption` satisfies the regex determinate by the `filter` property. |
855
+ * | `metadata` | Show only the items whose `metadata` satisfies the regex determinate by the `filter` property. |
856
+ * | `id-list` | Show only the items that are contained in the array determinate by the `filterList` property. |
857
+ * | `none` | Show all items. |
858
+ */
859
+ this.filterType = "none";
860
+ /**
861
+ * Set this attribute if you want to allow multi selection of the items.
862
+ */
863
+ this.multiSelection = false;
864
+ /**
865
+ * This property allows us to implement custom rendering of tree items.
866
+ */
867
+ this.renderItem = defaultRenderItem;
868
+ /**
869
+ * `true` to display the relation between tree items and tree lists using
870
+ * lines.
871
+ */
872
+ this.showLines = "all";
873
+ /**
874
+ * Set this attribute if you want all the children item's checkboxes to be
875
+ * checked when the parent item checkbox is checked, or to be unchecked when
876
+ * the parent item checkbox is unchecked.
877
+ * This attribute will be used in all items by default.
878
+ */
879
+ this.toggleCheckboxes = false;
880
+ /**
881
+ * This property lets you define the model of the ch-tree-x control.
882
+ */
883
+ this.treeModel = [];
884
+ }
885
+ /**
886
+ * Given an item id, an array of items to add, the download status and the
887
+ * lazy state, updates the item's UI Model.
888
+ */
889
+ async loadLazyContent(itemId, items, downloading = false, lazy = false) {
890
+ this.treeRef.loadLazyContent(itemId, items, downloading, lazy);
891
+ }
892
+ /**
893
+ * Given an item id, it displays and scrolls into the item view.
894
+ */
895
+ async scrollIntoVisible(treeItemId) {
896
+ this.treeRef.scrollIntoVisible(treeItemId);
897
+ }
898
+ /**
899
+ * This method is used to toggle a tree item by the tree item id/ids.
900
+ *
901
+ * @param treeItemIds An array id the tree items to be toggled.
902
+ * @param expand A boolean indicating that the tree item should be expanded or collapsed. (optional)
903
+ * @returns The modified items after the method was called.
904
+ */
905
+ async toggleItems(treeItemIds, expand) {
906
+ return this.treeRef.toggleItems(treeItemIds, expand);
907
+ }
908
+ /**
909
+ * Given a subset of item's properties, it updates all item UI models.
910
+ */
911
+ async updateAllItemsProperties(properties) {
912
+ this.treeRef.updateAllItemsProperties(properties);
913
+ }
914
+ /**
915
+ * Given a item list and the properties to update, it updates the properties
916
+ * of the items in the list.
917
+ */
918
+ async updateItemsProperties(items, properties) {
919
+ this.treeRef.updateItemsProperties(items, properties);
920
+ }
921
+ /**
922
+ * Update the information about the valid droppable zones.
923
+ * @param requestTimestamp Time where the request to the server was made. Useful to avoid having old information.
924
+ * @param newContainerId ID of the container where the drag is trying to be made.
925
+ * @param draggedItems Information about the dragged items.
926
+ * @param validDrop Current state of the droppable zone.
927
+ */
928
+ async updateValidDropZone(requestTimestamp, newContainerId, draggedItems, validDrop) {
929
+ this.treeRef.updateValidDropZone(requestTimestamp, newContainerId, draggedItems, validDrop);
930
+ }
931
+ render() {
932
+ return (h("ch-tree-view-render", { checkbox: this.checkbox, checked: this.checked, checkDroppableZoneCallback: this.checkDroppableZoneCallback, cssClass: this.cssClass, dragDisabled: this.dragDisabled, dropDisabled: this.dropDisabled, dropItemsCallback: this.dropItemsCallback, editableItems: this.editableItems, filter: this.filter, filterList: this.filterList, filterOptions: this.filterOptions, filterDebounce: this.filterDebounce, filterType: this.filterType, lazyLoadTreeItemsCallback: this.lazyLoadTreeItemsCallback, modifyItemCaptionCallback: this.modifyItemCaptionCallback, multiSelection: this.multiSelection, renderItem: this.renderItem, showLines: this.showLines, sortItemsCallback: this.sortItemsCallback, toggleCheckboxes: this.toggleCheckboxes, treeModel: this.treeModel, ref: (el) => (this.treeRef = el) }));
933
+ }
934
+ };
935
+ ChTreeViewRenderWrapper.style = treeViewCss;
936
+
937
+ export { ChTreeViewRender as ch_tree_view_render, ChTreeViewRenderWrapper as gxg_tree_view };