@hitachivantara/uikit-react-pentaho 6.0.13 → 6.0.14
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/Canvas/BottomPanel/BottomPanel.js +116 -179
- package/dist/Canvas/BottomPanel/BottomPanel.styles.js +43 -55
- package/dist/Canvas/CanvasContext.js +39 -43
- package/dist/Canvas/PanelTab/PanelTab.js +31 -39
- package/dist/Canvas/PanelTab/PanelTab.styles.js +39 -46
- package/dist/Canvas/PanelTabs/PanelTabs.js +22 -27
- package/dist/Canvas/PanelTabs/PanelTabs.styles.js +11 -15
- package/dist/Canvas/SidePanel/SidePanel.js +102 -148
- package/dist/Canvas/SidePanel/SidePanel.styles.js +55 -73
- package/dist/Canvas/SidePanel/useResizable.js +67 -66
- package/dist/Canvas/Toolbar/Toolbar.js +51 -58
- package/dist/Canvas/Toolbar/Toolbar.styles.js +37 -38
- package/dist/Canvas/ToolbarTabs/ToolbarTabEditor.js +126 -151
- package/dist/Canvas/ToolbarTabs/ToolbarTabs.js +174 -228
- package/dist/Canvas/ToolbarTabs/ToolbarTabs.styles.js +98 -129
- package/dist/index.js +8 -24
- package/package.json +5 -5
|
@@ -1,60 +1,53 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { useDefaultProps, useLabels, HvIconButton, HvTypography } from "@hitachivantara/uikit-react-core";
|
|
4
|
-
import { Previous } from "@hitachivantara/uikit-react-icons";
|
|
5
|
-
import { mergeStyles } from "@hitachivantara/uikit-react-utils";
|
|
6
1
|
import { useCanvasContext } from "../CanvasContext.js";
|
|
7
2
|
import { useClasses } from "./Toolbar.styles.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
staticClasses as canvasToolbarClasses
|
|
60
|
-
};
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { HvIconButton, HvTypography, useDefaultProps, useLabels } from "@hitachivantara/uikit-react-core";
|
|
5
|
+
import { mergeStyles } from "@hitachivantara/uikit-react-utils";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Previous } from "@hitachivantara/uikit-react-icons";
|
|
8
|
+
//#region src/Canvas/Toolbar/Toolbar.tsx
|
|
9
|
+
var DEFAULT_LABELS = { back: "Back" };
|
|
10
|
+
/**
|
|
11
|
+
* A toolbar component to use in a canvas context.
|
|
12
|
+
*/
|
|
13
|
+
var HvCanvasToolbar = forwardRef(function HvCanvasToolbar(props, ref) {
|
|
14
|
+
const { title: titleProp, backButton, labels: labelsProp, className, style, children, backButtonProps, classes: classesProp, ...others } = useDefaultProps("HvCanvasToolbar", props);
|
|
15
|
+
const { classes, cx } = useClasses(classesProp);
|
|
16
|
+
const labels = useLabels(DEFAULT_LABELS, labelsProp);
|
|
17
|
+
const canvasContext = useCanvasContext();
|
|
18
|
+
const sidePanelWidth = canvasContext?.sidePanelWidth ?? 0;
|
|
19
|
+
const title = typeof titleProp === "string" ? /* @__PURE__ */ jsx(HvTypography, {
|
|
20
|
+
variant: "title4",
|
|
21
|
+
children: titleProp
|
|
22
|
+
}) : titleProp;
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
24
|
+
ref,
|
|
25
|
+
className: cx(classes.root, className),
|
|
26
|
+
style: mergeStyles(style, {
|
|
27
|
+
"--sidepanel-width": `${sidePanelWidth}px`,
|
|
28
|
+
transition: canvasContext?.sidePanelDragging ? void 0 : "width 0.3s ease"
|
|
29
|
+
}),
|
|
30
|
+
...others,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: classes.back,
|
|
34
|
+
children: backButton ?? /* @__PURE__ */ jsx(HvIconButton, {
|
|
35
|
+
title: labels.back,
|
|
36
|
+
variant: "primaryGhost",
|
|
37
|
+
...backButtonProps,
|
|
38
|
+
children: /* @__PURE__ */ jsx(Previous, {})
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: classes.title,
|
|
43
|
+
children: title
|
|
44
|
+
}),
|
|
45
|
+
children && /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: classes.actions,
|
|
47
|
+
children
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//#endregion
|
|
53
|
+
export { HvCanvasToolbar };
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { createClasses, theme } from "@hitachivantara/uikit-react-core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
//#region src/Canvas/Toolbar/Toolbar.styles.tsx
|
|
3
|
+
var { staticClasses, useClasses } = createClasses("HvCanvasToolbar", {
|
|
4
|
+
root: {
|
|
5
|
+
width: `calc(100% - var(--sidepanel-width) - 2 * ${theme.space.sm})`,
|
|
6
|
+
height: 54,
|
|
7
|
+
display: "flex",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
borderRadius: theme.radii.full,
|
|
10
|
+
backgroundColor: theme.colors.bgContainer,
|
|
11
|
+
position: "absolute",
|
|
12
|
+
right: theme.space.sm,
|
|
13
|
+
top: 0
|
|
14
|
+
},
|
|
15
|
+
back: {
|
|
16
|
+
borderRadius: `${theme.radii.full} 0 0 ${theme.radii.full}`,
|
|
17
|
+
minWidth: 68,
|
|
18
|
+
backgroundColor: theme.colors.bgHover,
|
|
19
|
+
height: "100%",
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
justifyContent: "center"
|
|
23
|
+
},
|
|
24
|
+
title: {
|
|
25
|
+
display: "flex",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
padding: theme.spacing(0, "md"),
|
|
28
|
+
height: "100%",
|
|
29
|
+
flexGrow: 1
|
|
30
|
+
},
|
|
31
|
+
actions: {
|
|
32
|
+
display: "flex",
|
|
33
|
+
flexWrap: "nowrap",
|
|
34
|
+
overflow: "auto",
|
|
35
|
+
paddingRight: theme.space.md
|
|
36
|
+
}
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
useClasses
|
|
40
|
-
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { staticClasses, useClasses };
|
|
@@ -1,154 +1,129 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
1
|
import { useRef, useState } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { HvTypography, createClasses, isKey, theme, useControlled, useEnhancedEffect } from "@hitachivantara/uikit-react-core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Edit } from "@hitachivantara/uikit-react-icons";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
onKeyDownProp?.(event);
|
|
128
|
-
};
|
|
129
|
-
return /* @__PURE__ */ jsxs("div", { id, className: cx(classes.root, className), children: [
|
|
130
|
-
/* @__PURE__ */ jsx(
|
|
131
|
-
HvTypography,
|
|
132
|
-
{
|
|
133
|
-
ref: contentEditableRef,
|
|
134
|
-
contentEditable: isEditing,
|
|
135
|
-
className: cx(classes.label, { [classes.edit]: isEditing }),
|
|
136
|
-
variant: "label",
|
|
137
|
-
component: "span",
|
|
138
|
-
onInput: handleInput,
|
|
139
|
-
onClick: handleClick,
|
|
140
|
-
onBlur: handleBlur,
|
|
141
|
-
onKeyDown: handleKeyDown,
|
|
142
|
-
dangerouslySetInnerHTML: {
|
|
143
|
-
__html: value
|
|
144
|
-
},
|
|
145
|
-
...others
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
/* @__PURE__ */ jsx(Edit, { className: classes.editIcon, iconSize: "XS" })
|
|
149
|
-
] });
|
|
150
|
-
};
|
|
151
|
-
export {
|
|
152
|
-
ToolbarTabEditor,
|
|
153
|
-
staticClasses as toolbarTabEditorClasses
|
|
5
|
+
//#region src/Canvas/ToolbarTabs/ToolbarTabEditor.tsx
|
|
6
|
+
var { staticClasses, useClasses } = createClasses("HvCanvasToolbarTabsEditor", {
|
|
7
|
+
root: {
|
|
8
|
+
position: "relative",
|
|
9
|
+
display: "flex",
|
|
10
|
+
width: "100%",
|
|
11
|
+
overflow: "hidden",
|
|
12
|
+
"&:has($label:hover:not($edit))": {
|
|
13
|
+
color: theme.colors.textSubtle,
|
|
14
|
+
"& $editIcon": { visibility: "visible" }
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
edit: {
|
|
18
|
+
color: theme.colors.textSubtle,
|
|
19
|
+
borderColor: "currentColor",
|
|
20
|
+
backgroundColor: theme.colors.bgContainer,
|
|
21
|
+
cursor: "text"
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
width: "100%",
|
|
25
|
+
boxSizing: "border-box",
|
|
26
|
+
border: "1px solid transparent",
|
|
27
|
+
borderRadius: theme.radii.base,
|
|
28
|
+
padding: theme.spacing(0, "sm", 0, "xs"),
|
|
29
|
+
textAlign: "start",
|
|
30
|
+
whiteSpace: "nowrap",
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
outline: "none",
|
|
33
|
+
"&:not($edit)": { textOverflow: "ellipsis" },
|
|
34
|
+
"&:hover:not($edit)": {
|
|
35
|
+
color: theme.colors.textSubtle,
|
|
36
|
+
borderColor: theme.colors.bgHover,
|
|
37
|
+
backgroundColor: theme.colors.bgHover
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
editIcon: {
|
|
41
|
+
position: "absolute",
|
|
42
|
+
right: theme.space.xxs,
|
|
43
|
+
top: 4,
|
|
44
|
+
width: 16,
|
|
45
|
+
height: 16,
|
|
46
|
+
visibility: "hidden",
|
|
47
|
+
pointerEvents: "none"
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
var sanitize = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
51
|
+
var ToolbarTabEditor = ({ id, className, edit: editProp, value: valueProp, defaultValue: defaultValueProp = "", classes: classesProp, onInput: onInputProp, onClick: onClickProp, onBlur: onBlurProp, onKeyDown: onKeyDownProp, onChange: onChangeProp, onEditChange: onEditChangeProp, ...others }) => {
|
|
52
|
+
const { cx, classes } = useClasses(classesProp);
|
|
53
|
+
const contentEditableRef = useRef(null);
|
|
54
|
+
const [value, setValue] = useControlled(valueProp ? sanitize(valueProp) : valueProp, defaultValueProp ? sanitize(defaultValueProp) : defaultValueProp);
|
|
55
|
+
const [cachedValue, setCachedValue] = useState(value);
|
|
56
|
+
const [isEditing, setIsEditing] = useControlled(editProp, false);
|
|
57
|
+
const moveCursorToEnd = () => {
|
|
58
|
+
if (!contentEditableRef.current) return;
|
|
59
|
+
const element = contentEditableRef.current;
|
|
60
|
+
const range = document.createRange();
|
|
61
|
+
const selection = window.getSelection();
|
|
62
|
+
range.selectNodeContents(element);
|
|
63
|
+
range.collapse(false);
|
|
64
|
+
selection?.removeAllRanges();
|
|
65
|
+
selection?.addRange(range);
|
|
66
|
+
element.scrollLeft = element.scrollWidth;
|
|
67
|
+
};
|
|
68
|
+
const scrollContentToStart = () => {
|
|
69
|
+
if (!contentEditableRef.current) return;
|
|
70
|
+
const element = contentEditableRef.current;
|
|
71
|
+
element.scrollLeft = 0;
|
|
72
|
+
};
|
|
73
|
+
const changeEdit = (edit) => {
|
|
74
|
+
setIsEditing(edit);
|
|
75
|
+
onEditChangeProp?.(edit);
|
|
76
|
+
};
|
|
77
|
+
useEnhancedEffect(() => {
|
|
78
|
+
if (isEditing) moveCursorToEnd();
|
|
79
|
+
}, [isEditing, value]);
|
|
80
|
+
const handleInput = (event) => {
|
|
81
|
+
const newValue = sanitize(event.target.textContent) || "";
|
|
82
|
+
setValue(newValue);
|
|
83
|
+
onInputProp?.(event);
|
|
84
|
+
onChangeProp?.(event, newValue);
|
|
85
|
+
};
|
|
86
|
+
const handleClick = (event) => {
|
|
87
|
+
setCachedValue(value);
|
|
88
|
+
changeEdit(true);
|
|
89
|
+
onClickProp?.(event);
|
|
90
|
+
};
|
|
91
|
+
const handleBlur = (event) => {
|
|
92
|
+
changeEdit(false);
|
|
93
|
+
scrollContentToStart();
|
|
94
|
+
const newValue = value.trim() || cachedValue;
|
|
95
|
+
setValue(newValue);
|
|
96
|
+
onBlurProp?.(event, newValue);
|
|
97
|
+
};
|
|
98
|
+
const handleKeyDown = (event) => {
|
|
99
|
+
if (isKey(event, "Enter")) handleBlur(event);
|
|
100
|
+
else if (isKey(event, "Esc")) {
|
|
101
|
+
changeEdit(false);
|
|
102
|
+
setValue(cachedValue);
|
|
103
|
+
onChangeProp?.(event, cachedValue);
|
|
104
|
+
}
|
|
105
|
+
onKeyDownProp?.(event);
|
|
106
|
+
};
|
|
107
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
108
|
+
id,
|
|
109
|
+
className: cx(classes.root, className),
|
|
110
|
+
children: [/* @__PURE__ */ jsx(HvTypography, {
|
|
111
|
+
ref: contentEditableRef,
|
|
112
|
+
contentEditable: isEditing,
|
|
113
|
+
className: cx(classes.label, { [classes.edit]: isEditing }),
|
|
114
|
+
variant: "label",
|
|
115
|
+
component: "span",
|
|
116
|
+
onInput: handleInput,
|
|
117
|
+
onClick: handleClick,
|
|
118
|
+
onBlur: handleBlur,
|
|
119
|
+
onKeyDown: handleKeyDown,
|
|
120
|
+
dangerouslySetInnerHTML: { __html: value },
|
|
121
|
+
...others
|
|
122
|
+
}), /* @__PURE__ */ jsx(Edit, {
|
|
123
|
+
className: classes.editIcon,
|
|
124
|
+
iconSize: "XS"
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
154
127
|
};
|
|
128
|
+
//#endregion
|
|
129
|
+
export { ToolbarTabEditor, staticClasses };
|