@itwin/itwinui-react 1.25.0 → 1.28.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 +45 -0
- package/cjs/core/ButtonGroup/ButtonGroup.js +2 -4
- package/cjs/core/Buttons/Button/Button.d.ts +1 -1
- package/cjs/core/Buttons/Button/Button.js +4 -5
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -3
- package/cjs/core/Buttons/SplitButton/SplitButton.js +5 -3
- package/cjs/core/Checkbox/Checkbox.d.ts +11 -0
- package/cjs/core/Checkbox/Checkbox.js +14 -4
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBox.d.ts +2 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/core/ErrorPage/ErrorPage.d.ts +2 -1
- package/cjs/core/ErrorPage/ErrorPage.js +3 -2
- package/cjs/core/InformationPanel/InformationPanel.d.ts +4 -1
- package/cjs/core/InformationPanel/InformationPanel.js +4 -1
- package/cjs/core/InformationPanel/InformationPanelContent.d.ts +42 -0
- package/cjs/core/InformationPanel/InformationPanelContent.js +66 -0
- package/cjs/core/InformationPanel/index.d.ts +2 -0
- package/cjs/core/InformationPanel/index.js +3 -1
- package/cjs/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/cjs/core/Menu/MenuItem.d.ts +1 -1
- package/cjs/core/Modal/ModalButtonBar.d.ts +2 -1
- package/cjs/core/Modal/ModalButtonBar.js +3 -2
- package/cjs/core/Table/Table.d.ts +13 -0
- package/cjs/core/Table/Table.js +80 -11
- package/cjs/core/Table/TableCell.js +1 -1
- package/cjs/core/Table/TablePaginator.d.ts +7 -7
- package/cjs/core/Table/TablePaginator.js +20 -10
- package/cjs/core/Table/TableRowMemoized.d.ts +21 -0
- package/cjs/core/Table/TableRowMemoized.js +7 -4
- 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/filters/BaseFilter.js +3 -1
- package/cjs/core/Table/filters/FilterToggle.js +4 -3
- 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 +273 -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 +3 -8
- package/cjs/core/index.d.ts +4 -4
- package/cjs/core/index.js +4 -2
- package/cjs/core/utils/components/MiddleTextTruncation.d.ts +21 -0
- package/cjs/core/utils/components/MiddleTextTruncation.js +56 -0
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useContainerWidth.d.ts +17 -0
- package/cjs/core/utils/hooks/useContainerWidth.js +50 -0
- package/cjs/core/utils/hooks/useOverflow.d.ts +1 -1
- package/cjs/types/react-table-config.d.ts +16 -3
- package/esm/core/ButtonGroup/ButtonGroup.js +2 -4
- package/esm/core/Buttons/Button/Button.d.ts +1 -1
- package/esm/core/Buttons/Button/Button.js +4 -5
- package/esm/core/Buttons/IconButton/IconButton.js +2 -3
- package/esm/core/Buttons/SplitButton/SplitButton.js +5 -3
- package/esm/core/Checkbox/Checkbox.d.ts +11 -0
- package/esm/core/Checkbox/Checkbox.js +14 -4
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ComboBox/ComboBox.d.ts +2 -2
- package/esm/core/DatePicker/DatePicker.d.ts +1 -1
- package/esm/core/ErrorPage/ErrorPage.d.ts +2 -1
- package/esm/core/ErrorPage/ErrorPage.js +3 -2
- package/esm/core/InformationPanel/InformationPanel.d.ts +4 -1
- package/esm/core/InformationPanel/InformationPanel.js +4 -1
- package/esm/core/InformationPanel/InformationPanelContent.d.ts +42 -0
- package/esm/core/InformationPanel/InformationPanelContent.js +59 -0
- package/esm/core/InformationPanel/index.d.ts +2 -0
- package/esm/core/InformationPanel/index.js +1 -0
- package/esm/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/esm/core/Menu/MenuItem.d.ts +1 -1
- package/esm/core/Modal/ModalButtonBar.d.ts +2 -1
- package/esm/core/Modal/ModalButtonBar.js +3 -2
- package/esm/core/Table/Table.d.ts +13 -0
- package/esm/core/Table/Table.js +82 -13
- package/esm/core/Table/TableCell.js +1 -1
- package/esm/core/Table/TablePaginator.d.ts +7 -7
- package/esm/core/Table/TablePaginator.js +21 -11
- package/esm/core/Table/TableRowMemoized.d.ts +21 -0
- package/esm/core/Table/TableRowMemoized.js +5 -3
- 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/filters/BaseFilter.js +3 -1
- package/esm/core/Table/filters/FilterToggle.js +4 -3
- 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 +269 -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 +4 -9
- package/esm/core/index.d.ts +4 -4
- package/esm/core/index.js +2 -2
- package/esm/core/utils/components/MiddleTextTruncation.d.ts +21 -0
- package/esm/core/utils/components/MiddleTextTruncation.js +49 -0
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useContainerWidth.d.ts +17 -0
- package/esm/core/utils/hooks/useContainerWidth.js +43 -0
- package/esm/core/utils/hooks/useOverflow.d.ts +1 -1
- package/esm/types/react-table-config.d.ts +16 -3
- package/package.json +14 -5
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.useResizeColumns = void 0;
|
|
24
|
+
var react_table_1 = require("react-table");
|
|
25
|
+
var useResizeColumns = function (ownerDocument) { return function (hooks) {
|
|
26
|
+
hooks.getResizerProps = [defaultGetResizerProps(ownerDocument)];
|
|
27
|
+
hooks.stateReducers.push(reducer);
|
|
28
|
+
hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions);
|
|
29
|
+
}; };
|
|
30
|
+
exports.useResizeColumns = useResizeColumns;
|
|
31
|
+
var isTouchEvent = function (event) {
|
|
32
|
+
return event.type === 'touchstart';
|
|
33
|
+
};
|
|
34
|
+
var defaultGetResizerProps = function (ownerDocument) { return function (props, _a) {
|
|
35
|
+
var instance = _a.instance, header = _a.header, nextHeader = _a.nextHeader;
|
|
36
|
+
if (!ownerDocument) {
|
|
37
|
+
return props;
|
|
38
|
+
}
|
|
39
|
+
var dispatch = instance.dispatch, flatHeaders = instance.flatHeaders;
|
|
40
|
+
var onResizeStart = function (e, header) {
|
|
41
|
+
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
42
|
+
if (isTouchEvent(e) && e.touches && e.touches.length > 1) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Setting `width` here because it might take several rerenders until actual column width is set.
|
|
46
|
+
flatHeaders.forEach(function (h) {
|
|
47
|
+
if (!h.width) {
|
|
48
|
+
h.width = h.resizeWidth;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
var headerIdWidths = getLeafHeaders(header).map(function (d) { return [d.id, d.width]; });
|
|
52
|
+
var nextHeaderIdWidths = nextHeader
|
|
53
|
+
? getLeafHeaders(nextHeader).map(function (d) { return [d.id, d.width]; })
|
|
54
|
+
: [];
|
|
55
|
+
var clientX = isTouchEvent(e)
|
|
56
|
+
? Math.round(e.touches[0].clientX)
|
|
57
|
+
: e.clientX;
|
|
58
|
+
var dispatchMove = function (clientXPos) {
|
|
59
|
+
return dispatch({ type: react_table_1.actions.columnResizing, clientX: clientXPos });
|
|
60
|
+
};
|
|
61
|
+
var dispatchEnd = function () {
|
|
62
|
+
return dispatch({
|
|
63
|
+
type: react_table_1.actions.columnDoneResizing,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
var handlersAndEvents = {
|
|
67
|
+
mouse: {
|
|
68
|
+
moveEvent: 'mousemove',
|
|
69
|
+
moveHandler: function (e) { return dispatchMove(e.clientX); },
|
|
70
|
+
upEvent: 'mouseup',
|
|
71
|
+
upHandler: function () {
|
|
72
|
+
ownerDocument.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
|
|
73
|
+
ownerDocument.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
|
|
74
|
+
dispatchEnd();
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
touch: {
|
|
78
|
+
moveEvent: 'touchmove',
|
|
79
|
+
moveHandler: function (e) {
|
|
80
|
+
if (e.cancelable) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
}
|
|
84
|
+
dispatchMove(e.touches[0].clientX);
|
|
85
|
+
},
|
|
86
|
+
upEvent: 'touchend',
|
|
87
|
+
upHandler: function () {
|
|
88
|
+
ownerDocument.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
|
|
89
|
+
ownerDocument.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
|
|
90
|
+
dispatchEnd();
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
var events = isTouchEvent(e)
|
|
95
|
+
? handlersAndEvents.touch
|
|
96
|
+
: handlersAndEvents.mouse;
|
|
97
|
+
var passiveIfSupported = passiveEventSupported()
|
|
98
|
+
? { passive: false }
|
|
99
|
+
: false;
|
|
100
|
+
ownerDocument.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
|
|
101
|
+
ownerDocument.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
|
|
102
|
+
dispatch({
|
|
103
|
+
type: react_table_1.actions.columnStartResizing,
|
|
104
|
+
columnId: header.id,
|
|
105
|
+
columnWidth: header.width,
|
|
106
|
+
nextColumnWidth: nextHeader === null || nextHeader === void 0 ? void 0 : nextHeader.width,
|
|
107
|
+
headerIdWidths: headerIdWidths,
|
|
108
|
+
nextHeaderIdWidths: nextHeaderIdWidths,
|
|
109
|
+
clientX: clientX,
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
return [
|
|
113
|
+
props,
|
|
114
|
+
{
|
|
115
|
+
onMouseDown: function (e) {
|
|
116
|
+
e.persist();
|
|
117
|
+
// Prevents from triggering sort
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
onResizeStart(e, header);
|
|
120
|
+
},
|
|
121
|
+
onTouchStart: function (e) {
|
|
122
|
+
e.persist();
|
|
123
|
+
// Prevents from triggering sort
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
onResizeStart(e, header);
|
|
126
|
+
},
|
|
127
|
+
style: {
|
|
128
|
+
cursor: 'col-resize',
|
|
129
|
+
},
|
|
130
|
+
draggable: false,
|
|
131
|
+
role: 'separator',
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
}; };
|
|
135
|
+
exports.useResizeColumns.pluginName = 'useResizeColumns';
|
|
136
|
+
var reducer = function (newState, action, previousState, instance) {
|
|
137
|
+
if (action.type === react_table_1.actions.init) {
|
|
138
|
+
return __assign(__assign({}, newState), { columnResizing: {
|
|
139
|
+
columnWidths: {},
|
|
140
|
+
} });
|
|
141
|
+
}
|
|
142
|
+
if (action.type === react_table_1.actions.resetResize) {
|
|
143
|
+
return __assign(__assign({}, newState), { columnResizing: {
|
|
144
|
+
columnWidths: {},
|
|
145
|
+
} });
|
|
146
|
+
}
|
|
147
|
+
if (action.type === react_table_1.actions.columnStartResizing) {
|
|
148
|
+
var clientX = action.clientX, columnId = action.columnId, columnWidth = action.columnWidth, nextColumnWidth = action.nextColumnWidth, headerIdWidths = action.headerIdWidths, nextHeaderIdWidths = action.nextHeaderIdWidths;
|
|
149
|
+
return __assign(__assign({}, newState), { columnResizing: __assign(__assign({}, newState.columnResizing), { startX: clientX, columnWidth: columnWidth, nextColumnWidth: nextColumnWidth, headerIdWidths: headerIdWidths, nextHeaderIdWidths: nextHeaderIdWidths, isResizingColumn: columnId }) });
|
|
150
|
+
}
|
|
151
|
+
if (action.type === react_table_1.actions.columnResizing) {
|
|
152
|
+
var clientX = action.clientX;
|
|
153
|
+
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;
|
|
154
|
+
var deltaX = clientX - startX;
|
|
155
|
+
var newColumnWidths = getColumnWidths(headerIdWidths, deltaX / columnWidth);
|
|
156
|
+
var newNextColumnWidths = getColumnWidths(nextHeaderIdWidths, -deltaX / nextColumnWidth);
|
|
157
|
+
if (!isNewColumnWidthsValid(newColumnWidths, instance === null || instance === void 0 ? void 0 : instance.flatHeaders) ||
|
|
158
|
+
!isNewColumnWidthsValid(newNextColumnWidths, instance === null || instance === void 0 ? void 0 : instance.flatHeaders)) {
|
|
159
|
+
return newState;
|
|
160
|
+
}
|
|
161
|
+
return __assign(__assign({}, newState), { columnResizing: __assign(__assign({}, newState.columnResizing), { columnWidths: __assign(__assign(__assign({}, newState.columnResizing.columnWidths), newColumnWidths), newNextColumnWidths) }) });
|
|
162
|
+
}
|
|
163
|
+
if (action.type === react_table_1.actions.columnDoneResizing) {
|
|
164
|
+
return __assign(__assign({}, newState), { columnResizing: __assign(__assign({}, newState.columnResizing), { startX: undefined, isResizingColumn: undefined }) });
|
|
165
|
+
}
|
|
166
|
+
return newState;
|
|
167
|
+
};
|
|
168
|
+
var getColumnWidths = function (headerIdWidths, deltaPercentage) {
|
|
169
|
+
var columnWidths = {};
|
|
170
|
+
headerIdWidths.forEach(function (_a) {
|
|
171
|
+
var headerId = _a[0], headerWidth = _a[1];
|
|
172
|
+
columnWidths[headerId] = Math.max(headerWidth + headerWidth * deltaPercentage, 0);
|
|
173
|
+
});
|
|
174
|
+
return columnWidths;
|
|
175
|
+
};
|
|
176
|
+
var isNewColumnWidthsValid = function (columnWidths, headers) {
|
|
177
|
+
// Prevents from going outside the column bounds
|
|
178
|
+
if (Object.values(columnWidths).some(function (width) { return width <= 1; })) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
var _loop_1 = function (headerId, width) {
|
|
182
|
+
var header = headers === null || headers === void 0 ? void 0 : headers.find(function (h) { return h.id === headerId; });
|
|
183
|
+
if (!header) {
|
|
184
|
+
return "continue";
|
|
185
|
+
}
|
|
186
|
+
var minWidth = header.minWidth || 0;
|
|
187
|
+
var maxWidth = header.maxWidth || Infinity;
|
|
188
|
+
if (width < minWidth || width > maxWidth) {
|
|
189
|
+
return { value: false };
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
for (var _i = 0, _a = Object.entries(columnWidths); _i < _a.length; _i++) {
|
|
193
|
+
var _b = _a[_i], headerId = _b[0], width = _b[1];
|
|
194
|
+
var state_1 = _loop_1(headerId, width);
|
|
195
|
+
if (typeof state_1 === "object")
|
|
196
|
+
return state_1.value;
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
};
|
|
200
|
+
var useInstanceBeforeDimensions = function (instance) {
|
|
201
|
+
var flatHeaders = instance.flatHeaders, getHooks = instance.getHooks, columnResizing = instance.state.columnResizing;
|
|
202
|
+
var getInstance = (0, react_table_1.useGetLatest)(instance);
|
|
203
|
+
flatHeaders.forEach(function (header, index) {
|
|
204
|
+
var _a;
|
|
205
|
+
var resizeWidth = columnResizing.columnWidths[header.id];
|
|
206
|
+
header.width = resizeWidth || header.width || header.originalWidth;
|
|
207
|
+
header.isResizing = columnResizing.isResizingColumn === header.id;
|
|
208
|
+
var headerToResize = header.disableResizing
|
|
209
|
+
? getPreviousResizableHeader(header, instance)
|
|
210
|
+
: header;
|
|
211
|
+
var nextResizableHeader = getNextResizableHeader(header, instance);
|
|
212
|
+
header.canResize =
|
|
213
|
+
header.disableResizing != null ? !header.disableResizing : true;
|
|
214
|
+
// Show resizer when header is resizable or when next header is resizable
|
|
215
|
+
// and there is resizable columns on the left side of the resizer.
|
|
216
|
+
header.isResizerVisible =
|
|
217
|
+
(header.canResize && !!nextResizableHeader) ||
|
|
218
|
+
(headerToResize && !!((_a = instance.flatHeaders[index + 1]) === null || _a === void 0 ? void 0 : _a.canResize));
|
|
219
|
+
header.getResizerProps = (0, react_table_1.makePropGetter)(getHooks().getResizerProps, {
|
|
220
|
+
instance: getInstance(),
|
|
221
|
+
header: headerToResize,
|
|
222
|
+
nextHeader: nextResizableHeader,
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
var getPreviousResizableHeader = function (headerColumn, instance) {
|
|
227
|
+
var _a;
|
|
228
|
+
var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders;
|
|
229
|
+
var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
|
|
230
|
+
return __spreadArray([], headersList, true).slice(0, headerIndex)
|
|
231
|
+
.reverse()
|
|
232
|
+
.find(function (h) { return !h.disableResizing; });
|
|
233
|
+
};
|
|
234
|
+
var getNextResizableHeader = function (headerColumn, instance) {
|
|
235
|
+
var _a;
|
|
236
|
+
var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders;
|
|
237
|
+
var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
|
|
238
|
+
return __spreadArray([], headersList, true).slice(headerIndex + 1)
|
|
239
|
+
.find(function (h) { return !h.disableResizing; });
|
|
240
|
+
};
|
|
241
|
+
function getLeafHeaders(header) {
|
|
242
|
+
var leafHeaders = [];
|
|
243
|
+
var recurseHeader = function (header) {
|
|
244
|
+
if (header.columns && header.columns.length) {
|
|
245
|
+
header.columns.map(recurseHeader);
|
|
246
|
+
}
|
|
247
|
+
leafHeaders.push(header);
|
|
248
|
+
};
|
|
249
|
+
recurseHeader(header);
|
|
250
|
+
return leafHeaders;
|
|
251
|
+
}
|
|
252
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#safely_detecting_option_support
|
|
253
|
+
var passiveSupported = null;
|
|
254
|
+
var passiveEventSupported = function () {
|
|
255
|
+
// memoize support to avoid adding multiple test events
|
|
256
|
+
if (passiveSupported != null) {
|
|
257
|
+
return passiveSupported;
|
|
258
|
+
}
|
|
259
|
+
try {
|
|
260
|
+
var options = {
|
|
261
|
+
once: true,
|
|
262
|
+
get passive() {
|
|
263
|
+
passiveSupported = true;
|
|
264
|
+
return false;
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
window.addEventListener('test', function () { }, options);
|
|
268
|
+
}
|
|
269
|
+
catch (_a) {
|
|
270
|
+
passiveSupported = false;
|
|
271
|
+
}
|
|
272
|
+
return passiveSupported;
|
|
273
|
+
};
|
|
@@ -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/cjs/core/Table/utils.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCellStyle = void 0;
|
|
4
|
-
var getCellStyle = function (column) {
|
|
4
|
+
var getCellStyle = function (column, isTableResizing) {
|
|
5
5
|
var style = {};
|
|
6
6
|
style.flex = "1 1 145px";
|
|
7
7
|
if (column.width) {
|
|
8
8
|
var width = typeof column.width === 'string' ? column.width : column.width + "px";
|
|
9
9
|
style.width = width;
|
|
10
|
-
|
|
10
|
+
// This allows flexbox to handle the width of the column on table resize
|
|
11
|
+
if (isTableResizing && column.canResize) {
|
|
12
|
+
style.flex = Number(column.width) + " 1 " + width;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
style.flex = "0 0 " + width;
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
if (column.maxWidth) {
|
|
13
19
|
style.maxWidth = column.maxWidth + "px";
|
package/cjs/core/Tabs/Tabs.d.ts
CHANGED
package/cjs/core/Tabs/Tabs.js
CHANGED
|
@@ -61,15 +61,10 @@ var Tab_1 = require("./Tab");
|
|
|
61
61
|
*/
|
|
62
62
|
var Tabs = function (props) {
|
|
63
63
|
var _a, _b, _c;
|
|
64
|
-
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"]);
|
|
64
|
+
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"]);
|
|
65
65
|
(0, utils_1.useTheme)();
|
|
66
66
|
var tablistRef = react_1.default.useRef(null);
|
|
67
|
-
var _h =
|
|
68
|
-
var updateTabsWidth = react_1.default.useCallback(function (_a) {
|
|
69
|
-
var width = _a.width;
|
|
70
|
-
return setTabsWidth(width);
|
|
71
|
-
}, []);
|
|
72
|
-
var tablistSizeRef = (0, utils_1.useResizeObserver)(updateTabsWidth)[0];
|
|
67
|
+
var _h = (0, utils_1.useContainerWidth)(type !== 'default'), tablistSizeRef = _h[0], tabsWidth = _h[1];
|
|
73
68
|
var refs = (0, utils_1.useMergedRefs)(tablistRef, tablistSizeRef);
|
|
74
69
|
var _j = react_1.default.useState(function () {
|
|
75
70
|
return activeIndex != null
|
|
@@ -178,7 +173,7 @@ var Tabs = function (props) {
|
|
|
178
173
|
}
|
|
179
174
|
};
|
|
180
175
|
var isIE = !((_c = (_b = (_a = (0, utils_1.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'));
|
|
181
|
-
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-" + orientation), style: stripeProperties },
|
|
176
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-" + orientation, wrapperClassName), style: stripeProperties },
|
|
182
177
|
react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-tabs', "iui-" + type, {
|
|
183
178
|
'iui-green': color === 'green',
|
|
184
179
|
'iui-animated': type !== 'default' && !isIE,
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ export { Header, HeaderBreadcrumbs, HeaderButton, HeaderLogo } from './Header';
|
|
|
32
32
|
export type { HeaderProps, HeaderBreadcrumbsProps, HeaderButtonProps, HeaderLogoProps, } from './Header';
|
|
33
33
|
export { VerticalTabs, Tab, HorizontalTabs, HorizontalTab } from './Tabs';
|
|
34
34
|
export type { VerticalTabsProps, TabProps, HorizontalTabsProps, HorizontalTabProps, } from './Tabs';
|
|
35
|
-
export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, } from './InformationPanel';
|
|
36
|
-
export type { InformationPanelProps, InformationPanelWrapperProps, InformationPanelHeaderProps, InformationPanelBodyProps, } from './InformationPanel';
|
|
35
|
+
export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, InformationPanelContent, } from './InformationPanel';
|
|
36
|
+
export type { InformationPanelProps, InformationPanelWrapperProps, InformationPanelHeaderProps, InformationPanelBodyProps, InformationPanelContentProps, } from './InformationPanel';
|
|
37
37
|
export { Input } from './Input';
|
|
38
38
|
export type { InputProps } from './Input';
|
|
39
39
|
export { Label } from './Label';
|
|
@@ -88,5 +88,5 @@ export { UserIconGroup } from './UserIconGroup';
|
|
|
88
88
|
export type { UserIconGroupProps } from './UserIconGroup';
|
|
89
89
|
export { Wizard } from './Wizard';
|
|
90
90
|
export type { WizardProps, StepProperties, WizardType, WizardLocalization, } from './Wizard';
|
|
91
|
-
export { getUserColor, useTheme, ColorValue } from './utils';
|
|
92
|
-
export type { ThemeType } from './utils';
|
|
91
|
+
export { getUserColor, useTheme, ColorValue, MiddleTextTruncation, } from './utils';
|
|
92
|
+
export type { ThemeType, MiddleTextTruncationProps } from './utils';
|
package/cjs/core/index.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.Slider = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = void 0;
|
|
6
|
+
exports.ModalButtonBar = exports.Modal = exports.MenuExtraContent = exports.MenuDivider = exports.MenuItem = exports.Menu = exports.LabeledTextarea = exports.LabeledSelect = exports.InputGroup = exports.LabeledInput = exports.Label = exports.Input = exports.InformationPanelContent = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = exports.HorizontalTab = exports.HorizontalTabs = exports.Tab = exports.VerticalTabs = exports.HeaderLogo = exports.HeaderButton = exports.HeaderBreadcrumbs = exports.Header = exports.Footer = exports.FileUploadTemplate = exports.FileUpload = exports.Fieldset = exports.ExpandableBlock = exports.ErrorPage = exports.DropdownMenu = exports.generateLocalizedStrings = exports.DatePicker = exports.ComboBox = exports.ColorPalette = exports.ColorInputPanel = exports.ColorBuilder = exports.ColorSwatch = exports.ColorPicker = exports.Checkbox = exports.ButtonGroup = exports.SplitButton = exports.IdeasButton = exports.IconButton = exports.DropdownButton = exports.Button = exports.Breadcrumbs = exports.Badge = exports.Alert = void 0;
|
|
7
|
+
exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.Slider = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = exports.ProgressLinear = void 0;
|
|
8
8
|
/*---------------------------------------------------------------------------------------------
|
|
9
9
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
10
10
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -64,6 +64,7 @@ Object.defineProperty(exports, "InformationPanel", { enumerable: true, get: func
|
|
|
64
64
|
Object.defineProperty(exports, "InformationPanelWrapper", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelWrapper; } });
|
|
65
65
|
Object.defineProperty(exports, "InformationPanelHeader", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelHeader; } });
|
|
66
66
|
Object.defineProperty(exports, "InformationPanelBody", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelBody; } });
|
|
67
|
+
Object.defineProperty(exports, "InformationPanelContent", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelContent; } });
|
|
67
68
|
var Input_1 = require("./Input");
|
|
68
69
|
Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return Input_1.Input; } });
|
|
69
70
|
var Label_1 = require("./Label");
|
|
@@ -147,3 +148,4 @@ var utils_1 = require("./utils");
|
|
|
147
148
|
Object.defineProperty(exports, "getUserColor", { enumerable: true, get: function () { return utils_1.getUserColor; } });
|
|
148
149
|
Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return utils_1.useTheme; } });
|
|
149
150
|
Object.defineProperty(exports, "ColorValue", { enumerable: true, get: function () { return utils_1.ColorValue; } });
|
|
151
|
+
Object.defineProperty(exports, "MiddleTextTruncation", { enumerable: true, get: function () { return utils_1.MiddleTextTruncation; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CommonProps } from '../props';
|
|
3
|
+
export declare type MiddleTextTruncationProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Text to truncate.
|
|
6
|
+
*/
|
|
7
|
+
text: string;
|
|
8
|
+
/**
|
|
9
|
+
* Number of characters to leave at the end.
|
|
10
|
+
* @default 6
|
|
11
|
+
*/
|
|
12
|
+
endCharsCount?: number;
|
|
13
|
+
} & CommonProps;
|
|
14
|
+
/**
|
|
15
|
+
* Truncates text with the ellipsis in the middle,
|
|
16
|
+
* leaving defined number of chars at the end.
|
|
17
|
+
* @example
|
|
18
|
+
* <MiddleTextTruncation text='ThisIsMyVeryLongFileName.dgn' />
|
|
19
|
+
*/
|
|
20
|
+
export declare const MiddleTextTruncation: (props: MiddleTextTruncationProps) => JSX.Element;
|
|
21
|
+
export default MiddleTextTruncation;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.MiddleTextTruncation = void 0;
|
|
29
|
+
/*---------------------------------------------------------------------------------------------
|
|
30
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
31
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
32
|
+
*--------------------------------------------------------------------------------------------*/
|
|
33
|
+
var react_1 = __importDefault(require("react"));
|
|
34
|
+
var useOverflow_1 = require("../hooks/useOverflow");
|
|
35
|
+
var ELLIPSIS_CHAR = '…';
|
|
36
|
+
/**
|
|
37
|
+
* Truncates text with the ellipsis in the middle,
|
|
38
|
+
* leaving defined number of chars at the end.
|
|
39
|
+
* @example
|
|
40
|
+
* <MiddleTextTruncation text='ThisIsMyVeryLongFileName.dgn' />
|
|
41
|
+
*/
|
|
42
|
+
var MiddleTextTruncation = function (props) {
|
|
43
|
+
var text = props.text, _a = props.endCharsCount, endCharsCount = _a === void 0 ? 6 : _a, style = props.style, rest = __rest(props, ["text", "endCharsCount", "style"]);
|
|
44
|
+
var _b = (0, useOverflow_1.useOverflow)(text), ref = _b[0], visibleCount = _b[1];
|
|
45
|
+
var truncatedText = react_1.default.useMemo(function () {
|
|
46
|
+
if (visibleCount < text.length) {
|
|
47
|
+
return "" + text.substr(0, visibleCount - endCharsCount - ELLIPSIS_CHAR.length) + ELLIPSIS_CHAR + text.substr(text.length - endCharsCount);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return text;
|
|
51
|
+
}
|
|
52
|
+
}, [endCharsCount, text, visibleCount]);
|
|
53
|
+
return (react_1.default.createElement("span", __assign({ style: __assign({ display: 'flex', minWidth: 0, flexGrow: 1, whiteSpace: 'nowrap' }, style), ref: ref }, rest), truncatedText));
|
|
54
|
+
};
|
|
55
|
+
exports.MiddleTextTruncation = MiddleTextTruncation;
|
|
56
|
+
exports.default = exports.MiddleTextTruncation;
|
|
@@ -18,5 +18,6 @@ __exportStar(require("./useEventListener"), exports);
|
|
|
18
18
|
__exportStar(require("./useMergedRefs"), exports);
|
|
19
19
|
__exportStar(require("./useOverflow"), exports);
|
|
20
20
|
__exportStar(require("./useResizeObserver"), exports);
|
|
21
|
+
__exportStar(require("./useContainerWidth"), exports);
|
|
21
22
|
__exportStar(require("./useTheme"), exports);
|
|
22
23
|
__exportStar(require("./useIntersection"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that returns the width of an element in three stages:
|
|
3
|
+
* - initialized with 0
|
|
4
|
+
* - immediately set to element's initial width as soon as it's mounted
|
|
5
|
+
* - update to new width every time it changes (using `useResizeObserver` hook)
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
* @param watchResizes If false, ResizeObserver will not be connected and only the initial width will be returned
|
|
9
|
+
* @returns [ref to attach to the element, stateful width of the element]
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const [ref, width] = useContainerWidth();
|
|
13
|
+
* ... // do something with width
|
|
14
|
+
* return <div ref={ref}>...</div>;
|
|
15
|
+
*/
|
|
16
|
+
export declare const useContainerWidth: <T extends HTMLElement>(watchResizes?: boolean) => readonly [(instance: HTMLElement | null) => void, number];
|
|
17
|
+
export default useContainerWidth;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useContainerWidth = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
var react_1 = __importDefault(require("react"));
|
|
12
|
+
var useMergedRefs_1 = require("./useMergedRefs");
|
|
13
|
+
var useResizeObserver_1 = require("./useResizeObserver");
|
|
14
|
+
/**
|
|
15
|
+
* Hook that returns the width of an element in three stages:
|
|
16
|
+
* - initialized with 0
|
|
17
|
+
* - immediately set to element's initial width as soon as it's mounted
|
|
18
|
+
* - update to new width every time it changes (using `useResizeObserver` hook)
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
* @param watchResizes If false, ResizeObserver will not be connected and only the initial width will be returned
|
|
22
|
+
* @returns [ref to attach to the element, stateful width of the element]
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const [ref, width] = useContainerWidth();
|
|
26
|
+
* ... // do something with width
|
|
27
|
+
* return <div ref={ref}>...</div>;
|
|
28
|
+
*/
|
|
29
|
+
var useContainerWidth = function (watchResizes) {
|
|
30
|
+
if (watchResizes === void 0) { watchResizes = true; }
|
|
31
|
+
var _a = react_1.default.useState(0), contentWidth = _a[0], setContentWidth = _a[1];
|
|
32
|
+
var ref = react_1.default.useCallback(function (element) {
|
|
33
|
+
if (!element) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
setContentWidth(element.getBoundingClientRect().width);
|
|
37
|
+
}, []);
|
|
38
|
+
var updateWidth = react_1.default.useCallback(function (_a) {
|
|
39
|
+
var width = _a.width;
|
|
40
|
+
return setContentWidth(width);
|
|
41
|
+
}, []);
|
|
42
|
+
var _b = (0, useResizeObserver_1.useResizeObserver)(updateWidth), resizeRef = _b[0], resizeObserver = _b[1];
|
|
43
|
+
if (!watchResizes) {
|
|
44
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
45
|
+
}
|
|
46
|
+
var refs = (0, useMergedRefs_1.useMergedRefs)(ref, watchResizes ? resizeRef : undefined);
|
|
47
|
+
return [refs, contentWidth];
|
|
48
|
+
};
|
|
49
|
+
exports.useContainerWidth = useContainerWidth;
|
|
50
|
+
exports.default = exports.useContainerWidth;
|
|
@@ -20,4 +20,4 @@ import React from 'react';
|
|
|
20
20
|
* </div>
|
|
21
21
|
* );
|
|
22
22
|
*/
|
|
23
|
-
export declare const useOverflow: <T extends HTMLElement>(items: React.ReactNode[], disabled?: boolean) => readonly [(instance: T | null) => void, number];
|
|
23
|
+
export declare const useOverflow: <T extends HTMLElement>(items: React.ReactNode[] | string, disabled?: boolean) => readonly [(instance: T | null) => void, number];
|
|
@@ -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
|
}
|
|
@@ -58,14 +58,12 @@ import '@itwin/itwinui-css/css/button.css';
|
|
|
58
58
|
*/
|
|
59
59
|
export var ButtonGroup = React.forwardRef(function (props, ref) {
|
|
60
60
|
var children = props.children, className = props.className, style = props.style, overflowButton = props.overflowButton, rest = __rest(props, ["children", "className", "style", "overflowButton"]);
|
|
61
|
-
var items = React.useMemo(function () { return React.Children.
|
|
62
|
-
children,
|
|
63
|
-
]);
|
|
61
|
+
var items = React.useMemo(function () { var _a; return (_a = React.Children.map(children, function (child) { return React.createElement("div", null, child); })) !== null && _a !== void 0 ? _a : []; }, [children]);
|
|
64
62
|
useTheme();
|
|
65
63
|
var _a = useOverflow(items, !overflowButton), overflowRef = _a[0], visibleCount = _a[1];
|
|
66
64
|
var refs = useMergedRefs(overflowRef, ref);
|
|
67
65
|
return (React.createElement("div", __assign({ className: cx('iui-button-group', className), style: __assign(__assign({}, (!!overflowButton && { width: '100%' })), style), ref: refs }, rest), !!overflowButton && visibleCount < items.length ? (React.createElement(React.Fragment, null,
|
|
68
66
|
items.slice(0, visibleCount - 1),
|
|
69
|
-
overflowButton(visibleCount))) : (
|
|
67
|
+
overflowButton(visibleCount))) : (items)));
|
|
70
68
|
});
|
|
71
69
|
export default ButtonGroup;
|
|
@@ -43,7 +43,7 @@ export declare const Button: React.ForwardRefExoticComponent<{
|
|
|
43
43
|
* Use 'borderless' to hide outline.
|
|
44
44
|
* @default 'default'
|
|
45
45
|
*/
|
|
46
|
-
styleType?: "
|
|
46
|
+
styleType?: "default" | "cta" | "high-visibility" | "borderless" | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* Icon shown before the main button content.
|
|
49
49
|
*/
|