oolib 2.131.5 → 2.132.1
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.
|
@@ -66,6 +66,7 @@ var useResizeTableColumns_1 = require("./useResizeTableColumns");
|
|
|
66
66
|
var convertColHeaderConfigToRowData_1 = require("./utils/convertColHeaderConfigToRowData");
|
|
67
67
|
var convertRowHeaderConfigToCellData_1 = require("./utils/convertRowHeaderConfigToCellData");
|
|
68
68
|
var prepInitValueFromConfigIfNoValue_1 = require("./utils/prepInitValueFromConfigIfNoValue");
|
|
69
|
+
var DropdownSingle_1 = require("../Dropdowns/DropdownSingle");
|
|
69
70
|
var greyColor100 = themes_1.colors.greyColor100;
|
|
70
71
|
/*pending:
|
|
71
72
|
- first test whatever is done on okf
|
|
@@ -81,6 +82,7 @@ function SimpleTable(_a) {
|
|
|
81
82
|
noOfRows: 3,
|
|
82
83
|
colHeaderData: undefined,
|
|
83
84
|
rowHeaderData: undefined,
|
|
85
|
+
blockConfig: [undefined, { comp: 'DropdownSingle', props: {} }, { comp: 'DropdownSingle', props: {} }]
|
|
84
86
|
} : _b, _value = _a.value, onChange = _a.onChange, _c = _a.defaultColWidth, defaultColWidth = _c === void 0 ? 200 : _c;
|
|
85
87
|
var props = arguments[0];
|
|
86
88
|
var theme = (0, styled_components_1.useTheme)();
|
|
@@ -125,6 +127,7 @@ function SimpleTable(_a) {
|
|
|
125
127
|
}, [colResizeState]);
|
|
126
128
|
var CellContentBlocks = {
|
|
127
129
|
RichTextEditor: RichTextEditor,
|
|
130
|
+
DropdownSingle: DropdownSingle_1.DropdownSingle
|
|
128
131
|
// KPDropdown,
|
|
129
132
|
// TextInput,
|
|
130
133
|
// RadioList,
|
|
@@ -139,6 +142,9 @@ function SimpleTable(_a) {
|
|
|
139
142
|
padding: "0.9rem 1rem",
|
|
140
143
|
},
|
|
141
144
|
},
|
|
145
|
+
DropdownSingle: {
|
|
146
|
+
S: true
|
|
147
|
+
}
|
|
142
148
|
// KPDropdown: {
|
|
143
149
|
// size: 'small',
|
|
144
150
|
// },
|
|
@@ -174,11 +180,11 @@ function SimpleTable(_a) {
|
|
|
174
180
|
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
181
|
, enableColResizeActions = _b === void 0 ? true : _b // cuz in the case of pre fixed column (via config.rowHeaderData), enableResize will be set to false
|
|
176
182
|
;
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
var cellProps = __assign({}, CellContentBlockDefaultProps[
|
|
181
|
-
var cellValue = CellValueGetters[
|
|
183
|
+
var cellCompName = cell.comp || 'RichTextEditor';
|
|
184
|
+
var NoCompPlaceholder = function () { return react_1.default.createElement("div", null, "No comp exists"); };
|
|
185
|
+
var CellComp = CellContentBlocks[cellCompName] || NoCompPlaceholder;
|
|
186
|
+
var cellProps = CellContentBlockDefaultProps[cellCompName] ? __assign(__assign({}, CellContentBlockDefaultProps[cell.comp]), (cell.props || {})) : {};
|
|
187
|
+
var cellValue = CellValueGetters[cellCompName] ? CellValueGetters[cellCompName](cell.value) : cell.value;
|
|
182
188
|
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
|
|
183
189
|
//(100% - totalExplicitWidths)/(totalColumns - noOfColsWithExplicitWidths)
|
|
184
190
|
// let cellProps = {
|
|
@@ -40,9 +40,10 @@ var prepInitValueFromConfigIfNoValue = function (_a) {
|
|
|
40
40
|
}),
|
|
41
41
|
} //backwards compat
|
|
42
42
|
: {
|
|
43
|
-
data: __spreadArray([],
|
|
43
|
+
data: __spreadArray([], insertRowCellIdsAndComp({
|
|
44
44
|
noOfRows: noOfRows,
|
|
45
45
|
noOfCols: noOfCols,
|
|
46
|
+
blockConfig: config.blockConfig
|
|
46
47
|
}), true),
|
|
47
48
|
colWidthConfig: getInitColWidthConfigs({ noOfCols: noOfCols, defaultColWidth: defaultColWidth }),
|
|
48
49
|
};
|
|
@@ -66,12 +67,13 @@ var getInitColWidthConfigs = function (_a) {
|
|
|
66
67
|
return (__assign(__assign({}, a), (_a = {}, _a[b.colId] = b.width, _a)));
|
|
67
68
|
}, {});
|
|
68
69
|
};
|
|
69
|
-
var
|
|
70
|
-
var noOfRows = _a.noOfRows, noOfCols = _a.noOfCols;
|
|
70
|
+
var insertRowCellIdsAndComp = function (_a) {
|
|
71
|
+
var noOfRows = _a.noOfRows, noOfCols = _a.noOfCols, _b = _a.blockConfig, blockConfig = _b === void 0 ? [] : _b;
|
|
71
72
|
return (0, makeArrayFromLength_1.makeArrayFromLength)(noOfRows).map(function () { return ({
|
|
72
73
|
id: "row_".concat((0, genHash_1.genHash)(8)),
|
|
73
|
-
cellData: (0, makeArrayFromLength_1.makeArrayFromLength)(noOfCols).map(function () {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
cellData: (0, makeArrayFromLength_1.makeArrayFromLength)(noOfCols).map(function (d, i) {
|
|
75
|
+
var _a;
|
|
76
|
+
return (__assign({ id: "cell_".concat((0, genHash_1.genHash)(8)) }, (((_a = blockConfig[i]) === null || _a === void 0 ? void 0 : _a.comp) ? { comp: blockConfig[i].comp, props: blockConfig[i].props || {} } : {})));
|
|
77
|
+
}),
|
|
76
78
|
}); });
|
|
77
79
|
};
|