oolib 2.90.1 → 2.90.3
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export function AddRowButton({ onClick }: {
|
|
2
2
|
onClick: any;
|
|
3
3
|
}): React.JSX.Element;
|
|
4
|
-
export function AddColButton({ onClick, addColButtonWidth }: {
|
|
4
|
+
export function AddColButton({ onClick, addColButtonWidth, enableRowActions }: {
|
|
5
5
|
onClick: any;
|
|
6
6
|
addColButtonWidth: any;
|
|
7
|
+
enableRowActions: any;
|
|
7
8
|
}): React.JSX.Element;
|
|
8
9
|
import React from "react";
|
|
@@ -3,6 +3,17 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
6
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
18
|
if (k2 === undefined) k2 = k;
|
|
8
19
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -39,7 +50,7 @@ var mixins_1 = require("../../../../themes/mixins");
|
|
|
39
50
|
var Plus = icons_1.icons.Plus;
|
|
40
51
|
var commonStyles = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n border: none;\n ", "\n &:hover {\n background-color: ", ";\n }\n cursor: pointer;\n"], ["\n background-color: ", ";\n border: none;\n ", "\n &:hover {\n background-color: ", ";\n }\n cursor: pointer;\n"])), themes_1.colors.greyColor5, (0, mixins_1.transition)("background-color"), themes_1.colors.greyColor10);
|
|
41
52
|
var StyledRowButton = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 2rem;\n text-align: center;\n width: 100%;\n ", "\n"], ["\n height: 2rem;\n text-align: center;\n width: 100%;\n ", "\n"])), commonStyles);
|
|
42
|
-
var StyledColButton = styled_components_1.default.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n
|
|
53
|
+
var StyledColButton = styled_components_1.default.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n ", "\n"])), commonStyles);
|
|
43
54
|
var AddRowButton = function (_a) {
|
|
44
55
|
var onClick = _a.onClick;
|
|
45
56
|
return (react_1.default.createElement(StyledRowButton, { onClick: onClick },
|
|
@@ -47,8 +58,9 @@ var AddRowButton = function (_a) {
|
|
|
47
58
|
};
|
|
48
59
|
exports.AddRowButton = AddRowButton;
|
|
49
60
|
var AddColButton = function (_a) {
|
|
50
|
-
var onClick = _a.onClick, addColButtonWidth = _a.addColButtonWidth;
|
|
51
|
-
return (react_1.default.createElement(StyledColButton, { style: { width: addColButtonWidth + 'px' },
|
|
61
|
+
var onClick = _a.onClick, addColButtonWidth = _a.addColButtonWidth, enableRowActions = _a.enableRowActions;
|
|
62
|
+
return (react_1.default.createElement(StyledColButton, { style: __assign({ width: addColButtonWidth + 'px' }, (enableRowActions ? { marginBottom: '2rem' } : {}) //should be same as height of StyledRowButton
|
|
63
|
+
), onClick: onClick },
|
|
52
64
|
react_1.default.createElement(Plus, { size: 12, weight: "bold" })));
|
|
53
65
|
};
|
|
54
66
|
exports.AddColButton = AddColButton;
|
|
@@ -171,13 +171,15 @@ function SimpleTable(_a) {
|
|
|
171
171
|
var primaryTableActionsMenuHeight = 30;
|
|
172
172
|
var primaryTableActionsMenuGap = 5;
|
|
173
173
|
var genCell = function (_a) {
|
|
174
|
-
var cell = _a.cell, cellIdx = _a.cellIdx, rowIdx = _a.rowIdx
|
|
174
|
+
var cell = _a.cell, cellIdx = _a.cellIdx, rowIdx = _a.rowIdx, _b = _a.enableColResizeActions // cuz in the case of pre fixed column (via config.rowHeaderData), enableResize will be set to false
|
|
175
|
+
, enableColResizeActions = _b === void 0 ? true : _b // cuz in the case of pre fixed column (via config.rowHeaderData), enableResize will be set to false
|
|
176
|
+
;
|
|
175
177
|
var CellComp = RichTextEditor //cuz in oolib, richtexteditor will not be there for now
|
|
176
178
|
? CellContentBlocks["RichTextEditor"]
|
|
177
179
|
: function () { return react_1.default.createElement("div", null, "RTE Doesnt Exist"); };
|
|
178
180
|
var cellProps = __assign({}, CellContentBlockDefaultProps["RichTextEditor"]);
|
|
179
181
|
var cellValue = CellValueGetters["RichTextEditor"](cell.value);
|
|
180
|
-
var cellWidth = value.colWidthConfig["col_".concat(cellIdx)];
|
|
182
|
+
var cellWidth = value.colWidthConfig["col_".concat(cellIdx)] || defaultColWidth + 'px'; //cuz when pre-fixed column is applied via config.rowHeaderData, no colWidthConfig will be there for it in value.colWidthConfig
|
|
181
183
|
//(100% - totalExplicitWidths)/(totalColumns - noOfColsWithExplicitWidths)
|
|
182
184
|
// let cellProps = {
|
|
183
185
|
// ...CellContentBlockDefaultProps[cell.comp],
|
|
@@ -188,26 +190,28 @@ function SimpleTable(_a) {
|
|
|
188
190
|
var StyledCellWrapper = cell.isRowHeader
|
|
189
191
|
? styled_1.StyledSimpleTableHeaderCell
|
|
190
192
|
: styled_1.StyledSimpleTableCell;
|
|
191
|
-
return (react_1.default.createElement(StyledCellWrapper, { key: cell.id, id: "kp_table__cell__".concat(cell.id), readOnly: readOnly || cell.readOnly, style: {
|
|
193
|
+
return (react_1.default.createElement(StyledCellWrapper, __assign({ key: cell.id, id: "kp_table__cell__".concat(cell.id), readOnly: readOnly || cell.readOnly, style: {
|
|
192
194
|
color: greyColor100,
|
|
193
195
|
width: "".concat(cellWidth),
|
|
194
196
|
borderRight: (colResizeState === null || colResizeState === void 0 ? void 0 : colResizeState.colId) === "col_".concat(cellIdx) &&
|
|
195
197
|
"2px solid ".concat((0, utilsOolib_1.getPrimaryColor100)(theme === null || theme === void 0 ? void 0 : theme.colors)),
|
|
196
|
-
}, actionsActiveOnRow: actionsActiveOnRow, colIdx: cellIdx, rowIdx: rowIdx, totRows: value.data.length, actionsActiveOnCol: actionsActiveOnCol,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
198
|
+
}, actionsActiveOnRow: actionsActiveOnRow, colIdx: cellIdx, rowIdx: rowIdx, totRows: value.data.length, actionsActiveOnCol: actionsActiveOnCol }, (enableColResizeActions
|
|
199
|
+
? {
|
|
200
|
+
onMouseEnter: function (e) {
|
|
201
|
+
setHoveredRowAndCol({
|
|
202
|
+
rowIdx: rowIdx,
|
|
203
|
+
colIdx: cellIdx,
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
onMouseDown: function (e) {
|
|
207
|
+
initColResizeState(e, { colId: "col_".concat(cellIdx) });
|
|
208
|
+
},
|
|
209
|
+
onMouseOut: function (e) { return resetDragZoneIndicator(__assign({ e: e }, (cell.isRowHeader ? { borderStyleInactive: "2px solid ".concat(themes_1.colors.greyColor10) } : {}))); },
|
|
210
|
+
onMouseMove: function (e) { return hideShowDragZoneIndicator(__assign({ e: e }, (cell.isRowHeader ? {
|
|
211
|
+
borderStyleInactive: "2px solid ".concat(themes_1.colors.greyColor10),
|
|
212
|
+
borderStyleActive: "2px solid ".concat((0, utilsOolib_1.getPrimaryColor100)(theme === null || theme === void 0 ? void 0 : theme.colors))
|
|
213
|
+
} : {}))); }
|
|
214
|
+
} : {}), { tabIndex: 0 }),
|
|
211
215
|
react_1.default.createElement(ColActionsMenu_1.ColActionsMenu, __assign({}, {
|
|
212
216
|
value: value,
|
|
213
217
|
colIdx: cellIdx,
|
|
@@ -254,6 +258,7 @@ function SimpleTable(_a) {
|
|
|
254
258
|
convertToRichText: convertToRichText,
|
|
255
259
|
rowIdx: rowIdx
|
|
256
260
|
}),
|
|
261
|
+
enableColResizeActions: false //because pre-frozen column cannot be resized by user
|
|
257
262
|
}),
|
|
258
263
|
row.cellData.map(function (cell, cellIdx) { return genCell({ cell: cell, cellIdx: cellIdx, rowIdx: rowIdx }); })));
|
|
259
264
|
};
|
|
@@ -327,7 +332,7 @@ function SimpleTable(_a) {
|
|
|
327
332
|
}),
|
|
328
333
|
value.data.map(function (row, rowIdx) { return genRow({ row: row, rowIdx: rowIdx }); })),
|
|
329
334
|
!readOnly && enableRowActions && (react_1.default.createElement(AddRowColButtons_1.AddRowButton, { onClick: function () { return (0, handleRowActions_1.handleAddRow)(value, props); } }))),
|
|
330
|
-
!readOnly && enableColActions && (react_1.default.createElement(AddRowColButtons_1.AddColButton, { addColButtonWidth: addColButtonWidth, onClick: function () {
|
|
335
|
+
!readOnly && enableColActions && (react_1.default.createElement(AddRowColButtons_1.AddColButton, { enableRowActions: enableRowActions, addColButtonWidth: addColButtonWidth, onClick: function () {
|
|
331
336
|
return (0, handleColActions_1.handleAddCol)({ value: value, onChange: onChange, id: id, defaultColWidth: defaultColWidth });
|
|
332
337
|
} }))))));
|
|
333
338
|
}
|