@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
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Component, Element, forceUpdate, h, Host, Method, Prop, State, Event, Watch, } from '@stencil/core';
|
|
2
2
|
import { FButton } from '../../f-components/f-button/f-button';
|
|
3
|
+
import { FCheckbox } from '../../f-components/f-checkbox/f-checkbox';
|
|
4
|
+
import { FTextField } from '../../f-components/f-text-field/f-text-field';
|
|
5
|
+
import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
|
|
3
6
|
import { KupDebugCategory } from '../../managers/kup-debug/kup-debug-declarations';
|
|
4
7
|
import { KupDragEffect } from '../../managers/kup-interact/kup-interact-declarations';
|
|
5
|
-
import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
|
|
8
|
+
import { KupLanguageDashboard, KupLanguageGeneric, } from '../../managers/kup-language/kup-language-declarations';
|
|
6
9
|
import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
|
|
7
10
|
import { getProps, setProps } from '../../utils/utils';
|
|
8
11
|
import { componentWrapperId } from '../../variables/GenericVariables';
|
|
9
|
-
import {
|
|
10
|
-
export class
|
|
12
|
+
import { KupDashboardProps, } from './kup-dashboard-declarations';
|
|
13
|
+
export class KupDashboard {
|
|
11
14
|
constructor() {
|
|
12
15
|
/*-------------------------------------------------*/
|
|
13
16
|
/* S t a t e s */
|
|
@@ -27,9 +30,14 @@ export class KupFormEditor {
|
|
|
27
30
|
this.customStyle = '';
|
|
28
31
|
/**
|
|
29
32
|
* The data of the component.
|
|
30
|
-
* @default
|
|
33
|
+
* @default null
|
|
31
34
|
*/
|
|
32
35
|
this.data = null;
|
|
36
|
+
/**
|
|
37
|
+
* Enable drag & drop of the section.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
this.enableDesign = false;
|
|
33
41
|
/*-------------------------------------------------*/
|
|
34
42
|
/* I n t e r n a l V a r i a b l e s */
|
|
35
43
|
/*-------------------------------------------------*/
|
|
@@ -37,10 +45,6 @@ export class KupFormEditor {
|
|
|
37
45
|
* Instance of the KupManager class.
|
|
38
46
|
*/
|
|
39
47
|
this.kupManager = kupManagerInstance();
|
|
40
|
-
/**
|
|
41
|
-
* Draggable type of Form (Components or Sections).
|
|
42
|
-
*/
|
|
43
|
-
this.dragType = KupFormEditorDragTypes.Components;
|
|
44
48
|
/**
|
|
45
49
|
* Internal data of the component.
|
|
46
50
|
*/
|
|
@@ -72,7 +76,7 @@ export class KupFormEditor {
|
|
|
72
76
|
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
73
77
|
*/
|
|
74
78
|
async getProps(descriptions) {
|
|
75
|
-
return getProps(this,
|
|
79
|
+
return getProps(this, KupDashboardProps, descriptions);
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* This method is used to trigger a new render of the component.
|
|
@@ -85,15 +89,21 @@ export class KupFormEditor {
|
|
|
85
89
|
* @param {GenericObject} props - Object containing props that will be set to the component.
|
|
86
90
|
*/
|
|
87
91
|
async setProps(props) {
|
|
88
|
-
setProps(this,
|
|
92
|
+
setProps(this, KupDashboardProps, props);
|
|
89
93
|
}
|
|
90
94
|
/*-------------------------------------------------*/
|
|
91
95
|
/* P r i v a t e M e t h o d s */
|
|
92
96
|
/*-------------------------------------------------*/
|
|
97
|
+
buildGuid() {
|
|
98
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
99
|
+
var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
100
|
+
return v.toString(16);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
93
103
|
buildHeader() {
|
|
94
104
|
const clearButtonProp = {
|
|
95
105
|
icon: 'cancel',
|
|
96
|
-
label:
|
|
106
|
+
label: this.kupManager.language.translate(KupLanguageDashboard.RESET),
|
|
97
107
|
secondary: true,
|
|
98
108
|
onClick: () => {
|
|
99
109
|
this.resetData();
|
|
@@ -101,41 +111,24 @@ export class KupFormEditor {
|
|
|
101
111
|
};
|
|
102
112
|
const saveButtonProp = {
|
|
103
113
|
icon: 'save',
|
|
104
|
-
label:
|
|
114
|
+
label: this.kupManager.language.translate(KupLanguageDashboard.SAVE),
|
|
105
115
|
onClick: () => this.onKupSave(),
|
|
106
116
|
};
|
|
107
|
-
const selRadioProp = [
|
|
108
|
-
{
|
|
109
|
-
label: KupFormEditorLabels.Components,
|
|
110
|
-
value: KupFormEditorDragTypes.Components,
|
|
111
|
-
checked: this.dragType == KupFormEditorDragTypes.Components,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
label: KupFormEditorLabels.Sections,
|
|
115
|
-
value: KupFormEditorDragTypes.Sections,
|
|
116
|
-
checked: this.dragType == KupFormEditorDragTypes.Sections,
|
|
117
|
-
},
|
|
118
|
-
];
|
|
119
117
|
return (h("div", { class: "header" },
|
|
120
|
-
h(
|
|
121
|
-
|
|
122
|
-
.value;
|
|
123
|
-
this.resetData(this.internalData);
|
|
124
|
-
} }),
|
|
125
|
-
h(FButton, Object.assign({}, clearButtonProp)),
|
|
126
|
-
h(FButton, Object.assign({}, saveButtonProp))));
|
|
118
|
+
this.enableDesign ? (h(FButton, Object.assign({}, clearButtonProp))) : undefined,
|
|
119
|
+
this.enableDesign ? (h(FButton, Object.assign({}, saveButtonProp))) : undefined));
|
|
127
120
|
}
|
|
128
121
|
buildForm(form, parent) {
|
|
129
122
|
const classes = {
|
|
130
123
|
form: true,
|
|
131
124
|
'layout-column': form && form.layout == 'column',
|
|
132
125
|
'layout-row': form && form.layout == 'row',
|
|
133
|
-
'form-dropzone':
|
|
134
|
-
|
|
126
|
+
'form-dropzone': this.enableDesign &&
|
|
127
|
+
form &&
|
|
135
128
|
form.sections != null &&
|
|
136
129
|
form.sections.length > 0,
|
|
137
130
|
};
|
|
138
|
-
return form ? (h("div", { class: classes, ref: (el) => {
|
|
131
|
+
return form ? (h("div", { class: classes, style: this.getGridStyle(form), ref: (el) => {
|
|
139
132
|
if (!el)
|
|
140
133
|
return;
|
|
141
134
|
const kel = el;
|
|
@@ -143,6 +136,15 @@ export class KupFormEditor {
|
|
|
143
136
|
} }, form.sections.map((section) => this.buildSection(section, form)))) : (h("div", null, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA)));
|
|
144
137
|
}
|
|
145
138
|
buildSectionHeader(section, parent) {
|
|
139
|
+
const dimTextFieldProp = {
|
|
140
|
+
value: section.dim,
|
|
141
|
+
label: this.kupManager.language.translate(KupLanguageDashboard.DIMENSION),
|
|
142
|
+
onChange: (e) => {
|
|
143
|
+
const { target } = e;
|
|
144
|
+
section.dim = target.value;
|
|
145
|
+
this.refresh();
|
|
146
|
+
},
|
|
147
|
+
};
|
|
146
148
|
const addButtonProp = {
|
|
147
149
|
icon: 'add',
|
|
148
150
|
slim: true,
|
|
@@ -154,12 +156,7 @@ export class KupFormEditor {
|
|
|
154
156
|
id: section.id + (section.sections.length + 1),
|
|
155
157
|
loaded: section.loaded,
|
|
156
158
|
layout: section.layout,
|
|
157
|
-
components: [],
|
|
158
159
|
};
|
|
159
|
-
if (section.components) {
|
|
160
|
-
section.components.forEach((x) => newSec.components.push(x));
|
|
161
|
-
section.components.splice(0);
|
|
162
|
-
}
|
|
163
160
|
section.sections.push(newSec);
|
|
164
161
|
this.resetData(this.internalData);
|
|
165
162
|
},
|
|
@@ -174,97 +171,85 @@ export class KupFormEditor {
|
|
|
174
171
|
this.resetData(this.internalData);
|
|
175
172
|
},
|
|
176
173
|
};
|
|
174
|
+
const loadedCheckBoxProp = {
|
|
175
|
+
checked: section.loaded,
|
|
176
|
+
label: this.kupManager.language.translate(KupLanguageDashboard.LOADED),
|
|
177
|
+
onChange: () => {
|
|
178
|
+
section.loaded = !section.loaded;
|
|
179
|
+
this.refresh();
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
const columnCheckBoxProp = {
|
|
183
|
+
checked: section.layout == 'column',
|
|
184
|
+
label: this.kupManager.language.translate(KupLanguageDashboard.VERTICAL),
|
|
185
|
+
onChange: () => {
|
|
186
|
+
section.layout = section.layout == 'column' ? 'row' : 'column';
|
|
187
|
+
this.refresh();
|
|
188
|
+
},
|
|
189
|
+
};
|
|
177
190
|
return (h("div", { class: "section-header" },
|
|
178
191
|
h("div", null,
|
|
179
192
|
section.id,
|
|
180
|
-
|
|
181
|
-
section.dim ? '(' + section.dim + ')' : undefined,
|
|
182
|
-
" -",
|
|
183
|
-
' ',
|
|
193
|
+
" - ",
|
|
184
194
|
section.layout),
|
|
185
195
|
h("div", null,
|
|
186
196
|
h("div", { class: "section-header-actions" },
|
|
187
|
-
h(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
h("kup-switch", { checked: section.layout == 'column', label: KupFormEditorLabels.Column, "onKup-switch-change": (ev) => {
|
|
191
|
-
section.layout =
|
|
192
|
-
ev.detail.value == 'on' ? 'column' : 'row';
|
|
193
|
-
this.resetData(this.internalData);
|
|
194
|
-
} }),
|
|
197
|
+
h(FTextField, Object.assign({}, dimTextFieldProp)),
|
|
198
|
+
h(FCheckbox, Object.assign({}, loadedCheckBoxProp)),
|
|
199
|
+
h(FCheckbox, Object.assign({}, columnCheckBoxProp)),
|
|
195
200
|
h(FButton, Object.assign({}, addButtonProp)),
|
|
196
|
-
h(FButton, Object.assign({}, removeButtonProp))
|
|
197
|
-
section.components && section.components.length > 0 ? (h("kup-image", { resource: "widgets", sizeX: "24px", sizeY: "24px" })) : undefined))));
|
|
201
|
+
h(FButton, Object.assign({}, removeButtonProp))))));
|
|
198
202
|
}
|
|
199
203
|
buildSection(section, parent) {
|
|
200
204
|
const classes = {
|
|
201
205
|
section: true,
|
|
202
|
-
'section-draggable': this.
|
|
203
|
-
'section-dropzone':
|
|
204
|
-
section.sections.length == 0 ||
|
|
205
|
-
this.dragType == KupFormEditorDragTypes.Sections,
|
|
206
|
+
'section-draggable': this.enableDesign,
|
|
207
|
+
'section-dropzone': this.enableDesign,
|
|
206
208
|
};
|
|
207
209
|
const bodyClasses = {
|
|
208
210
|
'section-body': true,
|
|
209
211
|
'layout-column': section && section.layout == 'column',
|
|
210
212
|
'layout-row': section && section.layout == 'row',
|
|
211
213
|
};
|
|
212
|
-
let bodyStyles = {};
|
|
213
|
-
if (section.sections) {
|
|
214
|
-
let gridTemplate = '';
|
|
215
|
-
section.sections.forEach((childSection) => {
|
|
216
|
-
if (!childSection.dim)
|
|
217
|
-
gridTemplate += ' 1fr';
|
|
218
|
-
else
|
|
219
|
-
gridTemplate +=
|
|
220
|
-
childSection.dim.indexOf('%') < 0
|
|
221
|
-
? ' ' + childSection.dim + 'px'
|
|
222
|
-
: ' ' + childSection.dim;
|
|
223
|
-
});
|
|
224
|
-
if (section.layout == 'column')
|
|
225
|
-
bodyStyles['gridTemplateRows'] = gridTemplate;
|
|
226
|
-
if (section.layout == 'row')
|
|
227
|
-
bodyStyles['gridTemplateColumns'] = gridTemplate;
|
|
228
|
-
}
|
|
229
214
|
return (h("div", { class: classes, ref: (el) => {
|
|
230
215
|
if (!el)
|
|
231
216
|
return;
|
|
232
217
|
const kel = el;
|
|
233
218
|
kel.kupData = { parent: parent, section: section };
|
|
234
219
|
} },
|
|
235
|
-
this.
|
|
220
|
+
this.enableDesign
|
|
236
221
|
? this.buildSectionHeader(section, parent)
|
|
237
222
|
: undefined,
|
|
238
|
-
h("div", { class: bodyClasses, style:
|
|
239
|
-
this.
|
|
240
|
-
section.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return;
|
|
244
|
-
const kel = el;
|
|
245
|
-
kel.kupData = {
|
|
246
|
-
section: section,
|
|
247
|
-
componnent: component,
|
|
248
|
-
};
|
|
249
|
-
} },
|
|
250
|
-
component.id,
|
|
251
|
-
" - ",
|
|
252
|
-
component.type,
|
|
253
|
-
h("kup-switch", { checked: component.loaded, label: KupFormEditorLabels.Loaded, "onKup-switch-change": (ev) => {
|
|
254
|
-
component.loaded =
|
|
255
|
-
ev.detail.value == 'on';
|
|
256
|
-
} }))))
|
|
257
|
-
: undefined,
|
|
258
|
-
section.sections
|
|
223
|
+
h("div", { class: bodyClasses, style: this.getGridStyle(section) },
|
|
224
|
+
!this.enableDesign &&
|
|
225
|
+
section.loaded &&
|
|
226
|
+
(!section.sections || section.sections.length == 0) ? (h("slot", { name: section.id })) : undefined,
|
|
227
|
+
section.sections && (section.loaded || this.enableDesign)
|
|
259
228
|
? section.sections.map((childSection) => this.buildSection(childSection, section))
|
|
260
229
|
: undefined)));
|
|
261
230
|
}
|
|
231
|
+
calcSectionPosition(pointerY, pointerX, vertical, sectionCount, elements) {
|
|
232
|
+
let idx = sectionCount;
|
|
233
|
+
for (let index = 0; index < elements.length; index++) {
|
|
234
|
+
const element = elements[index];
|
|
235
|
+
const srect = element.getBoundingClientRect();
|
|
236
|
+
if (vertical && pointerY < srect.y) {
|
|
237
|
+
idx = index;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
else if (!vertical && pointerX < srect.x) {
|
|
241
|
+
idx = index;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
//console.log(
|
|
246
|
+
// `pointer: ${pointerX}:${pointerY} - vertical: ${vertical} - index: ${idx}`
|
|
247
|
+
//);
|
|
248
|
+
return idx;
|
|
249
|
+
}
|
|
262
250
|
didRenderInteractables() {
|
|
263
251
|
try {
|
|
264
252
|
const items = [];
|
|
265
|
-
this.rootElement.shadowRoot
|
|
266
|
-
.querySelectorAll('.component-draggable')
|
|
267
|
-
.forEach((x) => items.push(x));
|
|
268
253
|
this.rootElement.shadowRoot
|
|
269
254
|
.querySelectorAll('.section-draggable')
|
|
270
255
|
.forEach((x) => items.push(x));
|
|
@@ -284,10 +269,17 @@ export class KupFormEditor {
|
|
|
284
269
|
.querySelectorAll('.form-dropzone')
|
|
285
270
|
.forEach((x) => items.push(x));
|
|
286
271
|
items.forEach((item) => {
|
|
287
|
-
this.kupManager.interact.dropzone(item,
|
|
272
|
+
this.kupManager.interact.dropzone(item, {
|
|
273
|
+
ondropdeactivate: () => {
|
|
274
|
+
this.removeSectionPlaceHolder();
|
|
275
|
+
},
|
|
276
|
+
ondropmove: (ev) => {
|
|
277
|
+
this.removeSectionPlaceHolder();
|
|
278
|
+
this.dragEnter(ev.dragEvent.clientY, ev.dragEvent.clientX, ev.currentTarget);
|
|
279
|
+
},
|
|
280
|
+
}, null, {
|
|
288
281
|
drop: (ev) => {
|
|
289
|
-
ev.currentTarget
|
|
290
|
-
this.dropped(ev.currentTarget, ev.relatedTarget);
|
|
282
|
+
this.dropped(ev, ev.currentTarget, ev.relatedTarget);
|
|
291
283
|
},
|
|
292
284
|
});
|
|
293
285
|
});
|
|
@@ -296,45 +288,84 @@ export class KupFormEditor {
|
|
|
296
288
|
this.kupManager.debug.logMessage(this, error, KupDebugCategory.ERROR);
|
|
297
289
|
}
|
|
298
290
|
}
|
|
299
|
-
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
parent.kupData.
|
|
304
|
-
|
|
291
|
+
dragEnter(clientY, clientX, parent) {
|
|
292
|
+
if (parent.kupData.form) {
|
|
293
|
+
// form is the target of drop.
|
|
294
|
+
// calculate a new position for the section.
|
|
295
|
+
const nidx = this.calcSectionPosition(clientY, clientX, parent.kupData.form.layout == 'column', parent.kupData.form.sections.length, parent.children);
|
|
296
|
+
// set placeholder into target area.
|
|
297
|
+
this.setSectionPlaceHolder(parent, nidx);
|
|
305
298
|
}
|
|
306
|
-
else if (
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
child.kupData.
|
|
299
|
+
else if (parent.kupData.section) {
|
|
300
|
+
// section is the target of drop.
|
|
301
|
+
// calculate a new position for the section.
|
|
302
|
+
const nidx = this.calcSectionPosition(clientY, clientX, parent.kupData.section.layout == 'column', parent.kupData.section.sections.length, parent.lastElementChild.children);
|
|
303
|
+
// set placeholder into target area.
|
|
304
|
+
this.setSectionPlaceHolder(parent.lastElementChild, nidx);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
dropped(event, parent, child) {
|
|
308
|
+
const idx = child.kupData.parent.sections.indexOf(child.kupData.section);
|
|
309
|
+
child.kupData.parent.sections.splice(idx, 1);
|
|
310
|
+
if (parent.kupData.form) {
|
|
311
|
+
// form is the target of drop.
|
|
312
|
+
if (!parent.kupData.form.sections)
|
|
313
|
+
parent.kupData.form.sections = [];
|
|
314
|
+
// calculate a new position for the section.
|
|
315
|
+
const nidx = this.calcSectionPosition(event.dragEvent.clientY, event.dragEvent.clientX, parent.kupData.form.layout == 'column', parent.kupData.form.sections.length, parent.children);
|
|
316
|
+
// set the section in 'nidx' position.
|
|
317
|
+
parent.kupData.form.sections.splice(nidx, 0, child.kupData.section);
|
|
318
|
+
child.kupData.parent = parent.kupData.form;
|
|
319
|
+
}
|
|
320
|
+
else if (parent.kupData.section) {
|
|
321
|
+
// section is the target of drop.
|
|
322
|
+
if (!parent.kupData.section.sections ||
|
|
323
|
+
parent.kupData.section.sections.length == 0) {
|
|
324
|
+
// if the section target of drop doesn't contains other sections, i create a wrapper that will contain target section and dragged section.
|
|
325
|
+
const newSec = JSON.parse(JSON.stringify(parent.kupData.section));
|
|
326
|
+
newSec.dim = null;
|
|
327
|
+
child.kupData.section.dim = null;
|
|
328
|
+
parent.kupData.section.id = this.buildGuid();
|
|
329
|
+
parent.kupData.section.sections = [];
|
|
330
|
+
parent.kupData.section.sections.push(newSec);
|
|
335
331
|
}
|
|
336
|
-
|
|
332
|
+
// calculate a new position for the section.
|
|
333
|
+
const nidx = this.calcSectionPosition(event.dragEvent.clientY, event.dragEvent.clientX, parent.kupData.section.layout == 'column', parent.kupData.section.sections.length, parent.lastElementChild.children);
|
|
334
|
+
// set the section in 'nidx' position.
|
|
335
|
+
parent.kupData.section.sections.splice(nidx, 0, child.kupData.section);
|
|
336
|
+
child.kupData.parent = parent.kupData.section;
|
|
337
337
|
}
|
|
338
|
+
this.resetData(this.internalData);
|
|
339
|
+
}
|
|
340
|
+
getGridStyle(entity) {
|
|
341
|
+
let bodyStyles = {};
|
|
342
|
+
if (entity.sections) {
|
|
343
|
+
let gridTemplate = '';
|
|
344
|
+
entity.sections.forEach((childSection) => {
|
|
345
|
+
if (this.enableDesign || !childSection.dim)
|
|
346
|
+
gridTemplate += ' 1fr';
|
|
347
|
+
else
|
|
348
|
+
gridTemplate +=
|
|
349
|
+
childSection.dim.indexOf('%') < 0
|
|
350
|
+
? ' ' + childSection.dim + 'px'
|
|
351
|
+
: ' ' + childSection.dim;
|
|
352
|
+
});
|
|
353
|
+
if (entity.layout == 'column')
|
|
354
|
+
bodyStyles['gridTemplateRows'] = gridTemplate;
|
|
355
|
+
if (entity.layout == 'row')
|
|
356
|
+
bodyStyles['gridTemplateColumns'] = gridTemplate;
|
|
357
|
+
}
|
|
358
|
+
return bodyStyles;
|
|
359
|
+
}
|
|
360
|
+
setSectionPlaceHolder(element, index) {
|
|
361
|
+
const ph = document.createElement('div');
|
|
362
|
+
ph.className = 'section-placeholder';
|
|
363
|
+
element.insertBefore(ph, element.childNodes[index]);
|
|
364
|
+
}
|
|
365
|
+
removeSectionPlaceHolder() {
|
|
366
|
+
const ph = this.rootElement.shadowRoot.querySelector('.section-placeholder');
|
|
367
|
+
if (ph)
|
|
368
|
+
ph.parentElement.removeChild(ph);
|
|
338
369
|
}
|
|
339
370
|
resetData(form = null) {
|
|
340
371
|
if (form)
|
|
@@ -349,7 +380,6 @@ export class KupFormEditor {
|
|
|
349
380
|
}, 250);
|
|
350
381
|
}
|
|
351
382
|
unregisterInteractables() {
|
|
352
|
-
this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.component-draggable')));
|
|
353
383
|
this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-dropzone')));
|
|
354
384
|
this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-draggable')));
|
|
355
385
|
this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.form-dropzone')));
|
|
@@ -377,6 +407,14 @@ export class KupFormEditor {
|
|
|
377
407
|
}
|
|
378
408
|
componentDidRender() {
|
|
379
409
|
this.kupManager.debug.logRender(this, true);
|
|
410
|
+
const root = this.rootElement.shadowRoot;
|
|
411
|
+
if (root) {
|
|
412
|
+
const fields = root.querySelectorAll('.f-text-field');
|
|
413
|
+
if (fields)
|
|
414
|
+
fields.forEach((f) => {
|
|
415
|
+
FTextFieldMDC(f);
|
|
416
|
+
});
|
|
417
|
+
}
|
|
380
418
|
this.didRenderInteractables();
|
|
381
419
|
}
|
|
382
420
|
render() {
|
|
@@ -392,13 +430,13 @@ export class KupFormEditor {
|
|
|
392
430
|
this.kupManager.language.unregister(this);
|
|
393
431
|
this.kupManager.theme.unregister(this);
|
|
394
432
|
}
|
|
395
|
-
static get is() { return "kup-
|
|
433
|
+
static get is() { return "kup-dashboard"; }
|
|
396
434
|
static get encapsulation() { return "shadow"; }
|
|
397
435
|
static get originalStyleUrls() { return {
|
|
398
|
-
"$": ["kup-
|
|
436
|
+
"$": ["kup-dashboard.scss"]
|
|
399
437
|
}; }
|
|
400
438
|
static get styleUrls() { return {
|
|
401
|
-
"$": ["kup-
|
|
439
|
+
"$": ["kup-dashboard.css"]
|
|
402
440
|
}; }
|
|
403
441
|
static get properties() { return {
|
|
404
442
|
"customStyle": {
|
|
@@ -429,12 +467,12 @@ export class KupFormEditor {
|
|
|
429
467
|
"type": "unknown",
|
|
430
468
|
"mutable": false,
|
|
431
469
|
"complexType": {
|
|
432
|
-
"original": "
|
|
433
|
-
"resolved": "
|
|
470
|
+
"original": "KupDataDashboard",
|
|
471
|
+
"resolved": "KupDataDashboard",
|
|
434
472
|
"references": {
|
|
435
|
-
"
|
|
473
|
+
"KupDataDashboard": {
|
|
436
474
|
"location": "import",
|
|
437
|
-
"path": "./kup-
|
|
475
|
+
"path": "./kup-dashboard-declarations"
|
|
438
476
|
}
|
|
439
477
|
}
|
|
440
478
|
},
|
|
@@ -443,11 +481,32 @@ export class KupFormEditor {
|
|
|
443
481
|
"docs": {
|
|
444
482
|
"tags": [{
|
|
445
483
|
"name": "default",
|
|
446
|
-
"text": "
|
|
484
|
+
"text": "null"
|
|
447
485
|
}],
|
|
448
486
|
"text": "The data of the component."
|
|
449
487
|
},
|
|
450
488
|
"defaultValue": "null"
|
|
489
|
+
},
|
|
490
|
+
"enableDesign": {
|
|
491
|
+
"type": "boolean",
|
|
492
|
+
"mutable": false,
|
|
493
|
+
"complexType": {
|
|
494
|
+
"original": "boolean",
|
|
495
|
+
"resolved": "boolean",
|
|
496
|
+
"references": {}
|
|
497
|
+
},
|
|
498
|
+
"required": false,
|
|
499
|
+
"optional": false,
|
|
500
|
+
"docs": {
|
|
501
|
+
"tags": [{
|
|
502
|
+
"name": "default",
|
|
503
|
+
"text": "false"
|
|
504
|
+
}],
|
|
505
|
+
"text": "Enable drag & drop of the section."
|
|
506
|
+
},
|
|
507
|
+
"attribute": "enable-design",
|
|
508
|
+
"reflect": false,
|
|
509
|
+
"defaultValue": "false"
|
|
451
510
|
}
|
|
452
511
|
}; }
|
|
453
512
|
static get states() { return {
|
|
@@ -455,7 +514,7 @@ export class KupFormEditor {
|
|
|
455
514
|
}; }
|
|
456
515
|
static get events() { return [{
|
|
457
516
|
"method": "kupSave",
|
|
458
|
-
"name": "kup-
|
|
517
|
+
"name": "kup-dashboard-save",
|
|
459
518
|
"bubbles": true,
|
|
460
519
|
"cancelable": false,
|
|
461
520
|
"composed": true,
|
|
@@ -464,12 +523,12 @@ export class KupFormEditor {
|
|
|
464
523
|
"text": ""
|
|
465
524
|
},
|
|
466
525
|
"complexType": {
|
|
467
|
-
"original": "
|
|
468
|
-
"resolved": "
|
|
526
|
+
"original": "KupDashboardEventPayload",
|
|
527
|
+
"resolved": "KupDashboardEventPayload",
|
|
469
528
|
"references": {
|
|
470
|
-
"
|
|
529
|
+
"KupDashboardEventPayload": {
|
|
471
530
|
"location": "import",
|
|
472
|
-
"path": "./kup-
|
|
531
|
+
"path": "./kup-dashboard-declarations"
|
|
473
532
|
}
|
|
474
533
|
}
|
|
475
534
|
}
|