oolib 2.68.4 → 2.68.5

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.
@@ -10,7 +10,12 @@ export namespace UIContent {
10
10
  export const duplicate: string;
11
11
  export const insertRowAfter: string;
12
12
  export const insertRowBefore: string;
13
+ export const clearContent: string;
13
14
  export const insertColAfter: string;
14
15
  export const insertColBefore: string;
16
+ export const addHeaderCol: string;
17
+ export const addHeaderRow: string;
18
+ export const removeHeaderRow: string;
19
+ export const stretchToFullWidth: string;
15
20
  }
16
21
  }
@@ -12,7 +12,12 @@ exports.UIContent = {
12
12
  duplicate: 'Duplicate',
13
13
  insertRowAfter: 'Insert Below',
14
14
  insertRowBefore: 'Insert Above',
15
+ clearContent: 'Clear Content',
15
16
  insertColAfter: 'Insert Right',
16
- insertColBefore: 'Insert Left'
17
+ insertColBefore: 'Insert Left',
18
+ addHeaderCol: 'Header Column',
19
+ addHeaderRow: 'Add Header Row',
20
+ removeHeaderRow: 'Remove Header Row',
21
+ stretchToFullWidth: 'Stretch to Full Width'
17
22
  }
18
23
  };
@@ -1,7 +1,8 @@
1
1
  export function AddRowButton({ onClick }: {
2
2
  onClick: any;
3
3
  }): React.JSX.Element;
