@univerjs/design 1.0.0-alpha.7 → 1.0.0-beta.0
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/lib/cjs/index.js +152 -206
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +3 -3
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fr-FR.js +3 -3
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +3 -3
- package/lib/cjs/locale/pl-PL.js +3 -3
- package/lib/cjs/locale/pt-BR.js +3 -3
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +3 -3
- package/lib/es/index.js +153 -206
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +3 -3
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/es-ES.js +1 -1
- package/lib/es/locale/fr-FR.js +3 -3
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +3 -3
- package/lib/es/locale/pl-PL.js +3 -3
- package/lib/es/locale/pt-BR.js +3 -3
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +3 -3
- package/lib/index.css +32 -88
- package/lib/index.js +153 -206
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +3 -3
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/es-ES.js +1 -1
- package/lib/locale/fr-FR.js +3 -3
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +3 -3
- package/lib/locale/pl-PL.js +3 -3
- package/lib/locale/pt-BR.js +3 -3
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +3 -3
- package/lib/types/components/dialog/Dialog.d.ts +0 -6
- package/lib/types/components/popup/Popup.d.ts +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/umd/index.js +14 -14
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/package.json +11 -13
- package/lib/types/helper/resize-observer.d.ts +0 -19
package/lib/cjs/index.js
CHANGED
|
@@ -14,7 +14,6 @@ let cmdk = require("cmdk");
|
|
|
14
14
|
let react_dom = require("react-dom");
|
|
15
15
|
let _radix_ui_react_hover_card = require("@radix-ui/react-hover-card");
|
|
16
16
|
let sonner = require("sonner");
|
|
17
|
-
let react_transition_group = require("react-transition-group");
|
|
18
17
|
let _radix_ui_react_separator = require("@radix-ui/react-separator");
|
|
19
18
|
let react_dom_client = require("react-dom/client");
|
|
20
19
|
|
|
@@ -27,10 +26,9 @@ function clsx$1(...inputs) {
|
|
|
27
26
|
//#endregion
|
|
28
27
|
//#region src/components/accordion/Accordion.tsx
|
|
29
28
|
function Accordion(props) {
|
|
30
|
-
var _props$openIndex;
|
|
31
29
|
const { className, defaultOpenIndex = null, items, onOpenIndexChange } = props;
|
|
32
30
|
const [innerOpenIndex, setInnerOpenIndex] = (0, react.useState)(defaultOpenIndex);
|
|
33
|
-
const openIndex =
|
|
31
|
+
const openIndex = props.openIndex ?? innerOpenIndex;
|
|
34
32
|
const toggleItem = (index) => {
|
|
35
33
|
const nextOpenIndex = openIndex === index ? null : index;
|
|
36
34
|
if (props.openIndex === void 0) setInnerOpenIndex(nextOpenIndex);
|
|
@@ -39,30 +37,27 @@ function Accordion(props) {
|
|
|
39
37
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40
38
|
"data-u-comp": "accordion",
|
|
41
39
|
className: clsx$1("univer-divide-x-0 univer-divide-y univer-divide-solid univer-divide-gray-200 dark:!univer-divide-gray-600", className),
|
|
42
|
-
children: items.map((item, index) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
children:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
})] }, (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : index);
|
|
65
|
-
})
|
|
40
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
41
|
+
className: "univer-box-border univer-flex univer-w-full univer-cursor-pointer univer-items-center univer-gap-1.5 univer-border-none univer-bg-transparent univer-p-4 univer-text-left univer-text-gray-700 hover:univer-text-gray-900 focus:univer-outline-none dark:!univer-text-gray-200 dark:hover:!univer-text-white",
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: () => toggleItem(index),
|
|
44
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: clsx$1("univer-size-2.5 univer-flex-shrink-0 univer-transition-transform", {
|
|
45
|
+
"-univer-rotate-90": openIndex !== index,
|
|
46
|
+
"univer-rotate-0": openIndex === index
|
|
47
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
48
|
+
className: "univer-font-medium",
|
|
49
|
+
children: item.label
|
|
50
|
+
})]
|
|
51
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
52
|
+
className: clsx$1("univer-overflow-hidden univer-transition-[max-height,opacity] univer-duration-500 univer-ease-in-out", {
|
|
53
|
+
"univer-max-h-screen": openIndex === index,
|
|
54
|
+
"univer-max-h-0": openIndex !== index
|
|
55
|
+
}),
|
|
56
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
|
+
className: "univer-box-border univer-px-4 univer-py-1.5",
|
|
58
|
+
children: item.children
|
|
59
|
+
})
|
|
60
|
+
})] }, item.id ?? index))
|
|
66
61
|
});
|
|
67
62
|
}
|
|
68
63
|
|
|
@@ -160,7 +155,7 @@ function ConfigProvider(props) {
|
|
|
160
155
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConfigContext.Provider, {
|
|
161
156
|
value,
|
|
162
157
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_direction.DirectionProvider, {
|
|
163
|
-
dir: direction
|
|
158
|
+
dir: direction ?? "ltr",
|
|
164
159
|
children
|
|
165
160
|
})
|
|
166
161
|
});
|
|
@@ -541,7 +536,7 @@ function pad(value, length = 2) {
|
|
|
541
536
|
return String(value).padStart(length, "0");
|
|
542
537
|
}
|
|
543
538
|
function formatDateWithPattern(value, pattern) {
|
|
544
|
-
const date = value
|
|
539
|
+
const date = value ?? /* @__PURE__ */ new Date();
|
|
545
540
|
if (Number.isNaN(date.getTime())) return "Invalid Date";
|
|
546
541
|
const tokenMap = {
|
|
547
542
|
YYYY: String(date.getFullYear()),
|
|
@@ -551,10 +546,7 @@ function formatDateWithPattern(value, pattern) {
|
|
|
551
546
|
mm: pad(date.getMinutes()),
|
|
552
547
|
ss: pad(date.getSeconds())
|
|
553
548
|
};
|
|
554
|
-
return pattern.replace(/YYYY|MM|DD|HH|mm|ss/g, (token) =>
|
|
555
|
-
var _tokenMap$token;
|
|
556
|
-
return (_tokenMap$token = tokenMap[token]) !== null && _tokenMap$token !== void 0 ? _tokenMap$token : token;
|
|
557
|
-
});
|
|
549
|
+
return pattern.replace(/YYYY|MM|DD|HH|mm|ss/g, (token) => tokenMap[token] ?? token);
|
|
558
550
|
}
|
|
559
551
|
|
|
560
552
|
//#endregion
|
|
@@ -563,7 +555,7 @@ function TimeInput(props) {
|
|
|
563
555
|
const { className, value, onValueChange } = props;
|
|
564
556
|
function handleChangeTime(event) {
|
|
565
557
|
const [hours, minutes, seconds] = event.target.value.split(":").map(Number);
|
|
566
|
-
const newValue = new Date(value
|
|
558
|
+
const newValue = new Date(value ?? Date.now());
|
|
567
559
|
newValue.setHours(hours, minutes, seconds, 0);
|
|
568
560
|
onValueChange === null || onValueChange === void 0 || onValueChange(newValue);
|
|
569
561
|
}
|
|
@@ -661,8 +653,8 @@ function Calendar(props) {
|
|
|
661
653
|
const { direction = "ltr", locale } = (0, react.useContext)(ConfigContext);
|
|
662
654
|
const { ariaLabels, year, weekDays, months } = locale === null || locale === void 0 ? void 0 : locale.Calendar;
|
|
663
655
|
const today = /* @__PURE__ */ new Date();
|
|
664
|
-
const [currentYear, setCurrentYear] = (0, react.useState)((value
|
|
665
|
-
const [currentMonth, setCurrentMonth] = (0, react.useState)((value
|
|
656
|
+
const [currentYear, setCurrentYear] = (0, react.useState)((value ?? today).getFullYear());
|
|
657
|
+
const [currentMonth, setCurrentMonth] = (0, react.useState)((value ?? today).getMonth());
|
|
666
658
|
const [yearDropdownOpen, setYearDropdownOpen] = (0, react.useState)(false);
|
|
667
659
|
function prevMonth() {
|
|
668
660
|
setCurrentMonth((prev) => {
|
|
@@ -690,9 +682,8 @@ function Calendar(props) {
|
|
|
690
682
|
setYearDropdownOpen(false);
|
|
691
683
|
}
|
|
692
684
|
const yearOptions = (0, react.useMemo)(() => {
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
const endYear = (_max$getFullYear = max === null || max === void 0 ? void 0 : max.getFullYear()) !== null && _max$getFullYear !== void 0 ? _max$getFullYear : currentYear + DEFAULT_YEAR_RANGE;
|
|
685
|
+
const startYear = (min === null || min === void 0 ? void 0 : min.getFullYear()) ?? currentYear - DEFAULT_YEAR_RANGE;
|
|
686
|
+
const endYear = (max === null || max === void 0 ? void 0 : max.getFullYear()) ?? currentYear + DEFAULT_YEAR_RANGE;
|
|
696
687
|
return Array.from({ length: Math.max(0, endYear - startYear + 1) }, (_, index) => ({ year: startYear + index }));
|
|
697
688
|
}, [
|
|
698
689
|
currentYear,
|
|
@@ -725,31 +716,28 @@ function Calendar(props) {
|
|
|
725
716
|
return day && currentYear === today.getFullYear() && currentMonth === today.getMonth() && day === today.getDate();
|
|
726
717
|
}
|
|
727
718
|
function isDisabled(day) {
|
|
728
|
-
var _value$getHours, _value$getMinutes, _value$getSeconds;
|
|
729
719
|
if (!day) return false;
|
|
730
|
-
const hours = (
|
|
731
|
-
const minutes = (
|
|
732
|
-
const seconds = (
|
|
720
|
+
const hours = (value === null || value === void 0 ? void 0 : value.getHours()) ?? today.getHours();
|
|
721
|
+
const minutes = (value === null || value === void 0 ? void 0 : value.getMinutes()) ?? today.getMinutes();
|
|
722
|
+
const seconds = (value === null || value === void 0 ? void 0 : value.getSeconds()) ?? today.getSeconds();
|
|
733
723
|
const d = new Date(currentYear, currentMonth, day, hours, minutes, seconds);
|
|
734
724
|
if (min && d < min) return true;
|
|
735
725
|
if (max && d > max) return true;
|
|
736
726
|
return false;
|
|
737
727
|
}
|
|
738
728
|
function handleChangeDate(day) {
|
|
739
|
-
var _value$getHours2, _value$getMinutes2, _value$getSeconds2;
|
|
740
729
|
if (isDisabled(day)) return;
|
|
741
|
-
const hours = (
|
|
742
|
-
const minutes = (
|
|
743
|
-
const seconds = (
|
|
730
|
+
const hours = (value === null || value === void 0 ? void 0 : value.getHours()) ?? today.getHours();
|
|
731
|
+
const minutes = (value === null || value === void 0 ? void 0 : value.getMinutes()) ?? today.getMinutes();
|
|
732
|
+
const seconds = (value === null || value === void 0 ? void 0 : value.getSeconds()) ?? today.getSeconds();
|
|
744
733
|
const selectedDate = new Date(currentYear, currentMonth, day, hours, minutes, seconds);
|
|
745
734
|
onValueChange === null || onValueChange === void 0 || onValueChange(selectedDate);
|
|
746
735
|
}
|
|
747
736
|
function handleChangeTime(time) {
|
|
748
|
-
var _value$getDate;
|
|
749
737
|
const hours = time.getHours();
|
|
750
738
|
const minutes = time.getMinutes();
|
|
751
739
|
const seconds = time.getSeconds();
|
|
752
|
-
const updatedDate = new Date(currentYear, currentMonth, (
|
|
740
|
+
const updatedDate = new Date(currentYear, currentMonth, (value === null || value === void 0 ? void 0 : value.getDate()) ?? today.getDate(), hours, minutes, seconds);
|
|
753
741
|
onValueChange === null || onValueChange === void 0 || onValueChange(updatedDate);
|
|
754
742
|
}
|
|
755
743
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -927,7 +915,7 @@ function CheckboxGroup(props) {
|
|
|
927
915
|
key: index,
|
|
928
916
|
children: child.props.children,
|
|
929
917
|
checked: child.props.value ? value.includes(child.props.value) : false,
|
|
930
|
-
disabled: disabled
|
|
918
|
+
disabled: disabled ?? child.props.disabled,
|
|
931
919
|
onChange: handleChange
|
|
932
920
|
});
|
|
933
921
|
return child;
|
|
@@ -948,8 +936,8 @@ function Checkbox(props) {
|
|
|
948
936
|
if (!onChange || disabled) return;
|
|
949
937
|
if (typeof value !== "undefined") onChange === null || onChange === void 0 || onChange(value);
|
|
950
938
|
else {
|
|
951
|
-
var _inputRef$current
|
|
952
|
-
const checked = (
|
|
939
|
+
var _inputRef$current;
|
|
940
|
+
const checked = (inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.checked) ?? false;
|
|
953
941
|
onChange === null || onChange === void 0 || onChange(checked);
|
|
954
942
|
}
|
|
955
943
|
}
|
|
@@ -995,7 +983,7 @@ const DialogOverlay = (0, react.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
995
983
|
}));
|
|
996
984
|
DialogOverlay.displayName = _radix_ui_react_dialog.Overlay.displayName;
|
|
997
985
|
const DialogContent = (0, react.forwardRef)(({ className, children, closable = true, onClickClose, mountContainer, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, {
|
|
998
|
-
container: mountContainer
|
|
986
|
+
container: mountContainer ?? void 0,
|
|
999
987
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Content, {
|
|
1000
988
|
ref,
|
|
1001
989
|
className: clsx$1("data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0 data-[state=open]:univer-zoom-in-95 data-[state=open]:univer-slide-in-from-left-1/2 data-[state=open]:univer-slide-in-from-top-[48%] data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0 data-[state=closed]:univer-zoom-out-95 data-[state=closed]:univer-slide-out-to-left-1/2 data-[state=closed]:univer-slide-out-to-top-[48%] univer-fixed univer-left-1/2 univer-top-1/2 univer-z-[1080] univer-box-border univer-grid univer-w-full univer-max-w-lg -univer-translate-x-1/2 -univer-translate-y-1/2 univer-gap-4 univer-bg-white univer-p-4 univer-text-gray-500 univer-shadow-md univer-duration-200 sm:!univer-rounded-lg dark:!univer-bg-gray-700 dark:!univer-text-gray-400", borderClassName, className),
|
|
@@ -1109,7 +1097,8 @@ function useDraggable(options = {}) {
|
|
|
1109
1097
|
if (!isDragging) return;
|
|
1110
1098
|
e.preventDefault();
|
|
1111
1099
|
e.stopPropagation();
|
|
1112
|
-
|
|
1100
|
+
const newPosition = calculateBounds(e.clientX, e.clientY);
|
|
1101
|
+
setPosition(newPosition);
|
|
1113
1102
|
}, [isDragging, calculateBounds]);
|
|
1114
1103
|
const endDrag = (0, react.useCallback)(() => {
|
|
1115
1104
|
setIsDragging(false);
|
|
@@ -1161,7 +1150,7 @@ function Dialog(props) {
|
|
|
1161
1150
|
defaultPosition,
|
|
1162
1151
|
enabled: draggable
|
|
1163
1152
|
});
|
|
1164
|
-
const footer = propFooter
|
|
1153
|
+
const footer = propFooter ?? (showOk || showCancel ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1165
1154
|
className: "univer-flex univer-justify-end univer-gap-2",
|
|
1166
1155
|
children: [showCancel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1167
1156
|
onClick: onCancel,
|
|
@@ -1171,7 +1160,7 @@ function Dialog(props) {
|
|
|
1171
1160
|
onClick: onOk,
|
|
1172
1161
|
children: locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm
|
|
1173
1162
|
})]
|
|
1174
|
-
}) : null;
|
|
1163
|
+
}) : null);
|
|
1175
1164
|
const handleContentRef = (0, react.useCallback)((node) => {
|
|
1176
1165
|
if (node && draggable) setElementRef(node);
|
|
1177
1166
|
}, [draggable, setElementRef]);
|
|
@@ -1367,10 +1356,10 @@ function AlphaSlider({ hsv, alpha, onChange, onChanged }) {
|
|
|
1367
1356
|
const thumbRef = (0, react.useRef)(null);
|
|
1368
1357
|
const alphaRef = (0, react.useRef)(alpha);
|
|
1369
1358
|
const calculateAlpha = (0, react.useCallback)((clientX) => {
|
|
1370
|
-
var _thumbRef$current
|
|
1359
|
+
var _thumbRef$current;
|
|
1371
1360
|
const slider = sliderRef.current;
|
|
1372
1361
|
if (!slider) return;
|
|
1373
|
-
const thumbSize = (
|
|
1362
|
+
const thumbSize = ((_thumbRef$current = thumbRef.current) === null || _thumbRef$current === void 0 ? void 0 : _thumbRef$current.clientWidth) ?? 0;
|
|
1374
1363
|
const rect = slider.getBoundingClientRect();
|
|
1375
1364
|
const maxX = rect.width - thumbSize;
|
|
1376
1365
|
if (maxX <= 0) {
|
|
@@ -1408,10 +1397,10 @@ function AlphaSlider({ hsv, alpha, onChange, onChanged }) {
|
|
|
1408
1397
|
handlePointerUp
|
|
1409
1398
|
]);
|
|
1410
1399
|
const getThumbPosition = () => {
|
|
1411
|
-
var _thumbRef$
|
|
1400
|
+
var _thumbRef$current2, _sliderRef$current;
|
|
1412
1401
|
const safeAlpha = Math.min(Math.max(alpha * 100, 0), 100);
|
|
1413
|
-
const thumbSize = (
|
|
1414
|
-
const sliderWidth = (
|
|
1402
|
+
const thumbSize = ((_thumbRef$current2 = thumbRef.current) === null || _thumbRef$current2 === void 0 ? void 0 : _thumbRef$current2.clientWidth) ?? 0;
|
|
1403
|
+
const sliderWidth = ((_sliderRef$current = sliderRef.current) === null || _sliderRef$current === void 0 ? void 0 : _sliderRef$current.clientWidth) ?? 0;
|
|
1415
1404
|
const thumbOffsetPercent = sliderWidth > 0 ? thumbSize / sliderWidth * 100 : 0;
|
|
1416
1405
|
return `${safeAlpha / 100 * (100 - thumbOffsetPercent)}%`;
|
|
1417
1406
|
};
|
|
@@ -1498,7 +1487,7 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1498
1487
|
r: Math.round(r),
|
|
1499
1488
|
g: Math.round(g),
|
|
1500
1489
|
b: Math.round(b),
|
|
1501
|
-
a: alpha
|
|
1490
|
+
a: alpha ?? 1
|
|
1502
1491
|
});
|
|
1503
1492
|
}, [hsv, alpha]);
|
|
1504
1493
|
const handleChange = (color, value) => {
|
|
@@ -1506,10 +1495,11 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1506
1495
|
if (value !== "" && !/^\d*\.?\d*$/.test(value)) return;
|
|
1507
1496
|
const numValue = value === "" ? 0 : Number.parseFloat(value);
|
|
1508
1497
|
if (numValue > 1) return;
|
|
1509
|
-
|
|
1498
|
+
const newValues = {
|
|
1510
1499
|
...localValues,
|
|
1511
1500
|
a: numValue
|
|
1512
|
-
}
|
|
1501
|
+
};
|
|
1502
|
+
setLocalValues(newValues);
|
|
1513
1503
|
if (onChange) onChange(hsv[0], hsv[1], hsv[2], numValue);
|
|
1514
1504
|
return;
|
|
1515
1505
|
}
|
|
@@ -1529,7 +1519,7 @@ function RgbInput({ hsv, alpha, format, onChange }) {
|
|
|
1529
1519
|
r: Math.round(r),
|
|
1530
1520
|
g: Math.round(g),
|
|
1531
1521
|
b: Math.round(b),
|
|
1532
|
-
a: alpha
|
|
1522
|
+
a: alpha ?? 1
|
|
1533
1523
|
});
|
|
1534
1524
|
};
|
|
1535
1525
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1748,10 +1738,10 @@ function ColorSpectrum({ hsv, onChange, onChanged }) {
|
|
|
1748
1738
|
};
|
|
1749
1739
|
}, [hsv]);
|
|
1750
1740
|
const getIndicatorStyles = () => {
|
|
1751
|
-
var _containerRef$current3, _containerRef$current4
|
|
1741
|
+
var _containerRef$current3, _containerRef$current4;
|
|
1752
1742
|
const halfIndicatorSize = 16 / 2;
|
|
1753
|
-
const w = (_containerRef$current3 =
|
|
1754
|
-
const h = (
|
|
1743
|
+
const w = ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.clientWidth) ?? 0;
|
|
1744
|
+
const h = ((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.clientHeight) ?? 0;
|
|
1755
1745
|
return {
|
|
1756
1746
|
transform: `translate(${hsv[1] / 100 * w - halfIndicatorSize}px, ${(100 - hsv[2]) / 100 * h - halfIndicatorSize}px)`,
|
|
1757
1747
|
transition: isDragging ? "none" : "transform 0.1s ease-out"
|
|
@@ -1811,10 +1801,10 @@ function HueSlider({ hsv, onChange, onChanged }) {
|
|
|
1811
1801
|
const thumbRef = (0, react.useRef)(null);
|
|
1812
1802
|
const hsvRef = (0, react.useRef)(hsv);
|
|
1813
1803
|
const calculateHue = (0, react.useCallback)((clientX) => {
|
|
1814
|
-
var _thumbRef$current
|
|
1804
|
+
var _thumbRef$current;
|
|
1815
1805
|
const slider = sliderRef.current;
|
|
1816
1806
|
if (!slider) return;
|
|
1817
|
-
const thumbSize = (
|
|
1807
|
+
const thumbSize = ((_thumbRef$current = thumbRef.current) === null || _thumbRef$current === void 0 ? void 0 : _thumbRef$current.clientWidth) ?? 0;
|
|
1818
1808
|
const rect = slider.getBoundingClientRect();
|
|
1819
1809
|
const maxX = rect.width - thumbSize;
|
|
1820
1810
|
if (maxX <= 0) {
|
|
@@ -1854,10 +1844,10 @@ function HueSlider({ hsv, onChange, onChanged }) {
|
|
|
1854
1844
|
handlePointerUp
|
|
1855
1845
|
]);
|
|
1856
1846
|
const getThumbPosition = () => {
|
|
1857
|
-
var _thumbRef$
|
|
1847
|
+
var _thumbRef$current2, _sliderRef$current;
|
|
1858
1848
|
const safeHue = Math.min(Math.max(hsv[0], 0), 360);
|
|
1859
|
-
const thumbSize = (
|
|
1860
|
-
const sliderWidth = (
|
|
1849
|
+
const thumbSize = ((_thumbRef$current2 = thumbRef.current) === null || _thumbRef$current2 === void 0 ? void 0 : _thumbRef$current2.clientWidth) ?? 0;
|
|
1850
|
+
const sliderWidth = ((_sliderRef$current = sliderRef.current) === null || _sliderRef$current === void 0 ? void 0 : _sliderRef$current.clientWidth) ?? 0;
|
|
1861
1851
|
const thumbOffsetPercent = sliderWidth > 0 ? thumbSize / sliderWidth * 100 : 0;
|
|
1862
1852
|
return `${safeHue / 360 * (100 - thumbOffsetPercent)}%`;
|
|
1863
1853
|
};
|
|
@@ -2134,11 +2124,11 @@ function Footer(props) {
|
|
|
2134
2124
|
className: "univer-flex univer-items-center univer-justify-end univer-gap-2",
|
|
2135
2125
|
children: [closable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
2136
2126
|
onClick: onClose,
|
|
2137
|
-
children: cancelText
|
|
2127
|
+
children: cancelText ?? (locale === null || locale === void 0 ? void 0 : locale.Confirm.cancel)
|
|
2138
2128
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
2139
2129
|
variant: "primary",
|
|
2140
2130
|
onClick: onConfirm,
|
|
2141
|
-
children: confirmText
|
|
2131
|
+
children: confirmText ?? (locale === null || locale === void 0 ? void 0 : locale.Confirm.confirm)
|
|
2142
2132
|
})]
|
|
2143
2133
|
});
|
|
2144
2134
|
}
|
|
@@ -2394,7 +2384,10 @@ function DraggableList(props) {
|
|
|
2394
2384
|
onPointerDownCapture: (e) => {
|
|
2395
2385
|
if (pointerIdRef.current !== null) return;
|
|
2396
2386
|
if (!draggableHandle) pressedHandleIdRef.current = itemId;
|
|
2397
|
-
else
|
|
2387
|
+
else {
|
|
2388
|
+
const isMatched = !!e.target.closest(draggableHandle);
|
|
2389
|
+
pressedHandleIdRef.current = isMatched ? itemId : null;
|
|
2390
|
+
}
|
|
2398
2391
|
if (pressedHandleIdRef.current !== itemId) return;
|
|
2399
2392
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
2400
2393
|
dragPointerOffsetRef.current = {
|
|
@@ -2504,7 +2497,7 @@ const FormDualColumnLayout = (props) => {
|
|
|
2504
2497
|
*/
|
|
2505
2498
|
function Pager(props) {
|
|
2506
2499
|
const { className, value: current = 0, total: count = 0, loop, text: propText, onChange } = props;
|
|
2507
|
-
const text = propText
|
|
2500
|
+
const text = propText ?? `${current}/${count}`;
|
|
2508
2501
|
const hasValue = count > 0;
|
|
2509
2502
|
const onClickLeftArrow = () => {
|
|
2510
2503
|
if (current === 1) {
|
|
@@ -2650,7 +2643,7 @@ function Gallery(props) {
|
|
|
2650
2643
|
})
|
|
2651
2644
|
}),
|
|
2652
2645
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
2653
|
-
className: "univer-absolute univer-bottom-6 univer-left-1/2 univer-flex -univer-translate-x-1/2 univer-items-center univer-gap-3 univer-rounded-full univer-bg-gray-800 univer-px-6 univer-py-3 univer-text-gray-400",
|
|
2646
|
+
className: "univer-absolute univer-bottom-6 univer-left-1/2 univer-flex -univer-translate-x-1/2 univer-items-center univer-gap-3 univer-rounded-full univer-bg-gray-800 univer-px-6 univer-py-3 univer-text-gray-400 rtl:univer-flex-row-reverse",
|
|
2654
2647
|
children: [
|
|
2655
2648
|
hasPagination && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pager, {
|
|
2656
2649
|
className: "!univer-text-gray-400 [&_[data-u-comp=pager-left-arrow]:hover]:!univer-bg-gray-600 [&_[data-u-comp=pager-right-arrow]:hover]:!univer-bg-gray-600",
|
|
@@ -2976,14 +2969,16 @@ function Segmented({ items, value, defaultValue, onChange, className = "" }) {
|
|
|
2976
2969
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2977
2970
|
const newRect = newItemElement.getBoundingClientRect();
|
|
2978
2971
|
const newLeft = newRect.left - containerRect.left - SEGMENTED_PADDING;
|
|
2979
|
-
if (oldItemElement)
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2972
|
+
if (oldItemElement) {
|
|
2973
|
+
const oldLeft = oldItemElement.getBoundingClientRect().left - containerRect.left - SEGMENTED_PADDING;
|
|
2974
|
+
setSlideStyle({
|
|
2975
|
+
"--slide-from": `${oldLeft}px`,
|
|
2976
|
+
"--slide-to": `${newLeft}px`,
|
|
2977
|
+
left: `${SEGMENTED_PADDING}px`,
|
|
2978
|
+
width: `${newRect.width}px`,
|
|
2979
|
+
transform: `translateX(${newLeft}px)`
|
|
2980
|
+
});
|
|
2981
|
+
} else setSlideStyle({
|
|
2987
2982
|
left: `${SEGMENTED_PADDING}px`,
|
|
2988
2983
|
width: `${newRect.width}px`,
|
|
2989
2984
|
transform: `translateX(${newLeft}px)`
|
|
@@ -3165,50 +3160,47 @@ function Tooltip(props) {
|
|
|
3165
3160
|
children
|
|
3166
3161
|
});
|
|
3167
3162
|
let tooltipNode = null;
|
|
3168
|
-
if (typeof document !== "undefined" && visible && title && document.body) {
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3163
|
+
if (typeof document !== "undefined" && visible && title && document.body) tooltipNode = (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3164
|
+
ref: tooltipRef,
|
|
3165
|
+
dir: direction,
|
|
3166
|
+
role: "tooltip",
|
|
3167
|
+
className: clsx$1("univer-animate-in univer-fade-in-0 univer-zoom-in-95 univer-pointer-events-auto univer-absolute univer-z-[1081] univer-box-border univer-w-fit univer-max-w-sm univer-text-balance univer-rounded-lg univer-bg-gray-700 univer-px-2.5 univer-py-2 univer-text-xs univer-font-medium univer-text-white univer-shadow-lg univer-drop-shadow-sm dark:!univer-bg-gray-100 dark:!univer-text-gray-900", className),
|
|
3168
|
+
style: {
|
|
3169
|
+
top: (coords === null || coords === void 0 ? void 0 : coords.top) ?? -9999,
|
|
3170
|
+
left: (coords === null || coords === void 0 ? void 0 : coords.left) ?? -9999
|
|
3171
|
+
},
|
|
3172
|
+
onMouseEnter: () => showTooltip(),
|
|
3173
|
+
onMouseLeave: () => hideTooltip(),
|
|
3174
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3175
|
+
className: "univer-break-words",
|
|
3176
|
+
children: title
|
|
3177
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3178
|
+
ref: arrowRef,
|
|
3179
|
+
className: "univer-absolute univer-size-2.5 univer-rotate-45 univer-rounded-sm univer-bg-gray-700 dark:!univer-bg-gray-100",
|
|
3175
3180
|
style: {
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
left: "50%",
|
|
3196
|
-
transform: "translateX(-50%) rotate(45deg)"
|
|
3197
|
-
},
|
|
3198
|
-
...currentPlacement === "left" && {
|
|
3199
|
-
right: -5,
|
|
3200
|
-
top: "50%",
|
|
3201
|
-
transform: "translateY(-50%) rotate(45deg)"
|
|
3202
|
-
},
|
|
3203
|
-
...currentPlacement === "right" && {
|
|
3204
|
-
left: -5,
|
|
3205
|
-
top: "50%",
|
|
3206
|
-
transform: "translateY(-50%) rotate(45deg)"
|
|
3207
|
-
}
|
|
3181
|
+
...currentPlacement === "bottom" && {
|
|
3182
|
+
top: -5,
|
|
3183
|
+
left: "50%",
|
|
3184
|
+
transform: "translateX(-50%) rotate(45deg)"
|
|
3185
|
+
},
|
|
3186
|
+
...currentPlacement === "top" && {
|
|
3187
|
+
bottom: -5,
|
|
3188
|
+
left: "50%",
|
|
3189
|
+
transform: "translateX(-50%) rotate(45deg)"
|
|
3190
|
+
},
|
|
3191
|
+
...currentPlacement === "left" && {
|
|
3192
|
+
right: -5,
|
|
3193
|
+
top: "50%",
|
|
3194
|
+
transform: "translateY(-50%) rotate(45deg)"
|
|
3195
|
+
},
|
|
3196
|
+
...currentPlacement === "right" && {
|
|
3197
|
+
left: -5,
|
|
3198
|
+
top: "50%",
|
|
3199
|
+
transform: "translateY(-50%) rotate(45deg)"
|
|
3208
3200
|
}
|
|
3209
|
-
}
|
|
3210
|
-
})
|
|
3211
|
-
}
|
|
3201
|
+
}
|
|
3202
|
+
})]
|
|
3203
|
+
}), document.body);
|
|
3212
3204
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [triggerElement, tooltipNode] });
|
|
3213
3205
|
}
|
|
3214
3206
|
|
|
@@ -3244,8 +3236,7 @@ function clamp(value, min, max) {
|
|
|
3244
3236
|
return Math.max(min, Math.min(max, value));
|
|
3245
3237
|
}
|
|
3246
3238
|
function getStopOpacity(stop) {
|
|
3247
|
-
|
|
3248
|
-
return clamp((_stop$opacity = stop === null || stop === void 0 ? void 0 : stop.opacity) !== null && _stop$opacity !== void 0 ? _stop$opacity : 1, 0, 1);
|
|
3239
|
+
return clamp((stop === null || stop === void 0 ? void 0 : stop.opacity) ?? 1, 0, 1);
|
|
3249
3240
|
}
|
|
3250
3241
|
function getColorWithOpacity(color, opacity) {
|
|
3251
3242
|
if (opacity >= 1) return color;
|
|
@@ -3268,8 +3259,7 @@ function getStopColor(stop) {
|
|
|
3268
3259
|
return getColorWithOpacity(stop.color, getStopOpacity(stop));
|
|
3269
3260
|
}
|
|
3270
3261
|
function getGradientAngle(value) {
|
|
3271
|
-
|
|
3272
|
-
return (_ref = (_value$angle = value.angle) !== null && _value$angle !== void 0 ? _value$angle : DEFAULT_VALUE.angle) !== null && _ref !== void 0 ? _ref : 0;
|
|
3262
|
+
return value.angle ?? DEFAULT_VALUE.angle ?? 0;
|
|
3273
3263
|
}
|
|
3274
3264
|
function getCssLinearGradientAngle(value) {
|
|
3275
3265
|
return (getGradientAngle(value) + 90) % 360;
|
|
@@ -3318,7 +3308,7 @@ function GradientColorPicker(props) {
|
|
|
3318
3308
|
const handleAngleChange = (angle) => {
|
|
3319
3309
|
emitChange({
|
|
3320
3310
|
...valueRef.current,
|
|
3321
|
-
angle: angle
|
|
3311
|
+
angle: angle ?? 0
|
|
3322
3312
|
});
|
|
3323
3313
|
};
|
|
3324
3314
|
const handleStopColorChange = (color) => {
|
|
@@ -3345,7 +3335,7 @@ function GradientColorPicker(props) {
|
|
|
3345
3335
|
});
|
|
3346
3336
|
};
|
|
3347
3337
|
const handleStopTransparencyChange = (transparency) => {
|
|
3348
|
-
const nextTransparency = clamp(transparency
|
|
3338
|
+
const nextTransparency = clamp(transparency ?? 0, 0, 100);
|
|
3349
3339
|
const newStops = [...valueRef.current.stops];
|
|
3350
3340
|
newStops[selectedIndex] = {
|
|
3351
3341
|
...newStops[selectedIndex],
|
|
@@ -3727,7 +3717,7 @@ const Messager = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runt
|
|
|
3727
3717
|
...props
|
|
3728
3718
|
});
|
|
3729
3719
|
const message = ({ content, duration, id, onClose, type = "info" }) => {
|
|
3730
|
-
const messageId = id
|
|
3720
|
+
const messageId = id ?? createMessageId();
|
|
3731
3721
|
const method = resolveToastMethod(type);
|
|
3732
3722
|
let closed = false;
|
|
3733
3723
|
const handleClose = () => {
|
|
@@ -3739,7 +3729,7 @@ const message = ({ content, duration, id, onClose, type = "info" }) => {
|
|
|
3739
3729
|
method(content, {
|
|
3740
3730
|
id: messageId,
|
|
3741
3731
|
toasterId: MESSAGE_TOASTER_ID,
|
|
3742
|
-
duration: duration
|
|
3732
|
+
duration: duration ?? DEFAULT_MESSAGE_DURATION,
|
|
3743
3733
|
icon: type === "loading" ? void 0 : iconMap[type],
|
|
3744
3734
|
onDismiss: handleClose,
|
|
3745
3735
|
onAutoClose: handleClose
|
|
@@ -3839,9 +3829,10 @@ function PanelField(props) {
|
|
|
3839
3829
|
//#endregion
|
|
3840
3830
|
//#region src/components/popup/Popup.tsx
|
|
3841
3831
|
const POPUP_POINTER_OFFSET = 2;
|
|
3832
|
+
const DEFAULT_POPUP_OFFSET = [0, 0];
|
|
3842
3833
|
const HIDDEN_POPUP_OFFSET = [-9999, -9999];
|
|
3843
3834
|
function Popup(props) {
|
|
3844
|
-
const { children, visible = false, offset =
|
|
3835
|
+
const { children, visible = false, offset = DEFAULT_POPUP_OFFSET, overflowVisible = false, placementY = "below" } = props;
|
|
3845
3836
|
const nodeRef = (0, react.useRef)(null);
|
|
3846
3837
|
const [realOffset, setRealOffset] = (0, react.useState)(HIDDEN_POPUP_OFFSET);
|
|
3847
3838
|
const { mountContainer, direction } = (0, react.useContext)(ConfigContext);
|
|
@@ -3887,29 +3878,17 @@ function Popup(props) {
|
|
|
3887
3878
|
function preventDefault(event) {
|
|
3888
3879
|
event.preventDefault();
|
|
3889
3880
|
}
|
|
3890
|
-
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
exitActive: "univer-popup-exit",
|
|
3899
|
-
exitDone: "univer-popup-exit-active"
|
|
3881
|
+
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
3882
|
+
ref: nodeRef,
|
|
3883
|
+
dir: direction,
|
|
3884
|
+
className: clsx$1("univer-popup univer-fixed univer-z-[1070] univer-origin-top-left univer-overflow-hidden univer-rounded-md univer-shadow univer-transition-[transform,opacity] univer-duration-150", visible ? "univer-[transition-timing-function:cubic-bezier(0.08,0.82,0.17,1)] univer-scale-y-100 univer-opacity-100" : "univer-[transition-timing-function:cubic-bezier(0.6,0.04,0.98,0.34)] univer-scale-y-0 univer-opacity-0"),
|
|
3885
|
+
style: {
|
|
3886
|
+
left: realOffset[0] + POPUP_POINTER_OFFSET,
|
|
3887
|
+
top: realOffset[1] + POPUP_POINTER_OFFSET,
|
|
3888
|
+
overflow: overflowVisible ? "visible" : void 0
|
|
3900
3889
|
},
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
dir: direction,
|
|
3904
|
-
className: "univer-popup",
|
|
3905
|
-
style: {
|
|
3906
|
-
left: realOffset[0] + POPUP_POINTER_OFFSET,
|
|
3907
|
-
top: realOffset[1] + POPUP_POINTER_OFFSET,
|
|
3908
|
-
overflow: overflowVisible ? "visible" : void 0
|
|
3909
|
-
},
|
|
3910
|
-
onContextMenu: preventDefault,
|
|
3911
|
-
children
|
|
3912
|
-
})
|
|
3890
|
+
onContextMenu: preventDefault,
|
|
3891
|
+
children
|
|
3913
3892
|
}), mountContainer);
|
|
3914
3893
|
}
|
|
3915
3894
|
|
|
@@ -3932,7 +3911,7 @@ function RadioGroup(props) {
|
|
|
3932
3911
|
children: child.props.children,
|
|
3933
3912
|
value: child.props.value,
|
|
3934
3913
|
checked: value === child.props.value,
|
|
3935
|
-
disabled: disabled
|
|
3914
|
+
disabled: disabled ?? child.props.disabled,
|
|
3936
3915
|
onChange: handleChange
|
|
3937
3916
|
});
|
|
3938
3917
|
return child;
|
|
@@ -4116,13 +4095,19 @@ function MultipleSelect(props) {
|
|
|
4116
4095
|
disabled: option.disabled,
|
|
4117
4096
|
checked: value.includes(option.value),
|
|
4118
4097
|
onSelect: (item) => {
|
|
4119
|
-
|
|
4098
|
+
const newValue = value.includes(item) ? value.filter((v) => v !== item) : [...value, item];
|
|
4099
|
+
onChange(newValue);
|
|
4120
4100
|
}
|
|
4121
4101
|
};
|
|
4122
4102
|
});
|
|
4123
|
-
}, [
|
|
4103
|
+
}, [
|
|
4104
|
+
onChange,
|
|
4105
|
+
options,
|
|
4106
|
+
value
|
|
4107
|
+
]);
|
|
4124
4108
|
function handleClose(item) {
|
|
4125
|
-
|
|
4109
|
+
const newValue = value.filter((v) => v !== item);
|
|
4110
|
+
onChange(newValue);
|
|
4126
4111
|
}
|
|
4127
4112
|
const displayValue = (0, react.useMemo)(() => {
|
|
4128
4113
|
return options.filter((option) => value.includes(option.value)).map((option, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
|
|
@@ -4273,7 +4258,7 @@ function Toaster({ visibleToasts, ...props }) {
|
|
|
4273
4258
|
error: "[&_[data-icon]]:univer-text-red-500",
|
|
4274
4259
|
warning: "[&_[data-icon]]:univer-text-yellow-500"
|
|
4275
4260
|
} },
|
|
4276
|
-
visibleToasts: visibleToasts
|
|
4261
|
+
visibleToasts: visibleToasts ?? 5,
|
|
4277
4262
|
...props
|
|
4278
4263
|
});
|
|
4279
4264
|
}
|
|
@@ -4295,7 +4280,7 @@ const findNodePathFromTree = (tree, key) => {
|
|
|
4295
4280
|
return result;
|
|
4296
4281
|
};
|
|
4297
4282
|
const createCacheWithFindNodePathFromTree = (tree, defaultCache) => {
|
|
4298
|
-
const cache = defaultCache
|
|
4283
|
+
const cache = defaultCache ?? /* @__PURE__ */ new Map();
|
|
4299
4284
|
let cacheTree = tree;
|
|
4300
4285
|
return {
|
|
4301
4286
|
findNodePathFromTreeWithCache: (key) => {
|
|
@@ -4380,7 +4365,8 @@ const filterLeafNode = (tree, keyList) => {
|
|
|
4380
4365
|
const result = [];
|
|
4381
4366
|
const find = createCacheWithFindNodePathFromTree(tree);
|
|
4382
4367
|
keyList.forEach((key) => {
|
|
4383
|
-
const
|
|
4368
|
+
const path = find.findNodePathFromTreeWithCache(key);
|
|
4369
|
+
const node = findNodeFromPath(tree, path);
|
|
4384
4370
|
if (node) {
|
|
4385
4371
|
var _node$children3;
|
|
4386
4372
|
if (!((_node$children3 = node.children) === null || _node$children3 === void 0 ? void 0 : _node$children3.length)) result.push(node);
|
|
@@ -4534,45 +4520,6 @@ function unmount(container) {
|
|
|
4534
4520
|
}
|
|
4535
4521
|
}
|
|
4536
4522
|
|
|
4537
|
-
//#endregion
|
|
4538
|
-
//#region src/helper/resize-observer.ts
|
|
4539
|
-
/**
|
|
4540
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4541
|
-
*
|
|
4542
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4543
|
-
* you may not use this file except in compliance with the License.
|
|
4544
|
-
* You may obtain a copy of the License at
|
|
4545
|
-
*
|
|
4546
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4547
|
-
*
|
|
4548
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4549
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4550
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4551
|
-
* See the License for the specific language governing permissions and
|
|
4552
|
-
* limitations under the License.
|
|
4553
|
-
*/
|
|
4554
|
-
/**
|
|
4555
|
-
* All elements are observed by a single ResizeObserver is got greater performance than each element observed by separate ResizeObserver
|
|
4556
|
-
* See issue https://github.com/WICG/resize-observer/issues/59#issuecomment-408098151
|
|
4557
|
-
*/
|
|
4558
|
-
const _resizeObserverCallbacks = /* @__PURE__ */ new Set();
|
|
4559
|
-
let _resizeObserver;
|
|
4560
|
-
function resizeObserverCtor(callback) {
|
|
4561
|
-
if (!_resizeObserver) _resizeObserver = new ResizeObserver((...args) => {
|
|
4562
|
-
_resizeObserverCallbacks.forEach((callback) => callback(...args));
|
|
4563
|
-
});
|
|
4564
|
-
return {
|
|
4565
|
-
observe(target, options) {
|
|
4566
|
-
_resizeObserverCallbacks.add(callback);
|
|
4567
|
-
_resizeObserver.observe(target, options);
|
|
4568
|
-
},
|
|
4569
|
-
unobserve(target) {
|
|
4570
|
-
_resizeObserverCallbacks.delete(callback);
|
|
4571
|
-
_resizeObserver.unobserve(target);
|
|
4572
|
-
}
|
|
4573
|
-
};
|
|
4574
|
-
}
|
|
4575
|
-
|
|
4576
4523
|
//#endregion
|
|
4577
4524
|
exports.Accordion = Accordion;
|
|
4578
4525
|
exports.Avatar = Avatar;
|
|
@@ -4655,7 +4602,6 @@ exports.message = message;
|
|
|
4655
4602
|
exports.removeMessage = removeMessage;
|
|
4656
4603
|
exports.render = render;
|
|
4657
4604
|
exports.resetButtonClassName = resetButtonClassName;
|
|
4658
|
-
exports.resizeObserverCtor = resizeObserverCtor;
|
|
4659
4605
|
exports.scrollbarClassName = scrollbarClassName;
|
|
4660
4606
|
exports.selectClassName = selectClassName;
|
|
4661
4607
|
exports.toast = sonner.toast;
|