@sme.up/ketchup 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/cjs/{f-button-5b69d882.js → f-button-94cb5f35.js} +2 -2
  2. package/dist/cjs/{f-cell-3a740c48.js → f-cell-76830a0d.js} +12 -14
  3. package/dist/cjs/{f-checkbox-57443ca3.js → f-checkbox-cd977193.js} +1 -1
  4. package/dist/cjs/{f-chip-02e83f82.js → f-chip-68d45fd3.js} +3 -3
  5. package/dist/cjs/{f-image-2a61ece2.js → f-image-0e71df7e.js} +2 -2
  6. package/dist/cjs/{f-paginator-utils-09126bdd.js → f-paginator-utils-46689c0a.js} +80 -403
  7. package/dist/cjs/{f-text-field-9ee20a67.js → f-text-field-b4229cef.js} +11 -3
  8. package/dist/cjs/{index-06b131ea.js → index-31125378.js} +9 -4
  9. package/dist/cjs/ketchup.cjs.js +3 -3
  10. package/dist/cjs/kup-accordion.cjs.entry.js +5 -6
  11. package/dist/cjs/kup-autocomplete_25.cjs.entry.js +116 -111
  12. package/dist/cjs/kup-box.cjs.entry.js +15 -17
  13. package/dist/cjs/kup-calendar.cjs.entry.js +9 -11
  14. package/dist/cjs/kup-cell.cjs.entry.js +9 -11
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +5 -7
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +4 -5
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +76 -17
  18. package/dist/cjs/kup-drawer.cjs.entry.js +4 -5
  19. package/dist/cjs/kup-echart.cjs.entry.js +17 -19
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +140 -64
  21. package/dist/cjs/kup-form.cjs.entry.js +10 -12
  22. package/dist/cjs/kup-iframe.cjs.entry.js +4 -5
  23. package/dist/cjs/kup-image-list.cjs.entry.js +10 -12
  24. package/dist/cjs/kup-lazy.cjs.entry.js +4 -5
  25. package/dist/cjs/kup-magic-box.cjs.entry.js +5 -6
  26. package/dist/cjs/{kup-manager-02acbb37.js → kup-manager-7c514a30.js} +1400 -369
  27. package/dist/cjs/kup-nav-bar.cjs.entry.js +4 -5
  28. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  29. package/dist/cjs/kup-photo-frame.cjs.entry.js +4 -5
  30. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  31. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +6 -7
  33. package/dist/cjs/loader.cjs.js +3 -3
  34. package/dist/collection/assets/dashboard.js +48 -0
  35. package/dist/collection/assets/family-tree.js +236 -19
  36. package/dist/collection/assets/index.js +4 -0
  37. package/dist/collection/assets/kupinteract.js +68 -0
  38. package/dist/collection/collection-manifest.json +5 -5
  39. package/dist/collection/components/kup-dashboard/kup-dashboard.css +7 -0
  40. package/dist/collection/components/kup-dashboard/kup-dashboard.js +67 -7
  41. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +42 -30
  42. package/dist/collection/components/kup-echart/kup-echart.js +9 -9
  43. package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +3 -1
  44. package/dist/collection/components/kup-family-tree/kup-family-tree.css +79 -9
  45. package/dist/collection/components/kup-family-tree/kup-family-tree.js +253 -65
  46. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +1 -0
  47. package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
  48. package/dist/collection/f-components/f-text-field/f-text-field.js +9 -1
  49. package/dist/collection/managers/kup-data/kup-data-cell-helper.js +48 -15
  50. package/dist/collection/managers/kup-data/kup-data.js +5 -5
  51. package/dist/collection/managers/kup-interact/kup-interact.js +3 -5
  52. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +2 -0
  53. package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +131 -45
  54. package/dist/collection/utils/filters/filters-rows.js +4 -23
  55. package/dist/collection/utils/filters/filters-tree-items.js +2 -1
  56. package/dist/esm/{f-button-fd44ef70.js → f-button-cd948e50.js} +2 -2
  57. package/dist/esm/{f-cell-7b159a22.js → f-cell-474dd282.js} +6 -8
  58. package/dist/esm/{f-checkbox-c51c4a75.js → f-checkbox-e06cf07b.js} +1 -1
  59. package/dist/esm/{f-chip-c2e4c522.js → f-chip-d6f2eb94.js} +3 -3
  60. package/dist/esm/{f-image-2ab4b9aa.js → f-image-914a03ef.js} +2 -2
  61. package/dist/esm/{f-paginator-utils-ef537d82.js → f-paginator-utils-a4a52732.js} +44 -366
  62. package/dist/esm/{f-text-field-41c575eb.js → f-text-field-76341fe3.js} +11 -3
  63. package/dist/esm/{index-ad6ab214.js → index-e41330a5.js} +9 -4
  64. package/dist/esm/ketchup.js +3 -3
  65. package/dist/esm/kup-accordion.entry.js +3 -4
  66. package/dist/esm/kup-autocomplete_25.entry.js +17 -12
  67. package/dist/esm/kup-box.entry.js +9 -11
  68. package/dist/esm/kup-calendar.entry.js +5 -7
  69. package/dist/esm/kup-cell.entry.js +7 -9
  70. package/dist/esm/kup-dash-list.entry.js +2 -4
  71. package/dist/esm/kup-dash_2.entry.js +2 -3
  72. package/dist/esm/kup-dashboard.entry.js +74 -15
  73. package/dist/esm/kup-drawer.entry.js +2 -3
  74. package/dist/esm/kup-echart.entry.js +11 -13
  75. package/dist/esm/kup-family-tree.entry.js +138 -62
  76. package/dist/esm/kup-form.entry.js +7 -9
  77. package/dist/esm/kup-iframe.entry.js +2 -3
  78. package/dist/esm/kup-image-list.entry.js +8 -10
  79. package/dist/esm/kup-lazy.entry.js +2 -3
  80. package/dist/esm/kup-magic-box.entry.js +3 -4
  81. package/dist/esm/{kup-manager-22a475e6.js → kup-manager-86f440c7.js} +1379 -370
  82. package/dist/esm/kup-nav-bar.entry.js +2 -3
  83. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  84. package/dist/esm/kup-photo-frame.entry.js +2 -3
  85. package/dist/esm/kup-probe.entry.js +2 -2
  86. package/dist/esm/kup-qlik.entry.js +2 -2
  87. package/dist/esm/kup-snackbar.entry.js +4 -5
  88. package/dist/esm/loader.js +3 -3
  89. package/dist/ketchup/ketchup.esm.js +1 -1
  90. package/dist/ketchup/p-00e1133d.entry.js +9 -0
  91. package/dist/ketchup/p-066f344a.entry.js +1 -0
  92. package/dist/ketchup/p-0c6e0647.entry.js +1 -0
  93. package/dist/ketchup/p-151f7c17.entry.js +27 -0
  94. package/dist/ketchup/p-1e9c03b0.entry.js +1 -0
  95. package/dist/ketchup/{p-fc2b1229.js → p-21ea11cb.js} +3 -3
  96. package/dist/ketchup/{p-1959f835.entry.js → p-2f4e6c50.entry.js} +1 -1
  97. package/dist/ketchup/p-3586f59c.js +1 -0
  98. package/dist/ketchup/p-359fd90d.entry.js +1 -0
  99. package/dist/ketchup/{p-38d7584e.js → p-389fd0bf.js} +1 -1
  100. package/dist/ketchup/{p-cd5cfa7c.js → p-5552f156.js} +1 -1
  101. package/dist/ketchup/{p-264b1b19.entry.js → p-77aff9c1.entry.js} +1 -1
  102. package/dist/ketchup/{p-e9366aaf.entry.js → p-7cfdf53c.entry.js} +4 -4
  103. package/dist/ketchup/p-853a5178.entry.js +1 -0
  104. package/dist/ketchup/{p-edae3076.js → p-8673bd4e.js} +1 -1
  105. package/dist/ketchup/p-8b55b786.entry.js +1 -0
  106. package/dist/ketchup/p-95f5834b.entry.js +1 -0
  107. package/dist/ketchup/p-a2c595c4.js +1 -0
  108. package/dist/ketchup/p-ae91f27e.entry.js +1 -0
  109. package/dist/ketchup/{p-928c5c36.js → p-af664379.js} +1 -1
  110. package/dist/ketchup/p-b0b3989b.js +2 -0
  111. package/dist/ketchup/p-b3b65a61.entry.js +1 -0
  112. package/dist/ketchup/p-bc306a53.entry.js +1 -0
  113. package/dist/ketchup/{p-42080355.entry.js → p-c3783b77.entry.js} +1 -1
  114. package/dist/ketchup/{p-dc62a30f.js → p-cd4fc3fb.js} +1 -1
  115. package/dist/ketchup/p-cee76b14.entry.js +1 -0
  116. package/dist/ketchup/p-cfaea29b.entry.js +1 -0
  117. package/dist/ketchup/p-d2f51e7b.entry.js +1 -0
  118. package/dist/ketchup/p-df8e6a4d.entry.js +1 -0
  119. package/dist/ketchup/p-e60a1170.entry.js +1 -0
  120. package/dist/ketchup/p-e9a1ba04.entry.js +1 -0
  121. package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +6 -1
  122. package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +7 -3
  123. package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +26 -5
  124. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +1 -0
  125. package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
  126. package/dist/types/components.d.ts +49 -7
  127. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
  128. package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +13 -6
  129. package/dist/types/managers/kup-data/kup-data.d.ts +2 -1
  130. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +9 -1
  131. package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +7 -5
  132. package/dist/types/utils/filters/filters-rows.d.ts +0 -2
  133. package/package.json +2 -2
  134. package/dist/cjs/cell-utils-fe64a28c.js +0 -168
  135. package/dist/cjs/utils-4b208b48.js +0 -447
  136. package/dist/esm/cell-utils-cb5d4149.js +0 -160
  137. package/dist/esm/utils-2c1f4122.js +0 -428
  138. package/dist/ketchup/p-06c6cc68.js +0 -1
  139. package/dist/ketchup/p-0dacd4bc.entry.js +0 -1
  140. package/dist/ketchup/p-1c44dc62.entry.js +0 -1
  141. package/dist/ketchup/p-4bc9f98b.entry.js +0 -1
  142. package/dist/ketchup/p-578583db.entry.js +0 -1
  143. package/dist/ketchup/p-5866d507.entry.js +0 -1
  144. package/dist/ketchup/p-61059e9d.entry.js +0 -9
  145. package/dist/ketchup/p-664be494.entry.js +0 -1
  146. package/dist/ketchup/p-67cd575d.entry.js +0 -1
  147. package/dist/ketchup/p-682a367a.js +0 -1
  148. package/dist/ketchup/p-6ccf7eb2.entry.js +0 -1
  149. package/dist/ketchup/p-7230ab97.entry.js +0 -1
  150. package/dist/ketchup/p-752b4cef.entry.js +0 -1
  151. package/dist/ketchup/p-7de3e7ac.entry.js +0 -1
  152. package/dist/ketchup/p-9b36497d.entry.js +0 -1
  153. package/dist/ketchup/p-b982d137.entry.js +0 -1
  154. package/dist/ketchup/p-c0219e5e.js +0 -1
  155. package/dist/ketchup/p-c55fd0a7.entry.js +0 -1
  156. package/dist/ketchup/p-d154b3a0.entry.js +0 -1
  157. package/dist/ketchup/p-d2affb6f.entry.js +0 -27
  158. package/dist/ketchup/p-d3b542b3.js +0 -2
  159. package/dist/ketchup/p-d6c12c6c.js +0 -1
  160. package/dist/ketchup/p-da0eab60.entry.js +0 -1
