Skip to content

Commit

Permalink
Merge pull request #2517 from smeup/feat/g-cell-in-tbl
Browse files Browse the repository at this point in the history
LS25000864: kup-data-table: Support to graphic shape LBL and graphic formatting by using markers in the  contained text
  • Loading branch information
pasere-smeup authored Feb 18, 2025
2 parents 2ec3cf3 + 667ca1f commit b87cda0
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export enum FCellTypes {
SWITCH = 'switch',
TABLE = 'table',
TIME = 'time',
LABEL = 'label',
}
export const editableTypes = [
FCellTypes.AUTOCOMPLETE,
Expand Down Expand Up @@ -226,6 +227,7 @@ export const kupTypes = [
FCellTypes.PROGRESS_BAR,
FCellTypes.RADIO,
FCellTypes.RATING,
FCellTypes.LABEL,
];
/**
* Payload of the event fired when a cell is updated.
Expand Down
3 changes: 3 additions & 0 deletions packages/ketchup/src/f-components/f-cell/f-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import {
kupTypes,
} from './f-cell-declarations';
import { getIdOfItemByDisplayMode } from '../../components/kup-list/kup-list-helper';
import { FLabel } from '../f-label/f-label';

const dom: KupDom = document.documentElement as KupDom;

Expand Down Expand Up @@ -1243,6 +1244,8 @@ function setKupCell(
disabled={true}
></FTextField>
);
case FCellTypes.LABEL:
return <FLabel text={cell.value} classes="f-cell__text"></FLabel>;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FComponent } from '../../types/GenericTypes';

export interface FLabelProps extends FComponent {
text: string;
classes?: string;
}

export interface ParsedElement {
Expand Down
4 changes: 2 additions & 2 deletions packages/ketchup/src/f-components/f-label/f-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ function getVNodes(parsedElements: ParsedElement[]): VNode[] {
});
}

export const FLabel: FunctionalComponent<FLabelProps> = ({ text }) => {
export const FLabel: FunctionalComponent<FLabelProps> = ({ text, classes }) => {
const parsedElements = getParsedElements(text);
// To avoid creating unnecessary span in the text
// when there are no tags to format the content
if (parsedElements?.length > 1) {
return <span>{getVNodes(parsedElements)}</span>;
return <span class={classes}>{getVNodes(parsedElements)}</span>;
} else {
return <Fragment>{text}</Fragment>;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/ketchup/src/managers/kup-data/kup-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ export class KupData {
return FCellTypes.STRING;
case FCellShapes.TIME:
return FCellTypes.TIME;
case FCellShapes.LABEL:
return FCellTypes.LABEL;
}
}

Expand Down
22 changes: 22 additions & 0 deletions packages/ketchup/src/managers/kup-perf-tuning/kup-perf-tuning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,26 @@ export class KupPerfTuning {
`perfIndex ${perfIndex}, maxCellsPerPage ${this.data.maxCellsPerPage}`
);
}

mark(checkpoint: string): void {
performance.mark(`${checkpoint} - Started`);
}

measure(
checkpoint: string,
track: string,
trackGroup = 'SmeUP Performance Tracking'
): void {
performance.measure(`${checkpoint} - Completed`, {
start: `${checkpoint} - Started`,
detail: {
devtools: {
dataType: 'track-entry',
track: `${track} - Tasks`,
trackGroup: trackGroup,
color: 'tertiary-dark',
},
},
});
}
}

0 comments on commit b87cda0

Please sign in to comment.