@genexus/genexus-ide-ui 0.0.83 → 0.0.85

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