oolib 2.227.6 → 2.227.7

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.
Files changed (39) hide show
  1. package/dist/UIContent/index.d.ts +0 -15
  2. package/dist/UIContent/index.js +0 -14
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +2 -4
  5. package/package.json +1 -1
  6. package/dist/components/SimpleTable/comps/AddRowColButtons/index.d.ts +0 -9
  7. package/dist/components/SimpleTable/comps/AddRowColButtons/index.js +0 -77
  8. package/dist/components/SimpleTable/comps/rowColActionMenus/ColActionsMenu/index.d.ts +0 -11
  9. package/dist/components/SimpleTable/comps/rowColActionMenus/ColActionsMenu/index.js +0 -95
  10. package/dist/components/SimpleTable/comps/rowColActionMenus/RowActionsMenu/index.d.ts +0 -12
  11. package/dist/components/SimpleTable/comps/rowColActionMenus/RowActionsMenu/index.js +0 -120
  12. package/dist/components/SimpleTable/comps/rowColActionMenus/styled.d.ts +0 -1
  13. package/dist/components/SimpleTable/comps/rowColActionMenus/styled.js +0 -18
  14. package/dist/components/SimpleTable/handlers/handleColActions.d.ts +0 -38
  15. package/dist/components/SimpleTable/handlers/handleColActions.js +0 -155
  16. package/dist/components/SimpleTable/handlers/handleRowActions.d.ts +0 -34
  17. package/dist/components/SimpleTable/handlers/handleRowActions.js +0 -96
  18. package/dist/components/SimpleTable/handlers/handleStretchToFullWidth.d.ts +0 -8
  19. package/dist/components/SimpleTable/handlers/handleStretchToFullWidth.js +0 -34
  20. package/dist/components/SimpleTable/handlers/handleToggleColHeader.d.ts +0 -5
  21. package/dist/components/SimpleTable/handlers/handleToggleColHeader.js +0 -21
  22. package/dist/components/SimpleTable/handlers/handleToggleRowHeader.d.ts +0 -5
  23. package/dist/components/SimpleTable/handlers/handleToggleRowHeader.js +0 -31
  24. package/dist/components/SimpleTable/index.d.ts +0 -31
  25. package/dist/components/SimpleTable/index.js +0 -366
  26. package/dist/components/SimpleTable/styled.d.ts +0 -5
  27. package/dist/components/SimpleTable/styled.js +0 -80
  28. package/dist/components/SimpleTable/useResizeTableColumns.d.ts +0 -21
  29. package/dist/components/SimpleTable/useResizeTableColumns.js +0 -88
  30. package/dist/components/SimpleTable/utils/convertColHeaderConfigToRowData.d.ts +0 -8
  31. package/dist/components/SimpleTable/utils/convertColHeaderConfigToRowData.js +0 -16
  32. package/dist/components/SimpleTable/utils/convertRowHeaderConfigToCellData.d.ts +0 -10
  33. package/dist/components/SimpleTable/utils/convertRowHeaderConfigToCellData.js +0 -13
  34. package/dist/components/SimpleTable/utils/genHash.d.ts +0 -1
  35. package/dist/components/SimpleTable/utils/genHash.js +0 -13
  36. package/dist/components/SimpleTable/utils/prepInitValueFromConfigIfNoValue.d.ts +0 -10
  37. package/dist/components/SimpleTable/utils/prepInitValueFromConfigIfNoValue.js +0 -79
  38. package/dist/stories/Oolib/components/SimpleTable.stories.d.ts +0 -67
  39. package/dist/stories/Oolib/components/SimpleTable.stories.js +0 -128
@@ -11,19 +11,4 @@ export namespace UIContent {
11
11
  let uploadError_1: string;
12
12
  export { uploadError_1 as uploadError };
13
13
  }
14
- namespace SimpleTable {
15
- let _delete: string;
16
- export { _delete as delete };
17
- export let duplicate: string;
18
- export let insertRowAfter: string;
19
- export let insertRowBefore: string;
20
- export let clearContent: string;
21
- export let insertColAfter: string;
22
- export let insertColBefore: string;
23
- export let addHeaderCol: string;
24
- export let removeHeaderCol: string;
25
- export let addHeaderRow: string;
26
- export let removeHeaderRow: string;
27
- export let stretchToFullWidth: string;
28
- }
29
14
  }
