trotl-table 1.0.11 → 1.0.13
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/index.cjs.js +387 -116
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +383 -113
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { cloneElement, useEffect, useState, useCallback, useRef, useMemo } from 'react';
|
|
3
3
|
import { DndProvider, useDrop, useDrag } from 'react-dnd';
|
|
4
4
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
@@ -370,7 +370,7 @@ var ArrowKeyStepper = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
370
370
|
var _this$_getScrollState3 = this._getScrollState(),
|
|
371
371
|
scrollToColumn = _this$_getScrollState3.scrollToColumn,
|
|
372
372
|
scrollToRow = _this$_getScrollState3.scrollToRow;
|
|
373
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
373
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
374
374
|
className: className,
|
|
375
375
|
onKeyDown: this._onKeyDown
|
|
376
376
|
}, children({
|
|
@@ -424,7 +424,7 @@ var ArrowKeyStepper = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
424
424
|
return {};
|
|
425
425
|
}
|
|
426
426
|
}]);
|
|
427
|
-
}(React.PureComponent);
|
|
427
|
+
}(React$1.PureComponent);
|
|
428
428
|
_defineProperty(ArrowKeyStepper, "defaultProps", {
|
|
429
429
|
disabled: false,
|
|
430
430
|
isControlled: false,
|
|
@@ -788,14 +788,14 @@ var AutoSizer = /*#__PURE__*/function (_React$Component) {
|
|
|
788
788
|
}
|
|
789
789
|
*/
|
|
790
790
|
|
|
791
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
791
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
792
792
|
className: className,
|
|
793
793
|
ref: this._setRef,
|
|
794
794
|
style: _objectSpread$6(_objectSpread$6({}, outerStyle), style)
|
|
795
795
|
}, children(childParams));
|
|
796
796
|
}
|
|
797
797
|
}]);
|
|
798
|
-
}(React.Component);
|
|
798
|
+
}(React$1.Component);
|
|
799
799
|
_defineProperty(AutoSizer, "defaultProps", {
|
|
800
800
|
onResize: function onResize() {},
|
|
801
801
|
disableHeight: false,
|
|
@@ -834,7 +834,7 @@ var CellMeasurer = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
834
834
|
args[_key] = arguments[_key];
|
|
835
835
|
}
|
|
836
836
|
_this = _callSuper$c(this, CellMeasurer, [].concat(args));
|
|
837
|
-
_defineProperty(_this, "_child", /*#__PURE__*/React.createRef());
|
|
837
|
+
_defineProperty(_this, "_child", /*#__PURE__*/React$1.createRef());
|
|
838
838
|
_defineProperty(_this, "_measure", function () {
|
|
839
839
|
var _this$props = _this.props,
|
|
840
840
|
cache = _this$props.cache,
|
|
@@ -975,7 +975,7 @@ var CellMeasurer = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
977
|
}]);
|
|
978
|
-
}(React.PureComponent); // Used for DEV mode warning check
|
|
978
|
+
}(React$1.PureComponent); // Used for DEV mode warning check
|
|
979
979
|
_defineProperty(CellMeasurer, "__internalCellMeasurerFlag", false);
|
|
980
980
|
if (process.env.NODE_ENV !== 'production') {
|
|
981
981
|
CellMeasurer.__internalCellMeasurerFlag = true;
|
|
@@ -2557,7 +2557,7 @@ var CollectionView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
2557
2557
|
// This was originally reported via clauderic/react-infinite-calendar/issues/23
|
|
2558
2558
|
collectionStyle.overflowX = totalWidth + verticalScrollBarSize <= width ? 'hidden' : 'auto';
|
|
2559
2559
|
collectionStyle.overflowY = totalHeight + horizontalScrollBarSize <= height ? 'hidden' : 'auto';
|
|
2560
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2560
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
2561
2561
|
ref: this._setScrollingContainerRef,
|
|
2562
2562
|
"aria-label": this.props['aria-label'],
|
|
2563
2563
|
className: clsx('ReactVirtualized__Collection', className),
|
|
@@ -2566,7 +2566,7 @@ var CollectionView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
2566
2566
|
role: "grid",
|
|
2567
2567
|
style: _objectSpread$5(_objectSpread$5({}, collectionStyle), style),
|
|
2568
2568
|
tabIndex: 0
|
|
2569
|
-
}, cellCount > 0 && /*#__PURE__*/React.createElement("div", {
|
|
2569
|
+
}, cellCount > 0 && /*#__PURE__*/React$1.createElement("div", {
|
|
2570
2570
|
className: "ReactVirtualized__Collection__innerScrollContainer",
|
|
2571
2571
|
style: {
|
|
2572
2572
|
height: totalHeight,
|
|
@@ -2670,7 +2670,7 @@ var CollectionView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
2670
2670
|
return null;
|
|
2671
2671
|
}
|
|
2672
2672
|
}]);
|
|
2673
|
-
}(React.PureComponent);
|
|
2673
|
+
}(React$1.PureComponent);
|
|
2674
2674
|
_defineProperty(CollectionView, "defaultProps", {
|
|
2675
2675
|
'aria-label': 'grid',
|
|
2676
2676
|
horizontalOverscanSize: 0,
|
|
@@ -3046,7 +3046,7 @@ var Collection = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
3046
3046
|
key: "render",
|
|
3047
3047
|
value: function render() {
|
|
3048
3048
|
var props = _extends({}, (_objectDestructuringEmpty(this.props), this.props));
|
|
3049
|
-
return /*#__PURE__*/React.createElement(CollectionView, _extends({
|
|
3049
|
+
return /*#__PURE__*/React$1.createElement(CollectionView, _extends({
|
|
3050
3050
|
cellLayoutManager: this,
|
|
3051
3051
|
isScrollingChange: this._isScrollingChange,
|
|
3052
3052
|
ref: this._setCollectionViewRef
|
|
@@ -3168,7 +3168,7 @@ var Collection = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
3168
3168
|
this._collectionView = ref;
|
|
3169
3169
|
}
|
|
3170
3170
|
}]);
|
|
3171
|
-
}(React.PureComponent);
|
|
3171
|
+
}(React$1.PureComponent);
|
|
3172
3172
|
_defineProperty(Collection, "defaultProps", {
|
|
3173
3173
|
'aria-label': 'grid',
|
|
3174
3174
|
cellGroupRenderer: defaultCellGroupRenderer
|
|
@@ -3309,7 +3309,7 @@ var ColumnSizer = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
3309
3309
|
}
|
|
3310
3310
|
}
|
|
3311
3311
|
}]);
|
|
3312
|
-
}(React.PureComponent);
|
|
3312
|
+
}(React$1.PureComponent);
|
|
3313
3313
|
ColumnSizer.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
3314
3314
|
/**
|
|
3315
3315
|
* Function responsible for rendering a virtualized Grid.
|
|
@@ -5013,7 +5013,7 @@ var Grid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
5013
5013
|
gridStyle.overflowY = totalRowsHeight + horizontalScrollBarSize <= height ? 'hidden' : 'auto';
|
|
5014
5014
|
var childrenToDisplay = this._childrenToDisplay;
|
|
5015
5015
|
var showNoContentRenderer = childrenToDisplay.length === 0 && height > 0 && width > 0;
|
|
5016
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
5016
|
+
return /*#__PURE__*/React$1.createElement("div", _extends({
|
|
5017
5017
|
ref: this._setScrollingContainerRef
|
|
5018
5018
|
}, containerProps, {
|
|
5019
5019
|
"aria-label": this.props['aria-label'],
|
|
@@ -5024,7 +5024,7 @@ var Grid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
5024
5024
|
role: role,
|
|
5025
5025
|
style: _objectSpread$4(_objectSpread$4({}, gridStyle), style),
|
|
5026
5026
|
tabIndex: tabIndex
|
|
5027
|
-
}), childrenToDisplay.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
5027
|
+
}), childrenToDisplay.length > 0 && /*#__PURE__*/React$1.createElement("div", {
|
|
5028
5028
|
className: "ReactVirtualized__Grid__innerScrollContainer",
|
|
5029
5029
|
role: containerRole,
|
|
5030
5030
|
style: _objectSpread$4({
|
|
@@ -5558,7 +5558,7 @@ var Grid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
5558
5558
|
return {};
|
|
5559
5559
|
}
|
|
5560
5560
|
}]);
|
|
5561
|
-
}(React.PureComponent);
|
|
5561
|
+
}(React$1.PureComponent);
|
|
5562
5562
|
_defineProperty(Grid, "defaultProps", {
|
|
5563
5563
|
'aria-label': 'grid',
|
|
5564
5564
|
'aria-readonly': true,
|
|
@@ -5759,7 +5759,7 @@ var InfiniteLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
5759
5759
|
this._registeredChild = registeredChild;
|
|
5760
5760
|
}
|
|
5761
5761
|
}]);
|
|
5762
|
-
}(React.PureComponent);
|
|
5762
|
+
}(React$1.PureComponent);
|
|
5763
5763
|
/**
|
|
5764
5764
|
* Determines if the specified start/stop range is visible based on the most recently rendered range.
|
|
5765
5765
|
*/
|
|
@@ -6164,7 +6164,7 @@ var List = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
6164
6164
|
scrollToIndex = _this$props.scrollToIndex,
|
|
6165
6165
|
width = _this$props.width;
|
|
6166
6166
|
var classNames = clsx('ReactVirtualized__List', className);
|
|
6167
|
-
return /*#__PURE__*/React.createElement(Grid, _extends({}, this.props, {
|
|
6167
|
+
return /*#__PURE__*/React$1.createElement(Grid, _extends({}, this.props, {
|
|
6168
6168
|
autoContainerWidth: true,
|
|
6169
6169
|
cellRenderer: this._cellRenderer,
|
|
6170
6170
|
className: classNames,
|
|
@@ -6178,7 +6178,7 @@ var List = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
6178
6178
|
}));
|
|
6179
6179
|
}
|
|
6180
6180
|
}]);
|
|
6181
|
-
}(React.PureComponent);
|
|
6181
|
+
}(React$1.PureComponent);
|
|
6182
6182
|
_defineProperty(List, "defaultProps", {
|
|
6183
6183
|
autoHeight: false,
|
|
6184
6184
|
estimatedRowSize: 30,
|
|
@@ -7098,7 +7098,7 @@ var Masonry = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7098
7098
|
}
|
|
7099
7099
|
this._startIndex = startIndex;
|
|
7100
7100
|
this._stopIndex = stopIndex;
|
|
7101
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7101
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7102
7102
|
ref: this._setScrollingContainerRef,
|
|
7103
7103
|
"aria-label": this.props['aria-label'],
|
|
7104
7104
|
className: clsx('ReactVirtualized__Masonry', className),
|
|
@@ -7117,7 +7117,7 @@ var Masonry = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7117
7117
|
willChange: 'transform'
|
|
7118
7118
|
}, style),
|
|
7119
7119
|
tabIndex: tabIndex
|
|
7120
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7120
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
7121
7121
|
className: "ReactVirtualized__Masonry__innerScrollContainer",
|
|
7122
7122
|
style: {
|
|
7123
7123
|
width: '100%',
|
|
@@ -7217,7 +7217,7 @@ var Masonry = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7217
7217
|
return null;
|
|
7218
7218
|
}
|
|
7219
7219
|
}]);
|
|
7220
|
-
}(React.PureComponent);
|
|
7220
|
+
}(React$1.PureComponent);
|
|
7221
7221
|
_defineProperty(Masonry, "defaultProps", {
|
|
7222
7222
|
autoHeight: false,
|
|
7223
7223
|
keyMapper: identity,
|
|
@@ -7405,7 +7405,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7405
7405
|
fixedRowCount = _this$props.fixedRowCount,
|
|
7406
7406
|
rowCount = _this$props.rowCount;
|
|
7407
7407
|
if (rowIndex === rowCount - fixedRowCount) {
|
|
7408
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7408
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7409
7409
|
key: rest.key,
|
|
7410
7410
|
style: _objectSpread$2(_objectSpread$2({}, rest.style), {}, {
|
|
7411
7411
|
height: SCROLLBAR_SIZE_BUFFER
|
|
@@ -7440,7 +7440,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7440
7440
|
columnCount = _this$props3.columnCount,
|
|
7441
7441
|
fixedColumnCount = _this$props3.fixedColumnCount;
|
|
7442
7442
|
if (columnIndex === columnCount - fixedColumnCount) {
|
|
7443
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7443
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7444
7444
|
key: rest.key,
|
|
7445
7445
|
style: _objectSpread$2(_objectSpread$2({}, rest.style), {}, {
|
|
7446
7446
|
width: SCROLLBAR_SIZE_BUFFER
|
|
@@ -7689,14 +7689,14 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7689
7689
|
var _this$state4 = this.state,
|
|
7690
7690
|
scrollLeft = _this$state4.scrollLeft,
|
|
7691
7691
|
scrollTop = _this$state4.scrollTop;
|
|
7692
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7692
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7693
7693
|
style: this._containerOuterStyle
|
|
7694
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7694
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
7695
7695
|
style: this._containerTopStyle
|
|
7696
7696
|
}, this._renderTopLeftGrid(rest), this._renderTopRightGrid(_objectSpread$2(_objectSpread$2({}, rest), {}, {
|
|
7697
7697
|
onScroll: onScroll,
|
|
7698
7698
|
scrollLeft: scrollLeft
|
|
7699
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
7699
|
+
}))), /*#__PURE__*/React$1.createElement("div", {
|
|
7700
7700
|
style: this._containerBottomStyle
|
|
7701
7701
|
}, this._renderBottomLeftGrid(_objectSpread$2(_objectSpread$2({}, rest), {}, {
|
|
7702
7702
|
onScroll: onScroll,
|
|
@@ -7902,7 +7902,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7902
7902
|
width = this._getLeftGridWidth(props),
|
|
7903
7903
|
scrollbarSize = this.state.showVerticalScrollbar ? this.state.scrollbarSize : 0,
|
|
7904
7904
|
gridWidth = hideBottomLeftGridScrollbar ? width + scrollbarSize : width;
|
|
7905
|
-
var bottomLeftGrid = /*#__PURE__*/React.createElement(Grid, _extends({}, props, {
|
|
7905
|
+
var bottomLeftGrid = /*#__PURE__*/React$1.createElement(Grid, _extends({}, props, {
|
|
7906
7906
|
cellRenderer: this._cellRendererBottomLeftGrid,
|
|
7907
7907
|
className: this.props.classNameBottomLeftGrid,
|
|
7908
7908
|
columnCount: fixedColumnCount,
|
|
@@ -7917,7 +7917,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7917
7917
|
width: gridWidth
|
|
7918
7918
|
}));
|
|
7919
7919
|
if (hideBottomLeftGridScrollbar) {
|
|
7920
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7920
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7921
7921
|
className: "BottomLeftGrid_ScrollWrapper",
|
|
7922
7922
|
style: _objectSpread$2(_objectSpread$2({}, this._bottomLeftGridStyle), {}, {
|
|
7923
7923
|
height: height,
|
|
@@ -7937,7 +7937,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7937
7937
|
rowCount = props.rowCount,
|
|
7938
7938
|
scrollToColumn = props.scrollToColumn,
|
|
7939
7939
|
scrollToRow = props.scrollToRow;
|
|
7940
|
-
return /*#__PURE__*/React.createElement(Grid, _extends({}, props, {
|
|
7940
|
+
return /*#__PURE__*/React$1.createElement(Grid, _extends({}, props, {
|
|
7941
7941
|
cellRenderer: this._cellRendererBottomRightGrid,
|
|
7942
7942
|
className: this.props.classNameBottomRightGrid,
|
|
7943
7943
|
columnCount: Math.max(0, columnCount - fixedColumnCount),
|
|
@@ -7963,7 +7963,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
7963
7963
|
if (!fixedColumnCount || !fixedRowCount) {
|
|
7964
7964
|
return null;
|
|
7965
7965
|
}
|
|
7966
|
-
return /*#__PURE__*/React.createElement(Grid, _extends({}, props, {
|
|
7966
|
+
return /*#__PURE__*/React$1.createElement(Grid, _extends({}, props, {
|
|
7967
7967
|
className: this.props.classNameTopLeftGrid,
|
|
7968
7968
|
columnCount: fixedColumnCount,
|
|
7969
7969
|
height: this._getTopGridHeight(props),
|
|
@@ -8001,7 +8001,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8001
8001
|
left: 0
|
|
8002
8002
|
});
|
|
8003
8003
|
}
|
|
8004
|
-
var topRightGrid = /*#__PURE__*/React.createElement(Grid, _extends({}, props, {
|
|
8004
|
+
var topRightGrid = /*#__PURE__*/React$1.createElement(Grid, _extends({}, props, {
|
|
8005
8005
|
cellRenderer: this._cellRendererTopRightGrid,
|
|
8006
8006
|
className: this.props.classNameTopRightGrid,
|
|
8007
8007
|
columnCount: Math.max(0, columnCount - fixedColumnCount) + additionalColumnCount,
|
|
@@ -8017,7 +8017,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8017
8017
|
width: width
|
|
8018
8018
|
}));
|
|
8019
8019
|
if (hideTopRightGridScrollbar) {
|
|
8020
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
8020
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
8021
8021
|
className: "TopRightGrid_ScrollWrapper",
|
|
8022
8022
|
style: _objectSpread$2(_objectSpread$2({}, this._topRightGridStyle), {}, {
|
|
8023
8023
|
height: height,
|
|
@@ -8040,7 +8040,7 @@ var MultiGrid = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8040
8040
|
return null;
|
|
8041
8041
|
}
|
|
8042
8042
|
}]);
|
|
8043
|
-
}(React.PureComponent);
|
|
8043
|
+
}(React$1.PureComponent);
|
|
8044
8044
|
_defineProperty(MultiGrid, "defaultProps", {
|
|
8045
8045
|
classNameBottomLeftGrid: '',
|
|
8046
8046
|
classNameBottomRightGrid: '',
|
|
@@ -8143,7 +8143,7 @@ var ScrollSync = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8143
8143
|
});
|
|
8144
8144
|
}
|
|
8145
8145
|
}]);
|
|
8146
|
-
}(React.PureComponent);
|
|
8146
|
+
}(React$1.PureComponent);
|
|
8147
8147
|
ScrollSync.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
8148
8148
|
/**
|
|
8149
8149
|
* Function responsible for rendering 2 or more virtualized components.
|
|
@@ -8188,7 +8188,7 @@ function defaultHeaderRowRenderer(_ref /*:: */) {
|
|
|
8188
8188
|
var className = _ref /*:: */.className,
|
|
8189
8189
|
columns = _ref /*:: */.columns,
|
|
8190
8190
|
style = _ref /*:: */.style;
|
|
8191
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
8191
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
8192
8192
|
className: className,
|
|
8193
8193
|
role: "row",
|
|
8194
8194
|
style: style
|
|
@@ -8217,16 +8217,16 @@ function SortIndicator(_ref) {
|
|
|
8217
8217
|
'ReactVirtualized__Table__sortableHeaderIcon--ASC': sortDirection === SortDirection.ASC,
|
|
8218
8218
|
'ReactVirtualized__Table__sortableHeaderIcon--DESC': sortDirection === SortDirection.DESC
|
|
8219
8219
|
});
|
|
8220
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
8220
|
+
return /*#__PURE__*/React$1.createElement("svg", {
|
|
8221
8221
|
className: classNames,
|
|
8222
8222
|
width: 18,
|
|
8223
8223
|
height: 18,
|
|
8224
8224
|
viewBox: "0 0 24 24"
|
|
8225
|
-
}, sortDirection === SortDirection.ASC ? /*#__PURE__*/React.createElement("path", {
|
|
8225
|
+
}, sortDirection === SortDirection.ASC ? /*#__PURE__*/React$1.createElement("path", {
|
|
8226
8226
|
d: "M7 14l5-5 5 5z"
|
|
8227
|
-
}) : /*#__PURE__*/React.createElement("path", {
|
|
8227
|
+
}) : /*#__PURE__*/React$1.createElement("path", {
|
|
8228
8228
|
d: "M7 10l5 5 5-5z"
|
|
8229
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
8229
|
+
}), /*#__PURE__*/React$1.createElement("path", {
|
|
8230
8230
|
d: "M0 0h24v24H0z",
|
|
8231
8231
|
fill: "none"
|
|
8232
8232
|
}));
|
|
@@ -8245,13 +8245,13 @@ function defaultHeaderRenderer(_ref /*:: */) {
|
|
|
8245
8245
|
sortBy = _ref /*:: */.sortBy,
|
|
8246
8246
|
sortDirection = _ref /*:: */.sortDirection;
|
|
8247
8247
|
var showSortIndicator = sortBy === dataKey;
|
|
8248
|
-
var children = [/*#__PURE__*/React.createElement("span", {
|
|
8248
|
+
var children = [/*#__PURE__*/React$1.createElement("span", {
|
|
8249
8249
|
className: "ReactVirtualized__Table__headerTruncatedText",
|
|
8250
8250
|
key: "label",
|
|
8251
8251
|
title: typeof label === 'string' ? label : null
|
|
8252
8252
|
}, label)];
|
|
8253
8253
|
if (showSortIndicator) {
|
|
8254
|
-
children.push(/*#__PURE__*/React.createElement(SortIndicator, {
|
|
8254
|
+
children.push(/*#__PURE__*/React$1.createElement(SortIndicator, {
|
|
8255
8255
|
key: "SortIndicator",
|
|
8256
8256
|
sortDirection: sortDirection
|
|
8257
8257
|
}));
|
|
@@ -8327,7 +8327,7 @@ function defaultRowRenderer(_ref /*:: */) {
|
|
|
8327
8327
|
};
|
|
8328
8328
|
}
|
|
8329
8329
|
}
|
|
8330
|
-
return /*#__PURE__*/React.createElement("div", _extends({}, a11yProps, {
|
|
8330
|
+
return /*#__PURE__*/React$1.createElement("div", _extends({}, a11yProps, {
|
|
8331
8331
|
className: className,
|
|
8332
8332
|
key: key,
|
|
8333
8333
|
role: "row",
|
|
@@ -8348,7 +8348,7 @@ var Column = /*#__PURE__*/function (_React$Component) {
|
|
|
8348
8348
|
}
|
|
8349
8349
|
_inherits(Column, _React$Component);
|
|
8350
8350
|
return _createClass(Column);
|
|
8351
|
-
}(React.Component);
|
|
8351
|
+
}(React$1.Component);
|
|
8352
8352
|
_defineProperty(Column, "defaultProps", {
|
|
8353
8353
|
cellDataGetter: defaultCellDataGetter,
|
|
8354
8354
|
cellRenderer: defaultCellRenderer,
|
|
@@ -8587,7 +8587,7 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8587
8587
|
|
|
8588
8588
|
// Precompute and cache column styles before rendering rows and columns to speed things up
|
|
8589
8589
|
this._cachedColumnStyles = [];
|
|
8590
|
-
React.Children.toArray(children).forEach(function (column, index) {
|
|
8590
|
+
React$1.Children.toArray(children).forEach(function (column, index) {
|
|
8591
8591
|
var flexStyles = _this2._getFlexStyleForColumn(column, column.props.style || Column.defaultProps.style);
|
|
8592
8592
|
_this2._cachedColumnStyles[index] = _objectSpread$1({
|
|
8593
8593
|
overflow: 'hidden'
|
|
@@ -8597,10 +8597,10 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8597
8597
|
// Note that we specify :rowCount, :scrollbarWidth, :sortBy, and :sortDirection as properties on Grid even though these have nothing to do with Grid.
|
|
8598
8598
|
// This is done because Grid is a pure component and won't update unless its properties or state has changed.
|
|
8599
8599
|
// Any property that should trigger a re-render of Grid then is specified here to avoid a stale display.
|
|
8600
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
8600
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
8601
8601
|
"aria-label": this.props['aria-label'],
|
|
8602
8602
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
8603
|
-
"aria-colcount": React.Children.toArray(children).length,
|
|
8603
|
+
"aria-colcount": React$1.Children.toArray(children).length,
|
|
8604
8604
|
"aria-rowcount": this.props.rowCount,
|
|
8605
8605
|
className: clsx('ReactVirtualized__Table', className),
|
|
8606
8606
|
id: id,
|
|
@@ -8615,7 +8615,7 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8615
8615
|
paddingRight: scrollbarWidth,
|
|
8616
8616
|
width: width
|
|
8617
8617
|
}, rowStyleObject)
|
|
8618
|
-
}), /*#__PURE__*/React.createElement(Grid, _extends({}, this.props, {
|
|
8618
|
+
}), /*#__PURE__*/React$1.createElement(Grid, _extends({}, this.props, {
|
|
8619
8619
|
elementRef: this._setGridElementRef,
|
|
8620
8620
|
"aria-readonly": null,
|
|
8621
8621
|
autoContainerWidth: true,
|
|
@@ -8682,7 +8682,7 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8682
8682
|
// Avoid using object-spread syntax with multiple objects here,
|
|
8683
8683
|
// Since it results in an extra method call to 'babel-runtime/helpers/extends'
|
|
8684
8684
|
// See PR https://github.com/bvaughn/react-virtualized/pull/942
|
|
8685
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
8685
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
8686
8686
|
"aria-colindex": columnIndex + 1,
|
|
8687
8687
|
"aria-describedby": id,
|
|
8688
8688
|
className: clsx('ReactVirtualized__Table__rowColumn', className),
|
|
@@ -8765,7 +8765,7 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8765
8765
|
// Avoid using object-spread syntax with multiple objects here,
|
|
8766
8766
|
// Since it results in an extra method call to 'babel-runtime/helpers/extends'
|
|
8767
8767
|
// See PR https://github.com/bvaughn/react-virtualized/pull/942
|
|
8768
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
8768
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
8769
8769
|
"aria-label": headerAriaLabel,
|
|
8770
8770
|
"aria-sort": headerAriaSort,
|
|
8771
8771
|
className: classNames,
|
|
@@ -8808,7 +8808,7 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8808
8808
|
var rowData = rowGetter({
|
|
8809
8809
|
index: index
|
|
8810
8810
|
});
|
|
8811
|
-
var columns = React.Children.toArray(children).map(function (column, columnIndex) {
|
|
8811
|
+
var columns = React$1.Children.toArray(children).map(function (column, columnIndex) {
|
|
8812
8812
|
return _this3._createColumn({
|
|
8813
8813
|
column: column,
|
|
8814
8814
|
columnIndex: columnIndex,
|
|
@@ -8869,7 +8869,7 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8869
8869
|
var _this$props4 = this.props,
|
|
8870
8870
|
children = _this$props4.children,
|
|
8871
8871
|
disableHeader = _this$props4.disableHeader;
|
|
8872
|
-
var items = disableHeader ? [] : React.Children.toArray(children);
|
|
8872
|
+
var items = disableHeader ? [] : React$1.Children.toArray(children);
|
|
8873
8873
|
return items.map(function (column, index) {
|
|
8874
8874
|
return _this4._createHeader({
|
|
8875
8875
|
column: column,
|
|
@@ -8932,7 +8932,7 @@ var Table$1 = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
8932
8932
|
});
|
|
8933
8933
|
}
|
|
8934
8934
|
}]);
|
|
8935
|
-
}(React.PureComponent);
|
|
8935
|
+
}(React$1.PureComponent);
|
|
8936
8936
|
_defineProperty(Table$1, "defaultProps", {
|
|
8937
8937
|
disableHeader: false,
|
|
8938
8938
|
estimatedRowSize: 30,
|
|
@@ -8968,7 +8968,7 @@ Table$1.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
8968
8968
|
autoHeight: PropTypes.bool,
|
|
8969
8969
|
/** One or more Columns describing the data displayed in this row */
|
|
8970
8970
|
children: function children(props) {
|
|
8971
|
-
var children = React.Children.toArray(props.children);
|
|
8971
|
+
var children = React$1.Children.toArray(props.children);
|
|
8972
8972
|
for (var i = 0; i < children.length; i++) {
|
|
8973
8973
|
var childType = children[i].type;
|
|
8974
8974
|
if (childType !== Column && !(childType.prototype instanceof Column)) {
|
|
@@ -9347,7 +9347,7 @@ var WindowScroller = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
9347
9347
|
_defineProperty(_this, "_positionFromLeft", 0);
|
|
9348
9348
|
_defineProperty(_this, "_detectElementResize", void 0);
|
|
9349
9349
|
_defineProperty(_this, "_child", void 0);
|
|
9350
|
-
_defineProperty(_this, "_windowScrollerRef", /*#__PURE__*/React.createRef());
|
|
9350
|
+
_defineProperty(_this, "_windowScrollerRef", /*#__PURE__*/React$1.createRef());
|
|
9351
9351
|
_defineProperty(_this, "state", _objectSpread(_objectSpread({}, getDimensions(_this.props.scrollElement, _this.props)), {}, {
|
|
9352
9352
|
isScrolling: false,
|
|
9353
9353
|
scrollLeft: 0,
|
|
@@ -9497,7 +9497,7 @@ var WindowScroller = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
9497
9497
|
scrollLeft = _this$state2.scrollLeft,
|
|
9498
9498
|
height = _this$state2.height,
|
|
9499
9499
|
width = _this$state2.width;
|
|
9500
|
-
return /*#__PURE__*/React.createElement('div', {
|
|
9500
|
+
return /*#__PURE__*/React$1.createElement('div', {
|
|
9501
9501
|
ref: this._windowScrollerRef
|
|
9502
9502
|
}, children({
|
|
9503
9503
|
onChildScroll: this._onChildScroll,
|
|
@@ -9510,7 +9510,7 @@ var WindowScroller = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
9510
9510
|
}));
|
|
9511
9511
|
}
|
|
9512
9512
|
}]);
|
|
9513
|
-
}(React.PureComponent);
|
|
9513
|
+
}(React$1.PureComponent);
|
|
9514
9514
|
_defineProperty(WindowScroller, "defaultProps", {
|
|
9515
9515
|
onResize: function onResize() {},
|
|
9516
9516
|
onScroll: function onScroll() {},
|
|
@@ -9590,7 +9590,8 @@ const DraggableRow = ({
|
|
|
9590
9590
|
index,
|
|
9591
9591
|
moveRow,
|
|
9592
9592
|
children,
|
|
9593
|
-
|
|
9593
|
+
row,
|
|
9594
|
+
tableId,
|
|
9594
9595
|
enableDrag,
|
|
9595
9596
|
listRef
|
|
9596
9597
|
}) => {
|
|
@@ -9599,7 +9600,6 @@ const DraggableRow = ({
|
|
|
9599
9600
|
accept: ITEM_TYPE,
|
|
9600
9601
|
hover(draggedItem, monitor) {
|
|
9601
9602
|
if (!ref.current || !enableDrag) return;
|
|
9602
|
-
ref.current.getBoundingClientRect();
|
|
9603
9603
|
const clientOffset = monitor.getClientOffset();
|
|
9604
9604
|
|
|
9605
9605
|
// Auto-scroll logic
|
|
@@ -9629,23 +9629,31 @@ const DraggableRow = ({
|
|
|
9629
9629
|
}, drag] = useDrag({
|
|
9630
9630
|
type: ITEM_TYPE,
|
|
9631
9631
|
item: {
|
|
9632
|
-
index
|
|
9632
|
+
index,
|
|
9633
|
+
row,
|
|
9634
|
+
sourceTableId: tableId
|
|
9633
9635
|
},
|
|
9634
9636
|
canDrag: enableDrag,
|
|
9635
9637
|
collect: monitor => ({
|
|
9636
9638
|
isDragging: monitor.isDragging()
|
|
9637
9639
|
})
|
|
9638
9640
|
});
|
|
9639
|
-
drag
|
|
9641
|
+
// Compose drag & drop refs in effect to avoid reading ref during render
|
|
9642
|
+
const setRef = useCallback(node => {
|
|
9643
|
+
if (node) {
|
|
9644
|
+
ref.current = node;
|
|
9645
|
+
drag(drop(node));
|
|
9646
|
+
}
|
|
9647
|
+
}, [drag, drop]);
|
|
9640
9648
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
9641
|
-
ref:
|
|
9649
|
+
ref: setRef,
|
|
9642
9650
|
style: {
|
|
9643
9651
|
opacity: isDragging ? 0.5 : 1,
|
|
9644
9652
|
cursor: enableDrag ? "move" : "default"
|
|
9645
9653
|
}
|
|
9646
9654
|
}, children);
|
|
9647
9655
|
};
|
|
9648
|
-
function
|
|
9656
|
+
function TableInner({
|
|
9649
9657
|
tableId = "default",
|
|
9650
9658
|
columns = [],
|
|
9651
9659
|
data = [],
|
|
@@ -9662,7 +9670,12 @@ function Table({
|
|
|
9662
9670
|
deleteCallback = null,
|
|
9663
9671
|
buttons = ["view", "edit", "delete"],
|
|
9664
9672
|
enableDragRow = false,
|
|
9665
|
-
enableSearchUrlParam = false
|
|
9673
|
+
enableSearchUrlParam = false,
|
|
9674
|
+
enableMultiSelect = false,
|
|
9675
|
+
enableExternalRowDrop = false,
|
|
9676
|
+
onExternalRowDrop = () => {},
|
|
9677
|
+
useExternalDndContext = false,
|
|
9678
|
+
customColumns = []
|
|
9666
9679
|
}) {
|
|
9667
9680
|
// Local selection & sorting state (removed TableContext dependency)
|
|
9668
9681
|
const [selectedRows, setSelectedRows] = useState([]);
|
|
@@ -9800,7 +9813,7 @@ function Table({
|
|
|
9800
9813
|
const toggleGroup = gid => {
|
|
9801
9814
|
setExpandedGroups(prev => ({
|
|
9802
9815
|
...prev,
|
|
9803
|
-
[gid]: !
|
|
9816
|
+
[gid]: !prev[gid]
|
|
9804
9817
|
}));
|
|
9805
9818
|
};
|
|
9806
9819
|
useEffect(() => {
|
|
@@ -9913,40 +9926,90 @@ function Table({
|
|
|
9913
9926
|
const showDelete = buttons.includes("delete");
|
|
9914
9927
|
const showActions = showView || showEdit || showDelete;
|
|
9915
9928
|
|
|
9916
|
-
// MOVE ROW
|
|
9917
|
-
|
|
9929
|
+
// MOVE ROW (internal + between groups)
|
|
9930
|
+
// moveRow: allow toIndex to be null or an object { emptyGroupId } for empty group drop
|
|
9931
|
+
const moveRow = useCallback((fromIndex, toIndexOrGroup) => {
|
|
9918
9932
|
const from = tableDataFlat[fromIndex];
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9933
|
+
let to = null;
|
|
9934
|
+
let emptyGroupId = null;
|
|
9935
|
+
if (typeof toIndexOrGroup === 'object' && toIndexOrGroup && toIndexOrGroup.emptyGroupId) {
|
|
9936
|
+
emptyGroupId = toIndexOrGroup.emptyGroupId;
|
|
9937
|
+
} else {
|
|
9938
|
+
to = tableDataFlat[toIndexOrGroup];
|
|
9939
|
+
}
|
|
9940
|
+
if (!from || from.type !== "row" || toIndexOrGroup !== null && !to && !emptyGroupId) return;
|
|
9924
9941
|
setLocalData(prev => {
|
|
9925
9942
|
if (isGrouped) {
|
|
9926
|
-
//
|
|
9927
|
-
|
|
9928
|
-
|
|
9943
|
+
// Remove from old group
|
|
9944
|
+
let movedRow;
|
|
9945
|
+
const newGroups = prev.map(group => {
|
|
9929
9946
|
const groupId = group[groupKey] ?? group.groupId ?? group.groupName;
|
|
9930
|
-
if (groupId
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
}
|
|
9947
|
+
if (groupId === from.groupId) {
|
|
9948
|
+
const rows = [...group.rows];
|
|
9949
|
+
const fromPos = rows.findIndex(r => r.id === from.row.id);
|
|
9950
|
+
if (fromPos !== -1) {
|
|
9951
|
+
[movedRow] = rows.splice(fromPos, 1);
|
|
9952
|
+
}
|
|
9953
|
+
return {
|
|
9954
|
+
...group,
|
|
9955
|
+
rows
|
|
9956
|
+
};
|
|
9957
|
+
}
|
|
9958
|
+
return group;
|
|
9959
|
+
});
|
|
9960
|
+
if (!movedRow) return prev;
|
|
9961
|
+
// Insert into new group at correct position
|
|
9962
|
+
return newGroups.map(group => {
|
|
9963
|
+
const groupId = group[groupKey] ?? group.groupId ?? group.groupName;
|
|
9964
|
+
// If dropping into empty group
|
|
9965
|
+
if (emptyGroupId && groupId === emptyGroupId) {
|
|
9966
|
+
const rows = [...group.rows];
|
|
9967
|
+
if (groupKey && movedRow[groupKey] !== undefined) {
|
|
9968
|
+
movedRow = {
|
|
9969
|
+
...movedRow,
|
|
9970
|
+
[groupKey]: groupId
|
|
9971
|
+
};
|
|
9972
|
+
}
|
|
9973
|
+
rows.push(movedRow);
|
|
9974
|
+
return {
|
|
9975
|
+
...group,
|
|
9976
|
+
rows
|
|
9977
|
+
};
|
|
9978
|
+
}
|
|
9979
|
+
// Normal drop
|
|
9980
|
+
if (to && groupId === to.groupId) {
|
|
9981
|
+
const rows = [...group.rows];
|
|
9982
|
+
const toPos = rows.findIndex(r => r.id === to.row.id);
|
|
9983
|
+
if (groupKey && movedRow[groupKey] !== undefined) {
|
|
9984
|
+
movedRow = {
|
|
9985
|
+
...movedRow,
|
|
9986
|
+
[groupKey]: groupId
|
|
9987
|
+
};
|
|
9988
|
+
}
|
|
9989
|
+
if (toPos === -1) {
|
|
9990
|
+
rows.push(movedRow);
|
|
9991
|
+
} else {
|
|
9992
|
+
rows.splice(toPos, 0, movedRow);
|
|
9993
|
+
}
|
|
9994
|
+
return {
|
|
9995
|
+
...group,
|
|
9996
|
+
rows
|
|
9997
|
+
};
|
|
9998
|
+
}
|
|
9999
|
+
return group;
|
|
9941
10000
|
});
|
|
9942
10001
|
} else {
|
|
9943
10002
|
// Ungrouped: reorder the flat list
|
|
9944
10003
|
const arr = Array.isArray(prev) ? [...prev] : [];
|
|
9945
10004
|
const fromPos = arr.findIndex(r => r.id === from.row.id);
|
|
9946
|
-
const toPos = arr.findIndex(r => r.id === to.row.id);
|
|
9947
|
-
if (fromPos === -1 || toPos === -1) return prev;
|
|
10005
|
+
const toPos = to ? arr.findIndex(r => r.id === to.row.id) : -1;
|
|
10006
|
+
if (fromPos === -1 || to && toPos === -1) return prev;
|
|
9948
10007
|
const [moved] = arr.splice(fromPos, 1);
|
|
9949
|
-
|
|
10008
|
+
if (to) {
|
|
10009
|
+
arr.splice(toPos, 0, moved);
|
|
10010
|
+
} else {
|
|
10011
|
+
arr.push(moved);
|
|
10012
|
+
}
|
|
9950
10013
|
return arr;
|
|
9951
10014
|
}
|
|
9952
10015
|
});
|
|
@@ -9964,12 +10027,81 @@ function Table({
|
|
|
9964
10027
|
const gid = item.groupId;
|
|
9965
10028
|
const rows = groupRowsById[gid] || [];
|
|
9966
10029
|
const allSelected = rows.length > 0 && rows.every(r => selectedRows.includes(r.id));
|
|
10030
|
+
|
|
10031
|
+
// If expanded and group is empty and drag enabled, make the group header itself a drop target
|
|
10032
|
+
if (item.expanded && rows.length === 0 && enableDragRow) {
|
|
10033
|
+
// For empty group, drop target pushes into this group
|
|
10034
|
+
const GroupHeaderDrop = () => {
|
|
10035
|
+
const ref = useRef(null);
|
|
10036
|
+
const [, drop] = useDrop({
|
|
10037
|
+
accept: ITEM_TYPE,
|
|
10038
|
+
drop(draggedItem) {
|
|
10039
|
+
if (draggedItem && typeof draggedItem.index === "number") {
|
|
10040
|
+
moveRow(draggedItem.index, {
|
|
10041
|
+
emptyGroupId: gid
|
|
10042
|
+
});
|
|
10043
|
+
}
|
|
10044
|
+
},
|
|
10045
|
+
canDrop: () => true,
|
|
10046
|
+
collect: monitor => ({
|
|
10047
|
+
isOver: monitor.isOver(),
|
|
10048
|
+
canDrop: monitor.canDrop()
|
|
10049
|
+
})
|
|
10050
|
+
});
|
|
10051
|
+
drop(ref);
|
|
10052
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
10053
|
+
ref: ref,
|
|
10054
|
+
key: key,
|
|
10055
|
+
style: {
|
|
10056
|
+
...style,
|
|
10057
|
+
background: '#f6f6fa',
|
|
10058
|
+
border: '2px dashed #bbb',
|
|
10059
|
+
textAlign: 'center',
|
|
10060
|
+
color: '#888',
|
|
10061
|
+
minHeight: rowHeight,
|
|
10062
|
+
display: 'flex',
|
|
10063
|
+
alignItems: 'center'
|
|
10064
|
+
},
|
|
10065
|
+
className: "table-row group-row empty-group-drop",
|
|
10066
|
+
onClick: () => toggleGroup(gid)
|
|
10067
|
+
}, enableMultiSelect && showDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
10068
|
+
className: "table-cell checkbox-cell"
|
|
10069
|
+
}, /*#__PURE__*/React__default.createElement("input", {
|
|
10070
|
+
type: "checkbox",
|
|
10071
|
+
checked: allSelected,
|
|
10072
|
+
onChange: e => {
|
|
10073
|
+
e.stopPropagation();
|
|
10074
|
+
const ids = rows.map(r => r.id);
|
|
10075
|
+
if (allSelected) {
|
|
10076
|
+
setSelectedRows(prev => prev.filter(id => !ids.includes(id)));
|
|
10077
|
+
} else {
|
|
10078
|
+
setSelectedRows(prev => [...prev, ...ids.filter(id => !prev.includes(id))]);
|
|
10079
|
+
}
|
|
10080
|
+
},
|
|
10081
|
+
onClick: e => e.stopPropagation()
|
|
10082
|
+
})), showKey && /*#__PURE__*/React__default.createElement("div", {
|
|
10083
|
+
className: "table-cell key-cell"
|
|
10084
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
10085
|
+
className: "table-cell group-header",
|
|
10086
|
+
style: {
|
|
10087
|
+
width: '100%'
|
|
10088
|
+
}
|
|
10089
|
+
}, item.expanded ? "▾" : "▸", " ", item.groupName, " (0) \u2014 Drop here to move into this group"), columns.slice(1).map((_, i) => /*#__PURE__*/React__default.createElement("div", {
|
|
10090
|
+
key: i,
|
|
10091
|
+
className: "table-cell"
|
|
10092
|
+
})), showActions && /*#__PURE__*/React__default.createElement("div", {
|
|
10093
|
+
className: "table-cell action-cell"
|
|
10094
|
+
}));
|
|
10095
|
+
};
|
|
10096
|
+
return /*#__PURE__*/React__default.createElement(GroupHeaderDrop, null);
|
|
10097
|
+
}
|
|
10098
|
+
// Default: normal group header
|
|
9967
10099
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
9968
10100
|
key: key,
|
|
9969
10101
|
style: style,
|
|
9970
10102
|
className: "table-row group-row",
|
|
9971
10103
|
onClick: () => toggleGroup(gid)
|
|
9972
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
10104
|
+
}, enableMultiSelect && showDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
9973
10105
|
className: "table-cell checkbox-cell"
|
|
9974
10106
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
9975
10107
|
type: "checkbox",
|
|
@@ -9977,7 +10109,11 @@ function Table({
|
|
|
9977
10109
|
onChange: e => {
|
|
9978
10110
|
e.stopPropagation();
|
|
9979
10111
|
const ids = rows.map(r => r.id);
|
|
9980
|
-
|
|
10112
|
+
if (allSelected) {
|
|
10113
|
+
setSelectedRows(prev => prev.filter(id => !ids.includes(id)));
|
|
10114
|
+
} else {
|
|
10115
|
+
setSelectedRows(prev => [...prev, ...ids.filter(id => !prev.includes(id))]);
|
|
10116
|
+
}
|
|
9981
10117
|
},
|
|
9982
10118
|
onClick: e => e.stopPropagation()
|
|
9983
10119
|
})), showKey && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -9993,11 +10129,25 @@ function Table({
|
|
|
9993
10129
|
}
|
|
9994
10130
|
const row = item.row;
|
|
9995
10131
|
const visualIndex = tableDataFlat.slice(0, index).filter(i => i.type === "row").length + 1;
|
|
10132
|
+
|
|
10133
|
+
// Compose columns + custom columns
|
|
10134
|
+
const allColumns = [...columns];
|
|
10135
|
+
// Insert custom columns at specified places
|
|
10136
|
+
if (Array.isArray(customColumns)) {
|
|
10137
|
+
customColumns.forEach(col => {
|
|
10138
|
+
if (typeof col.place === 'number') {
|
|
10139
|
+
allColumns.splice(col.place, 0, {
|
|
10140
|
+
...col,
|
|
10141
|
+
isCustom: true
|
|
10142
|
+
});
|
|
10143
|
+
}
|
|
10144
|
+
});
|
|
10145
|
+
}
|
|
9996
10146
|
const content = /*#__PURE__*/React__default.createElement("div", {
|
|
9997
10147
|
key: key,
|
|
9998
10148
|
style: style,
|
|
9999
10149
|
className: "table-row"
|
|
10000
|
-
}, showDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
10150
|
+
}, enableMultiSelect && showDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
10001
10151
|
className: "table-cell checkbox-cell"
|
|
10002
10152
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
10003
10153
|
type: "checkbox",
|
|
@@ -10005,10 +10155,22 @@ function Table({
|
|
|
10005
10155
|
onChange: () => toggleRowSelection(row.id)
|
|
10006
10156
|
})), showKey && /*#__PURE__*/React__default.createElement("div", {
|
|
10007
10157
|
className: "table-cell key-cell"
|
|
10008
|
-
}, visualIndex),
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10158
|
+
}, visualIndex), allColumns.map((col, i) => {
|
|
10159
|
+
let cellStyle = col.isCustom && col.style ? {
|
|
10160
|
+
...col.style
|
|
10161
|
+
} : undefined;
|
|
10162
|
+
if (col.isCustom && col.style && col.style.width) {
|
|
10163
|
+
cellStyle = cellStyle || {};
|
|
10164
|
+
cellStyle.minWidth = col.style.width;
|
|
10165
|
+
cellStyle.maxWidth = col.style.width;
|
|
10166
|
+
cellStyle.width = col.style.width;
|
|
10167
|
+
}
|
|
10168
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
10169
|
+
key: i,
|
|
10170
|
+
className: "table-cell",
|
|
10171
|
+
style: cellStyle
|
|
10172
|
+
}, col.isCustom ? typeof col.render === 'function' ? col.render(row, i) : col.render : renderCell(row[col.accessor], col.accessor, row));
|
|
10173
|
+
}), showActions && /*#__PURE__*/React__default.createElement("div", {
|
|
10012
10174
|
className: "table-cell action-cell"
|
|
10013
10175
|
}, showView && /*#__PURE__*/React__default.createElement("button", {
|
|
10014
10176
|
className: "action-btn-table",
|
|
@@ -10038,20 +10200,59 @@ function Table({
|
|
|
10038
10200
|
key: key,
|
|
10039
10201
|
index: index,
|
|
10040
10202
|
moveRow: moveRow,
|
|
10041
|
-
|
|
10203
|
+
row: row,
|
|
10204
|
+
tableId: tableId,
|
|
10042
10205
|
enableDrag: true,
|
|
10043
10206
|
listRef: listRef
|
|
10044
10207
|
}, content);
|
|
10045
10208
|
}
|
|
10046
10209
|
return content;
|
|
10047
|
-
}, [tableDataFlat, columns, selectedRows, toggleRowSelection, groupRowsById, renderCell, showActions, showDelete, showEdit, showKey, showView,
|
|
10210
|
+
}, [tableDataFlat, columns, selectedRows, toggleRowSelection, groupRowsById, renderCell, showActions, showDelete, showEdit, showKey, showView, viewCallback, editCallback, enableDragRow, moveRow, enableMultiSelect, rowHeight, tableId, customColumns]);
|
|
10048
10211
|
const rowHeightGetter = ({
|
|
10049
10212
|
index
|
|
10050
10213
|
}) => tableDataFlat[index]?.type === "group" ? groupHeaderHeight : rowHeight;
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10214
|
+
|
|
10215
|
+
// Table-level drop target only when using external DnD context
|
|
10216
|
+
const tableContainerRef = useRef(null);
|
|
10217
|
+
const [{
|
|
10218
|
+
isOver: isExternalOver,
|
|
10219
|
+
canDrop: canExternalDrop
|
|
10220
|
+
}, externalDrop] = useDrop({
|
|
10221
|
+
accept: ITEM_TYPE,
|
|
10222
|
+
drop: draggedItem => {
|
|
10223
|
+
if (!useExternalDndContext) return; // safety
|
|
10224
|
+
if (!enableExternalRowDrop || isGrouped) return;
|
|
10225
|
+
if (!draggedItem || draggedItem.sourceTableId === tableId) return;
|
|
10226
|
+
onExternalRowDrop(draggedItem.row, draggedItem.sourceTableId, tableId);
|
|
10227
|
+
}
|
|
10228
|
+
});
|
|
10229
|
+
const setTableRef = useCallback(node => {
|
|
10230
|
+
tableContainerRef.current = node;
|
|
10231
|
+
if (node && useExternalDndContext && enableExternalRowDrop) {
|
|
10232
|
+
externalDrop(node);
|
|
10233
|
+
}
|
|
10234
|
+
}, [useExternalDndContext, enableExternalRowDrop, externalDrop]);
|
|
10235
|
+
|
|
10236
|
+
// Compose columns + custom columns for header
|
|
10237
|
+
const allColumns = [...columns];
|
|
10238
|
+
if (Array.isArray(customColumns)) {
|
|
10239
|
+
customColumns.forEach(col => {
|
|
10240
|
+
if (typeof col.place === 'number') {
|
|
10241
|
+
allColumns.splice(col.place, 0, {
|
|
10242
|
+
...col,
|
|
10243
|
+
isCustom: true
|
|
10244
|
+
});
|
|
10245
|
+
}
|
|
10246
|
+
});
|
|
10247
|
+
}
|
|
10248
|
+
const tableMarkup = /*#__PURE__*/React__default.createElement("div", {
|
|
10249
|
+
className: "table-container",
|
|
10250
|
+
ref: setTableRef,
|
|
10251
|
+
style: useExternalDndContext && enableExternalRowDrop ? {
|
|
10252
|
+
transition: 'background 0.15s',
|
|
10253
|
+
background: isExternalOver && canExternalDrop ? 'rgba(100,108,255,0.15)' : undefined,
|
|
10254
|
+
outline: isExternalOver && canExternalDrop ? '2px dashed #646cff' : undefined
|
|
10255
|
+
} : undefined
|
|
10055
10256
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
10056
10257
|
className: "table-header",
|
|
10057
10258
|
style: {
|
|
@@ -10062,7 +10263,7 @@ function Table({
|
|
|
10062
10263
|
}
|
|
10063
10264
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
10064
10265
|
className: "table-row header-row"
|
|
10065
|
-
}, showDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
10266
|
+
}, enableMultiSelect && showDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
10066
10267
|
className: "table-cell checkbox-cell"
|
|
10067
10268
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
10068
10269
|
type: "checkbox",
|
|
@@ -10077,14 +10278,29 @@ function Table({
|
|
|
10077
10278
|
}
|
|
10078
10279
|
})), showKey && /*#__PURE__*/React__default.createElement("div", {
|
|
10079
10280
|
className: "table-cell key-cell"
|
|
10080
|
-
}, "#"),
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10281
|
+
}, "#"), allColumns.map((col, i) => {
|
|
10282
|
+
// For custom columns, apply width and textAlign to header cell
|
|
10283
|
+
let cellStyle = col.isCustom && col.style ? {
|
|
10284
|
+
...col.style,
|
|
10285
|
+
cursor: undefined,
|
|
10286
|
+
display: 'flex',
|
|
10287
|
+
alignItems: 'center',
|
|
10288
|
+
justifyContent: col.style.textAlign === 'center' ? 'center' : col.style.textAlign === 'right' ? 'flex-end' : 'flex-start'
|
|
10289
|
+
} : {
|
|
10290
|
+
cursor: col.isCustom ? undefined : "pointer"
|
|
10291
|
+
};
|
|
10292
|
+
if (col.isCustom && col.style && col.style.width) {
|
|
10293
|
+
cellStyle.minWidth = col.style.width;
|
|
10294
|
+
cellStyle.maxWidth = col.style.width;
|
|
10295
|
+
cellStyle.width = col.style.width;
|
|
10086
10296
|
}
|
|
10087
|
-
|
|
10297
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
10298
|
+
key: i,
|
|
10299
|
+
className: "table-cell",
|
|
10300
|
+
style: cellStyle,
|
|
10301
|
+
onClick: col.isCustom ? undefined : () => setSort(col.accessor)
|
|
10302
|
+
}, col.isCustom ? col.header ?? '' : col.header, !col.isCustom && sorting?.column === col.accessor && (sorting.direction === "asc" ? " ↑" : " ↓"));
|
|
10303
|
+
}), showActions && /*#__PURE__*/React__default.createElement("div", {
|
|
10088
10304
|
className: "table-cell action-cell"
|
|
10089
10305
|
}, "Action"))), /*#__PURE__*/React__default.createElement("div", {
|
|
10090
10306
|
className: "main-table",
|
|
@@ -10110,11 +10326,65 @@ function Table({
|
|
|
10110
10326
|
cancelLabel: "Cancel",
|
|
10111
10327
|
showCancel: true,
|
|
10112
10328
|
showConfirm: true
|
|
10113
|
-
}, /*#__PURE__*/React__default.createElement("p", null, "Are you sure you want to delete ", /*#__PURE__*/React__default.createElement("strong", null, pendingDelete?.name || pendingDelete?.id), "?")))
|
|
10329
|
+
}, /*#__PURE__*/React__default.createElement("p", null, "Are you sure you want to delete ", /*#__PURE__*/React__default.createElement("strong", null, pendingDelete?.name || pendingDelete?.id), "?")));
|
|
10330
|
+
return tableMarkup;
|
|
10331
|
+
}
|
|
10332
|
+
function Table(props) {
|
|
10333
|
+
const {
|
|
10334
|
+
useExternalDndContext = false
|
|
10335
|
+
} = props;
|
|
10336
|
+
if (useExternalDndContext) {
|
|
10337
|
+
return /*#__PURE__*/React__default.createElement(TableInner, props);
|
|
10338
|
+
}
|
|
10339
|
+
// Provide DnD context when not supplied externally
|
|
10340
|
+
return /*#__PURE__*/React__default.createElement(DndProvider, {
|
|
10341
|
+
backend: HTML5Backend
|
|
10342
|
+
}, /*#__PURE__*/React__default.createElement(TableInner, props));
|
|
10343
|
+
}
|
|
10344
|
+
|
|
10345
|
+
function Switch({
|
|
10346
|
+
checked,
|
|
10347
|
+
onChange
|
|
10348
|
+
}) {
|
|
10349
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
10350
|
+
style: {
|
|
10351
|
+
display: "inline-flex",
|
|
10352
|
+
alignItems: "center",
|
|
10353
|
+
cursor: "pointer"
|
|
10354
|
+
}
|
|
10355
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
10356
|
+
type: "checkbox",
|
|
10357
|
+
checked: checked,
|
|
10358
|
+
onChange: onChange,
|
|
10359
|
+
style: {
|
|
10360
|
+
display: "none"
|
|
10361
|
+
}
|
|
10362
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
10363
|
+
style: {
|
|
10364
|
+
width: 36,
|
|
10365
|
+
height: 20,
|
|
10366
|
+
background: checked ? "#4caf50" : "#ccc",
|
|
10367
|
+
borderRadius: 12,
|
|
10368
|
+
position: "relative",
|
|
10369
|
+
transition: "background 0.2s",
|
|
10370
|
+
display: "inline-block"
|
|
10371
|
+
}
|
|
10372
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
10373
|
+
style: {
|
|
10374
|
+
position: "absolute",
|
|
10375
|
+
left: checked ? 18 : 2,
|
|
10376
|
+
top: 2,
|
|
10377
|
+
width: 16,
|
|
10378
|
+
height: 16,
|
|
10379
|
+
background: "#fff",
|
|
10380
|
+
borderRadius: "50%",
|
|
10381
|
+
transition: "left 0.2s"
|
|
10382
|
+
}
|
|
10383
|
+
})));
|
|
10114
10384
|
}
|
|
10115
10385
|
|
|
10116
10386
|
// src/index.js
|
|
10117
|
-
//
|
|
10387
|
+
// named exports for both
|
|
10118
10388
|
|
|
10119
|
-
export { Table, Table as default };
|
|
10389
|
+
export { Switch, Table, Table as default };
|
|
10120
10390
|
//# sourceMappingURL=index.esm.js.map
|