@skygraph/react 0.5.2 → 0.6.4
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/README.md +70 -70
- package/dist/{Table-BmesoMje.d.ts → Table-CAay8MmA.d.ts} +8 -1
- package/dist/{Table-CpKMOH2x.d.cts → Table-CMKo6Pc3.d.cts} +8 -1
- package/dist/{chunk-ZJF6SJLP.js → chunk-45YW5VSP.js} +44 -10
- package/dist/chunk-45YW5VSP.js.map +1 -0
- package/dist/{chunk-NXB3VAVF.js → chunk-7AA2JPZB.js} +148 -61
- package/dist/chunk-7AA2JPZB.js.map +1 -0
- package/dist/{chunk-Z5UGF7EO.js → chunk-EFDB2ENB.js} +87 -25
- package/dist/chunk-EFDB2ENB.js.map +1 -0
- package/dist/{chunk-UO6VJC3C.js → chunk-KGFFQGCM.js} +3 -3
- package/dist/{chunk-FSV73JI4.js → chunk-PEX2UTNG.js} +2 -2
- package/dist/chunk-VLRLCHEL.js +184 -0
- package/dist/chunk-VLRLCHEL.js.map +1 -0
- package/dist/{chunk-MLEBVELO.js → chunk-Y6XZ5TLD.js} +93 -47
- package/dist/chunk-Y6XZ5TLD.js.map +1 -0
- package/dist/{chunk-GJDDPZH7.js → chunk-ZJC2QUWA.js} +12 -12
- package/dist/chunk-ZJC2QUWA.js.map +1 -0
- package/dist/datagrid.cjs +76 -21
- package/dist/datagrid.cjs.map +1 -1
- package/dist/datagrid.js +3 -3
- package/dist/devtools.cjs +11 -11
- package/dist/devtools.cjs.map +1 -1
- package/dist/devtools.js +1 -1
- package/dist/form.cjs +168 -86
- package/dist/form.cjs.map +1 -1
- package/dist/form.d.cts +1 -1
- package/dist/form.d.ts +1 -1
- package/dist/form.js +3 -3
- package/dist/index.cjs +1549 -1021
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +157 -7
- package/dist/index.d.ts +157 -7
- package/dist/index.js +444 -231
- package/dist/index.js.map +1 -1
- package/dist/table.cjs +344 -221
- package/dist/table.cjs.map +1 -1
- package/dist/table.d.cts +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +4 -4
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-2OCEO636.js +0 -91
- package/dist/chunk-2OCEO636.js.map +0 -1
- package/dist/chunk-GJDDPZH7.js.map +0 -1
- package/dist/chunk-MLEBVELO.js.map +0 -1
- package/dist/chunk-NXB3VAVF.js.map +0 -1
- package/dist/chunk-Z5UGF7EO.js.map +0 -1
- package/dist/chunk-ZJF6SJLP.js.map +0 -1
- /package/dist/{chunk-UO6VJC3C.js.map → chunk-KGFFQGCM.js.map} +0 -0
- /package/dist/{chunk-FSV73JI4.js.map → chunk-PEX2UTNG.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
zodRule,
|
|
23
23
|
zodRules,
|
|
24
24
|
zodToJsonSchema
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-Y6XZ5TLD.js";
|
|
26
26
|
import {
|
|
27
27
|
Pagination,
|
|
28
28
|
Select,
|
|
@@ -31,28 +31,30 @@ import {
|
|
|
31
31
|
buildPrintHtml,
|
|
32
32
|
printElement,
|
|
33
33
|
useTable
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7AA2JPZB.js";
|
|
35
35
|
import {
|
|
36
36
|
Button,
|
|
37
37
|
Input,
|
|
38
38
|
Transition
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-45YW5VSP.js";
|
|
40
40
|
import {
|
|
41
41
|
Tree,
|
|
42
42
|
TreeSelect,
|
|
43
43
|
useTree
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-KGFFQGCM.js";
|
|
45
45
|
import {
|
|
46
46
|
DataGrid
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-EFDB2ENB.js";
|
|
48
48
|
import {
|
|
49
49
|
Checkbox
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-PEX2UTNG.js";
|
|
51
51
|
import {
|
|
52
52
|
ConfigProvider,
|
|
53
53
|
Spin,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
buildThemeVars,
|
|
55
|
+
useConfig,
|
|
56
|
+
useConfigWithDefaults
|
|
57
|
+
} from "./chunk-VLRLCHEL.js";
|
|
56
58
|
import {
|
|
57
59
|
VirtualList
|
|
58
60
|
} from "./chunk-BNMJSYI2.js";
|
|
@@ -62,7 +64,7 @@ import {
|
|
|
62
64
|
import {
|
|
63
65
|
HistoryPanel,
|
|
64
66
|
useHistory
|
|
65
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-ZJC2QUWA.js";
|
|
66
68
|
|
|
67
69
|
// src/locales/en_US.ts
|
|
68
70
|
var en_US = {
|
|
@@ -131,6 +133,9 @@ var en_US = {
|
|
|
131
133
|
prevMonth: "Previous month",
|
|
132
134
|
nextMonth: "Next month"
|
|
133
135
|
},
|
|
136
|
+
input: {
|
|
137
|
+
clear: "Clear"
|
|
138
|
+
},
|
|
134
139
|
inputPassword: {
|
|
135
140
|
showPassword: "Show password",
|
|
136
141
|
hidePassword: "Hide password"
|
|
@@ -294,6 +299,9 @@ var ru_RU = {
|
|
|
294
299
|
prevMonth: "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446",
|
|
295
300
|
nextMonth: "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446"
|
|
296
301
|
},
|
|
302
|
+
input: {
|
|
303
|
+
clear: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C"
|
|
304
|
+
},
|
|
297
305
|
inputPassword: {
|
|
298
306
|
showPassword: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C",
|
|
299
307
|
hidePassword: "\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"
|
|
@@ -457,6 +465,9 @@ var zh_CN = {
|
|
|
457
465
|
prevMonth: "\u4E0A\u4E2A\u6708",
|
|
458
466
|
nextMonth: "\u4E0B\u4E2A\u6708"
|
|
459
467
|
},
|
|
468
|
+
input: {
|
|
469
|
+
clear: "\u6E05\u9664"
|
|
470
|
+
},
|
|
460
471
|
inputPassword: {
|
|
461
472
|
showPassword: "\u663E\u793A\u5BC6\u7801",
|
|
462
473
|
hidePassword: "\u9690\u85CF\u5BC6\u7801"
|
|
@@ -620,6 +631,9 @@ var de_DE = {
|
|
|
620
631
|
prevMonth: "Vorheriger Monat",
|
|
621
632
|
nextMonth: "N\xE4chster Monat"
|
|
622
633
|
},
|
|
634
|
+
input: {
|
|
635
|
+
clear: "Leeren"
|
|
636
|
+
},
|
|
623
637
|
inputPassword: {
|
|
624
638
|
showPassword: "Passwort anzeigen",
|
|
625
639
|
hidePassword: "Passwort verbergen"
|
|
@@ -783,6 +797,9 @@ var fr_FR = {
|
|
|
783
797
|
prevMonth: "Mois pr\xE9c\xE9dent",
|
|
784
798
|
nextMonth: "Mois suivant"
|
|
785
799
|
},
|
|
800
|
+
input: {
|
|
801
|
+
clear: "Effacer"
|
|
802
|
+
},
|
|
786
803
|
inputPassword: {
|
|
787
804
|
showPassword: "Afficher le mot de passe",
|
|
788
805
|
hidePassword: "Masquer le mot de passe"
|
|
@@ -946,6 +963,9 @@ var es_ES = {
|
|
|
946
963
|
prevMonth: "Mes anterior",
|
|
947
964
|
nextMonth: "Mes siguiente"
|
|
948
965
|
},
|
|
966
|
+
input: {
|
|
967
|
+
clear: "Limpiar"
|
|
968
|
+
},
|
|
949
969
|
inputPassword: {
|
|
950
970
|
showPassword: "Mostrar contrase\xF1a",
|
|
951
971
|
hidePassword: "Ocultar contrase\xF1a"
|
|
@@ -2063,7 +2083,9 @@ function Calendar(props) {
|
|
|
2063
2083
|
"span",
|
|
2064
2084
|
{
|
|
2065
2085
|
className: "sg-calendar-event-dot",
|
|
2066
|
-
style: {
|
|
2086
|
+
style: {
|
|
2087
|
+
backgroundColor: ev.color ?? "var(--sg-color-primary, #1677ff)"
|
|
2088
|
+
},
|
|
2067
2089
|
title: ev.title
|
|
2068
2090
|
},
|
|
2069
2091
|
ev.key ?? ei
|
|
@@ -2654,6 +2676,21 @@ function startOfDay(d) {
|
|
|
2654
2676
|
function cloneDate(d) {
|
|
2655
2677
|
return new Date(d.getTime());
|
|
2656
2678
|
}
|
|
2679
|
+
function startOfWeek(d) {
|
|
2680
|
+
const s = startOfDay(d);
|
|
2681
|
+
s.setDate(s.getDate() - s.getDay());
|
|
2682
|
+
return s;
|
|
2683
|
+
}
|
|
2684
|
+
function endOfWeek(d) {
|
|
2685
|
+
const e = startOfWeek(d);
|
|
2686
|
+
e.setDate(e.getDate() + 6);
|
|
2687
|
+
return e;
|
|
2688
|
+
}
|
|
2689
|
+
function getWeekOfYear(d) {
|
|
2690
|
+
const oneJan = new Date(d.getFullYear(), 0, 1);
|
|
2691
|
+
const dayOfYear = Math.floor((startOfDay(d).getTime() - startOfDay(oneJan).getTime()) / 864e5) + 1;
|
|
2692
|
+
return Math.ceil((dayOfYear + oneJan.getDay()) / 7);
|
|
2693
|
+
}
|
|
2657
2694
|
function toValidDate(input) {
|
|
2658
2695
|
if (input == null || input === "") return null;
|
|
2659
2696
|
if (input instanceof Date) return isNaN(input.getTime()) ? null : input;
|
|
@@ -3055,6 +3092,7 @@ function DatePicker({
|
|
|
3055
3092
|
const okBtnLabel = config.locale?.modal?.okText ?? "OK";
|
|
3056
3093
|
const timeConfig = typeof showTime === "object" ? showTime : {};
|
|
3057
3094
|
const hasTime = !!showTime;
|
|
3095
|
+
const isWeek = picker === "week";
|
|
3058
3096
|
const fmt = formatProp ?? (hasTime ? "YYYY-MM-DD HH:mm:ss" : picker === "month" ? "YYYY-MM" : picker === "year" ? "YYYY" : "YYYY-MM-DD");
|
|
3059
3097
|
const normalizedValue = toValidDate(value);
|
|
3060
3098
|
const normalizedDefault = toValidDate(defaultValue);
|
|
@@ -3204,7 +3242,8 @@ function DatePicker({
|
|
|
3204
3242
|
}
|
|
3205
3243
|
if (e.key === "Escape") closeDropdown();
|
|
3206
3244
|
};
|
|
3207
|
-
const
|
|
3245
|
+
const formatValue = (d) => isWeek ? `${d.getFullYear()}-W${String(getWeekOfYear(d)).padStart(2, "0")}` : formatDate(d, fmt);
|
|
3246
|
+
const displayText = isInputting ? inputText : currentValue ? formatValue(currentValue) : "";
|
|
3208
3247
|
const wrapperCls = unstyled ? className ?? "" : [
|
|
3209
3248
|
"sg-datepicker",
|
|
3210
3249
|
`sg-datepicker-${size}`,
|
|
@@ -3269,7 +3308,9 @@ function DatePicker({
|
|
|
3269
3308
|
{
|
|
3270
3309
|
viewYear,
|
|
3271
3310
|
viewMonth,
|
|
3272
|
-
selectedDate: currentValue,
|
|
3311
|
+
selectedDate: isWeek ? null : currentValue,
|
|
3312
|
+
rangeStart: isWeek && currentValue ? startOfWeek(currentValue) : void 0,
|
|
3313
|
+
rangeEnd: isWeek && currentValue ? endOfWeek(currentValue) : void 0,
|
|
3273
3314
|
disabledDate,
|
|
3274
3315
|
onSelect: handleDateSelect,
|
|
3275
3316
|
onMonthChange: (d) => {
|
|
@@ -3385,7 +3426,8 @@ function RangePicker({
|
|
|
3385
3426
|
const [internalOpen, setInternalOpen] = useState5(false);
|
|
3386
3427
|
const [activeIndex, setActiveIndex] = useState5(0);
|
|
3387
3428
|
const [hoverDate, setHoverDate] = useState5(null);
|
|
3388
|
-
const
|
|
3429
|
+
const [draft, setDraft] = useState5(null);
|
|
3430
|
+
const currentValue = draft ?? normalizedValue ?? internalValue;
|
|
3389
3431
|
const isOpen = openProp ?? internalOpen;
|
|
3390
3432
|
const now = /* @__PURE__ */ new Date();
|
|
3391
3433
|
const [leftYear, setLeftYear] = useState5(() => (currentValue[0] ?? now).getFullYear());
|
|
@@ -3402,6 +3444,8 @@ function RangePicker({
|
|
|
3402
3444
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
3403
3445
|
setInternalOpen(false);
|
|
3404
3446
|
onOpenChange?.(false);
|
|
3447
|
+
setDraft(null);
|
|
3448
|
+
setActiveIndex(0);
|
|
3405
3449
|
}
|
|
3406
3450
|
};
|
|
3407
3451
|
document.addEventListener("mousedown", handle);
|
|
@@ -3424,7 +3468,7 @@ function RangePicker({
|
|
|
3424
3468
|
};
|
|
3425
3469
|
const handleDateSelect = (date) => {
|
|
3426
3470
|
if (activeIndex === 0) {
|
|
3427
|
-
|
|
3471
|
+
setDraft([date, null]);
|
|
3428
3472
|
setActiveIndex(1);
|
|
3429
3473
|
} else {
|
|
3430
3474
|
let start = currentValue[0];
|
|
@@ -3438,9 +3482,10 @@ function RangePicker({
|
|
|
3438
3482
|
s.setHours(tempTimes[0].getHours(), tempTimes[0].getMinutes(), tempTimes[0].getSeconds());
|
|
3439
3483
|
const e = cloneDate(end);
|
|
3440
3484
|
e.setHours(tempTimes[1].getHours(), tempTimes[1].getMinutes(), tempTimes[1].getSeconds());
|
|
3441
|
-
|
|
3485
|
+
setDraft([s, e]);
|
|
3442
3486
|
} else {
|
|
3443
3487
|
commitRange([start, end]);
|
|
3488
|
+
setDraft(null);
|
|
3444
3489
|
setInternalOpen(false);
|
|
3445
3490
|
onOpenChange?.(false);
|
|
3446
3491
|
setActiveIndex(0);
|
|
@@ -3449,6 +3494,7 @@ function RangePicker({
|
|
|
3449
3494
|
};
|
|
3450
3495
|
const handleTimeOk = () => {
|
|
3451
3496
|
commitRange(currentValue);
|
|
3497
|
+
setDraft(null);
|
|
3452
3498
|
setInternalOpen(false);
|
|
3453
3499
|
onOpenChange?.(false);
|
|
3454
3500
|
setActiveIndex(0);
|
|
@@ -3456,6 +3502,7 @@ function RangePicker({
|
|
|
3456
3502
|
const handleClear = (e) => {
|
|
3457
3503
|
e.stopPropagation();
|
|
3458
3504
|
commitRange([null, null]);
|
|
3505
|
+
setDraft(null);
|
|
3459
3506
|
setActiveIndex(0);
|
|
3460
3507
|
};
|
|
3461
3508
|
const handlePresetSelect = (val) => {
|
|
@@ -3464,6 +3511,8 @@ function RangePicker({
|
|
|
3464
3511
|
} else {
|
|
3465
3512
|
commitRange([val, val]);
|
|
3466
3513
|
}
|
|
3514
|
+
setDraft(null);
|
|
3515
|
+
setActiveIndex(0);
|
|
3467
3516
|
setInternalOpen(false);
|
|
3468
3517
|
onOpenChange?.(false);
|
|
3469
3518
|
};
|
|
@@ -3757,12 +3806,18 @@ function TimePicker({
|
|
|
3757
3806
|
}, [secondStep]);
|
|
3758
3807
|
const disHours = useMemo4(() => new Set(disabledHours?.() ?? []), [disabledHours]);
|
|
3759
3808
|
const disMinutes = useMemo4(() => new Set(disabledMinutes?.(hour) ?? []), [disabledMinutes, hour]);
|
|
3760
|
-
const disSecs = useMemo4(
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3809
|
+
const disSecs = useMemo4(
|
|
3810
|
+
() => new Set(disabledSeconds?.(hour, minute) ?? []),
|
|
3811
|
+
[disabledSeconds, hour, minute]
|
|
3812
|
+
);
|
|
3813
|
+
const commitTime = useCallback5(
|
|
3814
|
+
(h, m, s) => {
|
|
3815
|
+
const str = formatTime(h, m, s, fmt, use12Hours);
|
|
3816
|
+
setInternalValue(str);
|
|
3817
|
+
onChange?.(str);
|
|
3818
|
+
},
|
|
3819
|
+
[fmt, use12Hours, onChange]
|
|
3820
|
+
);
|
|
3766
3821
|
const handleHourChange = (h) => {
|
|
3767
3822
|
const realH = use12Hours ? h === 12 ? hour >= 12 ? 12 : 0 : hour >= 12 ? h + 12 : h : h;
|
|
3768
3823
|
setHour(realH);
|
|
@@ -3817,10 +3872,26 @@ function TimePicker({
|
|
|
3817
3872
|
"aria-label": ariaLabel,
|
|
3818
3873
|
"aria-labelledby": ariaLabelledBy,
|
|
3819
3874
|
children: [
|
|
3820
|
-
/* @__PURE__ */ jsx9(
|
|
3875
|
+
/* @__PURE__ */ jsx9(
|
|
3876
|
+
"span",
|
|
3877
|
+
{
|
|
3878
|
+
className: unstyled ? "" : currentValue ? "sg-timepicker-value" : "sg-timepicker-placeholder",
|
|
3879
|
+
children: currentValue || placeholder
|
|
3880
|
+
}
|
|
3881
|
+
),
|
|
3821
3882
|
/* @__PURE__ */ jsx9("span", { className: unstyled ? "" : "sg-timepicker-suffix", children: loading ? /* @__PURE__ */ jsx9(Spin, { size: "small", unstyled }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
3822
3883
|
allowClear && currentValue && /* @__PURE__ */ jsx9("span", { className: unstyled ? "" : "sg-timepicker-clear", onClick: handleClear, children: "\xD7" }),
|
|
3823
|
-
/* @__PURE__ */ jsx9(
|
|
3884
|
+
/* @__PURE__ */ jsx9(
|
|
3885
|
+
"svg",
|
|
3886
|
+
{
|
|
3887
|
+
className: unstyled ? "" : "sg-timepicker-icon-svg",
|
|
3888
|
+
viewBox: "0 0 16 16",
|
|
3889
|
+
width: "14",
|
|
3890
|
+
height: "14",
|
|
3891
|
+
fill: "currentColor",
|
|
3892
|
+
children: /* @__PURE__ */ jsx9("path", { d: "M8 0a8 8 0 110 16A8 8 0 018 0zm0 1a7 7 0 100 14A7 7 0 008 1zm.5 3v4.5l3 1.5-.5 1-3.5-1.75V4h1z" })
|
|
3893
|
+
}
|
|
3894
|
+
)
|
|
3824
3895
|
] }) })
|
|
3825
3896
|
]
|
|
3826
3897
|
}
|
|
@@ -3918,7 +3989,9 @@ function TimeRangePicker({
|
|
|
3918
3989
|
const size = sizeProp ?? config.size ?? "middle";
|
|
3919
3990
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
3920
3991
|
const fmt = formatProp ?? (use12Hours ? "hh:mm:ss A" : showSecond ? "HH:mm:ss" : "HH:mm");
|
|
3921
|
-
const [internalValue, setInternalValue] = useState6(
|
|
3992
|
+
const [internalValue, setInternalValue] = useState6(
|
|
3993
|
+
value ?? defaultValue ?? ["", ""]
|
|
3994
|
+
);
|
|
3922
3995
|
const [internalOpen, setInternalOpen] = useState6(false);
|
|
3923
3996
|
const currentValue = value ?? internalValue;
|
|
3924
3997
|
const isOpen = openProp ?? internalOpen;
|
|
@@ -3963,12 +4036,19 @@ function TimeRangePicker({
|
|
|
3963
4036
|
className
|
|
3964
4037
|
].filter(Boolean).join(" ");
|
|
3965
4038
|
return /* @__PURE__ */ jsxs9("div", { className: wrapperCls, ref, style, children: [
|
|
3966
|
-
/* @__PURE__ */ jsxs9(
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
4039
|
+
/* @__PURE__ */ jsxs9(
|
|
4040
|
+
"div",
|
|
4041
|
+
{
|
|
4042
|
+
className: unstyled ? "" : "sg-timepicker-input sg-timepicker-range-input",
|
|
4043
|
+
onClick: openDropdown,
|
|
4044
|
+
children: [
|
|
4045
|
+
/* @__PURE__ */ jsx9("span", { children: currentValue[0] || placeholder[0] }),
|
|
4046
|
+
/* @__PURE__ */ jsx9("span", { className: unstyled ? "" : "sg-timepicker-separator", children: separator }),
|
|
4047
|
+
/* @__PURE__ */ jsx9("span", { children: currentValue[1] || placeholder[1] }),
|
|
4048
|
+
/* @__PURE__ */ jsx9("span", { className: unstyled ? "" : "sg-timepicker-suffix", children: allowClear && (currentValue[0] || currentValue[1]) && /* @__PURE__ */ jsx9("span", { className: unstyled ? "" : "sg-timepicker-clear", onClick: handleClear, children: "\xD7" }) })
|
|
4049
|
+
]
|
|
4050
|
+
}
|
|
4051
|
+
),
|
|
3972
4052
|
isOpen && /* @__PURE__ */ jsx9("div", { className: unstyled ? "" : "sg-tp-dropdown sg-tp-dropdown-range", children: /* @__PURE__ */ jsxs9("div", { className: unstyled ? "" : "sg-tp-range-panels", children: [
|
|
3973
4053
|
/* @__PURE__ */ jsx9(
|
|
3974
4054
|
TimePicker,
|
|
@@ -4033,9 +4113,7 @@ function AutoComplete({
|
|
|
4033
4113
|
const [open, setOpen] = useState7(false);
|
|
4034
4114
|
const ref = useRef6(null);
|
|
4035
4115
|
const currentValue = value ?? internalValue;
|
|
4036
|
-
const filtered = options.filter(
|
|
4037
|
-
(o) => o.label.toLowerCase().includes(currentValue.toLowerCase())
|
|
4038
|
-
);
|
|
4116
|
+
const filtered = options.filter((o) => o.label.toLowerCase().includes(currentValue.toLowerCase()));
|
|
4039
4117
|
useEffect8(() => {
|
|
4040
4118
|
const handleClickOutside = (e) => {
|
|
4041
4119
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
@@ -4056,7 +4134,12 @@ function AutoComplete({
|
|
|
4056
4134
|
onSelect?.(opt.value, opt);
|
|
4057
4135
|
setOpen(false);
|
|
4058
4136
|
};
|
|
4059
|
-
const wrapperClass = unstyled ? className ?? "" : [
|
|
4137
|
+
const wrapperClass = unstyled ? className ?? "" : [
|
|
4138
|
+
"sg-autocomplete",
|
|
4139
|
+
`sg-autocomplete-${size}`,
|
|
4140
|
+
loading ? "sg-autocomplete-loading" : "",
|
|
4141
|
+
className
|
|
4142
|
+
].filter(Boolean).join(" ");
|
|
4060
4143
|
return /* @__PURE__ */ jsxs10("div", { className: wrapperClass, ref, style, children: [
|
|
4061
4144
|
/* @__PURE__ */ jsxs10("span", { className: unstyled ? "" : "sg-input-wrapper", children: [
|
|
4062
4145
|
/* @__PURE__ */ jsx10(
|
|
@@ -4069,7 +4152,8 @@ function AutoComplete({
|
|
|
4069
4152
|
className: unstyled ? "" : `sg-input sg-input-${size}`,
|
|
4070
4153
|
value: currentValue,
|
|
4071
4154
|
placeholder,
|
|
4072
|
-
disabled
|
|
4155
|
+
disabled,
|
|
4156
|
+
"aria-busy": loading || void 0,
|
|
4073
4157
|
onChange: handleChange,
|
|
4074
4158
|
onFocus: () => setOpen(true),
|
|
4075
4159
|
onBlur
|
|
@@ -4270,15 +4354,21 @@ function Rate({
|
|
|
4270
4354
|
}
|
|
4271
4355
|
|
|
4272
4356
|
// src/components/ui/Upload.tsx
|
|
4273
|
-
import { useRef as useRef8 } from "react";
|
|
4274
|
-
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4357
|
+
import { useRef as useRef8, useState as useState8 } from "react";
|
|
4358
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4275
4359
|
function Upload({
|
|
4276
4360
|
accept,
|
|
4277
4361
|
multiple,
|
|
4278
4362
|
disabled: disabledProp,
|
|
4279
4363
|
loading,
|
|
4280
|
-
fileList
|
|
4364
|
+
fileList,
|
|
4281
4365
|
maxCount,
|
|
4366
|
+
maxSize,
|
|
4367
|
+
beforeUpload,
|
|
4368
|
+
customRequest,
|
|
4369
|
+
listType = "text",
|
|
4370
|
+
showUploadList = true,
|
|
4371
|
+
drag = false,
|
|
4282
4372
|
onUpload,
|
|
4283
4373
|
onRemove,
|
|
4284
4374
|
children,
|
|
@@ -4293,21 +4383,114 @@ function Upload({
|
|
|
4293
4383
|
const removeLabel = uploadLocale?.removeFile ?? "Remove file";
|
|
4294
4384
|
const uploadAriaLabel = uploadLocale?.uploadAriaLabel ?? "Upload file";
|
|
4295
4385
|
const inputRef = useRef8(null);
|
|
4386
|
+
const isControlled = fileList !== void 0;
|
|
4387
|
+
const [internalList, setInternalList] = useState8(fileList ?? []);
|
|
4388
|
+
const list = isControlled ? fileList : internalList;
|
|
4389
|
+
const [isDragging, setIsDragging] = useState8(false);
|
|
4390
|
+
const updateList = (next) => {
|
|
4391
|
+
if (!isControlled) {
|
|
4392
|
+
setInternalList((prev) => typeof next === "function" ? next(prev) : next);
|
|
4393
|
+
}
|
|
4394
|
+
};
|
|
4395
|
+
const patchFile = (uid, patch) => {
|
|
4396
|
+
updateList((prev) => prev.map((f) => f.uid === uid ? { ...f, ...patch } : f));
|
|
4397
|
+
};
|
|
4296
4398
|
const handleClick = () => {
|
|
4297
4399
|
if (disabled || loading) return;
|
|
4298
4400
|
inputRef.current?.click();
|
|
4299
4401
|
};
|
|
4300
|
-
const
|
|
4301
|
-
|
|
4402
|
+
const handleFiles = async (rawFiles) => {
|
|
4403
|
+
if (rawFiles.length === 0) return;
|
|
4404
|
+
const accepted = [];
|
|
4405
|
+
for (const file of rawFiles) {
|
|
4406
|
+
if (maxSize !== void 0 && file.size > maxSize) continue;
|
|
4407
|
+
if (beforeUpload) {
|
|
4408
|
+
const ok = await beforeUpload(file, rawFiles);
|
|
4409
|
+
if (ok === false) continue;
|
|
4410
|
+
}
|
|
4411
|
+
accepted.push(file);
|
|
4412
|
+
}
|
|
4413
|
+
if (accepted.length === 0) return;
|
|
4414
|
+
let trimmed = accepted;
|
|
4302
4415
|
if (maxCount) {
|
|
4303
|
-
const remaining = maxCount -
|
|
4304
|
-
|
|
4305
|
-
}
|
|
4306
|
-
|
|
4416
|
+
const remaining = maxCount - list.length;
|
|
4417
|
+
trimmed = accepted.slice(0, Math.max(0, remaining));
|
|
4418
|
+
}
|
|
4419
|
+
if (customRequest) {
|
|
4420
|
+
const newItems = trimmed.map((file) => ({
|
|
4421
|
+
uid: `sg-upl-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
4422
|
+
name: file.name,
|
|
4423
|
+
size: file.size,
|
|
4424
|
+
status: "uploading",
|
|
4425
|
+
percent: 0,
|
|
4426
|
+
type: file.type,
|
|
4427
|
+
raw: file
|
|
4428
|
+
}));
|
|
4429
|
+
updateList((prev) => [...prev, ...newItems]);
|
|
4430
|
+
for (const item of newItems) {
|
|
4431
|
+
if (!item.raw) continue;
|
|
4432
|
+
customRequest({
|
|
4433
|
+
file: item.raw,
|
|
4434
|
+
onProgress: (percent) => patchFile(item.uid, { percent }),
|
|
4435
|
+
onSuccess: () => patchFile(item.uid, { status: "done", percent: 100 }),
|
|
4436
|
+
onError: () => patchFile(item.uid, { status: "error" })
|
|
4437
|
+
});
|
|
4438
|
+
}
|
|
4307
4439
|
}
|
|
4440
|
+
onUpload?.(trimmed);
|
|
4441
|
+
};
|
|
4442
|
+
const handleChange = (e) => {
|
|
4443
|
+
const files = Array.from(e.target.files ?? []);
|
|
4444
|
+
void handleFiles(files);
|
|
4308
4445
|
if (inputRef.current) inputRef.current.value = "";
|
|
4309
4446
|
};
|
|
4310
|
-
const
|
|
4447
|
+
const handleDrop = (e) => {
|
|
4448
|
+
e.preventDefault();
|
|
4449
|
+
setIsDragging(false);
|
|
4450
|
+
if (disabled || loading) return;
|
|
4451
|
+
const files = Array.from(e.dataTransfer.files ?? []);
|
|
4452
|
+
void handleFiles(files);
|
|
4453
|
+
};
|
|
4454
|
+
const handleDragOver = (e) => {
|
|
4455
|
+
e.preventDefault();
|
|
4456
|
+
if (disabled || loading) return;
|
|
4457
|
+
setIsDragging(true);
|
|
4458
|
+
};
|
|
4459
|
+
const handleDragLeave = () => setIsDragging(false);
|
|
4460
|
+
const handleRemove = (file) => {
|
|
4461
|
+
updateList((prev) => prev.filter((f) => f.uid !== file.uid));
|
|
4462
|
+
onRemove?.(file);
|
|
4463
|
+
};
|
|
4464
|
+
const wrapperClass = unstyled ? className ?? "" : [
|
|
4465
|
+
"sg-upload",
|
|
4466
|
+
`sg-upload-${listType}`,
|
|
4467
|
+
drag ? "sg-upload-drag" : "sg-upload-select",
|
|
4468
|
+
disabled ? "sg-upload-disabled" : "",
|
|
4469
|
+
loading ? "sg-upload-loading" : "",
|
|
4470
|
+
isDragging ? "sg-upload-dragging" : "",
|
|
4471
|
+
className
|
|
4472
|
+
].filter(Boolean).join(" ");
|
|
4473
|
+
const renderTrigger = () => {
|
|
4474
|
+
if (drag) {
|
|
4475
|
+
return /* @__PURE__ */ jsx13(
|
|
4476
|
+
"div",
|
|
4477
|
+
{
|
|
4478
|
+
className: unstyled ? "" : "sg-upload-drag-area",
|
|
4479
|
+
role: "button",
|
|
4480
|
+
tabIndex: 0,
|
|
4481
|
+
onClick: handleClick,
|
|
4482
|
+
onDrop: handleDrop,
|
|
4483
|
+
onDragOver: handleDragOver,
|
|
4484
|
+
onDragLeave: handleDragLeave,
|
|
4485
|
+
children: children ?? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
4486
|
+
/* @__PURE__ */ jsx13("p", { className: unstyled ? "" : "sg-upload-drag-icon", children: "\u2B06" }),
|
|
4487
|
+
/* @__PURE__ */ jsx13("p", { className: unstyled ? "" : "sg-upload-drag-text", children: "Click or drag file to this area to upload" })
|
|
4488
|
+
] })
|
|
4489
|
+
}
|
|
4490
|
+
);
|
|
4491
|
+
}
|
|
4492
|
+
return /* @__PURE__ */ jsx13("div", { className: unstyled ? "" : "sg-upload-select-trigger", onClick: handleClick, children: children ?? /* @__PURE__ */ jsx13(Button, { disabled, loading, children: uploadText }) });
|
|
4493
|
+
};
|
|
4311
4494
|
return /* @__PURE__ */ jsxs12("div", { className: wrapperClass, style, children: [
|
|
4312
4495
|
/* @__PURE__ */ jsx13(
|
|
4313
4496
|
"input",
|
|
@@ -4321,8 +4504,8 @@ function Upload({
|
|
|
4321
4504
|
onChange: handleChange
|
|
4322
4505
|
}
|
|
4323
4506
|
),
|
|
4324
|
-
|
|
4325
|
-
|
|
4507
|
+
renderTrigger(),
|
|
4508
|
+
showUploadList && list.length > 0 && /* @__PURE__ */ jsx13("div", { className: unstyled ? "" : "sg-upload-list", children: list.map((file) => /* @__PURE__ */ jsxs12(
|
|
4326
4509
|
"div",
|
|
4327
4510
|
{
|
|
4328
4511
|
className: unstyled ? "" : ["sg-upload-item", `sg-upload-item-${file.status}`].filter(Boolean).join(" "),
|
|
@@ -4331,12 +4514,16 @@ function Upload({
|
|
|
4331
4514
|
file.status === "uploading" && /* @__PURE__ */ jsx13(Spin, { size: "small", unstyled }),
|
|
4332
4515
|
file.name
|
|
4333
4516
|
] }),
|
|
4517
|
+
file.status === "uploading" && /* @__PURE__ */ jsxs12("span", { className: unstyled ? "" : "sg-upload-item-progress", children: [
|
|
4518
|
+
file.percent ?? 0,
|
|
4519
|
+
"%"
|
|
4520
|
+
] }),
|
|
4334
4521
|
file.status !== "uploading" && /* @__PURE__ */ jsx13(
|
|
4335
4522
|
"button",
|
|
4336
4523
|
{
|
|
4337
4524
|
type: "button",
|
|
4338
4525
|
className: unstyled ? "" : "sg-upload-item-remove",
|
|
4339
|
-
onClick: () =>
|
|
4526
|
+
onClick: () => handleRemove(file),
|
|
4340
4527
|
"aria-label": `${removeLabel}: ${file.name}`,
|
|
4341
4528
|
children: "\xD7"
|
|
4342
4529
|
}
|
|
@@ -4349,7 +4536,7 @@ function Upload({
|
|
|
4349
4536
|
}
|
|
4350
4537
|
|
|
4351
4538
|
// src/components/ui/Notification.tsx
|
|
4352
|
-
import { useState as
|
|
4539
|
+
import { useState as useState9, useEffect as useEffect9, useRef as useRef9 } from "react";
|
|
4353
4540
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4354
4541
|
var listeners = /* @__PURE__ */ new Set();
|
|
4355
4542
|
var items = [];
|
|
@@ -4392,7 +4579,7 @@ function NotificationContainer({
|
|
|
4392
4579
|
placement = "topRight",
|
|
4393
4580
|
unstyled
|
|
4394
4581
|
}) {
|
|
4395
|
-
const [list, setList] =
|
|
4582
|
+
const [list, setList] = useState9([]);
|
|
4396
4583
|
const listenerRef = useRef9(void 0);
|
|
4397
4584
|
useEffect9(() => {
|
|
4398
4585
|
const fn = (newItems) => setList(newItems);
|
|
@@ -4434,32 +4621,53 @@ function NotificationCard({
|
|
|
4434
4621
|
const type = item.type ?? "info";
|
|
4435
4622
|
const closeAriaLabel = useConfig().locale?.notification?.closeAriaLabel ?? "Close";
|
|
4436
4623
|
if (unstyled) {
|
|
4437
|
-
return /* @__PURE__ */ jsxs13("div", { role: "alert", children: [
|
|
4624
|
+
return /* @__PURE__ */ jsxs13("div", { role: "alert", className: item.className, style: item.style, children: [
|
|
4438
4625
|
/* @__PURE__ */ jsx14("span", { children: typeIcons[type] }),
|
|
4439
4626
|
/* @__PURE__ */ jsx14("span", { children: item.message }),
|
|
4440
4627
|
item.description && /* @__PURE__ */ jsx14("div", { children: item.description }),
|
|
4441
4628
|
/* @__PURE__ */ jsx14("button", { onClick: onClose, "aria-label": closeAriaLabel, children: "\xD7" })
|
|
4442
4629
|
] });
|
|
4443
4630
|
}
|
|
4444
|
-
return /* @__PURE__ */ jsxs13(
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4631
|
+
return /* @__PURE__ */ jsxs13(
|
|
4632
|
+
"div",
|
|
4633
|
+
{
|
|
4634
|
+
className: ["sg-notification", `sg-notification-${type}`, item.className].filter(Boolean).join(" "),
|
|
4635
|
+
style: item.style,
|
|
4636
|
+
role: "alert",
|
|
4637
|
+
children: [
|
|
4638
|
+
/* @__PURE__ */ jsx14("div", { className: "sg-notification-icon", children: typeIcons[type] }),
|
|
4639
|
+
/* @__PURE__ */ jsxs13("div", { className: "sg-notification-content", children: [
|
|
4640
|
+
/* @__PURE__ */ jsx14("div", { className: "sg-notification-message", children: item.message }),
|
|
4641
|
+
item.description && /* @__PURE__ */ jsx14("div", { className: "sg-notification-description", children: item.description })
|
|
4642
|
+
] }),
|
|
4643
|
+
/* @__PURE__ */ jsx14("button", { className: "sg-notification-close", onClick: onClose, "aria-label": closeAriaLabel, children: "\xD7" })
|
|
4644
|
+
]
|
|
4645
|
+
}
|
|
4646
|
+
);
|
|
4452
4647
|
}
|
|
4453
4648
|
|
|
4454
4649
|
// src/components/ui/Drawer.tsx
|
|
4455
|
-
import { useEffect as useEffect10, useCallback as useCallback7, useId as useId2 } from "react";
|
|
4456
|
-
import {
|
|
4650
|
+
import { useEffect as useEffect10, useCallback as useCallback7, useId as useId2, useRef as useRef10 } from "react";
|
|
4651
|
+
import { createPortal } from "react-dom";
|
|
4652
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4457
4653
|
var PLACEMENT_TRANSITION = {
|
|
4458
4654
|
left: "sg-slide-left",
|
|
4459
4655
|
right: "sg-slide-right",
|
|
4460
4656
|
top: "sg-slide-down",
|
|
4461
4657
|
bottom: "sg-slide-up"
|
|
4462
4658
|
};
|
|
4659
|
+
function getScopedCssVars(scope) {
|
|
4660
|
+
if (!scope || typeof window === "undefined") return {};
|
|
4661
|
+
const computed = window.getComputedStyle(scope);
|
|
4662
|
+
const vars = {};
|
|
4663
|
+
for (let i = 0; i < computed.length; i += 1) {
|
|
4664
|
+
const name = computed.item(i);
|
|
4665
|
+
if (name.startsWith("--sg-")) {
|
|
4666
|
+
vars[name] = computed.getPropertyValue(name);
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
return vars;
|
|
4670
|
+
}
|
|
4463
4671
|
function Drawer({
|
|
4464
4672
|
open,
|
|
4465
4673
|
onClose,
|
|
@@ -4480,6 +4688,7 @@ function Drawer({
|
|
|
4480
4688
|
const titleId = `${uid}-title`;
|
|
4481
4689
|
const bodyId = `${uid}-body`;
|
|
4482
4690
|
const trapRef = useFocusTrap(open);
|
|
4691
|
+
const scopeRef = useRef10(null);
|
|
4483
4692
|
const { locale } = useConfig();
|
|
4484
4693
|
const closeAriaLabel = locale?.drawer?.closeAriaLabel ?? "Close";
|
|
4485
4694
|
const handleKeyDown = useCallback7(
|
|
@@ -4517,7 +4726,8 @@ function Drawer({
|
|
|
4517
4726
|
);
|
|
4518
4727
|
}
|
|
4519
4728
|
const transitionName = PLACEMENT_TRANSITION[placement] ?? "sg-slide-right";
|
|
4520
|
-
|
|
4729
|
+
const portalTarget = typeof document !== "undefined" ? document.body : null;
|
|
4730
|
+
const drawer = /* @__PURE__ */ jsx15(Transition, { visible: open, name: "sg-fade", unmountOnExit: true, duration: 300, children: /* @__PURE__ */ jsxs14("div", { className: "sg-drawer-root", style: getScopedCssVars(scopeRef.current), children: [
|
|
4521
4731
|
mask && /* @__PURE__ */ jsx15("div", { className: "sg-drawer-mask", onClick: maskClosable ? onClose : void 0 }),
|
|
4522
4732
|
/* @__PURE__ */ jsx15(Transition, { visible: open, name: transitionName, unmountOnExit: true, duration: 300, children: /* @__PURE__ */ jsxs14(
|
|
4523
4733
|
"div",
|
|
@@ -4549,10 +4759,14 @@ function Drawer({
|
|
|
4549
4759
|
}
|
|
4550
4760
|
) })
|
|
4551
4761
|
] }) });
|
|
4762
|
+
return /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4763
|
+
/* @__PURE__ */ jsx15("span", { ref: scopeRef, hidden: true }),
|
|
4764
|
+
portalTarget ? createPortal(drawer, portalTarget) : drawer
|
|
4765
|
+
] });
|
|
4552
4766
|
}
|
|
4553
4767
|
|
|
4554
4768
|
// src/components/ui/Popconfirm.tsx
|
|
4555
|
-
import { useState as
|
|
4769
|
+
import { useState as useState10, useRef as useRef11, useEffect as useEffect11, useId as useId3 } from "react";
|
|
4556
4770
|
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4557
4771
|
function Popconfirm({
|
|
4558
4772
|
title,
|
|
@@ -4570,8 +4784,8 @@ function Popconfirm({
|
|
|
4570
4784
|
const popconfirmLocale = useConfig().locale?.popconfirm;
|
|
4571
4785
|
const okText = okTextProp ?? popconfirmLocale?.okText ?? "Yes";
|
|
4572
4786
|
const cancelText = cancelTextProp ?? popconfirmLocale?.cancelText ?? "No";
|
|
4573
|
-
const [open, setOpen] =
|
|
4574
|
-
const ref =
|
|
4787
|
+
const [open, setOpen] = useState10(false);
|
|
4788
|
+
const ref = useRef11(null);
|
|
4575
4789
|
const trapRef = useFocusTrap(open);
|
|
4576
4790
|
const popconfirmId = useId3();
|
|
4577
4791
|
useEffect11(() => {
|
|
@@ -4842,7 +5056,7 @@ function Breadcrumb({
|
|
|
4842
5056
|
}
|
|
4843
5057
|
|
|
4844
5058
|
// src/components/ui/Dropdown.tsx
|
|
4845
|
-
import { useState as
|
|
5059
|
+
import { useState as useState11, useRef as useRef12, useEffect as useEffect12, useId as useId4 } from "react";
|
|
4846
5060
|
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4847
5061
|
function Dropdown({
|
|
4848
5062
|
items: items2,
|
|
@@ -4856,10 +5070,10 @@ function Dropdown({
|
|
|
4856
5070
|
}) {
|
|
4857
5071
|
const config = useConfig();
|
|
4858
5072
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
4859
|
-
const [open, setOpen] =
|
|
4860
|
-
const [focusedIndex, setFocusedIndex] =
|
|
4861
|
-
const ref =
|
|
4862
|
-
const timerRef =
|
|
5073
|
+
const [open, setOpen] = useState11(false);
|
|
5074
|
+
const [focusedIndex, setFocusedIndex] = useState11(-1);
|
|
5075
|
+
const ref = useRef12(null);
|
|
5076
|
+
const timerRef = useRef12(void 0);
|
|
4863
5077
|
const menuId = useId4();
|
|
4864
5078
|
useEffect12(() => {
|
|
4865
5079
|
if (!open) return;
|
|
@@ -5131,7 +5345,7 @@ function Progress({
|
|
|
5131
5345
|
}
|
|
5132
5346
|
|
|
5133
5347
|
// src/components/ui/Menu.tsx
|
|
5134
|
-
import { useState as
|
|
5348
|
+
import { useState as useState12, useRef as useRef13, useEffect as useEffect13, useCallback as useCallback8 } from "react";
|
|
5135
5349
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5136
5350
|
function collectNavigableItems(items2, openKeys, mode, out = []) {
|
|
5137
5351
|
for (const item of items2) {
|
|
@@ -5184,18 +5398,18 @@ function Menu({
|
|
|
5184
5398
|
style,
|
|
5185
5399
|
unstyled
|
|
5186
5400
|
}) {
|
|
5187
|
-
const [internalSelected, setInternalSelected] =
|
|
5401
|
+
const [internalSelected, setInternalSelected] = useState12(
|
|
5188
5402
|
selectedKeys ?? defaultSelectedKeys
|
|
5189
5403
|
);
|
|
5190
|
-
const [internalOpen, setInternalOpen] =
|
|
5404
|
+
const [internalOpen, setInternalOpen] = useState12(
|
|
5191
5405
|
openKeys ?? defaultOpenKeys
|
|
5192
5406
|
);
|
|
5193
|
-
const rootRef =
|
|
5407
|
+
const rootRef = useRef13(null);
|
|
5194
5408
|
const currentSelected = selectedKeys ?? internalSelected;
|
|
5195
5409
|
const currentOpen = openKeys ?? internalOpen;
|
|
5196
5410
|
const navigable = collectNavigableItems(items2, currentOpen, mode);
|
|
5197
5411
|
const initialActive = currentSelected.find((k) => navigable.some((n) => n.key === k)) ?? navigable[0]?.key ?? "";
|
|
5198
|
-
const [activeKey, setActiveKey] =
|
|
5412
|
+
const [activeKey, setActiveKey] = useState12(initialActive);
|
|
5199
5413
|
useEffect13(() => {
|
|
5200
5414
|
if (!activeKey || !navigable.some((n) => n.key === activeKey)) {
|
|
5201
5415
|
setActiveKey(navigable[0]?.key ?? "");
|
|
@@ -5466,9 +5680,9 @@ function StyledMenuItem({
|
|
|
5466
5680
|
inlineCollapsed,
|
|
5467
5681
|
depth
|
|
5468
5682
|
}) {
|
|
5469
|
-
const popoverRef =
|
|
5470
|
-
const [hoverOpen, setHoverOpen] =
|
|
5471
|
-
const timerRef =
|
|
5683
|
+
const popoverRef = useRef13(null);
|
|
5684
|
+
const [hoverOpen, setHoverOpen] = useState12(false);
|
|
5685
|
+
const timerRef = useRef13(void 0);
|
|
5472
5686
|
useEffect13(() => {
|
|
5473
5687
|
return () => clearTimeout(timerRef.current);
|
|
5474
5688
|
}, []);
|
|
@@ -5616,7 +5830,7 @@ function StyledMenuItem({
|
|
|
5616
5830
|
}
|
|
5617
5831
|
|
|
5618
5832
|
// src/components/ui/Collapse.tsx
|
|
5619
|
-
import { useState as
|
|
5833
|
+
import { useState as useState13, useRef as useRef14, useEffect as useEffect14 } from "react";
|
|
5620
5834
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5621
5835
|
function toArray(val) {
|
|
5622
5836
|
if (val === void 0) return [];
|
|
@@ -5638,7 +5852,7 @@ function Collapse({
|
|
|
5638
5852
|
}) {
|
|
5639
5853
|
const config = useConfig();
|
|
5640
5854
|
const size = sizeProp ?? config.size ?? "middle";
|
|
5641
|
-
const [internalActive, setInternalActive] =
|
|
5855
|
+
const [internalActive, setInternalActive] = useState13(
|
|
5642
5856
|
toArray(activeKey ?? defaultActiveKey)
|
|
5643
5857
|
);
|
|
5644
5858
|
const currentActive = activeKey !== void 0 ? toArray(activeKey) : internalActive;
|
|
@@ -5702,9 +5916,9 @@ function CollapsePanel({
|
|
|
5702
5916
|
expandIconPosition,
|
|
5703
5917
|
onToggle
|
|
5704
5918
|
}) {
|
|
5705
|
-
const contentRef =
|
|
5706
|
-
const [height, setHeight] =
|
|
5707
|
-
const firstRender =
|
|
5919
|
+
const contentRef = useRef14(null);
|
|
5920
|
+
const [height, setHeight] = useState13(void 0);
|
|
5921
|
+
const firstRender = useRef14(true);
|
|
5708
5922
|
useEffect14(() => {
|
|
5709
5923
|
if (firstRender.current) {
|
|
5710
5924
|
firstRender.current = false;
|
|
@@ -5779,8 +5993,8 @@ function CollapsePanel({
|
|
|
5779
5993
|
|
|
5780
5994
|
// src/components/ui/ColorPicker.tsx
|
|
5781
5995
|
import {
|
|
5782
|
-
useState as
|
|
5783
|
-
useRef as
|
|
5996
|
+
useState as useState14,
|
|
5997
|
+
useRef as useRef15,
|
|
5784
5998
|
useEffect as useEffect15,
|
|
5785
5999
|
useCallback as useCallback9
|
|
5786
6000
|
} from "react";
|
|
@@ -5912,22 +6126,22 @@ function ColorPicker({
|
|
|
5912
6126
|
const config = useConfig();
|
|
5913
6127
|
const size = sizeProp ?? config.size ?? "middle";
|
|
5914
6128
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
5915
|
-
const [internalColor, setInternalColor] =
|
|
6129
|
+
const [internalColor, setInternalColor] = useState14(
|
|
5916
6130
|
value ?? defaultValue ?? DEFAULT_COLOR
|
|
5917
6131
|
);
|
|
5918
6132
|
const currentHex = (value ?? internalColor).toLowerCase();
|
|
5919
|
-
const [hsv, setHsv] =
|
|
6133
|
+
const [hsv, setHsv] = useState14(() => {
|
|
5920
6134
|
const [r, g, b] = hexToRgb(currentHex);
|
|
5921
6135
|
return rgbToHsv(r, g, b);
|
|
5922
6136
|
});
|
|
5923
|
-
const [internalOpen, setInternalOpen] =
|
|
6137
|
+
const [internalOpen, setInternalOpen] = useState14(false);
|
|
5924
6138
|
const isOpen = controlledOpen ?? internalOpen;
|
|
5925
|
-
const [textInput, setTextInput] =
|
|
5926
|
-
const wrapperRef =
|
|
5927
|
-
const timerRef =
|
|
5928
|
-
const satPanelRef =
|
|
5929
|
-
const hueBarRef =
|
|
5930
|
-
const draggingRef =
|
|
6139
|
+
const [textInput, setTextInput] = useState14(formatColor(currentHex, format));
|
|
6140
|
+
const wrapperRef = useRef15(null);
|
|
6141
|
+
const timerRef = useRef15(void 0);
|
|
6142
|
+
const satPanelRef = useRef15(null);
|
|
6143
|
+
const hueBarRef = useRef15(null);
|
|
6144
|
+
const draggingRef = useRef15(null);
|
|
5931
6145
|
useEffect15(() => {
|
|
5932
6146
|
if (value) {
|
|
5933
6147
|
const [r, g, b] = hexToRgb(value);
|
|
@@ -6205,7 +6419,7 @@ function ColorPicker({
|
|
|
6205
6419
|
}
|
|
6206
6420
|
|
|
6207
6421
|
// src/components/ui/Empty.tsx
|
|
6208
|
-
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6422
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6209
6423
|
var DefaultImage = () => /* @__PURE__ */ jsx26("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs24("g", { fill: "none", fillRule: "evenodd", transform: "translate(0 1)", children: [
|
|
6210
6424
|
/* @__PURE__ */ jsx26("ellipse", { cx: "32", cy: "33", rx: "32", ry: "7", fill: "currentColor", opacity: "0.08" }),
|
|
6211
6425
|
/* @__PURE__ */ jsxs24("g", { fillRule: "nonzero", stroke: "currentColor", strokeOpacity: "0.25", children: [
|
|
@@ -6220,15 +6434,12 @@ var DefaultImage = () => /* @__PURE__ */ jsx26("svg", { width: "64", height: "41
|
|
|
6220
6434
|
)
|
|
6221
6435
|
] })
|
|
6222
6436
|
] }) });
|
|
6223
|
-
function Empty({
|
|
6224
|
-
|
|
6225
|
-
description
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
unstyled
|
|
6230
|
-
}) {
|
|
6231
|
-
const localeDefault = useConfig().locale?.empty?.description ?? "No Data";
|
|
6437
|
+
function Empty({ image, description, children, className, style, unstyled }) {
|
|
6438
|
+
const config = useConfig();
|
|
6439
|
+
if (config.renderEmpty && image === void 0 && description === void 0 && children === void 0) {
|
|
6440
|
+
return /* @__PURE__ */ jsx26(Fragment6, { children: config.renderEmpty("Empty") });
|
|
6441
|
+
}
|
|
6442
|
+
const localeDefault = config.locale?.empty?.description ?? "No Data";
|
|
6232
6443
|
const desc = description === void 0 ? localeDefault : description;
|
|
6233
6444
|
if (unstyled) {
|
|
6234
6445
|
return /* @__PURE__ */ jsxs24("div", { className, style, role: "status", children: [
|
|
@@ -6304,7 +6515,7 @@ function Result({
|
|
|
6304
6515
|
}
|
|
6305
6516
|
|
|
6306
6517
|
// src/components/ui/Skeleton.tsx
|
|
6307
|
-
import { Fragment as
|
|
6518
|
+
import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6308
6519
|
function Skeleton({
|
|
6309
6520
|
active = false,
|
|
6310
6521
|
avatar,
|
|
@@ -6317,7 +6528,7 @@ function Skeleton({
|
|
|
6317
6528
|
unstyled
|
|
6318
6529
|
}) {
|
|
6319
6530
|
const loadingLabel = useConfig().locale?.skeleton?.loading ?? "Loading";
|
|
6320
|
-
if (!loading) return /* @__PURE__ */ jsx28(
|
|
6531
|
+
if (!loading) return /* @__PURE__ */ jsx28(Fragment7, { children });
|
|
6321
6532
|
const avatarSize = typeof avatar === "object" ? avatar.size ?? 40 : 40;
|
|
6322
6533
|
const avatarShape = typeof avatar === "object" ? avatar.shape ?? "circle" : "circle";
|
|
6323
6534
|
const titleWidth = typeof title === "object" ? title.width ?? "38%" : "38%";
|
|
@@ -6376,7 +6587,7 @@ function Skeleton({
|
|
|
6376
6587
|
}
|
|
6377
6588
|
|
|
6378
6589
|
// src/components/ui/Segmented.tsx
|
|
6379
|
-
import { useState as
|
|
6590
|
+
import { useState as useState15 } from "react";
|
|
6380
6591
|
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6381
6592
|
function normalizeOption(opt) {
|
|
6382
6593
|
if (typeof opt === "string") return { label: opt, value: opt };
|
|
@@ -6398,7 +6609,7 @@ function Segmented({
|
|
|
6398
6609
|
const size = sizeProp ?? config.size ?? "middle";
|
|
6399
6610
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
6400
6611
|
const normalized = options.map(normalizeOption);
|
|
6401
|
-
const [internalValue, setInternalValue] =
|
|
6612
|
+
const [internalValue, setInternalValue] = useState15(
|
|
6402
6613
|
value ?? defaultValue ?? normalized[0]?.value ?? ""
|
|
6403
6614
|
);
|
|
6404
6615
|
const currentValue = value ?? internalValue;
|
|
@@ -6621,7 +6832,7 @@ function Timeline({
|
|
|
6621
6832
|
}
|
|
6622
6833
|
|
|
6623
6834
|
// src/components/ui/Carousel.tsx
|
|
6624
|
-
import { useState as
|
|
6835
|
+
import { useState as useState16, useEffect as useEffect16, useCallback as useCallback10, Children } from "react";
|
|
6625
6836
|
import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6626
6837
|
function Carousel({
|
|
6627
6838
|
autoplay = false,
|
|
@@ -6636,7 +6847,7 @@ function Carousel({
|
|
|
6636
6847
|
}) {
|
|
6637
6848
|
const slides = Children.toArray(children);
|
|
6638
6849
|
const count = slides.length;
|
|
6639
|
-
const [current, setCurrent] =
|
|
6850
|
+
const [current, setCurrent] = useState16(0);
|
|
6640
6851
|
const slideLabel = useConfig().locale?.carousel?.slide ?? ((index) => `Slide ${index}`);
|
|
6641
6852
|
const goTo = useCallback10(
|
|
6642
6853
|
(index) => {
|
|
@@ -6804,10 +7015,10 @@ function Descriptions({
|
|
|
6804
7015
|
}
|
|
6805
7016
|
|
|
6806
7017
|
// src/components/complex/SchemaFormEditor/SchemaFormEditor.tsx
|
|
6807
|
-
import { useEffect as useEffect17, useMemo as useMemo9, useState as
|
|
7018
|
+
import { useEffect as useEffect17, useMemo as useMemo9, useState as useState18 } from "react";
|
|
6808
7019
|
|
|
6809
7020
|
// src/components/complex/SchemaFormEditor/useSchemaEditor.ts
|
|
6810
|
-
import { useCallback as useCallback11, useMemo as useMemo5, useRef as
|
|
7021
|
+
import { useCallback as useCallback11, useMemo as useMemo5, useRef as useRef16, useSyncExternalStore } from "react";
|
|
6811
7022
|
import { createCore } from "@skygraph/core";
|
|
6812
7023
|
|
|
6813
7024
|
// src/components/complex/SchemaFormEditor/adapters/jsonSchema.ts
|
|
@@ -6991,9 +7202,9 @@ function cloneSchema(schema) {
|
|
|
6991
7202
|
}
|
|
6992
7203
|
function useSchemaEditor(options = {}) {
|
|
6993
7204
|
const { initialSchema, onChange } = options;
|
|
6994
|
-
const onChangeRef =
|
|
7205
|
+
const onChangeRef = useRef16(onChange);
|
|
6995
7206
|
onChangeRef.current = onChange;
|
|
6996
|
-
const storeRef =
|
|
7207
|
+
const storeRef = useRef16(null);
|
|
6997
7208
|
if (storeRef.current === null) {
|
|
6998
7209
|
const core = options.core ?? createCore();
|
|
6999
7210
|
const initial = {
|
|
@@ -7315,8 +7526,8 @@ function SchemaFormEditorPalette({
|
|
|
7315
7526
|
}
|
|
7316
7527
|
|
|
7317
7528
|
// src/components/complex/SchemaFormEditor/SchemaFormEditorCanvas.tsx
|
|
7318
|
-
import { useCallback as useCallback12, useMemo as useMemo6, useRef as
|
|
7319
|
-
import { Fragment as
|
|
7529
|
+
import { useCallback as useCallback12, useMemo as useMemo6, useRef as useRef17, useState as useState17 } from "react";
|
|
7530
|
+
import { Fragment as Fragment8, jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7320
7531
|
function SchemaFormEditorCanvas({
|
|
7321
7532
|
store,
|
|
7322
7533
|
emptyText = "Drop a field here",
|
|
@@ -7342,8 +7553,8 @@ function SchemaFormEditorCanvas({
|
|
|
7342
7553
|
() => fields.map((f) => `${f.id}:${f.name}:${f.type}:${String(f.defaultValue ?? "")}`).join("|"),
|
|
7343
7554
|
[fields]
|
|
7344
7555
|
);
|
|
7345
|
-
const [dropIndicator, setDropIndicator] =
|
|
7346
|
-
const dragRef =
|
|
7556
|
+
const [dropIndicator, setDropIndicator] = useState17(null);
|
|
7557
|
+
const dragRef = useRef17(null);
|
|
7347
7558
|
function handleDragOver(e) {
|
|
7348
7559
|
if (e.dataTransfer.types.includes(PALETTE_DATA_TYPE) || e.dataTransfer.types.includes("text/plain") || dragRef.current !== null) {
|
|
7349
7560
|
e.preventDefault();
|
|
@@ -7494,7 +7705,7 @@ function FieldOverlay({
|
|
|
7494
7705
|
function handleDragLeave() {
|
|
7495
7706
|
onIndicator(null);
|
|
7496
7707
|
}
|
|
7497
|
-
return /* @__PURE__ */ jsxs33(
|
|
7708
|
+
return /* @__PURE__ */ jsxs33(Fragment8, { children: [
|
|
7498
7709
|
showIndicator && /* @__PURE__ */ jsx35("div", { className: "sg-sfe-canvas-drop-indicator", "data-testid": "sfe-drop-indicator" }),
|
|
7499
7710
|
/* @__PURE__ */ jsxs33(
|
|
7500
7711
|
"div",
|
|
@@ -7877,7 +8088,7 @@ function SchemaFormEditor({
|
|
|
7877
8088
|
const internalOptions = { initialSchema, onChange };
|
|
7878
8089
|
const internalStore = useSchemaEditor(internalOptions);
|
|
7879
8090
|
const store = externalStore ?? internalStore;
|
|
7880
|
-
const [bottomTab, setBottomTab] =
|
|
8091
|
+
const [bottomTab, setBottomTab] = useState18("preview");
|
|
7881
8092
|
useEffect17(() => {
|
|
7882
8093
|
function onKey(e) {
|
|
7883
8094
|
const target = e.target;
|
|
@@ -7996,7 +8207,7 @@ function PreviewPane({ store }) {
|
|
|
7996
8207
|
import { createVirtual, createMeasureCache } from "@skygraph/core";
|
|
7997
8208
|
|
|
7998
8209
|
// src/hooks/useGraph.ts
|
|
7999
|
-
import { useMemo as useMemo10, useRef as
|
|
8210
|
+
import { useMemo as useMemo10, useRef as useRef18, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
8000
8211
|
import { createCore as createCore2, createGraph } from "@skygraph/core";
|
|
8001
8212
|
function useGraph(options = {}) {
|
|
8002
8213
|
const { core: externalCore, ...graphOptions } = options;
|
|
@@ -8005,7 +8216,7 @@ function useGraph(options = {}) {
|
|
|
8005
8216
|
const g = createGraph(c, graphOptions);
|
|
8006
8217
|
return { graph: g, core: c };
|
|
8007
8218
|
}, [externalCore]);
|
|
8008
|
-
const snapshotRef =
|
|
8219
|
+
const snapshotRef = useRef18(null);
|
|
8009
8220
|
if (snapshotRef.current === null) {
|
|
8010
8221
|
snapshotRef.current = graph.getState();
|
|
8011
8222
|
}
|
|
@@ -8027,8 +8238,8 @@ import {
|
|
|
8027
8238
|
useEffect as useEffect18,
|
|
8028
8239
|
useImperativeHandle,
|
|
8029
8240
|
useMemo as useMemo11,
|
|
8030
|
-
useRef as
|
|
8031
|
-
useState as
|
|
8241
|
+
useRef as useRef19,
|
|
8242
|
+
useState as useState19
|
|
8032
8243
|
} from "react";
|
|
8033
8244
|
import {
|
|
8034
8245
|
routeOrthogonal,
|
|
@@ -8288,15 +8499,15 @@ function DiagramInner({
|
|
|
8288
8499
|
nodes.forEach((n, i) => m.set(n.id, allBounds[i]));
|
|
8289
8500
|
return m;
|
|
8290
8501
|
}, [nodes, allBounds]);
|
|
8291
|
-
const [view, setView] =
|
|
8292
|
-
const wrapperRef =
|
|
8502
|
+
const [view, setView] = useState19({ zoom: 1, panX: 0, panY: 0 });
|
|
8503
|
+
const wrapperRef = useRef19(null);
|
|
8293
8504
|
const isSelectionControlled = selection !== void 0;
|
|
8294
|
-
const [internalSelection, setInternalSelection] =
|
|
8505
|
+
const [internalSelection, setInternalSelection] = useState19(
|
|
8295
8506
|
() => defaultSelection ?? []
|
|
8296
8507
|
);
|
|
8297
8508
|
const currentSelection = isSelectionControlled ? selection : internalSelection;
|
|
8298
8509
|
const selectionSet = useMemo11(() => new Set(currentSelection), [currentSelection]);
|
|
8299
|
-
const onSelectionChangeRef =
|
|
8510
|
+
const onSelectionChangeRef = useRef19(onSelectionChange);
|
|
8300
8511
|
useEffect18(() => {
|
|
8301
8512
|
onSelectionChangeRef.current = onSelectionChange;
|
|
8302
8513
|
}, [onSelectionChange]);
|
|
@@ -8353,8 +8564,8 @@ function DiagramInner({
|
|
|
8353
8564
|
width: "100%",
|
|
8354
8565
|
height: "100%"
|
|
8355
8566
|
};
|
|
8356
|
-
const dragRef =
|
|
8357
|
-
const [draggingId, setDraggingId] =
|
|
8567
|
+
const dragRef = useRef19(null);
|
|
8568
|
+
const [draggingId, setDraggingId] = useState19(null);
|
|
8358
8569
|
const DRAG_THRESHOLD_PX = 0.5;
|
|
8359
8570
|
function applyMove(id, x, y) {
|
|
8360
8571
|
let nx = x;
|
|
@@ -8467,17 +8678,17 @@ function DiagramInner({
|
|
|
8467
8678
|
}));
|
|
8468
8679
|
}
|
|
8469
8680
|
}
|
|
8470
|
-
const [lasso, setLasso] =
|
|
8471
|
-
const lassoRef =
|
|
8472
|
-
const boundsByIdRef =
|
|
8681
|
+
const [lasso, setLasso] = useState19(null);
|
|
8682
|
+
const lassoRef = useRef19(null);
|
|
8683
|
+
const boundsByIdRef = useRef19(boundsById);
|
|
8473
8684
|
useEffect18(() => {
|
|
8474
8685
|
boundsByIdRef.current = boundsById;
|
|
8475
8686
|
}, [boundsById]);
|
|
8476
|
-
const viewRef =
|
|
8687
|
+
const viewRef = useRef19(view);
|
|
8477
8688
|
useEffect18(() => {
|
|
8478
8689
|
viewRef.current = view;
|
|
8479
8690
|
}, [view]);
|
|
8480
|
-
const wrapperSessionRef =
|
|
8691
|
+
const wrapperSessionRef = useRef19(null);
|
|
8481
8692
|
function startLasso(e) {
|
|
8482
8693
|
const rect = wrapperRef.current?.getBoundingClientRect();
|
|
8483
8694
|
if (!rect) return;
|
|
@@ -8628,12 +8839,12 @@ function DiagramInner({
|
|
|
8628
8839
|
onEdgeContextMenu(e, edge);
|
|
8629
8840
|
};
|
|
8630
8841
|
}
|
|
8631
|
-
const [hoveredNode, setHoveredNode] =
|
|
8632
|
-
const [hoveredEdge, setHoveredEdge] =
|
|
8633
|
-
const nodeHoverShowTimer =
|
|
8634
|
-
const nodeHoverHideTimer =
|
|
8635
|
-
const edgeHoverShowTimer =
|
|
8636
|
-
const edgeHoverHideTimer =
|
|
8842
|
+
const [hoveredNode, setHoveredNode] = useState19(null);
|
|
8843
|
+
const [hoveredEdge, setHoveredEdge] = useState19(null);
|
|
8844
|
+
const nodeHoverShowTimer = useRef19(null);
|
|
8845
|
+
const nodeHoverHideTimer = useRef19(null);
|
|
8846
|
+
const edgeHoverShowTimer = useRef19(null);
|
|
8847
|
+
const edgeHoverHideTimer = useRef19(null);
|
|
8637
8848
|
const clearTimer = (ref) => {
|
|
8638
8849
|
if (ref.current != null) {
|
|
8639
8850
|
window.clearTimeout(ref.current);
|
|
@@ -8931,8 +9142,8 @@ import {
|
|
|
8931
9142
|
useCallback as useCallback14,
|
|
8932
9143
|
useEffect as useEffect19,
|
|
8933
9144
|
useMemo as useMemo12,
|
|
8934
|
-
useRef as
|
|
8935
|
-
useState as
|
|
9145
|
+
useRef as useRef20,
|
|
9146
|
+
useState as useState20
|
|
8936
9147
|
} from "react";
|
|
8937
9148
|
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
8938
9149
|
function Dashboard({
|
|
@@ -8947,7 +9158,7 @@ function Dashboard({
|
|
|
8947
9158
|
onDashboardContextMenu
|
|
8948
9159
|
}) {
|
|
8949
9160
|
const dashboardLocale = useConfig().locale?.dashboard;
|
|
8950
|
-
const [maximizedId, setMaximizedId] =
|
|
9161
|
+
const [maximizedId, setMaximizedId] = useState20(null);
|
|
8951
9162
|
const wrapperClass = unstyled ? className : ["sg-dashboard", className].filter(Boolean).join(" ");
|
|
8952
9163
|
const gridStyle = {
|
|
8953
9164
|
display: "grid",
|
|
@@ -8996,8 +9207,8 @@ function DashboardWidgetView({
|
|
|
8996
9207
|
defaultActions
|
|
8997
9208
|
}) {
|
|
8998
9209
|
const dashboardLocale = useConfig().locale?.dashboard;
|
|
8999
|
-
const [hovered, setHovered] =
|
|
9000
|
-
const [menuOpen, setMenuOpen] =
|
|
9210
|
+
const [hovered, setHovered] = useState20(false);
|
|
9211
|
+
const [menuOpen, setMenuOpen] = useState20(false);
|
|
9001
9212
|
const widgetClass = unstyled ? widget.className : ["sg-dashboard-widget", widget.className].filter(Boolean).join(" ");
|
|
9002
9213
|
const widgetStyle = isMaximized ? {
|
|
9003
9214
|
gridColumn: `1 / span ${totalColumns}`,
|
|
@@ -9086,7 +9297,7 @@ function WidgetActionsMenu({
|
|
|
9086
9297
|
onActivateMaximize
|
|
9087
9298
|
}) {
|
|
9088
9299
|
const dashboardLocale = useConfig().locale?.dashboard;
|
|
9089
|
-
const wrapperRef =
|
|
9300
|
+
const wrapperRef = useRef20(null);
|
|
9090
9301
|
useEffect19(() => {
|
|
9091
9302
|
if (!open) return;
|
|
9092
9303
|
const onDocClick = (ev) => {
|
|
@@ -9190,8 +9401,8 @@ function MoreIcon() {
|
|
|
9190
9401
|
// src/components/complex/Dashboard/DashboardEditor.tsx
|
|
9191
9402
|
import {
|
|
9192
9403
|
useMemo as useMemo13,
|
|
9193
|
-
useRef as
|
|
9194
|
-
useState as
|
|
9404
|
+
useRef as useRef21,
|
|
9405
|
+
useState as useState21
|
|
9195
9406
|
} from "react";
|
|
9196
9407
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
9197
9408
|
var MIN_W = 1;
|
|
@@ -9216,12 +9427,12 @@ function DashboardEditor({
|
|
|
9216
9427
|
onWidgetRemove
|
|
9217
9428
|
}) {
|
|
9218
9429
|
const dashboardLocale = useConfig().locale?.dashboard;
|
|
9219
|
-
const gridRef =
|
|
9220
|
-
const dragRef =
|
|
9221
|
-
const [maximizedId, setMaximizedId] =
|
|
9222
|
-
const widgetsRef =
|
|
9430
|
+
const gridRef = useRef21(null);
|
|
9431
|
+
const dragRef = useRef21(null);
|
|
9432
|
+
const [maximizedId, setMaximizedId] = useState21(null);
|
|
9433
|
+
const widgetsRef = useRef21(widgets);
|
|
9223
9434
|
widgetsRef.current = widgets;
|
|
9224
|
-
const onChangeRef =
|
|
9435
|
+
const onChangeRef = useRef21(onLayoutChange);
|
|
9225
9436
|
onChangeRef.current = onLayoutChange;
|
|
9226
9437
|
function emitChange(widgetId, patch) {
|
|
9227
9438
|
const cb = onChangeRef.current;
|
|
@@ -9394,7 +9605,7 @@ function DashboardEditor({
|
|
|
9394
9605
|
import {
|
|
9395
9606
|
useCallback as useCallback15,
|
|
9396
9607
|
useMemo as useMemo14,
|
|
9397
|
-
useRef as
|
|
9608
|
+
useRef as useRef22
|
|
9398
9609
|
} from "react";
|
|
9399
9610
|
import { pointsToPath as pointsToPath2 } from "@skygraph/core";
|
|
9400
9611
|
import { jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -9481,7 +9692,7 @@ function Gantt({
|
|
|
9481
9692
|
style
|
|
9482
9693
|
}) {
|
|
9483
9694
|
const ganttLocale = useConfig().locale?.gantt;
|
|
9484
|
-
const onChangeRef =
|
|
9695
|
+
const onChangeRef = useRef22(onTaskChange);
|
|
9485
9696
|
onChangeRef.current = onTaskChange;
|
|
9486
9697
|
const resolved = useMemo14(() => {
|
|
9487
9698
|
const step = STEP_MS[scale];
|
|
@@ -9569,7 +9780,7 @@ function Gantt({
|
|
|
9569
9780
|
}
|
|
9570
9781
|
return out;
|
|
9571
9782
|
}, [taskRects, taskRectById]);
|
|
9572
|
-
const dragRef =
|
|
9783
|
+
const dragRef = useRef22(null);
|
|
9573
9784
|
const startInteraction = useCallback15(
|
|
9574
9785
|
(e, task, kind) => {
|
|
9575
9786
|
if (e.button !== 0) return;
|
|
@@ -9856,8 +10067,8 @@ import {
|
|
|
9856
10067
|
useCallback as useCallback16,
|
|
9857
10068
|
useEffect as useEffect20,
|
|
9858
10069
|
useMemo as useMemo15,
|
|
9859
|
-
useRef as
|
|
9860
|
-
useState as
|
|
10070
|
+
useRef as useRef23,
|
|
10071
|
+
useState as useState22
|
|
9861
10072
|
} from "react";
|
|
9862
10073
|
import { detectConflicts, isAvailable } from "@skygraph/core";
|
|
9863
10074
|
import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
@@ -9943,11 +10154,11 @@ function ResourceCalendar({
|
|
|
9943
10154
|
style
|
|
9944
10155
|
}) {
|
|
9945
10156
|
const resourceCalendarLocale = useConfig().locale?.resourceCalendar;
|
|
9946
|
-
const onChangeRef =
|
|
10157
|
+
const onChangeRef = useRef23(onAssignmentChange);
|
|
9947
10158
|
onChangeRef.current = onAssignmentChange;
|
|
9948
|
-
const onConflictRef =
|
|
10159
|
+
const onConflictRef = useRef23(onConflict);
|
|
9949
10160
|
onConflictRef.current = onConflict;
|
|
9950
|
-
const [ghost, setGhost] =
|
|
10161
|
+
const [ghost, setGhost] = useState22(null);
|
|
9951
10162
|
const step = STEP_MS2[scale];
|
|
9952
10163
|
const resolvedRange = useMemo15(
|
|
9953
10164
|
() => resolveRange(assignments, step, range),
|
|
@@ -10011,7 +10222,7 @@ function ResourceCalendar({
|
|
|
10011
10222
|
() => conflicts.map((c) => `${c.reason}:${c.assignmentIds.join(",")}`).sort().join("|"),
|
|
10012
10223
|
[conflicts]
|
|
10013
10224
|
);
|
|
10014
|
-
const lastKeyRef =
|
|
10225
|
+
const lastKeyRef = useRef23("");
|
|
10015
10226
|
useEffect20(() => {
|
|
10016
10227
|
if (lastKeyRef.current === conflictKey) return;
|
|
10017
10228
|
lastKeyRef.current = conflictKey;
|
|
@@ -10069,7 +10280,7 @@ function ResourceCalendar({
|
|
|
10069
10280
|
}
|
|
10070
10281
|
return out;
|
|
10071
10282
|
}, [rules, resources, rowIndexById, rangeStart, rangeEnd, step, pxPerMs, rowHeight]);
|
|
10072
|
-
const dragRef =
|
|
10283
|
+
const dragRef = useRef23(null);
|
|
10073
10284
|
const startInteraction = useCallback16(
|
|
10074
10285
|
(e, assignment, kind) => {
|
|
10075
10286
|
if (e.button !== 0) return;
|
|
@@ -10403,8 +10614,8 @@ function ResourceCalendar({
|
|
|
10403
10614
|
}
|
|
10404
10615
|
|
|
10405
10616
|
// src/components/complex/Timeline/Timeline.tsx
|
|
10406
|
-
import { Fragment as
|
|
10407
|
-
import { Fragment as
|
|
10617
|
+
import { Fragment as Fragment9, useMemo as useMemo16 } from "react";
|
|
10618
|
+
import { Fragment as Fragment10, jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
10408
10619
|
function toMs3(v) {
|
|
10409
10620
|
return v instanceof Date ? v.getTime() : v;
|
|
10410
10621
|
}
|
|
@@ -10485,7 +10696,7 @@ function EventTimeline({
|
|
|
10485
10696
|
"aria-label": timelineLocale?.ariaLabel ?? "Timeline",
|
|
10486
10697
|
"data-orientation": orientation,
|
|
10487
10698
|
"data-group-by": groupBy ?? "none",
|
|
10488
|
-
children: groups.map((group) => /* @__PURE__ */ jsxs40(
|
|
10699
|
+
children: groups.map((group) => /* @__PURE__ */ jsxs40(Fragment9, { children: [
|
|
10489
10700
|
groupBy && /* @__PURE__ */ jsx45(
|
|
10490
10701
|
"div",
|
|
10491
10702
|
{
|
|
@@ -10503,7 +10714,7 @@ function EventTimeline({
|
|
|
10503
10714
|
"aria-hidden": "true"
|
|
10504
10715
|
}
|
|
10505
10716
|
);
|
|
10506
|
-
const body = renderEvent ? renderEvent(ev) : /* @__PURE__ */ jsxs40(
|
|
10717
|
+
const body = renderEvent ? renderEvent(ev) : /* @__PURE__ */ jsxs40(Fragment10, { children: [
|
|
10507
10718
|
/* @__PURE__ */ jsx45("div", { className: unstyled ? void 0 : "sg-event-timeline-title", children: ev.title }),
|
|
10508
10719
|
ev.description !== void 0 && /* @__PURE__ */ jsx45("div", { className: unstyled ? void 0 : "sg-event-timeline-description", children: ev.description })
|
|
10509
10720
|
] });
|
|
@@ -10644,7 +10855,7 @@ function ChartLegend({ series, className, style }) {
|
|
|
10644
10855
|
}
|
|
10645
10856
|
|
|
10646
10857
|
// src/components/complex/Charts/ChartCrosshair.tsx
|
|
10647
|
-
import { Fragment as
|
|
10858
|
+
import { Fragment as Fragment11 } from "react";
|
|
10648
10859
|
import { jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10649
10860
|
var TIP_WIDTH = 140;
|
|
10650
10861
|
var TIP_LINE_HEIGHT = 14;
|
|
@@ -10738,7 +10949,7 @@ function ChartCrosshair({
|
|
|
10738
10949
|
),
|
|
10739
10950
|
points.map((p, i) => {
|
|
10740
10951
|
const rowY = tipY + TIP_PADDING + headerHeight + i * TIP_LINE_HEIGHT;
|
|
10741
|
-
return /* @__PURE__ */ jsxs42(
|
|
10952
|
+
return /* @__PURE__ */ jsxs42(Fragment11, { children: [
|
|
10742
10953
|
/* @__PURE__ */ jsx47(
|
|
10743
10954
|
"rect",
|
|
10744
10955
|
{
|
|
@@ -10783,7 +10994,7 @@ function ChartCrosshair({
|
|
|
10783
10994
|
}
|
|
10784
10995
|
|
|
10785
10996
|
// src/components/complex/Charts/ChartBrush.tsx
|
|
10786
|
-
import { useMemo as useMemo17, useRef as
|
|
10997
|
+
import { useMemo as useMemo17, useRef as useRef24, useState as useState23 } from "react";
|
|
10787
10998
|
import { jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10788
10999
|
function resolveBrushConfig(brush) {
|
|
10789
11000
|
if (brush == null || brush === false) return null;
|
|
@@ -10818,8 +11029,8 @@ function ChartBrush({
|
|
|
10818
11029
|
fill,
|
|
10819
11030
|
disabled
|
|
10820
11031
|
}) {
|
|
10821
|
-
const overlayRef =
|
|
10822
|
-
const [drag, setDrag] =
|
|
11032
|
+
const overlayRef = useRef24(null);
|
|
11033
|
+
const [drag, setDrag] = useState23(null);
|
|
10823
11034
|
const cls4 = (suffix) => unstyled ? void 0 : `sg-chart-brush-${suffix}`;
|
|
10824
11035
|
const clientToCategoryIndex = (clientX) => {
|
|
10825
11036
|
const overlay = overlayRef.current;
|
|
@@ -10964,10 +11175,10 @@ function ChartBrush({
|
|
|
10964
11175
|
}
|
|
10965
11176
|
|
|
10966
11177
|
// src/components/complex/Charts/LineChart.tsx
|
|
10967
|
-
import { forwardRef as forwardRef2, useMemo as useMemo19, useRef as
|
|
11178
|
+
import { forwardRef as forwardRef2, useMemo as useMemo19, useRef as useRef27, useState as useState25 } from "react";
|
|
10968
11179
|
|
|
10969
11180
|
// src/components/complex/Charts/ChartAxes.tsx
|
|
10970
|
-
import { Fragment as
|
|
11181
|
+
import { Fragment as Fragment12 } from "react";
|
|
10971
11182
|
import { jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10972
11183
|
var DEFAULT_Y_TICKS = 5;
|
|
10973
11184
|
var TICK_LEN = 4;
|
|
@@ -11062,7 +11273,7 @@ function ChartAxes({
|
|
|
11062
11273
|
strokeWidth: 1
|
|
11063
11274
|
}
|
|
11064
11275
|
),
|
|
11065
|
-
yTicks.map((t, i) => /* @__PURE__ */ jsxs44(
|
|
11276
|
+
yTicks.map((t, i) => /* @__PURE__ */ jsxs44(Fragment12, { children: [
|
|
11066
11277
|
/* @__PURE__ */ jsx49(
|
|
11067
11278
|
"line",
|
|
11068
11279
|
{
|
|
@@ -11122,7 +11333,7 @@ function ChartAxes({
|
|
|
11122
11333
|
const cx = xFor(idx);
|
|
11123
11334
|
const cat = categories[idx];
|
|
11124
11335
|
const text = xFmt ? xFmt(cat, idx) : String(cat);
|
|
11125
|
-
return /* @__PURE__ */ jsxs44(
|
|
11336
|
+
return /* @__PURE__ */ jsxs44(Fragment12, { children: [
|
|
11126
11337
|
/* @__PURE__ */ jsx49(
|
|
11127
11338
|
"line",
|
|
11128
11339
|
{
|
|
@@ -11174,9 +11385,9 @@ function ChartAxes({
|
|
|
11174
11385
|
}
|
|
11175
11386
|
|
|
11176
11387
|
// src/components/complex/Charts/chartRef.ts
|
|
11177
|
-
import { useCallback as useCallback17, useImperativeHandle as useImperativeHandle2, useMemo as useMemo18, useRef as
|
|
11388
|
+
import { useCallback as useCallback17, useImperativeHandle as useImperativeHandle2, useMemo as useMemo18, useRef as useRef25 } from "react";
|
|
11178
11389
|
function useChartPrint(forwardedRef, printable) {
|
|
11179
|
-
const rootRef =
|
|
11390
|
+
const rootRef = useRef25(null);
|
|
11180
11391
|
const printOptionsFromProp = useMemo18(() => {
|
|
11181
11392
|
if (typeof printable === "object" && printable !== null) {
|
|
11182
11393
|
return { fileName: printable.fileName };
|
|
@@ -11194,10 +11405,10 @@ function useChartPrint(forwardedRef, printable) {
|
|
|
11194
11405
|
}
|
|
11195
11406
|
|
|
11196
11407
|
// src/components/complex/Charts/useChartSize.ts
|
|
11197
|
-
import { useEffect as useEffect21, useRef as
|
|
11408
|
+
import { useEffect as useEffect21, useRef as useRef26, useState as useState24 } from "react";
|
|
11198
11409
|
function useChartSize(ref, fallback) {
|
|
11199
|
-
const [size, setSize] =
|
|
11200
|
-
const lastRef =
|
|
11410
|
+
const [size, setSize] = useState24(fallback);
|
|
11411
|
+
const lastRef = useRef26(size);
|
|
11201
11412
|
useEffect21(() => {
|
|
11202
11413
|
const el = ref.current;
|
|
11203
11414
|
if (!el) return void 0;
|
|
@@ -11343,7 +11554,7 @@ function downloadSvgAsPng(svg, fileNameOrOpts = "chart.png") {
|
|
|
11343
11554
|
}
|
|
11344
11555
|
|
|
11345
11556
|
// src/components/complex/Charts/ChartHoverToolbar.tsx
|
|
11346
|
-
import { Fragment as
|
|
11557
|
+
import { Fragment as Fragment13, jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11347
11558
|
function IconStroke(props) {
|
|
11348
11559
|
return /* @__PURE__ */ jsxs45(
|
|
11349
11560
|
"svg",
|
|
@@ -11368,7 +11579,7 @@ var PRINT_ICON = /* @__PURE__ */ jsx50(
|
|
|
11368
11579
|
IconStroke,
|
|
11369
11580
|
{
|
|
11370
11581
|
d: "M4 6V2.5h8V6",
|
|
11371
|
-
extra: /* @__PURE__ */ jsxs45(
|
|
11582
|
+
extra: /* @__PURE__ */ jsxs45(Fragment13, { children: [
|
|
11372
11583
|
/* @__PURE__ */ jsx50("rect", { x: 3, y: 6, width: 10, height: 6, rx: 1 }),
|
|
11373
11584
|
/* @__PURE__ */ jsx50("path", { d: "M4.5 10h7v3.5h-7z" })
|
|
11374
11585
|
] })
|
|
@@ -11378,7 +11589,7 @@ var SVG_ICON = /* @__PURE__ */ jsx50(
|
|
|
11378
11589
|
IconStroke,
|
|
11379
11590
|
{
|
|
11380
11591
|
d: "M3 8.5v3.25A1.25 1.25 0 0 0 4.25 13h7.5A1.25 1.25 0 0 0 13 11.75V8.5",
|
|
11381
|
-
extra: /* @__PURE__ */ jsxs45(
|
|
11592
|
+
extra: /* @__PURE__ */ jsxs45(Fragment13, { children: [
|
|
11382
11593
|
/* @__PURE__ */ jsx50("path", { d: "M8 2.5v7" }),
|
|
11383
11594
|
/* @__PURE__ */ jsx50("path", { d: "M5 6.5l3 3 3-3" })
|
|
11384
11595
|
] })
|
|
@@ -11388,7 +11599,7 @@ var PNG_ICON = /* @__PURE__ */ jsx50(
|
|
|
11388
11599
|
IconStroke,
|
|
11389
11600
|
{
|
|
11390
11601
|
d: "M2.5 3.5h11v9h-11z",
|
|
11391
|
-
extra: /* @__PURE__ */ jsxs45(
|
|
11602
|
+
extra: /* @__PURE__ */ jsxs45(Fragment13, { children: [
|
|
11392
11603
|
/* @__PURE__ */ jsx50("circle", { cx: 5.5, cy: 6.5, r: 0.9 }),
|
|
11393
11604
|
/* @__PURE__ */ jsx50("path", { d: "M2.5 11l3-3 2.5 2.5L10.5 8l3 3" })
|
|
11394
11605
|
] })
|
|
@@ -11398,7 +11609,7 @@ var RESET_ICON = /* @__PURE__ */ jsx50(
|
|
|
11398
11609
|
IconStroke,
|
|
11399
11610
|
{
|
|
11400
11611
|
d: "M3 8a5 5 0 1 0 1.5-3.5",
|
|
11401
|
-
extra: /* @__PURE__ */ jsx50(
|
|
11612
|
+
extra: /* @__PURE__ */ jsx50(Fragment13, { children: /* @__PURE__ */ jsx50("path", { d: "M3 3v3h3" }) })
|
|
11402
11613
|
}
|
|
11403
11614
|
);
|
|
11404
11615
|
function defaultChartActions(opts) {
|
|
@@ -11548,7 +11759,7 @@ function LineChartInner({
|
|
|
11548
11759
|
}, forwardedRef) {
|
|
11549
11760
|
const chartsLocale = useConfig().locale?.charts;
|
|
11550
11761
|
const { rootRef } = useChartPrint(forwardedRef, printable);
|
|
11551
|
-
const svgRef =
|
|
11762
|
+
const svgRef = useRef27(null);
|
|
11552
11763
|
const { min, max } = useMemo19(() => chartBounds(series.map((s) => s.values)), [series]);
|
|
11553
11764
|
const [pt, pr, pb, pl] = useMemo19(
|
|
11554
11765
|
() => resolveChartPadding(padding, yAxis, min, max),
|
|
@@ -11579,10 +11790,10 @@ function LineChartInner({
|
|
|
11579
11790
|
const animClass = anim.enabled && !unstyled ? "sg-chart-line-animate" : void 0;
|
|
11580
11791
|
const crosshairEnabled = crosshair !== false && categories.length > 0;
|
|
11581
11792
|
const crosshairFmt = typeof crosshair === "object" && crosshair !== null ? crosshair.valueFormatter : void 0;
|
|
11582
|
-
const [hoverIdx, setHoverIdx] =
|
|
11793
|
+
const [hoverIdx, setHoverIdx] = useState25(null);
|
|
11583
11794
|
const brushConfig = resolveBrushConfig(brush);
|
|
11584
11795
|
const isBrushControlled = brushConfig != null && "range" in brushConfig;
|
|
11585
|
-
const [internalBrushRange, setInternalBrushRange] =
|
|
11796
|
+
const [internalBrushRange, setInternalBrushRange] = useState25(
|
|
11586
11797
|
brushConfig?.defaultRange ?? null
|
|
11587
11798
|
);
|
|
11588
11799
|
const effectiveBrushRange = isBrushControlled ? brushConfig.range ?? null : internalBrushRange;
|
|
@@ -11630,7 +11841,7 @@ function LineChartInner({
|
|
|
11630
11841
|
brushConfig.onRangeChange?.(null);
|
|
11631
11842
|
} : void 0;
|
|
11632
11843
|
const resolvedActions = resolveChartActions(actions, { fileName, brushReset });
|
|
11633
|
-
const [toolbarVisible, setToolbarVisible] =
|
|
11844
|
+
const [toolbarVisible, setToolbarVisible] = useState25(false);
|
|
11634
11845
|
const handleSvgContextMenu = makeChartContextMenuHandler(onChartContextMenu);
|
|
11635
11846
|
const setSvgRef = (el) => {
|
|
11636
11847
|
svgRef.current = el;
|
|
@@ -11802,7 +12013,7 @@ var LineChart = forwardRef2(LineChartInner);
|
|
|
11802
12013
|
LineChart.displayName = "LineChart";
|
|
11803
12014
|
|
|
11804
12015
|
// src/components/complex/Charts/BarChart.tsx
|
|
11805
|
-
import { forwardRef as forwardRef3, useMemo as useMemo20, useRef as
|
|
12016
|
+
import { forwardRef as forwardRef3, useMemo as useMemo20, useRef as useRef28, useState as useState26 } from "react";
|
|
11806
12017
|
import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
11807
12018
|
function BarChartInner({
|
|
11808
12019
|
categories,
|
|
@@ -11828,7 +12039,7 @@ function BarChartInner({
|
|
|
11828
12039
|
}, forwardedRef) {
|
|
11829
12040
|
const chartsLocale = useConfig().locale?.charts;
|
|
11830
12041
|
const { rootRef } = useChartPrint(forwardedRef, printable);
|
|
11831
|
-
const svgRef =
|
|
12042
|
+
const svgRef = useRef28(null);
|
|
11832
12043
|
const { min, max } = useMemo20(() => chartBounds(series.map((s) => s.values)), [series]);
|
|
11833
12044
|
const baseline = Math.min(0, min);
|
|
11834
12045
|
const top = Math.max(0, max);
|
|
@@ -11860,7 +12071,7 @@ function BarChartInner({
|
|
|
11860
12071
|
const animClass = anim.enabled && !unstyled ? "sg-chart-bar-animate" : void 0;
|
|
11861
12072
|
const brushConfig = resolveBrushConfig(brush);
|
|
11862
12073
|
const isBrushControlled = brushConfig != null && "range" in brushConfig;
|
|
11863
|
-
const [internalBrushRange, setInternalBrushRange] =
|
|
12074
|
+
const [internalBrushRange, setInternalBrushRange] = useState26(
|
|
11864
12075
|
brushConfig?.defaultRange ?? null
|
|
11865
12076
|
);
|
|
11866
12077
|
const effectiveBrushRange = isBrushControlled ? brushConfig.range ?? null : internalBrushRange;
|
|
@@ -11873,7 +12084,7 @@ function BarChartInner({
|
|
|
11873
12084
|
brushConfig.onRangeChange?.(null);
|
|
11874
12085
|
} : void 0;
|
|
11875
12086
|
const resolvedActions = resolveChartActions(actions, { fileName, brushReset });
|
|
11876
|
-
const [toolbarVisible, setToolbarVisible] =
|
|
12087
|
+
const [toolbarVisible, setToolbarVisible] = useState26(false);
|
|
11877
12088
|
const handleSvgContextMenu = makeChartContextMenuHandler(onChartContextMenu);
|
|
11878
12089
|
const setSvgRef = (el) => {
|
|
11879
12090
|
svgRef.current = el;
|
|
@@ -12010,7 +12221,7 @@ var BarChart = forwardRef3(BarChartInner);
|
|
|
12010
12221
|
BarChart.displayName = "BarChart";
|
|
12011
12222
|
|
|
12012
12223
|
// src/components/complex/Charts/AreaChart.tsx
|
|
12013
|
-
import { forwardRef as forwardRef4, useMemo as useMemo21, useRef as
|
|
12224
|
+
import { forwardRef as forwardRef4, useMemo as useMemo21, useRef as useRef29, useState as useState27 } from "react";
|
|
12014
12225
|
import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
12015
12226
|
function AreaChartInner({
|
|
12016
12227
|
categories,
|
|
@@ -12037,7 +12248,7 @@ function AreaChartInner({
|
|
|
12037
12248
|
}, forwardedRef) {
|
|
12038
12249
|
const chartsLocale = useConfig().locale?.charts;
|
|
12039
12250
|
const { rootRef } = useChartPrint(forwardedRef, printable);
|
|
12040
|
-
const svgRef =
|
|
12251
|
+
const svgRef = useRef29(null);
|
|
12041
12252
|
const stackedValues = useMemo21(() => {
|
|
12042
12253
|
if (!stacked) return series.map((s) => [...s.values]);
|
|
12043
12254
|
const totals = new Array(categories.length).fill(0);
|
|
@@ -12087,7 +12298,7 @@ function AreaChartInner({
|
|
|
12087
12298
|
const animClass = anim.enabled && !unstyled ? "sg-chart-area-animate" : void 0;
|
|
12088
12299
|
const brushConfig = resolveBrushConfig(brush);
|
|
12089
12300
|
const isBrushControlled = brushConfig != null && "range" in brushConfig;
|
|
12090
|
-
const [internalBrushRange, setInternalBrushRange] =
|
|
12301
|
+
const [internalBrushRange, setInternalBrushRange] = useState27(
|
|
12091
12302
|
brushConfig?.defaultRange ?? null
|
|
12092
12303
|
);
|
|
12093
12304
|
const effectiveBrushRange = isBrushControlled ? brushConfig.range ?? null : internalBrushRange;
|
|
@@ -12100,7 +12311,7 @@ function AreaChartInner({
|
|
|
12100
12311
|
brushConfig.onRangeChange?.(null);
|
|
12101
12312
|
} : void 0;
|
|
12102
12313
|
const resolvedActions = resolveChartActions(actions, { fileName, brushReset });
|
|
12103
|
-
const [toolbarVisible, setToolbarVisible] =
|
|
12314
|
+
const [toolbarVisible, setToolbarVisible] = useState27(false);
|
|
12104
12315
|
const handleSvgContextMenu = makeChartContextMenuHandler(onChartContextMenu);
|
|
12105
12316
|
const setSvgRef = (el) => {
|
|
12106
12317
|
svgRef.current = el;
|
|
@@ -12234,7 +12445,7 @@ var AreaChart = forwardRef4(AreaChartInner);
|
|
|
12234
12445
|
AreaChart.displayName = "AreaChart";
|
|
12235
12446
|
|
|
12236
12447
|
// src/components/complex/Charts/PieChart.tsx
|
|
12237
|
-
import { forwardRef as forwardRef5, useMemo as useMemo22, useRef as
|
|
12448
|
+
import { forwardRef as forwardRef5, useMemo as useMemo22, useRef as useRef30, useState as useState28 } from "react";
|
|
12238
12449
|
import { jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12239
12450
|
function PieChartInner({
|
|
12240
12451
|
data,
|
|
@@ -12254,7 +12465,7 @@ function PieChartInner({
|
|
|
12254
12465
|
}, forwardedRef) {
|
|
12255
12466
|
const chartsLocale = useConfig().locale?.charts;
|
|
12256
12467
|
const { rootRef } = useChartPrint(forwardedRef, printable);
|
|
12257
|
-
const svgRef =
|
|
12468
|
+
const svgRef = useRef30(null);
|
|
12258
12469
|
const fallbackW = typeof width === "number" && Number.isFinite(width) ? width : 200;
|
|
12259
12470
|
const fallbackH = typeof height === "number" && Number.isFinite(height) ? height : 200;
|
|
12260
12471
|
const measured = useChartSize(svgRef, { width: fallbackW, height: fallbackH });
|
|
@@ -12272,7 +12483,7 @@ function PieChartInner({
|
|
|
12272
12483
|
animationDuration: `${anim.duration}ms`
|
|
12273
12484
|
} : void 0;
|
|
12274
12485
|
const resolvedActions = resolveChartActions(actions, { fileName });
|
|
12275
|
-
const [toolbarVisible, setToolbarVisible] =
|
|
12486
|
+
const [toolbarVisible, setToolbarVisible] = useState28(false);
|
|
12276
12487
|
const handleSvgContextMenu = makeChartContextMenuHandler(onChartContextMenu);
|
|
12277
12488
|
const setSvgRef = (el) => {
|
|
12278
12489
|
svgRef.current = el;
|
|
@@ -12509,7 +12720,8 @@ function ListInner({
|
|
|
12509
12720
|
(e, index) => {
|
|
12510
12721
|
if (!draggable || dragIndex === null) return;
|
|
12511
12722
|
e.preventDefault();
|
|
12512
|
-
|
|
12723
|
+
e.dataTransfer.dropEffect = "move";
|
|
12724
|
+
setDropIndex((prev) => prev === index ? prev : index);
|
|
12513
12725
|
},
|
|
12514
12726
|
[draggable, dragIndex]
|
|
12515
12727
|
);
|
|
@@ -12591,7 +12803,6 @@ function ListInner({
|
|
|
12591
12803
|
onDragOver: (e) => handleDragOver(e, index),
|
|
12592
12804
|
onDrop: (e) => handleDrop(e, index),
|
|
12593
12805
|
onDragEnd: handleDragEnd,
|
|
12594
|
-
onDragLeave: () => setDropIndex(null),
|
|
12595
12806
|
children: [
|
|
12596
12807
|
draggable && /* @__PURE__ */ jsx55("span", { className: "sg-list-drag-handle", children: "\u283F" }),
|
|
12597
12808
|
renderItem(item, index)
|
|
@@ -13153,7 +13364,7 @@ function Transfer({
|
|
|
13153
13364
|
}
|
|
13154
13365
|
|
|
13155
13366
|
// src/components/ui/Mentions.tsx
|
|
13156
|
-
import { useState as
|
|
13367
|
+
import { useState as useState29, useRef as useRef31, useEffect as useEffect22, useMemo as useMemo23, useCallback as useCallback18 } from "react";
|
|
13157
13368
|
import { jsx as jsx58, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
13158
13369
|
function Mentions({
|
|
13159
13370
|
value,
|
|
@@ -13179,12 +13390,12 @@ function Mentions({
|
|
|
13179
13390
|
() => Array.isArray(prefixConfig) ? prefixConfig : [prefixConfig],
|
|
13180
13391
|
[prefixConfig]
|
|
13181
13392
|
);
|
|
13182
|
-
const [internalValue, setInternalValue] =
|
|
13393
|
+
const [internalValue, setInternalValue] = useState29(value ?? defaultValue);
|
|
13183
13394
|
const currentValue = value ?? internalValue;
|
|
13184
|
-
const [mentionState, setMentionState] =
|
|
13185
|
-
const [activeIndex, setActiveIndex] =
|
|
13186
|
-
const textareaRef =
|
|
13187
|
-
const dropdownRef =
|
|
13395
|
+
const [mentionState, setMentionState] = useState29(null);
|
|
13396
|
+
const [activeIndex, setActiveIndex] = useState29(0);
|
|
13397
|
+
const textareaRef = useRef31(null);
|
|
13398
|
+
const dropdownRef = useRef31(null);
|
|
13188
13399
|
const filteredOptions = useMemo23(() => {
|
|
13189
13400
|
if (!mentionState) return [];
|
|
13190
13401
|
const q = mentionState.query.toLowerCase();
|
|
@@ -13304,7 +13515,7 @@ function Mentions({
|
|
|
13304
13515
|
}
|
|
13305
13516
|
|
|
13306
13517
|
// src/components/ui/InputPassword.tsx
|
|
13307
|
-
import { useState as
|
|
13518
|
+
import { useState as useState30 } from "react";
|
|
13308
13519
|
import { jsx as jsx59, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
13309
13520
|
function getStrength(password) {
|
|
13310
13521
|
if (!password || password.length < 4) return "weak";
|
|
@@ -13347,8 +13558,8 @@ function InputPassword({
|
|
|
13347
13558
|
const config = useConfig();
|
|
13348
13559
|
const size = sizeProp ?? config.size ?? "middle";
|
|
13349
13560
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
13350
|
-
const [visible, setVisible] =
|
|
13351
|
-
const [internal, setInternal] =
|
|
13561
|
+
const [visible, setVisible] = useState30(false);
|
|
13562
|
+
const [internal, setInternal] = useState30(defaultValue ?? "");
|
|
13352
13563
|
const current = value ?? internal;
|
|
13353
13564
|
const labels = { ...defaultStrengthLabels, ...strengthLabels };
|
|
13354
13565
|
const handleChange = (v) => {
|
|
@@ -13429,7 +13640,7 @@ function InputPassword({
|
|
|
13429
13640
|
}
|
|
13430
13641
|
|
|
13431
13642
|
// src/components/ui/SearchInput.tsx
|
|
13432
|
-
import { useState as
|
|
13643
|
+
import { useState as useState31, useRef as useRef32 } from "react";
|
|
13433
13644
|
import { jsx as jsx60, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
13434
13645
|
function SearchInput({
|
|
13435
13646
|
value,
|
|
@@ -13451,9 +13662,9 @@ function SearchInput({
|
|
|
13451
13662
|
const config = useConfig();
|
|
13452
13663
|
const size = sizeProp ?? config.size ?? "middle";
|
|
13453
13664
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
13454
|
-
const [internal, setInternal] =
|
|
13665
|
+
const [internal, setInternal] = useState31(defaultValue ?? "");
|
|
13455
13666
|
const current = value ?? internal;
|
|
13456
|
-
const inputRef =
|
|
13667
|
+
const inputRef = useRef32(null);
|
|
13457
13668
|
const handleChange = (v) => {
|
|
13458
13669
|
setInternal(v);
|
|
13459
13670
|
onChange?.(v);
|
|
@@ -13537,7 +13748,7 @@ function SearchInput({
|
|
|
13537
13748
|
}
|
|
13538
13749
|
|
|
13539
13750
|
// src/components/ui/TagInput.tsx
|
|
13540
|
-
import { useState as
|
|
13751
|
+
import { useState as useState32, useRef as useRef33, useId as useId5 } from "react";
|
|
13541
13752
|
import { jsx as jsx61, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
13542
13753
|
function TagInput({
|
|
13543
13754
|
value,
|
|
@@ -13561,9 +13772,9 @@ function TagInput({
|
|
|
13561
13772
|
const size = sizeProp ?? config.size ?? "middle";
|
|
13562
13773
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
13563
13774
|
const removeTagLabel = config.locale?.tagInput?.removeTag ?? ((tag) => `Remove ${tag}`);
|
|
13564
|
-
const [internalTags, setInternalTags] =
|
|
13565
|
-
const [inputValue, setInputValue] =
|
|
13566
|
-
const inputRef =
|
|
13775
|
+
const [internalTags, setInternalTags] = useState32(defaultValue);
|
|
13776
|
+
const [inputValue, setInputValue] = useState32("");
|
|
13777
|
+
const inputRef = useRef33(null);
|
|
13567
13778
|
const id = useId5();
|
|
13568
13779
|
const tags = value ?? internalTags;
|
|
13569
13780
|
const updateTags = (next) => {
|
|
@@ -13674,7 +13885,7 @@ function TagInput({
|
|
|
13674
13885
|
}
|
|
13675
13886
|
|
|
13676
13887
|
// src/components/ui/PinInput.tsx
|
|
13677
|
-
import { useState as
|
|
13888
|
+
import { useState as useState33, useRef as useRef34, useCallback as useCallback19, useId as useId6 } from "react";
|
|
13678
13889
|
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
13679
13890
|
function PinInput({
|
|
13680
13891
|
length = 6,
|
|
@@ -13699,9 +13910,9 @@ function PinInput({
|
|
|
13699
13910
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
13700
13911
|
const id = useId6();
|
|
13701
13912
|
const pad2 = (s) => s.padEnd(length, "").slice(0, length);
|
|
13702
|
-
const [internal, setInternal] =
|
|
13913
|
+
const [internal, setInternal] = useState33(() => pad2(defaultValue));
|
|
13703
13914
|
const current = value !== void 0 ? pad2(value) : internal;
|
|
13704
|
-
const refs =
|
|
13915
|
+
const refs = useRef34([]);
|
|
13705
13916
|
const pattern = type === "numeric" ? /^\d$/ : /^[a-zA-Z0-9]$/;
|
|
13706
13917
|
const update = useCallback19(
|
|
13707
13918
|
(next) => {
|
|
@@ -13810,8 +14021,8 @@ function PinInput({
|
|
|
13810
14021
|
}
|
|
13811
14022
|
|
|
13812
14023
|
// src/components/ui/InlineEdit.tsx
|
|
13813
|
-
import { useState as
|
|
13814
|
-
import { Fragment as
|
|
14024
|
+
import { useState as useState34, useRef as useRef35, useEffect as useEffect23 } from "react";
|
|
14025
|
+
import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
13815
14026
|
function InlineEdit({
|
|
13816
14027
|
value,
|
|
13817
14028
|
defaultValue = "",
|
|
@@ -13832,10 +14043,10 @@ function InlineEdit({
|
|
|
13832
14043
|
const config = useConfig();
|
|
13833
14044
|
const size = sizeProp ?? config.size ?? "middle";
|
|
13834
14045
|
const disabled = disabledProp ?? config.disabled ?? false;
|
|
13835
|
-
const [editing, setEditing] =
|
|
13836
|
-
const [internal, setInternal] =
|
|
13837
|
-
const [draft, setDraft] =
|
|
13838
|
-
const inputRef =
|
|
14046
|
+
const [editing, setEditing] = useState34(false);
|
|
14047
|
+
const [internal, setInternal] = useState34(defaultValue);
|
|
14048
|
+
const [draft, setDraft] = useState34("");
|
|
14049
|
+
const inputRef = useRef35(null);
|
|
13839
14050
|
const current = value ?? internal;
|
|
13840
14051
|
useEffect23(() => {
|
|
13841
14052
|
if (editing) {
|
|
@@ -13867,7 +14078,7 @@ function InlineEdit({
|
|
|
13867
14078
|
};
|
|
13868
14079
|
if (!editing) {
|
|
13869
14080
|
if (renderView) {
|
|
13870
|
-
return /* @__PURE__ */ jsx63(
|
|
14081
|
+
return /* @__PURE__ */ jsx63(Fragment14, { children: renderView(current, startEditing) });
|
|
13871
14082
|
}
|
|
13872
14083
|
if (unstyled) {
|
|
13873
14084
|
return /* @__PURE__ */ jsx63(
|
|
@@ -13916,7 +14127,7 @@ function InlineEdit({
|
|
|
13916
14127
|
onBlur: saveOnBlur ? save : void 0
|
|
13917
14128
|
}
|
|
13918
14129
|
),
|
|
13919
|
-
showButtons && /* @__PURE__ */ jsxs57(
|
|
14130
|
+
showButtons && /* @__PURE__ */ jsxs57(Fragment14, { children: [
|
|
13920
14131
|
/* @__PURE__ */ jsx63("button", { type: "button", onClick: save, children: "\u2713" }),
|
|
13921
14132
|
/* @__PURE__ */ jsx63("button", { type: "button", onClick: cancel, children: "\u2715" })
|
|
13922
14133
|
] })
|
|
@@ -14094,6 +14305,7 @@ export {
|
|
|
14094
14305
|
VirtualList,
|
|
14095
14306
|
buildPageRule,
|
|
14096
14307
|
buildPrintHtml,
|
|
14308
|
+
buildThemeVars,
|
|
14097
14309
|
chartDataKey,
|
|
14098
14310
|
colorForSeries,
|
|
14099
14311
|
createEmptyEditorSchema,
|
|
@@ -14126,6 +14338,7 @@ export {
|
|
|
14126
14338
|
useChartSize,
|
|
14127
14339
|
useComputed,
|
|
14128
14340
|
useConfig,
|
|
14341
|
+
useConfigWithDefaults,
|
|
14129
14342
|
useField,
|
|
14130
14343
|
useFieldArray,
|
|
14131
14344
|
useForm,
|