@@ -9,10 +9,11 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
- var _KupFamilyTree_instances, _KupFamilyTree_clickTimeout, _KupFamilyTree_hold, _KupFamilyTree_currentPanX, _KupFamilyTree_currentPanY, _KupFamilyTree_interactableTouch, _KupFamilyTree_kupManager, _KupFamilyTree_moveCb, _KupFamilyTree_wrapperEl, _KupFamilyTree_buildChildLine, _KupFamilyTree_buildNode, _KupFamilyTree_buildNodes, _KupFamilyTree_createTree, _KupFamilyTree_startPanning, _KupFamilyTree_getEventPath, _KupFamilyTree_getEventDetails, _KupFamilyTree_clickHandler, _KupFamilyTree_contextMenuHandler, _KupFamilyTree_dblClickHandler, _KupFamilyTree_didLoadInteractables, _KupFamilyTree_zoomTree, _KupFamilyTree_autofit;
12
+ var _KupFamilyTree_instances, _KupFamilyTree_clickTimeout, _KupFamilyTree_hold, _KupFamilyTree_currentPanX, _KupFamilyTree_currentPanY, _KupFamilyTree_interactableTouch, _KupFamilyTree_kupManager, _KupFamilyTree_moveCb, _KupFamilyTree_shouldAutofit, _KupFamilyTree_wrapperEl, _KupFamilyTree_buildChildLine, _KupFamilyTree_buildNode, _KupFamilyTree_buildNodeLayout, _KupFamilyTree_buildNodeLayout1, _KupFamilyTree_buildNodeLayout2, _KupFamilyTree_buildNodes, _KupFamilyTree_createTree, _KupFamilyTree_isBoxLayout, _KupFamilyTree_startPanning, _KupFamilyTree_getEventPath, _KupFamilyTree_getEventDetails, _KupFamilyTree_clickHandler, _KupFamilyTree_contextMenuHandler, _KupFamilyTree_dblClickHandler, _KupFamilyTree_didLoadInteractables, _KupFamilyTree_zoomTree;
13
13
  import { Component, Element, Event, forceUpdate, h, Host, Method, Prop, } from '@stencil/core';
