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