@sme.up/ketchup 6.2.0-SNAPSHOT → 6.2.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/{cell-utils-d894e802.js → cell-utils-fe64a28c.js} +2 -2
- package/dist/cjs/{f-button-414b3bc3.js → f-button-5b69d882.js} +1 -1
- package/dist/cjs/{f-cell-c8983ec7.js → f-cell-3a740c48.js} +6 -6
- package/dist/cjs/{f-chip-ef81bf51.js → f-chip-02e83f82.js} +2 -2
- package/dist/cjs/{f-image-0618c795.js → f-image-2a61ece2.js} +1 -1
- package/dist/cjs/{f-paginator-utils-c9dd5173.js → f-paginator-utils-09126bdd.js} +4 -4
- package/dist/cjs/{f-text-field-7d31190f.js → f-text-field-9ee20a67.js} +1 -1
- package/dist/cjs/ketchup.cjs.js +2 -2
- package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
- package/dist/cjs/kup-autocomplete_25.cjs.entry.js +35 -21
- package/dist/cjs/kup-box.cjs.entry.js +1306 -0
- package/dist/cjs/kup-calendar.cjs.entry.js +6 -6
- package/dist/cjs/kup-cell.cjs.entry.js +7 -7
- package/dist/cjs/kup-dash-list.cjs.entry.js +3 -3
- package/dist/cjs/kup-dash_2.cjs.entry.js +2 -2
- package/dist/cjs/kup-dashboard.cjs.entry.js +5 -5
- package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
- package/dist/cjs/{kup-box_2.cjs.entry.js → kup-echart.cjs.entry.js} +52 -1348
- package/dist/cjs/kup-family-tree.cjs.entry.js +410 -0
- package/dist/cjs/kup-form.cjs.entry.js +40 -29
- package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
- package/dist/cjs/kup-image-list.cjs.entry.js +70 -9
- package/dist/cjs/kup-lazy.cjs.entry.js +3 -3
- package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
- package/dist/cjs/{kup-manager-2fee8cf3.js → kup-manager-02acbb37.js} +83 -1
- package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +2 -2
- package/dist/cjs/kup-photo-frame.cjs.entry.js +8 -6
- package/dist/cjs/kup-probe.cjs.entry.js +1 -1
- package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
- package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-8470184d.js → utils-4b208b48.js} +1 -1
- package/dist/collection/assets/data-table.js +44 -0
- package/dist/collection/assets/family-tree.js +2437 -0
- package/dist/collection/assets/form.js +254 -0
- package/dist/collection/assets/index.js +4 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/kup-button/kup-button.js +1 -0
- 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-dropdown-button/kup-dropdown-button.js +1 -0
- package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +12 -0
- package/dist/collection/components/kup-family-tree/kup-family-tree.css +101 -0
- package/dist/collection/components/kup-family-tree/kup-family-tree.js +666 -0
- package/dist/collection/components/kup-form/kup-form-declarations.js +6 -0
- package/dist/collection/components/kup-form/kup-form.css +22 -9
- package/dist/collection/components/kup-form/kup-form.js +28 -49
- 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-photo-frame/kup-photo-frame.css +9 -2
- package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +5 -3
- package/dist/collection/components/kup-tree/kup-tree.js +16 -5
- package/dist/collection/managers/kup-data/kup-data-node-helper.js +69 -0
- package/dist/collection/managers/kup-data/kup-data.js +15 -1
- package/dist/collection/managers/kup-theme/kup-theme-declarations.js +2 -0
- package/dist/collection/types/GenericTypes.js +1 -1
- package/dist/esm/{cell-utils-7fc84d4e.js → cell-utils-cb5d4149.js} +2 -2
- package/dist/esm/{f-button-2f6cc296.js → f-button-fd44ef70.js} +1 -1
- package/dist/esm/{f-cell-4428481c.js → f-cell-7b159a22.js} +6 -6
- package/dist/esm/{f-chip-b39eb49a.js → f-chip-c2e4c522.js} +2 -2
- package/dist/esm/{f-image-b08ebeb2.js → f-image-2ab4b9aa.js} +1 -1
- package/dist/esm/{f-paginator-utils-4fda6086.js → f-paginator-utils-ef537d82.js} +4 -4
- package/dist/esm/{f-text-field-184a5fb3.js → f-text-field-41c575eb.js} +1 -1
- package/dist/esm/ketchup.js +2 -2
- package/dist/esm/kup-accordion.entry.js +3 -3
- package/dist/esm/kup-autocomplete_25.entry.js +35 -21
- package/dist/esm/kup-box.entry.js +1302 -0
- package/dist/esm/kup-calendar.entry.js +6 -6
- package/dist/esm/kup-cell.entry.js +7 -7
- package/dist/esm/kup-dash-list.entry.js +3 -3
- package/dist/esm/kup-dash_2.entry.js +2 -2
- package/dist/esm/kup-dashboard.entry.js +5 -5
- package/dist/esm/kup-drawer.entry.js +2 -2
- package/dist/esm/{kup-box_2.entry.js → kup-echart.entry.js} +53 -1348
- package/dist/esm/kup-family-tree.entry.js +406 -0
- package/dist/esm/kup-form.entry.js +40 -29
- package/dist/esm/kup-iframe.entry.js +2 -2
- package/dist/esm/kup-image-list.entry.js +70 -9
- package/dist/esm/kup-lazy.entry.js +3 -3
- package/dist/esm/kup-magic-box.entry.js +3 -3
- package/dist/esm/{kup-manager-3325b2d8.js → kup-manager-22a475e6.js} +83 -1
- package/dist/esm/kup-nav-bar.entry.js +2 -2
- package/dist/esm/kup-numeric-picker.entry.js +2 -2
- package/dist/esm/kup-photo-frame.entry.js +8 -6
- package/dist/esm/kup-probe.entry.js +1 -1
- package/dist/esm/kup-qlik.entry.js +1 -1
- package/dist/esm/kup-snackbar.entry.js +4 -4
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{utils-6373a07e.js → utils-2c1f4122.js} +1 -1
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-d7004ae4.js → p-06c6cc68.js} +1 -1
- package/dist/ketchup/{p-6127fccf.entry.js → p-0dacd4bc.entry.js} +1 -1
- package/dist/ketchup/{p-1db1d42b.entry.js → p-1959f835.entry.js} +1 -1
- package/dist/ketchup/p-1c44dc62.entry.js +1 -0
- package/dist/ketchup/{p-30820f8f.entry.js → p-264b1b19.entry.js} +1 -1
- package/dist/ketchup/{p-70660fe2.js → p-38d7584e.js} +1 -1
- package/dist/ketchup/{p-6b82e4e2.entry.js → p-42080355.entry.js} +1 -1
- package/dist/ketchup/p-4bc9f98b.entry.js +1 -0
- package/dist/ketchup/p-578583db.entry.js +1 -0
- package/dist/ketchup/{p-cc3abf84.entry.js → p-5866d507.entry.js} +1 -1
- package/dist/ketchup/p-61059e9d.entry.js +9 -0
- package/dist/ketchup/{p-175edb62.entry.js → p-664be494.entry.js} +1 -1
- package/dist/ketchup/{p-8103b80a.entry.js → p-67cd575d.entry.js} +1 -1
- package/dist/ketchup/{p-d95c904b.js → p-682a367a.js} +1 -1
- package/dist/ketchup/{p-153697fb.entry.js → p-6ccf7eb2.entry.js} +1 -1
- package/dist/ketchup/p-7230ab97.entry.js +1 -0
- package/dist/ketchup/p-752b4cef.entry.js +1 -0
- package/dist/ketchup/{p-41cf8703.entry.js → p-7de3e7ac.entry.js} +1 -1
- package/dist/ketchup/{p-f49cb68e.js → p-928c5c36.js} +1 -1
- package/dist/ketchup/{p-3c7c92c0.entry.js → p-9b36497d.entry.js} +1 -1
- package/dist/ketchup/{p-9fa457d4.entry.js → p-b982d137.entry.js} +1 -1
- package/dist/ketchup/{p-0741da57.js → p-c0219e5e.js} +1 -1
- package/dist/ketchup/p-c55fd0a7.entry.js +1 -0
- package/dist/ketchup/p-d154b3a0.entry.js +1 -0
- package/dist/ketchup/{p-a804fe83.entry.js → p-d2affb6f.entry.js} +1 -1
- package/dist/ketchup/p-d6c12c6c.js +1 -0
- package/dist/ketchup/{p-caabb9ab.entry.js → p-da0eab60.entry.js} +1 -1
- package/dist/ketchup/{p-ddce3430.js → p-dc62a30f.js} +1 -1
- package/dist/ketchup/p-e9366aaf.entry.js +39 -0
- package/dist/ketchup/{p-13e08580.js → p-edae3076.js} +1 -1
- package/dist/ketchup/{p-704e60eb.js → p-fc2b1229.js} +3 -3
- 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 +33 -0
- package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +61 -0
- package/dist/types/components/kup-form/kup-form-declarations.d.ts +18 -6
- package/dist/types/components/kup-form/kup-form.d.ts +1 -6
- 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-tree/kup-tree.d.ts +0 -1
- package/dist/types/components.d.ts +63 -97
- 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 +5 -1
- package/dist/types/types/GenericTypes.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/kup-field.cjs.entry.js +0 -241
- 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/esm/kup-field.entry.js +0 -237
- package/dist/ketchup/p-006bc4d0.entry.js +0 -1
- package/dist/ketchup/p-35325834.entry.js +0 -9
- package/dist/ketchup/p-359e8bec.entry.js +0 -40
- package/dist/ketchup/p-762c0382.entry.js +0 -1
- package/dist/ketchup/p-76947316.entry.js +0 -1
- package/dist/ketchup/p-a0ce8075.entry.js +0 -1
- package/dist/ketchup/p-ca9fd099.js +0 -1
- package/dist/ketchup/p-d2e76960.entry.js +0 -1
- package/dist/ketchup/p-ee580b3a.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,406 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-ad6ab214.js';
|
|
2
|
+
import { F as FButton } from './f-button-fd44ef70.js';
|
|
3
|
+
import { F as FButtonStyling } from './f-button-declarations-b1b4cac4.js';
|
|
4
|
+
import { k as kupManagerInstance, h as KupLanguageGeneric, y as KupPointerEventTypes } from './kup-manager-22a475e6.js';
|
|
5
|
+
import { g as getProps, s as setProps } from './utils-2c1f4122.js';
|
|
6
|
+
import { c as componentWrapperId } from './GenericVariables-665de00a.js';
|
|
7
|
+
import './f-image-2ab4b9aa.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Props of the kup-family-tree component.
|
|
11
|
+
* Used to export every prop in an object.
|
|
12
|
+
*/
|
|
13
|
+
var KupFamilyTreeProps;
|
|
14
|
+
(function (KupFamilyTreeProps) {
|
|
15
|
+
KupFamilyTreeProps["autofit"] = "The component's initial render will fit the container.";
|
|
16
|
+
KupFamilyTreeProps["collapsible"] = "Nodes can be expanded/collapsed.";
|
|
17
|
+
KupFamilyTreeProps["customStyle"] = "Custom style of the component.";
|
|
18
|
+
KupFamilyTreeProps["data"] = "Actual data of the component";
|
|
19
|
+
KupFamilyTreeProps["layout"] = "Layout of the boxes.";
|
|
20
|
+
})(KupFamilyTreeProps || (KupFamilyTreeProps = {}));
|
|
21
|
+
|
|
22
|
+
const kupFamilyTreeCss = ":host{--kup_familytree_item_background_color:var(\n --kup-familytree-item-background-color,\n var(--kup-primary-color)\n );--kup_familytree_item_color:var(\n --kup-familytree-item-color,\n var(--kup-text-on-primary-color)\n );--kup_familytree_item_height:var(--kup-familytree-item-height, 40px);--kup_familytree_item_h_padding:var(--kup-familytree-item-h-padding, 8px);--kup_familytree_item_v_padding:var(--kup-familytree-item-v-padding, 10px);--kup_familytree_item_width:var(--kup-familytree-item-width, 120px);--kup_familytree_lines_color:var(\n --kup-familytree-lines-color,\n var(--kup-border-color)\n );display:block;overflow:hidden}.family-tree{display:flex;transform:scale(var(--kup_familytree_scale, 1));transform-origin:0px 0px}.family-tree__node{border-collapse:collapse;margin:auto}.family-tree__node__staff{align-items:center;display:flex;flex-direction:column;height:0;transform:translateX(calc( ( var(--kup_familytree_item_width) + (var(--kup_familytree_item_h_padding) * 2) ) / 2 )) translateY(calc( 0px - ( var(--kup_familytree_staffchildren) * var(--kup_familytree_item_height) + var(--kup_familytree_staffchildren) * var(--kup_familytree_item_v_padding) ) ))}.family-tree__node__staff__item{padding:var(--kup_familytree_item_v_padding);text-align:left}.family-tree__node__staff__item:before{border-top:2px solid var(--kup_familytree_lines_color);content:\"\";position:absolute;transform:translateX(calc(100% + 2px)) translateY(calc(var(--kup_familytree_item_height) / 2));width:var(--kup_familytree_item_h_padding)}.family-tree__node td{vertical-align:top;padding:0}.family-tree__line--left{border-left:2px solid var(--kup_familytree_lines_color)}.family-tree__line--placeholder{height:calc(var(--kup_familytree_item_height) / 2)}.family-tree__line--staff{height:calc( var(--kup_familytree_staffchildren) * var(--kup_familytree_item_height) + var(--kup_familytree_staffchildren) * var(--kup_familytree_item_v_padding) )}.family-tree__line--right{border-right:2px solid var(--kup_familytree_lines_color)}.family-tree__line--top{border-top:2px solid var(--kup_familytree_lines_color)}.family-tree__line--vertical{background-color:var(--kup_familytree_lines_color);margin-left:auto;margin-right:auto;width:2px}.family-tree__item{display:flex}.family-tree__item__wrapper{margin:auto}.family-tree__item__wrapper kup-box{margin:0 auto;overflow:hidden;padding:0 18px;width:var(--kup_familytree_item_width);z-index:1}.family-tree__item__wrapper .f-button{width:fit-content;margin-left:auto;margin-right:auto}";
|
|
23
|
+
|
|
24
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
25
|
+
if (kind === "a" && !f)
|
|
26
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
27
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
28
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
29
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
+
};
|
|
31
|
+
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
32
|
+
if (kind === "m")
|
|
33
|
+
throw new TypeError("Private method is not writable");
|
|
34
|
+
if (kind === "a" && !f)
|
|
35
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
36
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
37
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
38
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
39
|
+
};
|
|
40
|
+
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;
|
|
41
|
+
const KupFamilyTree = class {
|
|
42
|
+
constructor(hostRef) {
|
|
43
|
+
registerInstance(this, hostRef);
|
|
44
|
+
this.kupClick = createEvent(this, "kup-familytree-click", 6);
|
|
45
|
+
this.kupContextMenu = createEvent(this, "kup-familytree-contextmenu", 6);
|
|
46
|
+
this.kupDblClick = createEvent(this, "kup-familytree-dblclick", 6);
|
|
47
|
+
_KupFamilyTree_instances.add(this);
|
|
48
|
+
/*-------------------------------------------------*/
|
|
49
|
+
/* P r o p s */
|
|
50
|
+
/*-------------------------------------------------*/
|
|
51
|
+
/**
|
|
52
|
+
* The component's initial render will fit the container.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
this.autofit = true;
|
|
56
|
+
/**
|
|
57
|
+
* Nodes can be expanded/collapsed.
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
this.collapsible = true;
|
|
61
|
+
/**
|
|
62
|
+
* Custom style of the component.
|
|
63
|
+
* @default ""
|
|
64
|
+
* @see https://ketchup.smeup.com/ketchup-showcase/#/customization
|
|
65
|
+
*/
|
|
66
|
+
this.customStyle = '';
|
|
67
|
+
/**
|
|
68
|
+
* Actual data of the component.
|
|
69
|
+
* @default null
|
|
70
|
+
*/
|
|
71
|
+
this.data = null;
|
|
72
|
+
/**
|
|
73
|
+
* Layout of the boxes.
|
|
74
|
+
* @default null
|
|
75
|
+
*/
|
|
76
|
+
this.layout = null;
|
|
77
|
+
/*-------------------------------------------------*/
|
|
78
|
+
/* I n t e r n a l V a r i a b l e s */
|
|
79
|
+
/*-------------------------------------------------*/
|
|
80
|
+
_KupFamilyTree_clickTimeout.set(this, []);
|
|
81
|
+
_KupFamilyTree_hold.set(this, false);
|
|
82
|
+
_KupFamilyTree_currentPanX.set(this, 0);
|
|
83
|
+
_KupFamilyTree_currentPanY.set(this, 0);
|
|
84
|
+
_KupFamilyTree_interactableTouch.set(this, []);
|
|
85
|
+
_KupFamilyTree_kupManager.set(this, kupManagerInstance());
|
|
86
|
+
_KupFamilyTree_moveCb.set(this, (e) => {
|
|
87
|
+
const deltaX = e.clientX - __classPrivateFieldGet(this, _KupFamilyTree_currentPanX, "f");
|
|
88
|
+
const deltaY = e.clientY - __classPrivateFieldGet(this, _KupFamilyTree_currentPanY, "f");
|
|
89
|
+
this.rootElement.scrollTop -= deltaY;
|
|
90
|
+
this.rootElement.scrollLeft -= deltaX;
|
|
91
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanX, e.clientX, "f");
|
|
92
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanY, e.clientY, "f");
|
|
93
|
+
});
|
|
94
|
+
_KupFamilyTree_wrapperEl.set(this, null);
|
|
95
|
+
}
|
|
96
|
+
/*-------------------------------------------------*/
|
|
97
|
+
/* P u b l i c M e t h o d s */
|
|
98
|
+
/*-------------------------------------------------*/
|
|
99
|
+
/**
|
|
100
|
+
* Used to retrieve component's props values.
|
|
101
|
+
* @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
|
|
102
|
+
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
103
|
+
*/
|
|
104
|
+
async getProps(descriptions) {
|
|
105
|
+
return getProps(this, KupFamilyTreeProps, descriptions);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* This method is used to trigger a new render of the component.
|
|
109
|
+
*/
|
|
110
|
+
async refresh() {
|
|
111
|
+
forceUpdate(this);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Sets the props to the component.
|
|
115
|
+
* @param {GenericObject} props - Object containing props that will be set to the component.
|
|
116
|
+
*/
|
|
117
|
+
async setProps(props) {
|
|
118
|
+
setProps(this, KupFamilyTreeProps, props);
|
|
119
|
+
}
|
|
120
|
+
/*-------------------------------------------------*/
|
|
121
|
+
/* L i f e c y c l e H o o k s */
|
|
122
|
+
/*-------------------------------------------------*/
|
|
123
|
+
componentWillLoad() {
|
|
124
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logLoad(this, false);
|
|
125
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").language.register(this);
|
|
126
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").theme.register(this);
|
|
127
|
+
}
|
|
128
|
+
componentDidLoad() {
|
|
129
|
+
__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_didLoadInteractables).call(this);
|
|
130
|
+
if (this.autofit) {
|
|
131
|
+
const parentWidth = __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").clientWidth;
|
|
132
|
+
const childWidth = __classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").children[0].clientWidth;
|
|
133
|
+
if (childWidth > parentWidth) {
|
|
134
|
+
__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_autofit).call(this, parentWidth, childWidth);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logLoad(this, true);
|
|
138
|
+
}
|
|
139
|
+
componentWillRender() {
|
|
140
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logRender(this, false);
|
|
141
|
+
}
|
|
142
|
+
componentDidRender() {
|
|
143
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logRender(this, true);
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
return (h(Host, { onDrag: (e) => e.preventDefault(), onPointerDown: (e) => {
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_startPanning).call(this, e);
|
|
149
|
+
}, onWheel: (e) => {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
__classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_zoomTree).call(this, e);
|
|
152
|
+
} }, h("style", null, __classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId }, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_createTree).call(this))));
|
|
153
|
+
}
|
|
154
|
+
disconnectedCallback() {
|
|
155
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").language.unregister(this);
|
|
156
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").theme.unregister(this);
|
|
157
|
+
}
|
|
158
|
+
get rootElement() { return getElement(this); }
|
|
159
|
+
};
|
|
160
|
+
_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) {
|
|
161
|
+
const content = [];
|
|
162
|
+
content.push(h("td", { class: {
|
|
163
|
+
'family-tree__line': true,
|
|
164
|
+
'family-tree__line--right': !first,
|
|
165
|
+
'family-tree__line--top': !first,
|
|
166
|
+
} }, h("div", { class: 'family-tree__line--placeholder' })));
|
|
167
|
+
content.push(h("td", { class: {
|
|
168
|
+
'family-tree__line': true,
|
|
169
|
+
'family-tree__line--left': first,
|
|
170
|
+
'family-tree__line--top': (first && !alone) || (moreTwo && !last),
|
|
171
|
+
} }, h("div", { class: 'family-tree__line--placeholder' })));
|
|
172
|
+
return content;
|
|
173
|
+
}, _KupFamilyTree_buildNode = function _KupFamilyTree_buildNode(node) {
|
|
174
|
+
var _a;
|
|
175
|
+
let children = null;
|
|
176
|
+
let staffChildren = null;
|
|
177
|
+
if (!this.collapsible || (this.collapsible && node.isExpanded)) {
|
|
178
|
+
(_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
|
|
179
|
+
if (child.isStaff) {
|
|
180
|
+
if (!staffChildren) {
|
|
181
|
+
staffChildren = [];
|
|
182
|
+
}
|
|
183
|
+
staffChildren.push(child);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
if (!children) {
|
|
187
|
+
children = [];
|
|
188
|
+
}
|
|
189
|
+
children.push(child);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const span1 = children ? children.length * 2 : 1;
|
|
194
|
+
const styleVLine = {
|
|
195
|
+
'family-tree__line': true,
|
|
196
|
+
'family-tree__line--placeholder': !!(children || staffChildren),
|
|
197
|
+
'family-tree__line--vertical': !!(children || staffChildren),
|
|
198
|
+
};
|
|
199
|
+
const data = {
|
|
200
|
+
columns: [
|
|
201
|
+
{ name: '*TREECOL', title: 'Fake column' },
|
|
202
|
+
...this.data.columns,
|
|
203
|
+
],
|
|
204
|
+
rows: [{ cells: Object.assign({ '*TREECOL': node }, node.cells) }],
|
|
205
|
+
};
|
|
206
|
+
const layout = node.layout || this.layout || null;
|
|
207
|
+
const expandButtonProp = {
|
|
208
|
+
icon: node.isExpanded ? 'remove' : 'plus',
|
|
209
|
+
styling: FButtonStyling.OUTLINED,
|
|
210
|
+
slim: true,
|
|
211
|
+
onClick: () => {
|
|
212
|
+
node.isExpanded = !node.isExpanded;
|
|
213
|
+
this.refresh();
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
const box = (h("div", { class: 'family-tree__item' }, h("div", { class: 'family-tree__item__wrapper' }, 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 }), this.collapsible &&
|
|
217
|
+
node.children &&
|
|
218
|
+
node.children.length > 0 ? (h(FButton, Object.assign({}, expandButtonProp))) : undefined)));
|
|
219
|
+
const staffStyle = {
|
|
220
|
+
['--kup_familytree_staffchildren']: (staffChildren === null || staffChildren === void 0 ? void 0 : staffChildren.length.toString()) || '0',
|
|
221
|
+
};
|
|
222
|
+
//TODO: set data-cell and data-column if needed inside events
|
|
223
|
+
return (h("table", { class: 'family-tree__node' }, h("tr", null, h("td", { "data-row": node, colSpan: span1 }, box)), h("tr", null, h("td", { colSpan: span1 }, h("div", { class: styleVLine }))), staffChildren
|
|
224
|
+
? [
|
|
225
|
+
h("tr", null, h("td", { colSpan: span1 }, h("div", { class: Object.assign(Object.assign({}, styleVLine), { 'family-tree__line--staff': true }), style: staffStyle }), h("div", { class: "family-tree__node__staff", style: staffStyle }, staffChildren.map((inode) => [
|
|
226
|
+
h("div", { class: "family-tree__node__staff__item" }, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, inode)),
|
|
227
|
+
])))),
|
|
228
|
+
]
|
|
229
|
+
: null, staffChildren && children
|
|
230
|
+
? [
|
|
231
|
+
h("tr", null, h("td", { colSpan: span1 }, h("div", { class: styleVLine }))),
|
|
232
|
+
h("tr", null, h("td", { colSpan: span1 }, h("div", { class: styleVLine }))),
|
|
233
|
+
]
|
|
234
|
+
: null, children
|
|
235
|
+
? [
|
|
236
|
+
h("tr", null, children.map((inode) => __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildChildLine).call(this, children.indexOf(inode) == 0, children.indexOf(inode) ==
|
|
237
|
+
children.length - 1, children.length == 1, children.length > 2))),
|
|
238
|
+
h("tr", null, children.map((inode) => (h("td", { colSpan: 2 }, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, inode))))),
|
|
239
|
+
]
|
|
240
|
+
: undefined));
|
|
241
|
+
}, _KupFamilyTree_buildNodes = function _KupFamilyTree_buildNodes(nodes) {
|
|
242
|
+
return nodes.map((node) => __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_buildNode).call(this, node));
|
|
243
|
+
}, _KupFamilyTree_createTree = function _KupFamilyTree_createTree() {
|
|
244
|
+
const emptyData = !this.data || !this.data.rows || !this.data.rows.length;
|
|
245
|
+
return (h("div", { class: "family-tree", onContextMenu: (e) => {
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
}, 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))));
|
|
248
|
+
}, _KupFamilyTree_startPanning = function _KupFamilyTree_startPanning(e) {
|
|
249
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanX, e.clientX, "f");
|
|
250
|
+
__classPrivateFieldSet(this, _KupFamilyTree_currentPanY, e.clientY, "f");
|
|
251
|
+
const endPanning = () => {
|
|
252
|
+
document.removeEventListener('pointermove', __classPrivateFieldGet(this, _KupFamilyTree_moveCb, "f"));
|
|
253
|
+
document.removeEventListener('pointerup', endPanning);
|
|
254
|
+
};
|
|
255
|
+
document.addEventListener('pointermove', __classPrivateFieldGet(this, _KupFamilyTree_moveCb, "f"));
|
|
256
|
+
document.addEventListener('pointerup', endPanning);
|
|
257
|
+
}, _KupFamilyTree_getEventPath = function _KupFamilyTree_getEventPath(currentEl) {
|
|
258
|
+
const path = [];
|
|
259
|
+
while (currentEl &&
|
|
260
|
+
currentEl !== this.rootElement &&
|
|
261
|
+
currentEl !== document.body) {
|
|
262
|
+
path.push(currentEl);
|
|
263
|
+
currentEl = currentEl.parentNode
|
|
264
|
+
? currentEl.parentNode
|
|
265
|
+
: currentEl.host;
|
|
266
|
+
}
|
|
267
|
+
return path;
|
|
268
|
+
}, _KupFamilyTree_getEventDetails = function _KupFamilyTree_getEventDetails(path, e) {
|
|
269
|
+
let td;
|
|
270
|
+
if (path) {
|
|
271
|
+
for (let i = path.length - 1; i >= 0; i--) {
|
|
272
|
+
let p = path[i];
|
|
273
|
+
if (!p.tagName) {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
switch (p.tagName.toUpperCase()) {
|
|
277
|
+
case 'TD': {
|
|
278
|
+
td = p;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
let cell = null, column = null, row = null;
|
|
285
|
+
if (td) {
|
|
286
|
+
cell = td['data-cell'];
|
|
287
|
+
column = td['data-column'];
|
|
288
|
+
row = td['data-row'];
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
cell: cell ? cell : null,
|
|
292
|
+
column: column ? column : null,
|
|
293
|
+
originalEvent: e,
|
|
294
|
+
row: row ? row : null,
|
|
295
|
+
td: td ? td : null,
|
|
296
|
+
};
|
|
297
|
+
}, _KupFamilyTree_clickHandler = function _KupFamilyTree_clickHandler(e) {
|
|
298
|
+
const details = __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventDetails).call(this, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventPath).call(this, e.target), e);
|
|
299
|
+
return details;
|
|
300
|
+
}, _KupFamilyTree_contextMenuHandler = function _KupFamilyTree_contextMenuHandler(e) {
|
|
301
|
+
const details = __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventDetails).call(this, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventPath).call(this, e.target), e);
|
|
302
|
+
return details;
|
|
303
|
+
}, _KupFamilyTree_dblClickHandler = function _KupFamilyTree_dblClickHandler(e) {
|
|
304
|
+
const details = __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventDetails).call(this, __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_getEventPath).call(this, e.target), e);
|
|
305
|
+
return details;
|
|
306
|
+
}, _KupFamilyTree_didLoadInteractables = function _KupFamilyTree_didLoadInteractables() {
|
|
307
|
+
__classPrivateFieldGet(this, _KupFamilyTree_interactableTouch, "f").push(this.rootElement);
|
|
308
|
+
const tapCb = (e) => {
|
|
309
|
+
if (__classPrivateFieldGet(this, _KupFamilyTree_hold, "f")) {
|
|
310
|
+
__classPrivateFieldSet(this, _KupFamilyTree_hold, false, "f");
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
switch (e.button) {
|
|
314
|
+
// left click
|
|
315
|
+
case 0:
|
|
316
|
+
// Note: event must be cloned
|
|
317
|
+
// otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
|
|
318
|
+
const clone = {};
|
|
319
|
+
for (const key in e) {
|
|
320
|
+
clone[key] = e[key];
|
|
321
|
+
}
|
|
322
|
+
__classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f").push(setTimeout(() => {
|
|
323
|
+
this.kupClick.emit({
|
|
324
|
+
comp: this,
|
|
325
|
+
id: this.rootElement.id,
|
|
326
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_clickHandler).call(this, clone),
|
|
327
|
+
});
|
|
328
|
+
}, 300));
|
|
329
|
+
break;
|
|
330
|
+
// right click
|
|
331
|
+
case 2:
|
|
332
|
+
this.kupContextMenu.emit({
|
|
333
|
+
comp: this,
|
|
334
|
+
id: this.rootElement.id,
|
|
335
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_contextMenuHandler).call(this, e),
|
|
336
|
+
});
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
const doubletapCb = (e) => {
|
|
341
|
+
switch (e.button) {
|
|
342
|
+
// left click
|
|
343
|
+
case 0:
|
|
344
|
+
for (let index = 0; index < __classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f").length; index++) {
|
|
345
|
+
clearTimeout(__classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f")[index]);
|
|
346
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").debug.logMessage(this, 'Cleared clickHandler timeout(' +
|
|
347
|
+
__classPrivateFieldGet(this, _KupFamilyTree_clickTimeout, "f")[index] +
|
|
348
|
+
').');
|
|
349
|
+
}
|
|
350
|
+
__classPrivateFieldSet(this, _KupFamilyTree_clickTimeout, [], "f");
|
|
351
|
+
this.kupDblClick.emit({
|
|
352
|
+
comp: this,
|
|
353
|
+
id: this.rootElement.id,
|
|
354
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_dblClickHandler).call(this, e),
|
|
355
|
+
});
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const holdCb = (e) => {
|
|
360
|
+
if (e.pointerType === 'pen' || e.pointerType === 'touch') {
|
|
361
|
+
__classPrivateFieldSet(this, _KupFamilyTree_hold, true, "f");
|
|
362
|
+
this.kupContextMenu.emit({
|
|
363
|
+
comp: this,
|
|
364
|
+
id: this.rootElement.id,
|
|
365
|
+
details: __classPrivateFieldGet(this, _KupFamilyTree_instances, "m", _KupFamilyTree_contextMenuHandler).call(this, e),
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.TAP, tapCb);
|
|
370
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.DOUBLETAP, doubletapCb);
|
|
371
|
+
__classPrivateFieldGet(this, _KupFamilyTree_kupManager, "f").interact.on(this.rootElement, KupPointerEventTypes.HOLD, holdCb);
|
|
372
|
+
}, _KupFamilyTree_zoomTree = function _KupFamilyTree_zoomTree(event) {
|
|
373
|
+
const current = parseFloat(__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.getPropertyValue('--kup_familytree_scale')) || 1;
|
|
374
|
+
const delta = 0.05;
|
|
375
|
+
let value = event.deltaY > 0 ? current - delta : current + delta;
|
|
376
|
+
if (value < delta) {
|
|
377
|
+
value = delta;
|
|
378
|
+
}
|
|
379
|
+
__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.setProperty('--kup_familytree_scale', value.toFixed(2));
|
|
380
|
+
}, _KupFamilyTree_autofit = function _KupFamilyTree_autofit(parentWidth, childWidth) {
|
|
381
|
+
const multiplierStep = 0.01;
|
|
382
|
+
const minWidth = (85 / 100) * parentWidth;
|
|
383
|
+
const maxWidth = (95 / 100) * parentWidth;
|
|
384
|
+
let multiplier = 1;
|
|
385
|
+
let tooManyAttempts = 2000;
|
|
386
|
+
let tempWidth = childWidth;
|
|
387
|
+
while ((tempWidth < minWidth || tempWidth > maxWidth) &&
|
|
388
|
+
tooManyAttempts > 0 &&
|
|
389
|
+
multiplier > multiplierStep) {
|
|
390
|
+
tooManyAttempts--;
|
|
391
|
+
if (tempWidth < minWidth) {
|
|
392
|
+
multiplier = multiplier + multiplierStep;
|
|
393
|
+
}
|
|
394
|
+
else if (tempWidth > maxWidth) {
|
|
395
|
+
multiplier = multiplier - multiplierStep;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
tooManyAttempts = 0;
|
|
399
|
+
}
|
|
400
|
+
tempWidth = childWidth * multiplier;
|
|
401
|
+
}
|
|
402
|
+
__classPrivateFieldGet(this, _KupFamilyTree_wrapperEl, "f").style.setProperty('--kup_familytree_scale', multiplier.toFixed(2));
|
|
403
|
+
};
|
|
404
|
+
KupFamilyTree.style = kupFamilyTreeCss;
|
|
405
|
+
|
|
406
|
+
export { KupFamilyTree as kup_family_tree };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { r as registerInstance, f as forceUpdate, h, H as Host, g as getElement } from './index-ad6ab214.js';
|
|
2
|
-
import { k as kupManagerInstance, _ as FCellTypes, h as KupLanguageGeneric } from './kup-manager-
|
|
3
|
-
import { i as identify, g as getProps, s as setProps } from './utils-
|
|
2
|
+
import { k as kupManagerInstance, _ as FCellTypes, h as KupLanguageGeneric } from './kup-manager-22a475e6.js';
|
|
3
|
+
import { i as identify, g as getProps, s as setProps } from './utils-2c1f4122.js';
|
|
4
4
|
import { c as componentWrapperId } from './GenericVariables-665de00a.js';
|
|
5
|
-
import { F as FCell } from './f-cell-
|
|
5
|
+
import { F as FCell } from './f-cell-7b159a22.js';
|
|
6
6
|
import { F as FTextFieldMDC } from './f-text-field-mdc-d42d3f9e.js';
|
|
7
|
-
import './cell-utils-
|
|
7
|
+
import './cell-utils-cb5d4149.js';
|
|
8
8
|
import './f-checkbox-c51c4a75.js';
|
|
9
|
-
import './f-text-field-
|
|
10
|
-
import './f-image-
|
|
11
|
-
import './f-chip-
|
|
9
|
+
import './f-text-field-41c575eb.js';
|
|
10
|
+
import './f-image-2ab4b9aa.js';
|
|
11
|
+
import './f-chip-c2e4c522.js';
|
|
12
12
|
import './tslib.es6-3eea2234.js';
|
|
13
13
|
import './component-b1bedf1d.js';
|
|
14
14
|
|
|
@@ -22,6 +22,12 @@ var KupFormProps;
|
|
|
22
22
|
KupFormProps["data"] = "Actual data of the form.";
|
|
23
23
|
KupFormProps["layout"] = "How the form will arrange its content.";
|
|
24
24
|
})(KupFormProps || (KupFormProps = {}));
|
|
25
|
+
var KupFormLabelAlignment;
|
|
26
|
+
(function (KupFormLabelAlignment) {
|
|
27
|
+
KupFormLabelAlignment["CENTER"] = "center";
|
|
28
|
+
KupFormLabelAlignment["LEFT"] = "left";
|
|
29
|
+
KupFormLabelAlignment["RIGHT"] = "right";
|
|
30
|
+
})(KupFormLabelAlignment || (KupFormLabelAlignment = {}));
|
|
25
31
|
var KupFormLabelPlacement;
|
|
26
32
|
(function (KupFormLabelPlacement) {
|
|
27
33
|
KupFormLabelPlacement["BOTTOM"] = "bottom";
|
|
@@ -32,7 +38,7 @@ var KupFormLabelPlacement;
|
|
|
32
38
|
KupFormLabelPlacement["TOP"] = "top";
|
|
33
39
|
})(KupFormLabelPlacement || (KupFormLabelPlacement = {}));
|
|
34
40
|
|
|
35
|
-
const kupFormCss = ":host{--kup_form_background_color:var(\n --kup-form-background-color,\n var(--kup-background-color)\n );--kup_form_color:var(--kup-form-color, var(--kup-text-color));--kup_form_font_family:var(--kup-form-font-family, var(--kup-font-family));--kup_form_font_size:var(--kup-form-font-size, var(--kup-font-size));display:block;font-family:var(--kup_form_font_family);font-size:var(--kup_form_font_size)}
|
|
41
|
+
const kupFormCss = ":host{--kup_form_background_color:var(\n --kup-form-background-color,\n var(--kup-background-color)\n );--kup_form_color:var(--kup-form-color, var(--kup-text-color));--kup_form_font_family:var(--kup-form-font-family, var(--kup-font-family));--kup_form_font_size:var(--kup-form-font-size, var(--kup-font-size));--kup_form_label_alignment:var(--kup-form-label-alignment);--kup_form_label_width:var(--kup-form-label-width);display:block;font-family:var(--kup_form_font_family);font-size:var(--kup_form_font_size)}.form{background:var(--kup_form_background_color);color:var(--kup_form_color);display:flex;flex-grow:1;overflow:auto;position:relative}.form--column{flex-direction:column}.form__section{display:flex;flex:1 1 1%;flex-direction:row;flex-wrap:wrap}.form__section--column{flex-direction:column;flex-wrap:unset}.form__section--column>.form__section{flex:0 0 auto}.form__section--grid{display:grid}.form__section--titled{border:1px solid var(--kup-border-color);padding-top:5px;position:relative;margin:10px}.form__section--titled>h3{background:var(--kup-background-color);font-size:calc(var(--kup-font-size) * 1.15);position:absolute;margin:0px;padding:0 8px;top:-11px;left:5px;transition:background-color 0.25s ease}.form__section--left .form__label{width:var(--kup_form_label_width, 0)}.form__section--right .form__field{min-width:200px;width:0}.form__label{-webkit-font-smoothing:antialiased;box-sizing:border-box;font-size:0.875em;letter-spacing:0.0178571429em;white-space:nowrap;width:var(--kup_form_label_width)}.form__label--center{text-align:var(--kup_form_label_alignment, center)}.form__label--left{text-align:var(--kup_form_label_alignment, left)}.form__label--right{text-align:var(--kup_form_label_alignment, right)}.form__field{min-height:16px}.form__field img{height:auto}.form .f-cell.c-right-aligned:not(.c-centered) .f-cell__content{justify-content:flex-start}";
|
|
36
42
|
|
|
37
43
|
const dom = document.documentElement;
|
|
38
44
|
const KupForm = class {
|
|
@@ -52,11 +58,6 @@ const KupForm = class {
|
|
|
52
58
|
* @default null
|
|
53
59
|
*/
|
|
54
60
|
this.data = null;
|
|
55
|
-
/**
|
|
56
|
-
* Placement of fields' labels.
|
|
57
|
-
* @default KupFormLabelPlacement.LEFT
|
|
58
|
-
*/
|
|
59
|
-
this.labelPlacement = KupFormLabelPlacement.LEFT;
|
|
60
61
|
/**
|
|
61
62
|
* How the form will arrange its content.
|
|
62
63
|
* @default null
|
|
@@ -203,6 +204,7 @@ const KupForm = class {
|
|
|
203
204
|
return h("form", { class: classObj }, formContent);
|
|
204
205
|
}
|
|
205
206
|
renderSection(section, parent, row, visibleColumns) {
|
|
207
|
+
var _a;
|
|
206
208
|
let sectionContent = null;
|
|
207
209
|
if (section.sections && section.sections.length > 0) {
|
|
208
210
|
const sections = section.sections;
|
|
@@ -227,7 +229,7 @@ const KupForm = class {
|
|
|
227
229
|
formField: content[cnt++],
|
|
228
230
|
row,
|
|
229
231
|
visibleColumns,
|
|
230
|
-
},
|
|
232
|
+
}, section);
|
|
231
233
|
let field = formField;
|
|
232
234
|
if (!section.horizontal) {
|
|
233
235
|
field = h("tr", null, formField);
|
|
@@ -244,12 +246,14 @@ const KupForm = class {
|
|
|
244
246
|
});
|
|
245
247
|
}
|
|
246
248
|
const isGrid = !!section.columns;
|
|
249
|
+
const labelPlacement = ((_a = section === null || section === void 0 ? void 0 : section.label) === null || _a === void 0 ? void 0 : _a.placement) || KupFormLabelPlacement.LEFT;
|
|
247
250
|
const sectionClass = {
|
|
248
251
|
form__section: true,
|
|
249
252
|
'form__section--column': !isGrid && !section.horizontal,
|
|
250
253
|
'form__section--grid': isGrid,
|
|
251
254
|
'form__section--titled': !!section.title,
|
|
252
255
|
'form__section--last': !section.sections || section.sections.length === 0,
|
|
256
|
+
[`form__section--${labelPlacement}`]: true,
|
|
253
257
|
};
|
|
254
258
|
const sectionStyle = section.style || {};
|
|
255
259
|
if (section.dim && parent) {
|
|
@@ -266,7 +270,8 @@ const KupForm = class {
|
|
|
266
270
|
}
|
|
267
271
|
return (h("div", { class: sectionClass, style: sectionStyle }, section.title ? h("h3", null, section.title) : null, h("table", null, h("tbody", null, section.horizontal ? (h("tr", null, sectionContent)) : (sectionContent)))));
|
|
268
272
|
}
|
|
269
|
-
renderFormField({ formField, row, visibleColumns, },
|
|
273
|
+
renderFormField({ formField, row, visibleColumns, }, section) {
|
|
274
|
+
var _a;
|
|
270
275
|
const classObj = {
|
|
271
276
|
form__field: true,
|
|
272
277
|
};
|
|
@@ -284,7 +289,7 @@ const KupForm = class {
|
|
|
284
289
|
column = visibleColumns[index];
|
|
285
290
|
visibleColumns.splice(index, 1);
|
|
286
291
|
}
|
|
287
|
-
else if (
|
|
292
|
+
else if (section) {
|
|
288
293
|
column = this.data.columns.find((x) => x.name === formField.column);
|
|
289
294
|
}
|
|
290
295
|
const cell = row.cells[formField.column];
|
|
@@ -307,7 +312,7 @@ const KupForm = class {
|
|
|
307
312
|
return null;
|
|
308
313
|
}
|
|
309
314
|
const cellProps = {
|
|
310
|
-
cell: cell,
|
|
315
|
+
cell: formField.data ? Object.assign(Object.assign({}, cell), { data: formField.data }) : cell,
|
|
311
316
|
column: column,
|
|
312
317
|
component: this,
|
|
313
318
|
editable: true,
|
|
@@ -316,14 +321,15 @@ const KupForm = class {
|
|
|
316
321
|
setSizes: true,
|
|
317
322
|
shape: formField.shape,
|
|
318
323
|
};
|
|
324
|
+
const label = formField.label || column.title;
|
|
319
325
|
resetLabel();
|
|
320
|
-
switch (
|
|
326
|
+
switch ((_a = section.label) === null || _a === void 0 ? void 0 : _a.placement) {
|
|
321
327
|
case KupFormLabelPlacement.BOTTOM:
|
|
322
|
-
return [h("tr", null, fieldCell()), h("tr", null, labelCell())];
|
|
328
|
+
return [h("tr", null, fieldCell()), h("tr", null, labelCell(label))];
|
|
323
329
|
case KupFormLabelPlacement.PLACEHOLDER:
|
|
324
330
|
setPlaceholderLabel();
|
|
325
331
|
case KupFormLabelPlacement.HIDDEN: {
|
|
326
|
-
if (
|
|
332
|
+
if (section) {
|
|
327
333
|
return [fieldCell()];
|
|
328
334
|
}
|
|
329
335
|
else {
|
|
@@ -331,24 +337,24 @@ const KupForm = class {
|
|
|
331
337
|
}
|
|
332
338
|
}
|
|
333
339
|
case KupFormLabelPlacement.RIGHT: {
|
|
334
|
-
if (
|
|
335
|
-
return [fieldCell(), labelCell()];
|
|
340
|
+
if (section) {
|
|
341
|
+
return [fieldCell(), labelCell(label)];
|
|
336
342
|
}
|
|
337
343
|
else {
|
|
338
344
|
return [
|
|
339
|
-
h("tr", null, fieldCell(), labelCell()),
|
|
345
|
+
h("tr", null, fieldCell(), labelCell(label)),
|
|
340
346
|
];
|
|
341
347
|
}
|
|
342
348
|
}
|
|
343
349
|
case KupFormLabelPlacement.TOP:
|
|
344
|
-
return [h("tr", null, labelCell()), h("tr", null, fieldCell())];
|
|
350
|
+
return [h("tr", null, labelCell(label)), h("tr", null, fieldCell())];
|
|
345
351
|
default: {
|
|
346
|
-
if (
|
|
347
|
-
return [labelCell(), fieldCell()];
|
|
352
|
+
if (section) {
|
|
353
|
+
return [labelCell(label), fieldCell()];
|
|
348
354
|
}
|
|
349
355
|
else {
|
|
350
356
|
return [
|
|
351
|
-
h("tr", null, labelCell(), fieldCell()),
|
|
357
|
+
h("tr", null, labelCell(label), fieldCell()),
|
|
352
358
|
];
|
|
353
359
|
}
|
|
354
360
|
}
|
|
@@ -356,8 +362,13 @@ const KupForm = class {
|
|
|
356
362
|
function fieldCell() {
|
|
357
363
|
return (h("td", { "data-cell": cell, "data-row": row, "data-column": formField.column, class: classObj, style: styleObj, title: title }, cell && column ? (h(FCell, Object.assign({}, cellProps))) : (h("span", null, formField.value))));
|
|
358
364
|
}
|
|
359
|
-
function labelCell() {
|
|
360
|
-
|
|
365
|
+
function labelCell(label) {
|
|
366
|
+
var _a, _b, _c;
|
|
367
|
+
const alignment = ((_a = section === null || section === void 0 ? void 0 : section.label) === null || _a === void 0 ? void 0 : _a.alignment) || KupFormLabelAlignment.LEFT;
|
|
368
|
+
const style = {
|
|
369
|
+
width: ((_b = section === null || section === void 0 ? void 0 : section.label) === null || _b === void 0 ? void 0 : _b.width) ? (_c = section === null || section === void 0 ? void 0 : section.label) === null || _c === void 0 ? void 0 : _c.width : '',
|
|
370
|
+
};
|
|
371
|
+
return (h("td", { class: `form__label form__label--${alignment}`, style: style }, h("span", null, label)));
|
|
361
372
|
}
|
|
362
373
|
function resetLabel() {
|
|
363
374
|
if (!cell.data) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-ad6ab214.js';
|
|
2
|
-
import { k as kupManagerInstance, c as KupDebugCategory } from './kup-manager-
|
|
3
|
-
import { g as getProps, s as setProps } from './utils-
|
|
2
|
+
import { k as kupManagerInstance, c as KupDebugCategory } from './kup-manager-22a475e6.js';
|
|
3
|
+
import { g as getProps, s as setProps } from './utils-2c1f4122.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Props of the kup-iframe component.
|