Skip to content

Commit

Permalink
fix(blocks-antd): Fix Statistic decimalSeparator after ant design upd…
Browse files Browse the repository at this point in the history
…ate.
  • Loading branch information
SamTolmay committed Sep 19, 2023
1 parent 208acbe commit 8a4c90c
Showing 1 changed file with 41 additions and 35 deletions.
Expand Up @@ -19,41 +19,47 @@ import { Statistic } from 'antd';
import { type } from '@lowdefy/helpers';
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';

const StatisticBlock = ({ blockId, components: { Icon }, events, properties, methods }) => (
<Statistic
className={methods.makeCssClass(properties.style)}
decimalSeparator={properties.decimalSeparator}
groupSeparator={properties.groupSeparator}
id={blockId}
loading={properties.loading}
precision={properties.precision}
title={renderHtml({ html: properties.title, methods })}
value={type.isNone(properties.value) ? '' : properties.value}
valueStyle={methods.makeCssClass(properties.valueStyle, true)}
prefix={
properties.prefixIcon ? (
<Icon
blockId={`${blockId}_prefixIcon`}
events={events}
properties={properties.prefixIcon}
/>
) : (
properties.prefix || ''
)
}
suffix={
properties.suffixIcon ? (
<Icon
blockId={`${blockId}_suffixIcon`}
events={events}
properties={properties.suffixIcon}
/>
) : (
properties.suffix || ''
)
}
/>
);
const StatisticBlock = ({ blockId, components: { Icon }, events, properties, methods }) => {
const additionalProps = {};
if (properties.decimalSeparator) {
additionalProps.decimalSeparator = properties.decimalSeparator;
}
return (
<Statistic
className={methods.makeCssClass(properties.style)}
groupSeparator={properties.groupSeparator}
id={blockId}
loading={properties.loading}
precision={properties.precision}
title={renderHtml({ html: properties.title, methods })}
value={type.isNone(properties.value) ? '' : properties.value}
valueStyle={methods.makeCssClass(properties.valueStyle, true)}
prefix={
properties.prefixIcon ? (
<Icon
blockId={`${blockId}_prefixIcon`}
events={events}
properties={properties.prefixIcon}
/>
) : (
properties.prefix || ''
)
}
suffix={
properties.suffixIcon ? (
<Icon
blockId={`${blockId}_suffixIcon`}
events={events}
properties={properties.suffixIcon}
/>
) : (
properties.suffix || ''
)
}
{...additionalProps}
/>
);
};

StatisticBlock.defaultProps = blockDefaultProps;
StatisticBlock.meta = {
Expand Down

0 comments on commit 8a4c90c

Please sign in to comment.