Skip to content

Commit

Permalink
Merge branch 'master' into dev-to-master
Browse files Browse the repository at this point in the history
  • Loading branch information
pasere-smeup authored Sep 28, 2022
2 parents 32bcbe1 + 5e5a68d commit 16b4579
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 9 deletions.
44 changes: 44 additions & 0 deletions packages/ketchup/src/assets/data-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,50 @@ const mockedRows = [
},
},
},
{
cells: {
FLD1: {
obj: {
t: 'CN',
p: 'COL',
k: 'CASFRA',
},
value: 'CASFRA',
},
FLD2: {
obj: {
t: 'NR',
p: '',
k: '10',
},
value: '10',
},
FLD3: {
obj: {
t: 'NR',
p: '',
k: '100000.60',
},
value: '100,000.60',
},
FLD4: {
obj: {
t: 'D8',
p: '*YYMD',
k: '20181101',
},
value: '2018-11-01',
},
FLD5: {
obj: {
t: 'NR',
p: 'P',
k: '0',
},
value: '0.00',
},
},
},
{
cells: {
FLD1: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export class KupDataTableState implements KupState {
expandGroups = false;
groupLabelDisplay = GroupLabelDisplayMode.BOTH;
density: string = 'small';
enableSortableColumns: boolean = false;
enableExtraColumns: boolean = true;
enableSortableColumns: boolean = false;
forceOneLine: boolean = false;
globalFilter = false;
globalFilterValue = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,6 @@ export class KupDataTable {

private getEventPath(currentEl: unknown): HTMLElement[] {
const path: HTMLElement[] = [];

while (
currentEl &&
currentEl !== this.rootElement &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ export class KupTimePicker {
this.value = value;
}


/*-------------------------------------------------*/
/* P r i v a t e M e t h o d s */
/*-------------------------------------------------*/

getFormattedValue(value: string): string {
return formattedStringToCustomUnformattedStringTime(
value,
Expand Down
25 changes: 19 additions & 6 deletions packages/ketchup/src/components/kup-tree/kup-tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ export class KupTree {
*/
private columnMenuCard: HTMLKupCardElement = null;
private treeWrapperRef: KupScrollOnHoverElement;
private selectedColumn: string = '';
private clickTimeout: any[] = [];
private globalFilterTimeout: number;
private footer: { [index: string]: number };
Expand Down Expand Up @@ -1030,6 +1029,11 @@ export class KupTree {
(this.expansionMode.toLowerCase() === KupTreeExpansionMode.NODE &&
!treeNodeData.expandable)
) {
const td = e
? this.getEventPath(e.target).find((el) => {
if (el.tagName === 'TD') return el;
})
: null;
// If this TreeNode is not disabled, then it can be selected and an event is emitted
if (treeNodeData && !treeNodeData.disabled) {
if (this.autoSelectionNodeMode)
Expand All @@ -1044,11 +1048,10 @@ export class KupTree {
.split(',')
.map((treeNodeIndex) => parseInt(treeNodeIndex)),
treeNode: treeNodeData,
columnName: this.selectedColumn,
columnName: td ? td.dataset.column : null,
auto: auto,
});
}
this.selectedColumn = '';
}

// If KupTreeExpansionMode.NODE then click is a collapse/expand click
Expand Down Expand Up @@ -1550,12 +1553,18 @@ export class KupTree {

// When can be expanded OR selected
if (!treeNodeData.disabled) {
treeNodeOptions['onClick'] = () => {
treeNodeOptions['onClick'] = (e: MouseEvent) => {
// Note: event must be cloned
// otherwise inside setTimeout will be exiting the Shadow DOM scope(causing loss of information, including target).
const clone: GenericObject = {};
for (const key in e) {
clone[key] = e[key];
}
this.clickTimeout.push(
setTimeout(
(e: MouseEvent) =>
() =>
this.hdlTreeNodeClick(
e,
clone as MouseEvent,
treeNodeData,
treeNodePath,
false
Expand All @@ -1569,6 +1578,10 @@ export class KupTree {
// When a tree node is displayed as a table
let treeNodeCells: JSX.Element[] | null = null;
let visibleCols = this.getVisibleColumns();

const _hasTooltip: boolean = !this.kupManager.objects.isEmptyKupObj(
treeNodeData.obj
);
if (this.showColumns && visibleCols && visibleCols.length) {
treeNodeCells = [];
// Renders all the cells
Expand Down

0 comments on commit 16b4579

Please sign in to comment.