14
14
  import { FButton } from '../../f-components/f-button/f-button';
15
15
  import { FButtonStyling, } from '../../f-components/f-button/f-button-declarations';
16
+ import { FImage } from '../../f-components/f-image/f-image';
16
17
  import { KupPointerEventTypes } from '../../managers/kup-interact/kup-interact-declarations';
17
18
  import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
18
19
  import { kupManagerInstance } from '../../managers/kup-manager/kup-manager';
@@ -26,10 +27,15 @@ export class KupFamilyTree {
26
27
  /* P r o p s */
27
28
  /*-------------------------------------------------*/
28
29
  /**
29
- * The component's initial render will fit the container.
30
+ * The component will autofit everytime a node is expanded.
30
31
  * @default true
31
32
  */
32
- this.autofit = true;
33
+ this.autofitOnExpand = true;
34
+ /**
35
+ * The component's initial render will fit the container by invoking the runAutofit method.
36
+ * @default true
37
+ */
38
+ this.autofitOnLoad = true;
33
39
  /**
34
40
  * Nodes can be expanded/collapsed.
35
41
  * @default true
@@ -51,6 +57,11 @@ export class KupFamilyTree {
51
57
  * @default null
52
58
  */
53
59
  this.layout = null;
60
+ /**
61
+ * Child nodes that have no children are arranged vertically.
62
+ * @default false
63
+ */
64
+ this.stackedLeaves = false;
54
65
  /*-------------------------------------------------*/
55
66
  /* I n t e r n a l V a r i a b l e s */
56
67
  /*-------------------------------------------------*/
@@ -68,11 +79,26 @@ export class KupFamilyTree {
68
79
  __classPrivateFieldSet(this, _KupFamilyTree_currentPanX, e.clientX, "f");
69
80
  __classPrivateFieldSet(this, _KupFamilyTree_currentPanY, e.clientY, "f");
70
81
  });
82
+ _KupFamilyTree_shouldAutofit.set(this, false);
71
83
  _KupFamilyTree_wrapperEl.set(this, null);
72
84
  }
73
85
  /*-------------------------------------------------*/
74
86
  /* P u b l i c M e t h o d s */
75
87
  /*-------------------------------------------------*/
