@helpdice/ui 1.3.1 → 1.3.2
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.js +90 -32
- package/dist/table/data-table.d.ts +4 -1
- package/dist/table/index.js +571 -193
- package/dist/table/table-head.d.ts +1 -0
- package/dist/table/table-types.d.ts +1 -0
- package/dist/table/table.d.ts +4 -0
- package/esm/table/data-table.d.ts +4 -1
- package/esm/table/data-table.js +45 -16
- package/esm/table/table-head.d.ts +1 -0
- package/esm/table/table-head.js +12 -11
- package/esm/table/table-types.d.ts +1 -0
- package/esm/table/table.d.ts +4 -0
- package/esm/table/table.js +32 -2
- package/package.json +1 -1
package/dist/table/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var reactDom = require('react-dom');
|
|
7
|
+
var Popover = require('components/popover');
|
|
7
8
|
|
|
8
9
|
function _interopNamespaceDefault(e) {
|
|
9
10
|
var n = Object.create(null);
|
|
@@ -1141,7 +1142,7 @@ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingL
|
|
|
1141
1142
|
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
1142
1143
|
return "".concat(scale1x);
|
|
1143
1144
|
};
|
|
1144
|
-
var defaultContext$
|
|
1145
|
+
var defaultContext$4 = {
|
|
1145
1146
|
getScaleProps: function getScaleProps() {
|
|
1146
1147
|
return undefined;
|
|
1147
1148
|
},
|
|
@@ -1167,7 +1168,7 @@ var defaultContext$3 = {
|
|
|
1167
1168
|
},
|
|
1168
1169
|
unit: '16px'
|
|
1169
1170
|
};
|
|
1170
|
-
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$
|
|
1171
|
+
var ScaleContext = /*#__PURE__*/React.createContext(defaultContext$4);
|
|
1171
1172
|
var useScale = function useScale() {
|
|
1172
1173
|
return React.useContext(ScaleContext);
|
|
1173
1174
|
};
|
|
@@ -1177,6 +1178,19 @@ var useScale = function useScale() {
|
|
|
1177
1178
|
var getId = function getId() {
|
|
1178
1179
|
return Math.random().toString(32).slice(2, 10);
|
|
1179
1180
|
};
|
|
1181
|
+
var pickChild = function pickChild(children, targetChild) {
|
|
1182
|
+
var target = [];
|
|
1183
|
+
var withoutTargetChildren = React.Children.map(children, function (item) {
|
|
1184
|
+
if (! /*#__PURE__*/React.isValidElement(item)) return item;
|
|
1185
|
+
if (item.type === targetChild) {
|
|
1186
|
+
target.push(item);
|
|
1187
|
+
return null;
|
|
1188
|
+
}
|
|
1189
|
+
return item;
|
|
1190
|
+
});
|
|
1191
|
+
var targetChildren = target.length >= 0 ? target : undefined;
|
|
1192
|
+
return [withoutTargetChildren, targetChildren];
|
|
1193
|
+
};
|
|
1180
1194
|
var pickChildByProps = function pickChildByProps(children, key, value) {
|
|
1181
1195
|
var target = [];
|
|
1182
1196
|
var isArray = Array.isArray(value);
|
|
@@ -1252,7 +1266,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
1252
1266
|
return getAllScaleProps;
|
|
1253
1267
|
};
|
|
1254
1268
|
|
|
1255
|
-
var _excluded$
|
|
1269
|
+
var _excluded$i = ["children"];
|
|
1256
1270
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
1257
1271
|
if (scale === 1) return scale;
|
|
1258
1272
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -1262,7 +1276,7 @@ var withScale = function withScale(Render) {
|
|
|
1262
1276
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1263
1277
|
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33;
|
|
1264
1278
|
var children = _ref.children,
|
|
1265
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1279
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
|
1266
1280
|
var _useTheme = useTheme(),
|
|
1267
1281
|
layout = _useTheme.layout;
|
|
1268
1282
|
var paddingLeft = props.paddingLeft,
|
|
@@ -1345,7 +1359,7 @@ var withScale = function withScale(Render) {
|
|
|
1345
1359
|
return ScaleFC;
|
|
1346
1360
|
};
|
|
1347
1361
|
|
|
1348
|
-
var _excluded$
|
|
1362
|
+
var _excluded$h = ["label", "labelRight", "type", "error", "htmlType", "icon", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled"];
|
|
1349
1363
|
var simulateChangeEvent = function simulateChangeEvent(el, event) {
|
|
1350
1364
|
return _objectSpread2(_objectSpread2({}, event), {}, {
|
|
1351
1365
|
target: el,
|
|
@@ -1385,7 +1399,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1385
1399
|
children = _ref.children,
|
|
1386
1400
|
_ref$disabled = _ref.disabled,
|
|
1387
1401
|
disabled = _ref$disabled === undefined ? false : _ref$disabled,
|
|
1388
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1402
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
1389
1403
|
var theme = useTheme();
|
|
1390
1404
|
var _useScale = useScale(),
|
|
1391
1405
|
SCALES = _useScale.SCALES;
|
|
@@ -1527,7 +1541,7 @@ tuple('hover', 'click');
|
|
|
1527
1541
|
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
1528
1542
|
tuple('start', 'center', 'end', 'left', 'right');
|
|
1529
1543
|
|
|
1530
|
-
var _excluded$
|
|
1544
|
+
var _excluded$g = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "resize"];
|
|
1531
1545
|
tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
|
|
1532
1546
|
var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1533
1547
|
var _ref$type = _ref.type,
|
|
@@ -1547,7 +1561,7 @@ var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1547
1561
|
placeholder = _ref.placeholder,
|
|
1548
1562
|
_ref$resize = _ref.resize,
|
|
1549
1563
|
resize = _ref$resize === undefined ? 'none' : _ref$resize,
|
|
1550
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1564
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
1551
1565
|
var theme = useTheme();
|
|
1552
1566
|
var _useScale = useScale(),
|
|
1553
1567
|
SCALES = _useScale.SCALES;
|
|
@@ -1647,11 +1661,11 @@ var PasswordIcon = function PasswordIcon(_ref) {
|
|
|
1647
1661
|
};
|
|
1648
1662
|
var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
|
|
1649
1663
|
|
|
1650
|
-
var _excluded$
|
|
1664
|
+
var _excluded$f = ["hideToggle", "children"];
|
|
1651
1665
|
var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1652
1666
|
var hideToggle = _ref.hideToggle,
|
|
1653
1667
|
children = _ref.children,
|
|
1654
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1668
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
1655
1669
|
var _useScale = useScale(),
|
|
1656
1670
|
getAllScaleProps = _useScale.getAllScaleProps;
|
|
1657
1671
|
var inputRef = React.useRef(null);
|
|
@@ -18948,11 +18962,11 @@ var SelectIcon = /*#__PURE__*/React.memo(SelectIconComponent);
|
|
|
18948
18962
|
|
|
18949
18963
|
/* "use client" */
|
|
18950
18964
|
|
|
18951
|
-
var defaultContext$
|
|
18965
|
+
var defaultContext$3 = {
|
|
18952
18966
|
visible: false,
|
|
18953
18967
|
disableAll: false
|
|
18954
18968
|
};
|
|
18955
|
-
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$
|
|
18969
|
+
var SelectContext = /*#__PURE__*/React.createContext(defaultContext$3);
|
|
18956
18970
|
var useSelectContext = function useSelectContext() {
|
|
18957
18971
|
return React.useContext(SelectContext);
|
|
18958
18972
|
};
|
|
@@ -19017,7 +19031,7 @@ var useResize = function useResize(callback) {
|
|
|
19017
19031
|
}, []);
|
|
19018
19032
|
};
|
|
19019
19033
|
|
|
19020
|
-
var _excluded$
|
|
19034
|
+
var _excluded$e = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
|
|
19021
19035
|
var CssTransition = function CssTransition(_ref) {
|
|
19022
19036
|
var children = _ref.children,
|
|
19023
19037
|
_ref$className = _ref.className,
|
|
@@ -19032,7 +19046,7 @@ var CssTransition = function CssTransition(_ref) {
|
|
|
19032
19046
|
clearTime = _ref$clearTime === undefined ? 60 : _ref$clearTime,
|
|
19033
19047
|
_ref$name = _ref.name,
|
|
19034
19048
|
name = _ref$name === undefined ? 'transition' : _ref$name,
|
|
19035
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19049
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
19036
19050
|
var _useState = React.useState(''),
|
|
19037
19051
|
_useState2 = _slicedToArray(_useState, 2),
|
|
19038
19052
|
classes = _useState2[0],
|
|
@@ -19288,7 +19302,7 @@ var SelectDropdown = /*#__PURE__*/React.forwardRef(function (_ref, dropdownRef)
|
|
|
19288
19302
|
});
|
|
19289
19303
|
SelectDropdown.displayName = 'SelectDropdown';
|
|
19290
19304
|
|
|
19291
|
-
var _excluded$
|
|
19305
|
+
var _excluded$d = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
|
|
19292
19306
|
var getItemLayout = function getItemLayout(val) {
|
|
19293
19307
|
var display = val === 0 ? 'display: none;' : 'display: inherit;';
|
|
19294
19308
|
if (typeof val === 'number') {
|
|
@@ -19326,7 +19340,7 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
19326
19340
|
children = _ref.children,
|
|
19327
19341
|
_ref$className = _ref.className,
|
|
19328
19342
|
className = _ref$className === undefined ? '' : _ref$className,
|
|
19329
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19343
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
19330
19344
|
var theme = useTheme();
|
|
19331
19345
|
var _useScale = useScale(),
|
|
19332
19346
|
SCALES = _useScale.SCALES;
|
|
@@ -19366,12 +19380,12 @@ var GridBasicItem = function GridBasicItem(_ref) {
|
|
|
19366
19380
|
};
|
|
19367
19381
|
GridBasicItem.displayName = 'GridBasicItem';
|
|
19368
19382
|
|
|
19369
|
-
var _excluded$
|
|
19383
|
+
var _excluded$c = ["children", "className"];
|
|
19370
19384
|
var GridComponent = function GridComponent(_ref) {
|
|
19371
19385
|
var children = _ref.children,
|
|
19372
19386
|
_ref$className = _ref.className,
|
|
19373
19387
|
className = _ref$className === undefined ? '' : _ref$className,
|
|
19374
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19388
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
19375
19389
|
var _useScale = useScale(),
|
|
19376
19390
|
SCALES = _useScale.SCALES;
|
|
19377
19391
|
var _styles$className = {
|
|
@@ -19391,7 +19405,7 @@ var GridComponent = function GridComponent(_ref) {
|
|
|
19391
19405
|
GridComponent.displayName = 'Grid';
|
|
19392
19406
|
var Grid = withScale(GridComponent);
|
|
19393
19407
|
|
|
19394
|
-
var _excluded$
|
|
19408
|
+
var _excluded$b = ["gap", "wrap", "children", "className"];
|
|
19395
19409
|
var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
19396
19410
|
var _ref$gap = _ref.gap,
|
|
19397
19411
|
gap = _ref$gap === undefined ? 0 : _ref$gap,
|
|
@@ -19400,7 +19414,7 @@ var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
|
19400
19414
|
children = _ref.children,
|
|
19401
19415
|
_ref$className = _ref.className,
|
|
19402
19416
|
className = _ref$className === undefined ? '' : _ref$className,
|
|
19403
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19417
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
19404
19418
|
var _useScale = useScale(),
|
|
19405
19419
|
unit = _useScale.unit,
|
|
19406
19420
|
SCALES = _useScale.SCALES;
|
|
@@ -19556,7 +19570,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (_ref, inputRef) {
|
|
|
19556
19570
|
});
|
|
19557
19571
|
SelectInput.displayName = 'GeistSelectInput';
|
|
19558
19572
|
|
|
19559
|
-
var _excluded$
|
|
19573
|
+
var _excluded$a = ["children", "label", "type", "disabled", "initialValue", "value", "icon", "onChange", "pure", "multiple", "clearable", "placeholder", "className", "dropdownClassName", "dropdownStyle", "disableMatchWidth", "getPopupContainer", "onDropdownVisibleChange"];
|
|
19560
19574
|
var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
19561
19575
|
var children = _ref.children,
|
|
19562
19576
|
label = _ref.label,
|
|
@@ -19585,7 +19599,7 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
|
19585
19599
|
getPopupContainer = _ref.getPopupContainer,
|
|
19586
19600
|
_ref$onDropdownVisibl = _ref.onDropdownVisibleChange,
|
|
19587
19601
|
onDropdownVisibleChange = _ref$onDropdownVisibl === undefined ? function () {} : _ref$onDropdownVisibl,
|
|
19588
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19602
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
19589
19603
|
var theme = useTheme();
|
|
19590
19604
|
var _useScale = useScale(),
|
|
19591
19605
|
SCALES = _useScale.SCALES;
|
|
@@ -19757,7 +19771,7 @@ var SelectComponent = /*#__PURE__*/React.forwardRef(function (_ref, selectRef) {
|
|
|
19757
19771
|
SelectComponent.displayName = 'Select';
|
|
19758
19772
|
var Select = withScale(SelectComponent);
|
|
19759
19773
|
|
|
19760
|
-
var _excluded$
|
|
19774
|
+
var _excluded$9 = ["value", "className", "children", "disabled", "divider", "label", "preventAllEvents"];
|
|
19761
19775
|
var SelectOptionComponent = function SelectOptionComponent(_ref) {
|
|
19762
19776
|
var identValue = _ref.value,
|
|
19763
19777
|
_ref$className = _ref.className,
|
|
@@ -19771,7 +19785,7 @@ var SelectOptionComponent = function SelectOptionComponent(_ref) {
|
|
|
19771
19785
|
label = _ref$label === undefined ? false : _ref$label,
|
|
19772
19786
|
_ref$preventAllEvents = _ref.preventAllEvents,
|
|
19773
19787
|
preventAllEvents = _ref$preventAllEvents === undefined ? false : _ref$preventAllEvents,
|
|
19774
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
19788
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
19775
19789
|
var theme = useTheme();
|
|
19776
19790
|
var _useScale = useScale(),
|
|
19777
19791
|
SCALES = _useScale.SCALES;
|
|
@@ -19861,7 +19875,8 @@ var TableHead = function TableHead(props) {
|
|
|
19861
19875
|
columns = _ref.columns,
|
|
19862
19876
|
width = _ref.width,
|
|
19863
19877
|
onFilters = _ref.onFilters,
|
|
19864
|
-
showFilters = _ref.showFilters
|
|
19878
|
+
showFilters = _ref.showFilters,
|
|
19879
|
+
stickyHeader = _ref.stickyHeader;
|
|
19865
19880
|
var isScalableWidth = React.useMemo(function () {
|
|
19866
19881
|
return columns.find(function (item) {
|
|
19867
19882
|
return !!item.width;
|
|
@@ -19950,9 +19965,9 @@ var TableHead = function TableHead(props) {
|
|
|
19950
19965
|
});
|
|
19951
19966
|
};
|
|
19952
19967
|
return /*#__PURE__*/React.createElement(React.Fragment, null, colgroup, /*#__PURE__*/React.createElement("thead", {
|
|
19953
|
-
className: _JSXStyle.dynamic([["
|
|
19968
|
+
className: _JSXStyle.dynamic([["3728881297", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
19954
19969
|
}, /*#__PURE__*/React.createElement("tr", {
|
|
19955
|
-
className: _JSXStyle.dynamic([["
|
|
19970
|
+
className: _JSXStyle.dynamic([["3728881297", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
19956
19971
|
}, columns.map(function (column, index) {
|
|
19957
19972
|
return /*#__PURE__*/React.createElement("th", {
|
|
19958
19973
|
style: {
|
|
@@ -19964,23 +19979,23 @@ var TableHead = function TableHead(props) {
|
|
|
19964
19979
|
},
|
|
19965
19980
|
key: "table-th-".concat(column.prop.toString(), "-").concat(index),
|
|
19966
19981
|
"data-column": column.label,
|
|
19967
|
-
className: _JSXStyle.dynamic([["
|
|
19982
|
+
className: _JSXStyle.dynamic([["3728881297", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + (column.className || "")
|
|
19968
19983
|
}, /*#__PURE__*/React.createElement("div", {
|
|
19969
|
-
className: _JSXStyle.dynamic([["
|
|
19984
|
+
className: _JSXStyle.dynamic([["3728881297", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + "thead-box"
|
|
19970
19985
|
}, column.label, /*#__PURE__*/React.createElement("br", {
|
|
19971
|
-
className: _JSXStyle.dynamic([["
|
|
19986
|
+
className: _JSXStyle.dynamic([["3728881297", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
19972
19987
|
}), /*#__PURE__*/React.createElement("span", {
|
|
19973
19988
|
style: {
|
|
19974
19989
|
textAlign: 'center'
|
|
19975
19990
|
},
|
|
19976
|
-
className: _JSXStyle.dynamic([["
|
|
19991
|
+
className: _JSXStyle.dynamic([["3728881297", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
19977
19992
|
}, column.text)));
|
|
19978
19993
|
})), showFilters && /*#__PURE__*/React.createElement("tr", {
|
|
19979
|
-
className: _JSXStyle.dynamic([["
|
|
19994
|
+
className: _JSXStyle.dynamic([["3728881297", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
19980
19995
|
}, generateFilterInputs())), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19981
|
-
id: "
|
|
19982
|
-
dynamic: [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]
|
|
19983
|
-
}, "thead.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;font-size:inherit;}th.__jsx-style-dynamic-selector{padding:0 0.5em;font-size:calc(0.75 * var(--table-font-size));font-weight:normal;text-align:left;-webkit-letter-spacing:0;-moz-letter-spacing:0;-ms-letter-spacing:0;letter-spacing:0;vertical-align:middle;min-height:calc(2.5 * var(--table-font-size));color:".concat(theme.palette.accents_5, ";background:").concat(theme.palette.accents_1, ";border-bottom:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-radius:0;}th.__jsx-style-dynamic-selector:nth-child(1){border-bottom:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";}th.__jsx-style-dynamic-selector:last-child{border-bottom:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}.thead-box.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-align:center;min-height:calc(2.5 * var(--table-font-size));text-transform:uppercase;}")));
|
|
19996
|
+
id: "3728881297",
|
|
19997
|
+
dynamic: [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]
|
|
19998
|
+
}, "thead.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;font-size:inherit;}th.__jsx-style-dynamic-selector{padding:0 0.5em;font-size:calc(0.75 * var(--table-font-size));font-weight:normal;text-align:left;-webkit-letter-spacing:0;-moz-letter-spacing:0;-ms-letter-spacing:0;letter-spacing:0;vertical-align:middle;min-height:calc(2.5 * var(--table-font-size));color:".concat(theme.palette.accents_5, ";background:").concat(theme.palette.accents_1, ";border-bottom:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-radius:0;").concat(stickyHeader && "\n position: sticky;\n top: 0;\n background-color: #fff;\n z-index: 1;\n ", ";}th.__jsx-style-dynamic-selector:nth-child(1){border-bottom:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";}th.__jsx-style-dynamic-selector:last-child{border-bottom:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}.thead-box.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-align:center;min-height:calc(2.5 * var(--table-font-size));text-transform:uppercase;}")));
|
|
19984
19999
|
};
|
|
19985
20000
|
TableHead.displayName = 'TableHead';
|
|
19986
20001
|
|
|
@@ -20019,11 +20034,11 @@ var TableCell = function TableCell(_ref) {
|
|
|
20019
20034
|
|
|
20020
20035
|
/* "use client" */
|
|
20021
20036
|
|
|
20022
|
-
var defaultContext$
|
|
20037
|
+
var defaultContext$2 = {
|
|
20023
20038
|
columns: [],
|
|
20024
20039
|
updateColumn: function updateColumn() {}
|
|
20025
20040
|
};
|
|
20026
|
-
var TableContext = /*#__PURE__*/React.createContext(defaultContext$
|
|
20041
|
+
var TableContext = /*#__PURE__*/React.createContext(defaultContext$2);
|
|
20027
20042
|
var useTableContext = function useTableContext() {
|
|
20028
20043
|
return React.useContext(TableContext);
|
|
20029
20044
|
};
|
|
@@ -20261,108 +20276,6 @@ var TableColumn = function TableColumn(columnProps) {
|
|
|
20261
20276
|
};
|
|
20262
20277
|
TableColumn.displayName = 'TableColumn';
|
|
20263
20278
|
|
|
20264
|
-
var _excluded$4 = ["children", "data", "initialData", "hover", "emptyText", "rowDraggable", "readOnly", "onRow", "onCell", "onChange", "onFilters", "showFilters", "onSelected", "className", "rowClassName"];
|
|
20265
|
-
function TableComponent(tableProps) {
|
|
20266
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
20267
|
-
var _ref = tableProps,
|
|
20268
|
-
children = _ref.children,
|
|
20269
|
-
customData = _ref.data,
|
|
20270
|
-
_ref$initialData = _ref.initialData,
|
|
20271
|
-
initialData = _ref$initialData === undefined ? [] : _ref$initialData,
|
|
20272
|
-
_ref$hover = _ref.hover,
|
|
20273
|
-
hover = _ref$hover === undefined ? true : _ref$hover,
|
|
20274
|
-
_ref$emptyText = _ref.emptyText,
|
|
20275
|
-
emptyText = _ref$emptyText === undefined ? '' : _ref$emptyText,
|
|
20276
|
-
_ref$rowDraggable = _ref.rowDraggable,
|
|
20277
|
-
rowDraggable = _ref$rowDraggable === undefined ? false : _ref$rowDraggable,
|
|
20278
|
-
_ref$readOnly = _ref.readOnly,
|
|
20279
|
-
readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
|
|
20280
|
-
onRow = _ref.onRow,
|
|
20281
|
-
onCell = _ref.onCell;
|
|
20282
|
-
_ref.onChange;
|
|
20283
|
-
var onFilters = _ref.onFilters,
|
|
20284
|
-
_ref$showFilters = _ref.showFilters,
|
|
20285
|
-
showFilters = _ref$showFilters === undefined ? false : _ref$showFilters,
|
|
20286
|
-
onSelected = _ref.onSelected,
|
|
20287
|
-
_ref$className = _ref.className,
|
|
20288
|
-
className = _ref$className === undefined ? '' : _ref$className,
|
|
20289
|
-
_ref$rowClassName = _ref.rowClassName,
|
|
20290
|
-
rowClassName = _ref$rowClassName === undefined ? function () {
|
|
20291
|
-
return '';
|
|
20292
|
-
} : _ref$rowClassName,
|
|
20293
|
-
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
20294
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
20295
|
-
var _useScale = useScale(),
|
|
20296
|
-
SCALES = _useScale.SCALES;
|
|
20297
|
-
var ref = React.useRef(null);
|
|
20298
|
-
var _useRealShape = useRealShape(ref),
|
|
20299
|
-
_useRealShape2 = _slicedToArray(_useRealShape, 2),
|
|
20300
|
-
width = _useRealShape2[0].width,
|
|
20301
|
-
updateShape = _useRealShape2[1];
|
|
20302
|
-
var _useState = React.useState([]),
|
|
20303
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
20304
|
-
columns = _useState2[0],
|
|
20305
|
-
setColumns = _useState2[1];
|
|
20306
|
-
var _useState3 = React.useState(initialData),
|
|
20307
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
20308
|
-
data = _useState4[0],
|
|
20309
|
-
setData = _useState4[1];
|
|
20310
|
-
var updateColumn = function updateColumn(column) {
|
|
20311
|
-
setColumns(function (last) {
|
|
20312
|
-
var hasColumn = last.find(function (item) {
|
|
20313
|
-
return item.prop === column.prop;
|
|
20314
|
-
});
|
|
20315
|
-
if (!hasColumn) return [].concat(_toConsumableArray(last), [column]);
|
|
20316
|
-
return last.map(function (item) {
|
|
20317
|
-
if (item.prop !== column.prop) return item;
|
|
20318
|
-
return column;
|
|
20319
|
-
});
|
|
20320
|
-
});
|
|
20321
|
-
};
|
|
20322
|
-
var contextValue = React.useMemo(function () {
|
|
20323
|
-
return {
|
|
20324
|
-
columns: columns,
|
|
20325
|
-
updateColumn: updateColumn
|
|
20326
|
-
};
|
|
20327
|
-
}, [columns]);
|
|
20328
|
-
React.useEffect(function () {
|
|
20329
|
-
if (typeof customData === 'undefined') return;
|
|
20330
|
-
setData(customData);
|
|
20331
|
-
}, [customData]);
|
|
20332
|
-
useResize(function () {
|
|
20333
|
-
return updateShape();
|
|
20334
|
-
});
|
|
20335
|
-
return /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
20336
|
-
value: contextValue
|
|
20337
|
-
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
20338
|
-
ref: ref
|
|
20339
|
-
}, props, {
|
|
20340
|
-
className: _JSXStyle.dynamic([["2132340556", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
|
|
20341
|
-
}), /*#__PURE__*/React.createElement(TableHead, {
|
|
20342
|
-
columns: columns,
|
|
20343
|
-
onFilters: onFilters,
|
|
20344
|
-
showFilters: showFilters,
|
|
20345
|
-
width: width
|
|
20346
|
-
}), /*#__PURE__*/React.createElement(TableBody, {
|
|
20347
|
-
data: data,
|
|
20348
|
-
hover: hover,
|
|
20349
|
-
emptyText: emptyText,
|
|
20350
|
-
onRow: onRow,
|
|
20351
|
-
onCell: onCell,
|
|
20352
|
-
rowClassName: rowClassName,
|
|
20353
|
-
rowDraggable: rowDraggable,
|
|
20354
|
-
readOnly: readOnly,
|
|
20355
|
-
onSelected: onSelected
|
|
20356
|
-
}), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20357
|
-
id: "2132340556",
|
|
20358
|
-
dynamic: [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
|
|
20359
|
-
}, "table.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;--table-font-size:".concat(SCALES.font(1), ";font-size:var(--table-font-size);width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}"))));
|
|
20360
|
-
}
|
|
20361
|
-
TableComponent.displayName = 'Table';
|
|
20362
|
-
TableComponent.Column = TableColumn;
|
|
20363
|
-
var Table = withScale(TableComponent);
|
|
20364
|
-
Table.Column = TableColumn;
|
|
20365
|
-
|
|
20366
20279
|
// import { IconContext } from "./context.js";
|
|
20367
20280
|
const createIcon = (Component) => {
|
|
20368
20281
|
const IconWrapper = React.forwardRef(({ color = "#001A72", strokeWidth = "1.5", size = "24", set = "outline", style, ...props }, ref) => {
|
|
@@ -22409,7 +22322,7 @@ const ChevronLeft = ({ color, strokeWidth, set }) => {
|
|
|
22409
22322
|
}
|
|
22410
22323
|
};
|
|
22411
22324
|
ChevronLeft.displayName = "ChevronLeft";
|
|
22412
|
-
createIcon(ChevronLeft);
|
|
22325
|
+
var ChevronLeft$1 = createIcon(ChevronLeft);
|
|
22413
22326
|
|
|
22414
22327
|
const ChevronCircleRight = ({ color, strokeWidth, set }) => {
|
|
22415
22328
|
const Broken = () => (React__namespace.createElement("g", null,
|
|
@@ -22492,7 +22405,7 @@ const ChevronRight = ({ color, strokeWidth, set }) => {
|
|
|
22492
22405
|
}
|
|
22493
22406
|
};
|
|
22494
22407
|
ChevronRight.displayName = "ChevronRight";
|
|
22495
|
-
createIcon(ChevronRight);
|
|
22408
|
+
var ChevronRight$1 = createIcon(ChevronRight);
|
|
22496
22409
|
|
|
22497
22410
|
const ChevronCircleUp = ({ color, strokeWidth, set }) => {
|
|
22498
22411
|
const Broken = () => (React__namespace.createElement("g", null,
|
|
@@ -30239,6 +30152,478 @@ const HelpCircle = ({ color, strokeWidth, set }) => {
|
|
|
30239
30152
|
HelpCircle.displayName = "HelpCircle";
|
|
30240
30153
|
createIcon(HelpCircle);
|
|
30241
30154
|
|
|
30155
|
+
var hexToRgb = function hexToRgb(color) {
|
|
30156
|
+
var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
30157
|
+
var full = color.replace(fullReg, function (_, r, g, b) {
|
|
30158
|
+
return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
30159
|
+
});
|
|
30160
|
+
var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
30161
|
+
if (!values) {
|
|
30162
|
+
throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
|
|
30163
|
+
}
|
|
30164
|
+
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
30165
|
+
};
|
|
30166
|
+
var colorToRgbValues = function colorToRgbValues(color) {
|
|
30167
|
+
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
30168
|
+
var safeColor = color.replace(/ /g, '');
|
|
30169
|
+
var colorType = color.substr(0, 4);
|
|
30170
|
+
var regArray = safeColor.match(/\((.+)\)/);
|
|
30171
|
+
if (!colorType.startsWith('rgb') || !regArray) {
|
|
30172
|
+
console.log(color);
|
|
30173
|
+
throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
|
|
30174
|
+
}
|
|
30175
|
+
return regArray[1].split(',').map(function (str) {
|
|
30176
|
+
return Number.parseFloat(str);
|
|
30177
|
+
});
|
|
30178
|
+
};
|
|
30179
|
+
var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
30180
|
+
if (!/^#|rgb|RGB/.test(color)) return color;
|
|
30181
|
+
var _colorToRgbValues = colorToRgbValues(color),
|
|
30182
|
+
_colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
|
|
30183
|
+
r = _colorToRgbValues2[0],
|
|
30184
|
+
g = _colorToRgbValues2[1],
|
|
30185
|
+
b = _colorToRgbValues2[2];
|
|
30186
|
+
var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
30187
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
30188
|
+
};
|
|
30189
|
+
|
|
30190
|
+
var _excluded$8 = ["active", "children", "disabled", "onClick"];
|
|
30191
|
+
var PaginationItem = function PaginationItem(_ref) {
|
|
30192
|
+
var active = _ref.active,
|
|
30193
|
+
children = _ref.children,
|
|
30194
|
+
disabled = _ref.disabled,
|
|
30195
|
+
onClick = _ref.onClick,
|
|
30196
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
30197
|
+
var theme = useTheme();
|
|
30198
|
+
var _useMemo = React.useMemo(function () {
|
|
30199
|
+
return [addColorAlpha(theme.palette.success, 0.1), addColorAlpha(theme.palette.success, 0.8)];
|
|
30200
|
+
}, [theme.palette.success]),
|
|
30201
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
30202
|
+
hover = _useMemo2[0],
|
|
30203
|
+
activeHover = _useMemo2[1];
|
|
30204
|
+
var classes = useClasses({
|
|
30205
|
+
active: active,
|
|
30206
|
+
disabled: disabled
|
|
30207
|
+
});
|
|
30208
|
+
var clickHandler = function clickHandler(event) {
|
|
30209
|
+
if (disabled) return;
|
|
30210
|
+
onClick && onClick(event);
|
|
30211
|
+
};
|
|
30212
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
30213
|
+
className: _JSXStyle.dynamic([["1657796974", [theme.palette.success, theme.layout.radius, theme.palette.background, hover, theme.palette.success, theme.palette.background, theme.expressiveness.shadowSmall, activeHover, theme.expressiveness.shadowMedium, theme.palette.accents_4, theme.palette.accents_2]]])
|
|
30214
|
+
}, /*#__PURE__*/React.createElement("button", _extends({
|
|
30215
|
+
onClick: clickHandler
|
|
30216
|
+
}, props, {
|
|
30217
|
+
className: _JSXStyle.dynamic([["1657796974", [theme.palette.success, theme.layout.radius, theme.palette.background, hover, theme.palette.success, theme.palette.background, theme.expressiveness.shadowSmall, activeHover, theme.expressiveness.shadowMedium, theme.palette.accents_4, theme.palette.accents_2]]]) + " " + (props && props.className != null && props.className || classes || "")
|
|
30218
|
+
}), children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
30219
|
+
id: "1657796974",
|
|
30220
|
+
dynamic: [theme.palette.success, theme.layout.radius, theme.palette.background, hover, theme.palette.success, theme.palette.background, theme.expressiveness.shadowSmall, activeHover, theme.expressiveness.shadowMedium, theme.palette.accents_4, theme.palette.accents_2]
|
|
30221
|
+
}, "li.__jsx-style-dynamic-selector{margin-right:0.428em;display:inline-block;}button.__jsx-style-dynamic-selector{border:none;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;box-sizing:border-box;text-transform:capitalize;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;text-align:center;vertical-align:middle;box-shadow:none;outline:none;height:var(--pagination-size);min-width:var(--pagination-size);font-size:inherit;cursor:pointer;color:".concat(theme.palette.success, ";border-radius:").concat(theme.layout.radius, ";background-color:").concat(theme.palette.background, ";-webkit-transition:all linear 200ms 0ms;transition:all linear 200ms 0ms;}button.__jsx-style-dynamic-selector:hover{background-color:").concat(hover, ";}.active.__jsx-style-dynamic-selector{font-weight:bold;background-color:").concat(theme.palette.success, ";color:").concat(theme.palette.background, ";box-shadow:").concat(theme.expressiveness.shadowSmall, ";}.active.__jsx-style-dynamic-selector:hover{background-color:").concat(activeHover, ";box-shadow:").concat(theme.expressiveness.shadowMedium, ";}.disabled.__jsx-style-dynamic-selector{color:").concat(theme.palette.accents_4, ";cursor:not-allowed;}.disabled.__jsx-style-dynamic-selector:hover{background-color:").concat(theme.palette.accents_2, ";}button.__jsx-style-dynamic-selector svg{width:1.3em;height:1.3em;}")));
|
|
30222
|
+
};
|
|
30223
|
+
PaginationItem.displayName = 'GeistPaginationItem';
|
|
30224
|
+
|
|
30225
|
+
/* "use client" */
|
|
30226
|
+
|
|
30227
|
+
tuple('prev', 'next', 'click');
|
|
30228
|
+
var defaultContext$1 = {};
|
|
30229
|
+
var PaginationContext = /*#__PURE__*/React.createContext(defaultContext$1);
|
|
30230
|
+
var usePaginationContext = function usePaginationContext() {
|
|
30231
|
+
return React.useContext(PaginationContext);
|
|
30232
|
+
};
|
|
30233
|
+
|
|
30234
|
+
var _excluded$7 = ["children"];
|
|
30235
|
+
var PaginationPrevious = function PaginationPrevious(_ref) {
|
|
30236
|
+
var children = _ref.children,
|
|
30237
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
30238
|
+
var _usePaginationContext = usePaginationContext(),
|
|
30239
|
+
update = _usePaginationContext.update,
|
|
30240
|
+
isFirst = _usePaginationContext.isFirst;
|
|
30241
|
+
return /*#__PURE__*/React.createElement(PaginationItem, _extends({
|
|
30242
|
+
onClick: function onClick() {
|
|
30243
|
+
return update && update('prev');
|
|
30244
|
+
},
|
|
30245
|
+
disabled: isFirst
|
|
30246
|
+
}, props), children);
|
|
30247
|
+
};
|
|
30248
|
+
PaginationPrevious.displayName = 'GeistPaginationPrevious';
|
|
30249
|
+
|
|
30250
|
+
var _excluded$6 = ["children"];
|
|
30251
|
+
var PaginationNext = function PaginationNext(_ref) {
|
|
30252
|
+
var children = _ref.children,
|
|
30253
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
30254
|
+
var _usePaginationContext = usePaginationContext(),
|
|
30255
|
+
update = _usePaginationContext.update,
|
|
30256
|
+
isLast = _usePaginationContext.isLast;
|
|
30257
|
+
return /*#__PURE__*/React.createElement(PaginationItem, _extends({
|
|
30258
|
+
onClick: function onClick() {
|
|
30259
|
+
return update && update('next');
|
|
30260
|
+
},
|
|
30261
|
+
disabled: isLast
|
|
30262
|
+
}, props), children);
|
|
30263
|
+
};
|
|
30264
|
+
PaginationNext.displayName = 'GeistPaginationNext';
|
|
30265
|
+
|
|
30266
|
+
var PaginationEllipsis = function PaginationEllipsis(_ref) {
|
|
30267
|
+
var isBefore = _ref.isBefore,
|
|
30268
|
+
_onClick = _ref.onClick;
|
|
30269
|
+
var _useState = React.useState(false),
|
|
30270
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30271
|
+
showMore = _useState2[0],
|
|
30272
|
+
setShowMore = _useState2[1];
|
|
30273
|
+
return /*#__PURE__*/React.createElement(PaginationItem, {
|
|
30274
|
+
onClick: function onClick(e) {
|
|
30275
|
+
return _onClick && _onClick(e);
|
|
30276
|
+
},
|
|
30277
|
+
onMouseEnter: function onMouseEnter() {
|
|
30278
|
+
return setShowMore(true);
|
|
30279
|
+
},
|
|
30280
|
+
onMouseLeave: function onMouseLeave() {
|
|
30281
|
+
return setShowMore(false);
|
|
30282
|
+
}
|
|
30283
|
+
}, showMore ? /*#__PURE__*/React.createElement("svg", {
|
|
30284
|
+
viewBox: "0 0 24 24",
|
|
30285
|
+
stroke: "currentColor",
|
|
30286
|
+
strokeWidth: "1.5",
|
|
30287
|
+
strokeLinecap: "round",
|
|
30288
|
+
strokeLinejoin: "round",
|
|
30289
|
+
fill: "none",
|
|
30290
|
+
shapeRendering: "geometricPrecision",
|
|
30291
|
+
className: _JSXStyle.dynamic([["2928474255", [isBefore ? '180deg' : '0deg']]]) + " " + "more"
|
|
30292
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
30293
|
+
d: "M13 17l5-5-5-5",
|
|
30294
|
+
className: _JSXStyle.dynamic([["2928474255", [isBefore ? '180deg' : '0deg']]])
|
|
30295
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
30296
|
+
d: "M6 17l5-5-5-5",
|
|
30297
|
+
className: _JSXStyle.dynamic([["2928474255", [isBefore ? '180deg' : '0deg']]])
|
|
30298
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
30299
|
+
viewBox: "0 0 24 24",
|
|
30300
|
+
strokeWidth: "1.5",
|
|
30301
|
+
strokeLinecap: "round",
|
|
30302
|
+
strokeLinejoin: "round",
|
|
30303
|
+
fill: "none",
|
|
30304
|
+
shapeRendering: "geometricPrecision",
|
|
30305
|
+
className: _JSXStyle.dynamic([["2928474255", [isBefore ? '180deg' : '0deg']]])
|
|
30306
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
30307
|
+
cx: "12",
|
|
30308
|
+
cy: "12",
|
|
30309
|
+
r: "1",
|
|
30310
|
+
fill: "currentColor",
|
|
30311
|
+
className: _JSXStyle.dynamic([["2928474255", [isBefore ? '180deg' : '0deg']]])
|
|
30312
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
30313
|
+
cx: "19",
|
|
30314
|
+
cy: "12",
|
|
30315
|
+
r: "1",
|
|
30316
|
+
fill: "currentColor",
|
|
30317
|
+
className: _JSXStyle.dynamic([["2928474255", [isBefore ? '180deg' : '0deg']]])
|
|
30318
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
30319
|
+
cx: "5",
|
|
30320
|
+
cy: "12",
|
|
30321
|
+
r: "1",
|
|
30322
|
+
fill: "currentColor",
|
|
30323
|
+
className: _JSXStyle.dynamic([["2928474255", [isBefore ? '180deg' : '0deg']]])
|
|
30324
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
30325
|
+
id: "2928474255",
|
|
30326
|
+
dynamic: [isBefore ? '180deg' : '0deg']
|
|
30327
|
+
}, "svg.__jsx-style-dynamic-selector{color:currentColor;stroke:currentColor;width:1em;height:1em;}.more.__jsx-style-dynamic-selector{-webkit-transform:rotate(".concat(isBefore ? '180deg' : '0deg', ");-ms-transform:rotate(").concat(isBefore ? '180deg' : '0deg', ");transform:rotate(").concat(isBefore ? '180deg' : '0deg', ");}")));
|
|
30328
|
+
};
|
|
30329
|
+
PaginationEllipsis.displayName = 'GeistPaginationEllipsis';
|
|
30330
|
+
|
|
30331
|
+
var PaginationPages = function PaginationPages(_ref) {
|
|
30332
|
+
var limit = _ref.limit,
|
|
30333
|
+
count = _ref.count,
|
|
30334
|
+
current = _ref.current,
|
|
30335
|
+
setPage = _ref.setPage;
|
|
30336
|
+
var showPages = React.useMemo(function () {
|
|
30337
|
+
var oddLimit = limit % 2 === 0 ? limit - 1 : limit;
|
|
30338
|
+
return oddLimit - 2;
|
|
30339
|
+
}, [limit]);
|
|
30340
|
+
var middleNumber = (showPages + 1) / 2;
|
|
30341
|
+
var _useMemo = React.useMemo(function () {
|
|
30342
|
+
var showEllipsis = count > limit;
|
|
30343
|
+
return [showEllipsis && current > middleNumber + 1, showEllipsis && current < count - middleNumber];
|
|
30344
|
+
}, [current, showPages, middleNumber, count, limit]),
|
|
30345
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
30346
|
+
showBeforeEllipsis = _useMemo2[0],
|
|
30347
|
+
showAfterEllipsis = _useMemo2[1];
|
|
30348
|
+
var pagesArray = React.useMemo(function () {
|
|
30349
|
+
return _toConsumableArray(new Array(showPages));
|
|
30350
|
+
}, [showPages]);
|
|
30351
|
+
var renderItem = React.useCallback(function (value, active) {
|
|
30352
|
+
return /*#__PURE__*/React.createElement(PaginationItem, {
|
|
30353
|
+
key: "pagination-item-".concat(value),
|
|
30354
|
+
active: value === active,
|
|
30355
|
+
onClick: function onClick() {
|
|
30356
|
+
return setPage(value);
|
|
30357
|
+
}
|
|
30358
|
+
}, value);
|
|
30359
|
+
}, []);
|
|
30360
|
+
var startPages = pagesArray.map(function (_, index) {
|
|
30361
|
+
var value = index + 2;
|
|
30362
|
+
return renderItem(value, current);
|
|
30363
|
+
});
|
|
30364
|
+
var middlePages = pagesArray.map(function (_, index) {
|
|
30365
|
+
var middleIndexNumber = middleNumber - (index + 1);
|
|
30366
|
+
var value = current - middleIndexNumber;
|
|
30367
|
+
return /*#__PURE__*/React.createElement(PaginationItem, {
|
|
30368
|
+
key: "pagination-middle-".concat(index),
|
|
30369
|
+
active: index + 1 === middleNumber,
|
|
30370
|
+
onClick: function onClick() {
|
|
30371
|
+
return setPage(value);
|
|
30372
|
+
}
|
|
30373
|
+
}, value);
|
|
30374
|
+
});
|
|
30375
|
+
var endPages = pagesArray.map(function (_, index) {
|
|
30376
|
+
var value = count - (showPages - index);
|
|
30377
|
+
return renderItem(value, current);
|
|
30378
|
+
});
|
|
30379
|
+
if (count <= limit) {
|
|
30380
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
30381
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, _toConsumableArray(new Array(count)).map(function (_, index) {
|
|
30382
|
+
var value = index + 1;
|
|
30383
|
+
return /*#__PURE__*/React.createElement(PaginationItem, {
|
|
30384
|
+
key: "pagination-item-".concat(value),
|
|
30385
|
+
active: value === current,
|
|
30386
|
+
onClick: function onClick() {
|
|
30387
|
+
return setPage(value);
|
|
30388
|
+
}
|
|
30389
|
+
}, value);
|
|
30390
|
+
}));
|
|
30391
|
+
/* eslint-enable */
|
|
30392
|
+
}
|
|
30393
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderItem(1, current), showBeforeEllipsis && /*#__PURE__*/React.createElement(PaginationEllipsis, {
|
|
30394
|
+
key: "pagination-ellipsis-before",
|
|
30395
|
+
isBefore: true,
|
|
30396
|
+
onClick: function onClick() {
|
|
30397
|
+
return setPage(function (last) {
|
|
30398
|
+
return last - 5 >= 1 ? last - 5 : 1;
|
|
30399
|
+
});
|
|
30400
|
+
}
|
|
30401
|
+
}), showBeforeEllipsis && showAfterEllipsis ? middlePages : showBeforeEllipsis ? endPages : startPages, showAfterEllipsis && /*#__PURE__*/React.createElement(PaginationEllipsis, {
|
|
30402
|
+
key: "pagination-ellipsis-after",
|
|
30403
|
+
onClick: function onClick() {
|
|
30404
|
+
return setPage(function (last) {
|
|
30405
|
+
return last + 5 <= count ? last + 5 : count;
|
|
30406
|
+
});
|
|
30407
|
+
}
|
|
30408
|
+
}), renderItem(count, current));
|
|
30409
|
+
};
|
|
30410
|
+
PaginationPages.displayName = 'GeistPaginationPages';
|
|
30411
|
+
|
|
30412
|
+
var _excluded$5 = ["page", "initialPage", "count", "limit", "children", "onChange", "className"];
|
|
30413
|
+
var PaginationComponent = function PaginationComponent(_ref) {
|
|
30414
|
+
var customPage = _ref.page,
|
|
30415
|
+
_ref$initialPage = _ref.initialPage,
|
|
30416
|
+
initialPage = _ref$initialPage === undefined ? 1 : _ref$initialPage,
|
|
30417
|
+
_ref$count = _ref.count,
|
|
30418
|
+
count = _ref$count === undefined ? 1 : _ref$count,
|
|
30419
|
+
_ref$limit = _ref.limit,
|
|
30420
|
+
limit = _ref$limit === undefined ? 7 : _ref$limit,
|
|
30421
|
+
children = _ref.children,
|
|
30422
|
+
onChange = _ref.onChange,
|
|
30423
|
+
_ref$className = _ref.className,
|
|
30424
|
+
className = _ref$className === undefined ? '' : _ref$className,
|
|
30425
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
30426
|
+
var _useScale = useScale(),
|
|
30427
|
+
SCALES = _useScale.SCALES;
|
|
30428
|
+
var _useCurrentState = useCurrentState(initialPage),
|
|
30429
|
+
_useCurrentState2 = _slicedToArray(_useCurrentState, 3),
|
|
30430
|
+
page = _useCurrentState2[0],
|
|
30431
|
+
setPage = _useCurrentState2[1],
|
|
30432
|
+
pageRef = _useCurrentState2[2];
|
|
30433
|
+
var _pickChild = pickChild(children, PaginationPrevious),
|
|
30434
|
+
_pickChild2 = _slicedToArray(_pickChild, 2),
|
|
30435
|
+
prevChildren = _pickChild2[1];
|
|
30436
|
+
var _pickChild3 = pickChild(children, PaginationNext),
|
|
30437
|
+
_pickChild4 = _slicedToArray(_pickChild3, 2),
|
|
30438
|
+
nextChildren = _pickChild4[1];
|
|
30439
|
+
var _useMemo = React.useMemo(function () {
|
|
30440
|
+
var hasChildren = function hasChildren(c) {
|
|
30441
|
+
return React.Children.count(c) > 0;
|
|
30442
|
+
};
|
|
30443
|
+
var prevDefault = /*#__PURE__*/React.createElement(PaginationPrevious, null, "prev");
|
|
30444
|
+
var nextDefault = /*#__PURE__*/React.createElement(PaginationNext, null, "next");
|
|
30445
|
+
return [hasChildren(prevChildren) ? prevChildren : prevDefault, hasChildren(nextChildren) ? nextChildren : nextDefault];
|
|
30446
|
+
}, [prevChildren, nextChildren]),
|
|
30447
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
30448
|
+
prevItem = _useMemo2[0],
|
|
30449
|
+
nextItem = _useMemo2[1];
|
|
30450
|
+
var update = function update(type) {
|
|
30451
|
+
if (type === 'prev' && pageRef.current > 1) {
|
|
30452
|
+
setPage(function (last) {
|
|
30453
|
+
return last - 1;
|
|
30454
|
+
});
|
|
30455
|
+
}
|
|
30456
|
+
if (type === 'next' && pageRef.current < count) {
|
|
30457
|
+
setPage(function (last) {
|
|
30458
|
+
return last + 1;
|
|
30459
|
+
});
|
|
30460
|
+
}
|
|
30461
|
+
};
|
|
30462
|
+
var values = React.useMemo(function () {
|
|
30463
|
+
return {
|
|
30464
|
+
isFirst: page <= 1,
|
|
30465
|
+
isLast: page >= count,
|
|
30466
|
+
update: update
|
|
30467
|
+
};
|
|
30468
|
+
}, [page, count]);
|
|
30469
|
+
React.useEffect(function () {
|
|
30470
|
+
onChange && onChange(page);
|
|
30471
|
+
}, [page]);
|
|
30472
|
+
React.useEffect(function () {
|
|
30473
|
+
if (customPage !== undefined) {
|
|
30474
|
+
setPage(customPage);
|
|
30475
|
+
}
|
|
30476
|
+
}, [customPage]);
|
|
30477
|
+
return /*#__PURE__*/React.createElement(PaginationContext.Provider, {
|
|
30478
|
+
value: values
|
|
30479
|
+
}, /*#__PURE__*/React.createElement("nav", _extends({}, props, {
|
|
30480
|
+
className: _JSXStyle.dynamic([["3826701357", [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
|
|
30481
|
+
}), prevItem, /*#__PURE__*/React.createElement(PaginationPages, {
|
|
30482
|
+
count: count,
|
|
30483
|
+
current: page,
|
|
30484
|
+
limit: limit,
|
|
30485
|
+
setPage: setPage
|
|
30486
|
+
}), nextItem), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
30487
|
+
id: "3826701357",
|
|
30488
|
+
dynamic: [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
|
|
30489
|
+
}, "nav.__jsx-style-dynamic-selector{font-variant:tabular-nums;font-feature-settings:'tnum';--pagination-size:".concat(SCALES.font(2), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}nav.__jsx-style-dynamic-selector button:last-of-type{margin-right:0;}")));
|
|
30490
|
+
};
|
|
30491
|
+
PaginationComponent.displayName = 'Pagination';
|
|
30492
|
+
var Pagination = withScale(PaginationComponent);
|
|
30493
|
+
|
|
30494
|
+
Pagination.Previous = PaginationPrevious;
|
|
30495
|
+
Pagination.Next = PaginationNext;
|
|
30496
|
+
|
|
30497
|
+
var _excluded$4 = ["children", "data", "initialData", "hover", "emptyText", "rowDraggable", "readOnly", "onRow", "onCell", "onChange", "onFilters", "onPageChange", "showFilters", "stickyHeader", "onSelected", "dataLength", "viewLength", "className", "rowClassName"];
|
|
30498
|
+
function TableComponent(tableProps) {
|
|
30499
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
30500
|
+
var _ref = tableProps,
|
|
30501
|
+
children = _ref.children,
|
|
30502
|
+
customData = _ref.data,
|
|
30503
|
+
_ref$initialData = _ref.initialData,
|
|
30504
|
+
initialData = _ref$initialData === undefined ? [] : _ref$initialData,
|
|
30505
|
+
_ref$hover = _ref.hover,
|
|
30506
|
+
hover = _ref$hover === undefined ? true : _ref$hover,
|
|
30507
|
+
_ref$emptyText = _ref.emptyText,
|
|
30508
|
+
emptyText = _ref$emptyText === undefined ? '' : _ref$emptyText,
|
|
30509
|
+
_ref$rowDraggable = _ref.rowDraggable,
|
|
30510
|
+
rowDraggable = _ref$rowDraggable === undefined ? false : _ref$rowDraggable,
|
|
30511
|
+
_ref$readOnly = _ref.readOnly,
|
|
30512
|
+
readOnly = _ref$readOnly === undefined ? false : _ref$readOnly,
|
|
30513
|
+
onRow = _ref.onRow,
|
|
30514
|
+
onCell = _ref.onCell;
|
|
30515
|
+
_ref.onChange;
|
|
30516
|
+
var onFilters = _ref.onFilters,
|
|
30517
|
+
onPageChange = _ref.onPageChange,
|
|
30518
|
+
_ref$showFilters = _ref.showFilters,
|
|
30519
|
+
showFilters = _ref$showFilters === undefined ? false : _ref$showFilters,
|
|
30520
|
+
_ref$stickyHeader = _ref.stickyHeader,
|
|
30521
|
+
stickyHeader = _ref$stickyHeader === undefined ? false : _ref$stickyHeader,
|
|
30522
|
+
onSelected = _ref.onSelected,
|
|
30523
|
+
dataLength = _ref.dataLength,
|
|
30524
|
+
viewLength = _ref.viewLength,
|
|
30525
|
+
_ref$className = _ref.className,
|
|
30526
|
+
className = _ref$className === undefined ? '' : _ref$className,
|
|
30527
|
+
_ref$rowClassName = _ref.rowClassName,
|
|
30528
|
+
rowClassName = _ref$rowClassName === undefined ? function () {
|
|
30529
|
+
return '';
|
|
30530
|
+
} : _ref$rowClassName,
|
|
30531
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
30532
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
30533
|
+
var _useScale = useScale(),
|
|
30534
|
+
SCALES = _useScale.SCALES;
|
|
30535
|
+
var ref = React.useRef(null);
|
|
30536
|
+
var _useRealShape = useRealShape(ref),
|
|
30537
|
+
_useRealShape2 = _slicedToArray(_useRealShape, 2),
|
|
30538
|
+
width = _useRealShape2[0].width,
|
|
30539
|
+
updateShape = _useRealShape2[1];
|
|
30540
|
+
var _useState = React.useState([]),
|
|
30541
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30542
|
+
columns = _useState2[0],
|
|
30543
|
+
setColumns = _useState2[1];
|
|
30544
|
+
var _useState3 = React.useState(initialData),
|
|
30545
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
30546
|
+
data = _useState4[0],
|
|
30547
|
+
setData = _useState4[1];
|
|
30548
|
+
var updateColumn = function updateColumn(column) {
|
|
30549
|
+
setColumns(function (last) {
|
|
30550
|
+
var hasColumn = last.find(function (item) {
|
|
30551
|
+
return item.prop === column.prop;
|
|
30552
|
+
});
|
|
30553
|
+
if (!hasColumn) return [].concat(_toConsumableArray(last), [column]);
|
|
30554
|
+
return last.map(function (item) {
|
|
30555
|
+
if (item.prop !== column.prop) return item;
|
|
30556
|
+
return column;
|
|
30557
|
+
});
|
|
30558
|
+
});
|
|
30559
|
+
};
|
|
30560
|
+
var contextValue = React.useMemo(function () {
|
|
30561
|
+
return {
|
|
30562
|
+
columns: columns,
|
|
30563
|
+
updateColumn: updateColumn
|
|
30564
|
+
};
|
|
30565
|
+
}, [columns]);
|
|
30566
|
+
React.useEffect(function () {
|
|
30567
|
+
if (typeof customData === 'undefined') return;
|
|
30568
|
+
setData(customData);
|
|
30569
|
+
}, [customData]);
|
|
30570
|
+
useResize(function () {
|
|
30571
|
+
return updateShape();
|
|
30572
|
+
});
|
|
30573
|
+
|
|
30574
|
+
// Function to calculate start and end index for a given page
|
|
30575
|
+
var getDataRange = function getDataRange(pageNumber, itemsPerPage, dataLength) {
|
|
30576
|
+
var startIndex = (pageNumber - 1) * itemsPerPage;
|
|
30577
|
+
var endIndex = Math.min(startIndex + itemsPerPage - 1, dataLength - 1);
|
|
30578
|
+
return {
|
|
30579
|
+
startIndex: startIndex,
|
|
30580
|
+
endIndex: endIndex
|
|
30581
|
+
};
|
|
30582
|
+
};
|
|
30583
|
+
return /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
30584
|
+
value: contextValue
|
|
30585
|
+
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
30586
|
+
ref: ref
|
|
30587
|
+
}, props, {
|
|
30588
|
+
className: _JSXStyle.dynamic([["2132340556", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
|
|
30589
|
+
}), /*#__PURE__*/React.createElement(TableHead, {
|
|
30590
|
+
stickyHeader: stickyHeader,
|
|
30591
|
+
columns: columns,
|
|
30592
|
+
onFilters: onFilters,
|
|
30593
|
+
showFilters: showFilters,
|
|
30594
|
+
width: width
|
|
30595
|
+
}), /*#__PURE__*/React.createElement(TableBody, {
|
|
30596
|
+
data: data,
|
|
30597
|
+
hover: hover,
|
|
30598
|
+
emptyText: emptyText,
|
|
30599
|
+
onRow: onRow,
|
|
30600
|
+
onCell: onCell,
|
|
30601
|
+
rowClassName: rowClassName,
|
|
30602
|
+
rowDraggable: rowDraggable,
|
|
30603
|
+
readOnly: readOnly,
|
|
30604
|
+
onSelected: onSelected
|
|
30605
|
+
}), children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
30606
|
+
id: "2132340556",
|
|
30607
|
+
dynamic: [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
|
|
30608
|
+
}, "table.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;--table-font-size:".concat(SCALES.font(1), ";font-size:var(--table-font-size);width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")), dataLength && viewLength && onPageChange ? /*#__PURE__*/React.createElement("tfoot", {
|
|
30609
|
+
className: _JSXStyle.dynamic([["2132340556", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]])
|
|
30610
|
+
}, /*#__PURE__*/React.createElement(Pagination, {
|
|
30611
|
+
onChange: function onChange(pageNumber) {
|
|
30612
|
+
// Get the range for the current page
|
|
30613
|
+
var _getDataRange = getDataRange(pageNumber, viewLength, dataLength),
|
|
30614
|
+
startIndex = _getDataRange.startIndex,
|
|
30615
|
+
endIndex = _getDataRange.endIndex;
|
|
30616
|
+
onPageChange(pageNumber, startIndex, endIndex);
|
|
30617
|
+
},
|
|
30618
|
+
limit: 5,
|
|
30619
|
+
count: Number(dataLength / viewLength)
|
|
30620
|
+
}, /*#__PURE__*/React.createElement(Pagination.Next, null, /*#__PURE__*/React.createElement(ChevronRight$1, null)), /*#__PURE__*/React.createElement(Pagination.Previous, null, /*#__PURE__*/React.createElement(ChevronLeft$1, null)))) : null));
|
|
30621
|
+
}
|
|
30622
|
+
TableComponent.displayName = 'Table';
|
|
30623
|
+
TableComponent.Column = TableColumn;
|
|
30624
|
+
var Table = withScale(TableComponent);
|
|
30625
|
+
Table.Column = TableColumn;
|
|
30626
|
+
|
|
30242
30627
|
var ButtonDrip = function ButtonDrip(_ref) {
|
|
30243
30628
|
var _ref$x = _ref.x,
|
|
30244
30629
|
x = _ref$x === undefined ? 0 : _ref$x,
|
|
@@ -30421,41 +30806,6 @@ var useButtonGroupContext = function useButtonGroupContext() {
|
|
|
30421
30806
|
return React.useContext(ButtonGroupContext);
|
|
30422
30807
|
};
|
|
30423
30808
|
|
|
30424
|
-
var hexToRgb = function hexToRgb(color) {
|
|
30425
|
-
var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
30426
|
-
var full = color.replace(fullReg, function (_, r, g, b) {
|
|
30427
|
-
return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
30428
|
-
});
|
|
30429
|
-
var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
30430
|
-
if (!values) {
|
|
30431
|
-
throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
|
|
30432
|
-
}
|
|
30433
|
-
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
30434
|
-
};
|
|
30435
|
-
var colorToRgbValues = function colorToRgbValues(color) {
|
|
30436
|
-
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
30437
|
-
var safeColor = color.replace(/ /g, '');
|
|
30438
|
-
var colorType = color.substr(0, 4);
|
|
30439
|
-
var regArray = safeColor.match(/\((.+)\)/);
|
|
30440
|
-
if (!colorType.startsWith('rgb') || !regArray) {
|
|
30441
|
-
console.log(color);
|
|
30442
|
-
throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
|
|
30443
|
-
}
|
|
30444
|
-
return regArray[1].split(',').map(function (str) {
|
|
30445
|
-
return Number.parseFloat(str);
|
|
30446
|
-
});
|
|
30447
|
-
};
|
|
30448
|
-
var addColorAlpha = function addColorAlpha(color, alpha) {
|
|
30449
|
-
if (!/^#|rgb|RGB/.test(color)) return color;
|
|
30450
|
-
var _colorToRgbValues = colorToRgbValues(color),
|
|
30451
|
-
_colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
|
|
30452
|
-
r = _colorToRgbValues2[0],
|
|
30453
|
-
g = _colorToRgbValues2[1],
|
|
30454
|
-
b = _colorToRgbValues2[2];
|
|
30455
|
-
var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
30456
|
-
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
|
|
30457
|
-
};
|
|
30458
|
-
|
|
30459
30809
|
var getButtonGhostColors = function getButtonGhostColors(palette, type) {
|
|
30460
30810
|
var colors = {
|
|
30461
30811
|
secondary: {
|
|
@@ -31202,6 +31552,9 @@ function DataTable(_ref) {
|
|
|
31202
31552
|
onDragLeave = _ref.onDragLeave,
|
|
31203
31553
|
onDrop = _ref.onDrop,
|
|
31204
31554
|
onRowClick = _ref.onRowClick,
|
|
31555
|
+
dataLength = _ref.dataLength,
|
|
31556
|
+
viewLength = _ref.viewLength,
|
|
31557
|
+
_onPageChange = _ref.onPageChange,
|
|
31205
31558
|
_ref$disableMenu = _ref.disableMenu,
|
|
31206
31559
|
disableMenu = _ref$disableMenu === undefined ? false : _ref$disableMenu;
|
|
31207
31560
|
var TABLE_ID = _.uniqueId('tbl');
|
|
@@ -31217,8 +31570,8 @@ function DataTable(_ref) {
|
|
|
31217
31570
|
// };
|
|
31218
31571
|
var _useState3 = React.useState([]),
|
|
31219
31572
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
31220
|
-
hideColumn = _useState4[0]
|
|
31221
|
-
_useState4[1];
|
|
31573
|
+
hideColumn = _useState4[0],
|
|
31574
|
+
setHideColumn = _useState4[1];
|
|
31222
31575
|
// const handleMenuClose = () => {
|
|
31223
31576
|
// setAnchorEl(null);
|
|
31224
31577
|
// };
|
|
@@ -31276,20 +31629,20 @@ function DataTable(_ref) {
|
|
|
31276
31629
|
// setSelected([]);
|
|
31277
31630
|
// };
|
|
31278
31631
|
|
|
31279
|
-
|
|
31280
|
-
|
|
31281
|
-
|
|
31282
|
-
|
|
31283
|
-
|
|
31284
|
-
|
|
31285
|
-
|
|
31286
|
-
|
|
31287
|
-
|
|
31288
|
-
|
|
31289
|
-
|
|
31290
|
-
|
|
31291
|
-
|
|
31292
|
-
|
|
31632
|
+
var handleHideColumnClick = function handleHideColumnClick(_event, id) {
|
|
31633
|
+
var selectedIndex = hideColumn.indexOf(id);
|
|
31634
|
+
var newSelected = [];
|
|
31635
|
+
if (selectedIndex === -1) {
|
|
31636
|
+
newSelected = newSelected.concat(hideColumn, id);
|
|
31637
|
+
} else if (selectedIndex === 0) {
|
|
31638
|
+
newSelected = newSelected.concat(hideColumn.slice(1));
|
|
31639
|
+
} else if (selectedIndex === hideColumn.length - 1) {
|
|
31640
|
+
newSelected = newSelected.concat(hideColumn.slice(0, -1));
|
|
31641
|
+
} else if (selectedIndex > 0) {
|
|
31642
|
+
newSelected = newSelected.concat(hideColumn.slice(0, selectedIndex), hideColumn.slice(selectedIndex + 1));
|
|
31643
|
+
}
|
|
31644
|
+
setHideColumn(newSelected);
|
|
31645
|
+
};
|
|
31293
31646
|
|
|
31294
31647
|
// Children change reset selected
|
|
31295
31648
|
React.useEffect(function () {
|
|
@@ -31328,6 +31681,19 @@ function DataTable(_ref) {
|
|
|
31328
31681
|
var COLUMNS = cols.filter(function (col) {
|
|
31329
31682
|
return !hideColumn.includes(col.name);
|
|
31330
31683
|
});
|
|
31684
|
+
var content = function content() {
|
|
31685
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, cols.map(function (option, index) {
|
|
31686
|
+
var colunqid = _.uniqueId("".concat(option.name, "-").concat(index));
|
|
31687
|
+
return /*#__PURE__*/React.createElement(Popover.Item, {
|
|
31688
|
+
key: colunqid
|
|
31689
|
+
// selected={!hideColumn.includes(option.name as never)}
|
|
31690
|
+
,
|
|
31691
|
+
onClick: function onClick(e) {
|
|
31692
|
+
return handleHideColumnClick(e, option.name);
|
|
31693
|
+
}
|
|
31694
|
+
}, /*#__PURE__*/React.createElement("span", null, option.name));
|
|
31695
|
+
}));
|
|
31696
|
+
};
|
|
31331
31697
|
return /*#__PURE__*/React.createElement(GridContainer, {
|
|
31332
31698
|
direction: "column"
|
|
31333
31699
|
}, /*#__PURE__*/React.createElement(Grid.Container, {
|
|
@@ -31426,13 +31792,15 @@ function DataTable(_ref) {
|
|
|
31426
31792
|
px: 0.6,
|
|
31427
31793
|
py: 0.4,
|
|
31428
31794
|
type: "dark"
|
|
31795
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
31796
|
+
child: content
|
|
31429
31797
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
31430
31798
|
onClick: function onClick() {},
|
|
31431
31799
|
auto: true,
|
|
31432
31800
|
scale: 2 / 3,
|
|
31433
31801
|
px: 0.6,
|
|
31434
31802
|
iconRight: /*#__PURE__*/React.createElement(Columns$1, null)
|
|
31435
|
-
}))) : null))), children ? /*#__PURE__*/React.createElement("div", {
|
|
31803
|
+
})))) : null))), children ? /*#__PURE__*/React.createElement("div", {
|
|
31436
31804
|
style: {
|
|
31437
31805
|
padding: '1rem'
|
|
31438
31806
|
}
|
|
@@ -31457,11 +31825,21 @@ function DataTable(_ref) {
|
|
|
31457
31825
|
onDrop: onDrop,
|
|
31458
31826
|
id: TABLE_ID,
|
|
31459
31827
|
style: _objectSpread2({
|
|
31828
|
+
overflow: 'auto',
|
|
31829
|
+
position: 'relative',
|
|
31460
31830
|
height: 'calc(100vh - 8.5rem)',
|
|
31461
31831
|
maxWidth: 'calc(100vw - 1rem)',
|
|
31462
31832
|
width: sideMenu ? 'calc(100vw - 17.2rem)' : 'inherit !important'
|
|
31463
31833
|
}, style)
|
|
31464
31834
|
}, /*#__PURE__*/React.createElement(Table, {
|
|
31835
|
+
stickyHeader: true,
|
|
31836
|
+
dataLength: dataLength,
|
|
31837
|
+
viewLength: viewLength,
|
|
31838
|
+
onPageChange: function onPageChange(page, start, end) {
|
|
31839
|
+
if (_onPageChange) {
|
|
31840
|
+
_onPageChange(page, start, end);
|
|
31841
|
+
}
|
|
31842
|
+
},
|
|
31465
31843
|
onRow: onRowClick,
|
|
31466
31844
|
rowDraggable: rowDraggable,
|
|
31467
31845
|
showFilters: openFilter,
|