@pega/lists-react 9.0.0-build.19.0 → 9.0.0-build.19.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts +3 -1
  2. package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts.map +1 -1
  3. package/lib/Core/Components/DefaultComponents/EmptyContainer.js +11 -2
  4. package/lib/Core/Components/DefaultComponents/EmptyContainer.js.map +1 -1
  5. package/lib/Core/Components/DefaultComponents/index.d.ts +3 -1
  6. package/lib/Core/Components/DefaultComponents/index.d.ts.map +1 -1
  7. package/lib/Core/Components/Toolbar/AdvanceToolbar.d.ts.map +1 -1
  8. package/lib/Core/Components/Toolbar/AdvanceToolbar.js +3 -13
  9. package/lib/Core/Components/Toolbar/AdvanceToolbar.js.map +1 -1
  10. package/lib/Core/Components/Toolbar/FieldSelector.d.ts +1 -0
  11. package/lib/Core/Components/Toolbar/FieldSelector.d.ts.map +1 -1
  12. package/lib/Core/Components/Toolbar/FieldSelector.js +3 -2
  13. package/lib/Core/Components/Toolbar/FieldSelector.js.map +1 -1
  14. package/lib/Core/Components/Toolbar/Grouping.types.d.ts +0 -6
  15. package/lib/Core/Components/Toolbar/Grouping.types.d.ts.map +1 -1
  16. package/lib/Core/Components/Toolbar/Grouping.types.js.map +1 -1
  17. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.d.ts +14 -18
  18. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.d.ts.map +1 -1
  19. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js +14 -15
  20. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js.map +1 -1
  21. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.d.ts +3 -2
  22. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.d.ts.map +1 -1
  23. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js +4 -4
  24. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js.map +1 -1
  25. package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.d.ts.map +1 -1
  26. package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.js +6 -3
  27. package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.js.map +1 -1
  28. package/lib/Core/Components/Toolbar/hooks/useMore.d.ts.map +1 -1
  29. package/lib/Core/Components/Toolbar/hooks/useMore.js +32 -23
  30. package/lib/Core/Components/Toolbar/hooks/useMore.js.map +1 -1
  31. package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts +4 -4
  32. package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts.map +1 -1
  33. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js +6 -6
  34. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js.map +1 -1
  35. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts +2 -1
  36. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts.map +1 -1
  37. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.js +8 -2
  38. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.js.map +1 -1
  39. package/lib/Core/Components/Toolbar/hooks/useSort/useSort.d.ts.map +1 -1
  40. package/lib/Core/Components/Toolbar/hooks/useSort/useSort.js +2 -2
  41. package/lib/Core/Components/Toolbar/hooks/useSort/useSort.js.map +1 -1
  42. package/lib/Core/Components/Virtualise/Pagination.d.ts.map +1 -1
  43. package/lib/Core/Components/Virtualise/Pagination.js +2 -1
  44. package/lib/Core/Components/Virtualise/Pagination.js.map +1 -1
  45. package/lib/Core/Components/Virtualise/UseScroll.d.ts +4 -1
  46. package/lib/Core/Components/Virtualise/UseScroll.d.ts.map +1 -1
  47. package/lib/Core/Components/Virtualise/UseScroll.js +16 -3
  48. package/lib/Core/Components/Virtualise/UseScroll.js.map +1 -1
  49. package/lib/Core/Components/Virtualise/VirtualizeInfinite.js +13 -3
  50. package/lib/Core/Components/Virtualise/VirtualizeInfinite.js.map +1 -1
  51. package/lib/Core/Components/Virtualise/index.js +12 -3
  52. package/lib/Core/Components/Virtualise/index.js.map +1 -1
  53. package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts +1 -1
  54. package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts.map +1 -1
  55. package/lib/Core/Views/Gallery/Components/GalleryCard.js +8 -6
  56. package/lib/Core/Views/Gallery/Components/GalleryCard.js.map +1 -1
  57. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts +8 -0
  58. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts.map +1 -0
  59. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js +25 -0
  60. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js.map +1 -0
  61. package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts +1 -2
  62. package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts.map +1 -1
  63. package/lib/Core/Views/Gallery/Components/GalleryHeader.js +4 -8
  64. package/lib/Core/Views/Gallery/Components/GalleryHeader.js.map +1 -1
  65. package/lib/Core/Views/Gallery/Gallery.types.d.ts +0 -1
  66. package/lib/Core/Views/Gallery/Gallery.types.d.ts.map +1 -1
  67. package/lib/Core/Views/Gallery/Gallery.types.js.map +1 -1
  68. package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts +9 -0
  69. package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts.map +1 -0
  70. package/lib/Core/Views/Gallery/hooks/useRowActions.js +25 -0
  71. package/lib/Core/Views/Gallery/hooks/useRowActions.js.map +1 -0
  72. package/lib/Core/Views/Gallery/index.d.ts.map +1 -1
  73. package/lib/Core/Views/Gallery/index.js +10 -7
  74. package/lib/Core/Views/Gallery/index.js.map +1 -1
  75. package/lib/Core/Views/Gallery/utils.d.ts +15 -2
  76. package/lib/Core/Views/Gallery/utils.d.ts.map +1 -1
  77. package/lib/Core/Views/Gallery/utils.js +23 -5
  78. package/lib/Core/Views/Gallery/utils.js.map +1 -1
  79. package/lib/Core/Views/Map/index.d.ts.map +1 -1
  80. package/lib/Core/Views/Map/index.js +2 -2
  81. package/lib/Core/Views/Map/index.js.map +1 -1
  82. package/lib/Core/Views/Table/TableA11y.d.ts +10 -0
  83. package/lib/Core/Views/Table/TableA11y.d.ts.map +1 -1
  84. package/lib/Core/Views/Table/TableA11y.js +185 -0
  85. package/lib/Core/Views/Table/TableA11y.js.map +1 -1
  86. package/lib/Core/Views/Table/VirtualizeWrapper.d.ts.map +1 -1
  87. package/lib/Core/Views/Table/VirtualizeWrapper.js +12 -13
  88. package/lib/Core/Views/Table/VirtualizeWrapper.js.map +1 -1
  89. package/lib/Core/Views/Table/index.d.ts.map +1 -1
  90. package/lib/Core/Views/Table/index.js +5 -3
  91. package/lib/Core/Views/Table/index.js.map +1 -1
  92. package/lib/Core/Views/Timeline/Timeline.d.ts.map +1 -1
  93. package/lib/Core/Views/Timeline/Timeline.js +11 -11
  94. package/lib/Core/Views/Timeline/Timeline.js.map +1 -1
  95. package/lib/Core/Views/Timeline/Timeline.styles.d.ts +1 -1
  96. package/lib/Core/Views/Timeline/Timeline.styles.d.ts.map +1 -1
  97. package/lib/Core/Views/Timeline/Timeline.styles.js +7 -10
  98. package/lib/Core/Views/Timeline/Timeline.styles.js.map +1 -1
  99. package/lib/Core/Views/Timeline/Timeline.types.d.ts +7 -9
  100. package/lib/Core/Views/Timeline/Timeline.types.d.ts.map +1 -1
  101. package/lib/Core/Views/Timeline/Timeline.types.js.map +1 -1
  102. package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts +2 -2
  103. package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts.map +1 -1
  104. package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.js.map +1 -1
  105. package/lib/Core/Views/Timeline/index.d.ts.map +1 -1
  106. package/lib/Core/Views/Timeline/index.js +4 -4
  107. package/lib/Core/Views/Timeline/index.js.map +1 -1
  108. package/lib/Core/Views/Timeline/utils.d.ts +8 -10
  109. package/lib/Core/Views/Timeline/utils.d.ts.map +1 -1
  110. package/lib/Core/Views/Timeline/utils.js +136 -58
  111. package/lib/Core/Views/Timeline/utils.js.map +1 -1
  112. package/lib/Core/templateFeatureSupport.d.ts +17 -0
  113. package/lib/Core/templateFeatureSupport.d.ts.map +1 -0
  114. package/lib/Core/templateFeatureSupport.js +30 -0
  115. package/lib/Core/templateFeatureSupport.js.map +1 -0
  116. package/package.json +7 -7
  117. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.d.ts +0 -7
  118. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.d.ts.map +0 -1
  119. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.js +0 -109
  120. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.js.map +0 -1
  121. package/lib/Core/Views/Timeline/utility.d.ts +0 -8
  122. package/lib/Core/Views/Timeline/utility.d.ts.map +0 -1
  123. package/lib/Core/Views/Timeline/utility.js +0 -120
  124. package/lib/Core/Views/Timeline/utility.js.map +0 -1
