@itwin/itwinui-react 1.26.1 → 1.27.0
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/CHANGELOG.md +15 -0
- package/cjs/core/Buttons/Button/Button.js +4 -5
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -3
- package/cjs/core/Checkbox/Checkbox.d.ts +11 -0
- package/cjs/core/Checkbox/Checkbox.js +14 -4
- package/cjs/core/ComboBox/ComboBox.d.ts +2 -2
- package/cjs/core/ErrorPage/ErrorPage.d.ts +2 -1
- package/cjs/core/ErrorPage/ErrorPage.js +3 -2
- package/cjs/core/Modal/ModalButtonBar.d.ts +2 -1
- package/cjs/core/Modal/ModalButtonBar.js +3 -2
- package/cjs/core/Table/Table.d.ts +8 -0
- package/cjs/core/Table/Table.js +71 -10
- package/cjs/core/Table/TableCell.js +1 -1
- package/cjs/core/Table/TablePaginator.d.ts +6 -6
- package/cjs/core/Table/TablePaginator.js +12 -7
- package/cjs/core/Table/TableRowMemoized.d.ts +21 -0
- package/cjs/core/Table/TableRowMemoized.js +6 -3
- package/cjs/core/Table/actionHandlers/resizeHandler.d.ts +51 -0
- package/cjs/core/Table/actionHandlers/resizeHandler.js +22 -0
- package/cjs/core/Table/actionHandlers/selectHandler.d.ts +10 -7
- package/cjs/core/Table/hooks/index.d.ts +1 -0
- package/cjs/core/Table/hooks/index.js +3 -1
- package/cjs/core/Table/hooks/useResizeColumns.d.ts +5 -0
- package/cjs/core/Table/hooks/useResizeColumns.js +271 -0
- package/cjs/core/Table/utils.d.ts +1 -1
- package/cjs/core/Table/utils.js +8 -2
- package/cjs/core/Tabs/Tabs.d.ts +4 -0
- package/cjs/core/Tabs/Tabs.js +2 -2
- package/cjs/types/react-table-config.d.ts +16 -3
- package/esm/core/Buttons/Button/Button.js +4 -5
- package/esm/core/Buttons/IconButton/IconButton.js +2 -3
- package/esm/core/Checkbox/Checkbox.d.ts +11 -0
- package/esm/core/Checkbox/Checkbox.js +14 -4
- package/esm/core/ComboBox/ComboBox.d.ts +2 -2
- package/esm/core/ErrorPage/ErrorPage.d.ts +2 -1
- package/esm/core/ErrorPage/ErrorPage.js +3 -2
- package/esm/core/Modal/ModalButtonBar.d.ts +2 -1
- package/esm/core/Modal/ModalButtonBar.js +3 -2
- package/esm/core/Table/Table.d.ts +8 -0
- package/esm/core/Table/Table.js +73 -12
- package/esm/core/Table/TableCell.js +1 -1
- package/esm/core/Table/TablePaginator.d.ts +6 -6
- package/esm/core/Table/TablePaginator.js +13 -8
- package/esm/core/Table/TableRowMemoized.d.ts +21 -0
- package/esm/core/Table/TableRowMemoized.js +4 -2
- package/esm/core/Table/actionHandlers/resizeHandler.d.ts +51 -0
- package/esm/core/Table/actionHandlers/resizeHandler.js +17 -0
- package/esm/core/Table/actionHandlers/selectHandler.d.ts +10 -7
- package/esm/core/Table/hooks/index.d.ts +1 -0
- package/esm/core/Table/hooks/index.js +1 -0
- package/esm/core/Table/hooks/useResizeColumns.d.ts +5 -0
- package/esm/core/Table/hooks/useResizeColumns.js +267 -0
- package/esm/core/Table/utils.d.ts +1 -1
- package/esm/core/Table/utils.js +8 -2
- package/esm/core/Tabs/Tabs.d.ts +4 -0
- package/esm/core/Tabs/Tabs.js +2 -2
- package/esm/types/react-table-config.d.ts +16 -3
- package/package.json +13 -5
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { actions, makePropGetter, useGetLatest, } from 'react-table';
|
|
22
|
+
export var useResizeColumns = function (ownerDocument) { return function (hooks) {
|
|
23
|
+
hooks.getResizerProps = [defaultGetResizerProps(ownerDocument)];
|
|
24
|
+
hooks.stateReducers.push(reducer);
|
|
25
|
+
hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions);
|
|
26
|
+
}; };
|
|
27
|
+
var isTouchEvent = function (event) {
|
|
28
|
+
return event.type === 'touchstart';
|
|
29
|
+
};
|
|
30
|
+
var defaultGetResizerProps = function (ownerDocument) { return function (props, _a) {
|
|
31
|
+
var instance = _a.instance, header = _a.header, nextHeader = _a.nextHeader;
|
|
32
|
+
if (!ownerDocument) {
|
|
33
|
+
return props;
|
|
34
|
+
}
|
|
35
|
+
var dispatch = instance.dispatch, flatHeaders = instance.flatHeaders;
|
|
36
|
+
var onResizeStart = function (e, header) {
|
|
37
|
+
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
38
|
+
if (isTouchEvent(e) && e.touches && e.touches.length > 1) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// Setting `width` here because it might take several rerenders until actual column width is set.
|
|
42
|
+
flatHeaders.forEach(function (h) {
|
|
43
|
+
if (!h.width) {
|
|
44
|
+
h.width = h.resizeWidth;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
var headerIdWidths = getLeafHeaders(header).map(function (d) { return [d.id, d.width]; });
|
|
48
|
+
var nextHeaderIdWidths = nextHeader
|
|
49
|
+
? getLeafHeaders(nextHeader).map(function (d) { return [d.id, d.width]; })
|
|
50
|
+
: [];
|
|
51
|
+
var clientX = isTouchEvent(e)
|
|
52
|
+
? Math.round(e.touches[0].clientX)
|
|
53
|
+
: e.clientX;
|
|
54
|
+
var dispatchMove = function (clientXPos) {
|
|
55
|
+
return dispatch({ type: actions.columnResizing, clientX: clientXPos });
|
|
56
|
+
};
|
|
57
|
+
var dispatchEnd = function () {
|
|
58
|
+
return dispatch({
|
|
59
|
+
type: actions.columnDoneResizing,
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var handlersAndEvents = {
|
|
63
|
+
mouse: {
|
|
64
|
+
moveEvent: 'mousemove',
|
|
65
|
+
moveHandler: function (e) { return dispatchMove(e.clientX); },
|
|
66
|
+
upEvent: 'mouseup',
|
|
67
|
+
upHandler: function () {
|
|
68
|
+
ownerDocument.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
|
|
69
|
+
ownerDocument.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
|
|
70
|
+
dispatchEnd();
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
touch: {
|
|
74
|
+
moveEvent: 'touchmove',
|
|
75
|
+
moveHandler: function (e) {
|
|
76
|
+
if (e.cancelable) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
}
|
|
80
|
+
dispatchMove(e.touches[0].clientX);
|
|
81
|
+
},
|
|
82
|
+
upEvent: 'touchend',
|
|
83
|
+
upHandler: function () {
|
|
84
|
+
ownerDocument.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
|
|
85
|
+
ownerDocument.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
|
|
86
|
+
dispatchEnd();
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
var events = isTouchEvent(e)
|
|
91
|
+
? handlersAndEvents.touch
|
|
92
|
+
: handlersAndEvents.mouse;
|
|
93
|
+
var passiveIfSupported = passiveEventSupported()
|
|
94
|
+
? { passive: false }
|
|
95
|
+
: false;
|
|
96
|
+
ownerDocument.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
|
|
97
|
+
ownerDocument.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
|
|
98
|
+
dispatch({
|
|
99
|
+
type: actions.columnStartResizing,
|
|
100
|
+
columnId: header.id,
|
|
101
|
+
columnWidth: header.width,
|
|
102
|
+
nextColumnWidth: nextHeader === null || nextHeader === void 0 ? void 0 : nextHeader.width,
|
|
103
|
+
headerIdWidths: headerIdWidths,
|
|
104
|
+
nextHeaderIdWidths: nextHeaderIdWidths,
|
|
105
|
+
clientX: clientX,
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return [
|
|
109
|
+
props,
|
|
110
|
+
{
|
|
111
|
+
onMouseDown: function (e) {
|
|
112
|
+
e.persist();
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
onResizeStart(e, header);
|
|
115
|
+
},
|
|
116
|
+
onTouchStart: function (e) {
|
|
117
|
+
e.persist();
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
onResizeStart(e, header);
|
|
120
|
+
},
|
|
121
|
+
style: {
|
|
122
|
+
cursor: 'col-resize',
|
|
123
|
+
},
|
|
124
|
+
draggable: false,
|
|
125
|
+
role: 'separator',
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
}; };
|
|
129
|
+
useResizeColumns.pluginName = 'useResizeColumns';
|
|
130
|
+
var reducer = function (newState, action, previousState, instance) {
|
|
131
|
+
if (action.type === actions.init) {
|
|
132
|
+
return __assign(__assign({}, newState), { columnResizing: {
|
|
133
|
+
columnWidths: {},
|
|
134
|
+
} });
|
|
135
|
+
}
|
|
136
|
+
if (action.type === actions.resetResize) {
|
|
137
|
+
return __assign(__assign({}, newState), { columnResizing: {
|
|
138
|
+
columnWidths: {},
|
|
139
|
+
} });
|
|
140
|
+
}
|
|
141
|
+
if (action.type === actions.columnStartResizing) {
|
|
142
|
+
var clientX = action.clientX, columnId = action.columnId, columnWidth = action.columnWidth, nextColumnWidth = action.nextColumnWidth, headerIdWidths = action.headerIdWidths, nextHeaderIdWidths = action.nextHeaderIdWidths;
|
|
143
|
+
return __assign(__assign({}, newState), { columnResizing: __assign(__assign({}, newState.columnResizing), { startX: clientX, columnWidth: columnWidth, nextColumnWidth: nextColumnWidth, headerIdWidths: headerIdWidths, nextHeaderIdWidths: nextHeaderIdWidths, isResizingColumn: columnId }) });
|
|
144
|
+
}
|
|
145
|
+
if (action.type === actions.columnResizing) {
|
|
146
|
+
var clientX = action.clientX;
|
|
147
|
+
var _a = newState.columnResizing, _b = _a.startX, startX = _b === void 0 ? 0 : _b, _c = _a.columnWidth, columnWidth = _c === void 0 ? 1 : _c, _d = _a.nextColumnWidth, nextColumnWidth = _d === void 0 ? 1 : _d, _e = _a.headerIdWidths, headerIdWidths = _e === void 0 ? [] : _e, _f = _a.nextHeaderIdWidths, nextHeaderIdWidths = _f === void 0 ? [] : _f;
|
|
148
|
+
var deltaX = clientX - startX;
|
|
149
|
+
var newColumnWidths = getColumnWidths(headerIdWidths, deltaX / columnWidth);
|
|
150
|
+
var newNextColumnWidths = getColumnWidths(nextHeaderIdWidths, -deltaX / nextColumnWidth);
|
|
151
|
+
if (!isNewColumnWidthsValid(newColumnWidths, instance === null || instance === void 0 ? void 0 : instance.flatHeaders) ||
|
|
152
|
+
!isNewColumnWidthsValid(newNextColumnWidths, instance === null || instance === void 0 ? void 0 : instance.flatHeaders)) {
|
|
153
|
+
return newState;
|
|
154
|
+
}
|
|
155
|
+
return __assign(__assign({}, newState), { columnResizing: __assign(__assign({}, newState.columnResizing), { columnWidths: __assign(__assign(__assign({}, newState.columnResizing.columnWidths), newColumnWidths), newNextColumnWidths) }) });
|
|
156
|
+
}
|
|
157
|
+
if (action.type === actions.columnDoneResizing) {
|
|
158
|
+
return __assign(__assign({}, newState), { columnResizing: __assign(__assign({}, newState.columnResizing), { startX: undefined, isResizingColumn: undefined }) });
|
|
159
|
+
}
|
|
160
|
+
return newState;
|
|
161
|
+
};
|
|
162
|
+
var getColumnWidths = function (headerIdWidths, deltaPercentage) {
|
|
163
|
+
var columnWidths = {};
|
|
164
|
+
headerIdWidths.forEach(function (_a) {
|
|
165
|
+
var headerId = _a[0], headerWidth = _a[1];
|
|
166
|
+
columnWidths[headerId] = Math.max(headerWidth + headerWidth * deltaPercentage, 0);
|
|
167
|
+
});
|
|
168
|
+
return columnWidths;
|
|
169
|
+
};
|
|
170
|
+
var isNewColumnWidthsValid = function (columnWidths, headers) {
|
|
171
|
+
// Prevents from going outside the column bounds
|
|
172
|
+
if (Object.values(columnWidths).some(function (width) { return width <= 1; })) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
var _loop_1 = function (headerId, width) {
|
|
176
|
+
var header = headers === null || headers === void 0 ? void 0 : headers.find(function (h) { return h.id === headerId; });
|
|
177
|
+
if (!header) {
|
|
178
|
+
return "continue";
|
|
179
|
+
}
|
|
180
|
+
var minWidth = header.minWidth || 0;
|
|
181
|
+
var maxWidth = header.maxWidth || Infinity;
|
|
182
|
+
if (width < minWidth || width > maxWidth) {
|
|
183
|
+
return { value: false };
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
for (var _i = 0, _a = Object.entries(columnWidths); _i < _a.length; _i++) {
|
|
187
|
+
var _b = _a[_i], headerId = _b[0], width = _b[1];
|
|
188
|
+
var state_1 = _loop_1(headerId, width);
|
|
189
|
+
if (typeof state_1 === "object")
|
|
190
|
+
return state_1.value;
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
};
|
|
194
|
+
var useInstanceBeforeDimensions = function (instance) {
|
|
195
|
+
var flatHeaders = instance.flatHeaders, getHooks = instance.getHooks, columnResizing = instance.state.columnResizing;
|
|
196
|
+
var getInstance = useGetLatest(instance);
|
|
197
|
+
flatHeaders.forEach(function (header, index) {
|
|
198
|
+
var _a;
|
|
199
|
+
var resizeWidth = columnResizing.columnWidths[header.id];
|
|
200
|
+
header.width = resizeWidth || header.width || header.originalWidth;
|
|
201
|
+
header.isResizing = columnResizing.isResizingColumn === header.id;
|
|
202
|
+
var headerToResize = header.disableResizing
|
|
203
|
+
? getPreviousResizableHeader(header, instance)
|
|
204
|
+
: header;
|
|
205
|
+
var nextResizableHeader = getNextResizableHeader(header, instance);
|
|
206
|
+
header.canResize =
|
|
207
|
+
header.disableResizing != null ? !header.disableResizing : true;
|
|
208
|
+
// Show resizer when header is resizable or when next header is resizable
|
|
209
|
+
// and there is resizable columns on the left side of the resizer.
|
|
210
|
+
header.isResizerVisible =
|
|
211
|
+
(header.canResize && !!nextResizableHeader) ||
|
|
212
|
+
(headerToResize && !!((_a = instance.flatHeaders[index + 1]) === null || _a === void 0 ? void 0 : _a.canResize));
|
|
213
|
+
header.getResizerProps = makePropGetter(getHooks().getResizerProps, {
|
|
214
|
+
instance: getInstance(),
|
|
215
|
+
header: headerToResize,
|
|
216
|
+
nextHeader: nextResizableHeader,
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
var getPreviousResizableHeader = function (headerColumn, instance) {
|
|
221
|
+
var _a;
|
|
222
|
+
var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders;
|
|
223
|
+
var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
|
|
224
|
+
return __spreadArray([], headersList, true).slice(0, headerIndex)
|
|
225
|
+
.reverse()
|
|
226
|
+
.find(function (h) { return !h.disableResizing; });
|
|
227
|
+
};
|
|
228
|
+
var getNextResizableHeader = function (headerColumn, instance) {
|
|
229
|
+
var _a;
|
|
230
|
+
var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders;
|
|
231
|
+
var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
|
|
232
|
+
return __spreadArray([], headersList, true).slice(headerIndex + 1)
|
|
233
|
+
.find(function (h) { return !h.disableResizing; });
|
|
234
|
+
};
|
|
235
|
+
function getLeafHeaders(header) {
|
|
236
|
+
var leafHeaders = [];
|
|
237
|
+
var recurseHeader = function (header) {
|
|
238
|
+
if (header.columns && header.columns.length) {
|
|
239
|
+
header.columns.map(recurseHeader);
|
|
240
|
+
}
|
|
241
|
+
leafHeaders.push(header);
|
|
242
|
+
};
|
|
243
|
+
recurseHeader(header);
|
|
244
|
+
return leafHeaders;
|
|
245
|
+
}
|
|
246
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#safely_detecting_option_support
|
|
247
|
+
var passiveSupported = null;
|
|
248
|
+
var passiveEventSupported = function () {
|
|
249
|
+
// memoize support to avoid adding multiple test events
|
|
250
|
+
if (passiveSupported != null) {
|
|
251
|
+
return passiveSupported;
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
var options = {
|
|
255
|
+
once: true,
|
|
256
|
+
get passive() {
|
|
257
|
+
passiveSupported = true;
|
|
258
|
+
return false;
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
window.addEventListener('test', function () { }, options);
|
|
262
|
+
}
|
|
263
|
+
catch (_a) {
|
|
264
|
+
passiveSupported = false;
|
|
265
|
+
}
|
|
266
|
+
return passiveSupported;
|
|
267
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ColumnInstance } from 'react-table';
|
|
2
|
-
export declare const getCellStyle: <T extends Record<string, unknown>>(column: ColumnInstance<T
|
|
2
|
+
export declare const getCellStyle: <T extends Record<string, unknown>>(column: ColumnInstance<T>, isTableResizing: boolean) => React.CSSProperties | undefined;
|
package/esm/core/Table/utils.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
export var getCellStyle = function (column) {
|
|
1
|
+
export var getCellStyle = function (column, isTableResizing) {
|
|
2
2
|
var style = {};
|
|
3
3
|
style.flex = "1 1 145px";
|
|
4
4
|
if (column.width) {
|
|
5
5
|
var width = typeof column.width === 'string' ? column.width : column.width + "px";
|
|
6
6
|
style.width = width;
|
|
7
|
-
|
|
7
|
+
// This allows flexbox to handle the width of the column on table resize
|
|
8
|
+
if (isTableResizing && column.canResize) {
|
|
9
|
+
style.flex = Number(column.width) + " 1 " + width;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
style.flex = "0 0 " + width;
|
|
13
|
+
}
|
|
8
14
|
}
|
|
9
15
|
if (column.maxWidth) {
|
|
10
16
|
style.maxWidth = column.maxWidth + "px";
|
package/esm/core/Tabs/Tabs.d.ts
CHANGED
package/esm/core/Tabs/Tabs.js
CHANGED
|
@@ -55,7 +55,7 @@ import { Tab } from './Tab';
|
|
|
55
55
|
*/
|
|
56
56
|
export var Tabs = function (props) {
|
|
57
57
|
var _a, _b, _c;
|
|
58
|
-
var labels = props.labels, activeIndex = props.activeIndex, onTabSelected = props.onTabSelected, _d = props.focusActivationMode, focusActivationMode = _d === void 0 ? 'auto' : _d, _e = props.type, type = _e === void 0 ? 'default' : _e, _f = props.color, color = _f === void 0 ? 'blue' : _f, _g = props.orientation, orientation = _g === void 0 ? 'horizontal' : _g, tabsClassName = props.tabsClassName, contentClassName = props.contentClassName, children = props.children, rest = __rest(props, ["labels", "activeIndex", "onTabSelected", "focusActivationMode", "type", "color", "orientation", "tabsClassName", "contentClassName", "children"]);
|
|
58
|
+
var labels = props.labels, activeIndex = props.activeIndex, onTabSelected = props.onTabSelected, _d = props.focusActivationMode, focusActivationMode = _d === void 0 ? 'auto' : _d, _e = props.type, type = _e === void 0 ? 'default' : _e, _f = props.color, color = _f === void 0 ? 'blue' : _f, _g = props.orientation, orientation = _g === void 0 ? 'horizontal' : _g, tabsClassName = props.tabsClassName, contentClassName = props.contentClassName, wrapperClassName = props.wrapperClassName, children = props.children, rest = __rest(props, ["labels", "activeIndex", "onTabSelected", "focusActivationMode", "type", "color", "orientation", "tabsClassName", "contentClassName", "wrapperClassName", "children"]);
|
|
59
59
|
useTheme();
|
|
60
60
|
var tablistRef = React.useRef(null);
|
|
61
61
|
var _h = useContainerWidth(type !== 'default'), tablistSizeRef = _h[0], tabsWidth = _h[1];
|
|
@@ -167,7 +167,7 @@ export var Tabs = function (props) {
|
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
var isIE = !((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, '--stripe-width', '100px'));
|
|
170
|
-
return (React.createElement("div", { className: cx('iui-tabs-wrapper', "iui-" + orientation), style: stripeProperties },
|
|
170
|
+
return (React.createElement("div", { className: cx('iui-tabs-wrapper', "iui-" + orientation, wrapperClassName), style: stripeProperties },
|
|
171
171
|
React.createElement("ul", __assign({ className: cx('iui-tabs', "iui-" + type, {
|
|
172
172
|
'iui-green': color === 'green',
|
|
173
173
|
'iui-animated': type !== 'default' && !isIE,
|
|
@@ -6,7 +6,7 @@ declare module 'react-table' {
|
|
|
6
6
|
cellProps: CellProps<D>;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
};
|
|
9
|
-
interface TableOptions<D extends object = {}> extends Omit<UseTableOptions<D>, 'data'>, UseRowSelectOptions<D>, UseExpandedOptions<D>, UseFiltersOptions<D>, UsePaginationOptions<D>, UseSortByOptions<D> {
|
|
9
|
+
interface TableOptions<D extends object = {}> extends Omit<UseTableOptions<D>, 'data'>, UseRowSelectOptions<D>, UseExpandedOptions<D>, UseFiltersOptions<D>, UsePaginationOptions<D>, Omit<UseResizeColumnsOptions<D>, 'disableResizing'>, UseSortByOptions<D> {
|
|
10
10
|
/**
|
|
11
11
|
* Table data list.
|
|
12
12
|
* Must be memoized.
|
|
@@ -21,9 +21,19 @@ declare module 'react-table' {
|
|
|
21
21
|
interface TableInstance<D extends object = {}> extends UseColumnOrderInstanceProps<D>, UseExpandedInstanceProps<D>, UseFiltersInstanceProps<D>, UseGlobalFiltersInstanceProps<D>, UseGroupByInstanceProps<D>, UsePaginationInstanceProps<D>, UseRowSelectInstanceProps<D>, UseRowStateInstanceProps<D>, UseSortByInstanceProps<D> {
|
|
22
22
|
initialRows: Row<D>[];
|
|
23
23
|
}
|
|
24
|
-
interface TableState<D extends object = {}> extends UseColumnOrderState<D>, UseExpandedState<D>, UseFiltersState<D>, UseGlobalFiltersState<D>, UseGroupByState<D>, UsePaginationState<D>,
|
|
24
|
+
interface TableState<D extends object = {}> extends UseColumnOrderState<D>, UseExpandedState<D>, UseFiltersState<D>, UseGlobalFiltersState<D>, UseGroupByState<D>, UsePaginationState<D>, UseRowSelectState<D>, UseRowStateState<D>, UseSortByState<D> {
|
|
25
|
+
columnResizing: {
|
|
26
|
+
startX?: number;
|
|
27
|
+
columnWidth?: number;
|
|
28
|
+
nextColumnWidth?: number;
|
|
29
|
+
headerIdWidths?: Array<[string, number]>;
|
|
30
|
+
nextHeaderIdWidths?: Array<[string, number]>;
|
|
31
|
+
columnWidths: Record<string, number>;
|
|
32
|
+
isResizingColumn?: string;
|
|
33
|
+
};
|
|
34
|
+
isTableResizing?: boolean;
|
|
25
35
|
}
|
|
26
|
-
interface ColumnInterface<D extends object = {}> extends UseSortByColumnOptions<D>, UseFiltersColumnOptions<D> {
|
|
36
|
+
interface ColumnInterface<D extends object = {}> extends UseSortByColumnOptions<D>, UseFiltersColumnOptions<D>, UseResizeColumnsColumnOptions<D> {
|
|
27
37
|
/**
|
|
28
38
|
* Custom class name applied to header column cell.
|
|
29
39
|
*/
|
|
@@ -59,6 +69,9 @@ declare module 'react-table' {
|
|
|
59
69
|
cellRenderer?: (props: CellRendererProps<D>) => React.ReactNode;
|
|
60
70
|
}
|
|
61
71
|
interface ColumnInstance<D extends object = {}> extends UseFiltersColumnProps<D>, UseGroupByColumnProps<D>, UseResizeColumnsColumnProps<D>, UseSortByColumnProps<D> {
|
|
72
|
+
originalWidth: number;
|
|
73
|
+
resizeWidth?: number;
|
|
74
|
+
isResizerVisible?: boolean;
|
|
62
75
|
}
|
|
63
76
|
interface Cell<D extends object = {}> extends UseGroupByCellProps<D>, UseRowStateCellProps<D> {
|
|
64
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"build-storybook": "build-storybook"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@itwin/itwinui-css": "^0.
|
|
43
|
+
"@itwin/itwinui-css": "^0.41.1",
|
|
44
44
|
"@itwin/itwinui-icons-react": "^1.1.1",
|
|
45
45
|
"@itwin/itwinui-illustrations-react": "^1.0.1",
|
|
46
46
|
"@tippyjs/react": "^4.2.5",
|
|
@@ -81,14 +81,15 @@
|
|
|
81
81
|
"eslint-plugin-react": "^7.25.1",
|
|
82
82
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
83
83
|
"fast-glob": "^3.2.5",
|
|
84
|
-
"husky": "^
|
|
84
|
+
"husky": "^4.0.0",
|
|
85
85
|
"inquirer": "^6.2.2",
|
|
86
86
|
"jest": "^27.0.6",
|
|
87
87
|
"jest-cli": "^27.0.6",
|
|
88
88
|
"jest-junit": "^12.0.0",
|
|
89
|
+
"lint-staged": "^12.1.2",
|
|
89
90
|
"markdown-to-jsx": "6.11.4",
|
|
90
91
|
"mkdirp": "^1.0.4",
|
|
91
|
-
"prettier": "
|
|
92
|
+
"prettier": "2.2.1",
|
|
92
93
|
"react": "^17.0.2",
|
|
93
94
|
"react-dom": "^17.0.2",
|
|
94
95
|
"rimraf": "^2.6.2",
|
|
@@ -120,9 +121,16 @@
|
|
|
120
121
|
},
|
|
121
122
|
"husky": {
|
|
122
123
|
"hooks": {
|
|
123
|
-
"pre-commit": "
|
|
124
|
+
"pre-commit": "lint-staged"
|
|
124
125
|
}
|
|
125
126
|
},
|
|
127
|
+
"lint-staged": {
|
|
128
|
+
"*.{tsx,ts,jsx,js}": [
|
|
129
|
+
"prettier --write",
|
|
130
|
+
"eslint --fix",
|
|
131
|
+
"yarn lint:copyright --fix"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
126
134
|
"sideEffects": [
|
|
127
135
|
"**/*.scss",
|
|
128
136
|
"**/*.css"
|