@@ -12,19 +12,5 @@ exports.UIContent = {
12
12
  },
13
13
  Pdf: {
14
14
  uploadError: "Unable to upload file"
15
- },
16
- SimpleTable: {
17
- delete: 'Delete',
18
- duplicate: 'Duplicate',
19
- insertRowAfter: 'Insert Below',
20
- insertRowBefore: 'Insert Above',
21
- clearContent: 'Clear Content',
22
- insertColAfter: 'Insert Right',
23
- insertColBefore: 'Insert Left',
24
- addHeaderCol: 'Add Header Column',
25
- removeHeaderCol: 'Remove Header Column',
26
- addHeaderRow: 'Add Header Row',
27
- removeHeaderRow: 'Remove Header Row',
28
- stretchToFullWidth: 'Stretch to Full Width'
29
15
  }
30
16
  };
package/dist/index.d.ts CHANGED
@@ -53,7 +53,6 @@ export { default as IFrameInput } from "./components/IFrameInput";
53
53
  export { ResourceInput } from "./components/ResourceInput";
54
54
  export { default as GroupQuestionsInputSingle } from "./components/GroupQuestionsInputSingle";
55
55
  export { ModalConfirmAction } from "./components/Modals/derivedComps/ModalConfirmAction";
56
- export { SimpleTable } from "./components/SimpleTable";
57
56
  export { styledOKELinkCSS } from "./components/OKELink/styled";
58
57
  export { default as TableCellResizerPlugin } from "./components/Lexical/Plugins/TableCellResizer";
59
58
  export { CardContent } from "./v2/components/cards/CardContent";
package/dist/index.js CHANGED
@@ -40,8 +40,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.BannerInfo = exports.BannerAlert = exports.GroupQuestionsInputSingle = exports.ResourceInput = exports.IFrameInput = exports.PDFInput = exports.AudioInput = exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.PageScrollIndicator = exports.HomeCover = exports.EmptyStates = exports.ModalSmall = exports.Modal = exports.ModalForms = exports.ModalConfirm = exports.SkeletonLoader = exports.Divider = exports.PercentCompletedPie = exports.Accordion = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.TagDisplay = exports.TagSelect = exports.TagLink = exports.TagClear = exports.LoaderOverlay = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.applyBlackOverlayOnHover = exports.icons = exports.colors = exports.GlobalStyles = void 0;
43
- exports.List = exports.SwitchDouble = exports.SwitchSingle = exports.RadioButton = exports.RadioInput = exports.RadioList = exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = exports.AccordionV2 = exports.HomeCoverV2 = exports.DateRangePickerV2 = exports.MetaBlockV2 = exports.typoV2_CSS = exports.colors2 = exports.TabBarV2 = exports.ButtonUpload = exports.ButtonGhostCompact = exports.ButtonTertiaryCompact = exports.ButtonSecondaryCompact = exports.ButtonPrimaryCompact = exports.ButtonGhostV2 = exports.ButtonTertiaryV2 = exports.ButtonSecondaryV2 = exports.ButtonPrimaryV2 = exports.TagClearV2 = exports.TagLinkV2 = exports.TagDisplayV2 = exports.generateOptions = exports.genTagComp = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.HintsProvider = exports.BlockLabel = exports.ListContent = exports.CardContent = exports.URLInput = exports.PasswordInput = exports.PhoneInput = exports.NumberInput = exports.EmailInput = exports.TextInput = exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = void 0;
44
- exports.FloatingPortal = exports.FloatingFocusManager = exports.useFloatingPosition = exports.baseStyling = exports.TooltipV2 = exports.ListItem = void 0;
43
+ exports.ListItem = exports.List = exports.SwitchDouble = exports.SwitchSingle = exports.RadioButton = exports.RadioInput = exports.RadioList = exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = exports.AccordionV2 = exports.HomeCoverV2 = exports.DateRangePickerV2 = exports.MetaBlockV2 = exports.typoV2_CSS = exports.colors2 = exports.TabBarV2 = exports.ButtonUpload = exports.ButtonGhostCompact = exports.ButtonTertiaryCompact = exports.ButtonSecondaryCompact = exports.ButtonPrimaryCompact = exports.ButtonGhostV2 = exports.ButtonTertiaryV2 = exports.ButtonSecondaryV2 = exports.ButtonPrimaryV2 = exports.TagClearV2 = exports.TagLinkV2 = exports.TagDisplayV2 = exports.generateOptions = exports.genTagComp = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.HintsProvider = exports.BlockLabel = exports.ListContent = exports.CardContent = exports.URLInput = exports.PasswordInput = exports.PhoneInput = exports.NumberInput = exports.EmailInput = exports.TextInput = exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = void 0;
44
+ exports.FloatingPortal = exports.FloatingFocusManager = exports.useFloatingPosition = exports.baseStyling = exports.TooltipV2 = void 0;
45
45
  //css and styling related ( styled-components )
