@lensui/lens-table 0.1.91 → 0.1.93
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/index.cjs +19 -8
- package/dist/index.css +23 -15
- package/dist/index.js +19 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -953,12 +953,13 @@ function TextEditor({ value, type, min, max, integer = false, style, labels, onC
|
|
|
953
953
|
var import_react6 = require("react");
|
|
954
954
|
var import_react_dom = require("react-dom");
|
|
955
955
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
956
|
-
function TextAreaEditor({ value, title, maxLength, inline = false, style, labels, onChange, onCommit, onCancel }) {
|
|
956
|
+
function TextAreaEditor({ value, title, maxLength, inline = false, keepRightBorderVisible = false, style, labels, onChange, onCommit, onCancel }) {
|
|
957
957
|
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
958
958
|
const inlineHeaderHeight = typeof style.height === "number" ? style.height : 34;
|
|
959
959
|
const editorStyle = inline && open ? {
|
|
960
960
|
...style,
|
|
961
|
-
"--rvg-textarea-inline-header-height": `${inlineHeaderHeight}px
|
|
961
|
+
"--rvg-textarea-inline-header-height": `${inlineHeaderHeight}px`,
|
|
962
|
+
"--rvg-textarea-inline-outline-right": keepRightBorderVisible ? "0px" : "-1px"
|
|
962
963
|
} : style;
|
|
963
964
|
const handleKeyDown = (event) => {
|
|
964
965
|
event.stopPropagation();
|
|
@@ -971,7 +972,7 @@ function TextAreaEditor({ value, title, maxLength, inline = false, style, labels
|
|
|
971
972
|
className: `rvg-native-editor rvg-textarea-editor${inline && open ? " is-inline-expanded" : ""}`,
|
|
972
973
|
style: editorStyle,
|
|
973
974
|
children: [
|
|
974
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
975
|
+
!(inline && open) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
975
976
|
"input",
|
|
976
977
|
{
|
|
977
978
|
value,
|
|
@@ -992,7 +993,13 @@ function TextAreaEditor({ value, title, maxLength, inline = false, style, labels
|
|
|
992
993
|
event.preventDefault();
|
|
993
994
|
event.stopPropagation();
|
|
994
995
|
},
|
|
995
|
-
onClick: () =>
|
|
996
|
+
onClick: () => {
|
|
997
|
+
if (!inline) {
|
|
998
|
+
setOpen(true);
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
setOpen((current) => !current);
|
|
1002
|
+
},
|
|
996
1003
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MultilineEditorIcon, {})
|
|
997
1004
|
}
|
|
998
1005
|
),
|
|
@@ -1198,11 +1205,12 @@ function getSelectionOutlineBounds({
|
|
|
1198
1205
|
horizontalEnd,
|
|
1199
1206
|
verticalStart,
|
|
1200
1207
|
verticalEnd,
|
|
1201
|
-
borderWidth = 2
|
|
1208
|
+
borderWidth = 2,
|
|
1209
|
+
keepRightBorderVisible = false
|
|
1202
1210
|
}) {
|
|
1203
1211
|
return {
|
|
1204
1212
|
left: Math.max(left - borderWidth, horizontalStart - borderWidth),
|
|
1205
|
-
right: Math.min(right + 1, horizontalEnd + 1),
|
|
1213
|
+
right: Math.min(right + 1, horizontalEnd + (keepRightBorderVisible ? 0 : 1)),
|
|
1206
1214
|
top: Math.max(top - borderWidth, verticalStart - borderWidth),
|
|
1207
1215
|
bottom: Math.min(bottom + borderWidth, verticalEnd + borderWidth)
|
|
1208
1216
|
};
|
|
@@ -3302,7 +3310,8 @@ function TableInner({
|
|
|
3302
3310
|
horizontalStart,
|
|
3303
3311
|
horizontalEnd,
|
|
3304
3312
|
verticalStart,
|
|
3305
|
-
verticalEnd: renderHeight
|
|
3313
|
+
verticalEnd: renderHeight,
|
|
3314
|
+
keepRightBorderVisible: horizontalEnd === viewport.width
|
|
3306
3315
|
});
|
|
3307
3316
|
const left = Math.round(bounds.left);
|
|
3308
3317
|
const right = Math.round(bounds.right);
|
|
@@ -3861,6 +3870,7 @@ function TableInner({
|
|
|
3861
3870
|
title: column.editor.title ?? column.title,
|
|
3862
3871
|
maxLength: column.editor.maxLength,
|
|
3863
3872
|
inline: column.editor.inline,
|
|
3873
|
+
keepRightBorderVisible: typeof editorStyle.left === "number" && typeof editorStyle.width === "number" && editorStyle.left + editorStyle.width >= viewport.width,
|
|
3864
3874
|
style: editorStyle,
|
|
3865
3875
|
labels,
|
|
3866
3876
|
onChange: setDraft,
|
|
@@ -4856,7 +4866,8 @@ function TableInner({
|
|
|
4856
4866
|
horizontalStart,
|
|
4857
4867
|
horizontalEnd,
|
|
4858
4868
|
verticalStart,
|
|
4859
|
-
verticalEnd: renderHeight
|
|
4869
|
+
verticalEnd: renderHeight,
|
|
4870
|
+
keepRightBorderVisible: horizontalEnd === viewport.width
|
|
4860
4871
|
});
|
|
4861
4872
|
const left = Math.round(bounds.left);
|
|
4862
4873
|
const right = Math.round(bounds.right);
|
package/dist/index.css
CHANGED
|
@@ -2753,23 +2753,30 @@
|
|
|
2753
2753
|
.rvg-textarea-editor {
|
|
2754
2754
|
padding-right: 24px;
|
|
2755
2755
|
}
|
|
2756
|
+
.rvg-root:has(.rvg-textarea-editor.is-inline-expanded) .rvg-selection-focus {
|
|
2757
|
+
display: none;
|
|
2758
|
+
}
|
|
2756
2759
|
.rvg-textarea-editor.is-inline-expanded {
|
|
2757
2760
|
z-index: 8;
|
|
2758
|
-
display:
|
|
2761
|
+
display: block;
|
|
2759
2762
|
height: calc(var(--rvg-textarea-inline-header-height) + 116px) !important;
|
|
2760
2763
|
padding: 0;
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
gap: 0;
|
|
2764
|
-
overflow: hidden;
|
|
2765
|
-
border: 2px solid var(--rvg-color-primary);
|
|
2764
|
+
overflow: visible;
|
|
2765
|
+
border: 0;
|
|
2766
2766
|
background: var(--rvg-color-bg);
|
|
2767
|
+
box-shadow: none;
|
|
2767
2768
|
}
|
|
2768
|
-
.rvg-textarea-editor.is-inline-expanded
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2769
|
+
.rvg-textarea-editor.is-inline-expanded::before {
|
|
2770
|
+
position: absolute;
|
|
2771
|
+
z-index: 1;
|
|
2772
|
+
top: -2px;
|
|
2773
|
+
right: var(--rvg-textarea-inline-outline-right, -1px);
|
|
2774
|
+
bottom: -2px;
|
|
2775
|
+
left: -2px;
|
|
2776
|
+
border: 2px solid var(--rvg-color-primary);
|
|
2777
|
+
content: "";
|
|
2778
|
+
pointer-events: none;
|
|
2779
|
+
box-sizing: border-box;
|
|
2773
2780
|
}
|
|
2774
2781
|
.rvg-textarea-trigger {
|
|
2775
2782
|
position: absolute;
|
|
@@ -2802,19 +2809,20 @@
|
|
|
2802
2809
|
min-width: 0;
|
|
2803
2810
|
min-height: 0;
|
|
2804
2811
|
margin: 0;
|
|
2805
|
-
padding: 8px;
|
|
2812
|
+
padding: 0 24px 8px 4px;
|
|
2806
2813
|
resize: none;
|
|
2807
2814
|
border: 0;
|
|
2808
|
-
border-top: 1px solid var(--rvg-color-primary);
|
|
2809
2815
|
border-radius: 0;
|
|
2810
2816
|
outline: none;
|
|
2811
|
-
background:
|
|
2817
|
+
background: transparent;
|
|
2812
2818
|
color: var(--rvg-color-text);
|
|
2813
2819
|
font:
|
|
2814
|
-
var(--rvg-font-size-body)
|
|
2820
|
+
var(--rvg-font-size-body) Inter,
|
|
2815
2821
|
ui-sans-serif,
|
|
2816
2822
|
system-ui,
|
|
2817
2823
|
sans-serif;
|
|
2824
|
+
line-height: var(--rvg-textarea-inline-header-height);
|
|
2825
|
+
box-shadow: none;
|
|
2818
2826
|
box-sizing: border-box;
|
|
2819
2827
|
}
|
|
2820
2828
|
.rvg-textarea-backdrop {
|
package/dist/index.js
CHANGED
|
@@ -923,12 +923,13 @@ function TextEditor({ value, type, min, max, integer = false, style, labels, onC
|
|
|
923
923
|
import { useState as useState4 } from "react";
|
|
924
924
|
import { createPortal } from "react-dom";
|
|
925
925
|
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
926
|
-
function TextAreaEditor({ value, title, maxLength, inline = false, style, labels, onChange, onCommit, onCancel }) {
|
|
926
|
+
function TextAreaEditor({ value, title, maxLength, inline = false, keepRightBorderVisible = false, style, labels, onChange, onCommit, onCancel }) {
|
|
927
927
|
const [open, setOpen] = useState4(false);
|
|
928
928
|
const inlineHeaderHeight = typeof style.height === "number" ? style.height : 34;
|
|
929
929
|
const editorStyle = inline && open ? {
|
|
930
930
|
...style,
|
|
931
|
-
"--rvg-textarea-inline-header-height": `${inlineHeaderHeight}px
|
|
931
|
+
"--rvg-textarea-inline-header-height": `${inlineHeaderHeight}px`,
|
|
932
|
+
"--rvg-textarea-inline-outline-right": keepRightBorderVisible ? "0px" : "-1px"
|
|
932
933
|
} : style;
|
|
933
934
|
const handleKeyDown = (event) => {
|
|
934
935
|
event.stopPropagation();
|
|
@@ -941,7 +942,7 @@ function TextAreaEditor({ value, title, maxLength, inline = false, style, labels
|
|
|
941
942
|
className: `rvg-native-editor rvg-textarea-editor${inline && open ? " is-inline-expanded" : ""}`,
|
|
942
943
|
style: editorStyle,
|
|
943
944
|
children: [
|
|
944
|
-
/* @__PURE__ */ jsx7(
|
|
945
|
+
!(inline && open) && /* @__PURE__ */ jsx7(
|
|
945
946
|
"input",
|
|
946
947
|
{
|
|
947
948
|
value,
|
|
@@ -962,7 +963,13 @@ function TextAreaEditor({ value, title, maxLength, inline = false, style, labels
|
|
|
962
963
|
event.preventDefault();
|
|
963
964
|
event.stopPropagation();
|
|
964
965
|
},
|
|
965
|
-
onClick: () =>
|
|
966
|
+
onClick: () => {
|
|
967
|
+
if (!inline) {
|
|
968
|
+
setOpen(true);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
setOpen((current) => !current);
|
|
972
|
+
},
|
|
966
973
|
children: /* @__PURE__ */ jsx7(MultilineEditorIcon, {})
|
|
967
974
|
}
|
|
968
975
|
),
|
|
@@ -1168,11 +1175,12 @@ function getSelectionOutlineBounds({
|
|
|
1168
1175
|
horizontalEnd,
|
|
1169
1176
|
verticalStart,
|
|
1170
1177
|
verticalEnd,
|
|
1171
|
-
borderWidth = 2
|
|
1178
|
+
borderWidth = 2,
|
|
1179
|
+
keepRightBorderVisible = false
|
|
1172
1180
|
}) {
|
|
1173
1181
|
return {
|
|
1174
1182
|
left: Math.max(left - borderWidth, horizontalStart - borderWidth),
|
|
1175
|
-
right: Math.min(right + 1, horizontalEnd + 1),
|
|
1183
|
+
right: Math.min(right + 1, horizontalEnd + (keepRightBorderVisible ? 0 : 1)),
|
|
1176
1184
|
top: Math.max(top - borderWidth, verticalStart - borderWidth),
|
|
1177
1185
|
bottom: Math.min(bottom + borderWidth, verticalEnd + borderWidth)
|
|
1178
1186
|
};
|
|
@@ -3272,7 +3280,8 @@ function TableInner({
|
|
|
3272
3280
|
horizontalStart,
|
|
3273
3281
|
horizontalEnd,
|
|
3274
3282
|
verticalStart,
|
|
3275
|
-
verticalEnd: renderHeight
|
|
3283
|
+
verticalEnd: renderHeight,
|
|
3284
|
+
keepRightBorderVisible: horizontalEnd === viewport.width
|
|
3276
3285
|
});
|
|
3277
3286
|
const left = Math.round(bounds.left);
|
|
3278
3287
|
const right = Math.round(bounds.right);
|
|
@@ -3831,6 +3840,7 @@ function TableInner({
|
|
|
3831
3840
|
title: column.editor.title ?? column.title,
|
|
3832
3841
|
maxLength: column.editor.maxLength,
|
|
3833
3842
|
inline: column.editor.inline,
|
|
3843
|
+
keepRightBorderVisible: typeof editorStyle.left === "number" && typeof editorStyle.width === "number" && editorStyle.left + editorStyle.width >= viewport.width,
|
|
3834
3844
|
style: editorStyle,
|
|
3835
3845
|
labels,
|
|
3836
3846
|
onChange: setDraft,
|
|
@@ -4826,7 +4836,8 @@ function TableInner({
|
|
|
4826
4836
|
horizontalStart,
|
|
4827
4837
|
horizontalEnd,
|
|
4828
4838
|
verticalStart,
|
|
4829
|
-
verticalEnd: renderHeight
|
|
4839
|
+
verticalEnd: renderHeight,
|
|
4840
|
+
keepRightBorderVisible: horizontalEnd === viewport.width
|
|
4830
4841
|
});
|
|
4831
4842
|
const left = Math.round(bounds.left);
|
|
4832
4843
|
const right = Math.round(bounds.right);
|