@sme.up/ketchup 4.0.0 → 4.1.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-1f89a299.js → cell-utils-841a7769.js} +2 -2
- package/dist/cjs/{f-chip-2d58c8f7.js → f-chip-b9f489ff.js} +7 -5
- package/dist/cjs/{f-image-5f4f29ca.js → f-image-0c3e6aa7.js} +3 -4
- package/dist/cjs/{index-3c471303.js → index-0416afab.js} +73 -64
- package/dist/cjs/ketchup.cjs.js +3 -3
- package/dist/cjs/kup-accordion.cjs.entry.js +5 -5
- package/dist/cjs/kup-autocomplete_29.cjs.entry.js +1014 -1103
- package/dist/cjs/kup-calendar.cjs.entry.js +8 -8
- package/dist/cjs/kup-dash-list.cjs.entry.js +6 -6
- package/dist/cjs/kup-dash_2.cjs.entry.js +106 -62
- package/dist/cjs/kup-drawer.cjs.entry.js +4 -4
- package/dist/cjs/kup-field.cjs.entry.js +3 -3
- package/dist/cjs/kup-iframe.cjs.entry.js +4 -4
- package/dist/cjs/kup-lazy.cjs.entry.js +4 -4
- package/dist/cjs/kup-magic-box.cjs.entry.js +21 -30
- package/dist/cjs/{kup-manager-59ad8bdc.js → kup-manager-828bd598.js} +599 -519
- package/dist/cjs/kup-nav-bar.cjs.entry.js +4 -4
- package/dist/cjs/{kup-objects-59ea949c.js → kup-objects-89f38d6a.js} +7 -29
- package/dist/cjs/kup-probe.cjs.entry.js +3 -3
- package/dist/cjs/kup-qlik.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{utils-2af73538.js → utils-5192ee20.js} +1 -1
- package/dist/collection/assets/data-table.js +1 -0
- package/dist/collection/collection-manifest.json +2 -3
- package/dist/collection/components/kup-accordion/kup-accordion.js +14 -14
- package/dist/collection/components/kup-autocomplete/kup-autocomplete.css +9 -0
- package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +20 -23
- package/dist/collection/components/kup-badge/kup-badge.js +12 -12
- package/dist/collection/components/kup-box/kup-box.css +30 -30
- package/dist/collection/components/kup-box/kup-box.js +181 -171
- package/dist/collection/components/kup-button/kup-button.css +8 -5
- package/dist/collection/components/kup-button/kup-button.js +26 -26
- package/dist/collection/components/kup-button-list/kup-button-list.css +8 -5
- package/dist/collection/components/kup-button-list/kup-button-list.js +18 -18
- package/dist/collection/components/kup-calendar/kup-calendar.css +8 -6
- package/dist/collection/components/kup-calendar/kup-calendar.js +30 -30
- package/dist/collection/components/kup-card/kup-card-helper.js +2 -1
- package/dist/collection/components/kup-card/kup-card.css +20 -1
- package/dist/collection/components/kup-card/kup-card.js +26 -26
- package/dist/collection/components/kup-chart/kup-chart.js +40 -40
- package/dist/collection/components/kup-checkbox/kup-checkbox.js +18 -18
- package/dist/collection/components/kup-chip/kup-chip.css +0 -1
- package/dist/collection/components/kup-chip/kup-chip.js +14 -14
- package/dist/collection/components/kup-color-picker/kup-color-picker.css +6 -9
- package/dist/collection/components/kup-color-picker/kup-color-picker.js +32 -40
- package/dist/collection/components/kup-combobox/kup-combobox.css +9 -0
- package/dist/collection/components/kup-combobox/kup-combobox.js +20 -23
- package/dist/collection/components/kup-dash-list/kup-dash-list.js +2 -2
- package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +1 -0
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +25 -46
- package/dist/collection/components/kup-data-table/kup-data-table.css +83 -87
- package/dist/collection/components/kup-data-table/kup-data-table.js +364 -531
- package/dist/collection/components/kup-date-picker/kup-date-picker.css +2373 -5
- package/dist/collection/components/kup-date-picker/kup-date-picker.js +72 -104
- package/dist/collection/components/kup-drawer/kup-drawer.js +8 -8
- package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.css +13 -5
- package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +38 -43
- package/dist/collection/components/kup-field/kup-field.js +20 -20
- package/dist/collection/components/kup-gauge/kup-gauge.js +16 -16
- package/dist/collection/components/kup-grid/kup-grid.css +2 -1
- package/dist/collection/components/kup-grid/kup-grid.js +12 -12
- package/dist/collection/components/kup-iframe/kup-iframe.js +4 -4
- package/dist/collection/components/kup-image/kup-image.js +24 -24
- package/dist/collection/components/kup-lazy/kup-lazy.js +16 -16
- package/dist/collection/components/kup-list/kup-list-declarations.js +1 -1
- package/dist/collection/components/kup-list/kup-list.css +4 -0
- package/dist/collection/components/kup-list/kup-list.js +38 -47
- package/dist/collection/components/kup-magic-box/kup-magic-box.css +11 -6
- package/dist/collection/components/kup-magic-box/kup-magic-box.js +27 -36
- package/dist/collection/components/kup-nav-bar/kup-nav-bar.js +10 -10
- package/dist/collection/components/kup-paginator/kup-paginator.css +8 -5
- package/dist/collection/components/kup-probe/kup-probe.js +8 -8
- package/dist/collection/components/kup-progress-bar/kup-progress-bar.js +20 -20
- package/dist/collection/components/kup-radio/kup-radio.js +16 -16
- package/dist/collection/components/kup-rating/kup-rating.js +14 -14
- package/dist/collection/components/kup-spinner/kup-spinner.js +22 -22
- package/dist/collection/components/kup-switch/kup-switch.js +16 -16
- package/dist/collection/components/kup-tab-bar/kup-tab-bar.js +12 -12
- package/dist/collection/components/kup-text-field/kup-text-field.js +48 -48
- package/dist/collection/components/kup-time-picker/kup-time-picker.css +2376 -0
- package/dist/collection/components/kup-time-picker/kup-time-picker.js +50 -83
- package/dist/collection/components/kup-tooltip/kup-tooltip.js +18 -12
- package/dist/collection/components/kup-tree/kup-tree.css +10 -10
- package/dist/collection/components/kup-tree/kup-tree.js +96 -66
- package/dist/collection/f-components/f-button/f-button.js +4 -2
- package/dist/collection/f-components/f-image/f-image.js +1 -2
- package/dist/collection/f-components/f-text-field/f-text-field.js +8 -6
- package/dist/collection/utils/kup-column-menu/kup-column-menu.js +11 -3
- package/dist/collection/utils/kup-debug/kup-debug.js +25 -27
- package/dist/collection/utils/kup-dynamic-position/kup-dynamic-position.js +3 -5
- package/dist/collection/utils/kup-interact/kup-interact-declarations.js +48 -0
- package/dist/collection/utils/kup-interact/kup-interact.js +362 -0
- package/dist/collection/utils/kup-manager/kup-manager.js +18 -6
- package/dist/collection/utils/kup-objects/kup-objects.js +7 -29
- package/dist/collection/utils/kup-scroll-on-hover/kup-scroll-on-hover.js +60 -62
- package/dist/collection/utils/kup-toolbar/kup-toolbar.js +16 -18
- package/dist/esm/{cell-utils-cb612463.js → cell-utils-de384721.js} +2 -2
- package/dist/esm/{f-chip-125d5dd6.js → f-chip-d585b63e.js} +7 -5
- package/dist/esm/{f-image-68b34fab.js → f-image-23548d00.js} +3 -4
- package/dist/esm/{index-bf2824a6.js → index-51694018.js} +73 -64
- package/dist/esm/ketchup.js +3 -3
- package/dist/esm/kup-accordion.entry.js +5 -5
- package/dist/esm/kup-autocomplete_29.entry.js +818 -907
- package/dist/esm/kup-calendar.entry.js +8 -8
- package/dist/esm/kup-dash-list.entry.js +6 -6
- package/dist/esm/kup-dash_2.entry.js +106 -62
- package/dist/esm/kup-drawer.entry.js +4 -4
- package/dist/esm/kup-field.entry.js +3 -3
- package/dist/esm/kup-iframe.entry.js +4 -4
- package/dist/esm/kup-lazy.entry.js +4 -4
- package/dist/esm/kup-magic-box.entry.js +21 -30
- package/dist/esm/{kup-manager-e7d7b353.js → kup-manager-583f2815.js} +595 -520
- package/dist/esm/kup-nav-bar.entry.js +4 -4
- package/dist/esm/{kup-objects-d38d2fa2.js → kup-objects-5968aefd.js} +7 -29
- package/dist/esm/kup-probe.entry.js +3 -3
- package/dist/esm/kup-qlik.entry.js +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-13dd007a.js → utils-a1dd14c3.js} +1 -1
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-64ea7e37.entry.js → p-0e91c9c9.entry.js} +1 -1
- package/dist/ketchup/{p-0320e24e.entry.js → p-0f2b6a24.entry.js} +1 -1
- package/dist/ketchup/{p-a5424073.js → p-361d9431.js} +1 -1
- package/dist/ketchup/p-565785ce.js +1 -0
- package/dist/ketchup/{p-7896031c.entry.js → p-57eb45ac.entry.js} +1 -1
- package/dist/ketchup/{p-08c7a092.js → p-6f5d8830.js} +1 -1
- package/dist/ketchup/{p-9c858a38.entry.js → p-802d8906.entry.js} +1 -1
- package/dist/ketchup/p-850b9e67.entry.js +1 -0
- package/dist/ketchup/{p-a12a5690.entry.js → p-88a5787a.entry.js} +1 -1
- package/dist/ketchup/p-8ed2b7bf.entry.js +1 -0
- package/dist/ketchup/{p-ee89966f.entry.js → p-90a0c2b7.entry.js} +2 -2
- package/dist/ketchup/{p-876da4c2.entry.js → p-94c0dd8c.entry.js} +1 -1
- package/dist/ketchup/p-9ec3c377.entry.js +45 -0
- package/dist/ketchup/p-b30f34d8.js +1 -0
- package/dist/ketchup/p-b6a47512.entry.js +1 -0
- package/dist/ketchup/p-bfaf8a82.js +1 -0
- package/dist/ketchup/{p-940ab57a.entry.js → p-ca0ebdcc.entry.js} +1 -1
- package/dist/ketchup/p-d5a3a4ed.js +1 -0
- package/dist/ketchup/{p-c7ee1fbc.js → p-ee7b190c.js} +1 -1
- package/dist/ketchup/{p-b0724035.entry.js → p-f6b54fa1.entry.js} +1 -1
- package/dist/types/components/kup-box/kup-box-declarations.d.ts +11 -2
- package/dist/types/components/kup-box/kup-box.d.ts +8 -4
- package/dist/types/components/kup-color-picker/kup-color-picker.d.ts +0 -1
- package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +12 -4
- package/dist/types/components/kup-data-table/kup-data-table-helper.d.ts +0 -2
- package/dist/types/components/kup-data-table/kup-data-table.d.ts +16 -49
- package/dist/types/components/kup-date-picker/kup-date-picker.d.ts +11 -14
- package/dist/types/components/kup-dropdown-button/kup-dropdown-button.d.ts +0 -4
- package/dist/types/components/kup-list/kup-list-declarations.d.ts +1 -1
- package/dist/types/components/kup-list/kup-list.d.ts +2 -3
- package/dist/types/components/kup-magic-box/kup-magic-box.d.ts +1 -0
- package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +7 -11
- package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +4 -4
- package/dist/types/components/kup-tree/kup-tree.d.ts +3 -0
- package/dist/types/components.d.ts +84 -121
- package/dist/types/utils/kup-dynamic-position/kup-dynamic-position.d.ts +2 -2
- package/dist/types/utils/kup-interact/kup-interact-declarations.d.ts +127 -0
- package/dist/types/utils/kup-interact/kup-interact.d.ts +93 -0
- package/dist/types/utils/kup-manager/kup-manager-declarations.d.ts +21 -4
- package/dist/types/utils/kup-manager/kup-manager.d.ts +2 -2
- package/dist/types/utils/kup-objects/kup-objects.d.ts +1 -7
- package/package.json +3 -3
- package/dist/cjs/drag-and-drop-4787ff6f.js +0 -281
- package/dist/cjs/kup-grid.cjs.entry.js +0 -130
- package/dist/collection/assets/images/drag-multiple.js +0 -1
- package/dist/collection/components/kup-layout/kup-layout.css +0 -53
- package/dist/collection/components/kup-layout/kup-layout.js +0 -156
- package/dist/collection/utils/drag-and-drop.js +0 -109
- package/dist/collection/utils/kup-dialog/kup-dialog-declarations.js +0 -36
- package/dist/collection/utils/kup-dialog/kup-dialog.js +0 -310
- package/dist/esm/drag-and-drop-321cb4ca.js +0 -265
- package/dist/esm/kup-grid.entry.js +0 -126
- package/dist/ketchup/p-00fe1e3e.js +0 -1
- package/dist/ketchup/p-1165f4ea.entry.js +0 -1
- package/dist/ketchup/p-170d3cba.js +0 -1
- package/dist/ketchup/p-18cb3ba3.js +0 -1
- package/dist/ketchup/p-23541a97.entry.js +0 -45
- package/dist/ketchup/p-8fb9d9b2.entry.js +0 -1
- package/dist/ketchup/p-b14e77f0.js +0 -1
- package/dist/ketchup/p-d24cfdea.entry.js +0 -1
- package/dist/ketchup/p-fcd2fd8f.js +0 -1
- package/dist/ketchup/p-fce3b9d8.entry.js +0 -1
- package/dist/types/assets/images/drag-multiple.d.ts +0 -1
- package/dist/types/components/kup-layout/kup-layout.d.ts +0 -25
- package/dist/types/utils/drag-and-drop.d.ts +0 -53
- package/dist/types/utils/kup-dialog/kup-dialog-declarations.d.ts +0 -43
- package/dist/types/utils/kup-dialog/kup-dialog.d.ts +0 -50
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Component, Element, Event, forceUpdate, getAssetPath, h, Host, Method, Prop, State, Watch, } from '@stencil/core';
|
|
2
|
-
import { FixedCellsClasses, FixedCellsCSSVarsBase, GroupLabelDisplayMode,
|
|
2
|
+
import { FixedCellsClasses, FixedCellsCSSVarsBase, GroupLabelDisplayMode, LoadMoreMode, PaginatorPos, ShowGrid, SortMode, TotalMode, TotalLabel, KupDataTableProps, fieldColumn, iconColumn, keyColumn, SelectionMode, } from './kup-data-table-declarations';
|
|
3
3
|
import { isRating, isGauge, isKnob, getCellType, getColumnByName, getCellValueForDisplay, } from '../../utils/cell-utils';
|
|
4
|
-
import { calcTotals, normalizeRows, filterRows, groupRows, paginateRows, sortRows, styleHasBorderRadius, styleHasWritingMode,
|
|
4
|
+
import { calcTotals, normalizeRows, filterRows, groupRows, paginateRows, sortRows, styleHasBorderRadius, styleHasWritingMode, } from './kup-data-table-helper';
|
|
5
5
|
import { stringToNumber, numberToFormattedStringNumber, identify, deepEqual, getProps, setProps, } from '../../utils/utils';
|
|
6
6
|
import { ItemsDisplayMode, } from '../kup-list/kup-list-declarations';
|
|
7
7
|
import { kupManagerInstance, } from '../../utils/kup-manager/kup-manager';
|
|
8
8
|
import { KupDataTableState } from './kup-data-table-state';
|
|
9
9
|
import { setTooltip, unsetTooltip } from '../../utils/helpers';
|
|
10
|
-
import { setDragEffectAllowed, setKetchupDraggable, setKetchupDroppable, setDragDropPayload, getDragDropPayload, } from '../../utils/drag-and-drop';
|
|
11
|
-
import { dragMultipleImg } from '../../assets/images/drag-multiple';
|
|
12
10
|
import { FImage } from '../../f-components/f-image/f-image';
|
|
13
11
|
import { FTextField } from '../../f-components/f-text-field/f-text-field';
|
|
14
12
|
import { FChip } from '../../f-components/f-chip/f-chip';
|
|
@@ -26,6 +24,7 @@ import { KupLanguageDensity, KupLanguageFontsize, KupLanguageGeneric, KupLanguag
|
|
|
26
24
|
import { KupThemeColorValues, KupThemeIconValues, } from '../../utils/kup-theme/kup-theme-declarations';
|
|
27
25
|
import { componentWrapperId } from '../../variables/GenericVariables';
|
|
28
26
|
import { KupDatesFormats } from '../../utils/kup-dates/kup-dates-declarations';
|
|
27
|
+
import { kupDragActiveAttr, KupDragEffect, kupDraggableCellAttr, kupDraggableColumnAttr, KupDropEventTypes, KupPointerEventTypes, } from '../../utils/kup-interact/kup-interact-declarations';
|
|
29
28
|
export class KupDataTable {
|
|
30
29
|
constructor() {
|
|
31
30
|
//////////////////////////////
|
|
@@ -159,6 +158,10 @@ export class KupDataTable {
|
|
|
159
158
|
* Sets the possibility to remove the selected column.
|
|
160
159
|
*/
|
|
161
160
|
this.removableColumns = false;
|
|
161
|
+
/**
|
|
162
|
+
* Gives the possibility to resize columns by dragging on their right edge.
|
|
163
|
+
*/
|
|
164
|
+
this.resizableColumns = true;
|
|
162
165
|
/**
|
|
163
166
|
* Sets the number of rows per page to display.
|
|
164
167
|
*/
|
|
@@ -244,10 +247,6 @@ export class KupDataTable {
|
|
|
244
247
|
* name of the column with the opened total menu
|
|
245
248
|
*/
|
|
246
249
|
this.openedTotalMenu = null;
|
|
247
|
-
/**
|
|
248
|
-
* name of the column with the opened group menu
|
|
249
|
-
*/
|
|
250
|
-
this.openedGroupMenu = null;
|
|
251
250
|
this.openedCustomSettings = false;
|
|
252
251
|
this.fontsize = 'medium';
|
|
253
252
|
/**
|
|
@@ -264,32 +263,6 @@ export class KupDataTable {
|
|
|
264
263
|
this.renderedRows = [];
|
|
265
264
|
this.loadMoreEventCounter = 0;
|
|
266
265
|
this.loadMoreEventPreviousQuantity = 0;
|
|
267
|
-
/**
|
|
268
|
-
* Internal not reactive state used to keep track if a column is being dragged.
|
|
269
|
-
* @private
|
|
270
|
-
*/
|
|
271
|
-
this.columnsAreBeingDragged = false;
|
|
272
|
-
/**
|
|
273
|
-
* Attribute to set when a column is being dragged on the whole thead element
|
|
274
|
-
* @const
|
|
275
|
-
* @default 'columns-dragging'
|
|
276
|
-
* @private
|
|
277
|
-
*/
|
|
278
|
-
this.dragFlagAttribute = 'columns-dragging';
|
|
279
|
-
/**
|
|
280
|
-
* The string representing the drag over attribute
|
|
281
|
-
* @const
|
|
282
|
-
* @default 'drag-over'
|
|
283
|
-
* @private
|
|
284
|
-
*/
|
|
285
|
-
this.dragOverAttribute = 'drag-over';
|
|
286
|
-
/**
|
|
287
|
-
* The string representing the drag starter attribute to set onto the element
|
|
288
|
-
* @const
|
|
289
|
-
* @default 'drag-starter'
|
|
290
|
-
* @private
|
|
291
|
-
*/
|
|
292
|
-
this.dragStarterAttribute = 'drag-starter';
|
|
293
266
|
/**
|
|
294
267
|
* contains the original data, used in transposed function
|
|
295
268
|
* @private
|
|
@@ -305,8 +278,17 @@ export class KupDataTable {
|
|
|
305
278
|
this.isRestoringState = false;
|
|
306
279
|
this.totalMenuCoords = null;
|
|
307
280
|
this.clickTimeout = [];
|
|
281
|
+
this.thRefs = [];
|
|
308
282
|
this.rowsRefs = [];
|
|
309
283
|
this.oldWidth = null;
|
|
284
|
+
this.hold = false;
|
|
285
|
+
this.interactableDrag = [];
|
|
286
|
+
this.interactableDrop = [];
|
|
287
|
+
this.interactableResize = [];
|
|
288
|
+
this.interactableTouch = [];
|
|
289
|
+
this.dropareaRef = null;
|
|
290
|
+
this.removeDropareaRef = null;
|
|
291
|
+
this.groupsDropareaRef = null;
|
|
310
292
|
/**
|
|
311
293
|
* Reference to the row detail card.
|
|
312
294
|
*/
|
|
@@ -627,16 +609,6 @@ export class KupDataTable {
|
|
|
627
609
|
this.columnMenuCard.layoutNumber = 12;
|
|
628
610
|
this.columnMenuCard.sizeX = 'auto';
|
|
629
611
|
this.columnMenuCard.sizeY = 'auto';
|
|
630
|
-
this.columnMenuCard.tabIndex = -1;
|
|
631
|
-
this.columnMenuCard.onclick = (e) => e.stopPropagation();
|
|
632
|
-
this.columnMenuCard.addEventListener('blur', () => {
|
|
633
|
-
if (this.kupManager.utilities.lastPointerDownPath.includes(this.columnMenuCard)) {
|
|
634
|
-
this.columnMenuCard.focus();
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
this.closeColumnMenu();
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
612
|
this.columnMenuCard.addEventListener('kup-card-click', (e) => {
|
|
641
613
|
this.kupDataTableColumnMenu.emit({
|
|
642
614
|
comp: this,
|
|
@@ -1010,9 +982,235 @@ export class KupDataTable {
|
|
|
1010
982
|
};
|
|
1011
983
|
this.intObserver = new IntersectionObserver(callback, options);
|
|
1012
984
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
985
|
+
didLoadInteractables() {
|
|
986
|
+
this.interactableTouch.push(this.tableRef);
|
|
987
|
+
const tapCb = (e) => {
|
|
988
|
+
if (this.hold) {
|
|
989
|
+
this.hold = false;
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
switch (e.button) {
|
|
993
|
+
// left click
|
|
994
|
+
case 0:
|
|
995
|
+
// Note: event must be cloned
|
|
996
|
+
// otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
|
|
997
|
+
const clone = {};
|
|
998
|
+
for (const key in e) {
|
|
999
|
+
clone[key] = e[key];
|
|
1000
|
+
}
|
|
1001
|
+
this.clickTimeout.push(setTimeout(() => {
|
|
1002
|
+
this.kupDataTableClick.emit({
|
|
1003
|
+
comp: this,
|
|
1004
|
+
id: this.rootElement.id,
|
|
1005
|
+
details: this.clickHandler(clone),
|
|
1006
|
+
});
|
|
1007
|
+
}, 300));
|
|
1008
|
+
break;
|
|
1009
|
+
// right click
|
|
1010
|
+
case 2:
|
|
1011
|
+
this.kupDataTableContextMenu.emit({
|
|
1012
|
+
comp: this,
|
|
1013
|
+
id: this.rootElement.id,
|
|
1014
|
+
details: this.contextMenuHandler(e),
|
|
1015
|
+
});
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
const doubletapCb = (e) => {
|
|
1020
|
+
switch (e.button) {
|
|
1021
|
+
// left click
|
|
1022
|
+
case 0:
|
|
1023
|
+
for (let index = 0; index < this.clickTimeout.length; index++) {
|
|
1024
|
+
clearTimeout(this.clickTimeout[index]);
|
|
1025
|
+
this.kupManager.debug.logMessage(this, 'Cleared clickHandler timeout(' +
|
|
1026
|
+
this.clickTimeout[index] +
|
|
1027
|
+
').');
|
|
1028
|
+
}
|
|
1029
|
+
this.clickTimeout = [];
|
|
1030
|
+
this.kupDataTableDblClick.emit({
|
|
1031
|
+
comp: this,
|
|
1032
|
+
id: this.rootElement.id,
|
|
1033
|
+
details: this.dblClickHandler(e),
|
|
1034
|
+
});
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
const holdCb = (e) => {
|
|
1039
|
+
if (e.pointerType === 'pen' || e.pointerType === 'touch') {
|
|
1040
|
+
this.hold = true;
|
|
1041
|
+
this.kupDataTableContextMenu.emit({
|
|
1042
|
+
comp: this,
|
|
1043
|
+
id: this.rootElement.id,
|
|
1044
|
+
details: this.contextMenuHandler(e),
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
this.kupManager.interact.on(this.tableRef, KupPointerEventTypes.TAP, tapCb);
|
|
1049
|
+
this.kupManager.interact.on(this.tableRef, KupPointerEventTypes.DOUBLETAP, doubletapCb);
|
|
1050
|
+
this.kupManager.interact.on(this.tableRef, KupPointerEventTypes.HOLD, holdCb);
|
|
1051
|
+
}
|
|
1052
|
+
didRenderInteractables() {
|
|
1053
|
+
if (this.showGroups) {
|
|
1054
|
+
if (!this.interactableDrop.includes(this.groupsDropareaRef)) {
|
|
1055
|
+
this.interactableDrop.push(this.groupsDropareaRef);
|
|
1056
|
+
this.kupManager.interact.dropzone(this.groupsDropareaRef, {
|
|
1057
|
+
accept: `[${kupDraggableColumnAttr}]`,
|
|
1058
|
+
}, null, {
|
|
1059
|
+
drop: (e) => {
|
|
1060
|
+
const draggedTh = e.relatedTarget;
|
|
1061
|
+
const grouped = getColumnByName(this.getColumns(), draggedTh.dataset.column);
|
|
1062
|
+
this.handleColumnGroup(grouped);
|
|
1063
|
+
this.tableRef.removeAttribute(kupDragActiveAttr);
|
|
1064
|
+
},
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
if (this.removableColumns) {
|
|
1069
|
+
if (!this.interactableDrop.includes(this.removeDropareaRef)) {
|
|
1070
|
+
this.interactableDrop.push(this.removeDropareaRef);
|
|
1071
|
+
this.kupManager.interact.dropzone(this.removeDropareaRef, {
|
|
1072
|
+
accept: `[${kupDraggableColumnAttr}]`,
|
|
1073
|
+
}, null, {
|
|
1074
|
+
drop: (e) => {
|
|
1075
|
+
const draggedTh = e.relatedTarget;
|
|
1076
|
+
const deleted = getColumnByName(this.getColumns(), draggedTh.dataset.column);
|
|
1077
|
+
this.handleColumnRemove(deleted);
|
|
1078
|
+
this.tableRef.removeAttribute(kupDragActiveAttr);
|
|
1079
|
+
},
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
if (this.enableSortableColumns) {
|
|
1084
|
+
const dataCb = (e) => {
|
|
1085
|
+
const draggable = e.target;
|
|
1086
|
+
return {
|
|
1087
|
+
cell: null,
|
|
1088
|
+
column: getColumnByName(this.getVisibleColumns(), draggable.dataset.column),
|
|
1089
|
+
id: this.rootElement.id,
|
|
1090
|
+
multiple: !!(this.selection === SelectionMode.MULTIPLE ||
|
|
1091
|
+
this.selection === SelectionMode.MULTIPLE_CHECKBOX),
|
|
1092
|
+
row: null,
|
|
1093
|
+
selectedRows: this.selectedRows,
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
const dropCb = (e) => {
|
|
1097
|
+
const draggable = e.relatedTarget;
|
|
1098
|
+
const sorted = draggable.kupDragDrop.column;
|
|
1099
|
+
const receiving = getColumnByName(this.getColumns(), e.target.dataset.column);
|
|
1100
|
+
if (receiving && sorted) {
|
|
1101
|
+
this.handleColumnSort(receiving, sorted);
|
|
1102
|
+
}
|
|
1103
|
+
this.tableRef.removeAttribute(kupDragActiveAttr);
|
|
1104
|
+
};
|
|
1105
|
+
const startCb = (e) => {
|
|
1106
|
+
const draggable = e.target;
|
|
1107
|
+
this.hideShowColumnDropArea(true, draggable);
|
|
1108
|
+
};
|
|
1109
|
+
const endCb = () => {
|
|
1110
|
+
this.hideShowColumnDropArea(false);
|
|
1111
|
+
};
|
|
1112
|
+
const dropCallbacks = {
|
|
1113
|
+
drop: dropCb,
|
|
1114
|
+
};
|
|
1115
|
+
const dragCallbacks = {
|
|
1116
|
+
start: startCb,
|
|
1117
|
+
end: endCb,
|
|
1118
|
+
};
|
|
1119
|
+
for (let index = 0; index < this.thRefs.length; index++) {
|
|
1120
|
+
const th = this.thRefs[index];
|
|
1121
|
+
if (th && !this.interactableDrag.includes(th)) {
|
|
1122
|
+
this.interactableDrag.push(th);
|
|
1123
|
+
this.kupManager.interact.dropzone(th, {
|
|
1124
|
+
accept: `[${kupDraggableColumnAttr}]`,
|
|
1125
|
+
}, null, dropCallbacks);
|
|
1126
|
+
this.kupManager.interact.draggable(th, {
|
|
1127
|
+
cursorChecker() {
|
|
1128
|
+
return null;
|
|
1129
|
+
},
|
|
1130
|
+
ignoreFrom: '.header-cell__drag-handler',
|
|
1131
|
+
}, {
|
|
1132
|
+
callback: dataCb,
|
|
1133
|
+
}, KupDragEffect.CLONE, dragCallbacks);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
if (this.resizableColumns) {
|
|
1138
|
+
const moveCb = (e) => {
|
|
1139
|
+
const column = getColumnByName(this.getVisibleColumns(), e.target.dataset.column);
|
|
1140
|
+
column.size = e.rect.width + 'px';
|
|
1141
|
+
this.refresh();
|
|
1142
|
+
};
|
|
1143
|
+
const callbacks = {
|
|
1144
|
+
move: moveCb,
|
|
1145
|
+
};
|
|
1146
|
+
for (let index = 0; index < this.thRefs.length; index++) {
|
|
1147
|
+
const th = this.thRefs[index];
|
|
1148
|
+
if (th && !this.interactableResize.includes(th)) {
|
|
1149
|
+
this.interactableResize.push(th);
|
|
1150
|
+
this.kupManager.interact.resizable(th, {
|
|
1151
|
+
allowFrom: '.header-cell__drag-handler',
|
|
1152
|
+
edges: {
|
|
1153
|
+
left: false,
|
|
1154
|
+
right: true,
|
|
1155
|
+
bottom: false,
|
|
1156
|
+
top: false,
|
|
1157
|
+
},
|
|
1158
|
+
ignoreFrom: '.header-cell__content',
|
|
1159
|
+
}, callbacks);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
if (this.dragEnabled) {
|
|
1164
|
+
for (let index = 0; index < this.rowsRefs.length; index++) {
|
|
1165
|
+
const row = this.rowsRefs[index];
|
|
1166
|
+
const dataCb = () => {
|
|
1167
|
+
const cellEl = this.rootElement.shadowRoot.querySelector('td:hover');
|
|
1168
|
+
return {
|
|
1169
|
+
cell: cellEl['data-cell'],
|
|
1170
|
+
column: getColumnByName(this.getVisibleColumns(), cellEl.dataset.column),
|
|
1171
|
+
id: this.rootElement.id,
|
|
1172
|
+
multiple: !!(this.selection === SelectionMode.MULTIPLE ||
|
|
1173
|
+
this.selection === SelectionMode.MULTIPLE_CHECKBOX),
|
|
1174
|
+
row: cellEl['data-row'],
|
|
1175
|
+
selectedRows: this.selectedRows,
|
|
1176
|
+
};
|
|
1177
|
+
};
|
|
1178
|
+
if (row && !this.interactableDrag.includes(row)) {
|
|
1179
|
+
this.interactableDrag.push(row);
|
|
1180
|
+
this.kupManager.interact.draggable(row, {
|
|
1181
|
+
allowFrom: 'td',
|
|
1182
|
+
cursorChecker() {
|
|
1183
|
+
return null;
|
|
1184
|
+
},
|
|
1185
|
+
}, {
|
|
1186
|
+
callback: dataCb,
|
|
1187
|
+
}, KupDragEffect.BADGE);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
if (this.dropEnabled) {
|
|
1192
|
+
const dataCb = () => {
|
|
1193
|
+
const receivingDetails = this.getEventDetails(this.rootElement.shadowRoot.querySelector('td:hover'));
|
|
1194
|
+
return {
|
|
1195
|
+
cell: receivingDetails.cell,
|
|
1196
|
+
column: receivingDetails.column,
|
|
1197
|
+
id: this.rootElement.id,
|
|
1198
|
+
row: receivingDetails.row,
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1201
|
+
for (let index = 0; index < this.rowsRefs.length; index++) {
|
|
1202
|
+
const row = this.rowsRefs[index];
|
|
1203
|
+
if (row && !this.interactableDrop.includes(row)) {
|
|
1204
|
+
this.interactableDrop.push(row);
|
|
1205
|
+
this.kupManager.interact.dropzone(row, {
|
|
1206
|
+
accept: `[${kupDraggableCellAttr}]`,
|
|
1207
|
+
}, {
|
|
1208
|
+
callback: dataCb,
|
|
1209
|
+
dispatcher: this.rootElement,
|
|
1210
|
+
type: KupDropEventTypes.DATATABLE,
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1016
1214
|
}
|
|
1017
1215
|
}
|
|
1018
1216
|
didLoadObservers() {
|
|
@@ -1023,6 +1221,11 @@ export class KupDataTable {
|
|
|
1023
1221
|
this.intObserver.observe(this.theadRef);
|
|
1024
1222
|
}
|
|
1025
1223
|
}
|
|
1224
|
+
didRenderObservers() {
|
|
1225
|
+
if (this.paginatedRowsLength < this.rowsLength && this.lazyLoadRows) {
|
|
1226
|
+
this.intObserver.observe(this.rowsRefs[this.paginatedRowsLength - 1]);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1026
1229
|
didLoadEventHandling() {
|
|
1027
1230
|
this.tableAreaRef.addEventListener('scroll', () => this.scrollStickyHeader());
|
|
1028
1231
|
}
|
|
@@ -1141,6 +1344,7 @@ export class KupDataTable {
|
|
|
1141
1344
|
this.totalMenuPosition();
|
|
1142
1345
|
this.checkScrollOnHover();
|
|
1143
1346
|
this.didRenderObservers();
|
|
1347
|
+
this.didRenderInteractables();
|
|
1144
1348
|
this.hideShowColumnDropArea(false);
|
|
1145
1349
|
this.setDynPosElements();
|
|
1146
1350
|
if (this.headerIsPersistent &&
|
|
@@ -1160,7 +1364,7 @@ export class KupDataTable {
|
|
|
1160
1364
|
componentDidLoad() {
|
|
1161
1365
|
this.didLoadObservers();
|
|
1162
1366
|
this.didLoadEventHandling();
|
|
1163
|
-
|
|
1367
|
+
this.didLoadInteractables();
|
|
1164
1368
|
if (this.selectRowsById) {
|
|
1165
1369
|
this.setSelectedRows(this.selectRowsById);
|
|
1166
1370
|
}
|
|
@@ -1361,12 +1565,15 @@ export class KupDataTable {
|
|
|
1361
1565
|
}
|
|
1362
1566
|
this.detailCard.data = cardData;
|
|
1363
1567
|
this.detailCard.style.position = 'fixed';
|
|
1364
|
-
this.detailCard.style.left =
|
|
1365
|
-
this.detailCard.style.top =
|
|
1568
|
+
this.detailCard.style.left = '0';
|
|
1569
|
+
this.detailCard.style.top = '0';
|
|
1570
|
+
this.detailCard.setAttribute('data-x', x.toString());
|
|
1571
|
+
this.detailCard.setAttribute('data-y', y.toString());
|
|
1572
|
+
this.detailCard.style.transform = 'translate(' + x + 'px,' + y + 'px)';
|
|
1366
1573
|
this.rootElement.shadowRoot.append(this.detailCard);
|
|
1367
1574
|
}
|
|
1368
1575
|
getEventDetails(el) {
|
|
1369
|
-
const isHeader = !!el.closest('thead'), isBody = !!el.closest('tbody'), isFooter = !!el.closest('tfoot'), td = el.closest('td'), textfield = el.closest('.f-text-field--wrapper'), th = el.closest('th'), tr = el.closest('tr'), filterRemove = el.closest('
|
|
1576
|
+
const isHeader = !!el.closest('thead'), isBody = !!el.closest('tbody'), isFooter = !!el.closest('tfoot'), td = el.closest('td'), textfield = el.closest('.f-text-field--wrapper'), th = el.closest('th'), tr = el.closest('tr'), filterRemove = el.closest(`.${KupThemeIconValues.FILTER_REMOVE.replace('--', '')}`);
|
|
1370
1577
|
let cell = null, column = null, isGroupRow = false, row = null;
|
|
1371
1578
|
if (isBody) {
|
|
1372
1579
|
if (tr) {
|
|
@@ -1453,7 +1660,6 @@ export class KupDataTable {
|
|
|
1453
1660
|
return details;
|
|
1454
1661
|
}
|
|
1455
1662
|
contextMenuHandler(e) {
|
|
1456
|
-
e.preventDefault();
|
|
1457
1663
|
const details = this.getEventDetails(e.target);
|
|
1458
1664
|
if (details.area === 'header') {
|
|
1459
1665
|
if (details.th && details.column) {
|
|
@@ -1463,7 +1669,7 @@ export class KupDataTable {
|
|
|
1463
1669
|
}
|
|
1464
1670
|
else if (details.area === 'body') {
|
|
1465
1671
|
const _hasTooltip = details.cell.obj
|
|
1466
|
-
? this.kupManager.objects.
|
|
1672
|
+
? !this.kupManager.objects.isEmptyKupObj(details.cell.obj)
|
|
1467
1673
|
: false;
|
|
1468
1674
|
if (_hasTooltip &&
|
|
1469
1675
|
this.showTooltipOnRightClick &&
|
|
@@ -1559,12 +1765,6 @@ export class KupDataTable {
|
|
|
1559
1765
|
getRows() {
|
|
1560
1766
|
return this.data && this.data.rows ? this.data.rows : [];
|
|
1561
1767
|
}
|
|
1562
|
-
// TODO if is not shared, move this in the third parameter of setKetchupDraggable method
|
|
1563
|
-
addMultiSelectDragImageToEvent(event) {
|
|
1564
|
-
const dragImage = document.createElement('img');
|
|
1565
|
-
dragImage.src = dragMultipleImg;
|
|
1566
|
-
event.dataTransfer.setDragImage(dragImage, 0, 0);
|
|
1567
|
-
}
|
|
1568
1768
|
initRows() {
|
|
1569
1769
|
this.filterRows();
|
|
1570
1770
|
this.footer = calcTotals(normalizeRows(this.getColumns(), this.rows), this.totals);
|
|
@@ -1974,74 +2174,12 @@ export class KupDataTable {
|
|
|
1974
2174
|
closeTotalMenu() {
|
|
1975
2175
|
this.openedTotalMenu = null;
|
|
1976
2176
|
}
|
|
1977
|
-
/* TODO
|
|
1978
|
-
private openGroupMenu(column: Column) {
|
|
1979
|
-
this.openedGroupMenu = column.name;
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
private closeGroupMenu() {
|
|
1983
|
-
this.openedGroupMenu = null;
|
|
1984
|
-
}
|
|
1985
|
-
*/
|
|
1986
2177
|
closeMenuAndTooltip() {
|
|
1987
2178
|
unsetTooltip(this.tooltip);
|
|
1988
2179
|
}
|
|
1989
|
-
isOpenedTotalMenu() {
|
|
1990
|
-
return this.openedTotalMenu != null;
|
|
1991
|
-
}
|
|
1992
2180
|
isOpenedTotalMenuForColumn(column) {
|
|
1993
2181
|
return this.openedTotalMenu === column;
|
|
1994
2182
|
}
|
|
1995
|
-
isOpenedGroupMenu() {
|
|
1996
|
-
return this.openedGroupMenu != null;
|
|
1997
|
-
}
|
|
1998
|
-
isOpenedGroupMenuForColumn(column) {
|
|
1999
|
-
return this.openedGroupMenu === column;
|
|
2000
|
-
}
|
|
2001
|
-
/**
|
|
2002
|
-
* Type guard needed to be sure that an object returned from composePath() is an HTMLElement with classes
|
|
2003
|
-
* @param node
|
|
2004
|
-
*/
|
|
2005
|
-
isHTMLElementFromEventTarget(node) {
|
|
2006
|
-
return node.classList !== undefined;
|
|
2007
|
-
}
|
|
2008
|
-
hasOverlayActions(column) {
|
|
2009
|
-
if (column == null || column.obj == null) {
|
|
2010
|
-
return false;
|
|
2011
|
-
}
|
|
2012
|
-
return this.kupManager.objects.canHaveAutomaticDerivedColumn(column.obj);
|
|
2013
|
-
}
|
|
2014
|
-
onHeaderCellContextMenuClose(event) {
|
|
2015
|
-
// Gets the path of the event (does not work in IE11 or previous)
|
|
2016
|
-
const eventPath = event.composedPath();
|
|
2017
|
-
let fromTotalMenu = false;
|
|
2018
|
-
let fromSameTable = false;
|
|
2019
|
-
// Examine the path
|
|
2020
|
-
for (let elem of eventPath) {
|
|
2021
|
-
// TODO When the footer is considered stable please do this in another dedicated method
|
|
2022
|
-
// check if is the open menu button the element which fired the event
|
|
2023
|
-
// TODO Maybe a better approach would be to use the blur event in order to hide the menu
|
|
2024
|
-
if (elem.id === totalMenuOpenID) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
// If we encounter our table we can stop looping the elements
|
|
2028
|
-
if (elem === this.tableAreaRef) {
|
|
2029
|
-
fromSameTable = true;
|
|
2030
|
-
break;
|
|
2031
|
-
}
|
|
2032
|
-
// TODO When the footer is considered stable please do this in another dedicated method
|
|
2033
|
-
// If the event comes from a menu of the table footer
|
|
2034
|
-
if (this.isHTMLElementFromEventTarget(elem) &&
|
|
2035
|
-
elem.classList &&
|
|
2036
|
-
elem.classList.contains('total-menu')) {
|
|
2037
|
-
fromTotalMenu = true;
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
// TODO When the footer is considered stable please do this in another dedicated method
|
|
2041
|
-
if (this.isOpenedTotalMenu() && !(fromTotalMenu && fromSameTable)) {
|
|
2042
|
-
this.closeTotalMenu();
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
2183
|
onJ4btnClicked(row, column, cell) {
|
|
2046
2184
|
// Since this function is called with bind, the event from the kup-button gets passed into the arguments array
|
|
2047
2185
|
const buttonEvent = arguments[3];
|
|
@@ -2219,7 +2357,7 @@ export class KupDataTable {
|
|
|
2219
2357
|
* @param extraCells - the extra cells rendered into the table
|
|
2220
2358
|
*/
|
|
2221
2359
|
composeHeaderCellClassAndStyle(columnIndex, extraCells = 0, column) {
|
|
2222
|
-
let columnClass = {}, thStyle = {};
|
|
2360
|
+
let columnClass = { ['header-cell']: true }, thStyle = column.style ? Object.assign({}, column.style) : {};
|
|
2223
2361
|
if (this.kupManager.objects.isBar(column.obj) ||
|
|
2224
2362
|
this.kupManager.objects.isButton(column.obj) ||
|
|
2225
2363
|
this.kupManager.objects.isChart(column.obj) ||
|
|
@@ -2229,13 +2367,13 @@ export class KupDataTable {
|
|
|
2229
2367
|
this.kupManager.objects.isProgressBar(column.obj) ||
|
|
2230
2368
|
this.kupManager.objects.isRadio(column.obj) ||
|
|
2231
2369
|
this.kupManager.objects.isVoCodver(column.obj)) {
|
|
2232
|
-
columnClass
|
|
2370
|
+
columnClass['header-cell--centered'] = true;
|
|
2233
2371
|
}
|
|
2234
2372
|
if (this.kupManager.objects.isNumber(column.obj)) {
|
|
2235
|
-
columnClass
|
|
2373
|
+
columnClass['header-cell--is-number'] = true;
|
|
2236
2374
|
}
|
|
2237
2375
|
if (this.kupManager.objects.isIcon(column.obj)) {
|
|
2238
|
-
columnClass
|
|
2376
|
+
columnClass['header-cell--is-icon'] = true;
|
|
2239
2377
|
}
|
|
2240
2378
|
// For fixed cells styles and classes
|
|
2241
2379
|
const fixedCellStyle = this.composeFixedCellStyleAndClass(columnIndex + 1 + extraCells, 0, extraCells);
|
|
@@ -2281,30 +2419,17 @@ export class KupDataTable {
|
|
|
2281
2419
|
}
|
|
2282
2420
|
// Renders normal cells
|
|
2283
2421
|
const dataColumns = this.getVisibleColumns().map((column, columnIndex) => {
|
|
2284
|
-
// Composes column cell style and classes
|
|
2285
2422
|
const { columnClass, thStyle } = this.composeHeaderCellClassAndStyle(columnIndex, specialExtraCellsCount, column);
|
|
2286
|
-
const overlay = null;
|
|
2287
|
-
//---- Filter ----
|
|
2288
2423
|
let filter = null;
|
|
2289
2424
|
if (this.filtersColumnMenuInstance.hasFiltersForColumn(this.filters, column)) {
|
|
2290
2425
|
const svgLabel = this.kupManager.language.translate(KupLanguageGeneric.REMOVE_FILTERS) + `: '${this.getFilterValueForTooltip(column)}'`;
|
|
2291
|
-
/**
|
|
2292
|
-
* When column has a filter but filters must not be displayed, shows an icon to remove the filter.
|
|
2293
|
-
* Upon click, the filter gets removed.
|
|
2294
|
-
* The payload event is simulated here.
|
|
2295
|
-
*/
|
|
2296
2426
|
filter = (h("span", { title: svgLabel, class: `kup-icon ${KupThemeIconValues.FILTER_REMOVE.replace('--', '')}` }));
|
|
2297
2427
|
}
|
|
2298
|
-
//---- Sort ----
|
|
2299
2428
|
let sortIcon = null;
|
|
2300
|
-
// When sorting is enabled, there are two things to do:
|
|
2301
|
-
// 1 - Add correct icon to the table
|
|
2302
|
-
// 2 - stores the handler to be later set onto the whole cell
|
|
2303
2429
|
let iconClass = this.getSortIcon(column.name);
|
|
2304
2430
|
if (iconClass !== '') {
|
|
2305
2431
|
sortIcon = (h("span", { class: iconClass, title: this.getSortDecode(column.name) }));
|
|
2306
2432
|
}
|
|
2307
|
-
// Adds the sortable class to the header cell
|
|
2308
2433
|
columnClass['header-cell--sortable'] = true;
|
|
2309
2434
|
let keyIcon = null;
|
|
2310
2435
|
if (column.isKey) {
|
|
@@ -2326,97 +2451,14 @@ export class KupDataTable {
|
|
|
2326
2451
|
}
|
|
2327
2452
|
}
|
|
2328
2453
|
}
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
// Sets which element has started the drag
|
|
2338
|
-
overElement.setAttribute(this.dragStarterAttribute, '');
|
|
2339
|
-
this.theadRef.setAttribute(this.dragFlagAttribute, '');
|
|
2340
|
-
this.columnsAreBeingDragged = true;
|
|
2341
|
-
this.hideShowColumnDropArea(true, overElement);
|
|
2342
|
-
// TODO set drag payload and get it in the other methods when need it
|
|
2343
|
-
// setDragDropPayload
|
|
2344
|
-
// getDragDropPayload
|
|
2345
|
-
// replace the used flags set with attribute
|
|
2346
|
-
},
|
|
2347
|
-
onDragEnd: (e) => {
|
|
2348
|
-
// When the drag has ended, checks if the element still exists or it was destroyed by JSX
|
|
2349
|
-
const overElement = this.getThElement(e.target);
|
|
2350
|
-
if (overElement) {
|
|
2351
|
-
// If it still exists, removes the attribute so that it can perform a new drag again
|
|
2352
|
-
overElement.removeAttribute(this.dragStarterAttribute);
|
|
2353
|
-
}
|
|
2354
|
-
// Remove the over attribute
|
|
2355
|
-
const dragDropPayload = getDragDropPayload();
|
|
2356
|
-
if (dragDropPayload && dragDropPayload.overElement) {
|
|
2357
|
-
dragDropPayload.overElement.removeAttribute(this.dragOverAttribute);
|
|
2358
|
-
}
|
|
2359
|
-
this.theadRef.removeAttribute(this.dragFlagAttribute);
|
|
2360
|
-
this.columnsAreBeingDragged = false;
|
|
2361
|
-
this.hideShowColumnDropArea(false);
|
|
2362
|
-
},
|
|
2363
|
-
};
|
|
2364
|
-
const dropHandlers = {
|
|
2365
|
-
onDrop: (e) => {
|
|
2366
|
-
const transferredData = JSON.parse(e.dataTransfer.getData(KupDataTableColumnDragType));
|
|
2367
|
-
// We are sure the tables have been dropped in a valid location -> starts sorting the columns
|
|
2368
|
-
this.handleColumnSort(column, transferredData);
|
|
2369
|
-
return KupDataTableColumnDragType;
|
|
2370
|
-
},
|
|
2371
|
-
onDragLeave: (e) => {
|
|
2372
|
-
if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {
|
|
2373
|
-
const overElement = this.getThElement(e.target);
|
|
2374
|
-
if (overElement) {
|
|
2375
|
-
overElement.removeAttribute(this.dragOverAttribute);
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
|
-
},
|
|
2379
|
-
onDragOver: (e) => {
|
|
2380
|
-
if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {
|
|
2381
|
-
const overElement = this.getThElement(e.target);
|
|
2382
|
-
overElement.setAttribute(this.dragOverAttribute, '');
|
|
2383
|
-
// TODO do it without using the element but with data like id, etc.
|
|
2384
|
-
setDragDropPayload({
|
|
2385
|
-
overElement,
|
|
2386
|
-
});
|
|
2387
|
-
// If element can have a drop effect
|
|
2388
|
-
if (!overElement.hasAttribute(this.dragStarterAttribute) &&
|
|
2389
|
-
this.columnsAreBeingDragged) {
|
|
2390
|
-
setDragEffectAllowed(e, 'move');
|
|
2391
|
-
return true;
|
|
2392
|
-
}
|
|
2393
|
-
else {
|
|
2394
|
-
setDragEffectAllowed(e, 'none');
|
|
2395
|
-
return false;
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
},
|
|
2399
|
-
};
|
|
2400
|
-
columnClass.number = this.kupManager.objects.isNumber(column.obj);
|
|
2401
|
-
return (h("th", Object.assign({ "data-cell": column, "data-column": column.name, class: columnClass, style: thStyle }, (this.enableSortableColumns
|
|
2402
|
-
? setKetchupDraggable(dragHandlers, {
|
|
2403
|
-
[KupDataTableColumnDragType]: column,
|
|
2404
|
-
'kup-drag-source-element': {
|
|
2405
|
-
column: column,
|
|
2406
|
-
id: this.rootElement.id,
|
|
2407
|
-
},
|
|
2408
|
-
})
|
|
2409
|
-
: {}), (this.enableSortableColumns
|
|
2410
|
-
? setKetchupDroppable(dropHandlers, [KupDataTableColumnDragType], this.rootElement, {
|
|
2411
|
-
column: column,
|
|
2412
|
-
id: this.rootElement.id,
|
|
2413
|
-
})
|
|
2414
|
-
: {})),
|
|
2415
|
-
h("span", { class: "column-title" }, this.applyLineBreaks(column.title)),
|
|
2416
|
-
overlay,
|
|
2417
|
-
keyIcon,
|
|
2418
|
-
sortIcon,
|
|
2419
|
-
filter));
|
|
2454
|
+
return (h("th", { ref: (el) => this.thRefs.push(el), "data-cell": column, "data-column": column.name, class: columnClass, style: thStyle },
|
|
2455
|
+
h("div", { class: "header-cell__content" },
|
|
2456
|
+
h("span", { class: "header-cell__title" }, this.applyLineBreaks(column.title)),
|
|
2457
|
+
h("span", { class: "header-cell__icons" },
|
|
2458
|
+
keyIcon,
|
|
2459
|
+
sortIcon,
|
|
2460
|
+
filter)),
|
|
2461
|
+
this.resizableColumns ? (h("span", { class: "header-cell__drag-handler" })) : null));
|
|
2420
2462
|
});
|
|
2421
2463
|
return [multiSelectColumn, actionsColumn, ...dataColumns];
|
|
2422
2464
|
// return [multiSelectColumn, groupColumn, actionsColumn, ...dataColumns];
|
|
@@ -2455,10 +2497,10 @@ export class KupDataTable {
|
|
|
2455
2497
|
const dataColumns = this.getVisibleColumns().map((column, columnIndex) => {
|
|
2456
2498
|
const { columnClass, thStyle } = this.composeHeaderCellClassAndStyle(columnIndex, specialExtraCellsCount, column);
|
|
2457
2499
|
return (h("th-sticky", { class: columnClass, style: thStyle },
|
|
2458
|
-
h("
|
|
2500
|
+
h("div", { class: "header-cell__content" },
|
|
2501
|
+
h("span", { class: "header-cell__title" }, this.applyLineBreaks(column.title)))));
|
|
2459
2502
|
});
|
|
2460
2503
|
return [multiSelectColumn, actionsColumn, ...dataColumns];
|
|
2461
|
-
//return [multiSelectColumn, groupColumn, actionsColumn, ...dataColumns];
|
|
2462
2504
|
}
|
|
2463
2505
|
renderTooltip() {
|
|
2464
2506
|
if (this.tooltipEnabled == false) {
|
|
@@ -2466,9 +2508,7 @@ export class KupDataTable {
|
|
|
2466
2508
|
}
|
|
2467
2509
|
return (h("kup-tooltip", { class: "datatable-tooltip", owner: this.rootElement.tagName, loadTimeout: this.showTooltipOnRightClick == true
|
|
2468
2510
|
? 0
|
|
2469
|
-
: this.tooltipLoadTimeout,
|
|
2470
|
-
this.tooltip.data = null;
|
|
2471
|
-
}, detailTimeout: this.tooltipDetailTimeout, ref: (el) => (this.tooltip = el), tabindex: 0 }));
|
|
2511
|
+
: this.tooltipLoadTimeout, detailTimeout: this.tooltipDetailTimeout, ref: (el) => (this.tooltip = el) }));
|
|
2472
2512
|
}
|
|
2473
2513
|
areTotalsSelected(column) {
|
|
2474
2514
|
return this.totals && this.totals[column.name] ? true : false;
|
|
@@ -2496,10 +2536,17 @@ export class KupDataTable {
|
|
|
2496
2536
|
if (this.rootElement.shadowRoot) {
|
|
2497
2537
|
const menu = this.rootElement.shadowRoot.querySelector('#totals-menu');
|
|
2498
2538
|
if (menu) {
|
|
2499
|
-
this.kupManager.dynamicPosition.register(menu, this.totalMenuCoords
|
|
2539
|
+
this.kupManager.dynamicPosition.register(menu, this.totalMenuCoords);
|
|
2540
|
+
this.kupManager.utilities.pointerDownCallbacks.add({
|
|
2541
|
+
cb: () => {
|
|
2542
|
+
this.closeTotalMenu();
|
|
2543
|
+
this.kupManager.dynamicPosition.stop(menu);
|
|
2544
|
+
},
|
|
2545
|
+
onlyOnce: true,
|
|
2546
|
+
el: menu,
|
|
2547
|
+
});
|
|
2500
2548
|
this.kupManager.dynamicPosition.start(menu);
|
|
2501
|
-
menu.
|
|
2502
|
-
setTimeout(() => menu.focus(), 0);
|
|
2549
|
+
menu.menuVisible = true;
|
|
2503
2550
|
}
|
|
2504
2551
|
}
|
|
2505
2552
|
}
|
|
@@ -2639,7 +2686,7 @@ export class KupDataTable {
|
|
|
2639
2686
|
});
|
|
2640
2687
|
}
|
|
2641
2688
|
}
|
|
2642
|
-
totalMenu = (h("kup-list", { class: `
|
|
2689
|
+
totalMenu = (h("kup-list", { class: `total-menu`, data: listData, id: "totals-menu", "is-menu": true, keyboardNavigation: true, "menu-visible": true, "onkup-list-click": (event) => this.onTotalsChange(event, column), tabindex: 0 }));
|
|
2643
2690
|
}
|
|
2644
2691
|
// TODO please use getValueForDisplay
|
|
2645
2692
|
let value;
|
|
@@ -2748,33 +2795,6 @@ export class KupDataTable {
|
|
|
2748
2795
|
value = numberToFormattedStringNumber(totalValue, column.decimals, column.obj ? column.obj.p : '');
|
|
2749
2796
|
}
|
|
2750
2797
|
}
|
|
2751
|
-
/*
|
|
2752
|
-
TODO Group Menu
|
|
2753
|
-
const groupMenu = undefined;
|
|
2754
|
-
if (this.isOpenedGroupMenuForColumn(column.name)) {
|
|
2755
|
-
const listData: KupListData[] = [
|
|
2756
|
-
{
|
|
2757
|
-
text: 'Matrice dei totali',
|
|
2758
|
-
value: 'MATTOT',
|
|
2759
|
-
selected: false,
|
|
2760
|
-
},
|
|
2761
|
-
];
|
|
2762
|
-
|
|
2763
|
-
groupMenu = (
|
|
2764
|
-
<kup-list
|
|
2765
|
-
class={`kup-menu group-menu`}
|
|
2766
|
-
data={...listData}
|
|
2767
|
-
id="group-menu"
|
|
2768
|
-
is-menu
|
|
2769
|
-
menu-visible
|
|
2770
|
-
onBlur={() => this.closeGroupMenu()}
|
|
2771
|
-
onkup-list-click={(event) => console.log(event)}
|
|
2772
|
-
tabindex={0}
|
|
2773
|
-
></kup-list>
|
|
2774
|
-
);
|
|
2775
|
-
}
|
|
2776
|
-
{groupMenu}
|
|
2777
|
-
*/
|
|
2778
2798
|
cells.push(h("td", { class: totalClass }, value));
|
|
2779
2799
|
}
|
|
2780
2800
|
jsxRows.push(h("tr", { ref: (el) => this.rowsRefs.push(el), "data-row": row, class: "group group-label" }, grouplabelcell));
|
|
@@ -2885,6 +2905,9 @@ export class KupDataTable {
|
|
|
2885
2905
|
}
|
|
2886
2906
|
}
|
|
2887
2907
|
const cell = row.cells[name];
|
|
2908
|
+
if (!cell) {
|
|
2909
|
+
return null;
|
|
2910
|
+
}
|
|
2888
2911
|
const jsxCell = this.renderCell(indend, cell, row, currentColumn, hideValuesRepetitions && previousRow
|
|
2889
2912
|
? previousRow.cells[name].value
|
|
2890
2913
|
: undefined);
|
|
@@ -2900,6 +2923,9 @@ export class KupDataTable {
|
|
|
2900
2923
|
if (cell.cssClass) {
|
|
2901
2924
|
cellClass[cell.cssClass] = true;
|
|
2902
2925
|
}
|
|
2926
|
+
else if (currentColumn.cssClass) {
|
|
2927
|
+
cellClass[currentColumn.cssClass] = true;
|
|
2928
|
+
}
|
|
2903
2929
|
let cellStyle = null;
|
|
2904
2930
|
if (!styleHasBorderRadius(cell)) {
|
|
2905
2931
|
cellStyle = Object.assign({}, cell.style);
|
|
@@ -2936,7 +2962,7 @@ export class KupDataTable {
|
|
|
2936
2962
|
* Controls if current cell needs a tooltip and eventually adds it.
|
|
2937
2963
|
* @todo When the option forceOneLine is active, there is a problem with the current implementation of the tooltip. See documentation in the mauer wiki for better understanding.
|
|
2938
2964
|
*/
|
|
2939
|
-
const _hasTooltip = this.kupManager.objects.
|
|
2965
|
+
const _hasTooltip = !this.kupManager.objects.isEmptyKupObj(cell.obj);
|
|
2940
2966
|
let eventHandlers = undefined;
|
|
2941
2967
|
let title = undefined;
|
|
2942
2968
|
if (_hasTooltip) {
|
|
@@ -2961,14 +2987,7 @@ export class KupDataTable {
|
|
|
2961
2987
|
};
|
|
2962
2988
|
}
|
|
2963
2989
|
}
|
|
2964
|
-
return (h("td", Object.assign({},
|
|
2965
|
-
? setKetchupDroppable(dropHandlersCell, [KupDataTableRowDragType], this.rootElement, {
|
|
2966
|
-
row: row,
|
|
2967
|
-
cell: cell,
|
|
2968
|
-
column: currentColumn,
|
|
2969
|
-
id: this.rootElement.id,
|
|
2970
|
-
})
|
|
2971
|
-
: {}), { title: title, "data-cell": cell, "data-column": name, "data-row": row, style: cellStyle, class: cellClass }, eventHandlers), jsxCell));
|
|
2990
|
+
return (h("td", Object.assign({ title: title, colSpan: cell.span && cell.span.col ? cell.span.col : null, rowSpan: cell.span && cell.span.row ? cell.span.row : null, "data-cell": cell, "data-column": name, "data-row": row, style: cellStyle, class: cellClass }, eventHandlers), jsxCell));
|
|
2972
2991
|
});
|
|
2973
2992
|
// adding row to rendered rows
|
|
2974
2993
|
this.renderedRows.push(row);
|
|
@@ -2978,67 +2997,10 @@ export class KupDataTable {
|
|
|
2978
2997
|
if (row.cssClass) {
|
|
2979
2998
|
rowClass[row.cssClass] = true;
|
|
2980
2999
|
}
|
|
2981
|
-
const dragHandlersRow = {
|
|
2982
|
-
onDragStart: (e) => {
|
|
2983
|
-
// get the tr tag
|
|
2984
|
-
const trElement = e.target;
|
|
2985
|
-
let cell = {};
|
|
2986
|
-
let column = {};
|
|
2987
|
-
if (trElement) {
|
|
2988
|
-
// get the elements inside the row that were touched
|
|
2989
|
-
const hoverElements = trElement.querySelectorAll(':hover');
|
|
2990
|
-
if (hoverElements) {
|
|
2991
|
-
// the td in position 0 is ALWAYS the last td touched
|
|
2992
|
-
const tdElement = hoverElements[0];
|
|
2993
|
-
if (tdElement) {
|
|
2994
|
-
// get the column name in td element
|
|
2995
|
-
const columnName = tdElement.getAttribute('data-column');
|
|
2996
|
-
if (columnName) {
|
|
2997
|
-
// finally get the cell
|
|
2998
|
-
cell = row.cells[columnName];
|
|
2999
|
-
// and the column
|
|
3000
|
-
column = getColumnByName(this.getColumns(), columnName);
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
// because I found the cell and the column inside this method I have to set here the event data
|
|
3006
|
-
// in this scenario it is not necessary pass the data parameter in setKetchupDraggable method
|
|
3007
|
-
const sourceElementData = {
|
|
3008
|
-
id: this.rootElement.id,
|
|
3009
|
-
row,
|
|
3010
|
-
selectedRows: this.selectedRows,
|
|
3011
|
-
cell,
|
|
3012
|
-
column,
|
|
3013
|
-
};
|
|
3014
|
-
// set event data
|
|
3015
|
-
// this is mandatory in order to add the source element data in the kup drop event
|
|
3016
|
-
e.dataTransfer.setData('kup-drag-source-element', JSON.stringify(sourceElementData));
|
|
3017
|
-
// Sets the type of drag
|
|
3018
|
-
setDragEffectAllowed(e, 'move');
|
|
3019
|
-
if (this.selectedRows.length > 1 ||
|
|
3020
|
-
(this.selectedRows.length == 1 &&
|
|
3021
|
-
!this.selectedRows.includes(row))) {
|
|
3022
|
-
this.addMultiSelectDragImageToEvent(e);
|
|
3023
|
-
}
|
|
3024
|
-
},
|
|
3025
|
-
onDragEnd: (_e) => {
|
|
3026
|
-
// Remove the over class
|
|
3027
|
-
const dragDropPayload = getDragDropPayload();
|
|
3028
|
-
if (dragDropPayload && dragDropPayload.overElement) {
|
|
3029
|
-
dragDropPayload.overElement.classList.remove('selected');
|
|
3030
|
-
}
|
|
3031
|
-
},
|
|
3032
|
-
};
|
|
3033
3000
|
const style = {
|
|
3034
3001
|
'--kup_datatable_row_actions': rowActionsCount,
|
|
3035
3002
|
};
|
|
3036
|
-
return (h("tr",
|
|
3037
|
-
? setKetchupDraggable(dragHandlersRow, {
|
|
3038
|
-
[KupDataTableRowDragType]: row,
|
|
3039
|
-
'kup-drag-source-element': {}, // I put nothing in there because I overwrite the content inside the onDragStart method
|
|
3040
|
-
})
|
|
3041
|
-
: {})),
|
|
3003
|
+
return (h("tr", { ref: (el) => this.rowsRefs.push(el), "data-row": row, class: rowClass, style: style },
|
|
3042
3004
|
selectRowCell,
|
|
3043
3005
|
rowActionsCell,
|
|
3044
3006
|
cells));
|
|
@@ -3480,134 +3442,26 @@ export class KupDataTable {
|
|
|
3480
3442
|
totalsMatrix));
|
|
3481
3443
|
}
|
|
3482
3444
|
columnRemoveArea() {
|
|
3483
|
-
|
|
3484
|
-
onDrop: (e) => {
|
|
3485
|
-
const transferredData = JSON.parse(e.dataTransfer.getData(KupDataTableColumnDragType));
|
|
3486
|
-
const overElement = this.getElementById(e.target, 'remove-column-area');
|
|
3487
|
-
overElement.removeAttribute(this.dragOverAttribute);
|
|
3488
|
-
// We are sure the tables have been dropped in a valid location -> starts ...
|
|
3489
|
-
this.handleColumnRemove(transferredData);
|
|
3490
|
-
return KupDataTableColumnDragRemoveType;
|
|
3491
|
-
},
|
|
3492
|
-
onDragOver: (e) => {
|
|
3493
|
-
const overElement = this.getElementById(e.target, 'remove-column-area');
|
|
3494
|
-
overElement.setAttribute(this.dragOverAttribute, '');
|
|
3495
|
-
return true;
|
|
3496
|
-
},
|
|
3497
|
-
onDragLeave: (e) => {
|
|
3498
|
-
const overElement = this.getElementById(e.target, 'remove-column-area');
|
|
3499
|
-
overElement.removeAttribute(this.dragOverAttribute);
|
|
3500
|
-
return true;
|
|
3501
|
-
},
|
|
3502
|
-
};
|
|
3503
|
-
return (h("div", Object.assign({ id: "remove-column-area" }, setKetchupDroppable(dropHandlersRemoveCols, [
|
|
3504
|
-
KupDataTableColumnDragType,
|
|
3505
|
-
KupDataTableColumnDragRemoveType,
|
|
3506
|
-
], this.rootElement, {})),
|
|
3445
|
+
return (h("div", { class: "droparea__remove", ref: (el) => (this.removeDropareaRef = el) },
|
|
3507
3446
|
h(FImage, { resource: "delete", color: `var(${KupThemeColorValues.DANGER})`, sizeX: "30px", sizeY: "50px" }),
|
|
3508
3447
|
h(FImage, { resource: "delete-empty", color: `var(${KupThemeColorValues.DANGER})`, sizeX: "30px", sizeY: "50px" })));
|
|
3509
3448
|
}
|
|
3510
3449
|
columnGroupArea() {
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
const overElement = this.getElementById(e.target, 'group-column-area');
|
|
3515
|
-
overElement.removeAttribute(this.dragOverAttribute);
|
|
3516
|
-
// We are sure the tables have been dropped in a valid location -> starts ...
|
|
3517
|
-
this.handleColumnGroup(transferredData);
|
|
3518
|
-
return KupDataTableColumnDragGroupType;
|
|
3519
|
-
},
|
|
3520
|
-
onDragOver: (e) => {
|
|
3521
|
-
const overElement = this.getElementById(e.target, 'group-column-area');
|
|
3522
|
-
overElement.setAttribute(this.dragOverAttribute, '');
|
|
3523
|
-
return true;
|
|
3524
|
-
},
|
|
3525
|
-
onDragLeave: (e) => {
|
|
3526
|
-
const overElement = this.getElementById(e.target, 'group-column-area');
|
|
3527
|
-
overElement.removeAttribute(this.dragOverAttribute);
|
|
3528
|
-
return true;
|
|
3529
|
-
},
|
|
3530
|
-
};
|
|
3531
|
-
return (h("div", Object.assign({ id: "group-column-area" }, setKetchupDroppable(dropHandlersGroupCols, [
|
|
3532
|
-
KupDataTableColumnDragType,
|
|
3533
|
-
KupDataTableColumnDragGroupType,
|
|
3534
|
-
], this.rootElement, {})),
|
|
3535
|
-
h(FImage, { resource: "bookmark", color: `var(${KupThemeColorValues.DANGER})`, sizeX: "30px", sizeY: "50px" }),
|
|
3536
|
-
h(FImage, { resource: "book", color: `var(${KupThemeColorValues.DANGER})`, sizeX: "30px", sizeY: "50px" })));
|
|
3537
|
-
}
|
|
3538
|
-
startDynamicPositioning(dropArea, th) {
|
|
3539
|
-
if (this.kupManager.dynamicPosition.isRegistered(dropArea)) {
|
|
3540
|
-
this.kupManager.dynamicPosition.changeAnchor(dropArea, th);
|
|
3541
|
-
}
|
|
3542
|
-
else {
|
|
3543
|
-
this.kupManager.dynamicPosition.register(dropArea, th, 10, KupDynamicPositionPlacement.TOP);
|
|
3544
|
-
}
|
|
3545
|
-
this.kupManager.dynamicPosition.start(dropArea);
|
|
3546
|
-
dropArea.classList.add('visible');
|
|
3547
|
-
}
|
|
3548
|
-
stopDynamicPositioning(dropArea) {
|
|
3549
|
-
dropArea.classList.remove('visible');
|
|
3550
|
-
this.kupManager.dynamicPosition.stop(dropArea);
|
|
3551
|
-
// Chrome workaround: dropArea is draggable even with the display:none rule
|
|
3552
|
-
dropArea.style.top = '-50px';
|
|
3553
|
-
dropArea.style.left = '-50px';
|
|
3554
|
-
}
|
|
3555
|
-
getElementById(target, id) {
|
|
3556
|
-
let element = target;
|
|
3557
|
-
if (element) {
|
|
3558
|
-
if (element.nodeType == Node.TEXT_NODE) {
|
|
3559
|
-
element = element.parentNode;
|
|
3560
|
-
}
|
|
3561
|
-
if (element.id !== id) {
|
|
3562
|
-
element = element.closest('#' + id);
|
|
3563
|
-
}
|
|
3564
|
-
}
|
|
3565
|
-
return element;
|
|
3566
|
-
}
|
|
3567
|
-
getThElement(target) {
|
|
3568
|
-
let element = target;
|
|
3569
|
-
if (element) {
|
|
3570
|
-
if (element.nodeType == Node.TEXT_NODE) {
|
|
3571
|
-
element = element.parentNode;
|
|
3572
|
-
}
|
|
3573
|
-
if (element.tagName !== 'TH') {
|
|
3574
|
-
element = element.closest('th');
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
return element;
|
|
3450
|
+
return (h("div", { class: "droparea__groups", ref: (el) => (this.groupsDropareaRef = el) },
|
|
3451
|
+
h(FImage, { resource: "bookmark", color: `var(${KupThemeColorValues.TEXT})`, sizeX: "30px", sizeY: "50px" }),
|
|
3452
|
+
h(FImage, { resource: "book", color: `var(${KupThemeColorValues.TEXT})`, sizeX: "30px", sizeY: "50px" })));
|
|
3578
3453
|
}
|
|
3579
3454
|
hideShowColumnDropArea(show, th) {
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
}
|
|
3587
|
-
const dropArea = this.rootElement.shadowRoot.querySelector('#remove-column-area');
|
|
3588
|
-
if (show) {
|
|
3589
|
-
const offset = this.showGroups ? '0px' : '25px';
|
|
3590
|
-
dropArea.style.marginLeft =
|
|
3591
|
-
'calc(' + th.clientWidth / 2 + 'px - ' + offset + ')';
|
|
3592
|
-
this.startDynamicPositioning(dropArea, th);
|
|
3593
|
-
}
|
|
3594
|
-
else {
|
|
3595
|
-
this.stopDynamicPositioning(dropArea);
|
|
3596
|
-
}
|
|
3597
|
-
}
|
|
3598
|
-
hideShowColumnGroupDropArea(show, th) {
|
|
3599
|
-
if (!this.showGroups) {
|
|
3600
|
-
return;
|
|
3601
|
-
}
|
|
3602
|
-
const dropArea = this.rootElement.shadowRoot.querySelector('#group-column-area');
|
|
3603
|
-
if (show) {
|
|
3604
|
-
const offset = this.removableColumns ? '51px' : '25px';
|
|
3605
|
-
dropArea.style.marginLeft =
|
|
3606
|
-
'calc(' + th.clientWidth / 2 + 'px - ' + offset + ')';
|
|
3607
|
-
this.startDynamicPositioning(dropArea, th);
|
|
3455
|
+
if (show && th && (this.removableColumns || this.showGroups)) {
|
|
3456
|
+
this.dropareaRef.classList.add('droparea--visible');
|
|
3457
|
+
this.kupManager.dynamicPosition.register(this.dropareaRef, th, 10, KupDynamicPositionPlacement.TOP);
|
|
3458
|
+
this.kupManager.dynamicPosition.start(this.dropareaRef);
|
|
3459
|
+
this.dropareaRef.style.marginLeft =
|
|
3460
|
+
th.clientWidth / 2 - this.dropareaRef.clientWidth / 2 + 'px';
|
|
3608
3461
|
}
|
|
3609
3462
|
else {
|
|
3610
|
-
this.
|
|
3463
|
+
this.dropareaRef.classList.remove('droparea--visible');
|
|
3464
|
+
+this.kupManager.dynamicPosition.stop(this.dropareaRef);
|
|
3611
3465
|
}
|
|
3612
3466
|
}
|
|
3613
3467
|
handleColumnRemove(column2remove) {
|
|
@@ -3724,9 +3578,6 @@ export class KupDataTable {
|
|
|
3724
3578
|
this.fontsize = this.getFontSizeCodeFromDecode(e.detail.value);
|
|
3725
3579
|
} })));
|
|
3726
3580
|
}
|
|
3727
|
-
getDensityDecodeFromCode(code) {
|
|
3728
|
-
return this.transcodeItem(code, this.DENSITY_CODES, this.DENSITY_DECODES);
|
|
3729
|
-
}
|
|
3730
3581
|
getDensityCodeFromDecode(decode) {
|
|
3731
3582
|
return this.transcodeItem(decode, this.DENSITY_DECODES, this.DENSITY_CODES);
|
|
3732
3583
|
}
|
|
@@ -3813,6 +3664,7 @@ export class KupDataTable {
|
|
|
3813
3664
|
} })));
|
|
3814
3665
|
}
|
|
3815
3666
|
render() {
|
|
3667
|
+
this.thRefs = [];
|
|
3816
3668
|
this.rowsRefs = [];
|
|
3817
3669
|
this.renderedRows = [];
|
|
3818
3670
|
let elStyle = undefined;
|
|
@@ -3820,14 +3672,7 @@ export class KupDataTable {
|
|
|
3820
3672
|
let rows = null;
|
|
3821
3673
|
if (this.paginatedRowsLength === 0) {
|
|
3822
3674
|
rows = (h("tr", { ref: (el) => this.rowsRefs.push(el) },
|
|
3823
|
-
h("td",
|
|
3824
|
-
? setKetchupDroppable(dropHandlersCell, [KupDataTableRowDragType], this.rootElement, {
|
|
3825
|
-
row: null,
|
|
3826
|
-
cell: null,
|
|
3827
|
-
column: null,
|
|
3828
|
-
id: this.rootElement.id,
|
|
3829
|
-
})
|
|
3830
|
-
: {}), { colSpan: this.calculateColspan() }), this.emptyDataLabel)));
|
|
3675
|
+
h("td", { colSpan: this.calculateColspan() }, this.emptyDataLabel)));
|
|
3831
3676
|
}
|
|
3832
3677
|
else {
|
|
3833
3678
|
rows = [];
|
|
@@ -3884,10 +3729,10 @@ export class KupDataTable {
|
|
|
3884
3729
|
data: chipsData,
|
|
3885
3730
|
id: 'group-chips',
|
|
3886
3731
|
type: FChipType.INPUT,
|
|
3887
|
-
|
|
3732
|
+
onIconClick: [],
|
|
3888
3733
|
};
|
|
3889
3734
|
for (let i = 0; i < chipsData.length; i++) {
|
|
3890
|
-
props.
|
|
3735
|
+
props.onIconClick.push(() => this.removeGroup(i));
|
|
3891
3736
|
}
|
|
3892
3737
|
groupChips = h(FChip, Object.assign({}, props));
|
|
3893
3738
|
}
|
|
@@ -3944,6 +3789,9 @@ export class KupDataTable {
|
|
|
3944
3789
|
} }))) : null,
|
|
3945
3790
|
paginatorTop),
|
|
3946
3791
|
h("div", { class: "group-wrapper" }, groupChips),
|
|
3792
|
+
h("div", { class: "droparea", ref: (el) => (this.dropareaRef = el) },
|
|
3793
|
+
this.showGroups ? this.columnGroupArea() : null,
|
|
3794
|
+
this.removableColumns ? this.columnRemoveArea() : null),
|
|
3947
3795
|
h("div", { style: elStyle, class: belowClass, ref: (el) => (this.tableAreaRef = el) },
|
|
3948
3796
|
this.showCustomization
|
|
3949
3797
|
? [
|
|
@@ -3960,39 +3808,8 @@ export class KupDataTable {
|
|
|
3960
3808
|
h("table", { class: tableClass, ref: (el) => (this.tableRef = el), onMouseLeave: (ev) => {
|
|
3961
3809
|
ev.stopPropagation();
|
|
3962
3810
|
unsetTooltip(this.tooltip);
|
|
3963
|
-
}, onClick: (e) => {
|
|
3964
|
-
// Note: event must be cloned
|
|
3965
|
-
// otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
|
|
3966
|
-
const clone = {};
|
|
3967
|
-
for (const key in e) {
|
|
3968
|
-
clone[key] = e[key];
|
|
3969
|
-
}
|
|
3970
|
-
this.clickTimeout.push(setTimeout(() => {
|
|
3971
|
-
this.kupDataTableClick.emit({
|
|
3972
|
-
comp: this,
|
|
3973
|
-
id: this.rootElement.id,
|
|
3974
|
-
details: this.clickHandler(clone),
|
|
3975
|
-
});
|
|
3976
|
-
}, 300));
|
|
3977
3811
|
}, onContextMenu: (e) => {
|
|
3978
|
-
|
|
3979
|
-
comp: this,
|
|
3980
|
-
id: this.rootElement.id,
|
|
3981
|
-
details: this.contextMenuHandler(e),
|
|
3982
|
-
});
|
|
3983
|
-
}, onDblClick: (e) => {
|
|
3984
|
-
for (let index = 0; index < this.clickTimeout.length; index++) {
|
|
3985
|
-
clearTimeout(this.clickTimeout[index]);
|
|
3986
|
-
this.kupManager.debug.logMessage(this, 'Cleared clickHandler timeout(' +
|
|
3987
|
-
this.clickTimeout[index] +
|
|
3988
|
-
').');
|
|
3989
|
-
}
|
|
3990
|
-
this.clickTimeout = [];
|
|
3991
|
-
this.kupDataTableDblClick.emit({
|
|
3992
|
-
comp: this,
|
|
3993
|
-
id: this.rootElement.id,
|
|
3994
|
-
details: this.dblClickHandler(e),
|
|
3995
|
-
});
|
|
3812
|
+
e.preventDefault();
|
|
3996
3813
|
}, onMouseMove: (e) => this.mouseMoveHandler(e), onMouseOut: () => this.mouseOutHandler() },
|
|
3997
3814
|
h("thead", { hidden: !this.showHeader, ref: (el) => (this.theadRef = el) },
|
|
3998
3815
|
h("tr", null, header)),
|
|
@@ -4002,12 +3819,11 @@ export class KupDataTable {
|
|
|
4002
3819
|
: null),
|
|
4003
3820
|
stickyEl),
|
|
4004
3821
|
tooltip,
|
|
4005
|
-
paginatorBottom)
|
|
4006
|
-
this.showGroups ? this.columnGroupArea() : null,
|
|
4007
|
-
this.removableColumns ? this.columnRemoveArea() : null));
|
|
3822
|
+
paginatorBottom)));
|
|
4008
3823
|
return compCreated;
|
|
4009
3824
|
}
|
|
4010
3825
|
disconnectedCallback() {
|
|
3826
|
+
this.kupManager.interact.unregister(this.interactableDrag.concat(this.interactableDrop, this.interactableResize, this.interactableTouch));
|
|
4011
3827
|
this.kupManager.language.unregister(this);
|
|
4012
3828
|
this.kupManager.theme.unregister(this);
|
|
4013
3829
|
const dynamicPositionElements = this.rootElement.shadowRoot.querySelectorAll('[' + kupDynamicPositionAttribute + ']');
|
|
@@ -4141,7 +3957,7 @@ export class KupDataTable {
|
|
|
4141
3957
|
"text": "Enables drag."
|
|
4142
3958
|
},
|
|
4143
3959
|
"attribute": "drag-enabled",
|
|
4144
|
-
"reflect":
|
|
3960
|
+
"reflect": true,
|
|
4145
3961
|
"defaultValue": "false"
|
|
4146
3962
|
},
|
|
4147
3963
|
"dropEnabled": {
|
|
@@ -4159,7 +3975,7 @@ export class KupDataTable {
|
|
|
4159
3975
|
"text": "Enables drop."
|
|
4160
3976
|
},
|
|
4161
3977
|
"attribute": "drop-enabled",
|
|
4162
|
-
"reflect":
|
|
3978
|
+
"reflect": true,
|
|
4163
3979
|
"defaultValue": "false"
|
|
4164
3980
|
},
|
|
4165
3981
|
"editableData": {
|
|
@@ -4174,8 +3990,8 @@ export class KupDataTable {
|
|
|
4174
3990
|
"optional": false,
|
|
4175
3991
|
"docs": {
|
|
4176
3992
|
"tags": [{
|
|
4177
|
-
"
|
|
4178
|
-
"
|
|
3993
|
+
"name": "default",
|
|
3994
|
+
"text": "false"
|
|
4179
3995
|
}],
|
|
4180
3996
|
"text": "When set to true, editable cells will be rendered using input components."
|
|
4181
3997
|
},
|
|
@@ -4288,8 +4104,8 @@ export class KupDataTable {
|
|
|
4288
4104
|
"optional": false,
|
|
4289
4105
|
"docs": {
|
|
4290
4106
|
"tags": [{
|
|
4291
|
-
"
|
|
4292
|
-
"
|
|
4107
|
+
"name": "see",
|
|
4108
|
+
"text": "fixedRows"
|
|
4293
4109
|
}],
|
|
4294
4110
|
"text": "Fixes the given number of columns so that they stay visible when horizontally scrolling the data-table.\nIf grouping is active or the value of the prop is <= 0, this prop will have no effect.\nCan be combined with fixedRows."
|
|
4295
4111
|
},
|
|
@@ -4309,8 +4125,8 @@ export class KupDataTable {
|
|
|
4309
4125
|
"optional": false,
|
|
4310
4126
|
"docs": {
|
|
4311
4127
|
"tags": [{
|
|
4312
|
-
"
|
|
4313
|
-
"
|
|
4128
|
+
"name": "see",
|
|
4129
|
+
"text": "fixedColumns"
|
|
4314
4130
|
}],
|
|
4315
4131
|
"text": "Fixes the given number of rows so that they stay visible when vertically scrolling the data-table.\nIf grouping is active or the value of the prop is <= 0, this prop will have no effect.\nCan be combined with fixedColumns."
|
|
4316
4132
|
},
|
|
@@ -4449,8 +4265,8 @@ export class KupDataTable {
|
|
|
4449
4265
|
"optional": false,
|
|
4450
4266
|
"docs": {
|
|
4451
4267
|
"tags": [{
|
|
4452
|
-
"
|
|
4453
|
-
"
|
|
4268
|
+
"name": "default",
|
|
4269
|
+
"text": "false"
|
|
4454
4270
|
}],
|
|
4455
4271
|
"text": "When set to true, clicked-on rows will have a visual feedback."
|
|
4456
4272
|
},
|
|
@@ -4529,11 +4345,11 @@ export class KupDataTable {
|
|
|
4529
4345
|
"optional": false,
|
|
4530
4346
|
"docs": {
|
|
4531
4347
|
"tags": [{
|
|
4532
|
-
"
|
|
4533
|
-
"
|
|
4348
|
+
"name": "see",
|
|
4349
|
+
"text": "loadMoreStep *"
|
|
4534
4350
|
}, {
|
|
4535
|
-
"
|
|
4536
|
-
"
|
|
4351
|
+
"name": "see",
|
|
4352
|
+
"text": "loadMoreLimit"
|
|
4537
4353
|
}],
|
|
4538
4354
|
"text": "Establish the modality of how many new records will be downloaded.\n\nThis property is regulated also by loadMoreStep."
|
|
4539
4355
|
},
|
|
@@ -4553,11 +4369,11 @@ export class KupDataTable {
|
|
|
4553
4369
|
"optional": false,
|
|
4554
4370
|
"docs": {
|
|
4555
4371
|
"tags": [{
|
|
4556
|
-
"
|
|
4557
|
-
"
|
|
4372
|
+
"name": "see",
|
|
4373
|
+
"text": "loadMoreMode *"
|
|
4558
4374
|
}, {
|
|
4559
|
-
"
|
|
4560
|
-
"
|
|
4375
|
+
"name": "see",
|
|
4376
|
+
"text": "loadMoreLimit"
|
|
4561
4377
|
}],
|
|
4562
4378
|
"text": "The number of records which will be requested to be downloaded when clicking on the load more button.\n\nThis property is regulated also by loadMoreMode."
|
|
4563
4379
|
},
|
|
@@ -4624,6 +4440,24 @@ export class KupDataTable {
|
|
|
4624
4440
|
"reflect": false,
|
|
4625
4441
|
"defaultValue": "false"
|
|
4626
4442
|
},
|
|
4443
|
+
"resizableColumns": {
|
|
4444
|
+
"type": "boolean",
|
|
4445
|
+
"mutable": false,
|
|
4446
|
+
"complexType": {
|
|
4447
|
+
"original": "boolean",
|
|
4448
|
+
"resolved": "boolean",
|
|
4449
|
+
"references": {}
|
|
4450
|
+
},
|
|
4451
|
+
"required": false,
|
|
4452
|
+
"optional": false,
|
|
4453
|
+
"docs": {
|
|
4454
|
+
"tags": [],
|
|
4455
|
+
"text": "Gives the possibility to resize columns by dragging on their right edge."
|
|
4456
|
+
},
|
|
4457
|
+
"attribute": "resizable-columns",
|
|
4458
|
+
"reflect": false,
|
|
4459
|
+
"defaultValue": "true"
|
|
4460
|
+
},
|
|
4627
4461
|
"rowActions": {
|
|
4628
4462
|
"type": "unknown",
|
|
4629
4463
|
"mutable": false,
|
|
@@ -4847,8 +4681,8 @@ export class KupDataTable {
|
|
|
4847
4681
|
"optional": false,
|
|
4848
4682
|
"docs": {
|
|
4849
4683
|
"tags": [{
|
|
4850
|
-
"
|
|
4851
|
-
"
|
|
4684
|
+
"name": "namespace",
|
|
4685
|
+
"text": "KupDataTable.showHeader"
|
|
4852
4686
|
}],
|
|
4853
4687
|
"text": "Enables rendering of the table header."
|
|
4854
4688
|
},
|
|
@@ -5088,7 +4922,6 @@ export class KupDataTable {
|
|
|
5088
4922
|
"columnMenuAnchor": {},
|
|
5089
4923
|
"groupState": {},
|
|
5090
4924
|
"openedTotalMenu": {},
|
|
5091
|
-
"openedGroupMenu": {},
|
|
5092
4925
|
"openedCustomSettings": {},
|
|
5093
4926
|
"fontsize": {},
|
|
5094
4927
|
"triggerColumnSortRerender": {}
|
|
@@ -5428,8 +5261,8 @@ export class KupDataTable {
|
|
|
5428
5261
|
"signature": "(descriptions?: boolean) => Promise<GenericObject>",
|
|
5429
5262
|
"parameters": [{
|
|
5430
5263
|
"tags": [{
|
|
5431
|
-
"
|
|
5432
|
-
"
|
|
5264
|
+
"name": "param",
|
|
5265
|
+
"text": "descriptions - When provided and true, the result will be the list of props with their description."
|
|
5433
5266
|
}],
|
|
5434
5267
|
"text": "- When provided and true, the result will be the list of props with their description."
|
|
5435
5268
|
}],
|
|
@@ -5460,8 +5293,8 @@ export class KupDataTable {
|
|
|
5460
5293
|
"signature": "(column: string) => Promise<void>",
|
|
5461
5294
|
"parameters": [{
|
|
5462
5295
|
"tags": [{
|
|
5463
|
-
"
|
|
5464
|
-
"
|
|
5296
|
+
"name": "param",
|
|
5297
|
+
"text": "column - Name of the column."
|
|
5465
5298
|
}],
|
|
5466
5299
|
"text": "- Name of the column."
|
|
5467
5300
|
}],
|
|
@@ -5528,8 +5361,8 @@ export class KupDataTable {
|
|
|
5528
5361
|
"signature": "(props: GenericObject) => Promise<void>",
|
|
5529
5362
|
"parameters": [{
|
|
5530
5363
|
"tags": [{
|
|
5531
|
-
"
|
|
5532
|
-
"
|
|
5364
|
+
"name": "param",
|
|
5365
|
+
"text": "props - Object containing props that will be set to the component."
|
|
5533
5366
|
}],
|
|
5534
5367
|
"text": "- Object containing props that will be set to the component."
|
|
5535
5368
|
}],
|
|
@@ -5557,14 +5390,14 @@ export class KupDataTable {
|
|
|
5557
5390
|
"signature": "(rowsById: string, emitEvent?: boolean) => Promise<void>",
|
|
5558
5391
|
"parameters": [{
|
|
5559
5392
|
"tags": [{
|
|
5560
|
-
"
|
|
5561
|
-
"
|
|
5393
|
+
"name": "param",
|
|
5394
|
+
"text": "rowsById - String containing the ids separated by \";\"."
|
|
5562
5395
|
}],
|
|
5563
5396
|
"text": "- String containing the ids separated by \";\"."
|
|
5564
5397
|
}, {
|
|
5565
5398
|
"tags": [{
|
|
5566
|
-
"
|
|
5567
|
-
"
|
|
5399
|
+
"name": "param",
|
|
5400
|
+
"text": "emitEvent - The event will always be emitted unless emitEvent is set to false."
|
|
5568
5401
|
}],
|
|
5569
5402
|
"text": "- The event will always be emitted unless emitEvent is set to false."
|
|
5570
5403
|
}],
|