4
- export function AddColButton({ onClick }: {
4
+ export function AddColButton({ onClick, addColButtonWidth }: {
5
5
  onClick: any;
6
+ addColButtonWidth: any;
6
7
  }): React.JSX.Element;
7
8
  import React from "react";
@@ -39,7 +39,7 @@ var mixins_1 = require("../../../../themes/mixins");
39
39
  var Plus = icons_1.icons.Plus;
40
40
  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
41
  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 width: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 2rem; //should be same as height of StyledRowButton\n flex-shrink: 0;\n ", "\n"], ["\n width: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 2rem; //should be same as height of StyledRowButton\n flex-shrink: 0;\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 margin-bottom: 2rem; //should be same as height of StyledRowButton\n flex-shrink: 0;\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 2rem; //should be same as height of StyledRowButton\n flex-shrink: 0;\n ", "\n"])), commonStyles);
43
43
  var AddRowButton = function (_a) {
44
44
  var onClick = _a.onClick;
45
45
  return (react_1.default.createElement(StyledRowButton, { onClick: onClick },
@@ -47,8 +47,8 @@ var AddRowButton = function (_a) {
47
47
  };
48
48
  exports.AddRowButton = AddRowButton;
49
49
  var AddColButton = function (_a) {
50
- var onClick = _a.onClick;
51
- return (react_1.default.createElement(StyledColButton, { onClick: onClick },
50
+ var onClick = _a.onClick, addColButtonWidth = _a.addColButtonWidth;
51
+ return (react_1.default.createElement(StyledColButton, { style: { width: addColButtonWidth + 'px' }, onClick: onClick },
52
52
  react_1.default.createElement(Plus, { size: 12, weight: "bold" })));
53
53
  };
54
54
  exports.AddColButton = AddColButton;
@@ -1,8 +1,9 @@
1
- export function ColActionsMenu({ value, colIdx, onChange, id, defaultColWidth }: {
1
+ export function ColActionsMenu({ value, colIdx, onChange, id, defaultColWidth, colActionsButtonHeight }: {
2
2
  value: any;
3
3
  colIdx: any;
4
4
  onChange: any;
5
5
  id: any;
6
6
  defaultColWidth: any;
7
+ colActionsButtonHeight: any;
7
8
  }): React.JSX.Element;
8
9
  import React from "react";
@@ -15,13 +15,13 @@ var UIContent_1 = require("../../../../../UIContent");
15
15
  var styled_1 = require("../styled");
16
16
  var DisplayIcon_1 = require("../../../../../utils/comps/DisplayIcon");
17
17
  var styled_components_1 = __importDefault(require("styled-components"));
18
- var StyledCustomSelectCompWrapper = styled_components_1.default.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n height: 1.5rem;\n width: 2.5rem;\n"], ["\n ", "\n height: 1.5rem;\n width: 2.5rem;\n"])), styled_1.commonRowColActionMenuStyles);
18
+ var StyledCustomSelectCompWrapper = styled_components_1.default.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n width: 2.5rem;\n"], ["\n ", "\n width: 2.5rem;\n"])), styled_1.commonRowColActionMenuStyles);
19
19
  var ColActionsMenu = function (_a) {
20
- var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth;
20
+ var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth, colActionsButtonHeight = _a.colActionsButtonHeight;
21
21
  return (react_1.default.createElement("div", { style: { zIndex: 2, position: 'absolute', top: 0, left: '50%', transform: 'translate(-50%, -50%)' } },
22
22
  react_1.default.createElement(ActionMenu_1.ActionMenu, { align: "left", CustomSelectComp: function (_a) {
23
23
  var active = _a.active, onClick = _a.onClick;
24
- return (react_1.default.createElement(StyledCustomSelectCompWrapper, { onClick: onClick, active: active },
24
+ return (react_1.default.createElement(StyledCustomSelectCompWrapper, { style: { height: colActionsButtonHeight + 'px' }, onClick: onClick, active: active },
25
25
  react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThree", size: 16 })));
26
26
  }, actions: [
27
27
  {
@@ -39,6 +39,10 @@ var ColActionsMenu = function (_a) {
39
39
  {
40
40
  display: UIContent_1.UIContent.SimpleTable.insertColBefore,
41
41
  onClick: function () { return (0, handleColActions_1.handleInsertColBefore)({ value: value, colIdx: colIdx, onChange: onChange, id: id, defaultColWidth: defaultColWidth }); },
42
+ },
43
+ {
44
+ display: UIContent_1.UIContent.SimpleTable.clearContent,
45
+ onClick: function () { return (0, handleColActions_1.handleClearColContent)({ value: value, colIdx: colIdx, onChange: onChange, id: id, defaultColWidth: defaultColWidth }); },
42
46
  }
43
47
  ] })));
44
48
  };
@@ -1,8 +1,9 @@
1
- export function RowActionsMenu({ value, rowIdx, onChange, id, setActionsActiveOnRow }: {
1
+ export function RowActionsMenu({ value, rowIdx, onChange, id, setActionsActiveOnRow, rowActionsButtonWidth }: {
2
2
  value: any;
3
3
  rowIdx: any;
4
4
  onChange: any;
5
5
  id: any;
6
6
  setActionsActiveOnRow: any;
7
+ rowActionsButtonWidth: any;
7
8
  }): React.JSX.Element;
8
9
  import React from "react";
@@ -15,14 +15,10 @@ var DisplayIcon_1 = require("../../../../../utils/comps/DisplayIcon");
15
15
  var ActionMenu_1 = require("../../../../ActionMenu");
16
16
  var handleRowActions_1 = require("../../../handlers/handleRowActions");
17
17
  var styled_1 = require("../styled");
18
- var StyledCustomSelectCompWrapper = styled_components_1.default.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n width: 1.5rem;\n height: 2.5rem;\n"], ["\n ", "\n width: 1.5rem;\n height: 2.5rem;\n"])), styled_1.commonRowColActionMenuStyles);
19
- var CustomSelectComp = function (_a) {
20
- var active = _a.active, onClick = _a.onClick;
21
- return (react_1.default.createElement(StyledCustomSelectCompWrapper, { onClick: onClick, active: active },
22
- react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThreeVertical", size: 16 })));
23
- };
18
+ var StyledCustomSelectCompWrapper = styled_components_1.default.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n /* width: 1.5rem; */\n height: 2.5rem;\n"], ["\n ", "\n /* width: 1.5rem; */\n height: 2.5rem;\n"])), styled_1.commonRowColActionMenuStyles);
19
+ // const CustomSelectComp =
24
20
  var RowActionsMenu = function (_a) {
25
- var value = _a.value, rowIdx = _a.rowIdx, onChange = _a.onChange, id = _a.id, setActionsActiveOnRow = _a.setActionsActiveOnRow;
21
+ var value = _a.value, rowIdx = _a.rowIdx, onChange = _a.onChange, id = _a.id, setActionsActiveOnRow = _a.setActionsActiveOnRow, rowActionsButtonWidth = _a.rowActionsButtonWidth;
26
22
  return (react_1.default.createElement("div", { style: {
27
23
  zIndex: 1,
28
24
  position: "absolute",
@@ -30,7 +26,11 @@ var RowActionsMenu = function (_a) {
30
26
  left: 0,
31
27
  transform: "translate(-50%, -50%)",
32
28
  } },
33
- react_1.default.createElement(ActionMenu_1.ActionMenu, { align: "left", setShowActions: function (showActions) { return setActionsActiveOnRow(showActions ? rowIdx : undefined); }, CustomSelectComp: CustomSelectComp, actions: [
29
+ react_1.default.createElement(ActionMenu_1.ActionMenu, { align: "left", setShowActions: function (showActions) { return setActionsActiveOnRow(showActions ? rowIdx : undefined); }, CustomSelectComp: function (_a) {
30
+ var active = _a.active, onClick = _a.onClick;
31
+ return (react_1.default.createElement(StyledCustomSelectCompWrapper, { style: { width: rowActionsButtonWidth + 'px' }, onClick: onClick, active: active },
32
+ react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThreeVertical", size: 16 })));
33
+ }, actions: [
34
34
  {
35
35
  display: UIContent_1.UIContent.SimpleTable.delete,
36
36
  onClick: function () { return (0, handleRowActions_1.handleDeleteRow)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id }); },
@@ -51,6 +51,12 @@ var RowActionsMenu = function (_a) {
51
51
  return (0, handleRowActions_1.handleInsertRowAfter)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id });
52
52
  },
53
53
  },
54
+ {
55
+ display: UIContent_1.UIContent.SimpleTable.clearContent,
56
+ onClick: function () {
57
+ return (0, handleRowActions_1.handleClearRowContent)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id });
58
+ },
59
+ },
54
60
  ] })));
55
61
  };
56
62
  exports.RowActionsMenu = RowActionsMenu;
@@ -30,3 +30,9 @@ export function handleInsertColBefore({ value, colIdx, onChange, id, defaultColW
30
30
  id: any;
31
31
  defaultColWidth: any;
32
32
  }): void;
33
+ export function handleClearColContent({ value, colIdx, onChange, id }: {
34
+ value: any;
35
+ colIdx: any;
36
+ onChange: any;
37
+ id: any;
38
+ }): void;
@@ -20,7 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
20
20
  return to.concat(ar || Array.prototype.slice.call(from));
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.handleInsertColBefore = exports.handleInsertColAfter = exports.handleDuplicateCol = exports.handleDeleteCol = exports.handleAddCol = void 0;
23
+ exports.handleClearColContent = exports.handleInsertColBefore = exports.handleInsertColAfter = exports.handleDuplicateCol = exports.handleDeleteCol = exports.handleAddCol = void 0;
24
24
  var genHash_1 = require("../utils/genHash");
25
25
  var handleAddColAtIdx = function (_a) {
26
26
  var value = _a.value, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth, colIdx = _a.colIdx;
@@ -127,3 +127,17 @@ var handleInsertColBefore = function (_a) {
127
127
  });
128
128
  };
129
129
  exports.handleInsertColBefore = handleInsertColBefore;
130
+ var handleClearColContent = function (_a) {
131
+ var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id;
132
+ var data = value.data, colWidthConfig = value.colWidthConfig;
133
+ var newData = data.map(function (row) {
134
+ var newCellData = __spreadArray([], row.cellData, true);
135
+ var cellToClear = newCellData[colIdx];
136
+ delete cellToClear.value;
137
+ newCellData.splice(colIdx, 1, cellToClear);
138
+ return __assign(__assign({}, row), { cellData: newCellData });
139
+ });
140
+ onChange &&
141
+ onChange(id, { data: newData, colWidthConfig: colWidthConfig });
142
+ };
143
+ exports.handleClearColContent = handleClearColContent;
@@ -23,3 +23,9 @@ export function handleInsertRowBefore({ value, rowIdx, onChange, id }: {
23
23
  onChange: any;
24
24
  id: any;
25
25
  }): void;
26
+ export function handleClearRowContent({ value, rowIdx, onChange, id }: {
27
+ value: any;
28
+ rowIdx: any;
29
+ onChange: any;
30
+ id: any;
31
+ }): void;
@@ -20,7 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
20
20
  return to.concat(ar || Array.prototype.slice.call(from));
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.handleInsertRowBefore = exports.handleInsertRowAfter = exports.handleDuplicateRow = exports.handleDeleteRow = exports.handleAddRow = void 0;
23
+ exports.handleClearRowContent = exports.handleInsertRowBefore = exports.handleInsertRowAfter = exports.handleDuplicateRow = exports.handleDeleteRow = exports.handleAddRow = void 0;
24
24
  var makeArrayFromLength_1 = require("../../../utils/makeArrayFromLength");
25
25
  var genHash_1 = require("../utils/genHash");
26
26
  var genNewRow = function (_a) {
@@ -78,3 +78,12 @@ var handleInsertRowBefore = function (_a) {
78
78
  onChange && onChange(id, { data: newData, colWidthConfig: colWidthConfig });
79
79
  };
80
80
  exports.handleInsertRowBefore = handleInsertRowBefore;
81
+ var handleClearRowContent = function (_a) {
82
+ var value = _a.value, rowIdx = _a.rowIdx, onChange = _a.onChange, id = _a.id;
83
+ var data = value.data, colWidthConfig = value.colWidthConfig;
84
+ var newData = __spreadArray([], data, true);
85
+ var newRow = genNewRow({ data: newData, rowIdx: rowIdx });
86
+ newData.splice(rowIdx, 1, newRow);
87
+ onChange && onChange(id, { data: newData, colWidthConfig: colWidthConfig });
88
+ };
89
+ exports.handleClearRowContent = handleClearRowContent;
@@ -0,0 +1,8 @@
1
+ export function handleStretchToFullWidth({ value, onChange, id, enableColActions, addColButtonWidth, fullWidthCompWrapper, }: {
2
+ value: any;
3
+ onChange: any;
4
+ id: any;
5
+ enableColActions: any;
6
+ addColButtonWidth: any;
7
+ fullWidthCompWrapper: any;
8
+ }): void;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.handleStretchToFullWidth = void 0;
15
+ var handleStretchToFullWidth = function (_a) {
16
+ var _b;
17
+ var value = _a.value, onChange = _a.onChange, id = _a.id, enableColActions = _a.enableColActions, addColButtonWidth = _a.addColButtonWidth, fullWidthCompWrapper = _a.fullWidthCompWrapper;
18
+ var data = value.data, colWidthConfig = value.colWidthConfig;
19
+ var totalAvailableWidth = ((_b = fullWidthCompWrapper.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) -
20
+ (enableColActions ? addColButtonWidth : 0);
21
+ var noOfCols = data[0].cellData.length;
22
+ var widthPerCol = totalAvailableWidth / noOfCols + "px";
23
+ var newColWidthConfig = Object.keys(colWidthConfig)
24
+ .map(function (k) { return ({
25
+ colId: k,
26
+ width: widthPerCol,
27
+ }); })
28
+ .reduce(function (a, b) {
29
+ var _a;
30
+ return (__assign(__assign({}, a), (_a = {}, _a[b.colId] = b.width, _a)));
31
+ }, {});
32
+ onChange && onChange(id, { data: data, colWidthConfig: newColWidthConfig });
33
+ };
34
+ exports.handleStretchToFullWidth = handleStretchToFullWidth;
@@ -0,0 +1,5 @@
1
+ export function handleToggleRowHeader({ value, onChange, id }: {
2
+ value: any;
3
+ onChange: any;
4
+ id: any;
5
+ }): void;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.handleToggleRowHeader = void 0;
15
+ var handleToggleRowHeader = function (_a) {
16
+ var value = _a.value, onChange = _a.onChange, id = _a.id;
17
+ var data = value.data, colWidthConfig = value.colWidthConfig;
18
+ var newData = data.map(function (row, rowIdx) {
19
+ if (row.isColHeader) { //then remove
20
+ var newRow = __assign({}, row);
21
+ delete newRow.isColHeader;
22
+ return newRow;
23
+ }
24
+ else { //else add
25
+ return __assign(__assign({}, row), (rowIdx === 0 ? { isColHeader: true } : {}));
26
+ }
27
+ });
28
+ onChange &&
29
+ onChange(id, { data: newData, colWidthConfig: colWidthConfig });
30
+ };
31
+ exports.handleToggleRowHeader = handleToggleRowHeader;
@@ -52,15 +52,18 @@ var BlockLabel_1 = require("../BlockLabel");
52
52
  var styled_components_1 = require("styled-components");
53
53
  var utilsOolib_1 = require("../../utilsOolib");
54
54
  var AddRowColButtons_1 = require("./comps/AddRowColButtons");
55
+ var UIContent_1 = require("../../UIContent");
56
+ var ActionMenu_1 = require("../ActionMenu");
55
57
  var ColActionsMenu_1 = require("./comps/rowColActionMenus/ColActionsMenu");
56
58
  var RowActionsMenu_1 = require("./comps/rowColActionMenus/RowActionsMenu");
57
59
  var handleColActions_1 = require("./handlers/handleColActions");
58
60
  var handleRowActions_1 = require("./handlers/handleRowActions");
61
+ var handleStretchToFullWidth_1 = require("./handlers/handleStretchToFullWidth");
62
+ var handleToggleRowHeader_1 = require("./handlers/handleToggleRowHeader");
59
63
  var styled_1 = require("./styled");
60
64
  var useResizeTableColumns_1 = require("./useResizeTableColumns");
61
65
  var convertColHeaderConfigToRowData_1 = require("./utils/convertColHeaderConfigToRowData");
62
66
  var prepInitValueFromConfigIfNoValue_1 = require("./utils/prepInitValueFromConfigIfNoValue");
63
- var lodash_1 = require("lodash");
64
67
  var greyColor100 = themes_1.colors.greyColor100;
65
68
  /*pending:
66
69
  - first test whatever is done on okf
@@ -93,11 +96,14 @@ function SimpleTable(_a) {
93
96
  // }
94
97
  // return _RichTextEditor && React.memo(_RichTextEditor, checkMemoFn)
95
98
  // },[])
96
- var _e = (0, react_1.useMemo)(function () { return (0, prepInitValueFromConfigIfNoValue_1.prepInitValueFromConfigIfNoValue)({
97
- _value: _value,
98
- config: config,
99
- defaultColWidth: defaultColWidth,
100
- }); }, [_value]), value = _e.value, enableColActions = _e.enableColActions, //returns all possible actions config if no config.colHeaderData is defined. else undefined\
99
+ var _e = (0, react_1.useMemo)(function () {
100
+ return (0, prepInitValueFromConfigIfNoValue_1.prepInitValueFromConfigIfNoValue)({
101
+ //memo v.imp cuz otherwise cell and row id keep changing on rerender if value doesnt exist, and this messes with their react keys, this leads to bugs
102
+ _value: _value,
103
+ config: config,
104
+ defaultColWidth: defaultColWidth,
105
+ });
106
+ }, [_value]), value = _e.value, enableColActions = _e.enableColActions, //returns all possible actions config if no config.colHeaderData is defined. else undefined\
101
107
  enableRowActions = _e.enableRowActions, canToggleColHeaderStyle = _e.canToggleColHeaderStyle;
102
108
  var _f = (0, useResizeTableColumns_1.useResizeTableColumns)({
103
109
  setColWidthConfig: function (setterFn) {
@@ -128,7 +134,7 @@ function SimpleTable(_a) {
128
134
  typo: "SANS_3",
129
135
  placeholder: " ",
130
136
  style: {
131
- padding: "0.8rem 1rem",
137
+ padding: "0.9rem 1rem",
132
138
  },
133
139
  },
134
140
  // KPDropdown: {
@@ -151,6 +157,16 @@ function SimpleTable(_a) {
151
157
  newData[rowIdx].cellData[cellIdx].value = v;
152
158
  onChange && onChange(id, { data: newData, colWidthConfig: colWidthConfig });
153
159
  };
160
+ /**
161
+ * we are explicitly defining this here and passing it on to AddColButton comp
162
+ * since we need this width to calculate stretch to full width
163
+ */
164
+ var addColButtonWidth = 20;
165
+ // these are explicitly defined here cuz we need to calc offset padding and margin using these, so that overflowX doesnt hide them
166
+ var rowActionsButtonWidth = 15;
167
+ var colActionsButtonHeight = 15;
168
+ var primaryTableActionsMenuHeight = 30;
169
+ var primaryTableActionsMenuGap = 5;
154
170
  var genRow = function (_a) {
155
171
  var row = _a.row, rowIdx = _a.rowIdx;
156
172
  var StyledWrapper = row.isColHeader
@@ -196,38 +212,93 @@ function SimpleTable(_a) {
196
212
  onChange: onChange,
197
213
  id: id,
198
214
  defaultColWidth: defaultColWidth,
215
+ colActionsButtonHeight: colActionsButtonHeight,
199
216
  }))),
200
217
  !readOnly &&
201
218
  enableRowActions &&
202
219
  cellIdx === 0 &&
203
220
  rowIdx !== undefined && //cuz for fixed col headers, rowIdx is undefined
204
- hoveredRowAndCol.rowIdx === rowIdx && (react_1.default.createElement(RowActionsMenu_1.RowActionsMenu, __assign({}, { value: value, rowIdx: rowIdx, onChange: onChange, id: id, setActionsActiveOnRow: setActionsActiveOnRow }))),
221
+ hoveredRowAndCol.rowIdx === rowIdx && (react_1.default.createElement(RowActionsMenu_1.RowActionsMenu, __assign({}, {
222
+ value: value,
223
+ rowIdx: rowIdx,
224
+ onChange: onChange,
225
+ id: id,
226
+ setActionsActiveOnRow: setActionsActiveOnRow,
227
+ rowActionsButtonWidth: rowActionsButtonWidth,
228
+ }))),
205
229
  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) {
206
230
  return handleCellInputChange({ v: v, rowIdx: rowIdx, cellIdx: cellIdx });
207
231
  } }))));
208
232
  })));
209
233
  };
234
+ var fullWidthCompWrapper = (0, react_1.useRef)(null);
210
235
  return (react_1.default.createElement("div", null,
211
236
  react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, getBlockLabelProps_1.getBlockLabelProps)(props))),
212
237
  react_1.default.createElement("div", { style: {
213
- display: "flex",
214
- alignItems: "stretch" /**without stretch AddColButton will be wonky */,
238
+ overflowX: "auto",
239
+ paddingLeft: rowActionsButtonWidth / 2 + "px",
240
+ marginLeft: "-" + rowActionsButtonWidth / 2 + "px",
241
+ paddingTop: primaryTableActionsMenuGap + primaryTableActionsMenuHeight + 'px'
215
242
  } },
216
- react_1.default.createElement("div", null,
217
- react_1.default.createElement(styled_1.StyledSimpleTable, { onMouseLeave: function () {
218
- return setHoveredRowAndCol({ rowIdx: undefined, colIdx: undefined });
219
- } },
220
- config.colHeaderData &&
221
- genRow({
222
- row: (0, convertColHeaderConfigToRowData_1.convertColHeaderConfigToRowData)({
223
- colHeaderData: config.colHeaderData,
224
- convertToRichText: convertToRichText,
243
+ react_1.default.createElement("div", { ref: fullWidthCompWrapper, style: {
244
+ display: "flex",
245
+ alignItems: "stretch" /**without stretch AddColButton will be wonky */,
246
+ } },
247
+ react_1.default.createElement("div", { style: { position: "relative" } },
248
+ react_1.default.createElement("div", { style: {
249
+ position: "absolute",
250
+ right: 0,
251
+ top: "-" + primaryTableActionsMenuGap + "px",
252
+ transform: "translateY(-100%)",
253
+ zIndex: 1,
254
+ } },
255
+ react_1.default.createElement(ActionMenu_1.ActionMenu, { ButtonComp: "ButtonPrimary", actions: __spreadArray(__spreadArray([
256
+ {
257
+ display: UIContent_1.UIContent.SimpleTable.stretchToFullWidth,
258
+ onClick: function () {
259
+ return (0, handleStretchToFullWidth_1.handleStretchToFullWidth)({
260
+ value: value,
261
+ onChange: onChange,
262
+ id: id,
263
+ enableColActions: enableColActions,
264
+ addColButtonWidth: addColButtonWidth,
265
+ fullWidthCompWrapper: fullWidthCompWrapper,
266
+ });
267
+ },
268
+ }
269
+ ], (enableRowActions
270
+ ? [
271
+ {
272
+ display: UIContent_1.UIContent.SimpleTable.addHeaderCol,
273
+ onClick: function () { },
274
+ },
275
+ ]
276
+ : []), true), (enableColActions
277
+ ? [
278
+ {
279
+ display: value.data[0].isColHeader
280
+ ? UIContent_1.UIContent.SimpleTable.removeHeaderRow
281
+ : UIContent_1.UIContent.SimpleTable.addHeaderRow,
282
+ onClick: function () {
283
+ return (0, handleToggleRowHeader_1.handleToggleRowHeader)({ value: value, onChange: onChange, id: id });
284
+ },
285
+ },
286
+ ]
287
+ : []), true) })),
288
+ react_1.default.createElement(styled_1.StyledSimpleTable, { onMouseLeave: function () {
289
+ return setHoveredRowAndCol({ rowIdx: undefined, colIdx: undefined });
290
+ } },
291
+ config.colHeaderData &&
292
+ genRow({
293
+ row: (0, convertColHeaderConfigToRowData_1.convertColHeaderConfigToRowData)({
294
+ colHeaderData: config.colHeaderData,
295
+ convertToRichText: convertToRichText,
296
+ }),
225
297
  }),
226
- }),
227
- value.data.map(function (row, rowIdx) { return genRow({ row: row, rowIdx: rowIdx }); })),
228
- !readOnly && enableRowActions && (react_1.default.createElement(AddRowColButtons_1.AddRowButton, { onClick: function () { return (0, handleRowActions_1.handleAddRow)(value, props); } }))),
229
- !readOnly && enableColActions && (react_1.default.createElement(AddRowColButtons_1.AddColButton, { onClick: function () {
230
- return (0, handleColActions_1.handleAddCol)({ value: value, onChange: onChange, id: id, defaultColWidth: defaultColWidth });
231
- } })))));
298
+ value.data.map(function (row, rowIdx) { return genRow({ row: row, rowIdx: rowIdx }); })),
299
+ !readOnly && enableRowActions && (react_1.default.createElement(AddRowColButtons_1.AddRowButton, { onClick: function () { return (0, handleRowActions_1.handleAddRow)(value, props); } }))),
300
+ !readOnly && enableColActions && (react_1.default.createElement(AddRowColButtons_1.AddColButton, { addColButtonWidth: addColButtonWidth, onClick: function () {
301
+ return (0, handleColActions_1.handleAddCol)({ value: value, onChange: onChange, id: id, defaultColWidth: defaultColWidth });
302
+ } }))))));
232
303
  }
233
304
  exports.SimpleTable = SimpleTable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.68.4",
3
+ "version": "2.68.5",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",