Skip to content

Commit 08c30c6

Browse files
author
Illia Obukhau
authored
[WC-1361]: timeline grouping bug (#180)
2 parents c5ded1c + 5e359bf commit 08c30c6

File tree

7 files changed

+29
-9
lines changed

7 files changed

+29
-9
lines changed

packages/pluggableWidgets/timeline-web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We fixed incorrect month grouping in custom visualization mode
12+
913
## [3.1.0] - 2021-12-23
1014

1115
### Added

packages/pluggableWidgets/timeline-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "timeline-web",
33
"widgetName": "Timeline",
4-
"version": "3.1.0",
4+
"version": "3.1.1",
55
"description": "Shows timeline",
66
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
77
"author": "Mendix",

packages/pluggableWidgets/timeline-web/src/Timeline.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TimelineContainerProps } from "../typings/TimelineProps";
33
import "./ui/Timeline.scss";
44
import { ActionValue, WebIcon } from "mendix";
55
import TimelineComponent, { getGroupHeaderByType } from "./components/TimelineComponent";
6-
import { getHeaderOption } from "./utils/utils";
6+
import { getGroupByMethodForCustomMode, getHeaderOption } from "./utils/utils";
77

88
export interface BasicItemType {
99
icon?: WebIcon;
@@ -44,7 +44,11 @@ export default function Timeline(props: TimelineContainerProps): ReactElement {
4444
action: props.onClick?.get(item)
4545
};
4646
} else {
47-
groupKey = getGroupHeaderByType(groupAttribute?.formatter, props.groupByKey, date);
47+
groupKey = getGroupHeaderByType(
48+
groupAttribute?.formatter,
49+
getGroupByMethodForCustomMode(props.groupByKey),
50+
date
51+
);
4852
constructedItem = {
4953
icon: props.customIcon?.get(item),
5054
groupHeader: props.customGroupHeader?.get(item),

packages/pluggableWidgets/timeline-web/src/Timeline.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<widget id="com.mendix.widget.web.timeline.Timeline" pluginWidget="true" needsEntityContext="true" offlineCapable="true" supportedPlatform="Web" xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../../../../node_modules/mendix/custom_widget.xsd">
2+
<widget id="com.mendix.widget.web.timeline.Timeline" pluginWidget="true" needsEntityContext="true" offlineCapable="true" supportedPlatform="Web" xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
33
<name>Timeline</name>
44
<description>Shows vertical timeline with events</description>
55
<studioProCategory>Display</studioProCategory>
@@ -61,7 +61,7 @@
6161
<description>Format group header with current language's format</description>
6262
<enumerationValues>
6363
<enumerationValue key="dayName">Day name</enumerationValue>
64-
<enumerationValue key="dayMonth">Day &amp; month</enumerationValue>
64+
<enumerationValue key="dayMonth">Day and month</enumerationValue>
6565
<enumerationValue key="fullDate">Day, month, year</enumerationValue>
6666
</enumerationValues>
6767
</property>
@@ -70,12 +70,12 @@
7070
<description />
7171
<enumerationValues>
7272
<enumerationValue key="month">Month</enumerationValue>
73-
<enumerationValue key="monthYear">Month &amp; year</enumerationValue>
73+
<enumerationValue key="monthYear">Month and year</enumerationValue>
7474
</enumerationValues>
7575
</property>
7676
<property key="ungroupedEventsPosition" type="enumeration" defaultValue="end">
7777
<caption>Ungrouped events position</caption>
78-
<description>Position in the list of events without a date &amp; time</description>
78+
<description>Position in the list of events without a date and time</description>
7979
<enumerationValues>
8080
<enumerationValue key="beginning">Beginning of the timeline</enumerationValue>
8181
<enumerationValue key="end">End of the timeline</enumerationValue>

packages/pluggableWidgets/timeline-web/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="Timeline" version="3.1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Timeline" version="3.1.1" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Timeline.xml" />
66
</widgetFiles>

packages/pluggableWidgets/timeline-web/src/utils/utils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TimelineContainerProps } from "../../typings/TimelineProps";
1+
import { GroupByKeyEnum, GroupByMonthOptionsEnum, TimelineContainerProps } from "../../typings/TimelineProps";
22

33
export type GroupHeaderConfig = Pick<
44
TimelineContainerProps,
@@ -8,3 +8,11 @@ export type GroupHeaderConfig = Pick<
88
export function getHeaderOption({ groupByKey, groupByDayOptions, groupByMonthOptions }: GroupHeaderConfig) {
99
return groupByKey === "day" ? groupByDayOptions : groupByKey === "month" ? groupByMonthOptions : "year";
1010
}
11+
12+
export function getGroupByMethodForCustomMode(groupByKey: GroupByKeyEnum): GroupByMonthOptionsEnum | GroupByKeyEnum {
13+
if (groupByKey === "month") {
14+
return "monthYear";
15+
}
16+
17+
return groupByKey;
18+
}

packages/pluggableWidgets/timeline-web/typings/TimelineProps.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ export interface TimelineContainerProps {
4040
}
4141

4242
export interface TimelinePreviewProps {
43+
/**
44+
* @deprecated Deprecated since version 9.18.0. Please use class property instead.
45+
*/
4346
className: string;
47+
class: string;
4448
style: string;
4549
styleObject?: CSSProperties;
4650
readOnly: boolean;

0 commit comments

Comments
 (0)