46
46
  var globalStyles_1 = require("./globalStyles");
47
47
  Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
@@ -165,8 +165,6 @@ Object.defineProperty(exports, "useBannerContext", { enumerable: true, get: func
165
165
  Object.defineProperty(exports, "BannerProvider", { enumerable: true, get: function () { return bannerContext_1.BannerProvider; } });
166
166
  var ModalConfirmAction_1 = require("./components/Modals/derivedComps/ModalConfirmAction");
167
167
  Object.defineProperty(exports, "ModalConfirmAction", { enumerable: true, get: function () { return ModalConfirmAction_1.ModalConfirmAction; } });
168
- var SimpleTable_1 = require("./components/SimpleTable");
169
- Object.defineProperty(exports, "SimpleTable", { enumerable: true, get: function () { return SimpleTable_1.SimpleTable; } });
170
168
  //styled-components css for use in lexical, since lexical uses classes primarily
171
169
  var styled_1 = require("./components/OKELink/styled");
172
170
  Object.defineProperty(exports, "styledOKELinkCSS", { enumerable: true, get: function () { return styled_1.styledOKELinkCSS; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.227.6",
3
+ "version": "2.227.7",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,9 +0,0 @@
1
- export function AddRowButton({ onClick }: {
2
- onClick: any;
3
- }): React.JSX.Element;
4
- export function AddColButton({ onClick, addColButtonWidth, enableRowActions }: {
5
- onClick: any;
6
- addColButtonWidth: any;
7
- enableRowActions: any;
8
- }): React.JSX.Element;
9
- import React from "react";
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || (function () {
34
- var ownKeys = function(o) {
35
- ownKeys = Object.getOwnPropertyNames || function (o) {
36
- var ar = [];
37
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
- return ar;
39
- };
40
- return ownKeys(o);
41
- };
42
- return function (mod) {
43
- if (mod && mod.__esModule) return mod;
44
- var result = {};
45
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
- __setModuleDefault(result, mod);
47
- return result;
48
- };
49
- })();
50
- var __importDefault = (this && this.__importDefault) || function (mod) {
51
- return (mod && mod.__esModule) ? mod : { "default": mod };
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.AddColButton = exports.AddRowButton = void 0;
55
- var react_1 = __importDefault(require("react"));
56
- var icons_1 = require("../../../../icons");
57
- var themes_1 = require("../../../../themes");
58
- var styled_components_1 = __importStar(require("styled-components"));
59
- var mixins_1 = require("../../../../themes/mixins");
60
- var Plus = icons_1.icons.Plus;
61
- 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);
62
- 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);
63
- var StyledColButton = styled_components_1.default.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n ", "\n"])), commonStyles);
64
- var AddRowButton = function (_a) {
65
- var onClick = _a.onClick;
66
- return (react_1.default.createElement(StyledRowButton, { onClick: onClick },
67
- react_1.default.createElement(Plus, { size: 12, weight: "bold" })));
68
- };
69
- exports.AddRowButton = AddRowButton;
70
- var AddColButton = function (_a) {
71
- var onClick = _a.onClick, addColButtonWidth = _a.addColButtonWidth, enableRowActions = _a.enableRowActions;
72
- return (react_1.default.createElement(StyledColButton, { style: __assign({ width: addColButtonWidth + 'px' }, (enableRowActions ? { marginBottom: '2rem' } : {}) //should be same as height of StyledRowButton
73
- ), onClick: onClick },
74
- react_1.default.createElement(Plus, { size: 12, weight: "bold" })));
75
- };
76
- exports.AddColButton = AddColButton;
77
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1,11 +0,0 @@
1
- export function ColActionsMenu({ value, colIdx, onChange, id, defaultColWidth, setActionsActiveOnCol, colActionsButtonHeight, conditionsToRender }: {
2
- value: any;
3
- colIdx: any;
4
- onChange: any;
5
- id: any;
6
- defaultColWidth: any;
7
- setActionsActiveOnCol: any;
8
- colActionsButtonHeight: any;
9
- conditionsToRender?: boolean;
10
- }): React.JSX.Element;
11
- import React from "react";
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || (function () {
23
- var ownKeys = function(o) {
24
- ownKeys = Object.getOwnPropertyNames || function (o) {
25
- var ar = [];
26
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
- return ar;
28
- };
29
- return ownKeys(o);
30
- };
31
- return function (mod) {
32
- if (mod && mod.__esModule) return mod;
33
- var result = {};
34
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
- __setModuleDefault(result, mod);
36
- return result;
37
- };
38
- })();
39
- var __importDefault = (this && this.__importDefault) || function (mod) {
40
- return (mod && mod.__esModule) ? mod : { "default": mod };
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.ColActionsMenu = void 0;
44
- var react_1 = __importStar(require("react"));
45
- var ActionMenu_1 = require("../../../../ActionMenu");
46
- var handleColActions_1 = require("../../../handlers/handleColActions");
47
- var UIContent_1 = require("../../../../../UIContent");
48
- var styled_1 = require("../styled");
49
- var DisplayIcon_1 = require("../../../../../utils/comps/DisplayIcon");
50
- var styled_components_1 = __importDefault(require("styled-components"));
51
- 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);
52
- var ColActionsMenu = function (_a) {
53
- var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth, setActionsActiveOnCol = _a.setActionsActiveOnCol, colActionsButtonHeight = _a.colActionsButtonHeight, _b = _a.conditionsToRender, conditionsToRender = _b === void 0 ? true : _b;
54
- var _c = (0, react_1.useState)(false), actionMenuIsOpen = _c[0], setActionMenuIsOpen = _c[1];
55
- var isFirstMount = (0, react_1.useRef)(true);
56
- (0, react_1.useEffect)(function () {
57
- if (!isFirstMount.current) {
58
- setActionsActiveOnCol(actionMenuIsOpen ? colIdx : undefined);
59
- }
60
- else {
61
- isFirstMount.current = false;
62
- }
63
- }, [actionMenuIsOpen]);
64
- // cuz if an actionmenu is open we want it to continue showing
65
- // on screen irrespective of other factors such as hover and such
66
- return (conditionsToRender || actionMenuIsOpen) && (react_1.default.createElement("div", { style: { zIndex: 2, position: 'absolute', top: 0, left: '50%', transform: 'translate(-50%, -50%)' } },
67
- react_1.default.createElement(ActionMenu_1.ActionMenu, { popOutOfOverflowHiddenParent: true, setShowActions: function (bool) { return setActionMenuIsOpen(bool); }, align: "left", CustomSelectComp: function (_a) {
68
- var active = _a.active, onClick = _a.onClick;
69
- return (react_1.default.createElement(StyledCustomSelectCompWrapper, { style: { height: colActionsButtonHeight + 'px' }, onClick: onClick, active: active },
70
- react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThree", size: 16 })));
71
- }, actions: [
72
- {
73
- display: UIContent_1.UIContent.SimpleTable.delete,
74
- onClick: function () { return (0, handleColActions_1.handleDeleteCol)({ value: value, colIdx: colIdx, onChange: onChange, id: id }); },
75
- },
76
- {
77
- display: UIContent_1.UIContent.SimpleTable.duplicate,
78
- onClick: function () { return (0, handleColActions_1.handleDuplicateCol)({ value: value, colIdx: colIdx, onChange: onChange, id: id }); },
79
- },
80
- {
81
- display: UIContent_1.UIContent.SimpleTable.insertColAfter,
82
- onClick: function () { return (0, handleColActions_1.handleInsertColAfter)({ value: value, colIdx: colIdx, onChange: onChange, id: id, defaultColWidth: defaultColWidth }); },
83
- },
84
- {
85
- display: UIContent_1.UIContent.SimpleTable.insertColBefore,
86
- onClick: function () { return (0, handleColActions_1.handleInsertColBefore)({ value: value, colIdx: colIdx, onChange: onChange, id: id, defaultColWidth: defaultColWidth }); },
87
- },
88
- {
89
- display: UIContent_1.UIContent.SimpleTable.clearContent,
90
- onClick: function () { return (0, handleColActions_1.handleClearColContent)({ value: value, colIdx: colIdx, onChange: onChange, id: id, defaultColWidth: defaultColWidth }); },
91
- }
92
- ] })));
93
- };
94
- exports.ColActionsMenu = ColActionsMenu;
95
- var templateObject_1;
@@ -1,12 +0,0 @@
1
- export function RowActionsMenu({ value, rowIdx, onChange, id, disableAddRow, setActionsActiveOnRow, rowActionsButtonWidth, conditionsToRender, blockConfig }: {
2
- value: any;
3
- rowIdx: any;
4
- onChange: any;
5
- id: any;
6
- disableAddRow: any;
7
- setActionsActiveOnRow: any;
8
- rowActionsButtonWidth: any;
9
- conditionsToRender?: boolean;
10
- blockConfig: any;
11
- }): React.JSX.Element;
12
- import React from "react";
@@ -1,120 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || (function () {
23
- var ownKeys = function(o) {
24
- ownKeys = Object.getOwnPropertyNames || function (o) {
25
- var ar = [];
26
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
- return ar;
28
- };
29
- return ownKeys(o);
30
- };
31
- return function (mod) {
32
- if (mod && mod.__esModule) return mod;
33
- var result = {};
34
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
- __setModuleDefault(result, mod);
36
- return result;
37
- };
38
- })();
39
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
40
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
41
- if (ar || !(i in from)) {
42
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
43
- ar[i] = from[i];
44
- }
45
- }
46
- return to.concat(ar || Array.prototype.slice.call(from));
47
- };
48
- var __importDefault = (this && this.__importDefault) || function (mod) {
49
- return (mod && mod.__esModule) ? mod : { "default": mod };
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- exports.RowActionsMenu = void 0;
53
- var react_1 = __importStar(require("react"));
54
- var styled_components_1 = __importDefault(require("styled-components"));
55
- var UIContent_1 = require("../../../../../UIContent");
56
- var DisplayIcon_1 = require("../../../../../utils/comps/DisplayIcon");
57
- var ActionMenu_1 = require("../../../../ActionMenu");
58
- var handleRowActions_1 = require("../../../handlers/handleRowActions");
59
- var styled_1 = require("../styled");
60
- 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);
61
- // const CustomSelectComp =
62
- var RowActionsMenu = function (_a) {
63
- var value = _a.value, rowIdx = _a.rowIdx, onChange = _a.onChange, id = _a.id, disableAddRow = _a.disableAddRow, setActionsActiveOnRow = _a.setActionsActiveOnRow, rowActionsButtonWidth = _a.rowActionsButtonWidth, _b = _a.conditionsToRender, conditionsToRender = _b === void 0 ? true : _b, blockConfig = _a.blockConfig;
64
- var _c = (0, react_1.useState)(false), actionMenuIsOpen = _c[0], setActionMenuIsOpen = _c[1];
65
- var isFirstMount = (0, react_1.useRef)(true);
66
- (0, react_1.useEffect)(function () {
67
- if (!isFirstMount.current) {
68
- setActionsActiveOnRow(actionMenuIsOpen ? rowIdx : undefined);
69
- }
70
- else {
71
- isFirstMount.current = false;
72
- }
73
- }, [actionMenuIsOpen]);
74
- // cuz if an actionmenu is open we want it to continue showing
75
- // on screen irrespective of other factors such as hover and such
76
- return (conditionsToRender || actionMenuIsOpen) && (react_1.default.createElement("div", { style: {
77
- zIndex: 2,
78
- position: "absolute",
79
- top: "50%",
80
- left: 0,
81
- transform: "translate(-50%, -50%)",
82
- } },
83
- react_1.default.createElement(ActionMenu_1.ActionMenu, { popOutOfOverflowHiddenParent: true, align: "left", setShowActions: function (showActions) {
84
- setActionMenuIsOpen(showActions);
85
- }, CustomSelectComp: function (_a) {
86
- var active = _a.active, onClick = _a.onClick;
87
- return (react_1.default.createElement(StyledCustomSelectCompWrapper, { style: { width: rowActionsButtonWidth + "px" }, onClick: onClick, active: active },
88
- react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: "DotsThreeVertical", size: 16 })));
89
- }, actions: __spreadArray(__spreadArray([], (!disableAddRow ? [
90
- {
91
- display: UIContent_1.UIContent.SimpleTable.delete,
92
- onClick: function () { return (0, handleRowActions_1.handleDeleteRow)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id }); },
93
- },
94
- {
95
- display: UIContent_1.UIContent.SimpleTable.duplicate,
96
- onClick: function () { return (0, handleRowActions_1.handleDuplicateRow)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id }); },
97
- },
98
- {
99
- display: UIContent_1.UIContent.SimpleTable.insertRowBefore,
100
- onClick: function () {
101
- return (0, handleRowActions_1.handleInsertRowBefore)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id, blockConfig: blockConfig });
102
- },
103
- },
104
- {
105
- display: UIContent_1.UIContent.SimpleTable.insertRowAfter,
106
- onClick: function () {
107
- return (0, handleRowActions_1.handleInsertRowAfter)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id, blockConfig: blockConfig });
108
- },
109
- },
110
- ] : []), true), [
111
- {
112
- display: UIContent_1.UIContent.SimpleTable.clearContent,
113
- onClick: function () {
114
- return (0, handleRowActions_1.handleClearRowContent)({ value: value, rowIdx: rowIdx, onChange: onChange, id: id, blockConfig: blockConfig });
115
- },
116
- },
117
- ], false) })));
118
- };
119
- exports.RowActionsMenu = RowActionsMenu;
120
- var templateObject_1;
@@ -1 +0,0 @@
1
- export const commonRowColActionMenuStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.commonRowColActionMenuStyles = void 0;
8
- var styled_components_1 = require("styled-components");
9
- var utilsOolib_1 = require("../../../../utilsOolib");
10
- var globalVariables_1 = require("../../../../globalStyles/globalVariables");
11
- var mixins_1 = require("../../../../themes/mixins");
12
- var themes_1 = require("../../../../themes");
13
- exports.commonRowColActionMenuStyles = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n ", ";\n border-radius: 4px;\n ", "\n cursor: pointer;\n ", "\n"], ["\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n ", ";\n border-radius: 4px;\n ", "\n cursor: pointer;\n ", "\n"])), (0, mixins_1.transition)("background-color", "border-color"), function (_a) {
14
- var active = _a.active, theme = _a.theme;
15
- return active
16
- ? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n "], ["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n "])), (0, utilsOolib_1.getPrimaryColor40)(theme === null || theme === void 0 ? void 0 : theme.colors), (0, utilsOolib_1.getPrimaryColor100)(theme === null || theme === void 0 ? void 0 : theme.colors)) : (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n ", ";\n "], ["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n ", ";\n "])), themes_1.colors.white, themes_1.colors.greyColor15, globalVariables_1.globalHoverOnWhiteBG);
17
- }, mixins_1.boxShadow1);
18
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1,38 +0,0 @@
1
- export function handleAddCol({ value, onChange, id, defaultColWidth }: {
2
- value: any;
3
- onChange: any;
4
- id: any;
5
- defaultColWidth: any;
6
- }): void;
7
- export function handleDeleteCol({ value, colIdx, onChange, id }: {
8
- value: any;
9
- colIdx: any;
10
- onChange: any;
11
- id: any;
12
- }): void;
13
- export function handleDuplicateCol({ value, colIdx, onChange, id }: {
14
- value: any;
15
- colIdx: any;
16
- onChange: any;
17
- id: any;
18
- }): void;
19
- export function handleInsertColAfter({ value, colIdx, onChange, id, defaultColWidth }: {
20
- value: any;
21
- colIdx: any;
22
- onChange: any;
23
- id: any;
24
- defaultColWidth: any;
25
- }): void;
26
- export function handleInsertColBefore({ value, colIdx, onChange, id, defaultColWidth }: {
27
- value: any;
28
- colIdx: any;
29
- onChange: any;
30
- id: any;
31
- defaultColWidth: any;
32
- }): void;
33
- export function handleClearColContent({ value, colIdx, onChange, id }: {
34
- value: any;
35
- colIdx: any;
36
- onChange: any;
37
- id: any;
38
- }): void;
@@ -1,155 +0,0 @@
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
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
- if (ar || !(i in from)) {
16
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
- ar[i] = from[i];
18
- }
19
- }
20
- return to.concat(ar || Array.prototype.slice.call(from));
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.handleClearColContent = exports.handleInsertColBefore = exports.handleInsertColAfter = exports.handleDuplicateCol = exports.handleDeleteCol = exports.handleAddCol = void 0;
24
- var genHash_1 = require("../utils/genHash");
25
- var genNewCell = function () { return ({
26
- id: "cell_".concat((0, genHash_1.genHash)(8)),
27
- }); };
28
- var handleAddColAtIdx = function (_a) {
29
- var value = _a.value, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth, colIdx = _a.colIdx;
30
- var data = value.data, colWidthConfig = value.colWidthConfig;
31
- var newData = __spreadArray([], data, true);
32
- newData = newData.map(function (row) {
33
- var newCellData = __spreadArray([], row.cellData, true);
34
- newCellData.splice(colIdx, 0, genNewCell());
35
- return __assign(__assign({}, row), { cellData: newCellData });
36
- });
37
- var newColWidthValue = defaultColWidth + "px";
38
- var newColWidthConfigAsArray = Object.values(colWidthConfig);
39
- newColWidthConfigAsArray.splice(colIdx, 0, newColWidthValue);
40
- var newColWidthConfig = newColWidthConfigAsArray
41
- .map(function (width, i) { return ({
42
- colId: "col_".concat(i),
43
- width: width,
44
- }); })
45
- .reduce(function (a, b) {
46
- var _a;
47
- return (__assign(__assign({}, a), (_a = {}, _a[b.colId] = b.width, _a)));
48
- }, {});
49
- onChange &&
50
- onChange(id, { data: newData, colWidthConfig: newColWidthConfig });
51
- };
52
- var handleAddCol = function (_a) {
53
- var value = _a.value, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth;
54
- handleAddColAtIdx({
55
- value: value,
56
- onChange: onChange,
57
- id: id,
58
- defaultColWidth: defaultColWidth,
59
- colIdx: value.data[0].cellData.length,
60
- });
61
- };
62
- exports.handleAddCol = handleAddCol;
63
- var handleDeleteCol = function (_a) {
64
- var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id;
65
- var data = value.data, colWidthConfig = value.colWidthConfig;
66
- var newData = data.map(function (row) {
67
- var newCellData = row.cellData.filter(function (cell, cellIdx) { return colIdx !== cellIdx; });
68
- return __assign(__assign({}, row), { cellData: newCellData });
69
- });
70
- var newColWidthConfig = __assign({}, colWidthConfig);
71
- delete newColWidthConfig["col_".concat(colIdx)];
72
- // now that we deleted this colIdx from widthconfig. we need to reset all the keys from col_0 to col_<length-1>
73
- newColWidthConfig = Object.values(newColWidthConfig)
74
- .map(function (width, i) { return ({
75
- colId: "col_".concat(i),
76
- width: width,
77
- }); })
78
- .reduce(function (a, b) {
79
- var _a;
80
- return (__assign(__assign({}, a), (_a = {}, _a[b.colId] = b.width, _a)));
81
- }, {});
82
- onChange &&
83
- onChange(id, { data: newData, colWidthConfig: newColWidthConfig });
84
- };
85
- exports.handleDeleteCol = handleDeleteCol;
86
- var handleDuplicateCol = function (_a) {
87
- var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id;
88
- var data = value.data, colWidthConfig = value.colWidthConfig;
89
- var newData = data.map(function (row) {
90
- var newCellData = __spreadArray([], row.cellData, true);
91
- var dataToDuplicate = __assign(__assign({}, newCellData[colIdx]), { id: "cell_".concat((0, genHash_1.genHash)(8)) });
92
- newCellData.splice(colIdx + 1, 0, dataToDuplicate);
93
- return __assign(__assign({}, row), { cellData: newCellData });
94
- });
95
- var newColWidthValue = colWidthConfig["col_".concat(colIdx)];
96
- var newColWidthConfigAsArray = Object.values(colWidthConfig);
97
- newColWidthConfigAsArray.splice(colIdx + 1, 0, newColWidthValue);
98
- var newColWidthConfig = newColWidthConfigAsArray
99
- .map(function (width, i) { return ({
100
- colId: "col_".concat(i),
101
- width: width,
102
- }); })
103
- .reduce(function (a, b) {
104
- var _a;
105
- return (__assign(__assign({}, a), (_a = {}, _a[b.colId] = b.width, _a)));
106
- }, {});
107
- onChange &&
108
- onChange(id, { data: newData, colWidthConfig: newColWidthConfig });
109
- };
110
- exports.handleDuplicateCol = handleDuplicateCol;
111
- var handleInsertColAfter = function (_a) {
112
- var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth;
113
- handleAddColAtIdx({
114
- value: value,
115
- onChange: onChange,
116
- id: id,
117
- defaultColWidth: defaultColWidth,
118
- colIdx: colIdx + 1,
119
- });
120
- };
121
- exports.handleInsertColAfter = handleInsertColAfter;
122
- var handleInsertColBefore = function (_a) {
123
- var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id, defaultColWidth = _a.defaultColWidth;
124
- handleAddColAtIdx({
125
- value: value,
126
- onChange: onChange,
127
- id: id,
128
- defaultColWidth: defaultColWidth,
129
- colIdx: colIdx,
130
- });
131
- };
132
- exports.handleInsertColBefore = handleInsertColBefore;
133
- var handleClearColContent = function (_a) {
134
- var value = _a.value, colIdx = _a.colIdx, onChange = _a.onChange, id = _a.id;
135
- var data = value.data, colWidthConfig = value.colWidthConfig;
136
- var newData = data.map(function (row) {
137
- var newCellData = __spreadArray([], row.cellData, true);
138
- // let cellToClear = newCellData[colIdx];
139
- // delete cellToClear.value;
140
- // console.log({cellToClear})
141
- /**
142
- * this genNewRow does one very important thing apart from the obvious of clearing the value:
143
- * it creates a fresh new row id, which changes the 'react key' of the row being rendered, which
144
- * ensures the the RTE used within the cell is reinitiated and the previous value in it is cleared.
145
- * (since RTEs are not controlled components)
146
- */
147
- newCellData.splice(colIdx, 1, genNewCell());
148
- // console.log({newCellData})
149
- return __assign(__assign({}, row), { cellData: newCellData });
150
- });
151
- // console.log({newData})
152
- onChange &&
153
- onChange(id, { data: newData, colWidthConfig: colWidthConfig });
154
- };
155
- exports.handleClearColContent = handleClearColContent;