@gpa-gemstone/react-table 1.2.34 → 1.2.36
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.
|
@@ -72,13 +72,13 @@ function AdjColumnHeaderWrapper(props) {
|
|
|
72
72
|
props.setWidth(w, (_b = props.MinWidth) !== null && _b !== void 0 ? _b : 100);
|
|
73
73
|
});
|
|
74
74
|
var onClick = React.useCallback(function (e) {
|
|
75
|
-
|
|
75
|
+
var _a;
|
|
76
|
+
if ((_a = props.AllowSort) !== null && _a !== void 0 ? _a : true)
|
|
77
|
+
props.onSort(props.Key, e, props.Field);
|
|
76
78
|
e.stopPropagation();
|
|
77
|
-
console.log('onCLick th');
|
|
78
79
|
}, [props.onSort]);
|
|
79
80
|
var onClickBorder = React.useCallback(function (e) {
|
|
80
81
|
props.startAdjustment(e);
|
|
81
|
-
console.log('onCLick border div');
|
|
82
82
|
}, [props.startAdjustment]);
|
|
83
83
|
return React.createElement("th", { ref: thref, style: style, onClick: onClick, onDrag: function (e) { e.stopPropagation(); } },
|
|
84
84
|
React.createElement("div", { style: {
|
|
@@ -87,7 +87,7 @@ interface TableProps<T> {
|
|
|
87
87
|
* @param data the item to be turned into a key
|
|
88
88
|
* @returns a unique Key
|
|
89
89
|
*/
|
|
90
|
-
KeySelector: (data: T) => string | number;
|
|
90
|
+
KeySelector: (data: T, index?: number) => string | number;
|
|
91
91
|
/**
|
|
92
92
|
* Optional Element to display in the last row of the Table
|
|
93
93
|
* use this for displaying warnings when the Table content gets cut off
|
|
@@ -177,20 +177,20 @@ function Rows(props) {
|
|
|
177
177
|
style.cursor = 'pointer';
|
|
178
178
|
if (props.Selected !== undefined && props.Selected(d))
|
|
179
179
|
style.backgroundColor = 'yellow';
|
|
180
|
-
var key = props.KeySelector(d);
|
|
180
|
+
var key = props.KeySelector(d, i);
|
|
181
181
|
return React.createElement("tr", { key: key, style: __assign({ display: (props.FixedLayout ? 'block' : undefined) }, style) },
|
|
182
182
|
React.Children.map(props.children, function (element) {
|
|
183
183
|
if (!React.isValidElement(element))
|
|
184
184
|
return null;
|
|
185
185
|
if (element.type === AdjustableColumn_1.default)
|
|
186
|
-
return React.createElement(Column_1.ColumnDataWrapper, __assign({}, element.props, { width: getWidth(element.props.Key, 'adjustable'), item: d, index: i, key: element.key, fixedLayout: props.FixedLayout, onClick: props.OnClick, sel: true }));
|
|
186
|
+
return React.createElement(Column_1.ColumnDataWrapper, __assign({}, element.props, { width: getWidth(element.props.Key, 'adjustable'), item: d, index: i, key: element.key, fixedLayout: props.FixedLayout, onClick: props.OnClick, dragStart: props.DragStart, sel: true }));
|
|
187
187
|
return null;
|
|
188
188
|
}),
|
|
189
189
|
React.Children.map(props.children, function (element) {
|
|
190
190
|
if (!React.isValidElement(element))
|
|
191
191
|
return null;
|
|
192
192
|
if (element.type === Column_1.default)
|
|
193
|
-
return React.createElement(Column_1.ColumnDataWrapper, __assign({}, element.props, { width: getWidth(element.props.Key, 'fixed'), item: d, index: i, key: element.key, fixedLayout: props.FixedLayout, onClick: props.OnClick }));
|
|
193
|
+
return React.createElement(Column_1.ColumnDataWrapper, __assign({}, element.props, { width: getWidth(element.props.Key, 'fixed'), item: d, index: i, key: element.key, fixedLayout: props.FixedLayout, onClick: props.OnClick, dragStart: props.DragStart }));
|
|
194
194
|
return null;
|
|
195
195
|
}));
|
|
196
196
|
})));
|
|
@@ -30,6 +30,7 @@ export interface IColumnProps<T> {
|
|
|
30
30
|
key: string;
|
|
31
31
|
field: keyof T | undefined;
|
|
32
32
|
index: number;
|
|
33
|
+
style?: React.CSSProperties;
|
|
33
34
|
}) => React.ReactNode;
|
|
34
35
|
}
|
|
35
36
|
export default function Column<T>(props: React.PropsWithChildren<IColumnProps<T>>): JSX.Element;
|
|
@@ -71,8 +71,10 @@ function ColumnHeaderWrapper(props) {
|
|
|
71
71
|
props.setWidth(w);
|
|
72
72
|
});
|
|
73
73
|
var onClick = React.useCallback(function (e) {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
var _a;
|
|
75
|
+
if ((_a = props.AllowSort) !== null && _a !== void 0 ? _a : true)
|
|
76
|
+
props.onSort(props.Key, e, props.Field);
|
|
77
|
+
}, [props.onSort, props.AllowSort]);
|
|
76
78
|
return React.createElement("th", { ref: thref, style: style, onClick: onClick, onDrag: function (e) { e.stopPropagation(); } },
|
|
77
79
|
props.sorted && props.asc ? React.createElement("div", { style: { position: 'absolute', width: 25 } }, gpa_symbols_1.SVGIcons.ArrowDropDown) : null,
|
|
78
80
|
props.sorted && !props.asc ? React.createElement("div", { style: { position: 'absolute', width: 25 } }, gpa_symbols_1.SVGIcons.ArrowDropUp) : null,
|
|
@@ -97,6 +99,7 @@ function ColumnDataWrapper(props) {
|
|
|
97
99
|
item: props.item,
|
|
98
100
|
key: props.Key,
|
|
99
101
|
field: props.Field,
|
|
102
|
+
style: css,
|
|
100
103
|
index: props.index
|
|
101
104
|
}) : getFieldValue(); };
|
|
102
105
|
var onClick = React.useCallback(function (e) {
|