@@ -1,12 +1,10 @@
1
- import type { ActivityObject, TimelineGroupBy } from './Timeline.types';
2
- export declare function getDatePartAsDate(date: string | number | Date): Date;
3
- export declare function getMonthYearPartAsDate(date: string | number | Date): Date;
4
- export declare function getYearPartAsDate(date: string | number | Date): Date;
5
- export declare function isSameDate(firstDate: string | number | Date, secondDate: string | number | Date): boolean;
6
- export declare function isSameMonthYear(firstDate: string | number | Date, secondDate: string | number | Date): boolean;
7
- export declare function isSameYear(firstDate: string | number | Date, secondDate: string | number | Date): boolean;
8
- export declare function isSameQuarterYear(firstDate: string | number | Date, secondDate: string | number | Date): boolean;
9
- export declare function isSameGroup(firstDate: string | number | Date | undefined, secondDate: string | number | Date | undefined, groupBy: TimelineGroupBy): boolean;
10
- export declare function groupByActivity(activity: ActivityObject[], groupBy: TimelineGroupBy): ActivityObject[][];
1
+ import type { DateTimeVariant } from '@pega/cosmos-react-core/lib/components/DateTime/DateTime.types';
2
+ import type { RsCoreTypes } from 'pega-repeating-structures-core';
3
+ import type { Group } from 'pega-repeating-structures-core/lib/types/State.types';
4
+ import type TimelineProps from './Timeline.types';
5
+ export declare const dateDisplayVariants: Partial<Record<NonNullable<Group['dateFunction']>, DateTimeVariant>>;
6
+ declare const getActivities: (groupHeaders: RsCoreTypes.View["groupHeaders"], columns: RsCoreTypes.View["columns"], { timelineFields, timezone, defaultRowHeight }: RsCoreTypes.View["meta"], groupBy?: Group) => TimelineProps["activities"];
7
+ export default getActivities;
8
+ export declare function calculateBodyMaxHeight(maxHeight: string | number | undefined, domContainer: HTMLElement | undefined, pContainer: HTMLElement | null | undefined): string | undefined;
11
9
  export declare function isFutureDate(date: string | number | Date | undefined, current: Date): boolean;
