oolib 2.108.3 → 2.109.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.
- package/dist/components/Breadcrumbs/index.d.ts +17 -4
- package/dist/components/Breadcrumbs/index.js +27 -15
- package/dist/components/Breadcrumbs/index.styled.d.ts +3 -2
- package/dist/components/Container/index.d.ts +15 -9
- package/dist/components/Container/index.js +10 -0
- package/dist/components/Container/index.styled.d.ts +2 -2
- package/dist/components/Dropdowns/comps/OptionsSingle/index.js +13 -16
- package/dist/components/EmptyStates/comps/styled.d.ts +1 -6
- package/dist/components/Lexical/Plugins/TableCellResizer/index.d.ts +2 -0
- package/dist/components/Lexical/Plugins/TableCellResizer/index.js +286 -0
- package/dist/components/Lexical/Plugins/TableCellResizer/index.styled.d.ts +9 -0
- package/dist/components/Lexical/Plugins/TableCellResizer/index.styled.js +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/themes/mixins/index.d.ts +9 -8
- package/dist/themes/mixins/index.js +1 -1
- package/dist/utils/customHooks/useContainerQuery.d.ts +8 -4
- package/package.json +5 -2
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
export function Breadcrumbs({ links, invert }: {
|
|
2
|
-
links: any;
|
|
3
|
-
invert: any;
|
|
4
|
-
}): React.JSX.Element;
|
|
5
1
|
import React from "react";
|
|
2
|
+
interface BreadcrumbLink {
|
|
3
|
+
to: string;
|
|
4
|
+
display: string;
|
|
5
|
+
}
|
|
6
|
+
interface BreadcrumbsProps {
|
|
7
|
+
links?: BreadcrumbLink[];
|
|
8
|
+
invert?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Renders a Breadcrumbs component based on the provided links and invert flag.
|
|
12
|
+
*
|
|
13
|
+
* @param {BreadcrumbsProps} links - The array of links to be displayed in the breadcrumbs
|
|
14
|
+
* @param {boolean} invert - Flag to indicate whether to invert the colors of the breadcrumbs
|
|
15
|
+
* @return {React.ReactElement} The rendered Breadcrumbs component
|
|
16
|
+
*/
|
|
17
|
+
export declare const Breadcrumbs: React.FunctionComponent<BreadcrumbsProps>;
|
|
18
|
+
export {};
|
|
@@ -32,37 +32,49 @@ var themes_1 = require("../../themes");
|
|
|
32
32
|
var mixins_1 = require("../../themes/mixins");
|
|
33
33
|
var ArrowLeft = icons_1.icons.ArrowLeft;
|
|
34
34
|
var white = themes_1.colors.white, greyColor100 = themes_1.colors.greyColor100, greyColor50 = themes_1.colors.greyColor50;
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Renders a Breadcrumbs component based on the provided links and invert flag.
|
|
37
|
+
*
|
|
38
|
+
* @param {BreadcrumbsProps} links - The array of links to be displayed in the breadcrumbs
|
|
39
|
+
* @param {boolean} invert - Flag to indicate whether to invert the colors of the breadcrumbs
|
|
40
|
+
* @return {React.ReactElement} The rendered Breadcrumbs component
|
|
41
|
+
*/
|
|
36
42
|
var Breadcrumbs = function (_a) {
|
|
37
43
|
var links = _a.links, invert = _a.invert;
|
|
38
44
|
var _b = (0, react_1.useState)(0), containerWidth = _b[0], setContainerWidth = _b[1];
|
|
39
45
|
var _c = (0, react_1.useState)(false), beConcise = _c[0], setBeConcise = _c[1];
|
|
40
46
|
var measuredContainer = (0, react_1.useRef)(null);
|
|
41
47
|
(0, react_1.useEffect)(function () {
|
|
42
|
-
measuredContainer && setContainerWidth(measuredContainer.current.offsetWidth);
|
|
48
|
+
measuredContainer.current && setContainerWidth(measuredContainer.current.offsetWidth);
|
|
43
49
|
}, []);
|
|
44
50
|
(0, react_1.useLayoutEffect)(function () {
|
|
51
|
+
var _a;
|
|
45
52
|
if (containerWidth === 0)
|
|
46
53
|
return; // when the measuredRef isn't updated yet
|
|
47
|
-
var children = measuredContainer.current.children;
|
|
54
|
+
var children = (_a = measuredContainer.current) === null || _a === void 0 ? void 0 : _a.children;
|
|
48
55
|
var isOverflowing = children[children.length - 1].getBoundingClientRect().right > containerWidth * 0.95; // if exceeds 95% of the parent
|
|
49
56
|
if (isOverflowing)
|
|
50
57
|
setBeConcise(true);
|
|
51
58
|
}, [containerWidth]);
|
|
52
|
-
if (containerWidth > (0, mixins_1.getBreakPoint)('md')) {
|
|
59
|
+
if (containerWidth > (0, mixins_1.getBreakPoint)('md')) {
|
|
60
|
+
// for large devices (not default since containerWidth is initialized to 0)
|
|
53
61
|
var linksDisplayed_1 = beConcise && links.length > 3 ? [links[0], { to: "", display: "..." }, links[links.length - 2], links[links.length - 1]] : links;
|
|
54
62
|
return (react_1.default.createElement(index_styled_1.StyledBreadcrumbs, { ref: measuredContainer }, linksDisplayed_1.map(function (link, ind) {
|
|
55
|
-
return (react_1.default.createElement(index_styled_1.StyledLinkCrumb, { to: link.to, invert: invert, key: ind, style: ind
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
return (react_1.default.createElement(index_styled_1.StyledLinkCrumb, { to: link.to, invert: invert, key: ind, style: ind === linksDisplayed_1.length - 1
|
|
64
|
+
? {
|
|
65
|
+
pointerEvents: 'none',
|
|
66
|
+
color: greyColor50,
|
|
67
|
+
width: !beConcise
|
|
68
|
+
? 'auto'
|
|
69
|
+
: (function () {
|
|
70
|
+
var _a;
|
|
71
|
+
var children = (_a = measuredContainer.current) === null || _a === void 0 ? void 0 : _a.children;
|
|
72
|
+
var childrenCount = children.length;
|
|
73
|
+
var correctionFactor = 88;
|
|
74
|
+
return containerWidth - (children[0].scrollWidth + correctionFactor + (childrenCount > 2 && children[childrenCount - 2].scrollWidth)) + 'px';
|
|
75
|
+
})(),
|
|
76
|
+
}
|
|
77
|
+
: {} },
|
|
66
78
|
react_1.default.createElement(Typo_1.SANS_2, { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' } }, link.display)));
|
|
67
79
|
})));
|
|
68
80
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const StyledBreadcrumbs: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
declare const StyledLinkCrumb: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
3
|
+
export { StyledBreadcrumbs, StyledLinkCrumb };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode } from "react";
|
|
2
|
-
export
|
|
3
|
-
children
|
|
2
|
+
export interface ContainerProps {
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
className?: string;
|
|
5
5
|
style?: CSSProperties;
|
|
6
6
|
enableContainerQuery?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare const Comp: ({ children, className, style, enableContainerQuery }: ContainerProps, ref: React.RefObject<HTMLDivElement> | null) => React.JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Renders a container component with optional container query feature.
|
|
11
|
+
*
|
|
12
|
+
* @param {ContainerProps} children - The child elements to be rendered within the container.
|
|
13
|
+
* @param {string} className - The CSS class for styling the container.
|
|
14
|
+
* @param {Object} style - The inline styles for the container.
|
|
15
|
+
* @param {boolean} enableContainerQuery - Flag to enable or disable the container query feature.
|
|
16
|
+
* @param {React.RefObject<HTMLDivElement> | null} ref - Reference object to the container element.
|
|
17
|
+
* @return {React.ReactElement} The rendered container component.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Container: React.ForwardRefExoticComponent<ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -36,4 +36,14 @@ var Comp = function (_a, ref //if a ref is passed from outside, it will override
|
|
|
36
36
|
return (react_1.default.createElement(index_styled_1.StyledContainer, { ref: ref || selfRef, className: className || "", style: style, containerQuery: containerQuery }, children));
|
|
37
37
|
};
|
|
38
38
|
exports.Comp = Comp;
|
|
39
|
+
/**
|
|
40
|
+
* Renders a container component with optional container query feature.
|
|
41
|
+
*
|
|
42
|
+
* @param {ContainerProps} children - The child elements to be rendered within the container.
|
|
43
|
+
* @param {string} className - The CSS class for styling the container.
|
|
44
|
+
* @param {Object} style - The inline styles for the container.
|
|
45
|
+
* @param {boolean} enableContainerQuery - Flag to enable or disable the container query feature.
|
|
46
|
+
* @param {React.RefObject<HTMLDivElement> | null} ref - Reference object to the container element.
|
|
47
|
+
* @return {React.ReactElement} The rendered container component.
|
|
48
|
+
*/
|
|
39
49
|
exports.Container = (0, react_1.forwardRef)(exports.Comp);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useContainerQueryReturn } from "../../utils/customHooks/useContainerQuery";
|
|
2
2
|
interface StyledContainerProps {
|
|
3
|
-
containerQuery?:
|
|
3
|
+
containerQuery?: useContainerQueryReturn['containerQuery'];
|
|
4
4
|
}
|
|
5
5
|
export declare const StyledContainer: import("styled-components").StyledComponent<"div", any, StyledContainerProps, never>;
|
|
6
6
|
export {};
|
|
@@ -107,22 +107,19 @@ var OptionsSingle = function (_a) {
|
|
|
107
107
|
S: S,
|
|
108
108
|
}),
|
|
109
109
|
isSearchable && genSearchBar(),
|
|
110
|
-
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (react_1.default.createElement(VirtualizedWrapper_1.VirtualizedWrapper, { options: options, lightboxHeight: lightboxHeight, searchString: searchString }, function (option, index, style) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
observerRef: options.length === index + 1 ? observerRef : null,
|
|
124
|
-
})))));
|
|
125
|
-
})),
|
|
110
|
+
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (react_1.default.createElement(VirtualizedWrapper_1.VirtualizedWrapper, { options: options, lightboxHeight: lightboxHeight, searchString: searchString }, function (option, index, style) { return (react_1.default.createElement(styled_1.StyledOption, { key: option.value, invert: invert, isSelected: !option.loading && (value === null || value === void 0 ? void 0 : value.value) === option.value, isFocussed: focussedOp === index, className: "OKE-Dropdown__option", ref: function (el) {
|
|
111
|
+
return focussedOp === index && el && scrollFocussedOpIntoView(el);
|
|
112
|
+
}, onClick: function (e) {
|
|
113
|
+
if (!option.loading)
|
|
114
|
+
handleSelect(option);
|
|
115
|
+
setSearchString && setSearchString("");
|
|
116
|
+
}, S: S, style: style && style }, option.loading ? (react_1.default.createElement(TextLoader_1.TextLoader, { style: { width: "8rem", height: "1.5rem" } })) : (react_1.default.createElement(OptionContent_1.OptionContent, __assign({}, {
|
|
117
|
+
option: option,
|
|
118
|
+
optionsClassName: optionsClassName,
|
|
119
|
+
invert: invert,
|
|
120
|
+
S: S,
|
|
121
|
+
observerRef: options.length === index + 1 ? observerRef : null,
|
|
122
|
+
}))))); })),
|
|
126
123
|
genCreateTagButton && genCreateTagButton(options))));
|
|
127
124
|
};
|
|
128
125
|
exports.OptionsSingle = OptionsSingle;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export const StyledSERIF_4_5: import("styled-components").StyledComponent<(props: any) => import("react").JSX.Element, any, {}, never>;
|
|
2
2
|
export const StyledFlexWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<{
|
|
4
|
-
children?: import("react").ReactNode;
|
|
5
|
-
className?: string;
|
|
6
|
-
style?: import("react").CSSProperties;
|
|
7
|
-
enableContainerQuery?: boolean;
|
|
8
|
-
} & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
3
|
+
export const StyledContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../Container").ContainerProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
var LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
30
|
+
var useLexicalEditable_1 = __importDefault(require("@lexical/react/useLexicalEditable"));
|
|
31
|
+
var table_1 = require("@lexical/table");
|
|
32
|
+
var lexical_1 = require("lexical");
|
|
33
|
+
var React = __importStar(require("react"));
|
|
34
|
+
var react_1 = require("react");
|
|
35
|
+
var react_dom_1 = require("react-dom");
|
|
36
|
+
var index_styled_1 = require("./index.styled");
|
|
37
|
+
var MIN_ROW_HEIGHT = 33;
|
|
38
|
+
var MIN_COLUMN_WIDTH = 50;
|
|
39
|
+
function TableCellResizer(_a) {
|
|
40
|
+
var editor = _a.editor;
|
|
41
|
+
var targetRef = (0, react_1.useRef)(null);
|
|
42
|
+
var resizerRef = (0, react_1.useRef)(null);
|
|
43
|
+
var tableRectRef = (0, react_1.useRef)(null);
|
|
44
|
+
var mouseStartPosRef = (0, react_1.useRef)(null);
|
|
45
|
+
var _b = (0, react_1.useState)(null), mouseCurrentPos = _b[0], updateMouseCurrentPos = _b[1];
|
|
46
|
+
var _c = (0, react_1.useState)(null), activeCell = _c[0], updateActiveCell = _c[1];
|
|
47
|
+
var _d = (0, react_1.useState)(false), isSelectingGrid = _d[0], updateIsSelectingGrid = _d[1];
|
|
48
|
+
var _e = (0, react_1.useState)(null), draggingDirection = _e[0], updateDraggingDirection = _e[1];
|
|
49
|
+
(0, react_1.useEffect)(function () {
|
|
50
|
+
return editor.registerCommand(lexical_1.SELECTION_CHANGE_COMMAND, function (payload) {
|
|
51
|
+
var selection = (0, lexical_1.$getSelection)();
|
|
52
|
+
var isTableSelection = (0, table_1.$isTableSelection)(selection);
|
|
53
|
+
if (isSelectingGrid !== isTableSelection) {
|
|
54
|
+
updateIsSelectingGrid(isTableSelection);
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}, lexical_1.COMMAND_PRIORITY_HIGH);
|
|
58
|
+
});
|
|
59
|
+
var resetState = (0, react_1.useCallback)(function () {
|
|
60
|
+
updateActiveCell(null);
|
|
61
|
+
targetRef.current = null;
|
|
62
|
+
updateDraggingDirection(null);
|
|
63
|
+
mouseStartPosRef.current = null;
|
|
64
|
+
tableRectRef.current = null;
|
|
65
|
+
}, []);
|
|
66
|
+
(0, react_1.useEffect)(function () {
|
|
67
|
+
var onMouseMove = function (event) {
|
|
68
|
+
setTimeout(function () {
|
|
69
|
+
var target = event.target;
|
|
70
|
+
if (draggingDirection) {
|
|
71
|
+
updateMouseCurrentPos({
|
|
72
|
+
x: event.clientX,
|
|
73
|
+
y: event.clientY,
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (resizerRef.current && resizerRef.current.contains(target)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (targetRef.current !== target) {
|
|
81
|
+
targetRef.current = target;
|
|
82
|
+
var cell_1 = (0, table_1.getDOMCellFromTarget)(target);
|
|
83
|
+
if (cell_1 && activeCell !== cell_1) {
|
|
84
|
+
editor.update(function () {
|
|
85
|
+
var tableCellNode = (0, lexical_1.$getNearestNodeFromDOMNode)(cell_1.elem);
|
|
86
|
+
if (!tableCellNode) {
|
|
87
|
+
throw new Error('TableCellResizer: Table cell node not found.');
|
|
88
|
+
}
|
|
89
|
+
var tableNode = (0, table_1.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
90
|
+
var tableElement = editor.getElementByKey(tableNode.getKey());
|
|
91
|
+
if (!tableElement) {
|
|
92
|
+
throw new Error('TableCellResizer: Table element not found.');
|
|
93
|
+
}
|
|
94
|
+
targetRef.current = target;
|
|
95
|
+
tableRectRef.current = tableElement.getBoundingClientRect();
|
|
96
|
+
updateActiveCell(cell_1);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else if (cell_1 == null) {
|
|
100
|
+
resetState();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, 0);
|
|
104
|
+
};
|
|
105
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
106
|
+
return function () {
|
|
107
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
108
|
+
};
|
|
109
|
+
}, [activeCell, draggingDirection, editor, resetState]);
|
|
110
|
+
var isHeightChanging = function (direction) {
|
|
111
|
+
if (direction === 'bottom') {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
};
|
|
116
|
+
var updateRowHeight = (0, react_1.useCallback)(function (newHeight) {
|
|
117
|
+
if (!activeCell) {
|
|
118
|
+
throw new Error('TableCellResizer: Expected active cell.');
|
|
119
|
+
}
|
|
120
|
+
editor.update(function () {
|
|
121
|
+
var tableCellNode = (0, lexical_1.$getNearestNodeFromDOMNode)(activeCell.elem);
|
|
122
|
+
if (!(0, table_1.$isTableCellNode)(tableCellNode)) {
|
|
123
|
+
throw new Error('TableCellResizer: Table cell node not found.');
|
|
124
|
+
}
|
|
125
|
+
var tableNode = (0, table_1.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
126
|
+
var tableRowIndex = (0, table_1.$getTableRowIndexFromTableCellNode)(tableCellNode);
|
|
127
|
+
var tableRows = tableNode.getChildren();
|
|
128
|
+
if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
|
|
129
|
+
throw new Error('Expected table cell to be inside of table row.');
|
|
130
|
+
}
|
|
131
|
+
var tableRow = tableRows[tableRowIndex];
|
|
132
|
+
if (!(0, table_1.$isTableRowNode)(tableRow)) {
|
|
133
|
+
throw new Error('Expected table row');
|
|
134
|
+
}
|
|
135
|
+
tableRow.setHeight(newHeight);
|
|
136
|
+
});
|
|
137
|
+
}, [activeCell, editor]);
|
|
138
|
+
var updateColumnWidth = (0, react_1.useCallback)(function (newWidth) {
|
|
139
|
+
if (!activeCell) {
|
|
140
|
+
throw new Error('TableCellResizer: Expected active cell.');
|
|
141
|
+
}
|
|
142
|
+
editor.update(function () {
|
|
143
|
+
var tableCellNode = (0, lexical_1.$getNearestNodeFromDOMNode)(activeCell.elem);
|
|
144
|
+
if (!(0, table_1.$isTableCellNode)(tableCellNode)) {
|
|
145
|
+
throw new Error('TableCellResizer: Table cell node not found.');
|
|
146
|
+
}
|
|
147
|
+
var tableNode = (0, table_1.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
148
|
+
var tableColumnIndex = (0, table_1.$getTableColumnIndexFromTableCellNode)(tableCellNode);
|
|
149
|
+
var tableRows = tableNode.getChildren();
|
|
150
|
+
for (var r = 0; r < tableRows.length; r++) {
|
|
151
|
+
var tableRow = tableRows[r];
|
|
152
|
+
if (!(0, table_1.$isTableRowNode)(tableRow)) {
|
|
153
|
+
throw new Error('Expected table row');
|
|
154
|
+
}
|
|
155
|
+
var rowCells = tableRow.getChildren();
|
|
156
|
+
var rowCellsSpan = rowCells.map(function (cell) { return cell.getColSpan(); });
|
|
157
|
+
var aggregatedRowSpans = rowCellsSpan.reduce(function (rowSpans, cellSpan) {
|
|
158
|
+
var _a;
|
|
159
|
+
var previousCell = (_a = rowSpans[rowSpans.length - 1]) !== null && _a !== void 0 ? _a : 0;
|
|
160
|
+
rowSpans.push(previousCell + cellSpan);
|
|
161
|
+
return rowSpans;
|
|
162
|
+
}, []);
|
|
163
|
+
var rowColumnIndexWithSpan = aggregatedRowSpans.findIndex(function (cellSpan) { return cellSpan > tableColumnIndex; });
|
|
164
|
+
if (rowColumnIndexWithSpan >= rowCells.length ||
|
|
165
|
+
rowColumnIndexWithSpan < 0) {
|
|
166
|
+
throw new Error('Expected table cell to be inside of table row.');
|
|
167
|
+
}
|
|
168
|
+
var tableCell = rowCells[rowColumnIndexWithSpan];
|
|
169
|
+
if (!(0, table_1.$isTableCellNode)(tableCell)) {
|
|
170
|
+
throw new Error('Expected table cell');
|
|
171
|
+
}
|
|
172
|
+
tableCell.setWidth(newWidth);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}, [activeCell, editor]);
|
|
176
|
+
var mouseUpHandler = (0, react_1.useCallback)(function (direction) {
|
|
177
|
+
var handler = function (event) {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
event.stopPropagation();
|
|
180
|
+
if (!activeCell) {
|
|
181
|
+
throw new Error('TableCellResizer: Expected active cell.');
|
|
182
|
+
}
|
|
183
|
+
if (mouseStartPosRef.current) {
|
|
184
|
+
var _a = mouseStartPosRef.current, x = _a.x, y = _a.y;
|
|
185
|
+
if (activeCell === null) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (isHeightChanging(direction)) {
|
|
189
|
+
var height = activeCell.elem.getBoundingClientRect().height;
|
|
190
|
+
var heightChange = Math.abs(event.clientY - y);
|
|
191
|
+
var isShrinking = direction === 'bottom' && y > event.clientY;
|
|
192
|
+
updateRowHeight(Math.max(isShrinking ? height - heightChange : heightChange + height, MIN_ROW_HEIGHT));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
var computedStyle = getComputedStyle(activeCell.elem);
|
|
196
|
+
var width = activeCell.elem.clientWidth; // width with padding
|
|
197
|
+
width -=
|
|
198
|
+
parseFloat(computedStyle.paddingLeft) +
|
|
199
|
+
parseFloat(computedStyle.paddingRight);
|
|
200
|
+
var widthChange = Math.abs(event.clientX - x);
|
|
201
|
+
var isShrinking = direction === 'right' && x > event.clientX;
|
|
202
|
+
updateColumnWidth(Math.max(isShrinking ? width - widthChange : widthChange + width, MIN_COLUMN_WIDTH));
|
|
203
|
+
}
|
|
204
|
+
resetState();
|
|
205
|
+
document.removeEventListener('mouseup', handler);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
return handler;
|
|
209
|
+
}, [activeCell, resetState, updateColumnWidth, updateRowHeight]);
|
|
210
|
+
var toggleResize = (0, react_1.useCallback)(function (direction) {
|
|
211
|
+
return function (event) {
|
|
212
|
+
event.preventDefault();
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
if (!activeCell) {
|
|
215
|
+
throw new Error('TableCellResizer: Expected active cell.');
|
|
216
|
+
}
|
|
217
|
+
mouseStartPosRef.current = {
|
|
218
|
+
x: event.clientX,
|
|
219
|
+
y: event.clientY,
|
|
220
|
+
};
|
|
221
|
+
updateMouseCurrentPos(mouseStartPosRef.current);
|
|
222
|
+
updateDraggingDirection(direction);
|
|
223
|
+
document.addEventListener('mouseup', mouseUpHandler(direction));
|
|
224
|
+
};
|
|
225
|
+
}, [activeCell, mouseUpHandler]);
|
|
226
|
+
var getResizers = (0, react_1.useCallback)(function () {
|
|
227
|
+
if (activeCell) {
|
|
228
|
+
var _a = activeCell.elem.getBoundingClientRect(), height = _a.height, width = _a.width, top_1 = _a.top, left = _a.left;
|
|
229
|
+
var styles = {
|
|
230
|
+
bottom: {
|
|
231
|
+
backgroundColor: 'none',
|
|
232
|
+
cursor: 'row-resize',
|
|
233
|
+
height: '10px',
|
|
234
|
+
left: "".concat(window.pageXOffset + left, "px"),
|
|
235
|
+
top: "".concat(window.pageYOffset + top_1 + height, "px"),
|
|
236
|
+
width: "".concat(width, "px"),
|
|
237
|
+
},
|
|
238
|
+
right: {
|
|
239
|
+
backgroundColor: 'none',
|
|
240
|
+
cursor: 'col-resize',
|
|
241
|
+
height: "".concat(height, "px"),
|
|
242
|
+
left: "".concat(window.pageXOffset + left + width, "px"),
|
|
243
|
+
top: "".concat(window.pageYOffset + top_1, "px"),
|
|
244
|
+
width: '10px',
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
var tableRect = tableRectRef.current;
|
|
248
|
+
if (draggingDirection && mouseCurrentPos && tableRect) {
|
|
249
|
+
if (isHeightChanging(draggingDirection)) {
|
|
250
|
+
styles[draggingDirection].left = "".concat(window.pageXOffset + tableRect.left, "px");
|
|
251
|
+
styles[draggingDirection].top = "".concat(window.pageYOffset + mouseCurrentPos.y, "px");
|
|
252
|
+
styles[draggingDirection].height = '3px';
|
|
253
|
+
styles[draggingDirection].width = "".concat(tableRect.width, "px");
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
styles[draggingDirection].top = "".concat(window.pageYOffset + tableRect.top, "px");
|
|
257
|
+
styles[draggingDirection].left = "".concat(window.pageXOffset + mouseCurrentPos.x, "px");
|
|
258
|
+
styles[draggingDirection].width = '3px';
|
|
259
|
+
styles[draggingDirection].height = "".concat(tableRect.height, "px");
|
|
260
|
+
}
|
|
261
|
+
styles[draggingDirection].backgroundColor = '#adf';
|
|
262
|
+
}
|
|
263
|
+
return styles;
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
bottom: null,
|
|
267
|
+
left: null,
|
|
268
|
+
right: null,
|
|
269
|
+
top: null,
|
|
270
|
+
};
|
|
271
|
+
}, [activeCell, draggingDirection, mouseCurrentPos]);
|
|
272
|
+
var resizerStyles = getResizers();
|
|
273
|
+
return (React.createElement("div", { ref: resizerRef }, activeCell != null && !isSelectingGrid && (React.createElement(React.Fragment, null,
|
|
274
|
+
React.createElement(index_styled_1.StyledTableCellResizer, { className: "TableCellResizer__resizer TableCellResizer__ui", style: resizerStyles.right || undefined, onMouseDown: toggleResize('right') }),
|
|
275
|
+
React.createElement(index_styled_1.StyledTableCellResizer, { className: "TableCellResizer__resizer TableCellResizer__ui", style: resizerStyles.bottom || undefined, onMouseDown: toggleResize('bottom') })))));
|
|
276
|
+
}
|
|
277
|
+
function TableCellResizerPlugin() {
|
|
278
|
+
var editor = (0, LexicalComposerContext_1.useLexicalComposerContext)()[0];
|
|
279
|
+
var isEditable = (0, useLexicalEditable_1.default)();
|
|
280
|
+
return (0, react_1.useMemo)(function () {
|
|
281
|
+
return isEditable
|
|
282
|
+
? (0, react_dom_1.createPortal)(React.createElement(TableCellResizer, { editor: editor }), document.body)
|
|
283
|
+
: null;
|
|
284
|
+
}, [editor, isEditable]);
|
|
285
|
+
}
|
|
286
|
+
exports.default = TableCellResizerPlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare const StyledTableCellResizer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
11
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
12
|
+
return cooked;
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.StyledTableCellResizer = void 0;
|
|
19
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
+
exports.StyledTableCellResizer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n\n"], ["\n position: absolute;\n\n"])));
|
|
21
|
+
var templateObject_1;
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export { ResourceInput } from "./components/ResourceInput";
|
|
|
65
65
|
export { ModalConfirmAction } from "./components/Modals/derivedComps/ModalConfirmAction";
|
|
66
66
|
export { SimpleTable } from "./components/SimpleTable";
|
|
67
67
|
export { styledOKELinkCSS } from "./components/OKELink/styled";
|
|
68
|
+
export { default as TableCellResizerPlugin } from "./components/Lexical/Plugins/TableCellResizer";
|
|
68
69
|
export { LoaderCircle, ProgressBar, LoaderCircle as Loader, LoaderOverlay } from "./components/LoadersAndProgress";
|
|
69
70
|
export { BannerAlert, BannerInfo } from "./components/Banners";
|
|
70
71
|
export { BannerContext, useBannerContext, BannerProvider } from "./components/Banners/bannerContext";
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.IFrameInput = exports.PDFInput = exports.AudioInput = exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.HintsProvider = exports.genTagComp = exports.generateOptions = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.ListContent = exports.CardContent = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.BarChart = 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.LoaderOverlay = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.icons = exports.colors = exports.GlobalStyles = void 0;
|
|
21
|
-
exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = exports.BannerAlert = exports.ResourceInput = void 0;
|
|
21
|
+
exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = exports.BannerAlert = exports.ResourceInput = void 0;
|
|
22
22
|
//css and styling related ( styled-components )
|
|
23
23
|
var globalStyles_1 = require("./globalStyles");
|
|
24
24
|
Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
|
|
@@ -166,3 +166,6 @@ Object.defineProperty(exports, "SimpleTable", { enumerable: true, get: function
|
|
|
166
166
|
//styled-components css for use in lexical, since lexical uses classes primarily
|
|
167
167
|
var styled_1 = require("./components/OKELink/styled");
|
|
168
168
|
Object.defineProperty(exports, "styledOKELinkCSS", { enumerable: true, get: function () { return styled_1.styledOKELinkCSS; } });
|
|
169
|
+
// lexical
|
|
170
|
+
var TableCellResizer_1 = require("./components/Lexical/Plugins/TableCellResizer");
|
|
171
|
+
Object.defineProperty(exports, "TableCellResizerPlugin", { enumerable: true, get: function () { return __importDefault(TableCellResizer_1).default; } });
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
export { transition } from "./transitions";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export const
|
|
6
|
-
export
|
|
7
|
-
export
|
|
2
|
+
export { boxShadow0, boxShadow1, innerShadow0 } from "./boxShadows";
|
|
3
|
+
export type breakpoint = "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
|
|
4
|
+
export declare const getBreakPoint: (point: breakpoint) => 0 | 600 | 800 | 1000 | 1300 | 1600;
|
|
5
|
+
export declare const mediaQuery: (point: any) => string;
|
|
6
|
+
export declare const isElementInViewport: (el: any) => boolean;
|
|
7
|
+
export declare const ellipsis: import("styled-components").FlattenSimpleInterpolation;
|
|
8
|
+
export declare const clampText: (noOfLines: any) => import("styled-components").FlattenSimpleInterpolation;
|
|
9
|
+
export declare const multilineUnderline: ({ color, thickness, reverse, }: {
|
|
8
10
|
color: any;
|
|
9
11
|
thickness?: string;
|
|
10
12
|
reverse?: boolean;
|
|
11
|
-
})
|
|
13
|
+
}) => {
|
|
12
14
|
init: import("styled-components").FlattenSimpleInterpolation;
|
|
13
15
|
hovered: import("styled-components").FlattenSimpleInterpolation;
|
|
14
16
|
};
|
|
15
|
-
export { boxShadow0, boxShadow1, innerShadow0 } from "./boxShadows";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { breakpoint } from "../../themes/mixins";
|
|
3
|
+
export interface useContainerQueryOptions {
|
|
2
4
|
enabled?: boolean;
|
|
3
|
-
}
|
|
5
|
+
}
|
|
6
|
+
export interface useContainerQueryReturn {
|
|
4
7
|
ref?: React.RefObject<HTMLDivElement>;
|
|
5
|
-
containerQuery?: (point:
|
|
8
|
+
containerQuery?: (point: breakpoint) => (styles: string | TemplateStringsArray) => string;
|
|
6
9
|
containerWidth: number;
|
|
7
10
|
containerHeight: number;
|
|
8
|
-
}
|
|
11
|
+
}
|
|
12
|
+
export declare const useContainerQuery: (options?: useContainerQueryOptions) => useContainerQueryReturn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oolib",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.109.1",
|
|
4
4
|
"description": " OKE Component Library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -100,6 +100,9 @@
|
|
|
100
100
|
"moment": "^2.24.0",
|
|
101
101
|
"phosphor-react": "^1.4.1",
|
|
102
102
|
"react-player": "^2.12.0",
|
|
103
|
-
"react-virtualized": "^9.22.5"
|
|
103
|
+
"react-virtualized": "^9.22.5",
|
|
104
|
+
"lexical": "0.13.1",
|
|
105
|
+
"@lexical/react": "0.13.1",
|
|
106
|
+
"@lexical/table": "0.13.1"
|
|
104
107
|
}
|
|
105
108
|
}
|