@sme.up/ketchup 6.1.0-SNAPSHOT → 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.
- package/dist/cjs/{f-button-ac179257.js → f-button-94cb5f35.js} +4 -4
- package/dist/cjs/f-cell-76830a0d.js +416 -0
- package/dist/cjs/f-checkbox-cd977193.js +29 -0
- package/dist/cjs/{f-chip-b00897d7.js → f-chip-68d45fd3.js} +3 -3
- package/dist/cjs/{f-image-89f25556.js → f-image-0e71df7e.js} +2 -2
- package/dist/cjs/{f-paginator-utils-8fa501b3.js → f-paginator-utils-46689c0a.js} +80 -403
- package/dist/cjs/{f-text-field-e1e45ade.js → f-text-field-b4229cef.js} +11 -3
- package/dist/cjs/{index-eb556444.js → index-31125378.js} +15 -8
- package/dist/cjs/ketchup.cjs.js +3 -3
- package/dist/cjs/kup-accordion.cjs.entry.js +5 -6
- package/dist/cjs/kup-autocomplete_25.cjs.entry.js +331 -299
- package/dist/cjs/kup-box.cjs.entry.js +1304 -0
- package/dist/cjs/kup-calendar.cjs.entry.js +9 -11
- package/dist/cjs/kup-cell.cjs.entry.js +10 -11
- package/dist/cjs/kup-dash-list.cjs.entry.js +5 -7
- package/dist/cjs/kup-dash_2.cjs.entry.js +5 -9
- package/dist/cjs/kup-dashboard.cjs.entry.js +438 -0
- package/dist/cjs/kup-drawer.cjs.entry.js +5 -6
- package/dist/cjs/{kup-box_2.cjs.entry.js → kup-echart.cjs.entry.js} +66 -1353
- package/dist/cjs/kup-family-tree.cjs.entry.js +486 -0
- package/dist/cjs/kup-form.cjs.entry.js +478 -0
- package/dist/cjs/kup-iframe.cjs.entry.js +4 -5
- package/dist/cjs/kup-image-list.cjs.entry.js +73 -13
- package/dist/cjs/kup-lazy.cjs.entry.js +5 -6
- package/dist/cjs/kup-magic-box.cjs.entry.js +5 -6
- package/dist/cjs/{kup-manager-7a941909.js → kup-manager-7c514a30.js} +1787 -356
- package/dist/cjs/kup-nav-bar.cjs.entry.js +4 -5
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
- package/dist/cjs/kup-photo-frame.cjs.entry.js +6 -7
- package/dist/cjs/kup-probe.cjs.entry.js +2 -2
- package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
- package/dist/cjs/kup-snackbar.cjs.entry.js +6 -7
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/assets/dashboard.js +161 -0
- package/dist/collection/assets/data-table.js +59 -0
- package/dist/collection/assets/family-tree.js +2654 -0
- package/dist/collection/assets/form.js +433 -0
- package/dist/collection/assets/grid.js +17 -0
- package/dist/collection/assets/index.js +18 -6
- package/dist/collection/assets/kupinteract.js +68 -0
- package/dist/collection/collection-manifest.json +8 -7
- package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +135 -129
- package/dist/collection/components/kup-box/kup-box.js +13 -2
- package/dist/collection/components/kup-button/kup-button.js +1 -0
- package/dist/collection/components/kup-combobox/kup-combobox.js +16 -13
- package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -0
- package/dist/collection/components/{kup-form-editor/kup-form-editor.css → kup-dashboard/kup-dashboard.css} +14 -6
- package/dist/collection/components/{kup-form-editor/kup-form-editor.js → kup-dashboard/kup-dashboard.js} +211 -152
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +42 -30
- package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
- package/dist/collection/components/kup-data-table/kup-data-table.js +7 -6
- package/dist/collection/components/kup-drawer/kup-drawer.css +5 -8
- package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +1 -0
- package/dist/collection/components/kup-echart/kup-echart.js +9 -9
- package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +14 -0
- package/dist/collection/components/kup-family-tree/kup-family-tree.css +171 -0
- package/dist/collection/components/kup-family-tree/kup-family-tree.js +854 -0
- package/dist/collection/components/kup-form/kup-form-declarations.js +25 -0
- package/dist/collection/components/kup-form/kup-form.css +99 -0
- package/dist/collection/components/kup-form/kup-form.js +647 -0
- package/dist/collection/components/kup-grid/kup-grid.js +1 -4
- package/dist/collection/components/kup-image-list/kup-image-list-state.js +9 -0
- package/dist/collection/components/kup-image-list/kup-image-list.css +0 -6
- package/dist/collection/components/kup-image-list/kup-image-list.js +113 -1
- package/dist/collection/components/kup-lazy/kup-lazy.css +13 -6
- package/dist/collection/components/kup-list/kup-list-helper.js +9 -3
- package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +13 -3
- package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +1 -1
- package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +4 -0
- package/dist/collection/components/kup-text-field/kup-text-field.js +54 -0
- package/dist/collection/components/kup-time-picker/kup-time-picker.js +0 -6
- package/dist/collection/components/kup-tree/kup-tree.js +26 -9
- package/dist/collection/f-components/f-button/f-button.js +2 -2
- package/dist/collection/f-components/f-cell/f-cell-declarations.js +5 -1
- package/dist/collection/f-components/f-cell/f-cell.js +34 -114
- package/dist/collection/f-components/f-text-field/f-text-field.js +9 -1
- package/dist/collection/managers/kup-data/kup-data-cell-helper.js +48 -15
- package/dist/collection/managers/kup-data/kup-data-node-helper.js +69 -0
- package/dist/collection/managers/kup-data/kup-data.js +114 -6
- package/dist/collection/managers/kup-interact/kup-interact.js +3 -5
- package/dist/collection/managers/kup-language/kup-language-declarations.js +11 -0
- package/dist/collection/managers/kup-objects/kup-objects.js +10 -0
- package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +2 -0
- package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +131 -45
- package/dist/collection/managers/kup-theme/kup-theme-declarations.js +20 -3
- package/dist/collection/types/GenericTypes.js +3 -2
- package/dist/collection/utils/filters/filters-rows.js +4 -23
- package/dist/collection/utils/filters/filters-tree-items.js +2 -1
- package/dist/esm/{f-button-871a544b.js → f-button-cd948e50.js} +4 -4
- package/dist/esm/{f-cell-521ef17a.js → f-cell-474dd282.js} +46 -283
- package/dist/esm/f-checkbox-e06cf07b.js +27 -0
- package/dist/esm/{f-chip-1dda722f.js → f-chip-d6f2eb94.js} +3 -3
- package/dist/esm/{f-image-c468d8ae.js → f-image-914a03ef.js} +2 -2
- package/dist/esm/{f-paginator-utils-7dff8ff0.js → f-paginator-utils-a4a52732.js} +44 -366
- package/dist/esm/{f-text-field-d6c61c73.js → f-text-field-76341fe3.js} +11 -3
- package/dist/esm/{index-baeab1ac.js → index-e41330a5.js} +15 -8
- package/dist/esm/ketchup.js +3 -3
- package/dist/esm/kup-accordion.entry.js +3 -4
- package/dist/esm/kup-autocomplete_25.entry.js +222 -190
- package/dist/esm/kup-box.entry.js +1300 -0
- package/dist/esm/kup-calendar.entry.js +5 -7
- package/dist/esm/kup-cell.entry.js +7 -8
- package/dist/esm/kup-dash-list.entry.js +2 -4
- package/dist/esm/kup-dash_2.entry.js +3 -7
- package/dist/esm/kup-dashboard.entry.js +434 -0
- package/dist/esm/kup-drawer.entry.js +3 -4
- package/dist/esm/{kup-box_2.entry.js → kup-echart.entry.js} +61 -1347
- package/dist/esm/kup-family-tree.entry.js +482 -0
- package/dist/esm/kup-form.entry.js +474 -0
- package/dist/esm/kup-iframe.entry.js +2 -3
- package/dist/esm/kup-image-list.entry.js +70 -10
- package/dist/esm/kup-lazy.entry.js +3 -4
- package/dist/esm/kup-magic-box.entry.js +3 -4
- package/dist/esm/{kup-manager-58b075b4.js → kup-manager-86f440c7.js} +1762 -357
- package/dist/esm/kup-nav-bar.entry.js +2 -3
- package/dist/esm/kup-numeric-picker.entry.js +3 -3
- package/dist/esm/kup-photo-frame.entry.js +4 -5
- package/dist/esm/kup-probe.entry.js +2 -2
- package/dist/esm/kup-qlik.entry.js +2 -2
- package/dist/esm/kup-snackbar.entry.js +4 -5
- package/dist/esm/loader.js +3 -3
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/p-00e1133d.entry.js +9 -0
- package/dist/ketchup/p-066f344a.entry.js +1 -0
- package/dist/ketchup/p-0c6e0647.entry.js +1 -0
- package/dist/ketchup/p-151f7c17.entry.js +27 -0
- package/dist/ketchup/p-1e9c03b0.entry.js +1 -0
- package/dist/ketchup/p-21ea11cb.js +30 -0
- package/dist/ketchup/{p-fac1a08b.entry.js → p-2f4e6c50.entry.js} +1 -1
- package/dist/ketchup/p-3586f59c.js +1 -0
- package/dist/ketchup/p-359fd90d.entry.js +1 -0
- package/dist/ketchup/p-389fd0bf.js +1 -0
- package/dist/ketchup/p-5552f156.js +1 -0
- package/dist/ketchup/{p-f09f2f98.entry.js → p-77aff9c1.entry.js} +1 -1
- package/dist/ketchup/p-7cfdf53c.entry.js +39 -0
- package/dist/ketchup/p-853a5178.entry.js +1 -0
- package/dist/ketchup/{p-44ec4f03.js → p-8673bd4e.js} +1 -1
- package/dist/ketchup/p-8b55b786.entry.js +1 -0
- package/dist/ketchup/p-95f5834b.entry.js +1 -0
- package/dist/ketchup/p-a2c595c4.js +1 -0
- package/dist/ketchup/p-ae91f27e.entry.js +1 -0
- package/dist/ketchup/p-af664379.js +1 -0
- package/dist/ketchup/p-b0b3989b.js +2 -0
- package/dist/ketchup/p-b3b65a61.entry.js +1 -0
- package/dist/ketchup/p-bc306a53.entry.js +1 -0
- package/dist/ketchup/{p-f71a1675.entry.js → p-c3783b77.entry.js} +1 -1
- package/dist/ketchup/{p-7eff4eee.js → p-cd4fc3fb.js} +1 -1
- package/dist/ketchup/p-cee76b14.entry.js +1 -0
- package/dist/ketchup/p-cfaea29b.entry.js +1 -0
- package/dist/ketchup/p-d2f51e7b.entry.js +1 -0
- package/dist/ketchup/p-df8e6a4d.entry.js +1 -0
- package/dist/ketchup/p-e60a1170.entry.js +1 -0
- package/dist/ketchup/p-e9a1ba04.entry.js +1 -0
- package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +1 -16
- package/dist/types/components/{kup-form-editor/kup-form-editor-declarations.d.ts → kup-dashboard/kup-dashboard-declarations.d.ts} +9 -27
- package/dist/types/components/{kup-form-editor/kup-form-editor.d.ts → kup-dashboard/kup-dashboard.d.ts} +17 -9
- package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
- package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +37 -0
- package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +82 -0
- package/dist/types/components/kup-form/kup-form-declarations.d.ts +60 -0
- package/dist/types/components/kup-form/kup-form.d.ts +63 -0
- package/dist/types/components/kup-image-list/kup-image-list-state.d.ts +6 -0
- package/dist/types/components/kup-image-list/kup-image-list.d.ts +17 -0
- package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +4 -0
- package/dist/types/components/kup-text-field/kup-text-field.d.ts +10 -0
- package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +0 -6
- package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +2 -0
- package/dist/types/components/kup-tree/kup-tree.d.ts +0 -1
- package/dist/types/components.d.ts +492 -231
- package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +4 -1
- package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +2 -0
- package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +13 -6
- package/dist/types/managers/kup-data/kup-data-declarations.d.ts +8 -0
- package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +15 -1
- package/dist/types/managers/kup-data/kup-data.d.ts +9 -2
- package/dist/types/managers/kup-language/kup-language-declarations.d.ts +11 -1
- package/dist/types/managers/kup-objects/kup-objects.d.ts +6 -0
- package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +9 -1
- package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +7 -5
- package/dist/types/types/GenericTypes.d.ts +3 -2
- package/dist/types/utils/filters/filters-rows.d.ts +0 -2
- package/package.json +2 -2
- package/dist/cjs/cell-utils-a78d6fac.js +0 -168
- package/dist/cjs/f-cell-69294bca.js +0 -653
- package/dist/cjs/kup-field.cjs.entry.js +0 -241
- package/dist/cjs/kup-form-editor.cjs.entry.js +0 -404
- package/dist/cjs/utils-6287d878.js +0 -447
- package/dist/collection/assets/form-editor.js +0 -338
- package/dist/collection/components/kup-field/kup-field-declarations.js +0 -15
- package/dist/collection/components/kup-field/kup-field.css +0 -48
- package/dist/collection/components/kup-field/kup-field.js +0 -514
- package/dist/collection/components/kup-form-editor/kup-form-editor-declarations.js +0 -23
- package/dist/esm/cell-utils-964da6b5.js +0 -160
- package/dist/esm/kup-field.entry.js +0 -237
- package/dist/esm/kup-form-editor.entry.js +0 -400
- package/dist/esm/utils-d7e4b3c2.js +0 -428
- package/dist/ketchup/p-1ae66cc5.js +0 -1
- package/dist/ketchup/p-34b74425.js +0 -1
- package/dist/ketchup/p-3c11e615.entry.js +0 -1
- package/dist/ketchup/p-4ffbc3ff.js +0 -1
- package/dist/ketchup/p-5264a3e6.entry.js +0 -1
- package/dist/ketchup/p-65974e48.entry.js +0 -1
- package/dist/ketchup/p-65b46587.entry.js +0 -40
- package/dist/ketchup/p-6dff70f8.entry.js +0 -1
- package/dist/ketchup/p-7454cb92.js +0 -1
- package/dist/ketchup/p-80968627.entry.js +0 -1
- package/dist/ketchup/p-8cdf61a4.js +0 -1
- package/dist/ketchup/p-954cc340.entry.js +0 -1
- package/dist/ketchup/p-976244f9.entry.js +0 -9
- package/dist/ketchup/p-99e0d768.entry.js +0 -1
- package/dist/ketchup/p-a0f6e25c.entry.js +0 -1
- package/dist/ketchup/p-a615a92b.entry.js +0 -1
- package/dist/ketchup/p-aca0e54b.js +0 -30
- package/dist/ketchup/p-b8939a8b.entry.js +0 -1
- package/dist/ketchup/p-bfc3bac7.js +0 -1
- package/dist/ketchup/p-c5ce8951.entry.js +0 -1
- package/dist/ketchup/p-d2ee56dd.entry.js +0 -1
- package/dist/ketchup/p-db71436b.entry.js +0 -27
- package/dist/ketchup/p-e0035c58.js +0 -1
- package/dist/ketchup/p-e1039cf2.entry.js +0 -1
- package/dist/ketchup/p-ea10176c.entry.js +0 -1
- package/dist/types/components/kup-field/kup-field-declarations.d.ts +0 -25
- package/dist/types/components/kup-field/kup-field.d.ts +0 -90
|
@@ -0,0 +1,854 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
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
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
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
|
+
import { Component, Element, Event, forceUpdate, h, Host, Method, Prop, } from '@stencil/core';
|
|
14
|
+
import { FButton } from '../../f-components/f-button/f-button';
|
|
15
|
+
import { FButtonStyling, } from '../../f-components/f-button/f-button-declarations';
|
|
16
|
+
import { FImage } from '../../f-components/f-image/f-image';
|
|
17
|
+
import { KupPointerEventTypes } from '../../managers/kup-interact/kup-interact-declarations';
|
|
18
|
+
import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
|
|
19
|
+
import { kupManagerInstance } from '../../managers/kup-manager/kup-manager';
|
|
20
|
+
import { getProps, setProps } from '../../utils/utils';
|
|
21
|
+
import { componentWrapperId } from '../../variables/GenericVariables';
|
|
22
|
+
import { KupFamilyTreeProps, } from './kup-family-tree-declarations';
|
|
23
|
+
export class KupFamilyTree {
|
|
24
|
+
constructor() {
|
|
25
|
+
_KupFamilyTree_instances.add(this);
|
|
26
|
+
/*-------------------------------------------------*/
|
|
27
|
+
/* P r o p s */
|
|
28
|
+
/*-------------------------------------------------*/
|
|
29
|
+
/**
|
|
30
|
+
* The component will autofit everytime a node is expanded.
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
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;
|
|
39
|
+
/**
|
|
40
|
+
* Nodes can be expanded/collapsed.
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
this.collapsible = true;
|
|
44
|
+
/**
|
|
45
|
+
* Custom style of the component.
|
|
46
|
+
* @default ""
|
|
47
|
+
* @see https://ketchup.smeup.com/ketchup-showcase/#/customization
|
|
48
|
+
*/
|
|
49
|
+
this.customStyle = '';
|
|
50
|
+
/**
|
|
51
|
+
* Actual data of the component.
|
|
52
|
+
* @default null
|
|
53
|
+
*/
|
|
54
|
+
this.data = null;
|
|
55
|
+
/**
|
|
56
|
+
* Layout of the boxes.
|
|
57
|
+
* @default null
|
|
58
|
+
*/
|
|
59
|
+
this.layout = null;
|
|
60
|
+
/**
|
|
61
|
+
* Child nodes that have no children are arranged vertically.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
this.stackedLeaves = false;
|
|
65
|
+
/*-------------------------------------------------*/
|
|
66
|
+
/* I n t e r n a l V a r i a b l e s */
|
|
67
|
+
/*-------------------------------------------------*/
|
|
68
|
+
_KupFamilyTree_clickTimeout.set(this, []);
|
|
69
|
+
_KupFamilyTree_hold.set(this, false);
|
|
70
|
+
_KupFamilyTree_currentPanX.set(this, 0);
|
|
71
|
+
_KupFamilyTree_currentPanY.set(this, 0);
|
|
72
|
+
_KupFamilyTree_interactableTouch.set(this, []);
|
|
73
|
+
_KupFamilyTree_kupManager.set(this, kupManagerInstance());
|
|
74
|
+
_KupFamilyTree_moveCb.set(this, (e) => {
|
|
75
|
+
const deltaX = e.clientX - __classPrivateFieldGet(this, _KupFamilyTree_currentPanX, "f");
|
|
76
|
+
const deltaY = e.clientY - __classPrivateFieldGet(this, _KupFamilyTree_currentPanY, "f");
|
|
77
|
+
this.rootElement.scrollTop -= deltaY;
|
|
78
|
+
this.rootElement.scrollLeft -= deltaX;
|
|
79
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanX, e.clientX, "f");
|
|
80
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanY, e.clientY, "f");
|
|
81
|
+
});
|
|
82
|
+
_KupFamilyTree_shouldAutofit.set(this, false);
|
|
83
|
+
_KupFamilyTree_wrapperEl.set(this, null);
|
|
84
|
+
}
|
|
85
|
+
/*-------------------------------------------------*/
|
|
86
|
+
/* P u b l i c M e t h o d s */
|
|
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
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Used to retrieve component's props values.
|
|
104
|
+
* @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
|
|
105
|
+
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
106
|
+
*/
|
|
107
|
+
async getProps(descriptions) {
|
|
108
|
+
return getProps(this, KupFamilyTreeProps, descriptions);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This method is used to trigger a new render of the component.
|
|
112
|
+
*/
|
|
113
|
+
async refresh() {
|
|
114
|
+
forceUpdate(this);
|
|
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
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Sets the props to the component.
|
|
147
|
+
* @param {GenericObject} props - Object containing props that will be set to the component.
|
|
148
|
+
*/
|
|
149
|
+
async setProps(props) {
|
|
150
|
+
setProps(this, KupFamilyTreeProps, props);
|
|
151
|
+
}
|
|
152
|
+
/*-------------------------------------------------*/
|
|
153
|
+
/* L i f e c y c l e H o o k s */
|
|
154
|
+
/*-------------------------------------------------*/
|
|
155
|
+
componentWillLoad() {
|
|
156
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logLoad(this, false);
|
|
157
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").language.register(this);
|
|
158
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").theme.register(this);
|
|
159
|
+
}
|
|
160
|
+
componentDidLoad() {
|
|
161
|
+
__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_didLoadInteractables).call(this);
|
|
162
|
+
if (this.autofitOnLoad) {
|
|
163
|
+
this.runAutofit();
|
|
164
|
+
}
|
|
165
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logLoad(this, true);
|
|
166
|
+
}
|
|
167
|
+
componentWillRender() {
|
|
168
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logRender(this, false);
|
|
169
|
+
}
|
|
170
|
+
componentDidRender() {
|
|
171
|
+
if (__classPrivateFieldGet(this, _KupFamilyTree_shouldAutofit, "f")) {
|
|
172
|
+
__classPrivateFieldSet(this, _KupFamilyTree_shouldAutofit, false, "f");
|
|
173
|
+
this.runAutofit();
|
|
174
|
+
}
|
|
175
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logRender(this, true);
|
|
176
|
+
}
|
|
177
|
+
render() {
|
|
178
|
+
return (h(Host, { onDrag: (e) => e.preventDefault(), onPointerDown: (e) => {
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_startPanning).call(this, e);
|
|
181
|
+
}, onWheel: (e) => {
|
|
182
|
+
__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_zoomTree).call(this, e);
|
|
183
|
+
} },
|
|
184
|
+
h("style", null, __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").theme.setKupStyle(this.rootElement)),
|
|
185
|
+
h("div", { id: componentWrapperId }, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_createTree).call(this))));
|
|
186
|
+
}
|
|
187
|
+
disconnectedCallback() {
|
|
188
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").language.unregister(this);
|
|
189
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").theme.unregister(this);
|
|
190
|
+
}
|
|
191
|
+
static get is() { return "kup-family-tree"; }
|
|
192
|
+
static get encapsulation() { return "shadow"; }
|
|
193
|
+
static get originalStyleUrls() { return {
|
|
194
|
+
"$": ["kup-family-tree.scss"]
|
|
195
|
+
}; }
|
|
196
|
+
static get styleUrls() { return {
|
|
197
|
+
"$": ["kup-family-tree.css"]
|
|
198
|
+
}; }
|
|
199
|
+
static get properties() { return {
|
|
200
|
+
"autofitOnExpand": {
|
|
201
|
+
"type": "boolean",
|
|
202
|
+
"mutable": false,
|
|
203
|
+
"complexType": {
|
|
204
|
+
"original": "boolean",
|
|
205
|
+
"resolved": "boolean",
|
|
206
|
+
"references": {}
|
|
207
|
+
},
|
|
208
|
+
"required": false,
|
|
209
|
+
"optional": false,
|
|
210
|
+
"docs": {
|
|
211
|
+
"tags": [{
|
|
212
|
+
"name": "default",
|
|
213
|
+
"text": "true"
|
|
214
|
+
}],
|
|
215
|
+
"text": "The component will autofit everytime a node is expanded."
|
|
216
|
+
},
|
|
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",
|
|
239
|
+
"reflect": false,
|
|
240
|
+
"defaultValue": "true"
|
|
241
|
+
},
|
|
242
|
+
"collapsible": {
|
|
243
|
+
"type": "boolean",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "boolean",
|
|
247
|
+
"resolved": "boolean",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": false,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [{
|
|
254
|
+
"name": "default",
|
|
255
|
+
"text": "true"
|
|
256
|
+
}],
|
|
257
|
+
"text": "Nodes can be expanded/collapsed."
|
|
258
|
+
},
|
|
259
|
+
"attribute": "collapsible",
|
|
260
|
+
"reflect": false,
|
|
261
|
+
"defaultValue": "true"
|
|
262
|
+
},
|
|
263
|
+
"customStyle": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"mutable": false,
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "string",
|
|
268
|
+
"resolved": "string",
|
|
269
|
+
"references": {}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": false,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [{
|
|
275
|
+
"name": "default",
|
|
276
|
+
"text": "\"\""
|
|
277
|
+
}, {
|
|
278
|
+
"name": "see",
|
|
279
|
+
"text": "https://ketchup.smeup.com/ketchup-showcase/#/customization"
|
|
280
|
+
}],
|
|
281
|
+
"text": "Custom style of the component."
|
|
282
|
+
},
|
|
283
|
+
"attribute": "custom-style",
|
|
284
|
+
"reflect": false,
|
|
285
|
+
"defaultValue": "''"
|
|
286
|
+
},
|
|
287
|
+
"data": {
|
|
288
|
+
"type": "unknown",
|
|
289
|
+
"mutable": false,
|
|
290
|
+
"complexType": {
|
|
291
|
+
"original": "KupFamilyTreeData",
|
|
292
|
+
"resolved": "KupFamilyTreeData",
|
|
293
|
+
"references": {
|
|
294
|
+
"KupFamilyTreeData": {
|
|
295
|
+
"location": "import",
|
|
296
|
+
"path": "./kup-family-tree-declarations"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"required": false,
|
|
301
|
+
"optional": false,
|
|
302
|
+
"docs": {
|
|
303
|
+
"tags": [{
|
|
304
|
+
"name": "default",
|
|
305
|
+
"text": "null"
|
|
306
|
+
}],
|
|
307
|
+
"text": "Actual data of the component."
|
|
308
|
+
},
|
|
309
|
+
"defaultValue": "null"
|
|
310
|
+
},
|
|
311
|
+
"layout": {
|
|
312
|
+
"type": "number",
|
|
313
|
+
"mutable": false,
|
|
314
|
+
"complexType": {
|
|
315
|
+
"original": "KupFamilyTreeLayout",
|
|
316
|
+
"resolved": "KupBoxLayout | number",
|
|
317
|
+
"references": {
|
|
318
|
+
"KupFamilyTreeLayout": {
|
|
319
|
+
"location": "import",
|
|
320
|
+
"path": "./kup-family-tree-declarations"
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"required": false,
|
|
325
|
+
"optional": false,
|
|
326
|
+
"docs": {
|
|
327
|
+
"tags": [{
|
|
328
|
+
"name": "default",
|
|
329
|
+
"text": "null"
|
|
330
|
+
}],
|
|
331
|
+
"text": "Layout of the boxes."
|
|
332
|
+
},
|
|
333
|
+
"attribute": "layout",
|
|
334
|
+
"reflect": false,
|
|
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"
|
|
357
|
+
}
|
|
358
|
+
}; }
|
|
359
|
+
static get events() { return [{
|
|
360
|
+
"method": "kupClick",
|
|
361
|
+
"name": "kup-familytree-click",
|
|
362
|
+
"bubbles": true,
|
|
363
|
+
"cancelable": false,
|
|
364
|
+
"composed": true,
|
|
365
|
+
"docs": {
|
|
366
|
+
"tags": [],
|
|
367
|
+
"text": ""
|
|
368
|
+
},
|
|
369
|
+
"complexType": {
|
|
370
|
+
"original": "KupFamilyTreeEventPayload",
|
|
371
|
+
"resolved": "KupFamilyTreeEventPayload",
|
|
372
|
+
"references": {
|
|
373
|
+
"KupFamilyTreeEventPayload": {
|
|
374
|
+
"location": "import",
|
|
375
|
+
"path": "./kup-family-tree-declarations"
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}, {
|
|
380
|
+
"method": "kupContextMenu",
|
|
381
|
+
"name": "kup-familytree-contextmenu",
|
|
382
|
+
"bubbles": true,
|
|
383
|
+
"cancelable": false,
|
|
384
|
+
"composed": true,
|
|
385
|
+
"docs": {
|
|
386
|
+
"tags": [],
|
|
387
|
+
"text": ""
|
|
388
|
+
},
|
|
389
|
+
"complexType": {
|
|
390
|
+
"original": "KupFamilyTreeEventPayload",
|
|
391
|
+
"resolved": "KupFamilyTreeEventPayload",
|
|
392
|
+
"references": {
|
|
393
|
+
"KupFamilyTreeEventPayload": {
|
|
394
|
+
"location": "import",
|
|
395
|
+
"path": "./kup-family-tree-declarations"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}, {
|
|
400
|
+
"method": "kupDblClick",
|
|
401
|
+
"name": "kup-familytree-dblclick",
|
|
402
|
+
"bubbles": true,
|
|
403
|
+
"cancelable": false,
|
|
404
|
+
"composed": true,
|
|
405
|
+
"docs": {
|
|
406
|
+
"tags": [],
|
|
407
|
+
"text": ""
|
|
408
|
+
},
|
|
409
|
+
"complexType": {
|
|
410
|
+
"original": "KupFamilyTreeEventPayload",
|
|
411
|
+
"resolved": "KupFamilyTreeEventPayload",
|
|
412
|
+
"references": {
|
|
413
|
+
"KupFamilyTreeEventPayload": {
|
|
414
|
+
"location": "import",
|
|
415
|
+
"path": "./kup-family-tree-declarations"
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}]; }
|
|
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
|
+
},
|
|
467
|
+
"getProps": {
|
|
468
|
+
"complexType": {
|
|
469
|
+
"signature": "(descriptions?: boolean) => Promise<GenericObject>",
|
|
470
|
+
"parameters": [{
|
|
471
|
+
"tags": [{
|
|
472
|
+
"name": "param",
|
|
473
|
+
"text": "descriptions - When provided and true, the result will be the list of props with their description."
|
|
474
|
+
}],
|
|
475
|
+
"text": "- When provided and true, the result will be the list of props with their description."
|
|
476
|
+
}],
|
|
477
|
+
"references": {
|
|
478
|
+
"Promise": {
|
|
479
|
+
"location": "global"
|
|
480
|
+
},
|
|
481
|
+
"GenericObject": {
|
|
482
|
+
"location": "import",
|
|
483
|
+
"path": "../../types/GenericTypes"
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
"return": "Promise<GenericObject>"
|
|
487
|
+
},
|
|
488
|
+
"docs": {
|
|
489
|
+
"text": "Used to retrieve component's props values.",
|
|
490
|
+
"tags": [{
|
|
491
|
+
"name": "param",
|
|
492
|
+
"text": "descriptions - When provided and true, the result will be the list of props with their description."
|
|
493
|
+
}, {
|
|
494
|
+
"name": "returns",
|
|
495
|
+
"text": "List of props as object, each key will be a prop."
|
|
496
|
+
}]
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
"refresh": {
|
|
500
|
+
"complexType": {
|
|
501
|
+
"signature": "() => Promise<void>",
|
|
502
|
+
"parameters": [],
|
|
503
|
+
"references": {
|
|
504
|
+
"Promise": {
|
|
505
|
+
"location": "global"
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
"return": "Promise<void>"
|
|
509
|
+
},
|
|
510
|
+
"docs": {
|
|
511
|
+
"text": "This method is used to trigger a new render of the component.",
|
|
512
|
+
"tags": []
|
|
513
|
+
}
|
|
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
|
+
},
|
|
531
|
+
"setProps": {
|
|
532
|
+
"complexType": {
|
|
533
|
+
"signature": "(props: GenericObject) => Promise<void>",
|
|
534
|
+
"parameters": [{
|
|
535
|
+
"tags": [{
|
|
536
|
+
"name": "param",
|
|
537
|
+
"text": "props - Object containing props that will be set to the component."
|
|
538
|
+
}],
|
|
539
|
+
"text": "- Object containing props that will be set to the component."
|
|
540
|
+
}],
|
|
541
|
+
"references": {
|
|
542
|
+
"Promise": {
|
|
543
|
+
"location": "global"
|
|
544
|
+
},
|
|
545
|
+
"GenericObject": {
|
|
546
|
+
"location": "import",
|
|
547
|
+
"path": "../../types/GenericTypes"
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
"return": "Promise<void>"
|
|
551
|
+
},
|
|
552
|
+
"docs": {
|
|
553
|
+
"text": "Sets the props to the component.",
|
|
554
|
+
"tags": [{
|
|
555
|
+
"name": "param",
|
|
556
|
+
"text": "props - Object containing props that will be set to the component."
|
|
557
|
+
}]
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}; }
|
|
561
|
+
static get elementRef() { return "rootElement"; }
|
|
562
|
+
}
|
|
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) {
|
|
564
|
+
const content = [];
|
|
565
|
+
content.push(h("td", { class: {
|
|
566
|
+
'family-tree__line': true,
|
|
567
|
+
'family-tree__line--right': !first,
|
|
568
|
+
'family-tree__line--top': !first,
|
|
569
|
+
} },
|
|
570
|
+
h("div", { class: 'family-tree__line--placeholder' })));
|
|
571
|
+
content.push(h("td", { class: {
|
|
572
|
+
'family-tree__line': true,
|
|
573
|
+
'family-tree__line--left': first,
|
|
574
|
+
'family-tree__line--top': (first && !alone) || (moreTwo && !last),
|
|
575
|
+
} },
|
|
576
|
+
h("div", { class: 'family-tree__line--placeholder' })));
|
|
577
|
+
return content;
|
|
578
|
+
}, _KupFamilyTree_buildNode = function _KupFamilyTree_buildNode(node) {
|
|
579
|
+
var _a;
|
|
580
|
+
let children = null;
|
|
581
|
+
let staffChildren = null;
|
|
582
|
+
if (!this.collapsible || (this.collapsible && node.isExpanded)) {
|
|
583
|
+
(_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
|
|
584
|
+
if (child.isStaff) {
|
|
585
|
+
if (!staffChildren) {
|
|
586
|
+
staffChildren = [];
|
|
587
|
+
}
|
|
588
|
+
staffChildren.push(child);
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
if (!children) {
|
|
592
|
+
children = [];
|
|
593
|
+
}
|
|
594
|
+
children.push(child);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
const stacked = this.stackedLeaves &&
|
|
599
|
+
children &&
|
|
600
|
+
children.every((c) => !c.children || c.children.length == 0);
|
|
601
|
+
const span1 = children ? children.length * 2 : 1;
|
|
602
|
+
const styleVLine = {
|
|
603
|
+
'family-tree__line': true,
|
|
604
|
+
'family-tree__line--placeholder': !!(children || staffChildren),
|
|
605
|
+
'family-tree__line--vertical': !!(children || staffChildren),
|
|
606
|
+
};
|
|
607
|
+
const data = {
|
|
608
|
+
columns: [
|
|
609
|
+
{ name: '*TREECOL', title: 'Fake column' },
|
|
610
|
+
...this.data.columns,
|
|
611
|
+
],
|
|
612
|
+
rows: [{ cells: Object.assign({ '*TREECOL': node }, node.cells) }],
|
|
613
|
+
};
|
|
614
|
+
const layout = node.layout || this.layout || 1;
|
|
615
|
+
const expandButtonProps = {
|
|
616
|
+
icon: node.isExpanded ? 'remove' : 'plus',
|
|
617
|
+
shaped: true,
|
|
618
|
+
slim: true,
|
|
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
|
+
}
|
|
630
|
+
node.isExpanded = !node.isExpanded;
|
|
631
|
+
if (this.autofitOnExpand) {
|
|
632
|
+
__classPrivateFieldSet(this, _KupFamilyTree_shouldAutofit, true, "f");
|
|
633
|
+
}
|
|
634
|
+
this.refresh();
|
|
635
|
+
},
|
|
636
|
+
wrapperClass: 'family-tree__item__expand',
|
|
637
|
+
};
|
|
638
|
+
const box = (h("div", { class: 'family-tree__item' },
|
|
639
|
+
h("div", { class: 'family-tree__item__wrapper' },
|
|
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)),
|
|
641
|
+
this.collapsible &&
|
|
642
|
+
node.children &&
|
|
643
|
+
node.children.length > 0 ? (h(FButton, Object.assign({}, expandButtonProps))) : undefined)));
|
|
644
|
+
const staffStyle = {
|
|
645
|
+
['--kup_familytree_staffchildren']: (staffChildren === null || staffChildren === void 0 ? void 0 : staffChildren.length.toString()) || '0',
|
|
646
|
+
};
|
|
647
|
+
//TODO: set data-cell and data-column if needed inside events
|
|
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
|
+
} },
|
|
654
|
+
h("tr", null,
|
|
655
|
+
h("td", { "data-row": node, colSpan: span1 }, box)),
|
|
656
|
+
h("tr", null,
|
|
657
|
+
h("td", { colSpan: span1 },
|
|
658
|
+
h("div", { class: styleVLine }))),
|
|
659
|
+
staffChildren
|
|
660
|
+
? [
|
|
661
|
+
h("tr", null,
|
|
662
|
+
h("td", { colSpan: span1 },
|
|
663
|
+
h("div", { class: Object.assign(Object.assign({}, styleVLine), { 'family-tree__line--staff': true }), style: staffStyle }),
|
|
664
|
+
h("div", { class: "family-tree__node__staff", style: staffStyle }, staffChildren.map((inode) => [
|
|
665
|
+
h("div", { class: "family-tree__node__staff__item" }, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, inode)),
|
|
666
|
+
])))),
|
|
667
|
+
]
|
|
668
|
+
: null,
|
|
669
|
+
staffChildren && children
|
|
670
|
+
? [
|
|
671
|
+
h("tr", null,
|
|
672
|
+
h("td", { colSpan: span1 },
|
|
673
|
+
h("div", { class: styleVLine }))),
|
|
674
|
+
]
|
|
675
|
+
: null,
|
|
676
|
+
children
|
|
677
|
+
? [
|
|
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)))))),
|
|
682
|
+
]
|
|
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)));
|
|
702
|
+
}, _KupFamilyTree_buildNodes = function _KupFamilyTree_buildNodes(nodes) {
|
|
703
|
+
return nodes.map((node) => __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, node));
|
|
704
|
+
}, _KupFamilyTree_createTree = function _KupFamilyTree_createTree() {
|
|
705
|
+
const emptyData = !this.data || !this.data.rows || !this.data.rows.length;
|
|
706
|
+
return (h("div", { class: "family-tree", onContextMenu: (e) => {
|
|
707
|
+
e.preventDefault();
|
|
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;
|
|
712
|
+
}, _KupFamilyTree_startPanning = function _KupFamilyTree_startPanning(e) {
|
|
713
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanX, e.clientX, "f");
|
|
714
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanY, e.clientY, "f");
|
|
715
|
+
__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").classList.add('family-tree--dragging');
|
|
716
|
+
const endPanning = () => {
|
|
717
|
+
document.removeEventListener('pointermove', __classPrivateFieldGet(this, _KupFamilyTree_moveCb, "f"));
|
|
718
|
+
document.removeEventListener('pointerup', endPanning);
|
|
719
|
+
__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").classList.remove('family-tree--dragging');
|
|
720
|
+
};
|
|
721
|
+
document.addEventListener('pointermove', __classPrivateFieldGet(this, _KupFamilyTree_moveCb, "f"));
|
|
722
|
+
document.addEventListener('pointerup', endPanning);
|
|
723
|
+
}, _KupFamilyTree_getEventPath = function _KupFamilyTree_getEventPath(currentEl) {
|
|
724
|
+
const path = [];
|
|
725
|
+
while (currentEl &&
|
|
726
|
+
currentEl !== this.rootElement &&
|
|
727
|
+
currentEl !== document.body) {
|
|
728
|
+
path.push(currentEl);
|
|
729
|
+
currentEl = currentEl.parentNode
|
|
730
|
+
? currentEl.parentNode
|
|
731
|
+
: currentEl.host;
|
|
732
|
+
}
|
|
733
|
+
return path;
|
|
734
|
+
}, _KupFamilyTree_getEventDetails = function _KupFamilyTree_getEventDetails(path, e) {
|
|
735
|
+
let expandButton;
|
|
736
|
+
let td;
|
|
737
|
+
if (path) {
|
|
738
|
+
for (let i = path.length - 1; i >= 0; i--) {
|
|
739
|
+
const el = path[i];
|
|
740
|
+
if (!el.tagName) {
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
if (el.classList.contains('family-tree__item__expand')) {
|
|
744
|
+
expandButton = el;
|
|
745
|
+
}
|
|
746
|
+
switch (el.tagName.toUpperCase()) {
|
|
747
|
+
case 'TD': {
|
|
748
|
+
td = el;
|
|
749
|
+
break;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
let cell = null, column = null, row = null;
|
|
755
|
+
if (td) {
|
|
756
|
+
cell = td['data-cell'];
|
|
757
|
+
column = td['data-column'];
|
|
758
|
+
row = td['data-row'];
|
|
759
|
+
}
|
|
760
|
+
return {
|
|
761
|
+
cell: cell ? cell : null,
|
|
762
|
+
column: column ? column : null,
|
|
763
|
+
expandButton: expandButton ? expandButton : null,
|
|
764
|
+
originalEvent: e,
|
|
765
|
+
row: row ? row : null,
|
|
766
|
+
td: td ? td : null,
|
|
767
|
+
};
|
|
768
|
+
}, _KupFamilyTree_clickHandler = function _KupFamilyTree_clickHandler(e) {
|
|
769
|
+
const details = __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventDetails).call(this, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventPath).call(this, e.target), e);
|
|
770
|
+
return details;
|
|
771
|
+
}, _KupFamilyTree_contextMenuHandler = function _KupFamilyTree_contextMenuHandler(e) {
|
|
772
|
+
const details = __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventDetails).call(this, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventPath).call(this, e.target), e);
|
|
773
|
+
return details;
|
|
774
|
+
}, _KupFamilyTree_dblClickHandler = function _KupFamilyTree_dblClickHandler(e) {
|
|
775
|
+
const details = __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventDetails).call(this, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventPath).call(this, e.target), e);
|
|
776
|
+
return details;
|
|
777
|
+
}, _KupFamilyTree_didLoadInteractables = function _KupFamilyTree_didLoadInteractables() {
|
|
778
|
+
__classPrivateFieldGet(this, _KupFamilyTree_interactableTouch, "f").push(this.rootElement);
|
|
779
|
+
const tapCb = (e) => {
|
|
780
|
+
if (__classPrivateFieldGet(this, _KupFamilyTree_hold, "f")) {
|
|
781
|
+
__classPrivateFieldSet(this, _KupFamilyTree_hold, false, "f");
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
switch (e.button) {
|
|
785
|
+
// left click
|
|
786
|
+
case 0:
|
|
787
|
+
// Note: event must be cloned
|
|
788
|
+
// otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
|
|
789
|
+
const clone = {};
|
|
790
|
+
for (const key in e) {
|
|
791
|
+
clone[key] = e[key];
|
|
792
|
+
}
|
|
793
|
+
__classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f").push(setTimeout(() => {
|
|
794
|
+
this.kupClick.emit({
|
|
795
|
+
comp: this,
|
|
796
|
+
id: this.rootElement.id,
|
|
797
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_clickHandler).call(this, clone),
|
|
798
|
+
});
|
|
799
|
+
}, 300));
|
|
800
|
+
break;
|
|
801
|
+
// right click
|
|
802
|
+
case 2:
|
|
803
|
+
this.kupContextMenu.emit({
|
|
804
|
+
comp: this,
|
|
805
|
+
id: this.rootElement.id,
|
|
806
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_contextMenuHandler).call(this, e),
|
|
807
|
+
});
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
const doubletapCb = (e) => {
|
|
812
|
+
switch (e.button) {
|
|
813
|
+
// left click
|
|
814
|
+
case 0:
|
|
815
|
+
for (let index = 0; index < __classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f").length; index++) {
|
|
816
|
+
clearTimeout(__classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f")[index]);
|
|
817
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logMessage(this, 'Cleared clickHandler timeout(' +
|
|
818
|
+
__classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f")[index] +
|
|
819
|
+
').');
|
|
820
|
+
}
|
|
821
|
+
__classPrivateFieldSet(this, _KupFamilyTree_clickTimeout, [], "f");
|
|
822
|
+
this.kupDblClick.emit({
|
|
823
|
+
comp: this,
|
|
824
|
+
id: this.rootElement.id,
|
|
825
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_dblClickHandler).call(this, e),
|
|
826
|
+
});
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
const holdCb = (e) => {
|
|
831
|
+
if (e.pointerType === 'pen' || e.pointerType === 'touch') {
|
|
832
|
+
__classPrivateFieldSet(this, _KupFamilyTree_hold, true, "f");
|
|
833
|
+
this.kupContextMenu.emit({
|
|
834
|
+
comp: this,
|
|
835
|
+
id: this.rootElement.id,
|
|
836
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_contextMenuHandler).call(this, e),
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.TAP, tapCb);
|
|
841
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.DOUBLETAP, doubletapCb);
|
|
842
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.HOLD, holdCb);
|
|
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;
|
|
851
|
+
}
|
|
852
|
+
__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.setProperty('--kup_familytree_scale', value.toFixed(2));
|
|
853
|
+
}
|
|
854
|
+
};
|