oolib 2.67.3 → 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 +4 -3
- package/dist/components/SimpleTable/styled.js +1 -1
- 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);
|
|
@@ -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
|
}
|
|
@@ -35,7 +35,7 @@ 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
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.
|
|
38
|
+
return rowIdx % 2 === 1 ? themes_1.colors.white : themes_1.colors.greyColor3;
|
|
39
39
|
});
|
|
40
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) {
|
|
41
41
|
var readOnly = _a.readOnly, theme = _a.theme;
|
|
@@ -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)
|