Skip to content

Commit

Permalink
Merge pull request #157 from mercedes-benz/TryOut
Browse files Browse the repository at this point in the history
link out feature
  • Loading branch information
m-o-n-i-s-h authored Dec 9, 2024
2 parents 9f7c856 + c032a8f commit 1a9740d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
<div className={'n-flex n-flex-row n-flex-wrap n-items-center'}>
<Autocomplete
id='autocomplete'
autoHighlight
multiple={multiSelector}
options={options}
disabled={disabled}
Expand Down
15 changes: 15 additions & 0 deletions src/chart/table/TableChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,21 @@ export const NeoTableChart = (props: ChartProps) => {
}
onCellDoubleClick={(e) => {
let rules = getRule(e, actionsRules, 'doubleClick');
let ruleCellCopy = getRule(e, actionsRules, 'ruleCellCopy');

if (ruleCellCopy?.length > 0) {
const fieldDetails = ruleCellCopy.find((rule) => rule.field === e.field);
if (fieldDetails) {
const regex = new RegExp(fieldDetails?.customizationValue, 'g');
setNotificationOpen(true);
navigator.clipboard.writeText(e.value.replace(regex, ''));
} else {
setNotificationOpen(true);
navigator.clipboard.writeText(e.value);
}
return;
}

if (rules !== null) {
rules.forEach((rule) => executeActionRule(rule, e, { ...props, pageNames: pageNames }, 'table'));
} else {
Expand Down
10 changes: 8 additions & 2 deletions src/extensions/actions/ActionsRuleCreationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ const RULE_CONDITIONS = {
disableFieldSelection: true,
multiple: true,
},
{
value: 'ruleCellCopy',
label: 'Cell Copy',
disableFieldSelection: true,
multiple: true,
},
],
bar: [
{
Expand Down Expand Up @@ -375,7 +381,7 @@ export const NeoCustomReportActionsModal = ({
const td2Styling = (type) => ({ width: type === 'bar' ? '15%' : '30%' });
const td2DropdownClassname = (type) => `n-align-middle n-pr-1 ${type === 'bar' ? 'n-w-full' : 'n-w-2/5'}`;
const td2Autocomplete = (type, index, rule) =>
(type !== 'bar' && rule.condition !== 'rowCheck' ? (
type !== 'bar' && rule.condition !== 'rowCheck' ? (
<Autocomplete
className='n-align-middle n-inline-block n-w-/5'
disableClearable={true}
Expand Down Expand Up @@ -406,7 +412,7 @@ export const NeoCustomReportActionsModal = ({
/>
) : (
<></>
));
);
const td4Styling = (type) => ({ width: type === 'bar' ? '45%' : '40%' });
const td4DropdownClassname = 'n-align-middle, n-w-1/3';
const td6Styling = (type) => ({ width: type === 'bar' ? '30%' : '20%' });
Expand Down
8 changes: 8 additions & 0 deletions src/index.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
@tailwind components;
@tailwind utilities;

.anchor {
text-decoration: underline;
text-decoration-thickness: 2px;
text-underline-offset: 4px;
text-decoration-color: blue;
color: blue;
}

/* Create CSS class based components */
/* https://tailwindcss.com/docs/reusing-styles#extracting-classes-with-apply */
@layer components {
Expand Down
5 changes: 5 additions & 0 deletions src/report/ReportRecordProcessing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ function RenderArray(value, transposedTable = false) {

export function RenderString(value) {
const str = value?.toString() || '';

if (str.startsWith('<a href=')) {
return <div dangerouslySetInnerHTML={{ __html: str }} className='anchor' />;
}

if (str.startsWith('http') || str.startsWith('https')) {
return (
<TextLink key={value} externalLink target='_blank' href={str}>
Expand Down

0 comments on commit 1a9740d

Please sign in to comment.