88
+ /**
89
+ * Collapses all nodes.
90
+ */
91
+ async collapseAll(nodes = this.data.rows) {
92
+ __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").data.node.setProperties(nodes, { isExpanded: false }, true);
93
+ this.refresh();
94
+ }
95
+ /**
96
+ * Expands all nodes.
97
+ */
98
+ async expandAll(nodes = this.data.rows) {
99
+ __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").data.node.setProperties(nodes, { isExpanded: true }, true);
100
+ this.refresh();
101
+ }
76
102
  /**
77
103
  * Used to retrieve component's props values.
78
104
  * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
@@ -87,6 +113,35 @@ export class KupFamilyTree {
87
113
  async refresh() {
88
114
  forceUpdate(this);
89
115
  }
116
+ /**
117
+ * This method causes the component to autofit its container's width.
118
+ */
119
+ async runAutofit() {
120
+ const parentWidth = __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").clientWidth;
121
+ const childWidth = __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").children[0].clientWidth;
122
+ const multiplierStep = 0.01;
123
+ const minWidth = (85 / 100) * parentWidth;
124
+ const maxWidth = (95 / 100) * parentWidth;
125
+ let multiplier = 1;
126
+ let tooManyAttempts = 2000;
127
+ let tempWidth = childWidth;
128
+ while ((tempWidth < minWidth || tempWidth > maxWidth) &&
129
+ tooManyAttempts > 0 &&
130
+ multiplier > multiplierStep) {
131
+ tooManyAttempts--;
132
+ if (tempWidth < minWidth) {
133
+ multiplier = multiplier + multiplierStep;
134
+ }
135
+ else if (tempWidth > maxWidth) {
136
+ multiplier = multiplier - multiplierStep;
137
+ }
138
+ else {
139
+ tooManyAttempts = 0;
140
+ }
141
+ tempWidth = childWidth * multiplier;
142
+ }
143
+ __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.setProperty('--kup_familytree_scale', multiplier <= 1 ? multiplier.toFixed(2) : '1');
144
+ }
90
145
  /**
91
146
  * Sets the props to the component.
92
147
  * @param {GenericObject} props - Object containing props that will be set to the component.
@@ -104,12 +159,8 @@ export class KupFamilyTree {
104
159
  }
105
160
  componentDidLoad() {
106
161
  __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_didLoadInteractables).call(this);
107
- if (this.autofit) {
108
- const parentWidth = __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").clientWidth;
109
- const childWidth = __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").children[0].clientWidth;
110
- if (childWidth > parentWidth) {
111
- __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_autofit).call(this, parentWidth, childWidth);
112
- }
162
+ if (this.autofitOnLoad) {
163
+ this.runAutofit();
113
164
  }
114
165
  __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logLoad(this, true);
115
166
  }
@@ -117,6 +168,10 @@ export class KupFamilyTree {
117
168
  __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logRender(this, false);
118
169
  }
119
170
  componentDidRender() {
171
+ if (__classPrivateFieldGet(this, _KupFamilyTree_shouldAutofit, "f")) {
172
+ __classPrivateFieldSet(this, _KupFamilyTree_shouldAutofit, false, "f");
173
+ this.runAutofit();
174
+ }
120
175
  __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logRender(this, true);
121
176
  }
122
177
  render() {
@@ -124,7 +179,6 @@ export class KupFamilyTree {
124
179
  e.preventDefault();
125
180
  __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_startPanning).call(this, e);
126
181
  }, onWheel: (e) => {
127
- e.preventDefault();
128
182
  __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_zoomTree).call(this, e);
129
183
  } },
130
184
  h("style", null, __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").theme.setKupStyle(this.rootElement)),
@@ -143,7 +197,7 @@ export class KupFamilyTree {
143
197
  "$": ["kup-family-tree.css"]
144
198
  }; }
145
199
  static get properties() { return {
146
- "autofit": {
200
+ "autofitOnExpand": {
147
201
  "type": "boolean",
148
202
  "mutable": false,
149
203
  "complexType": {
@@ -158,9 +212,30 @@ export class KupFamilyTree {
158
212
  "name": "default",
159
213
  "text": "true"
160
214
  }],
161
- "text": "The component's initial render will fit the container."
215
+ "text": "The component will autofit everytime a node is expanded."
162
216
  },
163
- "attribute": "autofit",
217
+ "attribute": "autofit-on-expand",
218
+ "reflect": false,
219
+ "defaultValue": "true"
220
+ },
221
+ "autofitOnLoad": {
222
+ "type": "boolean",
223
+ "mutable": false,
224
+ "complexType": {
225
+ "original": "boolean",
226
+ "resolved": "boolean",
227
+ "references": {}
228
+ },
229
+ "required": false,
230
+ "optional": false,
231
+ "docs": {
232
+ "tags": [{
233
+ "name": "default",
234
+ "text": "true"
235
+ }],
236
+ "text": "The component's initial render will fit the container by invoking the runAutofit method."
237
+ },
238
+ "attribute": "autofit-on-load",
164
239
  "reflect": false,
165
240
  "defaultValue": "true"
166
241
  },
@@ -234,15 +309,15 @@ export class KupFamilyTree {
234
309
  "defaultValue": "null"
235
310
  },
236
311
  "layout": {
237
- "type": "unknown",
312
+ "type": "number",
238
313
  "mutable": false,
239
314
  "complexType": {
240
- "original": "KupBoxLayout",
241
- "resolved": "KupBoxLayout",
315
+ "original": "KupFamilyTreeLayout",
316
+ "resolved": "KupBoxLayout | number",
242
317
  "references": {
243
- "KupBoxLayout": {
318
+ "KupFamilyTreeLayout": {
244
319
  "location": "import",
245
- "path": "../kup-box/kup-box-declarations"
320
+ "path": "./kup-family-tree-declarations"
246
321
  }
247
322
  }
248
323
  },
@@ -255,7 +330,30 @@ export class KupFamilyTree {
255
330
  }],
256
331
  "text": "Layout of the boxes."
257
332
  },
333
+ "attribute": "layout",
334
+ "reflect": false,
258
335
  "defaultValue": "null"
336
+ },
337
+ "stackedLeaves": {
338
+ "type": "boolean",
339
+ "mutable": false,
340
+ "complexType": {
341
+ "original": "boolean",
342
+ "resolved": "boolean",
343
+ "references": {}
344
+ },
345
+ "required": false,
346
+ "optional": false,
347
+ "docs": {
348
+ "tags": [{
349
+ "name": "default",
350
+ "text": "false"
351
+ }],
352
+ "text": "Child nodes that have no children are arranged vertically."
353
+ },
354
+ "attribute": "stacked-leaves",
355
+ "reflect": false,
356
+ "defaultValue": "false"
259
357
  }
260
358
  }; }
261
359
  static get events() { return [{
@@ -320,6 +418,52 @@ export class KupFamilyTree {
320
418
  }
321
419
  }]; }
322
420
  static get methods() { return {
421
+ "collapseAll": {
422
+ "complexType": {
423
+ "signature": "(nodes?: KupFamilyTreeNode[]) => Promise<void>",
424
+ "parameters": [{
425
+ "tags": [],
426
+ "text": ""
427
+ }],
428
+ "references": {
429
+ "Promise": {
430
+ "location": "global"
431
+ },
432
+ "KupFamilyTreeNode": {
433
+ "location": "import",
434
+ "path": "./kup-family-tree-declarations"
435
+ }
436
+ },
437
+ "return": "Promise<void>"
438
+ },
439
+ "docs": {
440
+ "text": "Collapses all nodes.",
441
+ "tags": []
442
+ }
443
+ },
444
+ "expandAll": {
445
+ "complexType": {
446
+ "signature": "(nodes?: KupFamilyTreeNode[]) => Promise<void>",
447
+ "parameters": [{
448
+ "tags": [],
449
+ "text": ""
450
+ }],
451
+ "references": {
452
+ "Promise": {
453
+ "location": "global"
454
+ },
455
+ "KupFamilyTreeNode": {
456
+ "location": "import",
457
+ "path": "./kup-family-tree-declarations"
458
+ }
459
+ },
460
+ "return": "Promise<void>"
461
+ },
462
+ "docs": {
463
+ "text": "Expands all nodes.",
464
+ "tags": []
465
+ }
466
+ },
323
467
  "getProps": {
324
468
  "complexType": {
325
469
  "signature": "(descriptions?: boolean) => Promise<GenericObject>",
@@ -368,6 +512,22 @@ export class KupFamilyTree {
368
512
  "tags": []
369
513
  }
370
514
  },
515
+ "runAutofit": {
516
+ "complexType": {
517
+ "signature": "() => Promise<void>",
518
+ "parameters": [],
519
+ "references": {
520
+ "Promise": {
521
+ "location": "global"
522
+ }
523
+ },
524
+ "return": "Promise<void>"
525
+ },
526
+ "docs": {
527
+ "text": "This method causes the component to autofit its container's width.",
528
+ "tags": []
529
+ }
530
+ },
371
531
  "setProps": {
372
532
  "complexType": {
373
533
  "signature": "(props: GenericObject) => Promise<void>",
@@ -400,7 +560,7 @@ export class KupFamilyTree {
400
560
  }; }
401
561
  static get elementRef() { return "rootElement"; }
402
562
  }
403
- _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap(), _KupFamilyTree_currentPanX = new WeakMap(), _KupFamilyTree_currentPanY = new WeakMap(), _KupFamilyTree_interactableTouch = new WeakMap(), _KupFamilyTree_kupManager = new WeakMap(), _KupFamilyTree_moveCb = new WeakMap(), _KupFamilyTree_wrapperEl = new WeakMap(), _KupFamilyTree_instances = new WeakSet(), _KupFamilyTree_buildChildLine = function _KupFamilyTree_buildChildLine(first, last, alone, moreTwo) {
563
+ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap(), _KupFamilyTree_currentPanX = new WeakMap(), _KupFamilyTree_currentPanY = new WeakMap(), _KupFamilyTree_interactableTouch = new WeakMap(), _KupFamilyTree_kupManager = new WeakMap(), _KupFamilyTree_moveCb = new WeakMap(), _KupFamilyTree_shouldAutofit = new WeakMap(), _KupFamilyTree_wrapperEl = new WeakMap(), _KupFamilyTree_instances = new WeakSet(), _KupFamilyTree_buildChildLine = function _KupFamilyTree_buildChildLine(first, last, alone, moreTwo) {
404
564
  const content = [];
405
565
  content.push(h("td", { class: {
406
566
  'family-tree__line': true,
@@ -435,6 +595,9 @@ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap()
435
595
  }
436
596
  });
437
597
  }
598
+ const stacked = this.stackedLeaves &&
599
+ children &&
600
+ children.every((c) => !c.children || c.children.length == 0);
438
601
  const span1 = children ? children.length * 2 : 1;
439
602
  const styleVLine = {
440
603
  'family-tree__line': true,
@@ -448,27 +611,46 @@ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap()
448
611
  ],
449
612
  rows: [{ cells: Object.assign({ '*TREECOL': node }, node.cells) }],
450
613
  };
451
- const layout = node.layout || this.layout || null;
452
- const expandButtonProp = {
614
+ const layout = node.layout || this.layout || 1;
615
+ const expandButtonProps = {
453
616
  icon: node.isExpanded ? 'remove' : 'plus',
454
- styling: FButtonStyling.OUTLINED,
617
+ shaped: true,
455
618
  slim: true,
456
- onClick: () => {
619
+ styling: FButtonStyling.OUTLINED,
620
+ title: `${__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").language.translate(KupLanguageGeneric.EXPAND)}/${__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").language.translate(KupLanguageGeneric.COLLAPSE)} (CTRL + Click)`,
621
+ onClick: (e) => {
622
+ if (e.ctrlKey && node.children && node.children.length > 0) {
623
+ if (node.isExpanded) {
624
+ this.collapseAll(node.children);
625
+ }
626
+ else {
627
+ this.expandAll(node.children);
628
+ }
629
+ }
457
630
  node.isExpanded = !node.isExpanded;
631
+ if (this.autofitOnExpand) {
632
+ __classPrivateFieldSet(this, _KupFamilyTree_shouldAutofit, true, "f");
633
+ }
458
634
  this.refresh();
459
635
  },
636
+ wrapperClass: 'family-tree__item__expand',
460
637
  };
461
638
  const box = (h("div", { class: 'family-tree__item' },
462
639
  h("div", { class: 'family-tree__item__wrapper' },
463
- h("kup-box", { class: "kup-borderless kup-paddingless", customStyle: "#kup-component { background: var(--kup_familytree_item_background_color); box-sizing: border-box; height: var(--kup_familytree_item_height); padding: 0 var(--kup_familytree_item_h_padding); } #kup-component .box-component { background: var(--kup_familytree_item_background_color); box-sizing: border-box; height: 100%;} #kup-component .f-cell__text { color: var(--kup_familytree_item_color); }", data: data, layout: layout }),
640
+ __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_isBoxLayout).call(this, layout) ? (h("kup-box", { class: "kup-borderless kup-paddingless", customStyle: "#kup-component { background: var(--kup_familytree_item_background_color); border: 2px solid var(--kup_familytree_lines_color); box-sizing: border-box; height: var(--kup_familytree_item_height); padding: 0 var(--kup_familytree_item_h_padding); } #kup-component .box-component { background: var(--kup_familytree_item_background_color); box-sizing: border-box; height: 100%;} #kup-component .f-cell__text { color: var(--kup_familytree_item_color); }", data: data, layout: layout, showSelection: false })) : (__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNodeLayout).call(this, node, layout)),
464
641
  this.collapsible &&
465
642
  node.children &&
466
- node.children.length > 0 ? (h(FButton, Object.assign({}, expandButtonProp))) : undefined)));
643
+ node.children.length > 0 ? (h(FButton, Object.assign({}, expandButtonProps))) : undefined)));
467
644
  const staffStyle = {
468
645
  ['--kup_familytree_staffchildren']: (staffChildren === null || staffChildren === void 0 ? void 0 : staffChildren.length.toString()) || '0',
469
646
  };
470
647
  //TODO: set data-cell and data-column if needed inside events
471
- return (h("table", { class: 'family-tree__node' },
648
+ return (h("table", { class: {
649
+ 'family-tree__node': true,
650
+ 'family-tree__node--stacked': this.stackedLeaves &&
651
+ !node.isStaff &&
652
+ (!node.children || node.children.length == 0),
653
+ } },
472
654
  h("tr", null,
473
655
  h("td", { "data-row": node, colSpan: span1 }, box)),
474
656
  h("tr", null,
@@ -489,18 +671,34 @@ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap()
489
671
  h("tr", null,
490
672
  h("td", { colSpan: span1 },
491
673
  h("div", { class: styleVLine }))),
492
- h("tr", null,
493
- h("td", { colSpan: span1 },
494
- h("div", { class: styleVLine }))),
495
674
  ]
496
675
  : null,
497
676
  children
498
677
  ? [
499
- h("tr", null, children.map((inode) => __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildChildLine).call(this, children.indexOf(inode) == 0, children.indexOf(inode) ==
500
- children.length - 1, children.length == 1, children.length > 2))),
501
- h("tr", null, children.map((inode) => (h("td", { colSpan: 2 }, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, inode))))),
678
+ h("tr", null, stacked ? (h("td", { colSpan: span1 },
679
+ h("div", { class: styleVLine }))) : (children.map((inode) => __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildChildLine).call(this, children.indexOf(inode) == 0, children.indexOf(inode) ==
680
+ children.length - 1, children.length == 1, children.length > 2)))),
681
+ h("tr", null, stacked ? (h("td", { colSpan: span1 }, children.map((inode) => __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, inode)))) : (children.map((inode) => (h("td", { colSpan: 2 }, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, inode)))))),
502
682
  ]
503
683
  : undefined));
684
+ }, _KupFamilyTree_buildNodeLayout = function _KupFamilyTree_buildNodeLayout(node, layout) {
685
+ switch (layout) {
686
+ case 2:
687
+ return __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNodeLayout2).call(this, node);
688
+ default:
689
+ return __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNodeLayout1).call(this, node);
690
+ }
691
+ }, _KupFamilyTree_buildNodeLayout1 = function _KupFamilyTree_buildNodeLayout1(node) {
692
+ return (h("div", { class: `family-tree__item__layout family-tree__item__layout--1` },
693
+ h("div", { class: 'family-tree__item__layout__text__title' }, node.value)));
694
+ }, _KupFamilyTree_buildNodeLayout2 = function _KupFamilyTree_buildNodeLayout2(node) {
695
+ return (h("div", { class: `family-tree__item__layout family-tree__item__layout--2` },
696
+ h("div", { class: 'family-tree__item__layout__color' }),
697
+ h("div", { class: 'family-tree__item__layout__image' },
698
+ h(FImage, { resource: node.icon, sizeX: "48px", sizeY: "48px" })),
699
+ h("div", { class: 'family-tree__item__layout__text' },
700
+ h("div", { class: 'family-tree__item__layout__text__title' }, node.value),
701
+ node.title ? (h("div", { class: 'family-tree__item__layout__text__subtitle' }, node.title)) : null)));
504
702
  }, _KupFamilyTree_buildNodes = function _KupFamilyTree_buildNodes(nodes) {
505
703
  return nodes.map((node) => __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, node));
506
704
  }, _KupFamilyTree_createTree = function _KupFamilyTree_createTree() {
@@ -508,12 +706,17 @@ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap()
508
706
  return (h("div", { class: "family-tree", onContextMenu: (e) => {
509
707
  e.preventDefault();
510
708
  }, ref: (el) => (__classPrivateFieldSet(this, _KupFamilyTree_wrapperEl, el, "f")) }, emptyData ? (h("div", null, __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").language.translate(KupLanguageGeneric.EMPTY_DATA))) : (__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNodes).call(this, this.data.rows))));
709
+ }, _KupFamilyTree_isBoxLayout = function _KupFamilyTree_isBoxLayout(layout) {
710
+ const tmp = layout;
711
+ return tmp && tmp.sections && tmp.sections.length > 0;
511
712
  }, _KupFamilyTree_startPanning = function _KupFamilyTree_startPanning(e) {
512
713
  __classPrivateFieldSet(this, _KupFamilyTree_currentPanX, e.clientX, "f");
513
714
  __classPrivateFieldSet(this, _KupFamilyTree_currentPanY, e.clientY, "f");
715
+ __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").classList.add('family-tree--dragging');
514
716
  const endPanning = () => {
515
717
  document.removeEventListener('pointermove', __classPrivateFieldGet(this, _KupFamilyTree_moveCb, "f"));
516
718
  document.removeEventListener('pointerup', endPanning);
719
+ __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").classList.remove('family-tree--dragging');
517
720
  };
518
721
  document.addEventListener('pointermove', __classPrivateFieldGet(this, _KupFamilyTree_moveCb, "f"));
519
722
  document.addEventListener('pointerup', endPanning);
@@ -529,16 +732,20 @@ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap()
529
732
  }
530
733
  return path;
531
734
  }, _KupFamilyTree_getEventDetails = function _KupFamilyTree_getEventDetails(path, e) {
735
+ let expandButton;
532
736
  let td;
533
737
  if (path) {
534
738
  for (let i = path.length - 1; i >= 0; i--) {
535
- let p = path[i];
536
- if (!p.tagName) {
739
+ const el = path[i];
740
+ if (!el.tagName) {
537
741
  continue;
538
742
  }
539
- switch (p.tagName.toUpperCase()) {
743
+ if (el.classList.contains('family-tree__item__expand')) {
744
+ expandButton = el;
745
+ }
746
+ switch (el.tagName.toUpperCase()) {
540
747
  case 'TD': {
541
- td = p;
748
+ td = el;
542
749
  break;
543
750
  }
544
751
  }
@@ -553,6 +760,7 @@ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap()
553
760
  return {
554
761
  cell: cell ? cell : null,
555
762
  column: column ? column : null,
763
+ expandButton: expandButton ? expandButton : null,
556
764
  originalEvent: e,
557
765
  row: row ? row : null,
558
766
  td: td ? td : null,
@@ -632,35 +840,15 @@ _KupFamilyTree_clickTimeout = new WeakMap(), _KupFamilyTree_hold = new WeakMap()
632
840
  __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.TAP, tapCb);
633
841
  __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.DOUBLETAP, doubletapCb);
634
842
  __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.HOLD, holdCb);
635
- }, _KupFamilyTree_zoomTree = function _KupFamilyTree_zoomTree(event) {
636
- const current = parseFloat(__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.getPropertyValue('--kup_familytree_scale')) || 1;
637
- const delta = 0.05;
638
- let value = event.deltaY > 0 ? current - delta : current + delta;
639
- if (value < delta) {
640
- value = delta;
641
- }
642
- __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.setProperty('--kup_familytree_scale', value.toFixed(2));
643
- }, _KupFamilyTree_autofit = function _KupFamilyTree_autofit(parentWidth, childWidth) {
644
- const multiplierStep = 0.01;
645
- const minWidth = (85 / 100) * parentWidth;
646
- const maxWidth = (95 / 100) * parentWidth;
647
- let multiplier = 1;
648
- let tooManyAttempts = 2000;
649
- let tempWidth = childWidth;
650
- while ((tempWidth < minWidth || tempWidth > maxWidth) &&
651
- tooManyAttempts > 0 &&
652
- multiplier > multiplierStep) {
653
- tooManyAttempts--;
654
- if (tempWidth < minWidth) {
655
- multiplier = multiplier + multiplierStep;
656
- }
657
- else if (tempWidth > maxWidth) {
658
- multiplier = multiplier - multiplierStep;
659
- }
660
- else {
661
- tooManyAttempts = 0;
843
+ }, _KupFamilyTree_zoomTree = function _KupFamilyTree_zoomTree(e) {
844
+ if (e.ctrlKey) {
845
+ e.preventDefault();
846
+ const currentScale = parseFloat(__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.getPropertyValue('--kup_familytree_scale')) || 1;
847
+ const delta = 0.05;
848
+ let value = e.deltaY > 0 ? currentScale - delta : currentScale + delta;
849
+ if (value < delta) {
850
+ value = delta;
662
851
  }
663
- tempWidth = childWidth * multiplier;
852
+ __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.setProperty('--kup_familytree_scale', value.toFixed(2));
664
853
  }
665
- __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.setProperty('--kup_familytree_scale', multiplier.toFixed(2));
666
854
  };
@@ -5,6 +5,7 @@
5
5
  export var KupTextFieldProps;
6
6
  (function (KupTextFieldProps) {
7
7
  KupTextFieldProps["customStyle"] = "Custom style of the component.";
8
+ KupTextFieldProps["decimals"] = "Number of decimals (should be used when inputType is number).";
8
9
  KupTextFieldProps["disabled"] = "When set to true, the component is disabled.";
9
10
  KupTextFieldProps["emitSubmitEventOnEnter"] = "When the text field is part of the autocomplete component and the list is opened, enter key selects the item and doesn't submit.";
10
11
  KupTextFieldProps["fullWidth"] = "When set to true, the component will be rendered at full width.";
@@ -25,6 +25,11 @@ export class KupTextField {
25
25
  * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
26
26
  */
