ods-component-lib 1.18.234 → 1.18.235
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.
- package/dist/components/devextreme/OdsTimelineTable/OdsTimelineTable.Functions.d.ts +0 -1
- package/dist/components/devextreme/OdsTimelineTable/OdsTimelineTable.Types.d.ts +23 -3
- package/dist/index.css +16 -1
- package/dist/index.js +134 -11
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +136 -13
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/customEnums.d.ts +5 -0
- package/dist/utils/customTypes.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare const checkboxCellComponent: (props: any) => React.JSX.Element;
|
|
3
3
|
export declare const statusCellComponent: (props: any) => React.JSX.Element;
|
|
4
|
-
export declare const minimalHeaderCellComponent: (data: any, __el: any) => React.JSX.Element;
|
|
5
4
|
export declare const mapCustomTask: (item: any) => any;
|
|
6
5
|
export declare const setSelectedKeys: (datasource: any[], key?: string, selectedKeys?: number[] | string[]) => any[];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IColumnProps, IGanttOptions, IItemProps } from "devextreme-react/gantt";
|
|
3
|
+
import { SortingProcessType, SortingType } from "../../../utils/customTypes";
|
|
4
|
+
export declare type SortingMode = "single" | "multiple" | "none";
|
|
5
|
+
export declare const enum EnumDateDirection {
|
|
6
|
+
prevMonth = "previousMonth",
|
|
7
|
+
nextMonth = "nextMonth"
|
|
8
|
+
}
|
|
3
9
|
export interface IMenuLinkItem {
|
|
4
10
|
text: string;
|
|
5
11
|
url: string;
|
|
@@ -24,6 +30,9 @@ export interface ICheckboxColumnChange {
|
|
|
24
30
|
dataField: string;
|
|
25
31
|
}
|
|
26
32
|
export interface IOdsTimelineTableProps extends React.PropsWithChildren<IGanttOptions> {
|
|
33
|
+
/**
|
|
34
|
+
* Set reference object to access Gantt component props
|
|
35
|
+
*/
|
|
27
36
|
/**
|
|
28
37
|
* Set columns for listview.
|
|
29
38
|
*/
|
|
@@ -52,6 +61,10 @@ export interface IOdsTimelineTableProps extends React.PropsWithChildren<IGanttOp
|
|
|
52
61
|
* Set true if it' s visible.
|
|
53
62
|
*/
|
|
54
63
|
showDateFilter?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* ClientSideSorting means Gantt's default sorting, but sorting have to be managed programmacitally if ServerSideSorting is chosen
|
|
66
|
+
*/
|
|
67
|
+
sortingProcess?: SortingProcessType;
|
|
55
68
|
/**
|
|
56
69
|
* This is a selection event that fired when selection is changed.
|
|
57
70
|
*/
|
|
@@ -60,11 +73,16 @@ export interface IOdsTimelineTableProps extends React.PropsWithChildren<IGanttOp
|
|
|
60
73
|
* This is a date range event that fired when date range is changed.
|
|
61
74
|
*/
|
|
62
75
|
onDateRangeChange?(e: IDateRangeChange): void;
|
|
76
|
+
/**
|
|
77
|
+
* Triggered after sorting changed
|
|
78
|
+
*/
|
|
79
|
+
onSortingChanged?(sortedColumns: ISortedColumn[], headerCellProps?: any): void;
|
|
63
80
|
}
|
|
64
81
|
export interface IOdsTimelineColumnProps extends IColumnProps {
|
|
65
82
|
isMinimized?: boolean;
|
|
66
83
|
isStatusColumn?: boolean;
|
|
67
84
|
isCheckboxColumn?: boolean;
|
|
85
|
+
sortingFieldName?: string;
|
|
68
86
|
}
|
|
69
87
|
export interface IOdsTimelineStatusColumnProps extends IOdsTimelineColumnProps {
|
|
70
88
|
onStatusColumnChange(e: IStatusColumnChange): void;
|
|
@@ -79,7 +97,9 @@ export interface IOdsTimelineDateFilter extends IItemProps {
|
|
|
79
97
|
nextText?: string;
|
|
80
98
|
onFilterRangeChange(e: IDateRangeChange): void;
|
|
81
99
|
}
|
|
82
|
-
export
|
|
83
|
-
|
|
84
|
-
|
|
100
|
+
export interface ISortedColumn {
|
|
101
|
+
sortingFieldName: string;
|
|
102
|
+
sortType: SortingType;
|
|
103
|
+
sortIndex: number;
|
|
104
|
+
sortingText: string;
|
|
85
105
|
}
|
package/dist/index.css
CHANGED
|
@@ -230,7 +230,22 @@ tr._2CvVM._3Xrp3._19iuB._3udtX {
|
|
|
230
230
|
._3sOBn {
|
|
231
231
|
vertical-align: middle !important;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
|
|
234
|
+
._ww084:has(._2Ljgj) {
|
|
235
|
+
width: 100%;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
._2Ljgj{
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
width: 100%;
|
|
241
|
+
display: flex;
|
|
242
|
+
align-items: center;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
._2dILO {
|
|
246
|
+
flex: 1;
|
|
247
|
+
align-content: center;
|
|
248
|
+
}
|
|
234
249
|
._3n8UJ {
|
|
235
250
|
background-color: lightgreen;
|
|
236
251
|
}
|
package/dist/index.js
CHANGED
|
@@ -38563,11 +38563,6 @@ var statusCellComponent = function statusCellComponent(props) {
|
|
|
38563
38563
|
}
|
|
38564
38564
|
});
|
|
38565
38565
|
};
|
|
38566
|
-
var minimalHeaderCellComponent = function minimalHeaderCellComponent(data, __el) {
|
|
38567
|
-
return React__default.createElement("div", {
|
|
38568
|
-
className: "minimalHeaderCell"
|
|
38569
|
-
}, data.data.column.caption);
|
|
38570
|
-
};
|
|
38571
38566
|
var mapCustomTask = function mapCustomTask(item) {
|
|
38572
38567
|
return _extends({
|
|
38573
38568
|
isSelected: false
|
|
@@ -38723,8 +38718,12 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38723
38718
|
multiSelectionEnabled = props.multiSelectionEnabled,
|
|
38724
38719
|
toolbarVisible = props.toolbarVisible,
|
|
38725
38720
|
showDateFilter = props.showDateFilter,
|
|
38721
|
+
sorting = props.sorting,
|
|
38722
|
+
sortingProcess = props.sortingProcess,
|
|
38726
38723
|
onCustomSelectionChanged = props.onCustomSelectionChanged,
|
|
38727
|
-
onDateRangeChange = props.onDateRangeChange
|
|
38724
|
+
onDateRangeChange = props.onDateRangeChange,
|
|
38725
|
+
onSortingChanged = props.onSortingChanged;
|
|
38726
|
+
var refGantt = React.useRef(null);
|
|
38728
38727
|
var _useState = React.useState(startDateRange != null ? startDateRange : Constants.timelineDefaultStartDate),
|
|
38729
38728
|
startDate = _useState[0],
|
|
38730
38729
|
setStartDate = _useState[1];
|
|
@@ -38734,6 +38733,13 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38734
38733
|
var _useState3 = React.useState([]),
|
|
38735
38734
|
timelineTasks = _useState3[0],
|
|
38736
38735
|
setTimelineTasks = _useState3[1];
|
|
38736
|
+
var _useState4 = React.useState([]),
|
|
38737
|
+
sortedColumns = _useState4[0],
|
|
38738
|
+
setSortedColumns = _useState4[1];
|
|
38739
|
+
var originalSortingMode = sorting.mode === undefined || sorting.mode === "" ? "none" : sorting.mode;
|
|
38740
|
+
var sortingMode = sortingProcess == "ServerSideSorting" ? "none" : originalSortingMode;
|
|
38741
|
+
var showSortIndexes = sortingProcess == "ServerSideSorting" ? false : sorting.showSortIndexes;
|
|
38742
|
+
var sortingActive = sortingProcess == "ServerSideSorting" && originalSortingMode != "none";
|
|
38737
38743
|
React.useEffect(function () {
|
|
38738
38744
|
setTimelineTasks(multiSelectionEnabled ? setSelectedKeys(customTasks.map(mapCustomTask), customTaskKey, customSelectedKeys) : customTasks);
|
|
38739
38745
|
}, [customTasks]);
|
|
@@ -38742,6 +38748,17 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38742
38748
|
return item.isSelected == true;
|
|
38743
38749
|
});
|
|
38744
38750
|
};
|
|
38751
|
+
var customClearSorting = function customClearSorting() {
|
|
38752
|
+
if (sortingProcess === "ServerSideSorting") {
|
|
38753
|
+
setSortedColumns([]);
|
|
38754
|
+
} else {
|
|
38755
|
+
refGantt.current.instance.clearSorting();
|
|
38756
|
+
}
|
|
38757
|
+
onSortingChanged && onSortingChanged([], undefined);
|
|
38758
|
+
};
|
|
38759
|
+
var getSortedColumns = function getSortedColumns() {
|
|
38760
|
+
return sortedColumns;
|
|
38761
|
+
};
|
|
38745
38762
|
var updateSelectionData = function updateSelectionData(keyValue, isSelected) {
|
|
38746
38763
|
setTimelineTasks(function (prev) {
|
|
38747
38764
|
return prev.map(function (item) {
|
|
@@ -38752,6 +38769,98 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38752
38769
|
});
|
|
38753
38770
|
});
|
|
38754
38771
|
};
|
|
38772
|
+
var minimalHeaderCellComponent = function minimalHeaderCellComponent(data) {
|
|
38773
|
+
return customHeaderCellComponent(data, true);
|
|
38774
|
+
};
|
|
38775
|
+
var customHeaderCellComponent = function customHeaderCellComponent(props, isMinimized) {
|
|
38776
|
+
var _ref;
|
|
38777
|
+
var _isMinimized = (_ref = isMinimized != null ? isMinimized : props.data.column.isMinimized) != null ? _ref : false;
|
|
38778
|
+
if (sortingActive && props.data.column.allowSorting) {
|
|
38779
|
+
return React__default.createElement("div", {
|
|
38780
|
+
className: "sortingHeaderCell",
|
|
38781
|
+
onClick: function onClick(e) {
|
|
38782
|
+
if (Boolean(props.data.column.allowSorting)) {
|
|
38783
|
+
if (e.shiftKey === true && e.ctrlKey === false) {
|
|
38784
|
+
onSorting(props.data, 2);
|
|
38785
|
+
} else if (e.shiftKey === false && e.ctrlKey === false) {
|
|
38786
|
+
onSorting(props.data, 1);
|
|
38787
|
+
} else if (e.shiftKey === false && e.ctrlKey === true) {
|
|
38788
|
+
onRemoveSorting(props.data);
|
|
38789
|
+
}
|
|
38790
|
+
}
|
|
38791
|
+
}
|
|
38792
|
+
}, React__default.createElement("span", {
|
|
38793
|
+
className: _isMinimized ? "headerCaption minimalHeaderCell" : "headerCaption"
|
|
38794
|
+
}, props.data.column.caption), getSortIcon(props.data.column));
|
|
38795
|
+
}
|
|
38796
|
+
return React__default.createElement("div", {
|
|
38797
|
+
className: _isMinimized ? "minimalHeaderCell" : ""
|
|
38798
|
+
}, props.data.column.caption);
|
|
38799
|
+
};
|
|
38800
|
+
var getSortIcon = function getSortIcon(column) {
|
|
38801
|
+
var sortingFieldName = getSortingFieldName(column);
|
|
38802
|
+
var sortedColumn = sortedColumns.find(function (item) {
|
|
38803
|
+
return item.sortingFieldName == sortingFieldName;
|
|
38804
|
+
});
|
|
38805
|
+
if (sortedColumn) {
|
|
38806
|
+
return sortedColumn.sortType === "ASC" ? React__default.createElement(outline.UpArrow2Icon, null) : React__default.createElement(outline.DownArrow2Icon, null);
|
|
38807
|
+
}
|
|
38808
|
+
return undefined;
|
|
38809
|
+
};
|
|
38810
|
+
var getSortingFieldName = function getSortingFieldName(column) {
|
|
38811
|
+
var _column$sortingFieldN;
|
|
38812
|
+
return (_column$sortingFieldN = column.sortingFieldName) != null ? _column$sortingFieldN : column.dataField;
|
|
38813
|
+
};
|
|
38814
|
+
var onSorting = function onSorting(headerCellProps, sortingMode) {
|
|
38815
|
+
var sortingFieldName = getSortingFieldName(headerCellProps.column);
|
|
38816
|
+
var sortedColumn = sortedColumns.find(function (item) {
|
|
38817
|
+
return item.sortingFieldName == sortingFieldName;
|
|
38818
|
+
});
|
|
38819
|
+
var prevSortIndex = sortedColumn === null || sortedColumn === void 0 ? void 0 : sortedColumn.sortIndex;
|
|
38820
|
+
var newSortedColumn = {
|
|
38821
|
+
sortingFieldName: sortingFieldName,
|
|
38822
|
+
sortType: "ASC",
|
|
38823
|
+
sortIndex: sortingMode == 2 ? sortedColumn === undefined ? sortedColumns.length : sortedColumns.length - 1 : 0,
|
|
38824
|
+
sortingText: sortingFieldName + " ASC"
|
|
38825
|
+
};
|
|
38826
|
+
if (sortedColumn) {
|
|
38827
|
+
newSortedColumn.sortType = sortedColumn.sortType == "ASC" ? "DESC" : "ASC";
|
|
38828
|
+
newSortedColumn.sortingText = sortingFieldName + " " + newSortedColumn.sortType;
|
|
38829
|
+
}
|
|
38830
|
+
var newSortedColumns = sortingMode == 2 ? [].concat(sortedColumns.filter(function (item) {
|
|
38831
|
+
return item.sortingFieldName != sortingFieldName;
|
|
38832
|
+
}), [newSortedColumn]) : [newSortedColumn];
|
|
38833
|
+
if (sortingMode == 2 && sortedColumn !== undefined) {
|
|
38834
|
+
newSortedColumns = newSortedColumns.map(function (item) {
|
|
38835
|
+
if (item.sortingFieldName != sortingFieldName && item.sortIndex > prevSortIndex) {
|
|
38836
|
+
item.sortIndex = item.sortIndex - 1;
|
|
38837
|
+
}
|
|
38838
|
+
return item;
|
|
38839
|
+
});
|
|
38840
|
+
}
|
|
38841
|
+
setSortedColumns(newSortedColumns);
|
|
38842
|
+
onSortingChanged && onSortingChanged(newSortedColumns, headerCellProps);
|
|
38843
|
+
};
|
|
38844
|
+
var onRemoveSorting = function onRemoveSorting(headerCellProps) {
|
|
38845
|
+
var sortingFieldName = getSortingFieldName(headerCellProps.column);
|
|
38846
|
+
var sortedColumn = sortedColumns.find(function (item) {
|
|
38847
|
+
return item.sortingFieldName == sortingFieldName;
|
|
38848
|
+
});
|
|
38849
|
+
if (sortedColumn === undefined) {
|
|
38850
|
+
return;
|
|
38851
|
+
}
|
|
38852
|
+
var prevSortIndex = sortedColumn.sortIndex;
|
|
38853
|
+
var newSortedColumns = sortedColumns.filter(function (item) {
|
|
38854
|
+
return item.sortingFieldName != sortingFieldName;
|
|
38855
|
+
}).map(function (item) {
|
|
38856
|
+
if (item.sortIndex > prevSortIndex) {
|
|
38857
|
+
item.sortIndex = item.sortIndex - 1;
|
|
38858
|
+
}
|
|
38859
|
+
return item;
|
|
38860
|
+
});
|
|
38861
|
+
setSortedColumns(newSortedColumns);
|
|
38862
|
+
onSortingChanged && onSortingChanged(newSortedColumns, headerCellProps);
|
|
38863
|
+
};
|
|
38755
38864
|
var onTimelineDateRangeChange = function onTimelineDateRangeChange(e) {
|
|
38756
38865
|
setStartDate(e.startDate);
|
|
38757
38866
|
setEndDate(e.endDate);
|
|
@@ -38767,7 +38876,9 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38767
38876
|
var timelineColumns = multiSelectionEnabled ? [OdsTimelineSelectionColumn(onTimelineCheckboxSelectionChange)].concat(customColumns) : customColumns;
|
|
38768
38877
|
React.useImperativeHandle(ref, function () {
|
|
38769
38878
|
return {
|
|
38770
|
-
getSelectedRowsData: getSelectedRowsData
|
|
38879
|
+
getSelectedRowsData: getSelectedRowsData,
|
|
38880
|
+
getSortedColumns: getSortedColumns,
|
|
38881
|
+
customClearSorting: customClearSorting
|
|
38771
38882
|
};
|
|
38772
38883
|
});
|
|
38773
38884
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(gantt.Gantt, Object.assign({
|
|
@@ -38778,7 +38889,13 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38778
38889
|
taskContentRender: function taskContentRender(params) {
|
|
38779
38890
|
return React__default.createElement(OdsTimelineTableTaskTemplate, Object.assign({}, params));
|
|
38780
38891
|
}
|
|
38781
|
-
}, props
|
|
38892
|
+
}, props, {
|
|
38893
|
+
ref: refGantt,
|
|
38894
|
+
sorting: {
|
|
38895
|
+
mode: sortingMode,
|
|
38896
|
+
showSortIndexes: false
|
|
38897
|
+
}
|
|
38898
|
+
}), toolbarVisible ? React__default.createElement(gantt.Toolbar, null, showDateFilter ? React__default.createElement(gantt.Item, {
|
|
38782
38899
|
key: "OdsTimelineTable_ToolbarItem_DateFilter",
|
|
38783
38900
|
component: function component(props) {
|
|
38784
38901
|
return OdsTimelineDateFilter(_extends({}, props, {
|
|
@@ -38810,16 +38927,22 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38810
38927
|
minWidth: 50,
|
|
38811
38928
|
cssClass: "cellCenteredVertically",
|
|
38812
38929
|
cellComponent: checkboxCellComponent,
|
|
38813
|
-
headerCellComponent: minimalHeaderCellComponent
|
|
38930
|
+
headerCellComponent: minimalHeaderCellComponent,
|
|
38931
|
+
allowSorting: false
|
|
38814
38932
|
}, columnProps));
|
|
38815
38933
|
} else {
|
|
38816
38934
|
return React__default.createElement(gantt.Column, Object.assign({
|
|
38817
|
-
headerCellComponent:
|
|
38935
|
+
headerCellComponent: function headerCellComponent(props) {
|
|
38936
|
+
return customHeaderCellComponent(props);
|
|
38937
|
+
}
|
|
38818
38938
|
}, columnProps));
|
|
38819
38939
|
}
|
|
38820
38940
|
}), React__default.createElement(gantt.Tasks, {
|
|
38821
38941
|
dataSource: timelineTasks
|
|
38822
|
-
}), children
|
|
38942
|
+
}), children, React__default.createElement(gantt.Sorting, {
|
|
38943
|
+
mode: sortingMode,
|
|
38944
|
+
showSortIndexes: showSortIndexes
|
|
38945
|
+
})));
|
|
38823
38946
|
});
|
|
38824
38947
|
|
|
38825
38948
|
/**
|