@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
|
@@ -3,1305 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-06b131ea.js');
|
|
6
|
-
const kupManager = require('./kup-manager-
|
|
7
|
-
const
|
|
8
|
-
const fPaginatorUtils = require('./f-paginator-utils-c9dd5173.js');
|
|
9
|
-
const utils = require('./utils-8470184d.js');
|
|
10
|
-
const fImage = require('./f-image-0618c795.js');
|
|
11
|
-
const fChip = require('./f-chip-ef81bf51.js');
|
|
6
|
+
const kupManager = require('./kup-manager-02acbb37.js');
|
|
7
|
+
const utils = require('./utils-4b208b48.js');
|
|
12
8
|
const GenericVariables = require('./GenericVariables-a9ed17ee.js');
|
|
13
|
-
const
|
|
14
|
-
const fTextFieldMdc = require('./f-text-field-mdc-85997738.js');
|
|
15
|
-
require('./f-button-414b3bc3.js');
|
|
16
|
-
require('./f-button-declarations-b611587f.js');
|
|
17
|
-
require('./f-checkbox-57443ca3.js');
|
|
18
|
-
require('./f-text-field-7d31190f.js');
|
|
19
|
-
require('./tslib.es6-0ee02c67.js');
|
|
20
|
-
require('./component-72a5b626.js');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Props of the kup-box component.
|
|
24
|
-
* Used to export every prop in an object.
|
|
25
|
-
*/
|
|
26
|
-
var KupBoxProps;
|
|
27
|
-
(function (KupBoxProps) {
|
|
28
|
-
KupBoxProps["cardData"] = "Data of the card linked to the box when the latter's layout must be a premade template.";
|
|
29
|
-
KupBoxProps["columns"] = "Number of columns.";
|
|
30
|
-
KupBoxProps["customStyle"] = "Custom style of the component.";
|
|
31
|
-
KupBoxProps["data"] = "Actual data of the box.";
|
|
32
|
-
KupBoxProps["dragEnabled"] = "Enable dragging.";
|
|
33
|
-
KupBoxProps["dropEnabled"] = "Enable dropping.";
|
|
34
|
-
KupBoxProps["dropOnSection"] = "Drop can be done in section.";
|
|
35
|
-
KupBoxProps["enableRowActions"] = "If enabled, a button to load / display the row actions will be displayed on the right of every box.";
|
|
36
|
-
KupBoxProps["globalFilter"] = "When set to true it activates the global filter.";
|
|
37
|
-
KupBoxProps["globalFilterValue"] = "The value of the global filter.";
|
|
38
|
-
KupBoxProps["kanban"] = "Displays the boxlist as a Kanban.";
|
|
39
|
-
KupBoxProps["layout"] = "How the field will be displayed. If not present, a default one will be created.";
|
|
40
|
-
KupBoxProps["multiSelection"] = "Enable multi selection.";
|
|
41
|
-
KupBoxProps["pageSelected"] = "Current page number.";
|
|
42
|
-
KupBoxProps["pageSize"] = "Number of boxes per page.";
|
|
43
|
-
KupBoxProps["pagination"] = "Enables pagination.";
|
|
44
|
-
KupBoxProps["rowsPerPage"] = "Number of current rows per page.";
|
|
45
|
-
KupBoxProps["scrollOnHover"] = "Activates the scroll on hover function.";
|
|
46
|
-
KupBoxProps["selectBox"] = "Automatically selects the box at the specified index.";
|
|
47
|
-
KupBoxProps["selectedRowsState"] = "Multiple selection.";
|
|
48
|
-
KupBoxProps["showSelection"] = "If enabled, highlights the selected box/boxes.";
|
|
49
|
-
KupBoxProps["sortBy"] = "If sorting is enabled, specifies which column to sort.";
|
|
50
|
-
KupBoxProps["sortEnabled"] = "Enable sorting.";
|
|
51
|
-
KupBoxProps["stateId"] = "";
|
|
52
|
-
KupBoxProps["store"] = "";
|
|
53
|
-
KupBoxProps["swipeDisabled"] = "Disable swipe.";
|
|
54
|
-
})(KupBoxProps || (KupBoxProps = {}));
|
|
55
|
-
|
|
56
|
-
class KupBoxState {
|
|
57
|
-
constructor() {
|
|
58
|
-
this.globalFilterValue = '';
|
|
59
|
-
this.sortBy = '';
|
|
60
|
-
this.selectedRowsState = '';
|
|
61
|
-
this.pageSelected = 1;
|
|
62
|
-
this.rowsPerPage = 0;
|
|
63
|
-
this.load = false;
|
|
64
|
-
}
|
|
65
|
-
/*Add attribute*/
|
|
66
|
-
toDebugString() {
|
|
67
|
-
// TODO
|
|
68
|
-
return 'box state';
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const kupBoxCss = ":host{--kup_box_background_color:var(\n --kup-box-background-color,\n var(--kup-background-color)\n );--kup_box_color:var(--kup-box-color, var(--kup-text-color));--kup_box_font_family:var(--kup-box-font-family, var(--kup-font-family));--kup_box_font_size:var(--kup-box-font-size, var(--kup-font-size));--kup_box_grid_gap:var(--kup-box-grid-gap, 1em);--kup_box_hover_box_shadow:var(\n --kup-box-hover-box-shadow,\n 0px 0px 7.5px 0px rgba(128, 128, 128, 0.5)\n );--kup_box_primary_color_rgb:var(\n --kup-box-primary-color-rgb,\n var(--kup-primary-color-rgb)\n );--kup_box_transition:var(--kup-box-transition, 0.25s);display:block;font-family:var(--kup_box_font_family);font-size:var(--kup_box_font_size)}.box-component{background:var(--kup_box_background_color);transition:border var(--kup_box_transition) ease}.box-component[kup-drag-over]{position:relative;border:3px dashed var(--kup-border-color)}#box-container{display:grid;grid-gap:var(--kup_box_grid_gap);color:var(--kup_box_color);overflow:auto}#box-container.is-kanban .kanban-section{overflow:auto}#box-container.is-kanban .box-wrapper{padding-top:1em}#box-container.is-kanban .box-wrapper .box{overflow:auto}#box-container *{box-sizing:border-box}#box-container .box-wrapper{display:flex;align-items:center}#box-container .box-wrapper .box{flex-grow:1;cursor:pointer;position:relative;display:flex;transition:background-color var(--kup_box_transition) ease, box-shadow var(--kup_box_transition) ease, border var(--kup_box_transition) ease}#box-container .box-wrapper .box.draggable{touch-action:none;user-select:none}#box-container .box-wrapper .box.column{flex-direction:column}#box-container .box-wrapper .box:hover{box-shadow:var(--kup_box_hover_box_shadow)}#box-container .box-wrapper .box.selected{background-color:rgba(var(--kup_box_primary_color_rgb), 0.175)}#box-container .box-wrapper .box.selected .box-section.titled>h3{background-color:transparent}#box-container .box-wrapper .box[kup-draggable]{opacity:0.5}#box-container .box-wrapper .box[kup-drag-over]{border:3px dashed var(--kup-border-color);position:relative;z-index:2}#box-container .box-wrapper .box .box-section{display:flex;flex-direction:row;flex:1 1 1%;flex-wrap:wrap}#box-container .box-wrapper .box .box-section.column{flex-direction:column;justify-content:center;flex-wrap:unset}#box-container .box-wrapper .box .box-section.column>.box-section{flex:0 0 auto}#box-container .box-wrapper .box .box-section.grid{display:grid}#box-container .box-wrapper .box .box-section .box-object{min-height:16px}#box-container .box-wrapper .box .box-section .box-object img{height:auto}#box-container .box-wrapper .box .box-section.collapse-section .header{border-top:1px solid var(--kup-border-color);color:rgba(var(--kup-text-color-rgb), 0.75);display:flex;justify-content:space-around;width:100%}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content{margin:0.5em;display:flex;align-items:center}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image{transition:transform 0.15s}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image.toggled{transform:rotate(-180deg)}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .kup-icon.kup-dropdown-icon{margin:0;-webkit-mask:var(--kup-dropdown-icon);mask:var(--kup-dropdown-icon)}#box-container .box-wrapper .box .box-section.collapse-section .content{display:none;width:100%}#box-container .box-wrapper .box .box-section.collapse-section.open .content{display:block}#box-container .box-wrapper .box .box-section.titled{border:1px solid var(--kup-border-color);padding-top:5px;position:relative;margin:10px}#box-container .box-wrapper .box .box-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}#box-container .box-wrapper .box .box-selection{position:absolute;top:0.5em;right:0.5em;z-index:1}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler{position:relative;width:24px;height:24px;margin-left:3px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler svg{cursor:pointer;opacity:0;fill:var(--kup-text-color);transition:opacity 500ms ease-out}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu{background:var(--kup-background-color);border:1px solid var(--kup-border-color);box-shadow:0px 0px 7.5px 0px rgba(128, 128, 128, 0.5);position:absolute;top:0;right:24px;display:none;z-index:10}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul{list-style-type:none;margin:0;padding:0}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li{cursor:pointer;white-space:nowrap;padding:0 12px;display:flex;align-items:center;line-height:30px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li:not(:last-child){border-bottom:1px solid var(--kup-border-color)}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu.open{display:block}#box-container .box-wrapper:hover .row-actions-wrapper .row-actions-toggler svg{opacity:1}#sort-panel,#global-filter{margin-bottom:1em}:host(.kup-center-aligned) #kup-component .box-section{text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell img{margin:auto}:host(.kup-right-aligned) #kup-component .box-section{text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell img{margin-left:auto;margin-right:0}:host(.kup-top-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-start}:host(.kup-bottom-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-end}:host(:not(.kup-borderless)) .box{border:1px solid var(--kup-border-color)}:host(.kup-flat-on-hover) #box-container .box-wrapper .box:hover{box-shadow:none}:host(.kup-shaped) .box{border-radius:10px}:host(.kup-round) .box{border-radius:25px}:host(.kup-dashed-sections) .box-section{border:2px dashed var(--kup-text-color)}:host(:not(.kup-paddingless)) #box-container .box{padding:3px}:host(:not(.kup-paddingless)) #box-container .box .box-section .box-object{padding:1px 4px}:host(:not(.kup-paddingless)) #box-container .box .box-section.last-child{margin:3px 4px}:host(.kup-danger){--kup-box-primary-color-rgb:var(--kup-danger-color-rgb)}:host(.kup-info){--kup-box-primary-color-rgb:var(--kup-info-color-rgb)}:host(.kup-secondary){--kup-box-primary-color-rgb:var(--kup-secondary-color-rgb)}:host(.kup-success){--kup-box-primary-color-rgb:var(--kup-success-color-rgb)}:host(.kup-warning){--kup-box-primary-color-rgb:var(--kup-warning-color-rgb)}";
|
|
73
|
-
|
|
74
|
-
const KupBox = class {
|
|
75
|
-
constructor(hostRef) {
|
|
76
|
-
index.registerInstance(this, hostRef);
|
|
77
|
-
this.kupBoxClick = index.createEvent(this, "kup-box-click", 6);
|
|
78
|
-
this.kupBoxSelected = index.createEvent(this, "kup-box-selected", 6);
|
|
79
|
-
this.kupAutoBoxSelect = index.createEvent(this, "kup-box-autoselect", 6);
|
|
80
|
-
this.kupRowActionMenuClick = index.createEvent(this, "kup-box-rowactionmenuclick", 6);
|
|
81
|
-
this.kupRowActionClick = index.createEvent(this, "kup-box-rowactionclick", 6);
|
|
82
|
-
this.kupDidLoad = index.createEvent(this, "kup-box-didload", 6);
|
|
83
|
-
this.kupDidUnload = index.createEvent(this, "kup-box-didunload", 6);
|
|
84
|
-
this.kupBoxContextMenu = index.createEvent(this, "kup-box-contextmenu", 6);
|
|
85
|
-
/*-------------------------------------------------*/
|
|
86
|
-
/* S t a t e s */
|
|
87
|
-
/*-------------------------------------------------*/
|
|
88
|
-
this.collapsedSection = {};
|
|
89
|
-
this.selectedRows = [];
|
|
90
|
-
this.currentPage = 1;
|
|
91
|
-
this.currentRowsPerPage = 10;
|
|
92
|
-
this.state = new KupBoxState();
|
|
93
|
-
/*-------------------------------------------------*/
|
|
94
|
-
/* P r o p s */
|
|
95
|
-
/*-------------------------------------------------*/
|
|
96
|
-
/**
|
|
97
|
-
* Data of the card linked to the box when the latter's layout must be a premade template.
|
|
98
|
-
* @default null
|
|
99
|
-
*/
|
|
100
|
-
this.cardData = null;
|
|
101
|
-
/**
|
|
102
|
-
* Number of columns
|
|
103
|
-
* @default 1
|
|
104
|
-
*/
|
|
105
|
-
this.columns = 1;
|
|
106
|
-
/**
|
|
107
|
-
* Custom style of the component.
|
|
108
|
-
* @default ""
|
|
109
|
-
* @see https://ketchup.smeup.com/ketchup-showcase/#/customization
|
|
110
|
-
*/
|
|
111
|
-
this.customStyle = '';
|
|
112
|
-
/**
|
|
113
|
-
* Actual data of the box.
|
|
114
|
-
* @default null
|
|
115
|
-
*/
|
|
116
|
-
this.data = null;
|
|
117
|
-
/**
|
|
118
|
-
* Enable dragging
|
|
119
|
-
* @default false
|
|
120
|
-
*/
|
|
121
|
-
this.dragEnabled = false;
|
|
122
|
-
/**
|
|
123
|
-
* Enable dropping
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
126
|
-
this.dropEnabled = false;
|
|
127
|
-
/**
|
|
128
|
-
* Drop can be done in section
|
|
129
|
-
* @default false
|
|
130
|
-
*/
|
|
131
|
-
this.dropOnSection = false;
|
|
132
|
-
/**
|
|
133
|
-
* When set to true, editable cells will be rendered using input components.
|
|
134
|
-
* @default false
|
|
135
|
-
*/
|
|
136
|
-
this.editableData = false;
|
|
137
|
-
/**
|
|
138
|
-
* If enabled, a button to load / display the row actions
|
|
139
|
-
* will be displayed on the right of every box
|
|
140
|
-
* @default false
|
|
141
|
-
*/
|
|
142
|
-
this.enableRowActions = false;
|
|
143
|
-
/**
|
|
144
|
-
* When set to true it activates the global filter.
|
|
145
|
-
* @default false
|
|
146
|
-
*/
|
|
147
|
-
this.globalFilter = false;
|
|
148
|
-
/**
|
|
149
|
-
* The value of the global filter.
|
|
150
|
-
* @default ""
|
|
151
|
-
*/
|
|
152
|
-
this.globalFilterValue = '';
|
|
153
|
-
/**
|
|
154
|
-
* Displays the boxlist as a Kanban.
|
|
155
|
-
* @default null
|
|
156
|
-
*/
|
|
157
|
-
this.kanban = null;
|
|
158
|
-
/**
|
|
159
|
-
* Enable multi selection
|
|
160
|
-
* @default false
|
|
161
|
-
*/
|
|
162
|
-
this.multiSelection = false;
|
|
163
|
-
/**
|
|
164
|
-
* Current page number
|
|
165
|
-
* @default 1
|
|
166
|
-
*/
|
|
167
|
-
this.pageSelected = 1;
|
|
168
|
-
/**
|
|
169
|
-
* Number of boxes per page
|
|
170
|
-
* @default 10
|
|
171
|
-
*/
|
|
172
|
-
this.pageSize = 10;
|
|
173
|
-
/**
|
|
174
|
-
* Enables pagination
|
|
175
|
-
* @default false
|
|
176
|
-
*/
|
|
177
|
-
this.pagination = false;
|
|
178
|
-
/**
|
|
179
|
-
* Activates the scroll on hover function.
|
|
180
|
-
* @default false
|
|
181
|
-
*/
|
|
182
|
-
this.scrollOnHover = false;
|
|
183
|
-
/**
|
|
184
|
-
* If enabled, highlights the selected box/boxes
|
|
185
|
-
* @default true
|
|
186
|
-
*/
|
|
187
|
-
this.showSelection = true;
|
|
188
|
-
/**
|
|
189
|
-
* Enable sorting
|
|
190
|
-
* @default false
|
|
191
|
-
*/
|
|
192
|
-
this.sortEnabled = false;
|
|
193
|
-
this.stateId = '';
|
|
194
|
-
/**
|
|
195
|
-
* Disable swipe
|
|
196
|
-
* @default false
|
|
197
|
-
*/
|
|
198
|
-
this.swipeDisabled = false;
|
|
199
|
-
/*-------------------------------------------------*/
|
|
200
|
-
/* I n t e r n a l V a r i a b l e s */
|
|
201
|
-
/*-------------------------------------------------*/
|
|
202
|
-
/**
|
|
203
|
-
* Instance of the KupManager class.
|
|
204
|
-
*/
|
|
205
|
-
this.kupManager = kupManager.kupManagerInstance();
|
|
206
|
-
this.visibleColumns = [];
|
|
207
|
-
this.rows = [];
|
|
208
|
-
this.filteredRows = [];
|
|
209
|
-
this.sectionRef = null;
|
|
210
|
-
this.rowsRefs = [];
|
|
211
|
-
this.hold = false;
|
|
212
|
-
this.interactableDrag = [];
|
|
213
|
-
this.interactableDrop = [];
|
|
214
|
-
this.interactableTouch = [];
|
|
215
|
-
}
|
|
216
|
-
initWithPersistedState() {
|
|
217
|
-
if (this.store && this.stateId) {
|
|
218
|
-
const state = this.store.getState(this.stateId);
|
|
219
|
-
if (state != null) {
|
|
220
|
-
this.kupManager.debug.logMessage(this, 'Initialize with state for stateId ' +
|
|
221
|
-
this.stateId +
|
|
222
|
-
': ' +
|
|
223
|
-
state);
|
|
224
|
-
// *** PROPS ***
|
|
225
|
-
this.sortBy = this.state.sortBy;
|
|
226
|
-
this.globalFilterValue = this.state.globalFilterValue;
|
|
227
|
-
this.selectedRowsState = this.state.selectedRowsState;
|
|
228
|
-
this.pageSelected = this.state.pageSelected;
|
|
229
|
-
this.rowsPerPage = this.state.rowsPerPage;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
persistState() {
|
|
234
|
-
if (this.store && this.stateId) {
|
|
235
|
-
let somethingChanged = false;
|
|
236
|
-
if (!this.kupManager.objects.deepEqual(this.state.sortBy, this.sortBy)) {
|
|
237
|
-
this.state.sortBy = this.sortBy;
|
|
238
|
-
somethingChanged = true;
|
|
239
|
-
}
|
|
240
|
-
if (!this.kupManager.objects.deepEqual(this.state.globalFilterValue, this.globalFilterValue)) {
|
|
241
|
-
this.state.globalFilterValue = this.globalFilterValue;
|
|
242
|
-
somethingChanged = true;
|
|
243
|
-
}
|
|
244
|
-
if (!this.kupManager.objects.deepEqual(this.state.pageSelected, this.currentPage)) {
|
|
245
|
-
this.state.pageSelected = this.currentPage;
|
|
246
|
-
somethingChanged = true;
|
|
247
|
-
}
|
|
248
|
-
if (!this.kupManager.objects.deepEqual(this.state.rowsPerPage, this.currentRowsPerPage)) {
|
|
249
|
-
this.state.rowsPerPage = this.currentRowsPerPage;
|
|
250
|
-
somethingChanged = true;
|
|
251
|
-
}
|
|
252
|
-
const selectedRowsState = this.selectedRows.reduce((accumulator, row, currentIndex) => {
|
|
253
|
-
const prefix = currentIndex > 0 ? ';' : '';
|
|
254
|
-
return accumulator + prefix + row.id;
|
|
255
|
-
}, '');
|
|
256
|
-
if (!this.kupManager.objects.deepEqual(this.state.selectedRowsState, selectedRowsState)) {
|
|
257
|
-
this.state.selectedRowsState = selectedRowsState;
|
|
258
|
-
somethingChanged = true;
|
|
259
|
-
}
|
|
260
|
-
if (!this.state.load) {
|
|
261
|
-
this.state.load = true;
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
if (somethingChanged) {
|
|
265
|
-
this.kupManager.debug.logMessage(this, 'Persisting state for stateId ' +
|
|
266
|
-
this.stateId +
|
|
267
|
-
': ' +
|
|
268
|
-
this.state);
|
|
269
|
-
this.store.persistState(this.stateId, this.state);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/*-------------------------------------------------*/
|
|
274
|
-
/* W a t c h e r s */
|
|
275
|
-
/*-------------------------------------------------*/
|
|
276
|
-
rowsPerPageHandler(newValue) {
|
|
277
|
-
this.currentRowsPerPage = newValue;
|
|
278
|
-
}
|
|
279
|
-
recalculateRows() {
|
|
280
|
-
this.initRows();
|
|
281
|
-
}
|
|
282
|
-
onDataChanged() {
|
|
283
|
-
utils.identify(this.getRows());
|
|
284
|
-
this.initVisibleColumns();
|
|
285
|
-
this.initRows();
|
|
286
|
-
this.checkLayout();
|
|
287
|
-
}
|
|
288
|
-
onLayoutChanged() {
|
|
289
|
-
this.checkLayout();
|
|
290
|
-
}
|
|
291
|
-
onSelectBoxChanged() {
|
|
292
|
-
this.handleAutomaticBoxSelection();
|
|
293
|
-
}
|
|
294
|
-
/*-------------------------------------------------*/
|
|
295
|
-
/* P u b l i c M e t h o d s */
|
|
296
|
-
/*-------------------------------------------------*/
|
|
297
|
-
/**
|
|
298
|
-
* Used to retrieve component's props values.
|
|
299
|
-
* @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
|
|
300
|
-
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
301
|
-
*/
|
|
302
|
-
async getProps(descriptions) {
|
|
303
|
-
return utils.getProps(this, KupBoxProps, descriptions);
|
|
304
|
-
}
|
|
305
|
-
async loadRowActions(row, actions) {
|
|
306
|
-
row.actions = actions;
|
|
307
|
-
// show menu
|
|
308
|
-
this.rowActionMenuOpened = row;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* This method is used to trigger a new render of the component.
|
|
312
|
-
*/
|
|
313
|
-
async refresh() {
|
|
314
|
-
index.forceUpdate(this);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Sets the props to the component.
|
|
318
|
-
* @param {GenericObject} props - Object containing props that will be set to the component.
|
|
319
|
-
*/
|
|
320
|
-
async setProps(props) {
|
|
321
|
-
utils.setProps(this, KupBoxProps, props);
|
|
322
|
-
}
|
|
323
|
-
/*-------------------------------------------------*/
|
|
324
|
-
/* P r i v a t e M e t h o d s */
|
|
325
|
-
/*-------------------------------------------------*/
|
|
326
|
-
getColumns() {
|
|
327
|
-
return this.data && this.data.columns
|
|
328
|
-
? this.data.columns
|
|
329
|
-
: [{ title: '', name: '', size: undefined }];
|
|
330
|
-
}
|
|
331
|
-
initVisibleColumns() {
|
|
332
|
-
this.visibleColumns = this.getColumns().filter((column) => {
|
|
333
|
-
if (column.hasOwnProperty('visible')) {
|
|
334
|
-
return column.visible;
|
|
335
|
-
}
|
|
336
|
-
return true;
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
getRows() {
|
|
340
|
-
return this.data && this.data.rows ? this.data.rows : [];
|
|
341
|
-
}
|
|
342
|
-
initRows() {
|
|
343
|
-
this.filteredRows = this.getRows();
|
|
344
|
-
if (this.globalFilter && this.globalFilterValue) {
|
|
345
|
-
// filtering rows
|
|
346
|
-
this.filteredRows = fPaginatorUtils.filterRows(this.filteredRows, null, this.globalFilterValue, this.visibleColumns);
|
|
347
|
-
}
|
|
348
|
-
this.rows = this.sortRows(this.filteredRows);
|
|
349
|
-
if (this.pagination) {
|
|
350
|
-
this.rows = fPaginatorUtils.paginateRows(this.rows, this.currentPage, this.currentRowsPerPage, false);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
sortRows(rows) {
|
|
354
|
-
let sortedRows = rows;
|
|
355
|
-
if (this.sortBy) {
|
|
356
|
-
// create 'fake' sortObject
|
|
357
|
-
const sortObject = {
|
|
358
|
-
column: this.sortBy,
|
|
359
|
-
sortMode: kupManager.SortMode.A,
|
|
360
|
-
};
|
|
361
|
-
sortedRows = fPaginatorUtils.sortRows(sortedRows, [sortObject]);
|
|
362
|
-
}
|
|
363
|
-
return sortedRows;
|
|
364
|
-
}
|
|
365
|
-
checkScrollOnHover() {
|
|
366
|
-
if (!this.kupManager.scrollOnHover.isRegistered(this.boxContainer)) {
|
|
367
|
-
if (this.scrollOnHover) {
|
|
368
|
-
this.kupManager.scrollOnHover.register(this.boxContainer);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
if (!this.scrollOnHover) {
|
|
373
|
-
this.kupManager.scrollOnHover.unregister(this.boxContainer);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
checkLayout() {
|
|
378
|
-
// check if there is a layout.
|
|
379
|
-
// if not, create a default layout
|
|
380
|
-
if (this.layout) {
|
|
381
|
-
this.boxLayout = this.layout;
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
// only one section, containing all visible fields
|
|
385
|
-
const section = {
|
|
386
|
-
horizontal: false,
|
|
387
|
-
sections: [],
|
|
388
|
-
};
|
|
389
|
-
// adding box objects to section
|
|
390
|
-
const visibleColumns = this.visibleColumns;
|
|
391
|
-
let size = visibleColumns.length;
|
|
392
|
-
let content = [];
|
|
393
|
-
let cnt = 0;
|
|
394
|
-
while (size-- > 0) {
|
|
395
|
-
content.push({
|
|
396
|
-
column: visibleColumns[cnt++].name,
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
section.content = content;
|
|
400
|
-
// creating a new layout
|
|
401
|
-
this.boxLayout = {
|
|
402
|
-
sections: [section],
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
onSortChange(e) {
|
|
406
|
-
let column = cellUtils.getColumnByName(this.visibleColumns, e.detail.value);
|
|
407
|
-
this.sortBy = column.name;
|
|
408
|
-
}
|
|
409
|
-
onGlobalFilterChange({ detail }) {
|
|
410
|
-
let value = '';
|
|
411
|
-
if (detail && detail.value) {
|
|
412
|
-
value = detail.value;
|
|
413
|
-
}
|
|
414
|
-
this.globalFilterValue = value;
|
|
415
|
-
}
|
|
416
|
-
isSectionExpanded(row, section) {
|
|
417
|
-
if (!row.id || !section.id) {
|
|
418
|
-
return false;
|
|
419
|
-
}
|
|
420
|
-
return (this.collapsedSection[section.id] &&
|
|
421
|
-
this.collapsedSection[section.id][row.id]);
|
|
422
|
-
}
|
|
423
|
-
handleAutomaticBoxSelection() {
|
|
424
|
-
if (this.selectBox &&
|
|
425
|
-
this.selectBox > 0 &&
|
|
426
|
-
this.selectBox <= this.data.rows.length) {
|
|
427
|
-
this.selectedRows = [];
|
|
428
|
-
for (let boxRow of this.data.rows) {
|
|
429
|
-
if (boxRow.id === (this.selectBox - 1).toString()) {
|
|
430
|
-
this.selectedRows.push(boxRow);
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
this.kupAutoBoxSelect.emit({
|
|
435
|
-
comp: this,
|
|
436
|
-
id: this.rootElement.id,
|
|
437
|
-
row: this.selectedRows[0],
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
getEventDetails(el, e) {
|
|
442
|
-
let boxObject = null;
|
|
443
|
-
let cell = null;
|
|
444
|
-
let row = null;
|
|
445
|
-
let column = null;
|
|
446
|
-
if (el) {
|
|
447
|
-
boxObject =
|
|
448
|
-
el.closest('.box-object') || el.querySelector('.box-object');
|
|
449
|
-
}
|
|
450
|
-
if (boxObject) {
|
|
451
|
-
cell = boxObject['data-cell'];
|
|
452
|
-
row = boxObject['data-row'];
|
|
453
|
-
column = cellUtils.getColumnByName(this.visibleColumns, boxObject.dataset.column);
|
|
454
|
-
}
|
|
455
|
-
return {
|
|
456
|
-
boxObject: boxObject ? boxObject : null,
|
|
457
|
-
column: column ? column : null,
|
|
458
|
-
cell: cell ? cell : null,
|
|
459
|
-
originalEvent: e,
|
|
460
|
-
row: row ? row : null,
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
contextMenuHandler(e) {
|
|
464
|
-
const details = this.getEventDetails(e.target, e);
|
|
465
|
-
return details;
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Checks if the element is the svg that opens the "row actions menu"
|
|
469
|
-
* @param element the element to check
|
|
470
|
-
*/
|
|
471
|
-
checkIfElementIsActionMenuIcon(element) {
|
|
472
|
-
if (element.tagName && element.parentElement) {
|
|
473
|
-
return (element.tagName === 'svg' &&
|
|
474
|
-
element.parentElement.classList.contains('row-actions-toggler'));
|
|
475
|
-
}
|
|
476
|
-
return false;
|
|
477
|
-
}
|
|
478
|
-
// event listeners
|
|
479
|
-
onBoxClick({ target }, row) {
|
|
480
|
-
if (!(target instanceof HTMLElement)) {
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
// searching parent
|
|
484
|
-
let element = target;
|
|
485
|
-
let classList = element.classList;
|
|
486
|
-
while (!classList.contains('box-object') &&
|
|
487
|
-
!classList.contains('box-section') &&
|
|
488
|
-
!classList.contains('box')) {
|
|
489
|
-
element = element.parentElement;
|
|
490
|
-
if (element === null) {
|
|
491
|
-
break;
|
|
492
|
-
}
|
|
493
|
-
classList = element.classList;
|
|
494
|
-
}
|
|
495
|
-
// evaluating column
|
|
496
|
-
let column = null;
|
|
497
|
-
if (classList.contains('box-object')) {
|
|
498
|
-
column = element.dataset.column;
|
|
499
|
-
}
|
|
500
|
-
this.kupBoxClick.emit({
|
|
501
|
-
comp: this,
|
|
502
|
-
id: this.rootElement.id,
|
|
503
|
-
row,
|
|
504
|
-
column,
|
|
505
|
-
});
|
|
506
|
-
// selecting box
|
|
507
|
-
if (this.multiSelection) {
|
|
508
|
-
// triggering multi selection
|
|
509
|
-
this.onSelectionCheckChange(row);
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
this.selectedRows = [row];
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
onSelectionCheckChange(row) {
|
|
516
|
-
var index = -1;
|
|
517
|
-
for (let i = 0; i < this.selectedRows.length; i++) {
|
|
518
|
-
const select = this.selectedRows[i];
|
|
519
|
-
if (select.id === row.id) {
|
|
520
|
-
index = i;
|
|
521
|
-
break;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
if (index >= 0) {
|
|
525
|
-
// remove row
|
|
526
|
-
this.selectedRows.splice(index, 1);
|
|
527
|
-
this.selectedRows = [...this.selectedRows];
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
// add row
|
|
531
|
-
this.selectedRows = [...this.selectedRows, row];
|
|
532
|
-
}
|
|
533
|
-
this.kupBoxSelected.emit({
|
|
534
|
-
comp: this,
|
|
535
|
-
id: this.rootElement.id,
|
|
536
|
-
rows: this.selectedRows,
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
toggleSectionExpand(row, section) {
|
|
540
|
-
// check if section / row has id
|
|
541
|
-
if (!section.id) {
|
|
542
|
-
// error
|
|
543
|
-
console.error('cannot expand / collapse a section withoun an ID');
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
if (!row.id) {
|
|
547
|
-
// error
|
|
548
|
-
console.error('cannot expand / collapse a section of a row without ad id');
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
// check if section already in collapsedSection
|
|
552
|
-
if (!this.collapsedSection[section.id]) {
|
|
553
|
-
// adding element and row, setting it to expanded
|
|
554
|
-
this.collapsedSection[section.id] = {};
|
|
555
|
-
this.collapsedSection[section.id][row.id] = true;
|
|
556
|
-
}
|
|
557
|
-
else {
|
|
558
|
-
const s = this.collapsedSection[section.id];
|
|
559
|
-
if (!s[row.id]) {
|
|
560
|
-
s[row.id] = true;
|
|
561
|
-
}
|
|
562
|
-
else {
|
|
563
|
-
s[row.id] = !s[row.id];
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
// triggering rendering
|
|
567
|
-
this.collapsedSection = Object.assign({}, this.collapsedSection);
|
|
568
|
-
}
|
|
569
|
-
onRowAction(row) {
|
|
570
|
-
if (!row) {
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
if (row === this.rowActionMenuOpened) {
|
|
574
|
-
// closing menu
|
|
575
|
-
this.rowActionMenuOpened = null;
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
if (row.actions) {
|
|
579
|
-
// actions already loaded -> show menu
|
|
580
|
-
this.rowActionMenuOpened = row;
|
|
581
|
-
}
|
|
582
|
-
else {
|
|
583
|
-
// no actions -> triggering event
|
|
584
|
-
this.kupRowActionMenuClick.emit({
|
|
585
|
-
comp: this,
|
|
586
|
-
id: this.rootElement.id,
|
|
587
|
-
row,
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
onRowActionClick(row, action, index) {
|
|
592
|
-
this.kupRowActionClick.emit({
|
|
593
|
-
comp: this,
|
|
594
|
-
id: this.rootElement.id,
|
|
595
|
-
row,
|
|
596
|
-
action,
|
|
597
|
-
index,
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* see onDocumentClick in kup-combo
|
|
602
|
-
*/
|
|
603
|
-
clickFunction(event) {
|
|
604
|
-
try {
|
|
605
|
-
const targets = event.composedPath();
|
|
606
|
-
for (let target of targets) {
|
|
607
|
-
if (this.checkIfElementIsActionMenuIcon(target)) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
catch (err) {
|
|
613
|
-
if (this.checkIfElementIsActionMenuIcon(event.target)) {
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
this.rowActionMenuOpened = null;
|
|
618
|
-
}
|
|
619
|
-
handlePageChange(pageNumber) {
|
|
620
|
-
const newPage = fPaginatorUtils.pageChange(pageNumber, this.filteredRows.length, this.currentRowsPerPage);
|
|
621
|
-
if (newPage) {
|
|
622
|
-
this.currentPage = newPage;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
handleRowsPerPageChange(rowsNumber) {
|
|
626
|
-
const newRows = fPaginatorUtils.rowsPerPageChange(rowsNumber, this.filteredRows.length);
|
|
627
|
-
if (newRows) {
|
|
628
|
-
this.currentRowsPerPage = newRows;
|
|
629
|
-
this.adjustPaginator();
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
adjustPaginator() {
|
|
633
|
-
const numberOfRows = this.rows.length;
|
|
634
|
-
// check if current page is valid
|
|
635
|
-
const numberOfPages = Math.ceil(numberOfRows / this.currentRowsPerPage);
|
|
636
|
-
if (this.currentPage > numberOfPages) {
|
|
637
|
-
// reset page
|
|
638
|
-
this.currentPage = 1;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
// render methods
|
|
642
|
-
renderSectionAsCard(row) {
|
|
643
|
-
let skipPush = false;
|
|
644
|
-
let cardData = {
|
|
645
|
-
button: [],
|
|
646
|
-
image: [],
|
|
647
|
-
progressbar: [],
|
|
648
|
-
text: [],
|
|
649
|
-
};
|
|
650
|
-
//First cycle sets specific binds between cardIDs and cells
|
|
651
|
-
for (var key in row.cells) {
|
|
652
|
-
if (row.cells.hasOwnProperty(key)) {
|
|
653
|
-
var cell = row.cells[key];
|
|
654
|
-
if (cell.cardID !== undefined) {
|
|
655
|
-
switch (cell.obj.p) {
|
|
656
|
-
case 'BTN':
|
|
657
|
-
do {
|
|
658
|
-
cardData.button.push({});
|
|
659
|
-
} while (cardData.button.length < cell.cardID);
|
|
660
|
-
cardData.button[cell.cardID] = {
|
|
661
|
-
label: cell.value,
|
|
662
|
-
};
|
|
663
|
-
break;
|
|
664
|
-
case 'IMG':
|
|
665
|
-
do {
|
|
666
|
-
cardData.image.push({});
|
|
667
|
-
} while (cardData.image.length < cell.cardID);
|
|
668
|
-
cardData.image[cell.cardID] = {
|
|
669
|
-
resource: cell.value,
|
|
670
|
-
};
|
|
671
|
-
break;
|
|
672
|
-
case 'PGB':
|
|
673
|
-
do {
|
|
674
|
-
cardData.progressbar.push({});
|
|
675
|
-
} while (cardData.progressbar.length < cell.cardID);
|
|
676
|
-
cardData.progressbar[cell.cardID] = {
|
|
677
|
-
value: cell.value,
|
|
678
|
-
};
|
|
679
|
-
break;
|
|
680
|
-
default:
|
|
681
|
-
do {
|
|
682
|
-
cardData.text.push('');
|
|
683
|
-
} while (cardData.text.length < cell.cardID);
|
|
684
|
-
cardData.text[cell.cardID] = cell.value;
|
|
685
|
-
break;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
//Second cycle sets leftover binds automatically
|
|
691
|
-
for (var key in row.cells) {
|
|
692
|
-
if (row.cells.hasOwnProperty(key)) {
|
|
693
|
-
var cell = row.cells[key];
|
|
694
|
-
if (cell.cardID === undefined) {
|
|
695
|
-
skipPush = false;
|
|
696
|
-
switch (cell.obj.p) {
|
|
697
|
-
case 'BTN':
|
|
698
|
-
for (let index = 0; index < cardData.button.length; index++) {
|
|
699
|
-
//If there are empty elements, the first one will be used
|
|
700
|
-
if (cardData.button[index] === {}) {
|
|
701
|
-
cardData.button[index] = {
|
|
702
|
-
label: cell.value,
|
|
703
|
-
};
|
|
704
|
-
skipPush = true;
|
|
705
|
-
break;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
//Otherwise a new element will be pushed
|
|
709
|
-
if (!skipPush) {
|
|
710
|
-
cardData.button.push({
|
|
711
|
-
label: cell.value,
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
break;
|
|
715
|
-
case 'IMG':
|
|
716
|
-
for (let index = 0; index < cardData.image.length; index++) {
|
|
717
|
-
//If there are empty elements, the first one will be used
|
|
718
|
-
if (cardData.image[index] === {}) {
|
|
719
|
-
cardData.image[index] = {
|
|
720
|
-
resource: cell.value,
|
|
721
|
-
};
|
|
722
|
-
skipPush = true;
|
|
723
|
-
break;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
//Otherwise a new element will be pushed
|
|
727
|
-
if (!skipPush) {
|
|
728
|
-
cardData.image.push({
|
|
729
|
-
resource: cell.value,
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
break;
|
|
733
|
-
case 'PGB':
|
|
734
|
-
for (let index = 0; index < cardData.progressbar.length; index++) {
|
|
735
|
-
//If there are empty elements, the first one will be used
|
|
736
|
-
if (cardData.progressbar[index] === {}) {
|
|
737
|
-
cardData.progressbar[index] = {
|
|
738
|
-
value: cell.value,
|
|
739
|
-
};
|
|
740
|
-
skipPush = true;
|
|
741
|
-
break;
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
//Otherwise a new element will be pushed
|
|
745
|
-
if (!skipPush) {
|
|
746
|
-
cardData.progressbar.push({
|
|
747
|
-
value: cell.value,
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
break;
|
|
751
|
-
default:
|
|
752
|
-
for (let index = 0; index < cardData.text.length; index++) {
|
|
753
|
-
//If there are empty elements, the first one will be used
|
|
754
|
-
if (cardData.text[index] === '') {
|
|
755
|
-
cardData.text[index] = cell.value;
|
|
756
|
-
skipPush = true;
|
|
757
|
-
break;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
//Otherwise a new element will be pushed
|
|
761
|
-
if (!skipPush) {
|
|
762
|
-
cardData.text.push(cell.value);
|
|
763
|
-
}
|
|
764
|
-
break;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
return index.h("kup-card", Object.assign({ data: cardData }, this.cardData));
|
|
770
|
-
}
|
|
771
|
-
renderRow(row) {
|
|
772
|
-
const visibleColumns = [...this.visibleColumns];
|
|
773
|
-
let boxContent = null;
|
|
774
|
-
// if layout in row, use that one
|
|
775
|
-
let rowLayout = row.layout;
|
|
776
|
-
if (!rowLayout) {
|
|
777
|
-
// otherwise, use 'default' layout
|
|
778
|
-
rowLayout = this.boxLayout;
|
|
779
|
-
}
|
|
780
|
-
let horizontal = false;
|
|
781
|
-
if (rowLayout) {
|
|
782
|
-
if (rowLayout.horizontal) {
|
|
783
|
-
horizontal = true;
|
|
784
|
-
}
|
|
785
|
-
const sections = rowLayout.sections;
|
|
786
|
-
let size = sections.length;
|
|
787
|
-
let cnt = 0;
|
|
788
|
-
if (size > 0) {
|
|
789
|
-
boxContent = [];
|
|
790
|
-
}
|
|
791
|
-
// create fake parent section
|
|
792
|
-
const parent = {
|
|
793
|
-
horizontal: horizontal,
|
|
794
|
-
};
|
|
795
|
-
while (size-- > 0) {
|
|
796
|
-
if (this.cardData !== null &&
|
|
797
|
-
this.cardData !== undefined &&
|
|
798
|
-
typeof this.cardData === 'object') {
|
|
799
|
-
boxContent.push(this.renderSectionAsCard(row));
|
|
800
|
-
}
|
|
801
|
-
else {
|
|
802
|
-
boxContent.push(this.renderSection(sections[cnt++], parent, row, visibleColumns));
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
var isSelected = false;
|
|
807
|
-
for (let select of this.selectedRows) {
|
|
808
|
-
if (select.id === row.id) {
|
|
809
|
-
isSelected = true;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
let multiSel = null;
|
|
813
|
-
if (this.multiSelection) {
|
|
814
|
-
multiSel = (index.h("div", { class: "box-selection" }, index.h("kup-checkbox", { checked: isSelected })));
|
|
815
|
-
}
|
|
816
|
-
let rowObject = null;
|
|
817
|
-
if (this.enableRowActions && !this.swipeDisabled) {
|
|
818
|
-
const menuClass = {
|
|
819
|
-
'row-action-menu': true,
|
|
820
|
-
open: row === this.rowActionMenuOpened,
|
|
821
|
-
};
|
|
822
|
-
let rowActionMenuContent = null;
|
|
823
|
-
if (row.actions) {
|
|
824
|
-
const actionItems = row.actions.map((item, index$1) => {
|
|
825
|
-
const iconClass = `icon ${item.icon}`;
|
|
826
|
-
return (index.h("li", { tabindex: "0", onClick: () => this.onRowActionClick(row, item, index$1) }, index.h("div", { class: iconClass }), index.h("div", { class: "text" }, item.text)));
|
|
827
|
-
});
|
|
828
|
-
rowActionMenuContent = index.h("ul", null, actionItems);
|
|
829
|
-
}
|
|
830
|
-
rowObject = (index.h("div", { class: "row-actions-wrapper" }, index.h("div", { class: "row-actions-toggler" }, index.h("svg", { version: "1.1", width: "24", height: "24", viewBox: "0 0 24 24", onClick: () => this.onRowAction(row) }, index.h("path", { d: "M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" })), index.h("div", { class: menuClass }, rowActionMenuContent))));
|
|
831
|
-
}
|
|
832
|
-
let badges = null;
|
|
833
|
-
if (row.badgeData && row.badgeData.length > 0) {
|
|
834
|
-
badges = row.badgeData.map((badge) => (index.h("kup-badge", { text: badge.text, class: badge['className']
|
|
835
|
-
? `centered ${badge['className']}`
|
|
836
|
-
: 'centered', imageData: badge.imageData })));
|
|
837
|
-
}
|
|
838
|
-
const boxClass = {
|
|
839
|
-
box: true,
|
|
840
|
-
draggable: this.dragEnabled,
|
|
841
|
-
selected: this.showSelection && isSelected,
|
|
842
|
-
column: !horizontal,
|
|
843
|
-
};
|
|
844
|
-
return (index.h("div", { class: "box-wrapper" }, index.h("div", { class: boxClass, onClick: (e) => this.onBoxClick(e, row), ref: (el) => this.rowsRefs.push(el) }, multiSel, boxContent, badges), rowObject));
|
|
845
|
-
}
|
|
846
|
-
renderSection(section, parent, row, visibleColumns) {
|
|
847
|
-
let sectionContent = null;
|
|
848
|
-
if (section.sections && section.sections.length > 0) {
|
|
849
|
-
// rendering child
|
|
850
|
-
const sections = section.sections;
|
|
851
|
-
let size = sections.length;
|
|
852
|
-
let cnt = 0;
|
|
853
|
-
if (size > 0) {
|
|
854
|
-
sectionContent = [];
|
|
855
|
-
}
|
|
856
|
-
while (size-- > 0) {
|
|
857
|
-
sectionContent.push(this.renderSection(sections[cnt++], section, row, visibleColumns));
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
else if (section.content) {
|
|
861
|
-
// rendering box objects
|
|
862
|
-
const content = section.content;
|
|
863
|
-
let size = content.length;
|
|
864
|
-
let cnt = 0;
|
|
865
|
-
if (size > 0) {
|
|
866
|
-
sectionContent = [];
|
|
867
|
-
}
|
|
868
|
-
while (size-- > 0) {
|
|
869
|
-
sectionContent.push(this.renderBoxObject({
|
|
870
|
-
boxObject: content[cnt++],
|
|
871
|
-
row,
|
|
872
|
-
visibleColumns,
|
|
873
|
-
}, true));
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
else if (visibleColumns.length > 0) {
|
|
877
|
-
const column = visibleColumns[0];
|
|
878
|
-
sectionContent = this.renderBoxObject({
|
|
879
|
-
boxObject: { column: column.name },
|
|
880
|
-
row,
|
|
881
|
-
visibleColumns,
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
const sectionExpanded = this.isSectionExpanded(row, section);
|
|
885
|
-
const isGrid = !!section.columns;
|
|
886
|
-
const sectionClass = {
|
|
887
|
-
'box-section': true,
|
|
888
|
-
open: sectionExpanded,
|
|
889
|
-
column: !isGrid && !section.horizontal,
|
|
890
|
-
grid: isGrid,
|
|
891
|
-
titled: !!section.title,
|
|
892
|
-
'last-child': !section.sections || section.sections.length === 0,
|
|
893
|
-
};
|
|
894
|
-
const sectionStyle = section.style || {};
|
|
895
|
-
if (section.dim && parent) {
|
|
896
|
-
sectionStyle.flex = `0 0 ${section.dim}`;
|
|
897
|
-
if (parent.horizontal) {
|
|
898
|
-
sectionStyle.maxWidth = section.dim;
|
|
899
|
-
}
|
|
900
|
-
else {
|
|
901
|
-
sectionStyle.maxHeight = section.dim;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
if (isGrid) {
|
|
905
|
-
sectionStyle['grid-template-columns'] = `repeat(${section.columns}, 1fr)`;
|
|
906
|
-
}
|
|
907
|
-
let sectionContainer = null;
|
|
908
|
-
if (section.collapsible) {
|
|
909
|
-
sectionClass['collapse-section'] = true;
|
|
910
|
-
const contentClass = {
|
|
911
|
-
content: true,
|
|
912
|
-
};
|
|
913
|
-
// TODO I18N
|
|
914
|
-
let headerTitle = '';
|
|
915
|
-
if (section.title) {
|
|
916
|
-
headerTitle = section.title;
|
|
917
|
-
}
|
|
918
|
-
else if (sectionExpanded) {
|
|
919
|
-
headerTitle = this.kupManager.language.translate(kupManager.KupLanguageGeneric.COLLAPSE);
|
|
920
|
-
}
|
|
921
|
-
else {
|
|
922
|
-
headerTitle = this.kupManager.language.translate(kupManager.KupLanguageGeneric.EXPAND);
|
|
923
|
-
}
|
|
924
|
-
sectionContainer = (index.h("div", { class: sectionClass, style: sectionStyle }, index.h("div", { class: contentClass }, sectionContent), index.h("div", { class: "header", role: "button", onClick: (e) => {
|
|
925
|
-
e.stopPropagation();
|
|
926
|
-
this.toggleSectionExpand(row, section);
|
|
927
|
-
} }, index.h("div", { class: "header-content" }, index.h("span", null, headerTitle), index.h(fImage.FImage, { resource: `${kupManager.KupThemeIconValues.DROPDOWN}`, sizeX: "1.25em", sizeY: "1.25em", wrapperClass: sectionExpanded ? 'toggled' : '' })))));
|
|
928
|
-
}
|
|
929
|
-
else {
|
|
930
|
-
const title = section.title ? index.h("h3", null, section.title) : null;
|
|
931
|
-
sectionContainer = (index.h("div", { class: sectionClass, style: sectionStyle }, title, sectionContent));
|
|
932
|
-
}
|
|
933
|
-
return sectionContainer;
|
|
934
|
-
}
|
|
935
|
-
renderBoxObject({ boxObject, row, visibleColumns, }, fromSection) {
|
|
936
|
-
const classObj = {
|
|
937
|
-
'box-object': true,
|
|
938
|
-
};
|
|
939
|
-
const boStyle = {};
|
|
940
|
-
let column = null;
|
|
941
|
-
let index$1 = -1;
|
|
942
|
-
for (let i = 0; i < visibleColumns.length; i++) {
|
|
943
|
-
const c = visibleColumns[i];
|
|
944
|
-
if (c.name === boxObject.column) {
|
|
945
|
-
index$1 = i;
|
|
946
|
-
break;
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
if (index$1 >= 0) {
|
|
950
|
-
column = visibleColumns[index$1];
|
|
951
|
-
visibleColumns.splice(index$1, 1);
|
|
952
|
-
}
|
|
953
|
-
else if (fromSection) {
|
|
954
|
-
column = this.data.columns.find((x) => x.name === boxObject.column);
|
|
955
|
-
}
|
|
956
|
-
const cell = row.cells[boxObject.column];
|
|
957
|
-
let title = undefined;
|
|
958
|
-
if (cell && !this.kupManager.objects.isEmptyKupObj(cell.obj)) {
|
|
959
|
-
classObj['is-obj'] = true;
|
|
960
|
-
if (this.kupManager.debug.isDebug()) {
|
|
961
|
-
title =
|
|
962
|
-
cell.obj.t + '; ' + cell.obj.p + '; ' + cell.obj.k + ';';
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
const cellProps = {
|
|
966
|
-
cell: cell,
|
|
967
|
-
column: column,
|
|
968
|
-
component: this,
|
|
969
|
-
editable: this.editableData,
|
|
970
|
-
renderKup: true,
|
|
971
|
-
row: row,
|
|
972
|
-
setSizes: true,
|
|
973
|
-
shape: boxObject.shape,
|
|
974
|
-
};
|
|
975
|
-
return (index.h("div", { "data-cell": cell, "data-row": row, "data-column": boxObject.column, class: classObj, style: boStyle, title: title }, cell && column ? (index.h(fCell.FCell, Object.assign({}, cellProps))) : (index.h("span", null, boxObject.value))));
|
|
976
|
-
}
|
|
977
|
-
/**
|
|
978
|
-
* Prepares the kanban sections by sorting the boxlist's data.
|
|
979
|
-
* @returns {{jsx: VNode[], style: { [index: string]: string }}} jsx contains the virtual nodes of the Kanban sections, style contains the grid CSS settings.
|
|
980
|
-
*/
|
|
981
|
-
kanbanMode() {
|
|
982
|
-
// Testing whether there are columns to group by
|
|
983
|
-
if (!this.kanban.columns || this.kanban.columns.length === 0) {
|
|
984
|
-
this.kupManager.debug.logMessage(this, 'No columns to group by detected.', kupManager.KupDebugCategory.ERROR);
|
|
985
|
-
return {
|
|
986
|
-
jsx: (index.h("div", { id: "empty-data-message", class: "box-wrapper" }, index.h("div", { ref: (el) => this.rowsRefs.push(el) }), this.kupManager.language.translate(kupManager.KupLanguageGeneric.EMPTY_DATA))),
|
|
987
|
-
style: { 'grid-template-columns': `repeat(1, 1fr)` },
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
const kanbanSections = [];
|
|
991
|
-
// Creating empty sections from prop-defined labels
|
|
992
|
-
if (this.kanban.labels) {
|
|
993
|
-
for (let index = 0; index < this.kanban.labels.length; index++) {
|
|
994
|
-
const key = this.kanban.labels[index];
|
|
995
|
-
kanbanSections.push({ labels: key, nodes: [] });
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
// Browsing all rows
|
|
999
|
-
for (let index = 0; index < this.rows.length; index++) {
|
|
1000
|
-
let key = [];
|
|
1001
|
-
// Creating the key for the current row
|
|
1002
|
-
for (let j = 0; j < this.kanban.columns.length; j++) {
|
|
1003
|
-
try {
|
|
1004
|
-
key.push(this.rows[index].cells[this.kanban.columns[j]].value);
|
|
1005
|
-
}
|
|
1006
|
-
catch (error) {
|
|
1007
|
-
this.kupManager.debug.logMessage(this, error, kupManager.KupDebugCategory.WARNING);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
const check = {
|
|
1011
|
-
found: false,
|
|
1012
|
-
index: null,
|
|
1013
|
-
};
|
|
1014
|
-
// Browsing key array to search whether the current key exists or not
|
|
1015
|
-
for (let j = 0; j < kanbanSections.length; j++) {
|
|
1016
|
-
let sortingKey = kanbanSections[j].labels;
|
|
1017
|
-
let found = true;
|
|
1018
|
-
for (let i = 0; i < sortingKey.length; i++) {
|
|
1019
|
-
if (key[i] !== sortingKey[i]) {
|
|
1020
|
-
found = false;
|
|
1021
|
-
break;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
if (found) {
|
|
1025
|
-
check.found = true;
|
|
1026
|
-
check.index = j;
|
|
1027
|
-
break;
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
// If current key exists, box will be pushed into the existing array of virtual nodes
|
|
1031
|
-
if (check.found) {
|
|
1032
|
-
kanbanSections[check.index].nodes.push(this.renderRow(this.rows[index]));
|
|
1033
|
-
}
|
|
1034
|
-
else {
|
|
1035
|
-
// Otherwise, a new section will be defined starting with just the current virtal node
|
|
1036
|
-
kanbanSections.push({
|
|
1037
|
-
labels: key,
|
|
1038
|
-
nodes: [this.renderRow(this.rows[index])],
|
|
1039
|
-
});
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
// Once the arrays are set, they need to be emptied into columns
|
|
1043
|
-
const kanbanJSX = [];
|
|
1044
|
-
for (let index$1 = 0; index$1 < kanbanSections.length; index$1++) {
|
|
1045
|
-
const sortingKey = kanbanSections[index$1].labels;
|
|
1046
|
-
const props = {
|
|
1047
|
-
data: [],
|
|
1048
|
-
};
|
|
1049
|
-
for (let index = 0; index < sortingKey.length; index++) {
|
|
1050
|
-
props.data.push({
|
|
1051
|
-
value: sortingKey[index],
|
|
1052
|
-
id: sortingKey[index],
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
kanbanJSX.push(index.h("div", { class: "kanban-section" }, index.h(fChip.FChip, Object.assign({}, props)), kanbanSections[index$1].nodes));
|
|
1056
|
-
}
|
|
1057
|
-
return {
|
|
1058
|
-
jsx: kanbanJSX,
|
|
1059
|
-
style: {
|
|
1060
|
-
'grid-template-columns': this.kanban.size
|
|
1061
|
-
? `repeat(${Object.keys(kanbanSections).length}, ${this.kanban.size})`
|
|
1062
|
-
: `repeat(${Object.keys(kanbanSections).length}, 1fr)`,
|
|
1063
|
-
},
|
|
1064
|
-
};
|
|
1065
|
-
}
|
|
1066
|
-
didLoadInteractables() {
|
|
1067
|
-
this.interactableTouch.push(this.boxContainer);
|
|
1068
|
-
const tapCb = (e) => {
|
|
1069
|
-
if (this.hold) {
|
|
1070
|
-
this.hold = false;
|
|
1071
|
-
return;
|
|
1072
|
-
}
|
|
1073
|
-
switch (e.button) {
|
|
1074
|
-
case 2:
|
|
1075
|
-
this.kupBoxContextMenu.emit({
|
|
1076
|
-
comp: this,
|
|
1077
|
-
id: this.rootElement.id,
|
|
1078
|
-
details: this.contextMenuHandler(e),
|
|
1079
|
-
});
|
|
1080
|
-
break;
|
|
1081
|
-
}
|
|
1082
|
-
};
|
|
1083
|
-
const holdCb = (e) => {
|
|
1084
|
-
if (e.pointerType === 'pen' || e.pointerType === 'touch') {
|
|
1085
|
-
this.hold = true;
|
|
1086
|
-
this.kupBoxContextMenu.emit({
|
|
1087
|
-
comp: this,
|
|
1088
|
-
id: this.rootElement.id,
|
|
1089
|
-
details: this.contextMenuHandler(e),
|
|
1090
|
-
});
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
this.kupManager.interact.on(this.boxContainer, kupManager.KupPointerEventTypes.TAP, tapCb);
|
|
1094
|
-
this.kupManager.interact.on(this.boxContainer, kupManager.KupPointerEventTypes.HOLD, holdCb);
|
|
1095
|
-
}
|
|
1096
|
-
didRenderInteractables() {
|
|
1097
|
-
if (this.dragEnabled) {
|
|
1098
|
-
for (let index = 0; index < this.rowsRefs.length; index++) {
|
|
1099
|
-
const row = this.rowsRefs[index];
|
|
1100
|
-
const dataCb = () => {
|
|
1101
|
-
const cellEl = this.rootElement.shadowRoot.querySelector('.box-object:hover');
|
|
1102
|
-
return {
|
|
1103
|
-
cell: cellEl['data-cell'],
|
|
1104
|
-
column: cellUtils.getColumnByName(this.visibleColumns, cellEl.dataset.column),
|
|
1105
|
-
id: this.rootElement.id,
|
|
1106
|
-
multiple: this.multiSelection,
|
|
1107
|
-
row: cellEl['data-row'],
|
|
1108
|
-
selectedRows: this.selectedRows,
|
|
1109
|
-
};
|
|
1110
|
-
};
|
|
1111
|
-
if (row && !this.interactableDrag.includes(row)) {
|
|
1112
|
-
this.interactableDrag.push(row);
|
|
1113
|
-
this.kupManager.interact.draggable(row, {
|
|
1114
|
-
allowFrom: '.box-object',
|
|
1115
|
-
cursorChecker() {
|
|
1116
|
-
return null;
|
|
1117
|
-
},
|
|
1118
|
-
}, {
|
|
1119
|
-
callback: dataCb,
|
|
1120
|
-
}, kupManager.KupDragEffect.BADGE);
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
if (this.dropEnabled) {
|
|
1125
|
-
const dataCb = () => {
|
|
1126
|
-
const receivingDetails = this.getEventDetails(this.rootElement.shadowRoot.querySelector('.box:hover'));
|
|
1127
|
-
return {
|
|
1128
|
-
cell: receivingDetails.cell,
|
|
1129
|
-
column: receivingDetails.column,
|
|
1130
|
-
id: this.rootElement.id,
|
|
1131
|
-
row: receivingDetails.row,
|
|
1132
|
-
};
|
|
1133
|
-
};
|
|
1134
|
-
if (!this.interactableDrop.includes(this.sectionRef)) {
|
|
1135
|
-
this.interactableDrop.push(this.sectionRef);
|
|
1136
|
-
this.kupManager.interact.dropzone(this.sectionRef, {
|
|
1137
|
-
accept: `[${kupManager.kupDraggableCellAttr}]`,
|
|
1138
|
-
}, {
|
|
1139
|
-
dispatcher: this.rootElement,
|
|
1140
|
-
type: kupManager.KupDropEventTypes.BOX,
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
for (let index = 0; index < this.rowsRefs.length; index++) {
|
|
1144
|
-
const row = this.rowsRefs[index];
|
|
1145
|
-
if (row && !this.interactableDrop.includes(row)) {
|
|
1146
|
-
this.interactableDrop.push(row);
|
|
1147
|
-
this.kupManager.interact.dropzone(row, {
|
|
1148
|
-
accept: `[${kupManager.kupDraggableCellAttr}]`,
|
|
1149
|
-
}, {
|
|
1150
|
-
callback: dataCb,
|
|
1151
|
-
dispatcher: this.rootElement,
|
|
1152
|
-
type: kupManager.KupDropEventTypes.BOX,
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
/*-------------------------------------------------*/
|
|
1159
|
-
/* L i f e c y c l e H o o k s */
|
|
1160
|
-
/*-------------------------------------------------*/
|
|
1161
|
-
componentWillLoad() {
|
|
1162
|
-
this.kupManager.debug.logLoad(this, false);
|
|
1163
|
-
if (this.rowsPerPage) {
|
|
1164
|
-
this.currentRowsPerPage = this.rowsPerPage;
|
|
1165
|
-
}
|
|
1166
|
-
else if (this.pageSize) {
|
|
1167
|
-
this.currentRowsPerPage = this.pageSize;
|
|
1168
|
-
}
|
|
1169
|
-
if (this.data &&
|
|
1170
|
-
this.data.rows &&
|
|
1171
|
-
this.currentRowsPerPage > this.data.rows.length) {
|
|
1172
|
-
this.currentRowsPerPage = this.data.rows.length;
|
|
1173
|
-
}
|
|
1174
|
-
this.kupManager.language.register(this);
|
|
1175
|
-
this.kupManager.theme.register(this);
|
|
1176
|
-
this.onDataChanged();
|
|
1177
|
-
this.adjustPaginator();
|
|
1178
|
-
}
|
|
1179
|
-
componentDidLoad() {
|
|
1180
|
-
this.handleAutomaticBoxSelection();
|
|
1181
|
-
// When component is created, then the listener is set. @See clickFunction for more details
|
|
1182
|
-
document.addEventListener('click', this.clickFunction.bind(this));
|
|
1183
|
-
this.currentPage = this.pageSelected;
|
|
1184
|
-
if (this.multiSelection && this.selectedRowsState) {
|
|
1185
|
-
this.selectedRows = [];
|
|
1186
|
-
let selectedIds = this.selectedRowsState.split(';');
|
|
1187
|
-
this.selectedRows = this.data.rows.filter((r) => {
|
|
1188
|
-
return selectedIds.indexOf(r.id) >= 0;
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
this.didLoadInteractables();
|
|
1192
|
-
this.kupDidLoad.emit({ comp: this, id: this.rootElement.id });
|
|
1193
|
-
this.kupManager.debug.logLoad(this, true);
|
|
1194
|
-
}
|
|
1195
|
-
componentWillRender() {
|
|
1196
|
-
this.kupManager.debug.logRender(this, false);
|
|
1197
|
-
}
|
|
1198
|
-
componentDidRender() {
|
|
1199
|
-
const root = this.rootElement.shadowRoot;
|
|
1200
|
-
if (root) {
|
|
1201
|
-
const fs = root.querySelectorAll('.f-text-field');
|
|
1202
|
-
for (let index = 0; index < fs.length; index++) {
|
|
1203
|
-
fTextFieldMdc.FTextFieldMDC(fs[index]);
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
this.checkScrollOnHover();
|
|
1207
|
-
this.persistState();
|
|
1208
|
-
this.didRenderInteractables();
|
|
1209
|
-
this.kupManager.debug.logRender(this, true);
|
|
1210
|
-
}
|
|
1211
|
-
render() {
|
|
1212
|
-
const isKanban = !!(typeof this.kanban === 'object' && this.kanban !== null);
|
|
1213
|
-
let sortPanel = null;
|
|
1214
|
-
if (this.sortEnabled) {
|
|
1215
|
-
// creating items
|
|
1216
|
-
const visibleColumnsItems = this.visibleColumns.map((column) => {
|
|
1217
|
-
const item = {
|
|
1218
|
-
value: column.title,
|
|
1219
|
-
id: column.name,
|
|
1220
|
-
selected: column.name === this.sortBy,
|
|
1221
|
-
};
|
|
1222
|
-
return item;
|
|
1223
|
-
});
|
|
1224
|
-
const items = [{ value: '', id: '' }, ...visibleColumnsItems];
|
|
1225
|
-
let textfieldData = {
|
|
1226
|
-
label: this.kupManager.language.translate(kupManager.KupLanguageGeneric.SORT_BY),
|
|
1227
|
-
trailingIcon: true,
|
|
1228
|
-
};
|
|
1229
|
-
let listData = {
|
|
1230
|
-
data: items,
|
|
1231
|
-
selectable: true,
|
|
1232
|
-
};
|
|
1233
|
-
let data = {
|
|
1234
|
-
'kup-text-field': textfieldData,
|
|
1235
|
-
'kup-list': listData,
|
|
1236
|
-
};
|
|
1237
|
-
sortPanel = (index.h("div", { id: "sort-panel" }, index.h("kup-combobox", { data: data, initialValue: this.sortBy, "onkup-combobox-itemclick": (e) => this.onSortChange(e) })));
|
|
1238
|
-
}
|
|
1239
|
-
let filterPanel = null;
|
|
1240
|
-
if (this.globalFilter) {
|
|
1241
|
-
filterPanel = (index.h("div", { id: "global-filter" }, index.h("kup-text-field", { fullWidth: true, label: this.kupManager.language.translate(kupManager.KupLanguageSearch.SEARCH), icon: kupManager.KupThemeIconValues.SEARCH, initialValue: this.globalFilterValue, "onkup-textfield-input": (event) => {
|
|
1242
|
-
window.clearTimeout(this.globalFilterTimeout);
|
|
1243
|
-
this.globalFilterTimeout = window.setTimeout(() => this.onGlobalFilterChange(event), 600);
|
|
1244
|
-
} })));
|
|
1245
|
-
}
|
|
1246
|
-
let paginator = null;
|
|
1247
|
-
if (this.pagination) {
|
|
1248
|
-
paginator = (index.h(fPaginatorUtils.FPaginator, { id: top ? 'top-paginator' : 'bottom-paginator', currentPage: this.currentPage, max: this.filteredRows.length, mode: fPaginatorUtils.FPaginatorMode.SIMPLE, perPage: this.currentRowsPerPage
|
|
1249
|
-
? this.currentRowsPerPage
|
|
1250
|
-
: this.pageSize, onPageChange: (e) => this.handlePageChange(e.detail.value), onRowsChange: (e) => this.handleRowsPerPageChange(e.detail.value) }));
|
|
1251
|
-
}
|
|
1252
|
-
let boxContent = null;
|
|
1253
|
-
let containerStyle = {};
|
|
1254
|
-
if (this.rows.length === 0) {
|
|
1255
|
-
boxContent = (index.h("div", { id: "empty-data-message", class: "box-wrapper" }, index.h("div", { class: "box", ref: (el) => this.rowsRefs.push(el) }, this.kupManager.language.translate(kupManager.KupLanguageGeneric.EMPTY_DATA))));
|
|
1256
|
-
containerStyle = { 'grid-template-columns': `repeat(1, 1fr)` };
|
|
1257
|
-
}
|
|
1258
|
-
else if (isKanban) {
|
|
1259
|
-
const kanban = this.kanbanMode();
|
|
1260
|
-
boxContent = kanban.jsx;
|
|
1261
|
-
containerStyle = kanban.style;
|
|
1262
|
-
}
|
|
1263
|
-
else {
|
|
1264
|
-
containerStyle = {
|
|
1265
|
-
'grid-template-columns': `repeat(${this.columns}, 1fr)`,
|
|
1266
|
-
};
|
|
1267
|
-
const rows = this.rows;
|
|
1268
|
-
let size = rows.length;
|
|
1269
|
-
let cnt = 0;
|
|
1270
|
-
boxContent = [];
|
|
1271
|
-
while (size-- > 0) {
|
|
1272
|
-
boxContent.push(this.renderRow(rows[cnt++]));
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
return (index.h(index.Host, null, index.h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)), index.h("div", { id: GenericVariables.componentWrapperId }, index.h("div", { class: 'box-component', ref: (el) => (this.sectionRef = el) }, sortPanel, filterPanel, paginator, index.h("div", { class: isKanban ? 'is-kanban' : '', id: 'box-container', style: containerStyle, onContextMenu: (e) => {
|
|
1276
|
-
e.preventDefault();
|
|
1277
|
-
}, ref: (el) => (this.boxContainer =
|
|
1278
|
-
el) }, boxContent)))));
|
|
1279
|
-
}
|
|
1280
|
-
disconnectedCallback() {
|
|
1281
|
-
this.kupManager.interact.unregister(this.interactableDrag.concat(this.interactableDrop));
|
|
1282
|
-
this.kupManager.language.unregister(this);
|
|
1283
|
-
this.kupManager.theme.unregister(this);
|
|
1284
|
-
if (this.scrollOnHover) {
|
|
1285
|
-
this.kupManager.scrollOnHover.unregister(this.boxContainer);
|
|
1286
|
-
}
|
|
1287
|
-
// When component is destroyed, then the listener is removed. @See clickFunction for more details
|
|
1288
|
-
document.removeEventListener('click', this.clickFunction.bind(this));
|
|
1289
|
-
this.kupDidUnload.emit({ comp: this, id: this.rootElement.id });
|
|
1290
|
-
}
|
|
1291
|
-
get rootElement() { return index.getElement(this); }
|
|
1292
|
-
static get watchers() { return {
|
|
1293
|
-
"pageSize": ["rowsPerPageHandler", "recalculateRows"],
|
|
1294
|
-
"globalFilterValue": ["recalculateRows"],
|
|
1295
|
-
"sortBy": ["recalculateRows"],
|
|
1296
|
-
"pagination": ["recalculateRows"],
|
|
1297
|
-
"currentPage": ["recalculateRows"],
|
|
1298
|
-
"currentRowsPerPage": ["recalculateRows"],
|
|
1299
|
-
"data": ["onDataChanged"],
|
|
1300
|
-
"layout": ["onLayoutChanged"],
|
|
1301
|
-
"selectBox": ["onSelectBoxChanged"]
|
|
1302
|
-
}; }
|
|
1303
|
-
};
|
|
1304
|
-
KupBox.style = kupBoxCss;
|
|
9
|
+
const cellUtils = require('./cell-utils-fe64a28c.js');
|
|
1305
10
|
|
|
1306
11
|
/*! *****************************************************************************
|
|
1307
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -16105,55 +14810,55 @@ registerShape('bezierCurve', BezierCurve);
|
|
|
16105
14810
|
registerShape('arc', Arc);
|
|
16106
14811
|
|
|
16107
14812
|
const graphic = /*#__PURE__*/Object.freeze({
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
14813
|
+
__proto__: null,
|
|
14814
|
+
updateProps: updateProps$1,
|
|
14815
|
+
initProps: initProps,
|
|
14816
|
+
removeElement: removeElement,
|
|
14817
|
+
removeElementWithFadeOut: removeElementWithFadeOut,
|
|
14818
|
+
isElementRemoved: isElementRemoved,
|
|
14819
|
+
extendShape: extendShape,
|
|
14820
|
+
extendPath: extendPath,
|
|
14821
|
+
registerShape: registerShape,
|
|
14822
|
+
getShapeClass: getShapeClass,
|
|
14823
|
+
makePath: makePath,
|
|
14824
|
+
makeImage: makeImage,
|
|
14825
|
+
mergePath: mergePath,
|
|
14826
|
+
resizePath: resizePath,
|
|
14827
|
+
subPixelOptimizeLine: subPixelOptimizeLine,
|
|
14828
|
+
subPixelOptimizeRect: subPixelOptimizeRect,
|
|
14829
|
+
subPixelOptimize: subPixelOptimize,
|
|
14830
|
+
getTransform: getTransform$1,
|
|
14831
|
+
applyTransform: applyTransform,
|
|
14832
|
+
transformDirection: transformDirection,
|
|
14833
|
+
groupTransition: groupTransition,
|
|
14834
|
+
clipPointsByRect: clipPointsByRect,
|
|
14835
|
+
clipRectByRect: clipRectByRect,
|
|
14836
|
+
createIcon: createIcon,
|
|
14837
|
+
linePolygonIntersect: linePolygonIntersect,
|
|
14838
|
+
lineLineIntersect: lineLineIntersect$1,
|
|
14839
|
+
setTooltipConfig: setTooltipConfig,
|
|
14840
|
+
traverseElements: traverseElements,
|
|
14841
|
+
Group: Group$3,
|
|
14842
|
+
Image: ZRImage,
|
|
14843
|
+
Text: ZRText,
|
|
14844
|
+
Circle: Circle,
|
|
14845
|
+
Ellipse: Ellipse,
|
|
14846
|
+
Sector: Sector,
|
|
14847
|
+
Ring: Ring,
|
|
14848
|
+
Polygon: Polygon,
|
|
14849
|
+
Polyline: Polyline$1,
|
|
14850
|
+
Rect: Rect$2,
|
|
14851
|
+
Line: Line$1,
|
|
14852
|
+
BezierCurve: BezierCurve,
|
|
14853
|
+
Arc: Arc,
|
|
14854
|
+
IncrementalDisplayable: IncrementalDisplayable,
|
|
14855
|
+
CompoundPath: CompoundPath,
|
|
14856
|
+
LinearGradient: LinearGradient,
|
|
14857
|
+
RadialGradient: RadialGradient,
|
|
14858
|
+
BoundingRect: BoundingRect,
|
|
14859
|
+
OrientedBoundingRect: OrientedBoundingRect,
|
|
14860
|
+
Point: Point,
|
|
14861
|
+
Path: Path
|
|
16157
14862
|
});
|
|
16158
14863
|
|
|
16159
14864
|
var EMPTY_OBJ = {};
|
|
@@ -95503,5 +94208,4 @@ _KupEchart_chartContainer = new WeakMap(), _KupEchart_chartEl = new WeakMap(), _
|
|
|
95503
94208
|
};
|
|
95504
94209
|
KupEchart.style = kupEchartCss;
|
|
95505
94210
|
|
|
95506
|
-
exports.kup_box = KupBox;
|
|
95507
94211
|
exports.kup_echart = KupEchart;
|