ods-component-lib 1.18.233 → 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 +136 -12
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +138 -14
- 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
|
@@ -38416,7 +38416,8 @@ var OdsMergeCellDataGrid = function OdsMergeCellDataGrid(props) {
|
|
|
38416
38416
|
onCellPrepared: onCustomCellPrepared,
|
|
38417
38417
|
onOptionChanged: props.onOptionChanged,
|
|
38418
38418
|
onToolbarPreparing: !props.closeGridHeader && (props.onToolbarPreparing || onToolbarPreparing),
|
|
38419
|
-
onSelectionChanged: handleSelectionChanged
|
|
38419
|
+
onSelectionChanged: handleSelectionChanged,
|
|
38420
|
+
onContentReady: props.onContentReady
|
|
38420
38421
|
}), gridColumns.map(function (col) {
|
|
38421
38422
|
return React__default.createElement(DataGrid.Column, Object.assign({
|
|
38422
38423
|
key: col.dataField
|
|
@@ -38562,11 +38563,6 @@ var statusCellComponent = function statusCellComponent(props) {
|
|
|
38562
38563
|
}
|
|
38563
38564
|
});
|
|
38564
38565
|
};
|
|
38565
|
-
var minimalHeaderCellComponent = function minimalHeaderCellComponent(data, __el) {
|
|
38566
|
-
return React__default.createElement("div", {
|
|
38567
|
-
className: "minimalHeaderCell"
|
|
38568
|
-
}, data.data.column.caption);
|
|
38569
|
-
};
|
|
38570
38566
|
var mapCustomTask = function mapCustomTask(item) {
|
|
38571
38567
|
return _extends({
|
|
38572
38568
|
isSelected: false
|
|
@@ -38722,8 +38718,12 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38722
38718
|
multiSelectionEnabled = props.multiSelectionEnabled,
|
|
38723
38719
|
toolbarVisible = props.toolbarVisible,
|
|
38724
38720
|
showDateFilter = props.showDateFilter,
|
|
38721
|
+
sorting = props.sorting,
|
|
38722
|
+
sortingProcess = props.sortingProcess,
|
|
38725
38723
|
onCustomSelectionChanged = props.onCustomSelectionChanged,
|
|
38726
|
-
onDateRangeChange = props.onDateRangeChange
|
|
38724
|
+
onDateRangeChange = props.onDateRangeChange,
|
|
38725
|
+
onSortingChanged = props.onSortingChanged;
|
|
38726
|
+
var refGantt = React.useRef(null);
|
|
38727
38727
|
var _useState = React.useState(startDateRange != null ? startDateRange : Constants.timelineDefaultStartDate),
|
|
38728
38728
|
startDate = _useState[0],
|
|
38729
38729
|
setStartDate = _useState[1];
|
|
@@ -38733,6 +38733,13 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38733
38733
|
var _useState3 = React.useState([]),
|
|
38734
38734
|
timelineTasks = _useState3[0],
|
|
38735
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";
|
|
38736
38743
|
React.useEffect(function () {
|
|
38737
38744
|
setTimelineTasks(multiSelectionEnabled ? setSelectedKeys(customTasks.map(mapCustomTask), customTaskKey, customSelectedKeys) : customTasks);
|
|
38738
38745
|
}, [customTasks]);
|
|
@@ -38741,6 +38748,17 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38741
38748
|
return item.isSelected == true;
|
|
38742
38749
|
});
|
|
38743
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
|
+
};
|
|
38744
38762
|
var updateSelectionData = function updateSelectionData(keyValue, isSelected) {
|
|
38745
38763
|
setTimelineTasks(function (prev) {
|
|
38746
38764
|
return prev.map(function (item) {
|
|
@@ -38751,6 +38769,98 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38751
38769
|
});
|
|
38752
38770
|
});
|
|
38753
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
|
+
};
|
|
38754
38864
|
var onTimelineDateRangeChange = function onTimelineDateRangeChange(e) {
|
|
38755
38865
|
setStartDate(e.startDate);
|
|
38756
38866
|
setEndDate(e.endDate);
|
|
@@ -38766,7 +38876,9 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38766
38876
|
var timelineColumns = multiSelectionEnabled ? [OdsTimelineSelectionColumn(onTimelineCheckboxSelectionChange)].concat(customColumns) : customColumns;
|
|
38767
38877
|
React.useImperativeHandle(ref, function () {
|
|
38768
38878
|
return {
|
|
38769
|
-
getSelectedRowsData: getSelectedRowsData
|
|
38879
|
+
getSelectedRowsData: getSelectedRowsData,
|
|
38880
|
+
getSortedColumns: getSortedColumns,
|
|
38881
|
+
customClearSorting: customClearSorting
|
|
38770
38882
|
};
|
|
38771
38883
|
});
|
|
38772
38884
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(gantt.Gantt, Object.assign({
|
|
@@ -38777,7 +38889,13 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38777
38889
|
taskContentRender: function taskContentRender(params) {
|
|
38778
38890
|
return React__default.createElement(OdsTimelineTableTaskTemplate, Object.assign({}, params));
|
|
38779
38891
|
}
|
|
38780
|
-
}, 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, {
|
|
38781
38899
|
key: "OdsTimelineTable_ToolbarItem_DateFilter",
|
|
38782
38900
|
component: function component(props) {
|
|
38783
38901
|
return OdsTimelineDateFilter(_extends({}, props, {
|
|
@@ -38809,16 +38927,22 @@ var OdsTimelineTable = React.forwardRef(function (props, ref) {
|
|
|
38809
38927
|
minWidth: 50,
|
|
38810
38928
|
cssClass: "cellCenteredVertically",
|
|
38811
38929
|
cellComponent: checkboxCellComponent,
|
|
38812
|
-
headerCellComponent: minimalHeaderCellComponent
|
|
38930
|
+
headerCellComponent: minimalHeaderCellComponent,
|
|
38931
|
+
allowSorting: false
|
|
38813
38932
|
}, columnProps));
|
|
38814
38933
|
} else {
|
|
38815
38934
|
return React__default.createElement(gantt.Column, Object.assign({
|
|
38816
|
-
headerCellComponent:
|
|
38935
|
+
headerCellComponent: function headerCellComponent(props) {
|
|
38936
|
+
return customHeaderCellComponent(props);
|
|
38937
|
+
}
|
|
38817
38938
|
}, columnProps));
|
|
38818
38939
|
}
|
|
38819
38940
|
}), React__default.createElement(gantt.Tasks, {
|
|
38820
38941
|
dataSource: timelineTasks
|
|
38821
|
-
}), children
|
|
38942
|
+
}), children, React__default.createElement(gantt.Sorting, {
|
|
38943
|
+
mode: sortingMode,
|
|
38944
|
+
showSortIndexes: showSortIndexes
|
|
38945
|
+
})));
|
|
38822
38946
|
});
|
|
38823
38947
|
|
|
38824
38948
|
/**
|