oolib 2.132.0 → 2.132.2
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,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PENDINGS
|
|
3
|
+
* - Ideally should migrate RichTextEditor to Lexical
|
|
4
|
+
* - Should run a function that converts rich text to plain text and sends that out in onChange. (like how we do for TitleInput)
|
|
5
|
+
* - for backwards compatibility, in the initValueSetting function, we should convert all plain text values to lexical shape & all draftjs shaped values also to lexical shape
|
|
6
|
+
* - memoization of cell comps maybe? there is some commented code for the same below..
|
|
7
|
+
*/
|
|
1
8
|
export function SimpleTable({ id, readOnly, config, value: _value, onChange, defaultColWidth, }: {
|
|
2
9
|
id: any;
|
|
3
10
|
readOnly: any;
|
|
@@ -66,15 +66,15 @@ 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
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
*/
|
|
71
|
+
/**
|
|
72
|
+
* PENDINGS
|
|
73
|
+
* - Ideally should migrate RichTextEditor to Lexical
|
|
74
|
+
* - Should run a function that converts rich text to plain text and sends that out in onChange. (like how we do for TitleInput)
|
|
75
|
+
* - for backwards compatibility, in the initValueSetting function, we should convert all plain text values to lexical shape & all draftjs shaped values also to lexical shape
|
|
76
|
+
* - memoization of cell comps maybe? there is some commented code for the same below..
|
|
77
|
+
*/
|
|
78
78
|
function SimpleTable(_a) {
|
|
79
79
|
var id = _a.id, readOnly = _a.readOnly, _b = _a.config, config = _b === void 0 ? {
|
|
80
80
|
noOfCols: 3,
|
|
@@ -126,10 +126,7 @@ function SimpleTable(_a) {
|
|
|
126
126
|
}, [colResizeState]);
|
|
127
127
|
var CellContentBlocks = {
|
|
128
128
|
RichTextEditor: RichTextEditor,
|
|
129
|
-
|
|
130
|
-
// TextInput,
|
|
131
|
-
// RadioList,
|
|
132
|
-
// SANS_3,
|
|
129
|
+
DropdownSingle: DropdownSingle_1.DropdownSingle
|
|
133
130
|
};
|
|
134
131
|
var CellContentBlockDefaultProps = {
|
|
135
132
|
RichTextEditor: {
|
|
@@ -141,21 +138,21 @@ function SimpleTable(_a) {
|
|
|
141
138
|
},
|
|
142
139
|
},
|
|
143
140
|
DropdownSingle: {
|
|
144
|
-
|
|
141
|
+
selectStyleOverride: {
|
|
142
|
+
backgroundColor: themes_1.colors.none,
|
|
143
|
+
},
|
|
144
|
+
popOutOfOverflowHiddenParent: true,
|
|
145
145
|
}
|
|
146
|
-
// KPDropdown: {
|
|
147
|
-
// size: 'small',
|
|
148
|
-
// },
|
|
149
146
|
};
|
|
147
|
+
var CellValueGetters = {
|
|
148
|
+
RichTextEditor: function (v) { return (convertToRichText ? convertToRichText(v) : v); },
|
|
149
|
+
}; //prob dont need this..
|
|
150
150
|
var _g = (0, react_1.useState)(undefined), actionsActiveOnRow = _g[0], setActionsActiveOnRow = _g[1];
|
|
151
151
|
var _h = (0, react_1.useState)(undefined), actionsActiveOnCol = _h[0], setActionsActiveOnCol = _h[1];
|
|
152
152
|
var _j = (0, react_1.useState)({
|
|
153
153
|
rowIdx: undefined,
|
|
154
154
|
colIdx: undefined,
|
|
155
155
|
}), hoveredRowAndCol = _j[0], setHoveredRowAndCol = _j[1];
|
|
156
|
-
var CellValueGetters = {
|
|
157
|
-
RichTextEditor: function (v) { return (convertToRichText ? convertToRichText(v) : v); },
|
|
158
|
-
}; //prob dont need this..
|
|
159
156
|
var handleCellInputChange = function (_a) {
|
|
160
157
|
var cellIdx = _a.cellIdx, rowIdx = _a.rowIdx, v = _a.v;
|
|
161
158
|
var valData = value.data;
|
|
@@ -178,11 +175,11 @@ function SimpleTable(_a) {
|
|
|
178
175
|
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
|
|
179
176
|
, enableColResizeActions = _b === void 0 ? true : _b // cuz in the case of pre fixed column (via config.rowHeaderData), enableResize will be set to false
|
|
180
177
|
;
|
|
181
|
-
var
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var cellProps =
|
|
185
|
-
var cellValue = CellValueGetters[
|
|
178
|
+
var cellCompName = cell.comp || 'RichTextEditor';
|
|
179
|
+
var NoCompPlaceholder = function () { return react_1.default.createElement("div", null, "No comp exists"); };
|
|
180
|
+
var CellComp = CellContentBlocks[cellCompName] || NoCompPlaceholder;
|
|
181
|
+
var cellProps = CellContentBlockDefaultProps[cellCompName] ? __assign(__assign({}, CellContentBlockDefaultProps[cellCompName]), (cell.props || {})) : {};
|
|
182
|
+
var cellValue = CellValueGetters[cellCompName] ? CellValueGetters[cellCompName](cell.value) : cell.value;
|
|
186
183
|
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
|
|
187
184
|
//(100% - totalExplicitWidths)/(totalColumns - noOfColsWithExplicitWidths)
|
|
188
185
|
// let cellProps = {
|