@salutejs/plasma-new-hope 0.317.0-dev.0 → 0.318.0-canary.1888.14216501427.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/Table/Table.css +24 -22
- package/cjs/components/Table/Table.js +11 -16
- package/cjs/components/Table/Table.js.map +1 -1
- package/cjs/components/Table/Table.styles.js +17 -11
- package/cjs/components/Table/Table.styles.js.map +1 -1
- package/cjs/components/Table/Table.styles_xngwgy.css +12 -0
- package/cjs/components/Table/Table.tokens.js +9 -0
- package/cjs/components/Table/Table.tokens.js.map +1 -1
- package/cjs/components/Table/ui/Cell/Cell.css +24 -22
- package/cjs/components/Table/ui/Cell/Cell.js.map +1 -1
- package/cjs/components/Table/ui/Cell/Cell.styles.js +1 -1
- package/cjs/components/Table/ui/Cell/Cell.styles.js.map +1 -1
- package/cjs/components/Table/ui/Cell/Cell.styles_1q2mjxm.css +1 -0
- package/cjs/components/Table/ui/EditableCell/EditableCell.css +25 -23
- package/cjs/components/Table/ui/EditableCell/EditableCell.js +15 -9
- package/cjs/components/Table/ui/EditableCell/EditableCell.js.map +1 -1
- package/cjs/components/Table/ui/EditableCell/EditableCell.styles.js +5 -5
- package/cjs/components/Table/ui/EditableCell/EditableCell.styles.js.map +1 -1
- package/{es/components/Table/ui/EditableCell/EditableCell.styles_277bjm.css → cjs/components/Table/ui/EditableCell/EditableCell.styles_1g3clv2.css} +3 -3
- package/cjs/components/Table/ui/HeadCell/HeadCell.css +24 -22
- package/cjs/components/Table/ui/HeadCell/HeadCell.js +9 -9
- package/cjs/components/Table/ui/HeadCell/HeadCell.js.map +1 -1
- package/cjs/components/Table/ui/HeadCell/HeadCell.styles.js +7 -1
- package/cjs/components/Table/ui/HeadCell/HeadCell.styles.js.map +1 -1
- package/{es/components/Table/ui/HeadCell/HeadCell.styles_1lo3lcf.css → cjs/components/Table/ui/HeadCell/HeadCell.styles_155gsrn.css} +1 -0
- package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.css +24 -22
- package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.js +3 -1
- package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.js.map +1 -1
- package/cjs/index.css +26 -24
- package/emotion/cjs/components/Table/Table.js +14 -16
- package/emotion/cjs/components/Table/Table.styles.js +20 -16
- package/emotion/cjs/components/Table/Table.tokens.js +9 -1
- package/emotion/cjs/components/Table/ui/Cell/Cell.styles.js +2 -2
- package/emotion/cjs/components/Table/ui/EditableCell/EditableCell.js +15 -9
- package/emotion/cjs/components/Table/ui/EditableCell/EditableCell.styles.js +9 -9
- package/emotion/cjs/components/Table/ui/HeadCell/HeadCell.js +9 -9
- package/emotion/cjs/components/Table/ui/HeadCell/HeadCell.styles.js +17 -5
- package/emotion/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.js +3 -1
- package/emotion/cjs/examples/plasma_b2c/components/Table/Table.stories.tsx +7 -6
- package/emotion/cjs/examples/plasma_web/components/Table/Table.stories.tsx +7 -6
- package/emotion/es/components/Table/Table.js +15 -17
- package/emotion/es/components/Table/Table.styles.js +19 -15
- package/emotion/es/components/Table/Table.tokens.js +8 -0
- package/emotion/es/components/Table/ui/Cell/Cell.styles.js +2 -2
- package/emotion/es/components/Table/ui/EditableCell/EditableCell.js +15 -9
- package/emotion/es/components/Table/ui/EditableCell/EditableCell.styles.js +10 -10
- package/emotion/es/components/Table/ui/HeadCell/HeadCell.js +10 -10
- package/emotion/es/components/Table/ui/HeadCell/HeadCell.styles.js +16 -4
- package/emotion/es/components/Table/ui/HeadCell/ui/Filter/Filter.js +3 -1
- package/emotion/es/examples/plasma_b2c/components/Table/Table.stories.tsx +7 -6
- package/emotion/es/examples/plasma_web/components/Table/Table.stories.tsx +7 -6
- package/es/components/Table/Table.css +24 -22
- package/es/components/Table/Table.js +13 -18
- package/es/components/Table/Table.js.map +1 -1
- package/es/components/Table/Table.styles.js +17 -12
- package/es/components/Table/Table.styles.js.map +1 -1
- package/es/components/Table/Table.styles_xngwgy.css +12 -0
- package/es/components/Table/Table.tokens.js +9 -1
- package/es/components/Table/Table.tokens.js.map +1 -1
- package/es/components/Table/ui/Cell/Cell.css +24 -22
- package/es/components/Table/ui/Cell/Cell.js.map +1 -1
- package/es/components/Table/ui/Cell/Cell.styles.js +1 -1
- package/es/components/Table/ui/Cell/Cell.styles.js.map +1 -1
- package/es/components/Table/ui/Cell/Cell.styles_1q2mjxm.css +1 -0
- package/es/components/Table/ui/EditableCell/EditableCell.css +25 -23
- package/es/components/Table/ui/EditableCell/EditableCell.js +15 -9
- package/es/components/Table/ui/EditableCell/EditableCell.js.map +1 -1
- package/es/components/Table/ui/EditableCell/EditableCell.styles.js +5 -5
- package/es/components/Table/ui/EditableCell/EditableCell.styles.js.map +1 -1
- package/{cjs/components/Table/ui/EditableCell/EditableCell.styles_277bjm.css → es/components/Table/ui/EditableCell/EditableCell.styles_1g3clv2.css} +3 -3
- package/es/components/Table/ui/HeadCell/HeadCell.css +24 -22
- package/es/components/Table/ui/HeadCell/HeadCell.js +10 -10
- package/es/components/Table/ui/HeadCell/HeadCell.js.map +1 -1
- package/es/components/Table/ui/HeadCell/HeadCell.styles.js +7 -2
- package/es/components/Table/ui/HeadCell/HeadCell.styles.js.map +1 -1
- package/{cjs/components/Table/ui/HeadCell/HeadCell.styles_1lo3lcf.css → es/components/Table/ui/HeadCell/HeadCell.styles_155gsrn.css} +1 -0
- package/es/components/Table/ui/HeadCell/ui/Filter/Filter.css +24 -22
- package/es/components/Table/ui/HeadCell/ui/Filter/Filter.js +3 -1
- package/es/components/Table/ui/HeadCell/ui/Filter/Filter.js.map +1 -1
- package/es/index.css +26 -24
- package/package.json +2 -2
- package/styled-components/cjs/components/Table/Table.js +14 -16
- package/styled-components/cjs/components/Table/Table.styles.js +13 -10
- package/styled-components/cjs/components/Table/Table.tokens.js +9 -1
- package/styled-components/cjs/components/Table/ui/Cell/Cell.styles.js +1 -1
- package/styled-components/cjs/components/Table/ui/EditableCell/EditableCell.js +15 -9
- package/styled-components/cjs/components/Table/ui/EditableCell/EditableCell.styles.js +4 -4
- package/styled-components/cjs/components/Table/ui/HeadCell/HeadCell.js +9 -9
- package/styled-components/cjs/components/Table/ui/HeadCell/HeadCell.styles.js +5 -2
- package/styled-components/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.js +3 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Table/Table.stories.tsx +7 -6
- package/styled-components/cjs/examples/plasma_web/components/Table/Table.stories.tsx +7 -6
- package/styled-components/es/components/Table/Table.js +15 -17
- package/styled-components/es/components/Table/Table.styles.js +12 -9
- package/styled-components/es/components/Table/Table.tokens.js +8 -0
- package/styled-components/es/components/Table/ui/Cell/Cell.styles.js +1 -1
- package/styled-components/es/components/Table/ui/EditableCell/EditableCell.js +15 -9
- package/styled-components/es/components/Table/ui/EditableCell/EditableCell.styles.js +5 -5
- package/styled-components/es/components/Table/ui/HeadCell/HeadCell.js +10 -10
- package/styled-components/es/components/Table/ui/HeadCell/HeadCell.styles.js +4 -1
- package/styled-components/es/components/Table/ui/HeadCell/ui/Filter/Filter.js +3 -1
- package/styled-components/es/examples/plasma_b2c/components/Table/Table.stories.tsx +7 -6
- package/styled-components/es/examples/plasma_web/components/Table/Table.stories.tsx +7 -6
- package/types/components/Table/Table.d.ts +2 -15
- package/types/components/Table/Table.d.ts.map +1 -1
- package/types/components/Table/Table.styles.d.ts +1 -0
- package/types/components/Table/Table.styles.d.ts.map +1 -1
- package/types/components/Table/Table.tokens.d.ts +8 -0
- package/types/components/Table/Table.tokens.d.ts.map +1 -1
- package/types/components/Table/Table.types.d.ts +11 -1
- package/types/components/Table/Table.types.d.ts.map +1 -1
- package/types/components/Table/ui/Cell/Cell.d.ts +3 -2
- package/types/components/Table/ui/Cell/Cell.d.ts.map +1 -1
- package/types/components/Table/ui/EditableCell/EditableCell.d.ts +12 -1
- package/types/components/Table/ui/EditableCell/EditableCell.d.ts.map +1 -1
- package/types/components/Table/ui/EditableCell/EditableCell.styles.d.ts.map +1 -1
- package/types/components/Table/ui/HeadCell/HeadCell.d.ts +11 -1
- package/types/components/Table/ui/HeadCell/HeadCell.d.ts.map +1 -1
- package/types/components/Table/ui/HeadCell/HeadCell.styles.d.ts +1 -0
- package/types/components/Table/ui/HeadCell/HeadCell.styles.d.ts.map +1 -1
- package/types/components/Table/ui/HeadCell/ui/Filter/Filter.d.ts +10 -1
- package/types/components/Table/ui/HeadCell/ui/Filter/Filter.d.ts.map +1 -1
- package/cjs/components/Table/Table.styles_1eg2zsx.css +0 -11
- package/cjs/components/Table/ui/Cell/Cell.styles_1ikyrwt.css +0 -1
- package/es/components/Table/Table.styles_1eg2zsx.css +0 -11
- package/es/components/Table/ui/Cell/Cell.styles_1ikyrwt.css +0 -1
@@ -12,8 +12,9 @@ var _Table2 = /*#__PURE__*/require("../../Table");
|
|
12
12
|
var _hooks = /*#__PURE__*/require("../../../../hooks");
|
13
13
|
var _Icon = /*#__PURE__*/require("../../../_Icon");
|
14
14
|
var _HeadCell = /*#__PURE__*/require("../HeadCell/HeadCell");
|
15
|
+
var _Table3 = /*#__PURE__*/require("../../Table.tokens");
|
15
16
|
var _EditableCell = /*#__PURE__*/require("./EditableCell.styles");
|
16
|
-
var
|
17
|
+
var _Resizer;
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
19
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
@@ -28,12 +29,13 @@ var keys = {
|
|
28
29
|
Escape: 'Escape'
|
29
30
|
};
|
30
31
|
var EditableCell = exports.EditableCell = function EditableCell(_ref) {
|
32
|
+
var _table$options$meta;
|
31
33
|
var size = _ref.size,
|
34
|
+
view = _ref.view,
|
32
35
|
cell = _ref.cell,
|
33
36
|
borderVariant = _ref.borderVariant,
|
34
37
|
table = _ref.table,
|
35
|
-
selected = _ref.selected
|
36
|
-
view = _ref.view;
|
38
|
+
selected = _ref.selected;
|
37
39
|
var _useState = (0, _react.useState)(cell.getValue()),
|
38
40
|
_useState2 = _slicedToArray(_useState, 2),
|
39
41
|
value = _useState2[0],
|
@@ -42,7 +44,7 @@ var EditableCell = exports.EditableCell = function EditableCell(_ref) {
|
|
42
44
|
_useState4 = _slicedToArray(_useState3, 2),
|
43
45
|
editingMode = _useState4[0],
|
44
46
|
setEditingMode = _useState4[1];
|
45
|
-
var updateData = table.options.meta.updateData;
|
47
|
+
var updateData = (_table$options$meta = table.options.meta) === null || _table$options$meta === void 0 ? void 0 : _table$options$meta.updateData;
|
46
48
|
var ref = (0, _hooks.useOutsideClick)(function () {
|
47
49
|
setEditingMode(false);
|
48
50
|
});
|
@@ -59,14 +61,18 @@ var EditableCell = exports.EditableCell = function EditableCell(_ref) {
|
|
59
61
|
};
|
60
62
|
var handleSubmit = function handleSubmit(e) {
|
61
63
|
e.stopPropagation();
|
62
|
-
updateData
|
64
|
+
if (updateData) {
|
65
|
+
updateData(cell.row.id, cell.column.id, value);
|
66
|
+
}
|
63
67
|
setEditingMode(false);
|
64
68
|
};
|
65
69
|
var handleKeyDown = function handleKeyDown(event) {
|
66
70
|
switch (event.code) {
|
67
71
|
case keys.Enter:
|
68
72
|
{
|
69
|
-
updateData
|
73
|
+
if (updateData) {
|
74
|
+
updateData(cell.row.id, cell.column.id, value);
|
75
|
+
}
|
70
76
|
setEditingMode(false);
|
71
77
|
break;
|
72
78
|
}
|
@@ -106,11 +112,11 @@ var EditableCell = exports.EditableCell = function EditableCell(_ref) {
|
|
106
112
|
tabIndex: -1
|
107
113
|
}, /*#__PURE__*/_react["default"].createElement(_Icon.IconDoneCircleOutline, {
|
108
114
|
size: (0, _HeadCell.getIconSize)(size)
|
109
|
-
}))) : /*#__PURE__*/_react["default"].createElement(_EditableCell.ContentWrapper, null, (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
115
|
+
}))) : /*#__PURE__*/_react["default"].createElement(_EditableCell.ContentWrapper, null, (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext()), /*#__PURE__*/_react["default"].createElement(_Icon.IconEditOutline, {
|
110
116
|
size: "xs",
|
111
|
-
className:
|
117
|
+
className: _Table3.classes.editIcon,
|
112
118
|
color: "var(--text-secondary)"
|
113
|
-
})))
|
119
|
+
}))), cell.column.getIsResizing() && (_Resizer || (_Resizer = /*#__PURE__*/_react["default"].createElement(_Table.Resizer, {
|
114
120
|
isResizing: true
|
115
121
|
}))));
|
116
122
|
};
|
@@ -13,7 +13,7 @@ var mergedIndicatorConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_IconButton.i
|
|
13
13
|
var IconButton = /*#__PURE__*/(0, _engines.component)(mergedIndicatorConfig);
|
14
14
|
var Td = exports.Td = /*#__PURE__*/_styledComponents["default"].td.withConfig({
|
15
15
|
componentId: "plasma-new-hope__sc-1uu72a1-0"
|
16
|
-
})(["position:relative;padding:", ";height:var(", ");border-width:
|
16
|
+
})(["position:relative;padding:", ";height:var(", ");border-width:0.0625rem;border-top-width:0;border-style:solid;border-color:", ";border-bottom-color:", ";cursor:pointer;box-sizing:border-box;& .", "{opacity:0;}&:hover .", "{opacity:1;}"], function (_ref) {
|
17
17
|
var selectionCell = _ref.selectionCell,
|
18
18
|
editingMode = _ref.editingMode;
|
19
19
|
return (
|
@@ -31,7 +31,7 @@ var Td = exports.Td = /*#__PURE__*/_styledComponents["default"].td.withConfig({
|
|
31
31
|
}, function (_ref3) {
|
32
32
|
var borderVariant = _ref3.borderVariant;
|
33
33
|
return borderVariant === 'all' || borderVariant === 'rows' ? "var(".concat(_Table.tableTokens.borderColor, ")") : 'transparent';
|
34
|
-
});
|
34
|
+
}, _Table.classes.editIcon, _Table.classes.editIcon);
|
35
35
|
var InnerWrapper = exports.InnerWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
36
36
|
componentId: "plasma-new-hope__sc-1uu72a1-1"
|
37
37
|
})(["display:flex;align-items:center;justify-content:space-between;width:100%;height:100%;"]);
|
@@ -43,10 +43,10 @@ var EditModeWrapper = exports.EditModeWrapper = /*#__PURE__*/_styledComponents["
|
|
43
43
|
})(["display:flex;align-items:center;justify-content:space-between;gap:var(", ");height:100%;"], _Table.tableTokens.editableCellPadding);
|
44
44
|
var InputWrapper = exports.InputWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
45
45
|
componentId: "plasma-new-hope__sc-1uu72a1-4"
|
46
|
-
})(["display:flex;align-items:center;height:100%;flex:1;padding:var(", ");background:var(", ");border:
|
46
|
+
})(["display:flex;align-items:center;height:100%;flex:1;padding:var(", ");background:var(", ");border:0.0625rem solid var(", ");border-radius:var(", ");box-sizing:border-box;gap:var(", ");"], _Table.tableTokens.editableCellInputPadding, _Table.tableTokens.editableCellInputBackground, _Table.tableTokens.editableCellInputBorderColor, _Table.tableTokens.editableCellInputBorderRadius, _Table.tableTokens.editableCellIconGap);
|
47
47
|
var Input = exports.Input = /*#__PURE__*/_styledComponents["default"].input.withConfig({
|
48
48
|
componentId: "plasma-new-hope__sc-1uu72a1-5"
|
49
|
-
})(["width:auto;border:none;padding:0;background:transparent;outline:none;caret-color:var(--text-accent);font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], _Table.tableTokens.fontFamily, _Table.tableTokens.fontSize, _Table.tableTokens.fontStyle, _Table.tableTokens.fontWeight, _Table.tableTokens.letterSpacing, _Table.tableTokens.lineHeight);
|
49
|
+
})(["width:auto;border:none;padding:0;background:transparent;outline:none;caret-color:var(--text-accent);color:var(--text-primary);font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], _Table.tableTokens.fontFamily, _Table.tableTokens.fontSize, _Table.tableTokens.fontStyle, _Table.tableTokens.fontWeight, _Table.tableTokens.letterSpacing, _Table.tableTokens.lineHeight);
|
50
50
|
var IconDoneButton = exports.IconDoneButton = /*#__PURE__*/(0, _styledComponents["default"])(IconButton).withConfig({
|
51
51
|
componentId: "plasma-new-hope__sc-1uu72a1-6"
|
52
52
|
})(["", ":var(", ");", ":var(", ");"], _IconButton.iconButtonTokens.iconButtonWidth, _Table.tableTokens.editableCellIconButtonWidth, _IconButton.iconButtonTokens.iconButtonHeight, _Table.tableTokens.editableCellIconButtonHeight);
|
@@ -9,6 +9,7 @@ var _react = /*#__PURE__*/_interopRequireDefault(/*#__PURE__*/require("react"));
|
|
9
9
|
var _Table = /*#__PURE__*/require("../../Table.styles");
|
10
10
|
var _Icon = /*#__PURE__*/require("../../../_Icon");
|
11
11
|
var _Table2 = /*#__PURE__*/require("../../Table");
|
12
|
+
var _Table3 = /*#__PURE__*/require("../../Table.tokens");
|
12
13
|
var _HeadCell = /*#__PURE__*/require("./HeadCell.styles");
|
13
14
|
var _Filter = /*#__PURE__*/require("./ui/Filter/Filter");
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
@@ -37,23 +38,22 @@ var HeadCell = exports.HeadCell = function HeadCell(_ref) {
|
|
37
38
|
size: size,
|
38
39
|
outerFiltered: outerFiltered,
|
39
40
|
tableContainerRef: tableContainerRef
|
40
|
-
}), header.column.getCanSort() && /*#__PURE__*/_react["default"].createElement(
|
41
|
-
style: {
|
42
|
-
lineHeight: 0,
|
43
|
-
cursor: 'pointer',
|
44
|
-
userSelect: 'none'
|
45
|
-
},
|
41
|
+
}), header.column.getCanSort() && /*#__PURE__*/_react["default"].createElement(_HeadCell.IconWrapper, {
|
46
42
|
onClick: header.column.getToggleSortingHandler()
|
47
43
|
}, (_asc$desc = {
|
48
44
|
asc: /*#__PURE__*/_react["default"].createElement(_Icon.IconArrowUp, {
|
49
|
-
size: getIconSize(size)
|
45
|
+
size: getIconSize(size),
|
46
|
+
className: _Table3.classes.sortingAscIcon
|
50
47
|
}),
|
51
48
|
desc: /*#__PURE__*/_react["default"].createElement(_Icon.IconArrowDown, {
|
52
|
-
size: getIconSize(size)
|
49
|
+
size: getIconSize(size),
|
50
|
+
className: _Table3.classes.sortingDescIcon
|
53
51
|
})
|
54
52
|
}[header.column.getIsSorted()]) !== null && _asc$desc !== void 0 ? _asc$desc : /*#__PURE__*/_react["default"].createElement(_Icon.IconSwapVert, {
|
55
|
-
size: getIconSize(size)
|
53
|
+
size: getIconSize(size),
|
54
|
+
className: _Table3.classes.sortingDefaultIcon
|
56
55
|
}))))), header.column.getCanResize() && /*#__PURE__*/_react["default"].createElement(_Table.Resizer, {
|
56
|
+
className: _Table3.classes.resizeDivider,
|
57
57
|
onMouseDown: header.getResizeHandler(),
|
58
58
|
onTouchStart: header.getResizeHandler(),
|
59
59
|
isResizing: header.column.getIsResizing()
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.ThWrapper = exports.ControlButtons = void 0;
|
6
|
+
exports.ThWrapper = exports.IconWrapper = exports.ControlButtons = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/_interopRequireDefault(/*#__PURE__*/require("styled-components"));
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9
9
|
var ControlButtons = exports.ControlButtons = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
@@ -11,4 +11,7 @@ var ControlButtons = exports.ControlButtons = /*#__PURE__*/_styledComponents["de
|
|
11
11
|
})(["display:flex;justify-content:space-between;align-items:center;gap:0.5rem;"]);
|
12
12
|
var ThWrapper = exports.ThWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
13
13
|
componentId: "plasma-new-hope__sc-haivw3-1"
|
14
|
-
})(["display:flex;justify-content:space-between;align-items:center;gap:0.5rem;"]);
|
14
|
+
})(["display:flex;justify-content:space-between;align-items:center;gap:0.5rem;"]);
|
15
|
+
var IconWrapper = exports.IconWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
16
|
+
componentId: "plasma-new-hope__sc-haivw3-2"
|
17
|
+
})(["line-height:0;cursor:pointer;user-select:none;"]);
|
@@ -10,6 +10,7 @@ var _hooks = /*#__PURE__*/require("../../../../../../hooks");
|
|
10
10
|
var _Icon = /*#__PURE__*/require("../../../../../_Icon");
|
11
11
|
var _HeadCell = /*#__PURE__*/require("../../HeadCell");
|
12
12
|
var _Table = /*#__PURE__*/require("../../../../Table.styles");
|
13
|
+
var _Table2 = /*#__PURE__*/require("../../../../Table.tokens");
|
13
14
|
var _Filter = /*#__PURE__*/require("./Filter.styles");
|
14
15
|
var _StyledIndicator, _StyledDivider;
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
@@ -85,7 +86,8 @@ var Filter = exports.Filter = function Filter(_ref) {
|
|
85
86
|
onChange: setLocalFiltered,
|
86
87
|
renderTarget: function renderTarget() {
|
87
88
|
return /*#__PURE__*/_react["default"].createElement(_Filter.IconFilterWrapper, null, /*#__PURE__*/_react["default"].createElement(_Icon.IconFilterFunnel, {
|
88
|
-
size: (0, _HeadCell.getIconSize)(size)
|
89
|
+
size: (0, _HeadCell.getIconSize)(size),
|
90
|
+
className: _Table2.classes.filterIcon
|
89
91
|
}), filtered.length ? _StyledIndicator || (_StyledIndicator = /*#__PURE__*/_react["default"].createElement(_Filter.StyledIndicator, {
|
90
92
|
size: "s",
|
91
93
|
view: "accent"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { useRef, ComponentProps, useState } from 'react';
|
2
2
|
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
import { getConfigVariations } from '@salutejs/plasma-sb-utils';
|
3
4
|
|
4
5
|
import { WithTheme } from '../../../_helpers';
|
5
6
|
import { ButtonGroup } from '../ButtonGroup/ButtonGroup';
|
@@ -8,12 +9,12 @@ import { IconButton } from '../IconButton/IconButton';
|
|
8
9
|
import { IconEditOutline } from '../../../../components/_Icon';
|
9
10
|
import { Dropdown } from '../Dropdown/Dropdown';
|
10
11
|
|
12
|
+
import { config } from './Table.config';
|
11
13
|
import { Table } from './Table';
|
12
14
|
|
13
15
|
type StoryTableProps = ComponentProps<typeof Table>;
|
14
16
|
|
15
|
-
const
|
16
|
-
const size = ['s', 'm', 'l'];
|
17
|
+
const { views, sizes } = getConfigVariations(config);
|
17
18
|
const borderVariant = ['rows', 'header', 'all'];
|
18
19
|
|
19
20
|
const meta: Meta<StoryTableProps> = {
|
@@ -23,11 +24,11 @@ const meta: Meta<StoryTableProps> = {
|
|
23
24
|
argTypes: {
|
24
25
|
view: {
|
25
26
|
control: 'select',
|
26
|
-
options:
|
27
|
+
options: views,
|
27
28
|
},
|
28
29
|
size: {
|
29
30
|
control: 'select',
|
30
|
-
options:
|
31
|
+
options: sizes,
|
31
32
|
},
|
32
33
|
borderVariant: {
|
33
34
|
control: 'select',
|
@@ -514,8 +515,8 @@ const StoryComplex = (args: StoryTableProps) => {
|
|
514
515
|
<Button text="Очистить выбранные" view="warning" size="xs" onClick={clearSelected} />
|
515
516
|
<Button text="Убрать сортировку" view="warning" size="xs" onClick={clearSorted} />
|
516
517
|
<Button text="Очистить фильтры" view="warning" size="xs" onClick={clearFiltered} />
|
517
|
-
<Button text="Очистить все" view="
|
518
|
-
<Button text="Добавить строку" view="
|
518
|
+
<Button text="Очистить все" view="negative" size="xs" onClick={clearAll} />
|
519
|
+
<Button text="Добавить строку" view="positive" size="xs" onClick={addRow} />
|
519
520
|
</ButtonGroup>
|
520
521
|
|
521
522
|
<br />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { useRef, ComponentProps, useState } from 'react';
|
2
2
|
import type { StoryObj, Meta } from '@storybook/react';
|
3
|
+
import { getConfigVariations } from '@salutejs/plasma-sb-utils';
|
3
4
|
|
4
5
|
import { WithTheme } from '../../../_helpers';
|
5
6
|
import { ButtonGroup } from '../ButtonGroup/ButtonGroup';
|
@@ -7,13 +8,13 @@ import { Button } from '../Button/Button';
|
|
7
8
|
import { IconButton } from '../IconButton/IconButton';
|
8
9
|
import { IconEditOutline } from '../../../../components/_Icon';
|
9
10
|
import { Dropdown } from '../Dropdown/Dropdown';
|
11
|
+
import { config } from '../../../plasma_b2c/components/Table/Table.config';
|
10
12
|
|
11
13
|
import { Table } from './Table';
|
12
14
|
|
13
15
|
type StoryTableProps = ComponentProps<typeof Table>;
|
14
16
|
|
15
|
-
const
|
16
|
-
const size = ['s', 'm', 'l'];
|
17
|
+
const { views, sizes } = getConfigVariations(config);
|
17
18
|
const borderVariant = ['rows', 'header', 'all'];
|
18
19
|
|
19
20
|
const meta: Meta<StoryTableProps> = {
|
@@ -23,11 +24,11 @@ const meta: Meta<StoryTableProps> = {
|
|
23
24
|
argTypes: {
|
24
25
|
view: {
|
25
26
|
control: 'select',
|
26
|
-
options:
|
27
|
+
options: views,
|
27
28
|
},
|
28
29
|
size: {
|
29
30
|
control: 'select',
|
30
|
-
options:
|
31
|
+
options: sizes,
|
31
32
|
},
|
32
33
|
borderVariant: {
|
33
34
|
control: 'select',
|
@@ -514,8 +515,8 @@ const StoryComplex = (args: StoryTableProps) => {
|
|
514
515
|
<Button text="Очистить выбранные" view="warning" size="xs" onClick={clearSelected} />
|
515
516
|
<Button text="Убрать сортировку" view="warning" size="xs" onClick={clearSorted} />
|
516
517
|
<Button text="Очистить фильтры" view="warning" size="xs" onClick={clearFiltered} />
|
517
|
-
<Button text="Очистить все" view="
|
518
|
-
<Button text="Добавить строку" view="
|
518
|
+
<Button text="Очистить все" view="negative" size="xs" onClick={clearAll} />
|
519
|
+
<Button text="Добавить строку" view="positive" size="xs" onClick={addRow} />
|
519
520
|
</ButtonGroup>
|
520
521
|
|
521
522
|
<br />
|
@@ -1,3 +1,5 @@
|
|
1
|
+
var _excluded = ["data", "onChange", "columns", "view", "size", "borderVariant", "enableSelection", "selected", "filtered", "sorted", "maxHeight", "stickyHeader", "onCellUpdate"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
1
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
@@ -8,12 +10,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
8
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
9
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
10
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
14
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
11
15
|
import React, { forwardRef, useState, useMemo, useRef } from 'react';
|
12
16
|
import { getCoreRowModel, useReactTable, getSortedRowModel, getFilteredRowModel } from '@tanstack/react-table';
|
13
17
|
import { useForkRef } from '@salutejs/plasma-core';
|
14
18
|
import { HeadCell, Cell, EditableCell } from './ui';
|
15
|
-
import { base, Table, Tr, Thead, StyledCheckbox } from './Table.styles';
|
16
|
-
export var SELECT_COLUMN_ID = '
|
19
|
+
import { base, Table, Tr, Thead, StyledCheckbox, Tbody } from './Table.styles';
|
20
|
+
export var SELECT_COLUMN_ID = 'SELECT_COLUMN_UNIQUE_ID';
|
17
21
|
export var tableRoot = function tableRoot(Root) {
|
18
22
|
return /*#__PURE__*/forwardRef(function (_ref, ref) {
|
19
23
|
var data = _ref.data,
|
@@ -29,7 +33,8 @@ export var tableRoot = function tableRoot(Root) {
|
|
29
33
|
outerSorted = _ref.sorted,
|
30
34
|
maxHeight = _ref.maxHeight,
|
31
35
|
stickyHeader = _ref.stickyHeader,
|
32
|
-
onCellUpdate = _ref.onCellUpdate
|
36
|
+
onCellUpdate = _ref.onCellUpdate,
|
37
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
33
38
|
var _useState = useState(outerSelected || {}),
|
34
39
|
_useState2 = _slicedToArray(_useState, 2),
|
35
40
|
innerSelected = _useState2[0],
|
@@ -123,17 +128,10 @@ export var tableRoot = function tableRoot(Root) {
|
|
123
128
|
enableSorting: enableSorting,
|
124
129
|
enableResizing: enableResizing,
|
125
130
|
filterFn: function filterFn(row, columnId, filterArr) {
|
126
|
-
if (outerFilterFn && filterArr && Array.isArray(filterArr)) {
|
127
|
-
|
128
|
-
return
|
129
|
-
}
|
130
|
-
for (var i = 0; i < filterArr.length; i++) {
|
131
|
-
var filterValue = filterArr[i];
|
132
|
-
if (outerFilterFn(filterValue, row.getValue(columnId))) {
|
133
|
-
return true;
|
134
|
-
}
|
135
|
-
}
|
136
|
-
return false;
|
131
|
+
if ((filterArr === null || filterArr === void 0 ? void 0 : filterArr.length) !== 0 && outerFilterFn && filterArr && Array.isArray(filterArr)) {
|
132
|
+
return filterArr.some(function (filterValue) {
|
133
|
+
return outerFilterFn(filterValue, row.getValue(columnId));
|
134
|
+
});
|
137
135
|
}
|
138
136
|
return true;
|
139
137
|
},
|
@@ -174,7 +172,7 @@ export var tableRoot = function tableRoot(Root) {
|
|
174
172
|
}
|
175
173
|
}
|
176
174
|
});
|
177
|
-
return /*#__PURE__*/React.createElement(Root, {
|
175
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
178
176
|
ref: rootRef,
|
179
177
|
data: data,
|
180
178
|
columns: columns,
|
@@ -183,7 +181,7 @@ export var tableRoot = function tableRoot(Root) {
|
|
183
181
|
style: {
|
184
182
|
maxHeight: maxHeight || 'none'
|
185
183
|
}
|
186
|
-
}, /*#__PURE__*/React.createElement(Table, {
|
184
|
+
}, props), /*#__PURE__*/React.createElement(Table, {
|
187
185
|
borderVariant: borderVariant,
|
188
186
|
stickyHeader: stickyHeader
|
189
187
|
}, /*#__PURE__*/React.createElement(Thead, {
|
@@ -203,7 +201,7 @@ export var tableRoot = function tableRoot(Root) {
|
|
203
201
|
tableContainerRef: tableContainerRef
|
204
202
|
});
|
205
203
|
}));
|
206
|
-
})), /*#__PURE__*/React.createElement(
|
204
|
+
})), /*#__PURE__*/React.createElement(Tbody, null, table.getRowModel().rows.map(function (row) {
|
207
205
|
return /*#__PURE__*/React.createElement(Tr, {
|
208
206
|
key: row.id,
|
209
207
|
selected: row.getIsSelected()
|
@@ -43,15 +43,18 @@ export var Thead = /*#__PURE__*/styled.thead.withConfig({
|
|
43
43
|
view === 'clear' ? 'none' : borderVariant === 'header' || borderVariant === 'rows' ? "inset 0 -1px 0 0 var(".concat(tokens.borderColor, ")") : "inset 0 1px 0 0 var(".concat(tokens.borderColor, "), inset 0 -1px 0 0 var(").concat(tokens.borderColor, ")")
|
44
44
|
);
|
45
45
|
}, Tr);
|
46
|
-
export var
|
46
|
+
export var Tbody = /*#__PURE__*/styled.tbody.withConfig({
|
47
47
|
componentId: "plasma-new-hope__sc-1nklm7n-3"
|
48
|
-
})(["
|
48
|
+
})([""]);
|
49
|
+
export var Resizer = /*#__PURE__*/styled.div.withConfig({
|
50
|
+
componentId: "plasma-new-hope__sc-1nklm7n-4"
|
51
|
+
})(["display:", ";position:absolute;z-index:1;top:-0.0625rem;bottom:0;right:-0.125rem;width:0.1875rem;background:var(--outline-accent);cursor:col-resize;user-select:none;touch-action:none;"], function (_ref6) {
|
49
52
|
var isResizing = _ref6.isResizing;
|
50
53
|
return isResizing ? 'block' : 'none';
|
51
54
|
});
|
52
55
|
export var Th = /*#__PURE__*/styled.th.withConfig({
|
53
|
-
componentId: "plasma-new-hope__sc-1nklm7n-
|
54
|
-
})(["padding:", ";position:relative;font-weight:600;text-align:left;height:var(", ");background-color:transparent;color:inherit;border-width:
|
56
|
+
componentId: "plasma-new-hope__sc-1nklm7n-5"
|
57
|
+
})(["padding:", ";position:relative;font-weight:600;text-align:left;height:var(", ");background-color:transparent;color:inherit;border-width:0.0625rem;border-top-width:0;border-bottom-width:0;border-style:solid;border-color:", ";&:hover{", "{display:block;}}"], function (_ref7) {
|
55
58
|
var selectionCell = _ref7.selectionCell;
|
56
59
|
return selectionCell ? "var(".concat(tokens.checkboxCellPadding, ")") : "var(".concat(tokens.cellPadding, ")");
|
57
60
|
}, tokens.headerRowHeight, function (_ref8) {
|
@@ -59,17 +62,17 @@ export var Th = /*#__PURE__*/styled.th.withConfig({
|
|
59
62
|
return borderVariant === 'all' ? "var(".concat(tokens.borderColor, ")") : 'transparent';
|
60
63
|
}, Resizer);
|
61
64
|
export var StyledCheckbox = /*#__PURE__*/styled(Checkbox).withConfig({
|
62
|
-
componentId: "plasma-new-hope__sc-1nklm7n-
|
65
|
+
componentId: "plasma-new-hope__sc-1nklm7n-6"
|
63
66
|
})(["", ":var(", ");", ":var(", ");", ":var(--text-accent);", ":var(--on-dark-text-primary);", ":var(--text-secondary);"], checkboxTokens.triggerSize, tokens.checkboxTriggerSize, checkboxTokens.triggerBorderRadius, tokens.checkboxTriggerBorderRadius, checkboxTokens.fillColor, checkboxTokens.iconColor, checkboxTokens.triggerBorderColor);
|
64
67
|
export var StyledDivider = /*#__PURE__*/styled(Divider).withConfig({
|
65
|
-
componentId: "plasma-new-hope__sc-1nklm7n-
|
68
|
+
componentId: "plasma-new-hope__sc-1nklm7n-7"
|
66
69
|
})(["", ":0.0625rem;", ":var(--surface-transparent-tertiary);", ":0.0625rem;"], dividerTokens.baseSideSize, dividerTokens.background, dividerTokens.borderRadius);
|
67
70
|
export var Button = /*#__PURE__*/styled(ButtonBase).withConfig({
|
68
|
-
componentId: "plasma-new-hope__sc-1nklm7n-
|
71
|
+
componentId: "plasma-new-hope__sc-1nklm7n-8"
|
69
72
|
})(["", ":var(", ");", ":0.4;", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");"], buttonTokens.buttonHeight, tokens.buttonHeight, buttonTokens.buttonDisabledOpacity, buttonTokens.buttonFontFamily, tokens.buttonFontFamily, buttonTokens.buttonFontSize, tokens.buttonFontSize, buttonTokens.buttonFontStyle, tokens.buttonFontStyle, buttonTokens.buttonFontWeight, tokens.buttonFontWeight, buttonTokens.buttonLetterSpacing, tokens.buttonLetterSpacing, buttonTokens.buttonLineHeight, tokens.buttonLineHeight);
|
70
73
|
export var ButtonAccent = /*#__PURE__*/styled(Button).withConfig({
|
71
|
-
componentId: "plasma-new-hope__sc-1nklm7n-
|
74
|
+
componentId: "plasma-new-hope__sc-1nklm7n-9"
|
72
75
|
})(["", ":var(--on-dark-text-primary);", ":var(--on-dark-text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-accent-active);"], buttonTokens.buttonColor, buttonTokens.buttonValueColor, buttonTokens.buttonBackgroundColor, buttonTokens.buttonBackgroundColorHover, buttonTokens.buttonBackgroundColorActive);
|
73
76
|
export var LinkButton = /*#__PURE__*/styled(LinkButtonBase).withConfig({
|
74
|
-
componentId: "plasma-new-hope__sc-1nklm7n-
|
77
|
+
componentId: "plasma-new-hope__sc-1nklm7n-10"
|
75
78
|
})(["", ":var(--text-primary);", ":var(--surface-transparent-clear);", ":var(--text-primary-hover);", ":var(--text-primary-active);", ":var(--surface-accent);", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");"], linkButtonTokens.linkButtonColor, linkButtonTokens.linkButtonBackgroundColor, linkButtonTokens.linkButtonColorHover, linkButtonTokens.linkButtonColorActive, linkButtonTokens.linkButtonFocusColor, linkButtonTokens.linkButtonFontFamily, tokens.linkButtonFontFamily, linkButtonTokens.linkButtonFontSize, tokens.linkButtonFontSize, linkButtonTokens.linkButtonFontStyle, tokens.linkButtonFontStyle, linkButtonTokens.linkButtonFontWeight, tokens.linkButtonFontWeight, linkButtonTokens.linkButtonLetterSpacing, tokens.linkButtonLetterSpacing, linkButtonTokens.linkButtonLineHeight, tokens.linkButtonLineHeight);
|
@@ -1,3 +1,11 @@
|
|
1
|
+
export var classes = {
|
2
|
+
editIcon: 'edit-icon',
|
3
|
+
sortingDefaultIcon: 'sorting-default-icon',
|
4
|
+
sortingAscIcon: 'sorting-asc-icon',
|
5
|
+
sortingDescIcon: 'sorting-desc-icon',
|
6
|
+
filterIcon: 'filter-icon',
|
7
|
+
resizeDivider: 'resize-divider'
|
8
|
+
};
|
1
9
|
export var tableTokens = {
|
2
10
|
fontFamily: '--plasma-table-font-family',
|
3
11
|
fontSize: '--plasma-table-font-size',
|
@@ -2,7 +2,7 @@ import styled from 'styled-components';
|
|
2
2
|
import { tableTokens as tokens } from '../../Table.tokens';
|
3
3
|
export var Td = /*#__PURE__*/styled.td.withConfig({
|
4
4
|
componentId: "plasma-new-hope__sc-1doamj5-0"
|
5
|
-
})(["position:relative;padding:", ";height:var(", ");border-width:
|
5
|
+
})(["position:relative;padding:", ";height:var(", ");border-width:0.0625rem;border-top-width:0;border-style:solid;border-color:", ";border-bottom-color:", ";box-sizing:border-box;"], function (_ref) {
|
6
6
|
var selectionCell = _ref.selectionCell;
|
7
7
|
return selectionCell ? "var(".concat(tokens.checkboxCellPadding, ")") : "var(".concat(tokens.cellPadding, ")");
|
8
8
|
}, tokens.rowHeight, function (_ref2) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var
|
1
|
+
var _Resizer;
|
2
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
4
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -12,6 +12,7 @@ import { SELECT_COLUMN_ID } from '../../Table';
|
|
12
12
|
import { useOutsideClick } from '../../../../hooks';
|
13
13
|
import { IconEditOutline, IconResetOutline, IconDoneCircleOutline } from '../../../_Icon';
|
14
14
|
import { getIconSize } from '../HeadCell/HeadCell';
|
15
|
+
import { classes } from '../../Table.tokens';
|
15
16
|
import { ContentWrapper, Td, IconDoneButton, Input, InnerWrapper, InputWrapper, EditModeWrapper, IconResetButton } from './EditableCell.styles';
|
16
17
|
var keys = {
|
17
18
|
Enter: 'Enter',
|
@@ -19,12 +20,13 @@ var keys = {
|
|
19
20
|
Escape: 'Escape'
|
20
21
|
};
|
21
22
|
export var EditableCell = function EditableCell(_ref) {
|
23
|
+
var _table$options$meta;
|
22
24
|
var size = _ref.size,
|
25
|
+
view = _ref.view,
|
23
26
|
cell = _ref.cell,
|
24
27
|
borderVariant = _ref.borderVariant,
|
25
28
|
table = _ref.table,
|
26
|
-
selected = _ref.selected
|
27
|
-
view = _ref.view;
|
29
|
+
selected = _ref.selected;
|
28
30
|
var _useState = useState(cell.getValue()),
|
29
31
|
_useState2 = _slicedToArray(_useState, 2),
|
30
32
|
value = _useState2[0],
|
@@ -33,7 +35,7 @@ export var EditableCell = function EditableCell(_ref) {
|
|
33
35
|
_useState4 = _slicedToArray(_useState3, 2),
|
34
36
|
editingMode = _useState4[0],
|
35
37
|
setEditingMode = _useState4[1];
|
36
|
-
var updateData = table.options.meta.updateData;
|
38
|
+
var updateData = (_table$options$meta = table.options.meta) === null || _table$options$meta === void 0 ? void 0 : _table$options$meta.updateData;
|
37
39
|
var ref = useOutsideClick(function () {
|
38
40
|
setEditingMode(false);
|
39
41
|
});
|
@@ -50,14 +52,18 @@ export var EditableCell = function EditableCell(_ref) {
|
|
50
52
|
};
|
51
53
|
var handleSubmit = function handleSubmit(e) {
|
52
54
|
e.stopPropagation();
|
53
|
-
updateData
|
55
|
+
if (updateData) {
|
56
|
+
updateData(cell.row.id, cell.column.id, value);
|
57
|
+
}
|
54
58
|
setEditingMode(false);
|
55
59
|
};
|
56
60
|
var handleKeyDown = function handleKeyDown(event) {
|
57
61
|
switch (event.code) {
|
58
62
|
case keys.Enter:
|
59
63
|
{
|
60
|
-
updateData
|
64
|
+
if (updateData) {
|
65
|
+
updateData(cell.row.id, cell.column.id, value);
|
66
|
+
}
|
61
67
|
setEditingMode(false);
|
62
68
|
break;
|
63
69
|
}
|
@@ -97,11 +103,11 @@ export var EditableCell = function EditableCell(_ref) {
|
|
97
103
|
tabIndex: -1
|
98
104
|
}, /*#__PURE__*/React.createElement(IconDoneCircleOutline, {
|
99
105
|
size: getIconSize(size)
|
100
|
-
}))) : /*#__PURE__*/React.createElement(ContentWrapper, null, flexRender(cell.column.columnDef.cell, cell.getContext()),
|
106
|
+
}))) : /*#__PURE__*/React.createElement(ContentWrapper, null, flexRender(cell.column.columnDef.cell, cell.getContext()), /*#__PURE__*/React.createElement(IconEditOutline, {
|
101
107
|
size: "xs",
|
102
|
-
className:
|
108
|
+
className: classes.editIcon,
|
103
109
|
color: "var(--text-secondary)"
|
104
|
-
})))
|
110
|
+
}))), cell.column.getIsResizing() && (_Resizer || (_Resizer = /*#__PURE__*/React.createElement(Resizer, {
|
105
111
|
isResizing: true
|
106
112
|
}))));
|
107
113
|
};
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
2
|
import { component, mergeConfig } from '../../../../engines';
|
3
|
-
import { tableTokens as tokens } from '../../Table.tokens';
|
3
|
+
import { tableTokens as tokens, classes } from '../../Table.tokens';
|
4
4
|
import { iconButtonConfig, iconButtonTokens } from '../../../IconButton';
|
5
5
|
var mergedIndicatorConfig = /*#__PURE__*/mergeConfig(iconButtonConfig);
|
6
6
|
var IconButton = /*#__PURE__*/component(mergedIndicatorConfig);
|
7
7
|
export var Td = /*#__PURE__*/styled.td.withConfig({
|
8
8
|
componentId: "plasma-new-hope__sc-1uu72a1-0"
|
9
|
-
})(["position:relative;padding:", ";height:var(", ");border-width:
|
9
|
+
})(["position:relative;padding:", ";height:var(", ");border-width:0.0625rem;border-top-width:0;border-style:solid;border-color:", ";border-bottom-color:", ";cursor:pointer;box-sizing:border-box;& .", "{opacity:0;}&:hover .", "{opacity:1;}"], function (_ref) {
|
10
10
|
var selectionCell = _ref.selectionCell,
|
11
11
|
editingMode = _ref.editingMode;
|
12
12
|
return (
|
@@ -24,7 +24,7 @@ export var Td = /*#__PURE__*/styled.td.withConfig({
|
|
24
24
|
}, function (_ref3) {
|
25
25
|
var borderVariant = _ref3.borderVariant;
|
26
26
|
return borderVariant === 'all' || borderVariant === 'rows' ? "var(".concat(tokens.borderColor, ")") : 'transparent';
|
27
|
-
});
|
27
|
+
}, classes.editIcon, classes.editIcon);
|
28
28
|
export var InnerWrapper = /*#__PURE__*/styled.div.withConfig({
|
29
29
|
componentId: "plasma-new-hope__sc-1uu72a1-1"
|
30
30
|
})(["display:flex;align-items:center;justify-content:space-between;width:100%;height:100%;"]);
|
@@ -36,10 +36,10 @@ export var EditModeWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
36
36
|
})(["display:flex;align-items:center;justify-content:space-between;gap:var(", ");height:100%;"], tokens.editableCellPadding);
|
37
37
|
export var InputWrapper = /*#__PURE__*/styled.div.withConfig({
|
38
38
|
componentId: "plasma-new-hope__sc-1uu72a1-4"
|
39
|
-
})(["display:flex;align-items:center;height:100%;flex:1;padding:var(", ");background:var(", ");border:
|
39
|
+
})(["display:flex;align-items:center;height:100%;flex:1;padding:var(", ");background:var(", ");border:0.0625rem solid var(", ");border-radius:var(", ");box-sizing:border-box;gap:var(", ");"], tokens.editableCellInputPadding, tokens.editableCellInputBackground, tokens.editableCellInputBorderColor, tokens.editableCellInputBorderRadius, tokens.editableCellIconGap);
|
40
40
|
export var Input = /*#__PURE__*/styled.input.withConfig({
|
41
41
|
componentId: "plasma-new-hope__sc-1uu72a1-5"
|
42
|
-
})(["width:auto;border:none;padding:0;background:transparent;outline:none;caret-color:var(--text-accent);font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight);
|
42
|
+
})(["width:auto;border:none;padding:0;background:transparent;outline:none;caret-color:var(--text-accent);color:var(--text-primary);font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight);
|
43
43
|
export var IconDoneButton = /*#__PURE__*/styled(IconButton).withConfig({
|
44
44
|
componentId: "plasma-new-hope__sc-1uu72a1-6"
|
45
45
|
})(["", ":var(", ");", ":var(", ");"], iconButtonTokens.iconButtonWidth, tokens.editableCellIconButtonWidth, iconButtonTokens.iconButtonHeight, tokens.editableCellIconButtonHeight);
|
@@ -3,7 +3,8 @@ import React from 'react';
|
|
3
3
|
import { Th, Resizer } from '../../Table.styles';
|
4
4
|
import { IconSwapVert, IconArrowDown, IconArrowUp } from '../../../_Icon';
|
5
5
|
import { SELECT_COLUMN_ID } from '../../Table';
|
6
|
-
import {
|
6
|
+
import { classes } from '../../Table.tokens';
|
7
|
+
import { ControlButtons, ThWrapper, IconWrapper } from './HeadCell.styles';
|
7
8
|
import { Filter } from './ui/Filter/Filter';
|
8
9
|
export var getIconSize = function getIconSize(size) {
|
9
10
|
return size === 's' ? 'xs' : 's';
|
@@ -30,23 +31,22 @@ export var HeadCell = function HeadCell(_ref) {
|
|
30
31
|
size: size,
|
31
32
|
outerFiltered: outerFiltered,
|
32
33
|
tableContainerRef: tableContainerRef
|
33
|
-
}), header.column.getCanSort() && /*#__PURE__*/React.createElement(
|
34
|
-
style: {
|
35
|
-
lineHeight: 0,
|
36
|
-
cursor: 'pointer',
|
37
|
-
userSelect: 'none'
|
38
|
-
},
|
34
|
+
}), header.column.getCanSort() && /*#__PURE__*/React.createElement(IconWrapper, {
|
39
35
|
onClick: header.column.getToggleSortingHandler()
|
40
36
|
}, (_asc$desc = {
|
41
37
|
asc: /*#__PURE__*/React.createElement(IconArrowUp, {
|
42
|
-
size: getIconSize(size)
|
38
|
+
size: getIconSize(size),
|
39
|
+
className: classes.sortingAscIcon
|
43
40
|
}),
|
44
41
|
desc: /*#__PURE__*/React.createElement(IconArrowDown, {
|
45
|
-
size: getIconSize(size)
|
42
|
+
size: getIconSize(size),
|
43
|
+
className: classes.sortingDescIcon
|
46
44
|
})
|
47
45
|
}[header.column.getIsSorted()]) !== null && _asc$desc !== void 0 ? _asc$desc : /*#__PURE__*/React.createElement(IconSwapVert, {
|
48
|
-
size: getIconSize(size)
|
46
|
+
size: getIconSize(size),
|
47
|
+
className: classes.sortingDefaultIcon
|
49
48
|
}))))), header.column.getCanResize() && /*#__PURE__*/React.createElement(Resizer, {
|
49
|
+
className: classes.resizeDivider,
|
50
50
|
onMouseDown: header.getResizeHandler(),
|
51
51
|
onTouchStart: header.getResizeHandler(),
|
52
52
|
isResizing: header.column.getIsResizing()
|
@@ -4,4 +4,7 @@ export var ControlButtons = /*#__PURE__*/styled.div.withConfig({
|
|
4
4
|
})(["display:flex;justify-content:space-between;align-items:center;gap:0.5rem;"]);
|
5
5
|
export var ThWrapper = /*#__PURE__*/styled.div.withConfig({
|
6
6
|
componentId: "plasma-new-hope__sc-haivw3-1"
|
7
|
-
})(["display:flex;justify-content:space-between;align-items:center;gap:0.5rem;"]);
|
7
|
+
})(["display:flex;justify-content:space-between;align-items:center;gap:0.5rem;"]);
|
8
|
+
export var IconWrapper = /*#__PURE__*/styled.div.withConfig({
|
9
|
+
componentId: "plasma-new-hope__sc-haivw3-2"
|
10
|
+
})(["line-height:0;cursor:pointer;user-select:none;"]);
|
@@ -14,6 +14,7 @@ import { useDidMountEffect } from '../../../../../../hooks';
|
|
14
14
|
import { IconFilterFunnel } from '../../../../../_Icon';
|
15
15
|
import { getIconSize } from '../../HeadCell';
|
16
16
|
import { ButtonAccent, LinkButton } from '../../../../Table.styles';
|
17
|
+
import { classes } from '../../../../Table.tokens';
|
17
18
|
import { IconFilterWrapper, StyledIndicator, Select, StyledDivider, ControlPanel } from './Filter.styles';
|
18
19
|
var getSelectWidth = function getSelectWidth(size) {
|
19
20
|
switch (size) {
|
@@ -76,7 +77,8 @@ export var Filter = function Filter(_ref) {
|
|
76
77
|
onChange: setLocalFiltered,
|
77
78
|
renderTarget: function renderTarget() {
|
78
79
|
return /*#__PURE__*/React.createElement(IconFilterWrapper, null, /*#__PURE__*/React.createElement(IconFilterFunnel, {
|
79
|
-
size: getIconSize(size)
|
80
|
+
size: getIconSize(size),
|
81
|
+
className: classes.filterIcon
|
80
82
|
}), filtered.length ? _StyledIndicator || (_StyledIndicator = /*#__PURE__*/React.createElement(StyledIndicator, {
|
81
83
|
size: "s",
|
82
84
|
view: "accent"
|