12
10
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Timeline/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAGpE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAGzE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAGpE;AAED,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EACjC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GACjC,OAAO,CAET;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EACjC,UAAU,EAAE,MAAM,G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,EAC9C,SAAS,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EACpC,gDAAgD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EACxE,UAAU,KAAK,KACd,aAAa,CAAC,YAAY,CA2D5B,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EACtC,YAAY,EAAE,WAAW,GAAG,SAAS,EACrC,UAAU,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,sBAc3C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,CAG7F"}
@@ -1,62 +1,140 @@
1
- import { getQuarter, parseToDate } from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';
2
- export function getDatePartAsDate(date) {
3
- const parsedDate = parseToDate(date);
4
- return new Date(parsedDate.getUTCFullYear(), parsedDate.getUTCMonth(), parsedDate.getUTCDate());
5
- }
6
- export function getMonthYearPartAsDate(date) {
7
- const parsedDate = parseToDate(date);
8
- return new Date(parsedDate.getUTCFullYear(), parsedDate.getUTCMonth());
9
- }
10
- export function getYearPartAsDate(date) {
11
- const parsedDate = parseToDate(date);
12
- return new Date(parsedDate.getUTCFullYear());
13
- }
14
- export function isSameDate(firstDate, secondDate) {
15
- return getDatePartAsDate(firstDate).getTime() === getDatePartAsDate(secondDate).getTime();
16
- }
17
- export function isSameMonthYear(firstDate, secondDate) {
18
- return (getMonthYearPartAsDate(firstDate).getTime() === getMonthYearPartAsDate(secondDate).getTime());
19
- }
20
- export function isSameYear(firstDate, secondDate) {
21
- return getYearPartAsDate(firstDate).getTime() === getYearPartAsDate(secondDate).getTime();
22
- }
23
- export function isSameQuarterYear(firstDate, secondDate) {
24
- return isSameYear(firstDate, secondDate) && getQuarter(firstDate) === getQuarter(secondDate);
25
- }
26
- export function isSameGroup(firstDate, secondDate, groupBy) {
27
- if (!firstDate || !secondDate)
28
- return false;
29
- switch (groupBy) {
30
- case 'none': {
31
- return true;
32
- }
33
- case 'date': {
34
- return isSameDate(firstDate, secondDate);
35
- }
36
- case 'monthyear': {
37
- return isSameMonthYear(firstDate, secondDate);
38
- }
39
- case 'quarteryear': {
40
- return isSameQuarterYear(firstDate, secondDate);
41
- }
42
- case 'year': {
43
- return isSameYear(firstDate, secondDate);
44
- }
45
- default:
46
- return false;
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import dayjs from 'dayjs';
3
+ import timezonePlugin from 'dayjs/plugin/timezone';
4
+ import { DateTimeDisplay, NoValue, parseToDate } from '@pega/cosmos-react-core';
5
+ import { FieldType, ROW_DENSITY } from 'pega-repeating-structures-core/lib/types/Meta.types';
6
+ import RenderingEngine from '../../Components/RenderingEngine/RenderCell';
7
+ import ValueRenderer from '../../Components/RenderingEngine/ValueRenderer';
8
+ dayjs.extend(timezonePlugin);
9
+ const getStatusVariant = (data) => {
10
+ let variant;
11
+ const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];
12
+ const infoStrings = ['open', 'hold', 'info', 'new'];
13
+ const successStrings = ['resolved', 'completed', 'success'];
14
+ const pendingStrings = ['pending'];
15
+ if (new RegExp(warnStrings.join('|'), 'i').test(data)) {
16
+ variant = 'warn';
17
+ }
18
+ else if (new RegExp(infoStrings.join('|'), 'i').test(data)) {
19
+ variant = 'info';
20
+ }
21
+ else if (new RegExp(successStrings.join('|'), 'i').test(data)) {
22
+ variant = 'success';
23
+ }
24
+ else if (new RegExp(pendingStrings.join('|'), 'i').test(data)) {
25
+ variant = 'pending';
26
+ }
27
+ else {
28
+ variant = 'info';
29
+ }
30
+ return variant;
31
+ };
32
+ const getFieldsAsActivityContent = (columns, row) => {
33
+ return columns
34
+ ?.filter(column => column.field.name !== 'RowActionMenu' && !column.hidden)
35
+ ?.map(column => {
36
+ return {
37
+ id: column.field.id,
38
+ name: column.field.label,
39
+ value: _jsx(ValueRenderer, { column: column, row: row })
40
+ };
41
+ });
42
+ };
43
+ const convertDateToTimezone = (value, timezone) => {
44
+ return (dayjs(value)
45
+ .tz(timezone)
46
+ // cSpell:disable-next-line
47
+ .format('YYYY-MM-DDTHH:mm:ss'));
48
+ };
49
+ export const dateDisplayVariants = {
50
+ YEARS: 'year',
51
+ QUARTERS: 'quarteryear',
52
+ MONTHS: 'monthyear',
53
+ WEEKS: 'week',
54
+ DAYS: 'date',
55
+ HOURS: 'datetime',
56
+ MINUTES: 'datetime'
57
+ };
58
+ const renderHeader = (header, groupBy, groupByColumn) => {
59
+ if (!groupByColumn || !header.name) {
60
+ return _jsx(NoValue, {});
61
+ }
62
+ if (groupBy?.dateFunction && typeof header.name !== 'boolean') {
63
+ return (_jsx(DateTimeDisplay, { variant: dateDisplayVariants[groupBy.dateFunction] ?? 'datetime', format: 'long', value: header.name }));
64
+ }
65
+ groupByColumn.setExecutionContext(null);
66
+ return (_jsx(RenderingEngine, { ...groupByColumn.getRenderingEngineProps(), context: {
67
+ getValue: () => header.name,
68
+ getExecutionContext: () => ({
69
+ getValue: () => header.data,
70
+ name: 'groupHeader'
71
+ })
72
+ } }));
73
+ };
74
+ const getActivities = (groupHeaders, columns, { timelineFields, timezone, defaultRowHeight }, groupBy) => {
75
+ const { title, date, status: statusProp, icon, content } = timelineFields ?? {};
76
+ const titleColumn = columns?.find(({ field }) => field.name === title?.name);
77
+ const dateColumn = columns?.find(({ field }) => field.name === date?.name);
78
+ const contentColumn = columns?.find(({ field }) => field.name === content?.name);
79
+ const groupByColumn = columns?.find(({ field }) => field.id === groupBy?.columnId);
80
+ return (groupHeaders ?? [])
81
+ .map(header => {
82
+ return {
83
+ header: renderHeader(header, groupBy, groupByColumn),
84
+ activity: (header.getRows() ?? [])
85
+ .map(row => {
86
+ const data = row.getContext().getValue();
87
+ const dateValue = date?.name ? data[date.name] : undefined;
88
+ const dateFieldType = dateColumn?.field?.type;
89
+ const isDateOnlyFieldType = dateFieldType === FieldType.DATE ||
90
+ dateFieldType === FieldType.DATE_ONLY ||
91
+ dateFieldType === FieldType.DATE_TIMELINE;
92
+ // Activity Object date can't be undefined
93
+ if (!dateValue) {
94
+ return undefined;
95
+ }
96
+ const statusData = statusProp?.name ? data[statusProp.name] : undefined;
97
+ const status = statusData
98
+ ? {
99
+ variant: getStatusVariant(statusData),
100
+ children: statusData
101
+ }
102
+ : undefined;
103
+ const activity = {
104
+ id: row.key,
105
+ title: title?.name && data[title.name] && titleColumn ? (_jsx(ValueRenderer, { column: titleColumn, row: row })) : (_jsx(NoValue, {})),
106
+ date: timezone && dateColumn?.formatterAllowed && dateFieldType && !isDateOnlyFieldType // Date only value should be formatted without timezone
107
+ ? convertDateToTimezone(dateValue, timezone)
108
+ : dateValue,
109
+ dateVariant: isDateOnlyFieldType ? 'date' : 'datetime',
110
+ icon: icon?.name ? data[icon.name] : undefined,
111
+ defaultExpanded: defaultRowHeight === ROW_DENSITY.WRAP_CONTENT,
112
+ content: contentColumn ? (_jsx(ValueRenderer, { column: contentColumn, row: row })) : (getFieldsAsActivityContent(columns, row)),
113
+ status: statusProp?.getCustomContent ? statusProp.getCustomContent(row) : status
114
+ };
115
+ return activity;
116
+ })
117
+ ?.filter((item) => !!item)
118
+ };
119
+ })
120
+ .filter(({ activity }) => activity.length > 0);
121
+ };
122
+ export default getActivities;
123
+ export function calculateBodyMaxHeight(maxHeight, domContainer, pContainer) {
124
+ if (maxHeight === undefined)
125
+ return;
126
+ if (!domContainer || !pContainer)
127
+ return;
128
+ const extraHeight = domContainer.offsetHeight - pContainer.offsetHeight;
129
+ if (typeof maxHeight === 'string' && maxHeight.startsWith('--')) {
130
+ // Means it is a css variable which is a string, and it needs to be computed with calc function
131
+ // If css variable is not defined then fallback to default max height i.e. 550px
132
+ const defaultMaxHeight = `calc(550px + ${extraHeight}px + 32px)`;
133
+ return `calc(var(${maxHeight}, ${defaultMaxHeight}) - ${extraHeight}px - 32px)`;
134
+ }
135
+ if (typeof maxHeight === 'number') {
136
+ return `${maxHeight - extraHeight - 32}px`;
47
137
  }
48
- }
49
- export function groupByActivity(activity, groupBy) {
50
- return activity.reduce((result, item, index) => {
51
- const isFirstItemInGroup = !isSameGroup(activity[index - 1]?.date, item.date, groupBy);
52
- if (isFirstItemInGroup) {
53
- result.push([item]);
54
- }
55
- else {
56
- result[result.length - 1].push(item);
57
- }
58
- return result;
59
- }, []);
60
138
  }
61
139
  export function isFutureDate(date, current) {
62
140
  if (!date || !current)
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../Core/Views/Timeline/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACZ,MAAM,6DAA6D,CAAC;AAIrE,MAAM,UAAU,iBAAiB,CAAC,IAA4B;IAC5D,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,EAAE,UAAU,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAA4B;IACjE,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAA4B;IAC5D,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,SAAiC,EACjC,UAAkC;IAElC,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,KAAK,iBAAiB,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;A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,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,QAA0B,EAC1B,OAAwB;IAExB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,MAA0B,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACjE,MAAM,kBAAkB,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvF,IAAI,kBAAkB,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAwC,EAAE,OAAa;IAClF,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC","sourcesContent":["import {\n getQuarter,\n parseToDate\n} from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';\n\nimport type { ActivityObject, TimelineGroupBy } from './Timeline.types';\n\nexport function getDatePartAsDate(date: string | number | Date): Date {\n const parsedDate = parseToDate(date);\n return new Date(parsedDate.getUTCFullYear(), parsedDate.getUTCMonth(), parsedDate.getUTCDate());\n}\n\nexport function getMonthYearPartAsDate(date: string | number | Date): Date {\n const parsedDate = parseToDate(date);\n return new Date(parsedDate.getUTCFullYear(), parsedDate.getUTCMonth());\n}\n\nexport function getYearPartAsDate(date: string | number | Date): Date {\n const parsedDate = parseToDate(date);\n return new Date(parsedDate.getUTCFullYear());\n}\n\nexport function isSameDate(\n firstDate: string | number | Date,\n secondDate: string | number | Date\n): boolean {\n return getDatePartAsDate(firstDate).getTime() === getDatePartAsDate(secondDate).getTime();\n}\n\nexport function isSameMonthYear(\n firstDate: string | number | Date,\n secondDate: string | number | Date\n): boolean {\n return (\n getMonthYearPartAsDate(firstDate).getTime() === getMonthYearPartAsDate(secondDate).getTime()\n );\n}\n\nexport function isSameYear(\n firstDate: string | number | Date,\n secondDate: string | number | Date\n): boolean {\n return getYearPartAsDate(firstDate).getTime() === getYearPartAsDate(secondDate).getTime();\n}\n\nexport function isSameQuarterYear(\n firstDate: string | number | Date,\n secondDate: string | number | Date\n): boolean {\n return isSameYear(firstDate, secondDate) && getQuarter(firstDate) === getQuarter(secondDate);\n}\n\nexport function isSameGroup(\n firstDate: string | number | Date | undefined,\n secondDate: string | number | Date | undefined,\n groupBy: TimelineGroupBy\n): boolean {\n if (!firstDate || !secondDate) return false;\n switch (groupBy) {\n case 'none': {\n return true;\n }\n case 'date': {\n return isSameDate(firstDate, secondDate);\n }\n case 'monthyear': {\n return isSameMonthYear(firstDate, secondDate);\n }\n case 'quarteryear': {\n return isSameQuarterYear(firstDate, secondDate);\n }\n case 'year': {\n return isSameYear(firstDate, secondDate);\n }\n default:\n return false;\n }\n}\n\nexport function groupByActivity(\n activity: ActivityObject[],\n groupBy: TimelineGroupBy\n): ActivityObject[][] {\n return activity.reduce((result: ActivityObject[][], item, index) => {\n const isFirstItemInGroup = !isSameGroup(activity[index - 1]?.date, item.date, groupBy);\n if (isFirstItemInGroup) {\n result.push([item]);\n } else {\n result[result.length - 1].push(item);\n }\n return result;\n }, []);\n}\n\nexport function isFutureDate(date: string | number | Date | undefined, current: Date): boolean {\n if (!date || !current) return false;\n return parseToDate(date).getTime() > current.getTime();\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../Core/Views/Timeline/utils.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OA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AAC;YAClB,CAAC,CAAC;gBACF,EAAE,MAAM,CAAC,CAAC,IAAI,EAA0B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACrD,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,MAAM,UAAU,sBAAsB,CACpC,SAAsC,EACtC,YAAqC,EACrC,UAA0C;IAE1C,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO;IACpC,IAAI,CAAC,YAAY,IAAI,CAAC,UAAU;QAAE,OAAO;IACzC,MAAM,WAAW,GAAG,YAAY,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;IACxE,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAChE,+FAA+F;QAC/F,gFAAgF;QAChF,MAAM,gBAAgB,GAAG,gBAAgB,WAAW,YAAY,CAAC;QACjE,OAAO,YAAY,SAAS,KAAK,gBAAgB,OAAO,WAAW,YAAY,CAAC;IAClF,CAAC;IACD,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,EAAE,IAAI,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAwC,EAAE,OAAa;IAClF,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport timezonePlugin from 'dayjs/plugin/timezone';\nimport type { ReactText } from 'react';\n\nimport type { DateTimeVariant } from '@pega/cosmos-react-core/lib/components/DateTime/DateTime.types';\nimport { DateTimeDisplay, NoValue, parseToDate } from '@pega/cosmos-react-core';\nimport type { FieldValueListProps, StatusProps } from '@pega/cosmos-react-core';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport { FieldType, ROW_DENSITY } from 'pega-repeating-structures-core/lib/types/Meta.types';\nimport type { Group } from 'pega-repeating-structures-core/lib/types/State.types';\n\nimport RenderingEngine from '../../Components/RenderingEngine/RenderCell';\nimport ValueRenderer from '../../Components/RenderingEngine/ValueRenderer';\n\nimport type { ActivityObject } from './Timeline.types';\nimport type TimelineProps from './Timeline.types';\n\ndayjs.extend(timezonePlugin);\nconst getStatusVariant = (data: string): StatusProps['variant'] => {\n let variant: StatusProps['variant'];\n const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];\n const infoStrings = ['open', 'hold', 'info', 'new'];\n const successStrings = ['resolved', 'completed', 'success'];\n const pendingStrings = ['pending'];\n\n if (new RegExp(warnStrings.join('|'), 'i').test(data)) {\n variant = 'warn';\n } else if (new RegExp(infoStrings.join('|'), 'i').test(data)) {\n variant = 'info';\n } else if (new RegExp(successStrings.join('|'), 'i').test(data)) {\n variant = 'success';\n } else if (new RegExp(pendingStrings.join('|'), 'i').test(data)) {\n variant = 'pending';\n } else {\n variant = 'info';\n }\n return variant;\n};\n\nconst getFieldsAsActivityContent = (\n columns: RsCoreTypes.View['columns'],\n row: RsCoreTypes.Row\n): FieldValueListProps['fields'] | undefined => {\n return columns\n ?.filter(column => column.field.name !== 'RowActionMenu' && !column.hidden)\n ?.map(column => {\n return {\n id: column.field.id,\n name: column.field.label,\n value: <ValueRenderer column={column} row={row} />\n };\n });\n};\n\nconst convertDateToTimezone = (\n value: string | number | Date,\n timezone: RsCoreTypes.Meta['timezone']\n): string => {\n return (\n dayjs(value)\n .tz(timezone)\n // cSpell:disable-next-line\n .format('YYYY-MM-DDTHH:mm:ss')\n );\n};\n\nexport const dateDisplayVariants: Partial<\n Record<NonNullable<Group['dateFunction']>, DateTimeVariant>\n> = {\n YEARS: 'year',\n QUARTERS: 'quarteryear',\n MONTHS: 'monthyear',\n WEEKS: 'week',\n DAYS: 'date',\n HOURS: 'datetime',\n MINUTES: 'datetime'\n};\n\nconst renderHeader = (\n header: RsCoreTypes.GroupGenerator,\n groupBy?: Group,\n groupByColumn?: RsCoreTypes.Column\n) => {\n if (!groupByColumn || !header.name) {\n return <NoValue />;\n }\n\n if (groupBy?.dateFunction && typeof header.name !== 'boolean') {\n return (\n <DateTimeDisplay\n variant={dateDisplayVariants[groupBy.dateFunction] ?? 'datetime'}\n format='long'\n value={header.name}\n />\n );\n }\n\n groupByColumn.setExecutionContext(null);\n\n return (\n <RenderingEngine\n {...groupByColumn.getRenderingEngineProps()}\n context={{\n getValue: () => header.name,\n getExecutionContext: () => ({\n getValue: () => header.data,\n name: 'groupHeader'\n })\n }}\n />\n );\n};\n\nconst getActivities = (\n groupHeaders: RsCoreTypes.View['groupHeaders'],\n columns: RsCoreTypes.View['columns'],\n { timelineFields, timezone, defaultRowHeight }: RsCoreTypes.View['meta'],\n groupBy?: Group\n): TimelineProps['activities'] => {\n const { title, date, status: statusProp, icon, content } = timelineFields ?? {};\n const titleColumn = columns?.find(({ field }) => field.name === title?.name);\n const dateColumn = columns?.find(({ field }) => field.name === date?.name);\n const contentColumn = columns?.find(({ field }) => field.name === content?.name);\n const groupByColumn = columns?.find(({ field }) => field.id === groupBy?.columnId);\n return (groupHeaders ?? [])\n .map(header => {\n return {\n header: renderHeader(header, groupBy, groupByColumn),\n activity: (header.getRows() ?? [])\n .map(row => {\n const data = row.getContext().getValue();\n const dateValue = date?.name ? data[date.name] : undefined;\n const dateFieldType = dateColumn?.field?.type;\n const isDateOnlyFieldType =\n dateFieldType === FieldType.DATE ||\n dateFieldType === FieldType.DATE_ONLY ||\n dateFieldType === FieldType.DATE_TIMELINE;\n\n // Activity Object date can't be undefined\n if (!dateValue) {\n return undefined;\n }\n const statusData = statusProp?.name ? data[statusProp.name] : undefined;\n const status = statusData\n ? {\n variant: getStatusVariant(statusData as string),\n children: statusData as ReactText\n }\n : undefined;\n const activity: ActivityObject = {\n id: row.key as string,\n title:\n title?.name && data[title.name] && titleColumn ? (\n <ValueRenderer column={titleColumn} row={row} />\n ) : (\n <NoValue />\n ),\n date:\n timezone && dateColumn?.formatterAllowed && dateFieldType && !isDateOnlyFieldType // Date only value should be formatted without timezone\n ? convertDateToTimezone(dateValue as string, timezone)\n : (dateValue as string),\n dateVariant: isDateOnlyFieldType ? 'date' : 'datetime',\n icon: icon?.name ? (data[icon.name] as string) : undefined,\n defaultExpanded: defaultRowHeight === ROW_DENSITY.WRAP_CONTENT,\n content: contentColumn ? (\n <ValueRenderer column={contentColumn} row={row} />\n ) : (\n getFieldsAsActivityContent(columns, row)\n ),\n status: statusProp?.getCustomContent ? statusProp.getCustomContent(row) : status\n };\n return activity;\n })\n ?.filter((item): item is ActivityObject => !!item)\n };\n })\n .filter(({ activity }) => activity.length > 0);\n};\n\nexport default getActivities;\n\nexport function calculateBodyMaxHeight(\n maxHeight: string | number | undefined,\n domContainer: HTMLElement | undefined,\n pContainer: HTMLElement | null | undefined\n) {\n if (maxHeight === undefined) return;\n if (!domContainer || !pContainer) return;\n const extraHeight = domContainer.offsetHeight - pContainer.offsetHeight;\n if (typeof maxHeight === 'string' && maxHeight.startsWith('--')) {\n // Means it is a css variable which is a string, and it needs to be computed with calc function\n // If css variable is not defined then fallback to default max height i.e. 550px\n const defaultMaxHeight = `calc(550px + ${extraHeight}px + 32px)`;\n return `calc(var(${maxHeight}, ${defaultMaxHeight}) - ${extraHeight}px - 32px)`;\n }\n if (typeof maxHeight === 'number') {\n return `${maxHeight - extraHeight - 32}px`;\n }\n}\n\nexport function isFutureDate(date: string | number | Date | undefined, current: Date): boolean {\n if (!date || !current) return false;\n return parseToDate(date).getTime() > current.getTime();\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
2
+ type TemplateValue = (typeof REPEATING_STRUCTURE_TEMPLATES)[keyof typeof REPEATING_STRUCTURE_TEMPLATES];
3
+ declare const featureSupport: {
4
+ [feature: string]: TemplateValue[];
5
+ };
6
+ type FeatureKey = keyof typeof featureSupport | string;
7
+ /**
8
+ * Check if a feature should show in toolbar for a given template.
9
+ * Features not in the map are considered supported for all templates.
10
+ *
11
+ * @param template - The template type
12
+ * @param feature - The feature identifier
13
+ * @returns true if the feature should show in toolbar for the template
14
+ */
15
+ declare const showFeatureForTemplate: (template: TemplateValue, feature: FeatureKey) => boolean;
16
+ export default showFeatureForTemplate;
17
+ //# sourceMappingURL=templateFeatureSupport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateFeatureSupport.d.ts","sourceRoot":"","sources":["../../Core/templateFeatureSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,KAAK,aAAa,GAChB,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAIrF,QAAA,MAAM,cAAc,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAAA;CAUzD,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,OAAO,cAAc,GAAG,MAAM,CAAC;AAEvD;;;;;;;GAOG;AACH,QAAA,MAAM,sBAAsB,GAAI,UAAU,aAAa,EAAE,SAAS,UAAU,KAAG,OAK9E,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
2
+ // TODO: All such feature map support should be available at View object based via a feature in rs-core based on the template from meta.
3
+ // The consumer can pass along the resolved feature map to their component for decisioning.
4
+ const featureSupport = {
5
+ personalization: ['Table', 'Gallery', 'Timeline'],
6
+ group: ['Table', 'Timeline'],
7
+ showHideColumns: ['Table', 'Gallery'],
8
+ freezeColumns: ['Table'],
9
+ rowDensity: ['Table'],
10
+ showHeaderIcons: ['Table'],
11
+ autoSizeColumns: ['Table'],
12
+ resetColumnWidths: ['Table'],
13
+ wrap: ['Table']
14
+ };
15
+ /**
16
+ * Check if a feature should show in toolbar for a given template.
17
+ * Features not in the map are considered supported for all templates.
18
+ *
19
+ * @param template - The template type
20
+ * @param feature - The feature identifier
21
+ * @returns true if the feature should show in toolbar for the template
22
+ */
23
+ const showFeatureForTemplate = (template, feature) => {
24
+ if (!featureSupport[feature]) {
25
+ return true;
26
+ }
27
+ return featureSupport[feature].includes(template);
28
+ };
29
+ export default showFeatureForTemplate;
30
+ //# sourceMappingURL=templateFeatureSupport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateFeatureSupport.js","sourceRoot":"","sources":["../../Core/templateFeatureSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAK/E,wIAAwI;AACxI,2FAA2F;AAC3F,MAAM,cAAc,GAA2C;IAC7D,eAAe,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC;IACjD,KAAK,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;IAC5B,eAAe,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;IACrC,aAAa,EAAE,CAAC,OAAO,CAAC;IACxB,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,eAAe,EAAE,CAAC,OAAO,CAAC;IAC1B,eAAe,EAAE,CAAC,OAAO,CAAC;IAC1B,iBAAiB,EAAE,CAAC,OAAO,CAAC;IAC5B,IAAI,EAAE,CAAC,OAAO,CAAC;CAChB,CAAC;AAIF;;;;;;;GAOG;AACH,MAAM,sBAAsB,GAAG,CAAC,QAAuB,EAAE,OAAmB,EAAW,EAAE;IACvF,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\ntype TemplateValue =\n (typeof REPEATING_STRUCTURE_TEMPLATES)[keyof typeof REPEATING_STRUCTURE_TEMPLATES];\n\n// TODO: All such feature map support should be available at View object based via a feature in rs-core based on the template from meta.\n// The consumer can pass along the resolved feature map to their component for decisioning.\nconst featureSupport: { [feature: string]: TemplateValue[] } = {\n personalization: ['Table', 'Gallery', 'Timeline'],\n group: ['Table', 'Timeline'],\n showHideColumns: ['Table', 'Gallery'],\n freezeColumns: ['Table'],\n rowDensity: ['Table'],\n showHeaderIcons: ['Table'],\n autoSizeColumns: ['Table'],\n resetColumnWidths: ['Table'],\n wrap: ['Table']\n};\n\ntype FeatureKey = keyof typeof featureSupport | string;\n\n/**\n * Check if a feature should show in toolbar for a given template.\n * Features not in the map are considered supported for all templates.\n *\n * @param template - The template type\n * @param feature - The feature identifier\n * @returns true if the feature should show in toolbar for the template\n */\nconst showFeatureForTemplate = (template: TemplateValue, feature: FeatureKey): boolean => {\n if (!featureSupport[feature]) {\n return true;\n }\n return featureSupport[feature].includes(template);\n};\n\nexport default showFeatureForTemplate;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/lists-react",
3
- "version": "9.0.0-build.19.0",
3
+ "version": "9.0.0-build.19.10",
4
4
  "description": "Repeating view structures such as Table, Gallery(Repeating layouts), Kanban etc.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Pegasystems",
@@ -14,9 +14,9 @@
14
14
  "build": "tsc -b tsconfig.build.json"
15
15
  },
16
16
  "dependencies": {
17
- "@pega/cosmos-react-condition-builder": "9.0.0-build.19.0",
18
- "@pega/cosmos-react-core": "9.0.0-build.19.0",
19
- "@pega/cosmos-react-rte": "9.0.0-build.19.0",
17
+ "@pega/cosmos-react-condition-builder": "9.0.0-build.19.10",
18
+ "@pega/cosmos-react-core": "9.0.0-build.19.10",
19
+ "@pega/cosmos-react-rte": "9.0.0-build.19.10",
20
20
  "@types/lodash-es": "^4.17.12",
21
21
  "@types/react": "^17.0.62 || ^18.3.3",
22
22
  "@types/react-dom": "^17.0.20 || ^18.3.0",
@@ -24,8 +24,8 @@
24
24
  "dayjs": "^1.11.13",
25
25
  "fast-deep-equal": "^3.1.3",
26
26
  "lodash-es": "^4.17.23",
27
- "pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.19.0",
28
- "pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.19.0",
27
+ "pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.19.10",
28
+ "pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.19.10",
29
29
  "polished": "^4.1.0",
30
30
  "prop-types": "^15.8.1",
31
31
  "react": "^17.0.0 || ^18.0.0",
@@ -44,7 +44,7 @@
44
44
  "@testing-library/react": "^16.0.0",
45
45
  "@testing-library/user-event": "^14.6.1",
46
46
  "jest-axe": "^8.0.0",
47
- "srs-utils": "9.0.0-build.19.0",
47
+ "srs-utils": "9.0.0-build.19.10",
48
48
  "typescript": "~5.9.3"
49
49
  }
50
50
  }
@@ -1,7 +0,0 @@
1
- import type { OmitStrict, ListToolbarProps } from '@pega/cosmos-react-core';
2
- import type { RsCoreTypes } from 'pega-repeating-structures-core';
3
- declare const TimelineToolbar: ({ view, ...restProps }: {
4
- view: RsCoreTypes.View;
5
- } & OmitStrict<ListToolbarProps, "sort" | "group">) => import("react/jsx-runtime").JSX.Element;
6
- export default TimelineToolbar;
7
- //# sourceMappingURL=TimelineToolbar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TimelineToolbar.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/Timeline/TimelineToolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAMlE,QAAA,MAAM,eAAe,GAAI,wBAGtB;IACD,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;CACxB,GAAG,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,4CAiHjD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,109 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
- import { ListToolbar, useI18n } from '@pega/cosmos-react-core';
4
- import { TOOLBAR_FEATURES } from '../../../constants';
5
- import { mapDateFnToGroupOption } from '../../../Views/Timeline/utility';
6
- const TimelineToolbar = ({ view, ...restProps }) => {
7
- const t = useI18n();
8
- const displaySort = view.shouldDisplayFeature(TOOLBAR_FEATURES.SORT);
9
- const displayGrouping = view.shouldDisplayFeature(TOOLBAR_FEATURES.GROUPING);
10
- const sort = useMemo(() => {
11
- const selected = view.state.sortingOrder?.[0]?.order === 'asc' ? 'ascending' : 'descending';
12
- return {
13
- mode: 'single-select',
14
- items: [
15
- {
16
- id: 'descending',
17
- text: t('timeline_toolbar_sort_descending'),
18
- icon: 'arrow-down',
19
- selected: selected === 'descending'
20
- },
21
- {
22
- id: 'ascending',
23
- text: t('timeline_toolbar_sort_ascending'),
24
- icon: 'arrow-up',
25
- selected: selected === 'ascending'
26
- }
27
- ],
28
- onItemClick: id => {
29
- if (view.state?.sortingOrder?.[0]) {
30
- view.type.applySorting([
31
- {
32
- ...view.state.sortingOrder[0],
33
- order: id === 'ascending' ? 'asc' : 'desc'
34
- }
35
- ]);
36
- }
37
- }
38
- };
39
- }, [view.state.sortingOrder, view.type.applySorting]);
40
- const group = useMemo(() => {
41
- const selected = mapDateFnToGroupOption(view.state.groups?.[0]?.dateFunction);
42
- return {
43
- mode: 'single-select',
44
- items: [
45
- {
46
- id: 'date',
47
- text: t('timeline_toolbar_group_date'),
48
- selected: selected === 'date'
49
- },
50
- {
51
- id: 'monthyear',
52
- text: t('timeline_toolbar_group_monthyear'),
53
- selected: selected === 'monthyear'
54
- },
55
- {
56
- id: 'quarteryear',
57
- text: t('timeline_toolbar_group_quarteryear'),
58
- selected: selected === 'quarteryear'
59
- },
60
- {
61
- id: 'year',
62
- text: t('timeline_toolbar_group_year'),
63
- selected: selected === 'year'
64
- },
65
- {
66
- id: 'none',
67
- text: t('timeline_toolbar_group_none'),
68
- selected: selected === 'none'
69
- }
70
- ],
71
- onItemClick: id => {
72
- let dateFunction;
73
- switch (id) {
74
- case 'year':
75
- dateFunction = 'YEARS';
76
- break;
77
- case 'quarteryear':
78
- dateFunction = 'QUARTERS';
79
- break;
80
- case 'monthyear':
81
- dateFunction = 'MONTHS';
82
- break;
83
- case 'date':
84
- dateFunction = 'DAYS';
85
- break;
86
- default:
87
- }
88
- view.type.applyGrouping(dateFunction && view.meta.timelineFields?.date?.label
89
- ? [
90
- {
91
- columnId: view.meta.timelineFields.date.label,
92
- dateFunction,
93
- level: 0,
94
- order: view.state.sortingOrder?.[0]?.order ?? 'desc'
95
- }
96
- ]
97
- : []);
98
- }
99
- };
100
- }, [
101
- view.state.groups,
102
- view.type.applyGrouping,
103
- view.meta.timelineFields?.date,
104
- view.state.sortingOrder
105
- ]);
106
- return (_jsx(ListToolbar, { ...restProps, sort: displaySort ? sort : undefined, group: view.meta.grouping && displayGrouping ? group : undefined }));
107
- };
108
- export default TimelineToolbar;
109
- //# sourceMappingURL=TimelineToolbar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TimelineToolbar.js","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/Timeline/TimelineToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oB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ACR,KAAK,WAAW;wBACd,YAAY,GAAG,QAAQ,CAAC;wBACxB,MAAM;oBACR,KAAK,MAAM;wBACT,YAAY,GAAG,MAAM,CAAC;wBACtB,MAAM;oBACR,QAAQ;gBACV,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,aAAa,CACrB,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,KAAK;oBACnD,CAAC,CAAC;wBACE;4BACE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK;4BAC7C,YAAY;4BACZ,KAAK,EAAE,CAAC;4BACR,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,MAAM;yBACrD;qBACF;oBACH,CAAC,CAAC,EAAE,CACP,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC,EAAE;QACD,IAAI,CAAC,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,IAAI,CAAC,aAAa;QACvB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI;QAC9B,IAAI,CAAC,KAAK,CAAC,YAAY;KACxB,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,WAAW,OACN,SAAS,EACb,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACpC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,GAChE,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport type { OmitStrict, ListToolbarProps } from '@pega/cosmos-react-core';\nimport type { PresetMenuProps } from '@pega/cosmos-react-core/lib/components/ListToolbar/ListToolbar.types';\nimport type { Group } from 'pega-repeating-structures-core/types/State.types';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport { ListToolbar, useI18n } from '@pega/cosmos-react-core';\n\nimport { TOOLBAR_FEATURES } from '../../../constants';\nimport { mapDateFnToGroupOption } from '../../../Views/Timeline/utility';\n\nconst TimelineToolbar = ({\n view,\n ...restProps\n}: {\n view: RsCoreTypes.View;\n} & OmitStrict<ListToolbarProps, 'sort' | 'group'>) => {\n const t = useI18n();\n const displaySort = view.shouldDisplayFeature(TOOLBAR_FEATURES.SORT);\n const displayGrouping = view.shouldDisplayFeature(TOOLBAR_FEATURES.GROUPING);\n\n const sort: PresetMenuProps = useMemo(() => {\n const selected = view.state.sortingOrder?.[0]?.order === 'asc' ? 'ascending' : 'descending';\n return {\n mode: 'single-select',\n items: [\n {\n id: 'descending',\n text: t('timeline_toolbar_sort_descending'),\n icon: 'arrow-down',\n selected: selected === 'descending'\n },\n {\n id: 'ascending',\n text: t('timeline_toolbar_sort_ascending'),\n icon: 'arrow-up',\n selected: selected === 'ascending'\n }\n ],\n onItemClick: id => {\n if (view.state?.sortingOrder?.[0]) {\n view.type.applySorting([\n {\n ...view.state.sortingOrder[0],\n order: id === 'ascending' ? 'asc' : 'desc'\n }\n ]);\n }\n }\n };\n }, [view.state.sortingOrder, view.type.applySorting]);\n\n const group: PresetMenuProps = useMemo(() => {\n const selected = mapDateFnToGroupOption(view.state.groups?.[0]?.dateFunction);\n\n return {\n mode: 'single-select',\n items: [\n {\n id: 'date',\n text: t('timeline_toolbar_group_date'),\n selected: selected === 'date'\n },\n {\n id: 'monthyear',\n text: t('timeline_toolbar_group_monthyear'),\n selected: selected === 'monthyear'\n },\n {\n id: 'quarteryear',\n text: t('timeline_toolbar_group_quarteryear'),\n selected: selected === 'quarteryear'\n },\n {\n id: 'year',\n text: t('timeline_toolbar_group_year'),\n selected: selected === 'year'\n },\n {\n id: 'none',\n text: t('timeline_toolbar_group_none'),\n selected: selected === 'none'\n }\n ],\n onItemClick: id => {\n let dateFunction: Group['dateFunction'];\n switch (id) {\n case 'year':\n dateFunction = 'YEARS';\n break;\n case 'quarteryear':\n dateFunction = 'QUARTERS';\n break;\n case 'monthyear':\n dateFunction = 'MONTHS';\n break;\n case 'date':\n dateFunction = 'DAYS';\n break;\n default:\n }\n view.type.applyGrouping(\n dateFunction && view.meta.timelineFields?.date?.label\n ? [\n {\n columnId: view.meta.timelineFields.date.label,\n dateFunction,\n level: 0,\n order: view.state.sortingOrder?.[0]?.order ?? 'desc'\n }\n ]\n : []\n );\n }\n };\n }, [\n view.state.groups,\n view.type.applyGrouping,\n view.meta.timelineFields?.date,\n view.state.sortingOrder\n ]);\n\n return (\n <ListToolbar\n {...restProps}\n sort={displaySort ? sort : undefined}\n group={view.meta.grouping && displayGrouping ? group : undefined}\n />\n );\n};\n\nexport default TimelineToolbar;\n"]}
@@ -1,8 +0,0 @@
1
- import type { Group } from 'pega-repeating-structures-core/lib/types/State.types';
2
- import type { RsCoreTypes } from 'pega-repeating-structures-core';
3
- import type { ActivityObject, TimelineGroupBy } from './Timeline.types';
4
- declare const getActivity: (rows: RsCoreTypes.View["rows"], columns: RsCoreTypes.View["columns"], { timelineFields, timezone, defaultRowHeight }: RsCoreTypes.View["meta"]) => ActivityObject[] | undefined;
5
- export default getActivity;
6
- export declare const mapDateFnToGroupOption: (dateFunction: Group["dateFunction"]) => TimelineGroupBy;
7
- export declare function calculateBodyMaxHeight(maxHeight: string | number | undefined, domContainer: HTMLElement | undefined, pContainer: HTMLElement | null | undefined): string | undefined;
8
- //# sourceMappingURL=utility.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Timeline/utility.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAIlF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIlE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAmDxE,QAAA,MAAM,WAAW,GACf,MAAM,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAC9B,SAAS,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EACpC,gDAAgD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KACvE,cAAc,EAAE,GAAG,SAqDrB,CAAC;AAEF,eAAe,WAAW,CAAC;AAE3B,eAAO,MAAM,sBAAsB,GAAI,cAAc,KAAK,CAAC,cAAc,CAAC,KAAG,eAa5E,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EACtC,YAAY,EAAE,WAAW,GAAG,SAAS,EACrC,UAAU,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,sBAc3C"}