oolib 2.67.2 → 2.67.4
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/components/SimpleTable/index.js +6 -5
- package/dist/components/SimpleTable/styled.js +5 -5
- package/dist/components/SimpleTable/utils/convertColHeaderConfigToRowData.d.ts +8 -0
- package/dist/components/SimpleTable/utils/convertColHeaderConfigToRowData.js +16 -0
- package/dist/components/SimpleTable/utils/prepInitValueFromConfigIfNoValue.d.ts +1 -2
- package/dist/components/SimpleTable/utils/prepInitValueFromConfigIfNoValue.js +2 -15
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ var functions_1 = require("./functions");
|
|
|
56
56
|
var styled_1 = require("./styled");
|
|
57
57
|
var useResizeTableColumns_1 = require("./useResizeTableColumns");
|
|
58
58
|
var prepInitValueFromConfigIfNoValue_1 = require("./utils/prepInitValueFromConfigIfNoValue");
|
|
59
|
+
var convertColHeaderConfigToRowData_1 = require("./utils/convertColHeaderConfigToRowData");
|
|
59
60
|
var greyColor100 = themes_1.colors.greyColor100;
|
|
60
61
|
/*pending:
|
|
61
62
|
- first test whatever is done on okf
|
|
@@ -81,11 +82,9 @@ function SimpleTable(_a) {
|
|
|
81
82
|
_value: _value,
|
|
82
83
|
config: config,
|
|
83
84
|
defaultColWidth: defaultColWidth,
|
|
84
|
-
convertToRichText: convertToRichText
|
|
85
85
|
}), value = _f.value, canAddCols = _f.canAddCols, //returns true if no config.colHeaderData is defined. else false
|
|
86
86
|
canToggleColHeaderStyle = _f.canToggleColHeaderStyle // returns true if no config.colHeaderData is defined. else false
|
|
87
87
|
;
|
|
88
|
-
console.log({ value: value });
|
|
89
88
|
var _g = (0, useResizeTableColumns_1.useResizeTableColumns)({
|
|
90
89
|
setColWidthConfig: function (setterFn) {
|
|
91
90
|
var newColWidthConfig = setterFn(value.colWidthConfig);
|
|
@@ -151,7 +150,7 @@ function SimpleTable(_a) {
|
|
|
151
150
|
// ...CellContentBlockDefaultProps[cell.comp],
|
|
152
151
|
// ...(cell.props ? cell.props : {}),
|
|
153
152
|
// }
|
|
154
|
-
return (react_1.default.createElement(styled_1.StyledSimpleTableCell, { key: cell.id, id: "kp_table__cell__".concat(cell.id), style: {
|
|
153
|
+
return (react_1.default.createElement(styled_1.StyledSimpleTableCell, { key: cell.id, id: "kp_table__cell__".concat(cell.id), readOnly: readOnly || cell.readOnly, style: {
|
|
155
154
|
color: greyColor100,
|
|
156
155
|
width: "".concat(cellWidth),
|
|
157
156
|
minHeight: "4rem",
|
|
@@ -159,7 +158,7 @@ function SimpleTable(_a) {
|
|
|
159
158
|
"2px solid ".concat((0, utilsOolib_1.getPrimaryColor100)(theme === null || theme === void 0 ? void 0 : theme.colors)),
|
|
160
159
|
}, onMouseDown: function (e) {
|
|
161
160
|
initColResizeState(e, { colId: "col_".concat(cellIdx) });
|
|
162
|
-
}, onMouseOut: resetDragZoneIndicator, onMouseMove: hideShowDragZoneIndicator },
|
|
161
|
+
}, onMouseOut: resetDragZoneIndicator, onMouseMove: hideShowDragZoneIndicator, tabIndex: 0 },
|
|
163
162
|
react_1.default.createElement(CellComp, __assign({}, cellProps, { id: "kp_table_cell__".concat(cell.id, "__rich_input") /*dont mess with this id nomenclature. it needs to stay this way. check out the handleCellInputChange fn to understand */, value: cellValue, readOnly: readOnly || cell.readOnly, onChange: function (k, v) {
|
|
164
163
|
return handleCellInputChange({ v: v, rowIdx: rowIdx, cellIdx: cellIdx });
|
|
165
164
|
} }))));
|
|
@@ -172,7 +171,9 @@ function SimpleTable(_a) {
|
|
|
172
171
|
alignItems: "stretch" /**without stretch AddColButton will be wonky */,
|
|
173
172
|
} },
|
|
174
173
|
react_1.default.createElement("div", null,
|
|
175
|
-
react_1.default.createElement(styled_1.StyledSimpleTable, null,
|
|
174
|
+
react_1.default.createElement(styled_1.StyledSimpleTable, null,
|
|
175
|
+
config.colHeaderData && genRow({ row: (0, convertColHeaderConfigToRowData_1.convertColHeaderConfigToRowData)({ colHeaderData: config.colHeaderData, convertToRichText: convertToRichText }) }),
|
|
176
|
+
value.data.map(function (row, rowIdx) { return genRow({ row: row, rowIdx: rowIdx }); })),
|
|
176
177
|
!readOnly && canAddRows && (react_1.default.createElement(AddRowColButtons_1.AddRowButton, { onClick: function () { return (0, functions_1.handleAddRow)(value, props); } }))),
|
|
177
178
|
!readOnly && canAddCols && (react_1.default.createElement(AddRowColButtons_1.AddColButton, { onClick: function () { return (0, functions_1.handleAddCol)(value, props); } })))));
|
|
178
179
|
}
|
|
@@ -33,13 +33,13 @@ var transitions_1 = require("../../themes/mixins/transitions");
|
|
|
33
33
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
34
34
|
var utilsOolib_1 = require("../../utilsOolib");
|
|
35
35
|
exports.StyledSimpleTable = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-top: 1px solid ", ";\n border-bottom: 1px solid ", ";\n border-left: 1px solid ", ";\n"], ["\n border-top: 1px solid ", ";\n border-bottom: 1px solid ", ";\n border-left: 1px solid ", ";\n"])), themes_1.colors.greyColor10, themes_1.colors.greyColor10, themes_1.colors.greyColor10);
|
|
36
|
-
exports.StyledSimpleTableRow = styled_components_1.default.div(
|
|
36
|
+
exports.StyledSimpleTableRow = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n ", ";\n background-color: ", ";\n"], ["\n display: flex;\n ", ";\n background-color: ", ";\n"])), (0, transitions_1.transition)("background-color"), function (_a) {
|
|
37
37
|
var rowIdx = _a.rowIdx;
|
|
38
|
-
return rowIdx % 2 === 1 ? themes_1.colors.
|
|
39
|
-
}
|
|
38
|
+
return rowIdx % 2 === 1 ? themes_1.colors.white : themes_1.colors.greyColor3;
|
|
39
|
+
});
|
|
40
|
+
exports.StyledSimpleTableCell = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n /* max-width: 300px; */\n padding: 0.8rem 1rem;\n /* margin: 0 1rem; */\n border-right: 1px solid ", ";\n ", ";\n ", "\n"], ["\n /* max-width: 300px; */\n padding: 0.8rem 1rem;\n /* margin: 0 1rem; */\n border-right: 1px solid ", ";\n ", ";\n ", "\n"])), themes_1.colors.greyColor10, (0, transitions_1.transition)("background-color"), function (_a) {
|
|
40
41
|
var readOnly = _a.readOnly, theme = _a.theme;
|
|
41
|
-
return !readOnly && (0, styled_components_1.css)(
|
|
42
|
+
return !readOnly && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n :hover{\n background-color: ", ";\n }\n :focus{\n outline: 1px solid ", ";\n background-color: ", ";\n } \n "], ["\n :hover{\n background-color: ", ";\n }\n :focus{\n outline: 1px solid ", ";\n background-color: ", ";\n } \n "])), (0, utilsOolib_1.getPrimaryColor10)(theme === null || theme === void 0 ? void 0 : theme.colors), (0, utilsOolib_1.getPrimaryColor100)(theme === null || theme === void 0 ? void 0 : theme.colors), themes_1.colors.none);
|
|
42
43
|
});
|
|
43
|
-
exports.StyledSimpleTableCell = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n /* max-width: 300px; */\n padding: 0.8rem 1rem;\n /* margin: 0 1rem; */\n border-right: 1px solid ", ";\n"], ["\n /* max-width: 300px; */\n padding: 0.8rem 1rem;\n /* margin: 0 1rem; */\n border-right: 1px solid ", ";\n"])), themes_1.colors.greyColor10);
|
|
44
44
|
exports.StyledSimpleTableHeader = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n .public-DraftEditor-content {\n font-weight: 600;\n }\n background-color: ", ";\n border-bottom: 2px solid ", ";\n"], ["\n .public-DraftEditor-content {\n font-weight: 600;\n }\n background-color: ", ";\n border-bottom: 2px solid ", ";\n"])), themes_1.colors.greyColor, themes_1.colors.greyColor10);
|
|
45
45
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertColHeaderConfigToRowData = void 0;
|
|
4
|
+
var convertColHeaderConfigToRowData = function (_a) {
|
|
5
|
+
var colHeaderData = _a.colHeaderData, convertToRichText = _a.convertToRichText;
|
|
6
|
+
return {
|
|
7
|
+
id: "colHeader",
|
|
8
|
+
isColHeader: true,
|
|
9
|
+
cellData: colHeaderData.map(function (d, i) { return ({
|
|
10
|
+
value: convertToRichText ? convertToRichText(d) : d,
|
|
11
|
+
readOnly: true,
|
|
12
|
+
id: "colHeaderCell_".concat(i),
|
|
13
|
+
}); }),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.convertColHeaderConfigToRowData = convertColHeaderConfigToRowData;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export function prepInitValueFromConfigIfNoValue({ _value, config, defaultColWidth,
|
|
1
|
+
export function prepInitValueFromConfigIfNoValue({ _value, config, defaultColWidth, }: {
|
|
2
2
|
_value: any;
|
|
3
3
|
config: any;
|
|
4
4
|
defaultColWidth: any;
|
|
5
|
-
convertToRichText: any;
|
|
6
5
|
}): {
|
|
7
6
|
value: any;
|
|
8
7
|
canAddCols: boolean;
|
|
@@ -22,16 +22,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.prepInitValueFromConfigIfNoValue = void 0;
|
|
24
24
|
var makeArrayFromLength_1 = require("../../../utils/makeArrayFromLength");
|
|
25
|
-
var toArray_1 = require("../../../utils/toArray");
|
|
26
25
|
var functions_1 = require("../functions");
|
|
27
26
|
var prepInitValueFromConfigIfNoValue = function (_a) {
|
|
28
27
|
var _b;
|
|
29
|
-
var _value = _a._value, config = _a.config, defaultColWidth = _a.defaultColWidth
|
|
28
|
+
var _value = _a._value, config = _a.config, defaultColWidth = _a.defaultColWidth;
|
|
30
29
|
//if colHeaderData is defined then that decides the noOfCols.
|
|
31
30
|
var noOfCols = ((_b = config.colHeaderData) === null || _b === void 0 ? void 0 : _b.length) || config.noOfCols;
|
|
32
31
|
var value = !_value
|
|
33
32
|
? {
|
|
34
|
-
data: __spreadArray(
|
|
33
|
+
data: __spreadArray([], insertRowAndCellIds({
|
|
35
34
|
noOfRows: config.noOfRows,
|
|
36
35
|
noOfCols: noOfCols
|
|
37
36
|
}), true),
|
|
@@ -50,18 +49,6 @@ var prepInitValueFromConfigIfNoValue = function (_a) {
|
|
|
50
49
|
});
|
|
51
50
|
};
|
|
52
51
|
exports.prepInitValueFromConfigIfNoValue = prepInitValueFromConfigIfNoValue;
|
|
53
|
-
var convertColHeaderConfigToRowData = function (_a) {
|
|
54
|
-
var colHeaderData = _a.colHeaderData, convertToRichText = _a.convertToRichText;
|
|
55
|
-
return {
|
|
56
|
-
id: "colHeader",
|
|
57
|
-
isColHeader: true,
|
|
58
|
-
cellData: colHeaderData.map(function (d, i) { return ({
|
|
59
|
-
value: convertToRichText ? convertToRichText(d) : d,
|
|
60
|
-
readOnly: true,
|
|
61
|
-
id: "colHeaderCell_".concat(i),
|
|
62
|
-
}); }),
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
52
|
var getInitColWidthConfigs = function (_a) {
|
|
66
53
|
var noOfCols = _a.noOfCols, defaultColWidth = _a.defaultColWidth;
|
|
67
54
|
return (0, makeArrayFromLength_1.makeArrayFromLength)(noOfCols)
|