27
27
  this.customStyle = '';
28
+ /**
29
+ * Number of decimals (should be used when inputType is number).
30
+ * @default null
31
+ */
32
+ this.decimals = null;
28
33
  /**
29
34
  * When set to true, the component is disabled.
30
35
  * @default false
@@ -291,6 +296,7 @@ export class KupTextField {
291
296
  danger: this.rootElement.classList.contains('kup-danger')
292
297
  ? true
293
298
  : false,
299
+ decimals: this.decimals,
294
300
  disabled: this.disabled,
295
301
  fullHeight: this.rootElement.classList.contains('kup-full-height')
296
302
  ? true
@@ -380,6 +386,27 @@ export class KupTextField {
380
386
  "reflect": false,
381
387
  "defaultValue": "''"
382
388
  },
389
+ "decimals": {
390
+ "type": "number",
391
+ "mutable": false,
392
+ "complexType": {
393
+ "original": "number",
394
+ "resolved": "number",
395
+ "references": {}
396
+ },
397
+ "required": false,
398
+ "optional": false,
399
+ "docs": {
400
+ "tags": [{
401
+ "name": "default",
402
+ "text": "null"
403
+ }],
404
+ "text": "Number of decimals (should be used when inputType is number)."
405
+ },
406
+ "attribute": "decimals",
407
+ "reflect": false,
408
+ "defaultValue": "null"
409
+ },
383
410
  "disabled": {
384
411
  "type": "boolean",
385
412
  "mutable": false,
@@ -55,7 +55,15 @@ function setContent(props) {
55
55
  props.maxLength)) : undefined,
56
56
  !props.trailingIcon ? iconEl : undefined,
57
57
  props.textArea ? (h("span", { class: "mdc-text-field__resizer" },
58
- h("textarea", { class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, maxlength: props.maxLength, value: props.value, onBlur: props.onBlur, onClick: props.onClick, onChange: props.onChange, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown }))) : (h("input", { type: props.inputType ? props.inputType : 'text', step: props.step, min: props.min, max: props.max, name: props.name, class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, placeholder: props.fullWidth ? props.label : undefined, maxlength: props.maxLength, value: props.value, onBlur: props.onBlur, onClick: props.onClick, onChange: props.onChange, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown })),
58
+ h("textarea", { class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, maxlength: props.maxLength, value: props.value, onBlur: props.onBlur, onClick: props.onClick, onChange: props.onChange, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown }))) : (h("input", { type: props.inputType ? props.inputType : 'text', step: props.step, min: props.min, max: props.max, name: props.name, class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, placeholder: props.fullWidth ? props.label : undefined, maxlength: props.maxLength, value: props.value, onBlur: props.onBlur, onChange: (e) => {
59
+ if (props.decimals !== null &&
60
+ props.inputType === 'number') {
61
+ e.target.value = parseFloat(e.target.value).toFixed(props.decimals);
62
+ }
63
+ if (props.onChange) {
64
+ props.onChange(e);
65
+ }
66
+ }, onClick: props.onClick, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown })),
59
67
  props.isClearable ? (h("span", { class: `mdc-text-field__icon kup-icon ${KupThemeIconValues.CLEAR.replace('--', '')}`, onClick: props.onClearIconClick })) : undefined,
60
68
  props.trailingIcon ? iconEl : undefined,
61
69
  !props.fullWidth && !isOutlined ? labelEl : undefined,