@j3m-quantum/ui 2.1.10 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +663 -408
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -3
- package/dist/index.d.ts +81 -3
- package/dist/index.js +529 -255
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React37 = require('react');
|
|
4
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
5
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
6
6
|
var clsx = require('clsx');
|
|
@@ -72,7 +72,7 @@ function _interopNamespace(e) {
|
|
|
72
72
|
return Object.freeze(n);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
var
|
|
75
|
+
var React37__namespace = /*#__PURE__*/_interopNamespace(React37);
|
|
76
76
|
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
77
77
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
78
78
|
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
@@ -107,8 +107,8 @@ var tunnel__default = /*#__PURE__*/_interopDefault(tunnel);
|
|
|
107
107
|
// src/hooks/use-mobile.ts
|
|
108
108
|
var MOBILE_BREAKPOINT = 1024;
|
|
109
109
|
function useIsMobile() {
|
|
110
|
-
const [isMobile, setIsMobile] =
|
|
111
|
-
|
|
110
|
+
const [isMobile, setIsMobile] = React37__namespace.useState(void 0);
|
|
111
|
+
React37__namespace.useEffect(() => {
|
|
112
112
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
113
113
|
const onChange = () => {
|
|
114
114
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -196,7 +196,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
);
|
|
199
|
-
var Button =
|
|
199
|
+
var Button = React37__namespace.forwardRef(
|
|
200
200
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
201
201
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
202
202
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -560,7 +560,7 @@ function Slider({
|
|
|
560
560
|
max = 100,
|
|
561
561
|
...props
|
|
562
562
|
}) {
|
|
563
|
-
const _values =
|
|
563
|
+
const _values = React37__namespace.useMemo(
|
|
564
564
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
565
565
|
[value, defaultValue, min, max]
|
|
566
566
|
);
|
|
@@ -846,7 +846,7 @@ function Toggle({
|
|
|
846
846
|
}
|
|
847
847
|
);
|
|
848
848
|
}
|
|
849
|
-
var ToggleGroupContext =
|
|
849
|
+
var ToggleGroupContext = React37__namespace.createContext({
|
|
850
850
|
size: "default",
|
|
851
851
|
variant: "default",
|
|
852
852
|
spacing: 0
|
|
@@ -883,7 +883,7 @@ function ToggleGroupItem({
|
|
|
883
883
|
size,
|
|
884
884
|
...props
|
|
885
885
|
}) {
|
|
886
|
-
const context =
|
|
886
|
+
const context = React37__namespace.useContext(ToggleGroupContext);
|
|
887
887
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
888
888
|
ToggleGroupPrimitive__namespace.Item,
|
|
889
889
|
{
|
|
@@ -913,7 +913,7 @@ function ThemeSwitch({
|
|
|
913
913
|
className,
|
|
914
914
|
size = "default"
|
|
915
915
|
}) {
|
|
916
|
-
const [isChecked, setIsChecked] =
|
|
916
|
+
const [isChecked, setIsChecked] = React37__namespace.useState(defaultChecked);
|
|
917
917
|
const isControlled = checked !== void 0;
|
|
918
918
|
const currentChecked = isControlled ? checked : isChecked;
|
|
919
919
|
const handleClick = () => {
|
|
@@ -1333,7 +1333,7 @@ function Label2({
|
|
|
1333
1333
|
);
|
|
1334
1334
|
}
|
|
1335
1335
|
var Form = reactHookForm.FormProvider;
|
|
1336
|
-
var FormFieldContext =
|
|
1336
|
+
var FormFieldContext = React37__namespace.createContext(
|
|
1337
1337
|
{}
|
|
1338
1338
|
);
|
|
1339
1339
|
var FormField = ({
|
|
@@ -1342,8 +1342,8 @@ var FormField = ({
|
|
|
1342
1342
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1343
1343
|
};
|
|
1344
1344
|
var useFormField = () => {
|
|
1345
|
-
const fieldContext =
|
|
1346
|
-
const itemContext =
|
|
1345
|
+
const fieldContext = React37__namespace.useContext(FormFieldContext);
|
|
1346
|
+
const itemContext = React37__namespace.useContext(FormItemContext);
|
|
1347
1347
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1348
1348
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1349
1349
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1360,11 +1360,11 @@ var useFormField = () => {
|
|
|
1360
1360
|
...fieldState
|
|
1361
1361
|
};
|
|
1362
1362
|
};
|
|
1363
|
-
var FormItemContext =
|
|
1363
|
+
var FormItemContext = React37__namespace.createContext(
|
|
1364
1364
|
{}
|
|
1365
1365
|
);
|
|
1366
1366
|
function FormItem({ className, ...props }) {
|
|
1367
|
-
const id =
|
|
1367
|
+
const id = React37__namespace.useId();
|
|
1368
1368
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1369
1369
|
"div",
|
|
1370
1370
|
{
|
|
@@ -1612,7 +1612,7 @@ function FieldError({
|
|
|
1612
1612
|
errors,
|
|
1613
1613
|
...props
|
|
1614
1614
|
}) {
|
|
1615
|
-
const content =
|
|
1615
|
+
const content = React37.useMemo(() => {
|
|
1616
1616
|
if (children) {
|
|
1617
1617
|
return children;
|
|
1618
1618
|
}
|
|
@@ -1906,7 +1906,7 @@ function TableHeader({ className, ...props }) {
|
|
|
1906
1906
|
"thead",
|
|
1907
1907
|
{
|
|
1908
1908
|
"data-slot": "table-header",
|
|
1909
|
-
className: cn("[&_tr]:border-b", className),
|
|
1909
|
+
className: cn("bg-muted/50 [&_tr]:border-b [&_tr]:border-border/50", className),
|
|
1910
1910
|
...props
|
|
1911
1911
|
}
|
|
1912
1912
|
);
|
|
@@ -1940,7 +1940,7 @@ function TableRow({ className, ...props }) {
|
|
|
1940
1940
|
{
|
|
1941
1941
|
"data-slot": "table-row",
|
|
1942
1942
|
className: cn(
|
|
1943
|
-
"hover:bg-muted/
|
|
1943
|
+
"hover:bg-muted/20 data-[state=selected]:bg-muted/50 border-b border-border/30 transition-colors",
|
|
1944
1944
|
className
|
|
1945
1945
|
),
|
|
1946
1946
|
...props
|
|
@@ -1953,7 +1953,7 @@ function TableHead({ className, ...props }) {
|
|
|
1953
1953
|
{
|
|
1954
1954
|
"data-slot": "table-head",
|
|
1955
1955
|
className: cn(
|
|
1956
|
-
"text-foreground h-
|
|
1956
|
+
"text-foreground h-12 px-3 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
1957
1957
|
className
|
|
1958
1958
|
),
|
|
1959
1959
|
...props
|
|
@@ -1966,7 +1966,7 @@ function TableCell({ className, ...props }) {
|
|
|
1966
1966
|
{
|
|
1967
1967
|
"data-slot": "table-cell",
|
|
1968
1968
|
className: cn(
|
|
1969
|
-
"
|
|
1969
|
+
"px-3 py-4 text-left align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
1970
1970
|
className
|
|
1971
1971
|
),
|
|
1972
1972
|
...props
|
|
@@ -2762,8 +2762,8 @@ function CalendarDayButton({
|
|
|
2762
2762
|
modifiers,
|
|
2763
2763
|
...props
|
|
2764
2764
|
}) {
|
|
2765
|
-
const ref =
|
|
2766
|
-
|
|
2765
|
+
const ref = React37__namespace.useRef(null);
|
|
2766
|
+
React37__namespace.useEffect(() => {
|
|
2767
2767
|
if (modifiers.focused) ref.current?.focus();
|
|
2768
2768
|
}, [modifiers.focused]);
|
|
2769
2769
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2784,9 +2784,9 @@ function CalendarDayButton({
|
|
|
2784
2784
|
}
|
|
2785
2785
|
);
|
|
2786
2786
|
}
|
|
2787
|
-
var CarouselContext =
|
|
2787
|
+
var CarouselContext = React37__namespace.createContext(null);
|
|
2788
2788
|
function useCarousel() {
|
|
2789
|
-
const context =
|
|
2789
|
+
const context = React37__namespace.useContext(CarouselContext);
|
|
2790
2790
|
if (!context) {
|
|
2791
2791
|
throw new Error("useCarousel must be used within a <Carousel />");
|
|
2792
2792
|
}
|
|
@@ -2808,20 +2808,20 @@ function Carousel({
|
|
|
2808
2808
|
},
|
|
2809
2809
|
plugins
|
|
2810
2810
|
);
|
|
2811
|
-
const [canScrollPrev, setCanScrollPrev] =
|
|
2812
|
-
const [canScrollNext, setCanScrollNext] =
|
|
2813
|
-
const onSelect =
|
|
2811
|
+
const [canScrollPrev, setCanScrollPrev] = React37__namespace.useState(false);
|
|
2812
|
+
const [canScrollNext, setCanScrollNext] = React37__namespace.useState(false);
|
|
2813
|
+
const onSelect = React37__namespace.useCallback((api2) => {
|
|
2814
2814
|
if (!api2) return;
|
|
2815
2815
|
setCanScrollPrev(api2.canScrollPrev());
|
|
2816
2816
|
setCanScrollNext(api2.canScrollNext());
|
|
2817
2817
|
}, []);
|
|
2818
|
-
const scrollPrev =
|
|
2818
|
+
const scrollPrev = React37__namespace.useCallback(() => {
|
|
2819
2819
|
api?.scrollPrev();
|
|
2820
2820
|
}, [api]);
|
|
2821
|
-
const scrollNext =
|
|
2821
|
+
const scrollNext = React37__namespace.useCallback(() => {
|
|
2822
2822
|
api?.scrollNext();
|
|
2823
2823
|
}, [api]);
|
|
2824
|
-
const handleKeyDown =
|
|
2824
|
+
const handleKeyDown = React37__namespace.useCallback(
|
|
2825
2825
|
(event) => {
|
|
2826
2826
|
if (event.key === "ArrowLeft") {
|
|
2827
2827
|
event.preventDefault();
|
|
@@ -2833,11 +2833,11 @@ function Carousel({
|
|
|
2833
2833
|
},
|
|
2834
2834
|
[scrollPrev, scrollNext]
|
|
2835
2835
|
);
|
|
2836
|
-
|
|
2836
|
+
React37__namespace.useEffect(() => {
|
|
2837
2837
|
if (!api || !setApi) return;
|
|
2838
2838
|
setApi(api);
|
|
2839
2839
|
}, [api, setApi]);
|
|
2840
|
-
|
|
2840
|
+
React37__namespace.useEffect(() => {
|
|
2841
2841
|
if (!api) return;
|
|
2842
2842
|
onSelect(api);
|
|
2843
2843
|
api.on("reInit", onSelect);
|
|
@@ -2970,9 +2970,9 @@ function CarouselNext({
|
|
|
2970
2970
|
);
|
|
2971
2971
|
}
|
|
2972
2972
|
var THEMES = { light: "", dark: ".dark" };
|
|
2973
|
-
var ChartContext =
|
|
2973
|
+
var ChartContext = React37__namespace.createContext(null);
|
|
2974
2974
|
function useChart() {
|
|
2975
|
-
const context =
|
|
2975
|
+
const context = React37__namespace.useContext(ChartContext);
|
|
2976
2976
|
if (!context) {
|
|
2977
2977
|
throw new Error("useChart must be used within a <ChartContainer />");
|
|
2978
2978
|
}
|
|
@@ -2985,7 +2985,7 @@ function ChartContainer({
|
|
|
2985
2985
|
config,
|
|
2986
2986
|
...props
|
|
2987
2987
|
}) {
|
|
2988
|
-
const uniqueId =
|
|
2988
|
+
const uniqueId = React37__namespace.useId();
|
|
2989
2989
|
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
2990
2990
|
return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2991
2991
|
"div",
|
|
@@ -3046,7 +3046,7 @@ function ChartTooltipContent({
|
|
|
3046
3046
|
labelKey
|
|
3047
3047
|
}) {
|
|
3048
3048
|
const { config } = useChart();
|
|
3049
|
-
const tooltipLabel =
|
|
3049
|
+
const tooltipLabel = React37__namespace.useMemo(() => {
|
|
3050
3050
|
if (hideLabel || !payload?.length) {
|
|
3051
3051
|
return null;
|
|
3052
3052
|
}
|
|
@@ -3881,7 +3881,7 @@ function StatusProgress({
|
|
|
3881
3881
|
const resolvedVariant = variant ?? getVariantFromProgress(clampedValue);
|
|
3882
3882
|
const colors = getStatusColors(resolvedVariant);
|
|
3883
3883
|
const sizes = getSizeClasses(size);
|
|
3884
|
-
const labelText =
|
|
3884
|
+
const labelText = React37__namespace.useMemo(() => {
|
|
3885
3885
|
if (currentCount !== void 0 && totalCount !== void 0) {
|
|
3886
3886
|
return `${currentCount} / ${totalCount} ${unitLabel}`;
|
|
3887
3887
|
}
|
|
@@ -3986,8 +3986,8 @@ function TooltipContent({
|
|
|
3986
3986
|
) });
|
|
3987
3987
|
}
|
|
3988
3988
|
function useDetectTheme() {
|
|
3989
|
-
const [theme, setTheme] =
|
|
3990
|
-
|
|
3989
|
+
const [theme, setTheme] = React37__namespace.useState("light");
|
|
3990
|
+
React37__namespace.useEffect(() => {
|
|
3991
3991
|
const isDark = document.documentElement.classList.contains("dark");
|
|
3992
3992
|
setTheme(isDark ? "dark" : "light");
|
|
3993
3993
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -4636,7 +4636,7 @@ function CommandShortcut({
|
|
|
4636
4636
|
}
|
|
4637
4637
|
);
|
|
4638
4638
|
}
|
|
4639
|
-
var SearchTrigger =
|
|
4639
|
+
var SearchTrigger = React37__namespace.forwardRef(
|
|
4640
4640
|
({
|
|
4641
4641
|
className,
|
|
4642
4642
|
placeholder = "Search...",
|
|
@@ -4672,7 +4672,7 @@ var SearchTrigger = React36__namespace.forwardRef(
|
|
|
4672
4672
|
);
|
|
4673
4673
|
SearchTrigger.displayName = "SearchTrigger";
|
|
4674
4674
|
function useSearchShortcut(onOpen, key = "k") {
|
|
4675
|
-
|
|
4675
|
+
React37__namespace.useEffect(() => {
|
|
4676
4676
|
const down = (e) => {
|
|
4677
4677
|
if (e.key.toLowerCase() === key.toLowerCase() && (e.metaKey || e.ctrlKey)) {
|
|
4678
4678
|
e.preventDefault();
|
|
@@ -5647,9 +5647,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
5647
5647
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
5648
5648
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
5649
5649
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
5650
|
-
var SidebarContext =
|
|
5650
|
+
var SidebarContext = React37__namespace.createContext(null);
|
|
5651
5651
|
function useSidebar() {
|
|
5652
|
-
const context =
|
|
5652
|
+
const context = React37__namespace.useContext(SidebarContext);
|
|
5653
5653
|
if (!context) {
|
|
5654
5654
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
5655
5655
|
}
|
|
@@ -5665,10 +5665,10 @@ function SidebarProvider({
|
|
|
5665
5665
|
...props
|
|
5666
5666
|
}) {
|
|
5667
5667
|
const isMobile = useIsMobile();
|
|
5668
|
-
const [openMobile, setOpenMobile] =
|
|
5669
|
-
const [_open, _setOpen] =
|
|
5668
|
+
const [openMobile, setOpenMobile] = React37__namespace.useState(false);
|
|
5669
|
+
const [_open, _setOpen] = React37__namespace.useState(defaultOpen);
|
|
5670
5670
|
const open = openProp ?? _open;
|
|
5671
|
-
const setOpen =
|
|
5671
|
+
const setOpen = React37__namespace.useCallback(
|
|
5672
5672
|
(value) => {
|
|
5673
5673
|
const openState = typeof value === "function" ? value(open) : value;
|
|
5674
5674
|
if (setOpenProp) {
|
|
@@ -5680,10 +5680,10 @@ function SidebarProvider({
|
|
|
5680
5680
|
},
|
|
5681
5681
|
[setOpenProp, open]
|
|
5682
5682
|
);
|
|
5683
|
-
const toggleSidebar =
|
|
5683
|
+
const toggleSidebar = React37__namespace.useCallback(() => {
|
|
5684
5684
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
5685
5685
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
5686
|
-
|
|
5686
|
+
React37__namespace.useEffect(() => {
|
|
5687
5687
|
const handleKeyDown = (event) => {
|
|
5688
5688
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
5689
5689
|
event.preventDefault();
|
|
@@ -5694,7 +5694,7 @@ function SidebarProvider({
|
|
|
5694
5694
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
5695
5695
|
}, [toggleSidebar]);
|
|
5696
5696
|
const state = open ? "expanded" : "collapsed";
|
|
5697
|
-
const contextValue =
|
|
5697
|
+
const contextValue = React37__namespace.useMemo(
|
|
5698
5698
|
() => ({
|
|
5699
5699
|
state,
|
|
5700
5700
|
open,
|
|
@@ -6152,7 +6152,7 @@ function SidebarMenuSkeleton({
|
|
|
6152
6152
|
showIcon = false,
|
|
6153
6153
|
...props
|
|
6154
6154
|
}) {
|
|
6155
|
-
const width =
|
|
6155
|
+
const width = React37__namespace.useMemo(() => {
|
|
6156
6156
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
6157
6157
|
}, []);
|
|
6158
6158
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6296,7 +6296,7 @@ var sectionVariants = classVarianceAuthority.cva(
|
|
|
6296
6296
|
}
|
|
6297
6297
|
);
|
|
6298
6298
|
var isGlassVariant = (variant) => variant?.startsWith("glass-") ?? false;
|
|
6299
|
-
var Section =
|
|
6299
|
+
var Section = React37__namespace.forwardRef(
|
|
6300
6300
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6301
6301
|
"section",
|
|
6302
6302
|
{
|
|
@@ -6308,7 +6308,7 @@ var Section = React36__namespace.forwardRef(
|
|
|
6308
6308
|
)
|
|
6309
6309
|
);
|
|
6310
6310
|
Section.displayName = "Section";
|
|
6311
|
-
var SectionHeader =
|
|
6311
|
+
var SectionHeader = React37__namespace.forwardRef(
|
|
6312
6312
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6313
6313
|
"div",
|
|
6314
6314
|
{
|
|
@@ -6323,7 +6323,7 @@ var SectionHeader = React36__namespace.forwardRef(
|
|
|
6323
6323
|
)
|
|
6324
6324
|
);
|
|
6325
6325
|
SectionHeader.displayName = "SectionHeader";
|
|
6326
|
-
var SectionTitle =
|
|
6326
|
+
var SectionTitle = React37__namespace.forwardRef(
|
|
6327
6327
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6328
6328
|
"h2",
|
|
6329
6329
|
{
|
|
@@ -6337,7 +6337,7 @@ var SectionTitle = React36__namespace.forwardRef(
|
|
|
6337
6337
|
)
|
|
6338
6338
|
);
|
|
6339
6339
|
SectionTitle.displayName = "SectionTitle";
|
|
6340
|
-
var SectionDescription =
|
|
6340
|
+
var SectionDescription = React37__namespace.forwardRef(
|
|
6341
6341
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6342
6342
|
"p",
|
|
6343
6343
|
{
|
|
@@ -6351,7 +6351,7 @@ var SectionDescription = React36__namespace.forwardRef(
|
|
|
6351
6351
|
)
|
|
6352
6352
|
);
|
|
6353
6353
|
SectionDescription.displayName = "SectionDescription";
|
|
6354
|
-
var SectionContent =
|
|
6354
|
+
var SectionContent = React37__namespace.forwardRef(
|
|
6355
6355
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6356
6356
|
"div",
|
|
6357
6357
|
{
|
|
@@ -6365,7 +6365,7 @@ var SectionContent = React36__namespace.forwardRef(
|
|
|
6365
6365
|
)
|
|
6366
6366
|
);
|
|
6367
6367
|
SectionContent.displayName = "SectionContent";
|
|
6368
|
-
var SectionFooter =
|
|
6368
|
+
var SectionFooter = React37__namespace.forwardRef(
|
|
6369
6369
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6370
6370
|
"div",
|
|
6371
6371
|
{
|
|
@@ -6590,7 +6590,7 @@ function SiteHeader({
|
|
|
6590
6590
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[var(--header-height,3.5rem)] w-full items-center gap-[var(--j3m-spacing-s)] px-[var(--j3m-spacing-m)]", children: [
|
|
6591
6591
|
trigger,
|
|
6592
6592
|
trigger && /* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mr-[var(--j3m-spacing-s)] h-4" }),
|
|
6593
|
-
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6593
|
+
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React37__namespace.Fragment, { children: [
|
|
6594
6594
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {}),
|
|
6595
6595
|
/* @__PURE__ */ jsxRuntime.jsx(BreadcrumbItem, { children: item.href ? /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbLink, { href: item.href, children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbPage, { children: item.label }) })
|
|
6596
6596
|
] }, index)) }) }),
|
|
@@ -7211,11 +7211,11 @@ function PlanningWeekCommentPopover({
|
|
|
7211
7211
|
open,
|
|
7212
7212
|
onOpenChange
|
|
7213
7213
|
}) {
|
|
7214
|
-
const [newCommentText, setNewCommentText] =
|
|
7215
|
-
const [selectedLocationId, setSelectedLocationId] =
|
|
7216
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
7217
|
-
const [showAddForm, setShowAddForm] =
|
|
7218
|
-
const selectedLocation =
|
|
7214
|
+
const [newCommentText, setNewCommentText] = React37__namespace.useState("");
|
|
7215
|
+
const [selectedLocationId, setSelectedLocationId] = React37__namespace.useState("");
|
|
7216
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React37__namespace.useState(true);
|
|
7217
|
+
const [showAddForm, setShowAddForm] = React37__namespace.useState(false);
|
|
7218
|
+
const selectedLocation = React37__namespace.useMemo(() => {
|
|
7219
7219
|
return locationOptions.find((opt) => opt.id === selectedLocationId);
|
|
7220
7220
|
}, [locationOptions, selectedLocationId]);
|
|
7221
7221
|
const handleSubmit = () => {
|
|
@@ -7259,8 +7259,8 @@ function PlanningWeekCommentPopover({
|
|
|
7259
7259
|
minute: "2-digit"
|
|
7260
7260
|
}).format(date);
|
|
7261
7261
|
};
|
|
7262
|
-
const prevOpenRef =
|
|
7263
|
-
|
|
7262
|
+
const prevOpenRef = React37__namespace.useRef(open);
|
|
7263
|
+
React37__namespace.useEffect(() => {
|
|
7264
7264
|
const wasOpen = prevOpenRef.current;
|
|
7265
7265
|
prevOpenRef.current = open;
|
|
7266
7266
|
if (wasOpen && !open) {
|
|
@@ -7639,15 +7639,15 @@ function PlanningTable({
|
|
|
7639
7639
|
stickySupplierColumn = true,
|
|
7640
7640
|
maxHeight = "600px"
|
|
7641
7641
|
} = config;
|
|
7642
|
-
const weeks =
|
|
7642
|
+
const weeks = React37__namespace.useMemo(
|
|
7643
7643
|
() => generateWeeks(startDate, weekCount),
|
|
7644
7644
|
[startDate, weekCount]
|
|
7645
7645
|
);
|
|
7646
|
-
const currentWeekKey =
|
|
7646
|
+
const currentWeekKey = React37__namespace.useMemo(() => {
|
|
7647
7647
|
const currentWeek = weeks.find((w) => w.isCurrentWeek);
|
|
7648
7648
|
return currentWeek ? getWeekKey(currentWeek.startDate) : null;
|
|
7649
7649
|
}, [weeks]);
|
|
7650
|
-
const columnSummaryData =
|
|
7650
|
+
const columnSummaryData = React37__namespace.useMemo(() => {
|
|
7651
7651
|
const summaryMap = /* @__PURE__ */ new Map();
|
|
7652
7652
|
for (const week of weeks) {
|
|
7653
7653
|
const weekKey = getWeekKey(week.startDate);
|
|
@@ -7689,14 +7689,14 @@ function PlanningTable({
|
|
|
7689
7689
|
}
|
|
7690
7690
|
return summaryMap;
|
|
7691
7691
|
}, [weeks, suppliers]);
|
|
7692
|
-
const columns =
|
|
7692
|
+
const columns = React37__namespace.useMemo(
|
|
7693
7693
|
() => generateColumns(weeks, config, suppliers, columnSummaryData),
|
|
7694
7694
|
[weeks, config, suppliers, columnSummaryData]
|
|
7695
7695
|
);
|
|
7696
|
-
const [sorting, setSorting] =
|
|
7697
|
-
const [columnFilters, setColumnFilters] =
|
|
7698
|
-
const [columnVisibility, setColumnVisibility] =
|
|
7699
|
-
const [rowSelection, setRowSelection] =
|
|
7696
|
+
const [sorting, setSorting] = React37__namespace.useState([]);
|
|
7697
|
+
const [columnFilters, setColumnFilters] = React37__namespace.useState([]);
|
|
7698
|
+
const [columnVisibility, setColumnVisibility] = React37__namespace.useState({});
|
|
7699
|
+
const [rowSelection, setRowSelection] = React37__namespace.useState({});
|
|
7700
7700
|
const table = reactTable.useReactTable({
|
|
7701
7701
|
data: suppliers,
|
|
7702
7702
|
columns,
|
|
@@ -7720,7 +7720,7 @@ function PlanningTable({
|
|
|
7720
7720
|
}
|
|
7721
7721
|
}
|
|
7722
7722
|
});
|
|
7723
|
-
const insightMetrics =
|
|
7723
|
+
const insightMetrics = React37__namespace.useMemo(() => {
|
|
7724
7724
|
let totalProduced = 0;
|
|
7725
7725
|
let totalRequired = 0;
|
|
7726
7726
|
let totalDeliveries = 0;
|
|
@@ -7954,10 +7954,10 @@ function DeliveryCommentPopover({
|
|
|
7954
7954
|
onAddComment,
|
|
7955
7955
|
deliveryLabel
|
|
7956
7956
|
}) {
|
|
7957
|
-
const [open, setOpen] =
|
|
7958
|
-
const [newCommentText, setNewCommentText] =
|
|
7959
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
7960
|
-
const [showAddForm, setShowAddForm] =
|
|
7957
|
+
const [open, setOpen] = React37__namespace.useState(false);
|
|
7958
|
+
const [newCommentText, setNewCommentText] = React37__namespace.useState("");
|
|
7959
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React37__namespace.useState(true);
|
|
7960
|
+
const [showAddForm, setShowAddForm] = React37__namespace.useState(false);
|
|
7961
7961
|
const handleSubmit = () => {
|
|
7962
7962
|
if (newCommentText.trim() && onAddComment) {
|
|
7963
7963
|
onAddComment(newCommentText.trim());
|
|
@@ -7984,8 +7984,8 @@ function DeliveryCommentPopover({
|
|
|
7984
7984
|
minute: "2-digit"
|
|
7985
7985
|
}).format(date);
|
|
7986
7986
|
};
|
|
7987
|
-
const prevOpenRef =
|
|
7988
|
-
|
|
7987
|
+
const prevOpenRef = React37__namespace.useRef(open);
|
|
7988
|
+
React37__namespace.useEffect(() => {
|
|
7989
7989
|
const wasOpen = prevOpenRef.current;
|
|
7990
7990
|
prevOpenRef.current = open;
|
|
7991
7991
|
if (wasOpen && !open) {
|
|
@@ -8097,8 +8097,8 @@ function ProductionCommentSection({
|
|
|
8097
8097
|
comments = [],
|
|
8098
8098
|
onAddComment
|
|
8099
8099
|
}) {
|
|
8100
|
-
const [showAddForm, setShowAddForm] =
|
|
8101
|
-
const [newComment, setNewComment] =
|
|
8100
|
+
const [showAddForm, setShowAddForm] = React37__namespace.useState(false);
|
|
8101
|
+
const [newComment, setNewComment] = React37__namespace.useState("");
|
|
8102
8102
|
const handleSubmit = () => {
|
|
8103
8103
|
if (newComment.trim() && onAddComment) {
|
|
8104
8104
|
onAddComment(newComment.trim());
|
|
@@ -8283,7 +8283,7 @@ function DeliveryDetailsView({
|
|
|
8283
8283
|
onAddComment
|
|
8284
8284
|
}) {
|
|
8285
8285
|
const elements = delivery.elements ?? [];
|
|
8286
|
-
const categorizedElements =
|
|
8286
|
+
const categorizedElements = React37__namespace.useMemo(() => {
|
|
8287
8287
|
const sent = [];
|
|
8288
8288
|
const notSent = [];
|
|
8289
8289
|
const moved = [];
|
|
@@ -8651,15 +8651,15 @@ function WeekDetailDialog({
|
|
|
8651
8651
|
}) {
|
|
8652
8652
|
const production = data?.production;
|
|
8653
8653
|
const initialProduced = production?.produced ?? 0;
|
|
8654
|
-
const [producedValue, setProducedValue] =
|
|
8655
|
-
const [hasChanges, setHasChanges] =
|
|
8656
|
-
const [selectedDelivery, setSelectedDelivery] =
|
|
8657
|
-
|
|
8654
|
+
const [producedValue, setProducedValue] = React37__namespace.useState(initialProduced.toString());
|
|
8655
|
+
const [hasChanges, setHasChanges] = React37__namespace.useState(false);
|
|
8656
|
+
const [selectedDelivery, setSelectedDelivery] = React37__namespace.useState(null);
|
|
8657
|
+
React37__namespace.useEffect(() => {
|
|
8658
8658
|
const newProduced = data?.production?.produced ?? 0;
|
|
8659
8659
|
setProducedValue(newProduced.toString());
|
|
8660
8660
|
setHasChanges(false);
|
|
8661
8661
|
}, [data]);
|
|
8662
|
-
|
|
8662
|
+
React37__namespace.useEffect(() => {
|
|
8663
8663
|
if (!open) {
|
|
8664
8664
|
setSelectedDelivery(null);
|
|
8665
8665
|
}
|
|
@@ -8790,24 +8790,24 @@ function ElementProductionDialog({
|
|
|
8790
8790
|
elements,
|
|
8791
8791
|
onSave
|
|
8792
8792
|
}) {
|
|
8793
|
-
const [searchQuery, setSearchQuery] =
|
|
8794
|
-
const [selectedIds, setSelectedIds] =
|
|
8793
|
+
const [searchQuery, setSearchQuery] = React37__namespace.useState("");
|
|
8794
|
+
const [selectedIds, setSelectedIds] = React37__namespace.useState(
|
|
8795
8795
|
new Set(elements.filter((e) => e.isProduced).map((e) => e.id))
|
|
8796
8796
|
);
|
|
8797
|
-
|
|
8797
|
+
React37__namespace.useEffect(() => {
|
|
8798
8798
|
if (open) {
|
|
8799
8799
|
setSelectedIds(new Set(elements.filter((e) => e.isProduced).map((e) => e.id)));
|
|
8800
8800
|
setSearchQuery("");
|
|
8801
8801
|
}
|
|
8802
8802
|
}, [open, elements]);
|
|
8803
|
-
const filteredElements =
|
|
8803
|
+
const filteredElements = React37__namespace.useMemo(() => {
|
|
8804
8804
|
if (!searchQuery.trim()) return elements;
|
|
8805
8805
|
const query = searchQuery.toLowerCase();
|
|
8806
8806
|
return elements.filter(
|
|
8807
8807
|
(e) => e.name.toLowerCase().includes(query) || e.prefix?.toLowerCase().includes(query) || e.type?.toLowerCase().includes(query)
|
|
8808
8808
|
);
|
|
8809
8809
|
}, [elements, searchQuery]);
|
|
8810
|
-
|
|
8810
|
+
React37__namespace.useMemo(() => {
|
|
8811
8811
|
const prefixes = /* @__PURE__ */ new Set();
|
|
8812
8812
|
elements.forEach((e) => {
|
|
8813
8813
|
if (e.prefix) prefixes.add(e.prefix);
|
|
@@ -8993,10 +8993,10 @@ function DeliveryCommentPopover2({
|
|
|
8993
8993
|
onAddComment,
|
|
8994
8994
|
deliveryLabel
|
|
8995
8995
|
}) {
|
|
8996
|
-
const [open, setOpen] =
|
|
8997
|
-
const [newCommentText, setNewCommentText] =
|
|
8998
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
8999
|
-
const [showAddForm, setShowAddForm] =
|
|
8996
|
+
const [open, setOpen] = React37__namespace.useState(false);
|
|
8997
|
+
const [newCommentText, setNewCommentText] = React37__namespace.useState("");
|
|
8998
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React37__namespace.useState(true);
|
|
8999
|
+
const [showAddForm, setShowAddForm] = React37__namespace.useState(false);
|
|
9000
9000
|
const handleSubmit = () => {
|
|
9001
9001
|
if (newCommentText.trim() && onAddComment) {
|
|
9002
9002
|
onAddComment(newCommentText.trim());
|
|
@@ -9023,7 +9023,7 @@ function DeliveryCommentPopover2({
|
|
|
9023
9023
|
minute: "2-digit"
|
|
9024
9024
|
}).format(date);
|
|
9025
9025
|
};
|
|
9026
|
-
|
|
9026
|
+
React37__namespace.useEffect(() => {
|
|
9027
9027
|
if (!open) {
|
|
9028
9028
|
setShowAddForm(false);
|
|
9029
9029
|
setNewCommentText("");
|
|
@@ -9133,8 +9133,8 @@ function ProductionCommentSection2({
|
|
|
9133
9133
|
comments = [],
|
|
9134
9134
|
onAddComment
|
|
9135
9135
|
}) {
|
|
9136
|
-
const [showAddForm, setShowAddForm] =
|
|
9137
|
-
const [newComment, setNewComment] =
|
|
9136
|
+
const [showAddForm, setShowAddForm] = React37__namespace.useState(false);
|
|
9137
|
+
const [newComment, setNewComment] = React37__namespace.useState("");
|
|
9138
9138
|
const handleSubmit = () => {
|
|
9139
9139
|
if (newComment.trim() && onAddComment) {
|
|
9140
9140
|
onAddComment(newComment.trim());
|
|
@@ -9319,7 +9319,7 @@ function DeliveryDetailsView2({
|
|
|
9319
9319
|
onAddComment
|
|
9320
9320
|
}) {
|
|
9321
9321
|
const elements = delivery.elements ?? [];
|
|
9322
|
-
const categorizedElements =
|
|
9322
|
+
const categorizedElements = React37__namespace.useMemo(() => {
|
|
9323
9323
|
const sent = [];
|
|
9324
9324
|
const notSent = [];
|
|
9325
9325
|
const moved = [];
|
|
@@ -9653,10 +9653,10 @@ function WeekDetailSheet({
|
|
|
9653
9653
|
onAddProductionComment,
|
|
9654
9654
|
onAddDeliveryComment
|
|
9655
9655
|
}) {
|
|
9656
|
-
const [selectedDelivery, setSelectedDelivery] =
|
|
9657
|
-
const [productionDialogOpen, setProductionDialogOpen] =
|
|
9658
|
-
const [previousProducedCount, setPreviousProducedCount] =
|
|
9659
|
-
const productionElements =
|
|
9656
|
+
const [selectedDelivery, setSelectedDelivery] = React37__namespace.useState(null);
|
|
9657
|
+
const [productionDialogOpen, setProductionDialogOpen] = React37__namespace.useState(false);
|
|
9658
|
+
const [previousProducedCount, setPreviousProducedCount] = React37__namespace.useState(void 0);
|
|
9659
|
+
const productionElements = React37__namespace.useMemo(() => {
|
|
9660
9660
|
if (!data?.deliveries) return [];
|
|
9661
9661
|
const elements = [];
|
|
9662
9662
|
const seenIds = /* @__PURE__ */ new Set();
|
|
@@ -9680,12 +9680,12 @@ function WeekDetailSheet({
|
|
|
9680
9680
|
return elements;
|
|
9681
9681
|
}, [data?.deliveries]);
|
|
9682
9682
|
const currentProducedCount = productionElements.filter((e) => e.isProduced).length;
|
|
9683
|
-
|
|
9683
|
+
React37__namespace.useEffect(() => {
|
|
9684
9684
|
if (open && data?.deliveries) {
|
|
9685
9685
|
setPreviousProducedCount(currentProducedCount);
|
|
9686
9686
|
}
|
|
9687
9687
|
}, [open]);
|
|
9688
|
-
|
|
9688
|
+
React37__namespace.useEffect(() => {
|
|
9689
9689
|
if (!open) {
|
|
9690
9690
|
setSelectedDelivery(null);
|
|
9691
9691
|
setProductionDialogOpen(false);
|
|
@@ -9918,13 +9918,13 @@ function CalibrationWeekCell({
|
|
|
9918
9918
|
onAddClick,
|
|
9919
9919
|
...props
|
|
9920
9920
|
}) {
|
|
9921
|
-
const inputRef =
|
|
9922
|
-
const [localValue, setLocalValue] =
|
|
9921
|
+
const inputRef = React37__namespace.useRef(null);
|
|
9922
|
+
const [localValue, setLocalValue] = React37__namespace.useState(
|
|
9923
9923
|
data.entered !== null ? String(data.entered) : ""
|
|
9924
9924
|
);
|
|
9925
|
-
const [isHovered, setIsHovered] =
|
|
9926
|
-
const [isEditing, setIsEditing] =
|
|
9927
|
-
|
|
9925
|
+
const [isHovered, setIsHovered] = React37__namespace.useState(false);
|
|
9926
|
+
const [isEditing, setIsEditing] = React37__namespace.useState(false);
|
|
9927
|
+
React37__namespace.useEffect(() => {
|
|
9928
9928
|
setLocalValue(data.entered !== null ? String(data.entered) : "");
|
|
9929
9929
|
}, [data.entered]);
|
|
9930
9930
|
const unitLabel = formatCalibrationUnit(unit);
|
|
@@ -10110,11 +10110,11 @@ function CommentPopover({
|
|
|
10110
10110
|
open,
|
|
10111
10111
|
onOpenChange
|
|
10112
10112
|
}) {
|
|
10113
|
-
const [newCommentText, setNewCommentText] =
|
|
10114
|
-
const [selectedPrefixId, setSelectedPrefixId] =
|
|
10115
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
10116
|
-
const [showAddForm, setShowAddForm] =
|
|
10117
|
-
const selectedPrefixName =
|
|
10113
|
+
const [newCommentText, setNewCommentText] = React37__namespace.useState("");
|
|
10114
|
+
const [selectedPrefixId, setSelectedPrefixId] = React37__namespace.useState("");
|
|
10115
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React37__namespace.useState(true);
|
|
10116
|
+
const [showAddForm, setShowAddForm] = React37__namespace.useState(false);
|
|
10117
|
+
const selectedPrefixName = React37__namespace.useMemo(() => {
|
|
10118
10118
|
const prefix = availablePrefixes.find((p) => p.id === selectedPrefixId);
|
|
10119
10119
|
return prefix?.name ?? "";
|
|
10120
10120
|
}, [availablePrefixes, selectedPrefixId]);
|
|
@@ -10146,8 +10146,8 @@ function CommentPopover({
|
|
|
10146
10146
|
minute: "2-digit"
|
|
10147
10147
|
}).format(date);
|
|
10148
10148
|
};
|
|
10149
|
-
const prevOpenRef =
|
|
10150
|
-
|
|
10149
|
+
const prevOpenRef = React37__namespace.useRef(open);
|
|
10150
|
+
React37__namespace.useEffect(() => {
|
|
10151
10151
|
const wasOpen = prevOpenRef.current;
|
|
10152
10152
|
prevOpenRef.current = open;
|
|
10153
10153
|
if (wasOpen && !open) {
|
|
@@ -10392,7 +10392,7 @@ function CalibrationTable({
|
|
|
10392
10392
|
onAddComment,
|
|
10393
10393
|
onAddEarlierWeek
|
|
10394
10394
|
} = config;
|
|
10395
|
-
const calculatedStartDate =
|
|
10395
|
+
const calculatedStartDate = React37__namespace.useMemo(() => {
|
|
10396
10396
|
if (startDate) return startDate;
|
|
10397
10397
|
let earliest = null;
|
|
10398
10398
|
for (const prefix of prefixes) {
|
|
@@ -10413,31 +10413,31 @@ function CalibrationTable({
|
|
|
10413
10413
|
}
|
|
10414
10414
|
return earliest ?? /* @__PURE__ */ new Date();
|
|
10415
10415
|
}, [startDate, prefixes]);
|
|
10416
|
-
const [additionalWeeks, setAdditionalWeeks] =
|
|
10417
|
-
const weeks =
|
|
10416
|
+
const [additionalWeeks, setAdditionalWeeks] = React37__namespace.useState(0);
|
|
10417
|
+
const weeks = React37__namespace.useMemo(() => {
|
|
10418
10418
|
const start = new Date(calculatedStartDate);
|
|
10419
10419
|
start.setDate(start.getDate() - additionalWeeks * 7);
|
|
10420
10420
|
return generateWeeks(start, weekCount + additionalWeeks);
|
|
10421
10421
|
}, [calculatedStartDate, weekCount, additionalWeeks]);
|
|
10422
|
-
|
|
10422
|
+
React37__namespace.useMemo(() => {
|
|
10423
10423
|
const currentWeek = weeks.find((w) => w.isCurrentWeek);
|
|
10424
10424
|
return currentWeek ? getWeekKey(currentWeek.startDate) : null;
|
|
10425
10425
|
}, [weeks]);
|
|
10426
|
-
const [currentPage, setCurrentPage] =
|
|
10427
|
-
const [pageSize, setPageSize] =
|
|
10428
|
-
const [searchQuery, setSearchQuery] =
|
|
10429
|
-
const filteredPrefixes =
|
|
10426
|
+
const [currentPage, setCurrentPage] = React37__namespace.useState(0);
|
|
10427
|
+
const [pageSize, setPageSize] = React37__namespace.useState(defaultPageSize);
|
|
10428
|
+
const [searchQuery, setSearchQuery] = React37__namespace.useState("");
|
|
10429
|
+
const filteredPrefixes = React37__namespace.useMemo(() => {
|
|
10430
10430
|
if (!searchQuery) return prefixes;
|
|
10431
10431
|
const query = searchQuery.toLowerCase();
|
|
10432
10432
|
return prefixes.filter(
|
|
10433
10433
|
(p) => p.name.toLowerCase().includes(query) || p.typeCode.toLowerCase().includes(query)
|
|
10434
10434
|
);
|
|
10435
10435
|
}, [prefixes, searchQuery]);
|
|
10436
|
-
const paginatedPrefixes =
|
|
10436
|
+
const paginatedPrefixes = React37__namespace.useMemo(() => {
|
|
10437
10437
|
const start = currentPage * pageSize;
|
|
10438
10438
|
return filteredPrefixes.slice(start, start + pageSize);
|
|
10439
10439
|
}, [filteredPrefixes, currentPage, pageSize]);
|
|
10440
|
-
|
|
10440
|
+
React37__namespace.useMemo(
|
|
10441
10441
|
() => canSubmitCalibration(prefixes),
|
|
10442
10442
|
[prefixes]
|
|
10443
10443
|
);
|
|
@@ -10461,11 +10461,11 @@ function CalibrationTable({
|
|
|
10461
10461
|
}
|
|
10462
10462
|
return allComments;
|
|
10463
10463
|
};
|
|
10464
|
-
const availablePrefixes =
|
|
10464
|
+
const availablePrefixes = React37__namespace.useMemo(
|
|
10465
10465
|
() => prefixes.map((p) => ({ id: p.id, name: p.name })),
|
|
10466
10466
|
[prefixes]
|
|
10467
10467
|
);
|
|
10468
|
-
const insightMetrics =
|
|
10468
|
+
const insightMetrics = React37__namespace.useMemo(() => {
|
|
10469
10469
|
let totalCalibrated = 0;
|
|
10470
10470
|
let totalRequired = 0;
|
|
10471
10471
|
for (const prefix of prefixes) {
|
|
@@ -10506,7 +10506,7 @@ function CalibrationTable({
|
|
|
10506
10506
|
}
|
|
10507
10507
|
];
|
|
10508
10508
|
}, [prefixes]);
|
|
10509
|
-
const columnSummaryData =
|
|
10509
|
+
const columnSummaryData = React37__namespace.useMemo(() => {
|
|
10510
10510
|
const summaryMap = /* @__PURE__ */ new Map();
|
|
10511
10511
|
for (const week of weeks) {
|
|
10512
10512
|
const weekKey = getWeekKey(week.startDate);
|
|
@@ -10773,14 +10773,14 @@ function CommentDialog({
|
|
|
10773
10773
|
open,
|
|
10774
10774
|
onOpenChange
|
|
10775
10775
|
}) {
|
|
10776
|
-
const [selectedPrefixId, setSelectedPrefixId] =
|
|
10777
|
-
const [selectedWeekKey, setSelectedWeekKey] =
|
|
10778
|
-
const [commentText, setCommentText] =
|
|
10779
|
-
const currentWeek =
|
|
10776
|
+
const [selectedPrefixId, setSelectedPrefixId] = React37__namespace.useState("");
|
|
10777
|
+
const [selectedWeekKey, setSelectedWeekKey] = React37__namespace.useState("");
|
|
10778
|
+
const [commentText, setCommentText] = React37__namespace.useState("");
|
|
10779
|
+
const currentWeek = React37__namespace.useMemo(
|
|
10780
10780
|
() => weeks.find((w) => w.isCurrentWeek),
|
|
10781
10781
|
[weeks]
|
|
10782
10782
|
);
|
|
10783
|
-
|
|
10783
|
+
React37__namespace.useEffect(() => {
|
|
10784
10784
|
if (open) {
|
|
10785
10785
|
setSelectedPrefixId(prefixes[0]?.id ?? "");
|
|
10786
10786
|
setSelectedWeekKey(currentWeek ? getWeekKey(currentWeek.startDate) : weeks[0] ? getWeekKey(weeks[0].startDate) : "");
|
|
@@ -11327,7 +11327,7 @@ function WeeklyLoadingView({
|
|
|
11327
11327
|
showNavigation = true,
|
|
11328
11328
|
className
|
|
11329
11329
|
}) {
|
|
11330
|
-
const [shippedOpenState, setShippedOpenState] =
|
|
11330
|
+
const [shippedOpenState, setShippedOpenState] = React37__namespace.useState({
|
|
11331
11331
|
1: false,
|
|
11332
11332
|
// Monday
|
|
11333
11333
|
2: false,
|
|
@@ -11345,7 +11345,7 @@ function WeeklyLoadingView({
|
|
|
11345
11345
|
[dayOfWeek]: !prev[dayOfWeek]
|
|
11346
11346
|
}));
|
|
11347
11347
|
};
|
|
11348
|
-
const weekDays =
|
|
11348
|
+
const weekDays = React37__namespace.useMemo(() => {
|
|
11349
11349
|
const days = [];
|
|
11350
11350
|
for (let i = 0; i < 5; i++) {
|
|
11351
11351
|
const date = dateFns.addDays(week.startDate, i);
|
|
@@ -11357,7 +11357,7 @@ function WeeklyLoadingView({
|
|
|
11357
11357
|
}
|
|
11358
11358
|
return days;
|
|
11359
11359
|
}, [week.startDate]);
|
|
11360
|
-
const deliveriesByDay =
|
|
11360
|
+
const deliveriesByDay = React37__namespace.useMemo(() => {
|
|
11361
11361
|
const grouped = /* @__PURE__ */ new Map();
|
|
11362
11362
|
for (let i = 1; i <= 5; i++) {
|
|
11363
11363
|
grouped.set(i, { pending: [], shipped: [] });
|
|
@@ -11377,7 +11377,7 @@ function WeeklyLoadingView({
|
|
|
11377
11377
|
}, [deliveries]);
|
|
11378
11378
|
const totalPendingDeliveries = deliveries.filter((d) => !isShippedDelivery(d)).length;
|
|
11379
11379
|
const totalShippedDeliveries = deliveries.filter((d) => isShippedDelivery(d)).length;
|
|
11380
|
-
const daySummaryData =
|
|
11380
|
+
const daySummaryData = React37__namespace.useMemo(() => {
|
|
11381
11381
|
const summaries = /* @__PURE__ */ new Map();
|
|
11382
11382
|
for (let i = 1; i <= 5; i++) {
|
|
11383
11383
|
const dayData = deliveriesByDay.get(i) ?? { pending: [], shipped: [] };
|
|
@@ -11731,7 +11731,7 @@ function DeliveryTimeline({ timelineState }) {
|
|
|
11731
11731
|
const state = getStateForStep(step.id);
|
|
11732
11732
|
const styles = getStepStyles(state);
|
|
11733
11733
|
const isLast = index === TIMELINE_STEPS.length - 1;
|
|
11734
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11734
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React37__namespace.Fragment, { children: [
|
|
11735
11735
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
11736
11736
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11737
11737
|
"div",
|
|
@@ -11866,7 +11866,7 @@ function AddCommentDialog({
|
|
|
11866
11866
|
weekId,
|
|
11867
11867
|
onAddComment
|
|
11868
11868
|
}) {
|
|
11869
|
-
const [commentText, setCommentText] =
|
|
11869
|
+
const [commentText, setCommentText] = React37__namespace.useState("");
|
|
11870
11870
|
const handleSubmit = () => {
|
|
11871
11871
|
if (commentText.trim() && onAddComment) {
|
|
11872
11872
|
onAddComment({
|
|
@@ -11891,7 +11891,7 @@ function AddCommentDialog({
|
|
|
11891
11891
|
handleSubmit();
|
|
11892
11892
|
}
|
|
11893
11893
|
};
|
|
11894
|
-
|
|
11894
|
+
React37__namespace.useEffect(() => {
|
|
11895
11895
|
if (!open) {
|
|
11896
11896
|
setCommentText("");
|
|
11897
11897
|
}
|
|
@@ -11954,8 +11954,8 @@ function CommentsSection({
|
|
|
11954
11954
|
weekId,
|
|
11955
11955
|
onAddComment
|
|
11956
11956
|
}) {
|
|
11957
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
11958
|
-
const [addDialogOpen, setAddDialogOpen] =
|
|
11957
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React37__namespace.useState(true);
|
|
11958
|
+
const [addDialogOpen, setAddDialogOpen] = React37__namespace.useState(false);
|
|
11959
11959
|
const formatDate6 = (date) => {
|
|
11960
11960
|
return new Intl.DateTimeFormat("en-US", {
|
|
11961
11961
|
month: "short",
|
|
@@ -12029,7 +12029,7 @@ function DeliveryDetailPage({
|
|
|
12029
12029
|
onConfirmLoad
|
|
12030
12030
|
}) {
|
|
12031
12031
|
const timelineState = getTimelineState(delivery);
|
|
12032
|
-
const elementsByStatus =
|
|
12032
|
+
const elementsByStatus = React37__namespace.useMemo(() => {
|
|
12033
12033
|
const loaded = delivery.elements.filter((e) => e.status === "loaded");
|
|
12034
12034
|
const missing = delivery.elements.filter((e) => e.status === "missing");
|
|
12035
12035
|
const moved = delivery.elements.filter((e) => e.status === "moved");
|
|
@@ -12216,11 +12216,11 @@ function SupplierWeeklyLoading({
|
|
|
12216
12216
|
bordered = true,
|
|
12217
12217
|
className
|
|
12218
12218
|
}) {
|
|
12219
|
-
const [selectedDelivery, setSelectedDelivery] =
|
|
12220
|
-
const [sheetOpen, setSheetOpen] =
|
|
12221
|
-
const [commentDelivery, setCommentDelivery] =
|
|
12222
|
-
const [commentDialogOpen, setCommentDialogOpen] =
|
|
12223
|
-
const [commentText, setCommentText] =
|
|
12219
|
+
const [selectedDelivery, setSelectedDelivery] = React37__namespace.useState(null);
|
|
12220
|
+
const [sheetOpen, setSheetOpen] = React37__namespace.useState(false);
|
|
12221
|
+
const [commentDelivery, setCommentDelivery] = React37__namespace.useState(null);
|
|
12222
|
+
const [commentDialogOpen, setCommentDialogOpen] = React37__namespace.useState(false);
|
|
12223
|
+
const [commentText, setCommentText] = React37__namespace.useState("");
|
|
12224
12224
|
const handleDeliveryClick = (delivery) => {
|
|
12225
12225
|
setSelectedDelivery(delivery);
|
|
12226
12226
|
setSheetOpen(true);
|
|
@@ -12263,7 +12263,7 @@ function SupplierWeeklyLoading({
|
|
|
12263
12263
|
handleCommentSubmit();
|
|
12264
12264
|
}
|
|
12265
12265
|
};
|
|
12266
|
-
const insightMetrics =
|
|
12266
|
+
const insightMetrics = React37__namespace.useMemo(() => {
|
|
12267
12267
|
const totalDeliveries = deliveries.length;
|
|
12268
12268
|
const readyDeliveries = deliveries.filter((d) => d.isReadyToUnload).length;
|
|
12269
12269
|
deliveries.filter(
|
|
@@ -12682,11 +12682,11 @@ function CapacityPlanningChart({
|
|
|
12682
12682
|
allowDragDrop = true,
|
|
12683
12683
|
className
|
|
12684
12684
|
}) {
|
|
12685
|
-
const containerRef =
|
|
12686
|
-
const [draggedPackage, setDraggedPackage] =
|
|
12687
|
-
const [showUnassigned, setShowUnassigned] =
|
|
12688
|
-
const [containerWidth, setContainerWidth] =
|
|
12689
|
-
|
|
12685
|
+
const containerRef = React37__namespace.useRef(null);
|
|
12686
|
+
const [draggedPackage, setDraggedPackage] = React37__namespace.useState(null);
|
|
12687
|
+
const [showUnassigned, setShowUnassigned] = React37__namespace.useState(true);
|
|
12688
|
+
const [containerWidth, setContainerWidth] = React37__namespace.useState(0);
|
|
12689
|
+
React37__namespace.useEffect(() => {
|
|
12690
12690
|
const updateWidth = () => {
|
|
12691
12691
|
if (containerRef.current) {
|
|
12692
12692
|
setContainerWidth(containerRef.current.offsetWidth);
|
|
@@ -12699,15 +12699,15 @@ function CapacityPlanningChart({
|
|
|
12699
12699
|
}
|
|
12700
12700
|
return () => observer.disconnect();
|
|
12701
12701
|
}, []);
|
|
12702
|
-
const cumulativeNeed =
|
|
12702
|
+
const cumulativeNeed = React37__namespace.useMemo(
|
|
12703
12703
|
() => calculateCumulativeNeed(weeks, deliveries),
|
|
12704
12704
|
[weeks, deliveries]
|
|
12705
12705
|
);
|
|
12706
|
-
const packagePositions =
|
|
12706
|
+
const packagePositions = React37__namespace.useMemo(
|
|
12707
12707
|
() => calculatePackagePositions(packages, weeks),
|
|
12708
12708
|
[packages, weeks]
|
|
12709
12709
|
);
|
|
12710
|
-
const deliveriesByWeek =
|
|
12710
|
+
const deliveriesByWeek = React37__namespace.useMemo(() => {
|
|
12711
12711
|
const map = /* @__PURE__ */ new Map();
|
|
12712
12712
|
for (const d of deliveries) {
|
|
12713
12713
|
const existing = map.get(d.weekKey) || [];
|
|
@@ -13244,7 +13244,7 @@ var calculateInnerOffset = (date, range, columnWidth) => {
|
|
|
13244
13244
|
const dayOfMonth = date.getDate();
|
|
13245
13245
|
return dayOfMonth / totalRangeDays * columnWidth;
|
|
13246
13246
|
};
|
|
13247
|
-
var GanttContext =
|
|
13247
|
+
var GanttContext = React37.createContext({
|
|
13248
13248
|
zoom: 100,
|
|
13249
13249
|
range: "monthly",
|
|
13250
13250
|
columnWidth: 50,
|
|
@@ -13260,13 +13260,13 @@ var GanttContext = React36.createContext({
|
|
|
13260
13260
|
setGroupExpanded: () => {
|
|
13261
13261
|
}
|
|
13262
13262
|
});
|
|
13263
|
-
var useGanttContext = () =>
|
|
13263
|
+
var useGanttContext = () => React37.useContext(GanttContext);
|
|
13264
13264
|
var GanttContentHeader = ({
|
|
13265
13265
|
title,
|
|
13266
13266
|
columns,
|
|
13267
13267
|
renderHeaderItem
|
|
13268
13268
|
}) => {
|
|
13269
|
-
const id =
|
|
13269
|
+
const id = React37.useId();
|
|
13270
13270
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13271
13271
|
"div",
|
|
13272
13272
|
{
|
|
@@ -13314,8 +13314,8 @@ var getWeekStartDate = (year, weekNumber) => {
|
|
|
13314
13314
|
return dateFns.addWeeks(week1Start, weekNumber - 1);
|
|
13315
13315
|
};
|
|
13316
13316
|
var WeeklyHeader = () => {
|
|
13317
|
-
const gantt =
|
|
13318
|
-
const weeklyData =
|
|
13317
|
+
const gantt = React37.useContext(GanttContext);
|
|
13318
|
+
const weeklyData = React37.useMemo(() => {
|
|
13319
13319
|
const result = [];
|
|
13320
13320
|
for (const yearData of gantt.timelineData) {
|
|
13321
13321
|
const year = yearData.year;
|
|
@@ -13350,7 +13350,7 @@ var WeeklyHeader = () => {
|
|
|
13350
13350
|
] }, yearData.year));
|
|
13351
13351
|
};
|
|
13352
13352
|
var MonthlyHeader = () => {
|
|
13353
|
-
const gantt =
|
|
13353
|
+
const gantt = React37.useContext(GanttContext);
|
|
13354
13354
|
return gantt.timelineData.map((year) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col", children: [
|
|
13355
13355
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13356
13356
|
GanttContentHeader,
|
|
@@ -13369,7 +13369,7 @@ var MonthlyHeader = () => {
|
|
|
13369
13369
|
] }, year.year));
|
|
13370
13370
|
};
|
|
13371
13371
|
var QuarterlyHeader = () => {
|
|
13372
|
-
const gantt =
|
|
13372
|
+
const gantt = React37.useContext(GanttContext);
|
|
13373
13373
|
return gantt.timelineData.map(
|
|
13374
13374
|
(year) => year.quarters.map((quarter, quarterIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13375
13375
|
"div",
|
|
@@ -13397,7 +13397,7 @@ var headers = {
|
|
|
13397
13397
|
quarterly: QuarterlyHeader
|
|
13398
13398
|
};
|
|
13399
13399
|
var GanttHeader = ({ className }) => {
|
|
13400
|
-
const gantt =
|
|
13400
|
+
const gantt = React37.useContext(GanttContext);
|
|
13401
13401
|
const Header2 = headers[gantt.range];
|
|
13402
13402
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13403
13403
|
"div",
|
|
@@ -13415,7 +13415,7 @@ var GanttSidebarItem = ({
|
|
|
13415
13415
|
onSelectItem,
|
|
13416
13416
|
className
|
|
13417
13417
|
}) => {
|
|
13418
|
-
const gantt =
|
|
13418
|
+
const gantt = React37.useContext(GanttContext);
|
|
13419
13419
|
const tempEndAt = feature.endAt && dateFns.isSameDay(feature.startAt, feature.endAt) ? dateFns.addDays(feature.endAt, 1) : feature.endAt;
|
|
13420
13420
|
const duration = tempEndAt ? dateFns.formatDistance(feature.startAt, tempEndAt) : `${dateFns.formatDistance(feature.startAt, /* @__PURE__ */ new Date())} so far`;
|
|
13421
13421
|
const handleClick = (event) => {
|
|
@@ -13491,24 +13491,24 @@ function computeGroupRange(features) {
|
|
|
13491
13491
|
}
|
|
13492
13492
|
return { start: minStart, end: maxEnd };
|
|
13493
13493
|
}
|
|
13494
|
-
var GanttGroupSummaryBar =
|
|
13494
|
+
var GanttGroupSummaryBar = React37.memo(({
|
|
13495
13495
|
group,
|
|
13496
13496
|
className
|
|
13497
13497
|
}) => {
|
|
13498
|
-
const gantt =
|
|
13499
|
-
const timelineStartDate =
|
|
13498
|
+
const gantt = React37.useContext(GanttContext);
|
|
13499
|
+
const timelineStartDate = React37.useMemo(
|
|
13500
13500
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
13501
13501
|
[gantt.timelineData]
|
|
13502
13502
|
);
|
|
13503
|
-
const { start: groupStart, end: groupEnd } =
|
|
13503
|
+
const { start: groupStart, end: groupEnd } = React37.useMemo(
|
|
13504
13504
|
() => computeGroupRange(group.features),
|
|
13505
13505
|
[group.features]
|
|
13506
13506
|
);
|
|
13507
|
-
const offset =
|
|
13507
|
+
const offset = React37.useMemo(() => {
|
|
13508
13508
|
if (!groupStart) return 0;
|
|
13509
13509
|
return Math.round(getOffset(groupStart, timelineStartDate, gantt));
|
|
13510
13510
|
}, [groupStart, timelineStartDate, gantt]);
|
|
13511
|
-
const width =
|
|
13511
|
+
const width = React37.useMemo(() => {
|
|
13512
13512
|
if (!groupStart || !groupEnd) return 0;
|
|
13513
13513
|
return Math.round(getWidth(groupStart, groupEnd, gantt));
|
|
13514
13514
|
}, [groupStart, groupEnd, gantt]);
|
|
@@ -13548,13 +13548,13 @@ var GanttCollapsibleSidebarGroup = ({
|
|
|
13548
13548
|
children,
|
|
13549
13549
|
className
|
|
13550
13550
|
}) => {
|
|
13551
|
-
const gantt =
|
|
13551
|
+
const gantt = React37.useContext(GanttContext);
|
|
13552
13552
|
const isExpanded = gantt.expandedGroups[group.id] ?? true;
|
|
13553
|
-
const { start: groupStart, end: groupEnd } =
|
|
13553
|
+
const { start: groupStart, end: groupEnd } = React37.useMemo(
|
|
13554
13554
|
() => computeGroupRange(group.features),
|
|
13555
13555
|
[group.features]
|
|
13556
13556
|
);
|
|
13557
|
-
const duration =
|
|
13557
|
+
const duration = React37.useMemo(() => {
|
|
13558
13558
|
if (!groupStart || !groupEnd) return null;
|
|
13559
13559
|
return dateFns.formatDistance(groupStart, groupEnd);
|
|
13560
13560
|
}, [groupStart, groupEnd]);
|
|
@@ -13598,7 +13598,7 @@ var GanttCollapsibleTimelineGroup = ({
|
|
|
13598
13598
|
children,
|
|
13599
13599
|
className
|
|
13600
13600
|
}) => {
|
|
13601
|
-
const gantt =
|
|
13601
|
+
const gantt = React37.useContext(GanttContext);
|
|
13602
13602
|
const isExpanded = gantt.expandedGroups[group.id] ?? true;
|
|
13603
13603
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13604
13604
|
Collapsible,
|
|
@@ -13658,7 +13658,7 @@ var GanttAddFeatureHelper = ({
|
|
|
13658
13658
|
className
|
|
13659
13659
|
}) => {
|
|
13660
13660
|
const [scrollX] = useGanttScrollX();
|
|
13661
|
-
const gantt =
|
|
13661
|
+
const gantt = React37.useContext(GanttContext);
|
|
13662
13662
|
const [mousePosition, mouseRef] = usehooks.useMouse();
|
|
13663
13663
|
const handleClick = () => {
|
|
13664
13664
|
const ganttRect = gantt.ref?.current?.getBoundingClientRect();
|
|
@@ -13697,10 +13697,10 @@ var GanttColumn = ({
|
|
|
13697
13697
|
index,
|
|
13698
13698
|
isColumnSecondary
|
|
13699
13699
|
}) => {
|
|
13700
|
-
const gantt =
|
|
13700
|
+
const gantt = React37.useContext(GanttContext);
|
|
13701
13701
|
const [dragging] = useGanttDragging();
|
|
13702
13702
|
const [mousePosition, mouseRef] = usehooks.useMouse();
|
|
13703
|
-
const [hovering, setHovering] =
|
|
13703
|
+
const [hovering, setHovering] = React37.useState(false);
|
|
13704
13704
|
const [windowScroll] = usehooks.useWindowScroll();
|
|
13705
13705
|
const handleMouseEnter = () => setHovering(true);
|
|
13706
13706
|
const handleMouseLeave = () => setHovering(false);
|
|
@@ -13730,7 +13730,7 @@ var GanttColumns = ({
|
|
|
13730
13730
|
columns,
|
|
13731
13731
|
isColumnSecondary
|
|
13732
13732
|
}) => {
|
|
13733
|
-
const id =
|
|
13733
|
+
const id = React37.useId();
|
|
13734
13734
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13735
13735
|
"div",
|
|
13736
13736
|
{
|
|
@@ -13749,12 +13749,12 @@ var GanttColumns = ({
|
|
|
13749
13749
|
}
|
|
13750
13750
|
);
|
|
13751
13751
|
};
|
|
13752
|
-
var GanttGridLines =
|
|
13752
|
+
var GanttGridLines = React37.memo(({
|
|
13753
13753
|
className
|
|
13754
13754
|
}) => {
|
|
13755
|
-
const gantt =
|
|
13756
|
-
const id =
|
|
13757
|
-
const { columns, monthBoundaryIndices } =
|
|
13755
|
+
const gantt = React37.useContext(GanttContext);
|
|
13756
|
+
const id = React37.useId();
|
|
13757
|
+
const { columns, monthBoundaryIndices } = React37.useMemo(() => {
|
|
13758
13758
|
let totalColumns = 0;
|
|
13759
13759
|
const monthIndices = [];
|
|
13760
13760
|
if (gantt.range === "weekly") {
|
|
@@ -13818,7 +13818,7 @@ var GanttCreateMarkerTrigger = ({
|
|
|
13818
13818
|
onCreateMarker,
|
|
13819
13819
|
className
|
|
13820
13820
|
}) => {
|
|
13821
|
-
const gantt =
|
|
13821
|
+
const gantt = React37.useContext(GanttContext);
|
|
13822
13822
|
const [mousePosition, mouseRef] = usehooks.useMouse();
|
|
13823
13823
|
const [windowScroll] = usehooks.useWindowScroll();
|
|
13824
13824
|
const x = usehooks.useThrottle(
|
|
@@ -13867,7 +13867,7 @@ var GanttFeatureDragHelper = ({
|
|
|
13867
13867
|
id: `feature-drag-helper-${featureId}`
|
|
13868
13868
|
});
|
|
13869
13869
|
const isPressed = Boolean(attributes["aria-pressed"]);
|
|
13870
|
-
|
|
13870
|
+
React37.useEffect(() => setDragging(isPressed), [isPressed, setDragging]);
|
|
13871
13871
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13872
13872
|
"div",
|
|
13873
13873
|
{
|
|
@@ -13913,7 +13913,7 @@ var GanttFeatureItemCard = ({
|
|
|
13913
13913
|
const [, setDragging] = useGanttDragging();
|
|
13914
13914
|
const { attributes, listeners, setNodeRef } = core.useDraggable({ id });
|
|
13915
13915
|
const isPressed = Boolean(attributes["aria-pressed"]);
|
|
13916
|
-
|
|
13916
|
+
React37.useEffect(() => setDragging(isPressed), [isPressed, setDragging]);
|
|
13917
13917
|
return /* @__PURE__ */ jsxRuntime.jsx(Card, { className: "h-full w-full rounded-sm border bg-background px-2 py-1.5 text-xs shadow-sm overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13918
13918
|
"div",
|
|
13919
13919
|
{
|
|
@@ -13939,37 +13939,37 @@ var GanttFeatureItem = ({
|
|
|
13939
13939
|
...feature
|
|
13940
13940
|
}) => {
|
|
13941
13941
|
const [scrollX] = useGanttScrollX();
|
|
13942
|
-
const gantt =
|
|
13943
|
-
const timelineStartDate =
|
|
13942
|
+
const gantt = React37.useContext(GanttContext);
|
|
13943
|
+
const timelineStartDate = React37.useMemo(
|
|
13944
13944
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
13945
13945
|
[gantt.timelineData]
|
|
13946
13946
|
);
|
|
13947
|
-
const [startAt, setStartAt] =
|
|
13948
|
-
const [endAt, setEndAt] =
|
|
13949
|
-
const width =
|
|
13947
|
+
const [startAt, setStartAt] = React37.useState(feature.startAt);
|
|
13948
|
+
const [endAt, setEndAt] = React37.useState(feature.endAt);
|
|
13949
|
+
const width = React37.useMemo(
|
|
13950
13950
|
() => Math.round(getWidth(startAt, endAt, gantt)),
|
|
13951
13951
|
[startAt, endAt, gantt]
|
|
13952
13952
|
);
|
|
13953
|
-
const offset =
|
|
13953
|
+
const offset = React37.useMemo(
|
|
13954
13954
|
() => Math.round(getOffset(startAt, timelineStartDate, gantt)),
|
|
13955
13955
|
[startAt, timelineStartDate, gantt]
|
|
13956
13956
|
);
|
|
13957
|
-
const addRange =
|
|
13957
|
+
const addRange = React37.useMemo(() => getAddRange(gantt.range), [gantt.range]);
|
|
13958
13958
|
const [mousePosition] = usehooks.useMouse();
|
|
13959
|
-
const [previousMouseX, setPreviousMouseX] =
|
|
13960
|
-
const [previousStartAt, setPreviousStartAt] =
|
|
13961
|
-
const [previousEndAt, setPreviousEndAt] =
|
|
13959
|
+
const [previousMouseX, setPreviousMouseX] = React37.useState(0);
|
|
13960
|
+
const [previousStartAt, setPreviousStartAt] = React37.useState(startAt);
|
|
13961
|
+
const [previousEndAt, setPreviousEndAt] = React37.useState(endAt);
|
|
13962
13962
|
const mouseSensor = core.useSensor(core.MouseSensor, {
|
|
13963
13963
|
activationConstraint: {
|
|
13964
13964
|
distance: 10
|
|
13965
13965
|
}
|
|
13966
13966
|
});
|
|
13967
|
-
const handleItemDragStart =
|
|
13967
|
+
const handleItemDragStart = React37.useCallback(() => {
|
|
13968
13968
|
setPreviousMouseX(mousePosition.x);
|
|
13969
13969
|
setPreviousStartAt(startAt);
|
|
13970
13970
|
setPreviousEndAt(endAt);
|
|
13971
13971
|
}, [mousePosition.x, startAt, endAt]);
|
|
13972
|
-
const handleItemDragMove =
|
|
13972
|
+
const handleItemDragMove = React37.useCallback(() => {
|
|
13973
13973
|
const currentDate = getDateByMousePosition(gantt, mousePosition.x);
|
|
13974
13974
|
const originalDate = getDateByMousePosition(gantt, previousMouseX);
|
|
13975
13975
|
const delta = gantt.range === "weekly" ? dateFns.differenceInDays(currentDate, originalDate) : getInnerDifferenceIn(gantt.range)(currentDate, originalDate);
|
|
@@ -13978,17 +13978,17 @@ var GanttFeatureItem = ({
|
|
|
13978
13978
|
setStartAt(newStartDate);
|
|
13979
13979
|
setEndAt(newEndDate);
|
|
13980
13980
|
}, [gantt, mousePosition.x, previousMouseX, previousStartAt, previousEndAt]);
|
|
13981
|
-
const onDragEnd =
|
|
13981
|
+
const onDragEnd = React37.useCallback(
|
|
13982
13982
|
() => onMove?.(feature.id, startAt, endAt),
|
|
13983
13983
|
[onMove, feature.id, startAt, endAt]
|
|
13984
13984
|
);
|
|
13985
|
-
const handleLeftDragMove =
|
|
13985
|
+
const handleLeftDragMove = React37.useCallback(() => {
|
|
13986
13986
|
const ganttRect = gantt.ref?.current?.getBoundingClientRect();
|
|
13987
13987
|
const x = mousePosition.x - (ganttRect?.left ?? 0) + scrollX - gantt.sidebarWidth;
|
|
13988
13988
|
const newStartAt = getDateByMousePosition(gantt, x);
|
|
13989
13989
|
setStartAt(newStartAt);
|
|
13990
13990
|
}, [gantt, mousePosition.x, scrollX]);
|
|
13991
|
-
const handleRightDragMove =
|
|
13991
|
+
const handleRightDragMove = React37.useCallback(() => {
|
|
13992
13992
|
const ganttRect = gantt.ref?.current?.getBoundingClientRect();
|
|
13993
13993
|
const x = mousePosition.x - (ganttRect?.left ?? 0) + scrollX - gantt.sidebarWidth;
|
|
13994
13994
|
const newEndAt = getDateByMousePosition(gantt, x);
|
|
@@ -14184,21 +14184,21 @@ var GanttFeatureList = ({
|
|
|
14184
14184
|
children
|
|
14185
14185
|
}
|
|
14186
14186
|
);
|
|
14187
|
-
var GanttMarker =
|
|
14188
|
-
const gantt =
|
|
14189
|
-
const differenceIn =
|
|
14187
|
+
var GanttMarker = React37.memo(({ label, date, id, onRemove, className }) => {
|
|
14188
|
+
const gantt = React37.useContext(GanttContext);
|
|
14189
|
+
const differenceIn = React37.useMemo(
|
|
14190
14190
|
() => getDifferenceIn(gantt.range),
|
|
14191
14191
|
[gantt.range]
|
|
14192
14192
|
);
|
|
14193
|
-
const timelineStartDate =
|
|
14193
|
+
const timelineStartDate = React37.useMemo(
|
|
14194
14194
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14195
14195
|
[gantt.timelineData]
|
|
14196
14196
|
);
|
|
14197
|
-
const offset =
|
|
14197
|
+
const offset = React37.useMemo(
|
|
14198
14198
|
() => differenceIn(date, timelineStartDate),
|
|
14199
14199
|
[differenceIn, date, timelineStartDate]
|
|
14200
14200
|
);
|
|
14201
|
-
const innerOffset =
|
|
14201
|
+
const innerOffset = React37.useMemo(
|
|
14202
14202
|
() => calculateInnerOffset(
|
|
14203
14203
|
date,
|
|
14204
14204
|
gantt.range,
|
|
@@ -14206,7 +14206,7 @@ var GanttMarker = React36.memo(({ label, date, id, onRemove, className }) => {
|
|
|
14206
14206
|
),
|
|
14207
14207
|
[date, gantt.range, gantt.columnWidth, gantt.zoom]
|
|
14208
14208
|
);
|
|
14209
|
-
const handleRemove =
|
|
14209
|
+
const handleRemove = React37.useCallback(() => onRemove?.(id), [onRemove, id]);
|
|
14210
14210
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14211
14211
|
"div",
|
|
14212
14212
|
{
|
|
@@ -14256,14 +14256,14 @@ var GanttProvider = ({
|
|
|
14256
14256
|
className,
|
|
14257
14257
|
defaultExpandedGroups = {}
|
|
14258
14258
|
}) => {
|
|
14259
|
-
const scrollRef =
|
|
14260
|
-
const [timelineData, setTimelineData] =
|
|
14259
|
+
const scrollRef = React37.useRef(null);
|
|
14260
|
+
const [timelineData, setTimelineData] = React37.useState(
|
|
14261
14261
|
createInitialTimelineData(/* @__PURE__ */ new Date())
|
|
14262
14262
|
);
|
|
14263
14263
|
const [, setScrollX] = useGanttScrollX();
|
|
14264
14264
|
const sidebarWidth = 280;
|
|
14265
|
-
const [expandedGroups, setExpandedGroups] =
|
|
14266
|
-
const setGroupExpanded =
|
|
14265
|
+
const [expandedGroups, setExpandedGroups] = React37.useState(defaultExpandedGroups);
|
|
14266
|
+
const setGroupExpanded = React37.useCallback((groupId, expanded) => {
|
|
14267
14267
|
setExpandedGroups((prev) => ({ ...prev, [groupId]: expanded }));
|
|
14268
14268
|
}, []);
|
|
14269
14269
|
const headerHeight = 60;
|
|
@@ -14274,7 +14274,7 @@ var GanttProvider = ({
|
|
|
14274
14274
|
} else if (range === "quarterly") {
|
|
14275
14275
|
columnWidth = 100;
|
|
14276
14276
|
}
|
|
14277
|
-
const cssVariables =
|
|
14277
|
+
const cssVariables = React37.useMemo(
|
|
14278
14278
|
() => ({
|
|
14279
14279
|
"--gantt-zoom": `${zoom}`,
|
|
14280
14280
|
"--gantt-column-width": `${zoom / 100 * columnWidth}px`,
|
|
@@ -14284,13 +14284,13 @@ var GanttProvider = ({
|
|
|
14284
14284
|
}),
|
|
14285
14285
|
[zoom, columnWidth, sidebarWidth]
|
|
14286
14286
|
);
|
|
14287
|
-
|
|
14287
|
+
React37.useEffect(() => {
|
|
14288
14288
|
if (scrollRef.current) {
|
|
14289
14289
|
scrollRef.current.scrollLeft = scrollRef.current.scrollWidth / 2 - scrollRef.current.clientWidth / 2;
|
|
14290
14290
|
setScrollX(scrollRef.current.scrollLeft);
|
|
14291
14291
|
}
|
|
14292
14292
|
}, [setScrollX]);
|
|
14293
|
-
const handleScroll =
|
|
14293
|
+
const handleScroll = React37.useCallback(
|
|
14294
14294
|
throttle__default.default(() => {
|
|
14295
14295
|
const scrollElement = scrollRef.current;
|
|
14296
14296
|
if (!scrollElement) {
|
|
@@ -14342,7 +14342,7 @@ var GanttProvider = ({
|
|
|
14342
14342
|
}, 100),
|
|
14343
14343
|
[]
|
|
14344
14344
|
);
|
|
14345
|
-
|
|
14345
|
+
React37.useEffect(() => {
|
|
14346
14346
|
const scrollElement = scrollRef.current;
|
|
14347
14347
|
if (scrollElement) {
|
|
14348
14348
|
scrollElement.addEventListener("scroll", handleScroll);
|
|
@@ -14353,7 +14353,7 @@ var GanttProvider = ({
|
|
|
14353
14353
|
}
|
|
14354
14354
|
};
|
|
14355
14355
|
}, [handleScroll]);
|
|
14356
|
-
const scrollToFeature =
|
|
14356
|
+
const scrollToFeature = React37.useCallback(
|
|
14357
14357
|
(feature) => {
|
|
14358
14358
|
const scrollElement = scrollRef.current;
|
|
14359
14359
|
if (!scrollElement) {
|
|
@@ -14433,21 +14433,21 @@ var GanttTimeline = ({
|
|
|
14433
14433
|
);
|
|
14434
14434
|
var GanttToday = ({ className }) => {
|
|
14435
14435
|
const label = "Today";
|
|
14436
|
-
const date =
|
|
14437
|
-
const gantt =
|
|
14438
|
-
const differenceIn =
|
|
14436
|
+
const date = React37.useMemo(() => /* @__PURE__ */ new Date(), []);
|
|
14437
|
+
const gantt = React37.useContext(GanttContext);
|
|
14438
|
+
const differenceIn = React37.useMemo(
|
|
14439
14439
|
() => getDifferenceIn(gantt.range),
|
|
14440
14440
|
[gantt.range]
|
|
14441
14441
|
);
|
|
14442
|
-
const timelineStartDate =
|
|
14442
|
+
const timelineStartDate = React37.useMemo(
|
|
14443
14443
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14444
14444
|
[gantt.timelineData]
|
|
14445
14445
|
);
|
|
14446
|
-
const offset =
|
|
14446
|
+
const offset = React37.useMemo(
|
|
14447
14447
|
() => differenceIn(date, timelineStartDate),
|
|
14448
14448
|
[differenceIn, date, timelineStartDate]
|
|
14449
14449
|
);
|
|
14450
|
-
const innerOffset =
|
|
14450
|
+
const innerOffset = React37.useMemo(
|
|
14451
14451
|
() => Math.round(calculateInnerOffset(
|
|
14452
14452
|
date,
|
|
14453
14453
|
gantt.range,
|
|
@@ -14539,11 +14539,11 @@ var getWeekStartDate2 = (year, weekNumber) => {
|
|
|
14539
14539
|
targetDate.setDate(week1Start.getDate() + (weekNumber - 1) * 7);
|
|
14540
14540
|
return targetDate;
|
|
14541
14541
|
};
|
|
14542
|
-
var EnhancedGridLines =
|
|
14542
|
+
var EnhancedGridLines = React37.memo(({ rowCount }) => {
|
|
14543
14543
|
const gantt = useGanttContext();
|
|
14544
|
-
const id =
|
|
14544
|
+
const id = React37__namespace.useId();
|
|
14545
14545
|
const columnWidth = gantt.columnWidth * gantt.zoom / 100;
|
|
14546
|
-
const { verticalLines, totalColumns } =
|
|
14546
|
+
const { verticalLines, totalColumns } = React37.useMemo(() => {
|
|
14547
14547
|
const lines = [];
|
|
14548
14548
|
let totalCols = 0;
|
|
14549
14549
|
if (gantt.range === "weekly") {
|
|
@@ -14583,7 +14583,7 @@ var EnhancedGridLines = React36.memo(({ rowCount }) => {
|
|
|
14583
14583
|
}
|
|
14584
14584
|
return { verticalLines: lines, totalColumns: totalCols };
|
|
14585
14585
|
}, [gantt.timelineData, gantt.range, columnWidth]);
|
|
14586
|
-
const horizontalLines =
|
|
14586
|
+
const horizontalLines = React37.useMemo(() => {
|
|
14587
14587
|
const lines = [];
|
|
14588
14588
|
for (let i = 0; i <= rowCount; i++) {
|
|
14589
14589
|
lines.push(i);
|
|
@@ -14633,7 +14633,7 @@ var EnhancedGridLines = React36.memo(({ rowCount }) => {
|
|
|
14633
14633
|
] });
|
|
14634
14634
|
});
|
|
14635
14635
|
EnhancedGridLines.displayName = "EnhancedGridLines";
|
|
14636
|
-
var DeliveryCut =
|
|
14636
|
+
var DeliveryCut = React37.memo(({
|
|
14637
14637
|
date,
|
|
14638
14638
|
packageEndDate,
|
|
14639
14639
|
packageName,
|
|
@@ -14641,19 +14641,19 @@ var DeliveryCut = React36.memo(({
|
|
|
14641
14641
|
feasibility
|
|
14642
14642
|
}) => {
|
|
14643
14643
|
const gantt = useGanttContext();
|
|
14644
|
-
const timelineStartDate =
|
|
14644
|
+
const timelineStartDate = React37.useMemo(
|
|
14645
14645
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14646
14646
|
[gantt.timelineData]
|
|
14647
14647
|
);
|
|
14648
|
-
const offset =
|
|
14648
|
+
const offset = React37.useMemo(
|
|
14649
14649
|
() => Math.round(getOffset(date, timelineStartDate, gantt)),
|
|
14650
14650
|
[date, timelineStartDate, gantt]
|
|
14651
14651
|
);
|
|
14652
|
-
const deltaDays =
|
|
14652
|
+
const deltaDays = React37.useMemo(
|
|
14653
14653
|
() => dateFns.differenceInDays(date, packageEndDate),
|
|
14654
14654
|
[date, packageEndDate]
|
|
14655
14655
|
);
|
|
14656
|
-
const colors =
|
|
14656
|
+
const colors = React37.useMemo(() => {
|
|
14657
14657
|
switch (feasibility) {
|
|
14658
14658
|
case "feasible":
|
|
14659
14659
|
return {
|
|
@@ -14682,7 +14682,7 @@ var DeliveryCut = React36.memo(({
|
|
|
14682
14682
|
};
|
|
14683
14683
|
}
|
|
14684
14684
|
}, [feasibility]);
|
|
14685
|
-
const deltaText =
|
|
14685
|
+
const deltaText = React37.useMemo(() => {
|
|
14686
14686
|
if (deltaDays > 0) {
|
|
14687
14687
|
return `+${deltaDays}d buffer`;
|
|
14688
14688
|
} else if (deltaDays < 0) {
|
|
@@ -14720,7 +14720,7 @@ var DeliveryCut = React36.memo(({
|
|
|
14720
14720
|
);
|
|
14721
14721
|
});
|
|
14722
14722
|
DeliveryCut.displayName = "DeliveryCut";
|
|
14723
|
-
var FeasibilityFeatureItem =
|
|
14723
|
+
var FeasibilityFeatureItem = React37.memo(({
|
|
14724
14724
|
feature,
|
|
14725
14725
|
pkg,
|
|
14726
14726
|
feasibility,
|
|
@@ -14731,35 +14731,35 @@ var FeasibilityFeatureItem = React36.memo(({
|
|
|
14731
14731
|
}) => {
|
|
14732
14732
|
const gantt = useGanttContext();
|
|
14733
14733
|
const [, setDragging] = useGanttDragging();
|
|
14734
|
-
const timelineStartDate =
|
|
14734
|
+
const timelineStartDate = React37.useMemo(
|
|
14735
14735
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14736
14736
|
[gantt.timelineData]
|
|
14737
14737
|
);
|
|
14738
|
-
const [startAt, setStartAt] =
|
|
14739
|
-
const [endAt, setEndAt] =
|
|
14740
|
-
const originalDuration =
|
|
14738
|
+
const [startAt, setStartAt] = React37.useState(feature.startAt);
|
|
14739
|
+
const [endAt, setEndAt] = React37.useState(feature.endAt);
|
|
14740
|
+
const originalDuration = React37.useMemo(
|
|
14741
14741
|
() => dateFns.differenceInDays(feature.endAt, feature.startAt),
|
|
14742
14742
|
[feature.endAt, feature.startAt]
|
|
14743
14743
|
);
|
|
14744
|
-
const width =
|
|
14744
|
+
const width = React37.useMemo(
|
|
14745
14745
|
() => Math.round(getWidth(startAt, endAt, gantt)),
|
|
14746
14746
|
[startAt, endAt, gantt]
|
|
14747
14747
|
);
|
|
14748
|
-
const offset =
|
|
14748
|
+
const offset = React37.useMemo(
|
|
14749
14749
|
() => Math.round(getOffset(startAt, timelineStartDate, gantt)),
|
|
14750
14750
|
[startAt, timelineStartDate, gantt]
|
|
14751
14751
|
);
|
|
14752
14752
|
const [mousePosition] = usehooks.useMouse();
|
|
14753
|
-
const [previousMouseX, setPreviousMouseX] =
|
|
14754
|
-
const [previousStartAt, setPreviousStartAt] =
|
|
14753
|
+
const [previousMouseX, setPreviousMouseX] = React37.useState(0);
|
|
14754
|
+
const [previousStartAt, setPreviousStartAt] = React37.useState(startAt);
|
|
14755
14755
|
const mouseSensor = core.useSensor(core.MouseSensor, {
|
|
14756
14756
|
activationConstraint: { distance: 10 }
|
|
14757
14757
|
});
|
|
14758
|
-
const handleDragStart =
|
|
14758
|
+
const handleDragStart = React37.useCallback(() => {
|
|
14759
14759
|
setPreviousMouseX(mousePosition.x);
|
|
14760
14760
|
setPreviousStartAt(startAt);
|
|
14761
14761
|
}, [mousePosition.x, startAt]);
|
|
14762
|
-
const handleDragMove =
|
|
14762
|
+
const handleDragMove = React37.useCallback(() => {
|
|
14763
14763
|
const currentDate = getDateByMousePosition(gantt, mousePosition.x);
|
|
14764
14764
|
const originalDate = getDateByMousePosition(gantt, previousMouseX);
|
|
14765
14765
|
const delta = dateFns.differenceInDays(currentDate, originalDate);
|
|
@@ -14768,18 +14768,18 @@ var FeasibilityFeatureItem = React36.memo(({
|
|
|
14768
14768
|
setStartAt(newStart);
|
|
14769
14769
|
setEndAt(newEnd);
|
|
14770
14770
|
}, [gantt, mousePosition.x, previousMouseX, previousStartAt, originalDuration]);
|
|
14771
|
-
const handleDragEnd =
|
|
14771
|
+
const handleDragEnd = React37.useCallback(() => {
|
|
14772
14772
|
onMove?.(feature.id, startAt, endAt);
|
|
14773
14773
|
}, [onMove, feature.id, startAt, endAt]);
|
|
14774
14774
|
const { attributes, listeners, setNodeRef, isDragging } = core.useDraggable({
|
|
14775
14775
|
id: `feature-${feature.id}`
|
|
14776
14776
|
});
|
|
14777
|
-
|
|
14777
|
+
React37.useEffect(() => setDragging(isDragging), [isDragging, setDragging]);
|
|
14778
14778
|
const color = feature.status.color;
|
|
14779
|
-
const handleMouseEnter =
|
|
14779
|
+
const handleMouseEnter = React37.useCallback(() => {
|
|
14780
14780
|
onHoverChange?.(true);
|
|
14781
14781
|
}, [onHoverChange]);
|
|
14782
|
-
const handleMouseLeave =
|
|
14782
|
+
const handleMouseLeave = React37.useCallback(() => {
|
|
14783
14783
|
onHoverChange?.(false);
|
|
14784
14784
|
}, [onHoverChange]);
|
|
14785
14785
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -14913,13 +14913,13 @@ function ProductionPackageGantt({
|
|
|
14913
14913
|
zoom = 100,
|
|
14914
14914
|
className
|
|
14915
14915
|
}) {
|
|
14916
|
-
const [packageDates, setPackageDates] =
|
|
14916
|
+
const [packageDates, setPackageDates] = React37.useState(
|
|
14917
14917
|
() => new Map(packages.map((pkg) => [pkg.id, { startDate: pkg.startDate, endDate: pkg.endDate }]))
|
|
14918
14918
|
);
|
|
14919
|
-
const [hoveredPackageId, setHoveredPackageId] =
|
|
14920
|
-
const [selectedPackage, setSelectedPackage] =
|
|
14921
|
-
const [sheetOpen, setSheetOpen] =
|
|
14922
|
-
const packageFeasibility =
|
|
14919
|
+
const [hoveredPackageId, setHoveredPackageId] = React37.useState(null);
|
|
14920
|
+
const [selectedPackage, setSelectedPackage] = React37.useState(null);
|
|
14921
|
+
const [sheetOpen, setSheetOpen] = React37.useState(false);
|
|
14922
|
+
const packageFeasibility = React37.useMemo(() => {
|
|
14923
14923
|
const result = /* @__PURE__ */ new Map();
|
|
14924
14924
|
for (const pkg of packages) {
|
|
14925
14925
|
const dates = packageDates.get(pkg.id) ?? { startDate: pkg.startDate, endDate: pkg.endDate };
|
|
@@ -14927,7 +14927,7 @@ function ProductionPackageGantt({
|
|
|
14927
14927
|
}
|
|
14928
14928
|
return result;
|
|
14929
14929
|
}, [packages, packageDates]);
|
|
14930
|
-
const ganttFeatures =
|
|
14930
|
+
const ganttFeatures = React37.useMemo(() => {
|
|
14931
14931
|
return packages.map((pkg) => {
|
|
14932
14932
|
const dates = packageDates.get(pkg.id) ?? { startDate: pkg.startDate, endDate: pkg.endDate };
|
|
14933
14933
|
const status = packageFeasibility.get(pkg.id) ?? "feasible";
|
|
@@ -14944,7 +14944,7 @@ function ProductionPackageGantt({
|
|
|
14944
14944
|
};
|
|
14945
14945
|
});
|
|
14946
14946
|
}, [packages, packageDates, packageFeasibility]);
|
|
14947
|
-
const handleFeatureMove =
|
|
14947
|
+
const handleFeatureMove = React37.useCallback((id, startAt, endAt) => {
|
|
14948
14948
|
setPackageDates((prev) => {
|
|
14949
14949
|
const next = new Map(prev);
|
|
14950
14950
|
next.set(id, { startDate: startAt, endDate: endAt });
|
|
@@ -14952,15 +14952,15 @@ function ProductionPackageGantt({
|
|
|
14952
14952
|
});
|
|
14953
14953
|
onPackageMove?.(id, startAt, endAt);
|
|
14954
14954
|
}, [onPackageMove]);
|
|
14955
|
-
const handlePackageClick =
|
|
14955
|
+
const handlePackageClick = React37.useCallback((pkg) => {
|
|
14956
14956
|
setSelectedPackage(pkg);
|
|
14957
14957
|
setSheetOpen(true);
|
|
14958
14958
|
onPackageClick?.(pkg);
|
|
14959
14959
|
}, [onPackageClick]);
|
|
14960
|
-
const handleHoverChange =
|
|
14960
|
+
const handleHoverChange = React37.useCallback((pkgId, isHovered) => {
|
|
14961
14961
|
setHoveredPackageId(isHovered ? pkgId : null);
|
|
14962
14962
|
}, []);
|
|
14963
|
-
const insightMetrics =
|
|
14963
|
+
const insightMetrics = React37.useMemo(() => {
|
|
14964
14964
|
const feasibleCount = Array.from(packageFeasibility.values()).filter((s) => s === "feasible").length;
|
|
14965
14965
|
const atRiskCount = Array.from(packageFeasibility.values()).filter((s) => s === "at-risk").length;
|
|
14966
14966
|
const infeasibleCount = Array.from(packageFeasibility.values()).filter((s) => s === "infeasible").length;
|
|
@@ -15134,11 +15134,11 @@ function getPhaseColor(phaseId, customColor) {
|
|
|
15134
15134
|
if (customColor) return customColor;
|
|
15135
15135
|
return PHASE_COLORS[phaseId] || "hsl(var(--chart-5))";
|
|
15136
15136
|
}
|
|
15137
|
-
var LightweightGridLines =
|
|
15137
|
+
var LightweightGridLines = React37.memo(() => {
|
|
15138
15138
|
const gantt = useGanttContext();
|
|
15139
|
-
const id =
|
|
15139
|
+
const id = React37__namespace.useId();
|
|
15140
15140
|
const columnWidth = gantt.columnWidth * gantt.zoom / 100;
|
|
15141
|
-
const { lines, totalWidth } =
|
|
15141
|
+
const { lines, totalWidth } = React37.useMemo(() => {
|
|
15142
15142
|
const linePositions = [];
|
|
15143
15143
|
let currentOffset = 0;
|
|
15144
15144
|
let weekCounter = 0;
|
|
@@ -15185,13 +15185,13 @@ var LightweightGridLines = React36.memo(() => {
|
|
|
15185
15185
|
);
|
|
15186
15186
|
});
|
|
15187
15187
|
LightweightGridLines.displayName = "LightweightGridLines";
|
|
15188
|
-
var DeadlineMarker =
|
|
15188
|
+
var DeadlineMarker = React37.memo(({ date, label, visible }) => {
|
|
15189
15189
|
const gantt = useGanttContext();
|
|
15190
|
-
const timelineStartDate =
|
|
15190
|
+
const timelineStartDate = React37.useMemo(
|
|
15191
15191
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
15192
15192
|
[gantt.timelineData]
|
|
15193
15193
|
);
|
|
15194
|
-
const offset =
|
|
15194
|
+
const offset = React37.useMemo(
|
|
15195
15195
|
() => Math.round(getOffset(date, timelineStartDate, gantt)),
|
|
15196
15196
|
[date, timelineStartDate, gantt]
|
|
15197
15197
|
);
|
|
@@ -15235,8 +15235,8 @@ var DeadlineMarker = React36.memo(({ date, label, visible }) => {
|
|
|
15235
15235
|
);
|
|
15236
15236
|
});
|
|
15237
15237
|
DeadlineMarker.displayName = "DeadlineMarker";
|
|
15238
|
-
var PhaseIndicator =
|
|
15239
|
-
const handleClick =
|
|
15238
|
+
var PhaseIndicator = React37.memo(({ type, onClick }) => {
|
|
15239
|
+
const handleClick = React37.useCallback((e) => {
|
|
15240
15240
|
e.stopPropagation();
|
|
15241
15241
|
onClick?.(e);
|
|
15242
15242
|
}, [onClick]);
|
|
@@ -15259,18 +15259,18 @@ var PhaseIndicator = React36.memo(({ type, onClick }) => {
|
|
|
15259
15259
|
] }) });
|
|
15260
15260
|
});
|
|
15261
15261
|
PhaseIndicator.displayName = "PhaseIndicator";
|
|
15262
|
-
var PhaseBar =
|
|
15263
|
-
const [isHovered, setIsHovered] =
|
|
15262
|
+
var PhaseBar = React37.memo(({ phase, isExpanded, onToggle, hasDeadline }) => {
|
|
15263
|
+
const [isHovered, setIsHovered] = React37.useState(false);
|
|
15264
15264
|
const gantt = useGanttContext();
|
|
15265
|
-
const timelineStartDate =
|
|
15265
|
+
const timelineStartDate = React37.useMemo(
|
|
15266
15266
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
15267
15267
|
[gantt.timelineData]
|
|
15268
15268
|
);
|
|
15269
|
-
const width =
|
|
15269
|
+
const width = React37.useMemo(
|
|
15270
15270
|
() => Math.round(getWidth(phase.startDate, phase.endDate, gantt)),
|
|
15271
15271
|
[phase.startDate, phase.endDate, gantt]
|
|
15272
15272
|
);
|
|
15273
|
-
const offset =
|
|
15273
|
+
const offset = React37.useMemo(
|
|
15274
15274
|
() => Math.round(getOffset(phase.startDate, timelineStartDate, gantt)),
|
|
15275
15275
|
[phase.startDate, timelineStartDate, gantt]
|
|
15276
15276
|
);
|
|
@@ -15352,17 +15352,17 @@ var PhaseBar = React36.memo(({ phase, isExpanded, onToggle, hasDeadline }) => {
|
|
|
15352
15352
|
);
|
|
15353
15353
|
});
|
|
15354
15354
|
PhaseBar.displayName = "PhaseBar";
|
|
15355
|
-
var PackageBar =
|
|
15355
|
+
var PackageBar = React37.memo(({ pkg, phaseColor, onClick }) => {
|
|
15356
15356
|
const gantt = useGanttContext();
|
|
15357
|
-
const timelineStartDate =
|
|
15357
|
+
const timelineStartDate = React37.useMemo(
|
|
15358
15358
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
15359
15359
|
[gantt.timelineData]
|
|
15360
15360
|
);
|
|
15361
|
-
const width =
|
|
15361
|
+
const width = React37.useMemo(
|
|
15362
15362
|
() => Math.round(getWidth(pkg.startDate, pkg.endDate, gantt)),
|
|
15363
15363
|
[pkg.startDate, pkg.endDate, gantt]
|
|
15364
15364
|
);
|
|
15365
|
-
const offset =
|
|
15365
|
+
const offset = React37.useMemo(
|
|
15366
15366
|
() => Math.round(getOffset(pkg.startDate, timelineStartDate, gantt)),
|
|
15367
15367
|
[pkg.startDate, pkg.endDate, gantt]
|
|
15368
15368
|
);
|
|
@@ -15408,7 +15408,7 @@ var PackageBar = React36.memo(({ pkg, phaseColor, onClick }) => {
|
|
|
15408
15408
|
);
|
|
15409
15409
|
});
|
|
15410
15410
|
PackageBar.displayName = "PackageBar";
|
|
15411
|
-
var PhaseSidebarItem =
|
|
15411
|
+
var PhaseSidebarItem = React37.memo(({
|
|
15412
15412
|
phase,
|
|
15413
15413
|
packageCount,
|
|
15414
15414
|
isExpanded,
|
|
@@ -15463,7 +15463,7 @@ var PhaseSidebarItem = React36.memo(({
|
|
|
15463
15463
|
);
|
|
15464
15464
|
});
|
|
15465
15465
|
PhaseSidebarItem.displayName = "PhaseSidebarItem";
|
|
15466
|
-
var PackageSidebarItem =
|
|
15466
|
+
var PackageSidebarItem = React37.memo(({
|
|
15467
15467
|
pkg,
|
|
15468
15468
|
phaseColor,
|
|
15469
15469
|
onClick
|
|
@@ -15528,12 +15528,12 @@ function PhaseGantt({
|
|
|
15528
15528
|
className,
|
|
15529
15529
|
defaultExpandedPhases = []
|
|
15530
15530
|
}) {
|
|
15531
|
-
const [expandedPhases, setExpandedPhases] =
|
|
15531
|
+
const [expandedPhases, setExpandedPhases] = React37.useState(
|
|
15532
15532
|
() => new Set(defaultExpandedPhases)
|
|
15533
15533
|
);
|
|
15534
|
-
const [selectedPackage, setSelectedPackage] =
|
|
15535
|
-
const [sheetOpen, setSheetOpen] =
|
|
15536
|
-
const togglePhase =
|
|
15534
|
+
const [selectedPackage, setSelectedPackage] = React37.useState(null);
|
|
15535
|
+
const [sheetOpen, setSheetOpen] = React37.useState(false);
|
|
15536
|
+
const togglePhase = React37.useCallback((phaseId) => {
|
|
15537
15537
|
setExpandedPhases((prev) => {
|
|
15538
15538
|
const next = new Set(prev);
|
|
15539
15539
|
if (next.has(phaseId)) {
|
|
@@ -15544,12 +15544,12 @@ function PhaseGantt({
|
|
|
15544
15544
|
return next;
|
|
15545
15545
|
});
|
|
15546
15546
|
}, []);
|
|
15547
|
-
const handlePackageClick =
|
|
15547
|
+
const handlePackageClick = React37.useCallback((pkg) => {
|
|
15548
15548
|
setSelectedPackage(pkg);
|
|
15549
15549
|
setSheetOpen(true);
|
|
15550
15550
|
onPackageClick?.(pkg);
|
|
15551
15551
|
}, [onPackageClick]);
|
|
15552
|
-
const packagesByPhase =
|
|
15552
|
+
const packagesByPhase = React37.useMemo(() => {
|
|
15553
15553
|
const map = /* @__PURE__ */ new Map();
|
|
15554
15554
|
for (const phase of phases) {
|
|
15555
15555
|
map.set(phase.id, []);
|
|
@@ -15562,7 +15562,7 @@ function PhaseGantt({
|
|
|
15562
15562
|
}
|
|
15563
15563
|
return map;
|
|
15564
15564
|
}, [phases, packages]);
|
|
15565
|
-
const selectedPhase =
|
|
15565
|
+
const selectedPhase = React37.useMemo(() => {
|
|
15566
15566
|
if (!selectedPackage) return null;
|
|
15567
15567
|
return phases.find((p) => p.id === selectedPackage.phaseId) ?? null;
|
|
15568
15568
|
}, [selectedPackage, phases]);
|
|
@@ -15819,7 +15819,7 @@ function SubtaskItem({
|
|
|
15819
15819
|
const { subtask, isLocked, lockReason, isNextAction, isActionable } = subtaskState;
|
|
15820
15820
|
const TypeIcon = getSubtaskTypeIcon(subtask.type);
|
|
15821
15821
|
const StatusIcon = getStatusIcon(subtask.status);
|
|
15822
|
-
const handleAction =
|
|
15822
|
+
const handleAction = React37__namespace.useCallback(() => {
|
|
15823
15823
|
if (isActionable && onAction) {
|
|
15824
15824
|
onAction(subtask);
|
|
15825
15825
|
}
|
|
@@ -16020,7 +16020,7 @@ function PackageCard({
|
|
|
16020
16020
|
onPackageClick,
|
|
16021
16021
|
className
|
|
16022
16022
|
}) {
|
|
16023
|
-
const [isExpanded, setIsExpanded] =
|
|
16023
|
+
const [isExpanded, setIsExpanded] = React37__namespace.useState(false);
|
|
16024
16024
|
const {
|
|
16025
16025
|
package: pkg,
|
|
16026
16026
|
status,
|
|
@@ -16035,13 +16035,13 @@ function PackageCard({
|
|
|
16035
16035
|
} = packageState;
|
|
16036
16036
|
const priorityConfig = getPriorityConfig(pkg.priority);
|
|
16037
16037
|
const statusConfig = getStatusConfig(status);
|
|
16038
|
-
const handleCardClick =
|
|
16038
|
+
const handleCardClick = React37__namespace.useCallback((e) => {
|
|
16039
16039
|
if (e.target.closest('button, [role="button"]')) {
|
|
16040
16040
|
return;
|
|
16041
16041
|
}
|
|
16042
16042
|
onPackageClick?.(pkg);
|
|
16043
16043
|
}, [onPackageClick, pkg]);
|
|
16044
|
-
const handleNextAction =
|
|
16044
|
+
const handleNextAction = React37__namespace.useCallback(() => {
|
|
16045
16045
|
if (nextAction && onSubtaskAction) {
|
|
16046
16046
|
onSubtaskAction(nextAction.subtask);
|
|
16047
16047
|
}
|
|
@@ -16470,7 +16470,7 @@ function TodoBoard({
|
|
|
16470
16470
|
height = 600,
|
|
16471
16471
|
className
|
|
16472
16472
|
}) {
|
|
16473
|
-
const [activeId, setActiveId] =
|
|
16473
|
+
const [activeId, setActiveId] = React37__namespace.useState(null);
|
|
16474
16474
|
const sensors = core.useSensors(
|
|
16475
16475
|
core.useSensor(core.MouseSensor, {
|
|
16476
16476
|
activationConstraint: { distance: 8 }
|
|
@@ -16479,23 +16479,23 @@ function TodoBoard({
|
|
|
16479
16479
|
activationConstraint: { delay: 200, tolerance: 5 }
|
|
16480
16480
|
})
|
|
16481
16481
|
);
|
|
16482
|
-
const packageStates =
|
|
16482
|
+
const packageStates = React37__namespace.useMemo(
|
|
16483
16483
|
() => computeAllPackageStates(packages, workflowConfig),
|
|
16484
16484
|
[packages, workflowConfig]
|
|
16485
16485
|
);
|
|
16486
|
-
const groupedPackages =
|
|
16486
|
+
const groupedPackages = React37__namespace.useMemo(
|
|
16487
16487
|
() => groupPackagesByBucket(packageStates),
|
|
16488
16488
|
[packageStates]
|
|
16489
16489
|
);
|
|
16490
16490
|
const buckets = getBucketConfig(workflowConfig);
|
|
16491
|
-
const activePackageState =
|
|
16491
|
+
const activePackageState = React37__namespace.useMemo(
|
|
16492
16492
|
() => packageStates.find((p) => p.package.id === activeId),
|
|
16493
16493
|
[packageStates, activeId]
|
|
16494
16494
|
);
|
|
16495
|
-
const handleDragStart =
|
|
16495
|
+
const handleDragStart = React37__namespace.useCallback((event) => {
|
|
16496
16496
|
setActiveId(event.active.id);
|
|
16497
16497
|
}, []);
|
|
16498
|
-
const handleDragEnd =
|
|
16498
|
+
const handleDragEnd = React37__namespace.useCallback((event) => {
|
|
16499
16499
|
setActiveId(null);
|
|
16500
16500
|
}, []);
|
|
16501
16501
|
const heightStyle = typeof height === "number" ? `${height}px` : height;
|
|
@@ -16728,21 +16728,21 @@ function TodoList({
|
|
|
16728
16728
|
onPackageClick,
|
|
16729
16729
|
className
|
|
16730
16730
|
}) {
|
|
16731
|
-
const [expandedIds, setExpandedIds] =
|
|
16732
|
-
const [sort, setSort] =
|
|
16731
|
+
const [expandedIds, setExpandedIds] = React37__namespace.useState(/* @__PURE__ */ new Set());
|
|
16732
|
+
const [sort, setSort] = React37__namespace.useState({
|
|
16733
16733
|
field: "priority",
|
|
16734
16734
|
direction: null
|
|
16735
16735
|
});
|
|
16736
|
-
const packageStates =
|
|
16736
|
+
const packageStates = React37__namespace.useMemo(
|
|
16737
16737
|
() => computeAllPackageStates(packages, workflowConfig),
|
|
16738
16738
|
[packages, workflowConfig]
|
|
16739
16739
|
);
|
|
16740
|
-
const groupedPackages =
|
|
16740
|
+
const groupedPackages = React37__namespace.useMemo(
|
|
16741
16741
|
() => groupPackagesByBucket(packageStates),
|
|
16742
16742
|
[packageStates]
|
|
16743
16743
|
);
|
|
16744
16744
|
const buckets = getBucketConfig2(workflowConfig);
|
|
16745
|
-
const toggleExpand =
|
|
16745
|
+
const toggleExpand = React37__namespace.useCallback((id) => {
|
|
16746
16746
|
setExpandedIds((prev) => {
|
|
16747
16747
|
const next = new Set(prev);
|
|
16748
16748
|
if (next.has(id)) {
|
|
@@ -16753,7 +16753,7 @@ function TodoList({
|
|
|
16753
16753
|
return next;
|
|
16754
16754
|
});
|
|
16755
16755
|
}, []);
|
|
16756
|
-
const handleSort =
|
|
16756
|
+
const handleSort = React37__namespace.useCallback((field) => {
|
|
16757
16757
|
setSort((prev) => {
|
|
16758
16758
|
if (prev.field !== field) {
|
|
16759
16759
|
return { field, direction: "asc" };
|
|
@@ -16786,7 +16786,7 @@ function TodoList({
|
|
|
16786
16786
|
const bucketPackages = groupedPackages[bucket.id] || [];
|
|
16787
16787
|
if (bucketPackages.length === 0) return null;
|
|
16788
16788
|
const sortedPackages = sortPackages(bucketPackages, sort.field, sort.direction);
|
|
16789
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16789
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React37__namespace.Fragment, { children: [
|
|
16790
16790
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16791
16791
|
BucketHeaderRow,
|
|
16792
16792
|
{
|
|
@@ -16798,7 +16798,7 @@ function TodoList({
|
|
|
16798
16798
|
),
|
|
16799
16799
|
sortedPackages.map((packageState) => {
|
|
16800
16800
|
const isExpanded = expandedIds.has(packageState.package.id);
|
|
16801
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16801
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React37__namespace.Fragment, { children: [
|
|
16802
16802
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16803
16803
|
PackageRow,
|
|
16804
16804
|
{
|
|
@@ -16913,10 +16913,10 @@ function PackageRow2({
|
|
|
16913
16913
|
const priorityConfig = getPriorityConfig2(pkg.priority);
|
|
16914
16914
|
const statusConfig = getStatusConfig2(status);
|
|
16915
16915
|
const lockedCount = subtaskStates.filter((s) => s.isLocked).length;
|
|
16916
|
-
const handleRowClick =
|
|
16916
|
+
const handleRowClick = React37__namespace.useCallback(() => {
|
|
16917
16917
|
onPackageClick?.(pkg);
|
|
16918
16918
|
}, [onPackageClick, pkg]);
|
|
16919
|
-
const handleNextAction =
|
|
16919
|
+
const handleNextAction = React37__namespace.useCallback(() => {
|
|
16920
16920
|
if (nextAction && onSubtaskAction) {
|
|
16921
16921
|
onSubtaskAction(nextAction.subtask);
|
|
16922
16922
|
}
|
|
@@ -17043,7 +17043,7 @@ function WorkflowViewToggle({
|
|
|
17043
17043
|
onValueChange,
|
|
17044
17044
|
className
|
|
17045
17045
|
}) {
|
|
17046
|
-
const handleValueChange =
|
|
17046
|
+
const handleValueChange = React37__namespace.useCallback(
|
|
17047
17047
|
(newValue) => {
|
|
17048
17048
|
if (newValue === "kanban" || newValue === "list") {
|
|
17049
17049
|
onValueChange(newValue);
|
|
@@ -17093,6 +17093,281 @@ function WorkflowViewToggle({
|
|
|
17093
17093
|
}
|
|
17094
17094
|
) });
|
|
17095
17095
|
}
|
|
17096
|
+
function DataTableBlock({
|
|
17097
|
+
columns,
|
|
17098
|
+
data,
|
|
17099
|
+
searchPlaceholder = "Search...",
|
|
17100
|
+
searchColumn,
|
|
17101
|
+
enableRowSelection = true,
|
|
17102
|
+
enableColumnVisibility = true,
|
|
17103
|
+
enablePagination = true,
|
|
17104
|
+
pageSizeOptions = [10, 20, 30, 50],
|
|
17105
|
+
defaultPageSize = 10,
|
|
17106
|
+
onRowSelectionChange,
|
|
17107
|
+
className
|
|
17108
|
+
}) {
|
|
17109
|
+
const [sorting, setSorting] = React37__namespace.useState([]);
|
|
17110
|
+
const [columnFilters, setColumnFilters] = React37__namespace.useState([]);
|
|
17111
|
+
const [columnVisibility, setColumnVisibility] = React37__namespace.useState({});
|
|
17112
|
+
const [rowSelection, setRowSelection] = React37__namespace.useState({});
|
|
17113
|
+
const [globalFilter, setGlobalFilter] = React37__namespace.useState("");
|
|
17114
|
+
const table = reactTable.useReactTable({
|
|
17115
|
+
data,
|
|
17116
|
+
columns,
|
|
17117
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
17118
|
+
getPaginationRowModel: enablePagination ? reactTable.getPaginationRowModel() : void 0,
|
|
17119
|
+
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
17120
|
+
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
17121
|
+
onSortingChange: setSorting,
|
|
17122
|
+
onColumnFiltersChange: setColumnFilters,
|
|
17123
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
17124
|
+
onRowSelectionChange: setRowSelection,
|
|
17125
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
17126
|
+
globalFilterFn: "includesString",
|
|
17127
|
+
state: {
|
|
17128
|
+
sorting,
|
|
17129
|
+
columnFilters,
|
|
17130
|
+
columnVisibility,
|
|
17131
|
+
rowSelection,
|
|
17132
|
+
globalFilter
|
|
17133
|
+
},
|
|
17134
|
+
initialState: {
|
|
17135
|
+
pagination: {
|
|
17136
|
+
pageSize: defaultPageSize
|
|
17137
|
+
}
|
|
17138
|
+
}
|
|
17139
|
+
});
|
|
17140
|
+
React37__namespace.useEffect(() => {
|
|
17141
|
+
if (onRowSelectionChange) {
|
|
17142
|
+
const selectedRows = table.getFilteredSelectedRowModel().rows.map((row) => row.original);
|
|
17143
|
+
onRowSelectionChange(selectedRows);
|
|
17144
|
+
}
|
|
17145
|
+
}, [rowSelection, onRowSelectionChange, table]);
|
|
17146
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-4", className), children: [
|
|
17147
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
17148
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 max-w-sm", children: [
|
|
17149
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
17150
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17151
|
+
Input,
|
|
17152
|
+
{
|
|
17153
|
+
placeholder: searchPlaceholder,
|
|
17154
|
+
value: globalFilter ?? "",
|
|
17155
|
+
onChange: (event) => setGlobalFilter(event.target.value),
|
|
17156
|
+
className: "pl-9"
|
|
17157
|
+
}
|
|
17158
|
+
)
|
|
17159
|
+
] }),
|
|
17160
|
+
enableColumnVisibility && /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
17161
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", className: "ml-auto h-9", children: [
|
|
17162
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, { className: "mr-2 h-4 w-4" }),
|
|
17163
|
+
"Columns"
|
|
17164
|
+
] }) }),
|
|
17165
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
|
|
17166
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
17167
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
17168
|
+
table.getAllColumns().filter((column) => column.getCanHide()).map((column) => {
|
|
17169
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17170
|
+
DropdownMenuCheckboxItem,
|
|
17171
|
+
{
|
|
17172
|
+
className: "capitalize",
|
|
17173
|
+
checked: column.getIsVisible(),
|
|
17174
|
+
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
17175
|
+
children: column.id
|
|
17176
|
+
},
|
|
17177
|
+
column.id
|
|
17178
|
+
);
|
|
17179
|
+
})
|
|
17180
|
+
] })
|
|
17181
|
+
] })
|
|
17182
|
+
] }),
|
|
17183
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-[var(--color-border-subtle)] shadow-[var(--j3m-shadow-default)]", children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
|
|
17184
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { className: "hover:bg-transparent", children: headerGroup.headers.map((header) => {
|
|
17185
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: header.isPlaceholder ? null : reactTable.flexRender(
|
|
17186
|
+
header.column.columnDef.header,
|
|
17187
|
+
header.getContext()
|
|
17188
|
+
) }, header.id);
|
|
17189
|
+
}) }, headerGroup.id)) }),
|
|
17190
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17191
|
+
TableRow,
|
|
17192
|
+
{
|
|
17193
|
+
"data-state": row.getIsSelected() && "selected",
|
|
17194
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
17195
|
+
},
|
|
17196
|
+
row.id
|
|
17197
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) }) })
|
|
17198
|
+
] }) }),
|
|
17199
|
+
(enableRowSelection || enablePagination) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
17200
|
+
enableRowSelection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
|
|
17201
|
+
table.getFilteredSelectedRowModel().rows.length,
|
|
17202
|
+
" of",
|
|
17203
|
+
" ",
|
|
17204
|
+
table.getFilteredRowModel().rows.length,
|
|
17205
|
+
" row(s) selected."
|
|
17206
|
+
] }),
|
|
17207
|
+
enablePagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-6", children: [
|
|
17208
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
17209
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Rows per page" }),
|
|
17210
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17211
|
+
Select,
|
|
17212
|
+
{
|
|
17213
|
+
value: `${table.getState().pagination.pageSize}`,
|
|
17214
|
+
onValueChange: (value) => {
|
|
17215
|
+
table.setPageSize(Number(value));
|
|
17216
|
+
},
|
|
17217
|
+
children: [
|
|
17218
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }),
|
|
17219
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { side: "top", children: pageSizeOptions.map((pageSize) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
|
|
17220
|
+
]
|
|
17221
|
+
}
|
|
17222
|
+
)
|
|
17223
|
+
] }),
|
|
17224
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center text-sm font-medium", children: [
|
|
17225
|
+
"Page ",
|
|
17226
|
+
table.getState().pagination.pageIndex + 1,
|
|
17227
|
+
" of",
|
|
17228
|
+
" ",
|
|
17229
|
+
table.getPageCount()
|
|
17230
|
+
] }),
|
|
17231
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
17232
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17233
|
+
Button,
|
|
17234
|
+
{
|
|
17235
|
+
variant: "outline",
|
|
17236
|
+
size: "icon",
|
|
17237
|
+
className: "h-8 w-8",
|
|
17238
|
+
onClick: () => table.setPageIndex(0),
|
|
17239
|
+
disabled: !table.getCanPreviousPage(),
|
|
17240
|
+
children: [
|
|
17241
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to first page" }),
|
|
17242
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, { className: "h-4 w-4" })
|
|
17243
|
+
]
|
|
17244
|
+
}
|
|
17245
|
+
),
|
|
17246
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17247
|
+
Button,
|
|
17248
|
+
{
|
|
17249
|
+
variant: "outline",
|
|
17250
|
+
size: "icon",
|
|
17251
|
+
className: "h-8 w-8",
|
|
17252
|
+
onClick: () => table.previousPage(),
|
|
17253
|
+
disabled: !table.getCanPreviousPage(),
|
|
17254
|
+
children: [
|
|
17255
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to previous page" }),
|
|
17256
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" })
|
|
17257
|
+
]
|
|
17258
|
+
}
|
|
17259
|
+
),
|
|
17260
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17261
|
+
Button,
|
|
17262
|
+
{
|
|
17263
|
+
variant: "outline",
|
|
17264
|
+
size: "icon",
|
|
17265
|
+
className: "h-8 w-8",
|
|
17266
|
+
onClick: () => table.nextPage(),
|
|
17267
|
+
disabled: !table.getCanNextPage(),
|
|
17268
|
+
children: [
|
|
17269
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to next page" }),
|
|
17270
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
17271
|
+
]
|
|
17272
|
+
}
|
|
17273
|
+
),
|
|
17274
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17275
|
+
Button,
|
|
17276
|
+
{
|
|
17277
|
+
variant: "outline",
|
|
17278
|
+
size: "icon",
|
|
17279
|
+
className: "h-8 w-8",
|
|
17280
|
+
onClick: () => table.setPageIndex(table.getPageCount() - 1),
|
|
17281
|
+
disabled: !table.getCanNextPage(),
|
|
17282
|
+
children: [
|
|
17283
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to last page" }),
|
|
17284
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, { className: "h-4 w-4" })
|
|
17285
|
+
]
|
|
17286
|
+
}
|
|
17287
|
+
)
|
|
17288
|
+
] })
|
|
17289
|
+
] })
|
|
17290
|
+
] })
|
|
17291
|
+
] });
|
|
17292
|
+
}
|
|
17293
|
+
function DataTableSortHeader({
|
|
17294
|
+
column,
|
|
17295
|
+
title,
|
|
17296
|
+
className
|
|
17297
|
+
}) {
|
|
17298
|
+
if (!column.getCanSort()) {
|
|
17299
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(className), children: title });
|
|
17300
|
+
}
|
|
17301
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17302
|
+
Button,
|
|
17303
|
+
{
|
|
17304
|
+
variant: "ghost",
|
|
17305
|
+
size: "sm",
|
|
17306
|
+
className: cn("-ml-3 h-8 data-[state=open]:bg-accent", className),
|
|
17307
|
+
onClick: () => column.toggleSorting(column.getIsSorted() === "asc"),
|
|
17308
|
+
children: [
|
|
17309
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
|
|
17310
|
+
column.getIsSorted() === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "ml-2 h-4 w-4" }) : column.getIsSorted() === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "ml-2 h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4 opacity-50" })
|
|
17311
|
+
]
|
|
17312
|
+
}
|
|
17313
|
+
);
|
|
17314
|
+
}
|
|
17315
|
+
function DataTableRowActions({
|
|
17316
|
+
row,
|
|
17317
|
+
onView,
|
|
17318
|
+
onEdit,
|
|
17319
|
+
onDelete,
|
|
17320
|
+
actions
|
|
17321
|
+
}) {
|
|
17322
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
17323
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
|
|
17324
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Open menu" }),
|
|
17325
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "h-4 w-4" })
|
|
17326
|
+
] }) }),
|
|
17327
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "end", children: [
|
|
17328
|
+
onView && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { onClick: () => onView(row.original), children: "View" }),
|
|
17329
|
+
onEdit && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { onClick: () => onEdit(row.original), children: "Edit" }),
|
|
17330
|
+
actions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17331
|
+
DropdownMenuItem,
|
|
17332
|
+
{
|
|
17333
|
+
onClick: () => action.onClick(row.original),
|
|
17334
|
+
className: action.destructive ? "text-destructive" : void 0,
|
|
17335
|
+
children: action.label
|
|
17336
|
+
},
|
|
17337
|
+
index
|
|
17338
|
+
)),
|
|
17339
|
+
onDelete && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
17340
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
17341
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17342
|
+
DropdownMenuItem,
|
|
17343
|
+
{
|
|
17344
|
+
onClick: () => onDelete(row.original),
|
|
17345
|
+
className: "text-destructive",
|
|
17346
|
+
children: "Delete"
|
|
17347
|
+
}
|
|
17348
|
+
)
|
|
17349
|
+
] })
|
|
17350
|
+
] })
|
|
17351
|
+
] });
|
|
17352
|
+
}
|
|
17353
|
+
function DataTableRowExpand({
|
|
17354
|
+
row,
|
|
17355
|
+
onClick
|
|
17356
|
+
}) {
|
|
17357
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17358
|
+
Button,
|
|
17359
|
+
{
|
|
17360
|
+
variant: "ghost",
|
|
17361
|
+
size: "icon",
|
|
17362
|
+
className: "h-8 w-8",
|
|
17363
|
+
onClick: () => onClick?.(row.original),
|
|
17364
|
+
children: [
|
|
17365
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "View details" }),
|
|
17366
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
17367
|
+
]
|
|
17368
|
+
}
|
|
17369
|
+
);
|
|
17370
|
+
}
|
|
17096
17371
|
|
|
17097
17372
|
// src/components/event-calendar/types.ts
|
|
17098
17373
|
var DEFAULT_WORKING_HOURS = {
|
|
@@ -17156,7 +17431,7 @@ var BADGE_VARIANT_LABELS = {
|
|
|
17156
17431
|
colored: "Colored",
|
|
17157
17432
|
mixed: "Mixed"
|
|
17158
17433
|
};
|
|
17159
|
-
var CalendarContext =
|
|
17434
|
+
var CalendarContext = React37__namespace.createContext(null);
|
|
17160
17435
|
function EventCalendarProvider({
|
|
17161
17436
|
children,
|
|
17162
17437
|
events: initialEvents = [],
|
|
@@ -17171,38 +17446,38 @@ function EventCalendarProvider({
|
|
|
17171
17446
|
onEventUpdate,
|
|
17172
17447
|
onEventDelete
|
|
17173
17448
|
}) {
|
|
17174
|
-
const [selectedDate, setSelectedDate] =
|
|
17175
|
-
const [selectedUserId, setSelectedUserId] =
|
|
17176
|
-
const [events, setEventsState] =
|
|
17177
|
-
const [users] =
|
|
17178
|
-
const [badgeVariant, setBadgeVariant] =
|
|
17179
|
-
const [view, setView] =
|
|
17180
|
-
const [workingHours, setWorkingHours] =
|
|
17181
|
-
const [visibleHours, setVisibleHours] =
|
|
17182
|
-
|
|
17449
|
+
const [selectedDate, setSelectedDate] = React37__namespace.useState(defaultDate);
|
|
17450
|
+
const [selectedUserId, setSelectedUserId] = React37__namespace.useState(defaultUserId);
|
|
17451
|
+
const [events, setEventsState] = React37__namespace.useState(initialEvents);
|
|
17452
|
+
const [users] = React37__namespace.useState(initialUsers);
|
|
17453
|
+
const [badgeVariant, setBadgeVariant] = React37__namespace.useState(defaultBadgeVariant);
|
|
17454
|
+
const [view, setView] = React37__namespace.useState(defaultView);
|
|
17455
|
+
const [workingHours, setWorkingHours] = React37__namespace.useState(defaultWorkingHours);
|
|
17456
|
+
const [visibleHours, setVisibleHours] = React37__namespace.useState(defaultVisibleHours);
|
|
17457
|
+
React37__namespace.useEffect(() => {
|
|
17183
17458
|
setEventsState(initialEvents);
|
|
17184
17459
|
}, [initialEvents]);
|
|
17185
|
-
const setEvents =
|
|
17460
|
+
const setEvents = React37__namespace.useCallback((newEvents) => {
|
|
17186
17461
|
setEventsState(newEvents);
|
|
17187
17462
|
}, []);
|
|
17188
|
-
const addEvent =
|
|
17463
|
+
const addEvent = React37__namespace.useCallback((event) => {
|
|
17189
17464
|
setEventsState((prev) => [...prev, event]);
|
|
17190
17465
|
onEventAdd?.(event);
|
|
17191
17466
|
}, [onEventAdd]);
|
|
17192
|
-
const updateEvent =
|
|
17467
|
+
const updateEvent = React37__namespace.useCallback((event) => {
|
|
17193
17468
|
setEventsState(
|
|
17194
17469
|
(prev) => prev.map((e) => e.id === event.id ? event : e)
|
|
17195
17470
|
);
|
|
17196
17471
|
onEventUpdate?.(event);
|
|
17197
17472
|
}, [onEventUpdate]);
|
|
17198
|
-
const deleteEvent =
|
|
17473
|
+
const deleteEvent = React37__namespace.useCallback((eventId) => {
|
|
17199
17474
|
setEventsState((prev) => prev.filter((e) => e.id !== eventId));
|
|
17200
17475
|
onEventDelete?.(eventId);
|
|
17201
17476
|
}, [onEventDelete]);
|
|
17202
|
-
const goToToday =
|
|
17477
|
+
const goToToday = React37__namespace.useCallback(() => {
|
|
17203
17478
|
setSelectedDate(/* @__PURE__ */ new Date());
|
|
17204
17479
|
}, []);
|
|
17205
|
-
const goToPrevious =
|
|
17480
|
+
const goToPrevious = React37__namespace.useCallback(() => {
|
|
17206
17481
|
setSelectedDate((current) => {
|
|
17207
17482
|
switch (view) {
|
|
17208
17483
|
case "day":
|
|
@@ -17220,7 +17495,7 @@ function EventCalendarProvider({
|
|
|
17220
17495
|
}
|
|
17221
17496
|
});
|
|
17222
17497
|
}, [view]);
|
|
17223
|
-
const goToNext =
|
|
17498
|
+
const goToNext = React37__namespace.useCallback(() => {
|
|
17224
17499
|
setSelectedDate((current) => {
|
|
17225
17500
|
switch (view) {
|
|
17226
17501
|
case "day":
|
|
@@ -17238,7 +17513,7 @@ function EventCalendarProvider({
|
|
|
17238
17513
|
}
|
|
17239
17514
|
});
|
|
17240
17515
|
}, [view]);
|
|
17241
|
-
const contextValue =
|
|
17516
|
+
const contextValue = React37__namespace.useMemo(
|
|
17242
17517
|
() => ({
|
|
17243
17518
|
// State
|
|
17244
17519
|
selectedDate,
|
|
@@ -17285,7 +17560,7 @@ function EventCalendarProvider({
|
|
|
17285
17560
|
return /* @__PURE__ */ jsxRuntime.jsx(CalendarContext.Provider, { value: contextValue, children });
|
|
17286
17561
|
}
|
|
17287
17562
|
function useEventCalendar() {
|
|
17288
|
-
const context =
|
|
17563
|
+
const context = React37__namespace.useContext(CalendarContext);
|
|
17289
17564
|
if (!context) {
|
|
17290
17565
|
throw new Error("useEventCalendar must be used within an EventCalendarProvider");
|
|
17291
17566
|
}
|
|
@@ -17293,14 +17568,14 @@ function useEventCalendar() {
|
|
|
17293
17568
|
}
|
|
17294
17569
|
function useFilteredEvents() {
|
|
17295
17570
|
const { events, selectedUserId } = useEventCalendar();
|
|
17296
|
-
return
|
|
17571
|
+
return React37__namespace.useMemo(() => {
|
|
17297
17572
|
if (!selectedUserId) return events;
|
|
17298
17573
|
return events.filter((event) => event.user.id === selectedUserId);
|
|
17299
17574
|
}, [events, selectedUserId]);
|
|
17300
17575
|
}
|
|
17301
17576
|
function useEventsInRange(startDate, endDate) {
|
|
17302
17577
|
const filteredEvents = useFilteredEvents();
|
|
17303
|
-
return
|
|
17578
|
+
return React37__namespace.useMemo(() => {
|
|
17304
17579
|
return filteredEvents.filter((event) => {
|
|
17305
17580
|
const eventStart = new Date(event.startDate);
|
|
17306
17581
|
const eventEnd = new Date(event.endDate);
|
|
@@ -17858,8 +18133,8 @@ function MoreEvents({ count, onClick, className }) {
|
|
|
17858
18133
|
);
|
|
17859
18134
|
}
|
|
17860
18135
|
function TimeIndicator({ className }) {
|
|
17861
|
-
const [now, setNow] =
|
|
17862
|
-
|
|
18136
|
+
const [now, setNow] = React37__namespace.useState(/* @__PURE__ */ new Date());
|
|
18137
|
+
React37__namespace.useEffect(() => {
|
|
17863
18138
|
const interval = setInterval(() => setNow(/* @__PURE__ */ new Date()), 6e4);
|
|
17864
18139
|
return () => clearInterval(interval);
|
|
17865
18140
|
}, []);
|
|
@@ -17896,24 +18171,24 @@ function DateBadge({ date, className }) {
|
|
|
17896
18171
|
}
|
|
17897
18172
|
);
|
|
17898
18173
|
}
|
|
17899
|
-
var DragContext =
|
|
18174
|
+
var DragContext = React37__namespace.createContext(null);
|
|
17900
18175
|
function DragProvider({
|
|
17901
18176
|
children,
|
|
17902
18177
|
snapMinutes = 15,
|
|
17903
18178
|
onDragStart,
|
|
17904
18179
|
onDragEnd
|
|
17905
18180
|
}) {
|
|
17906
|
-
const [draggedEvent, setDraggedEventState] =
|
|
17907
|
-
const [isDragging, setIsDragging] =
|
|
18181
|
+
const [draggedEvent, setDraggedEventState] = React37__namespace.useState(null);
|
|
18182
|
+
const [isDragging, setIsDragging] = React37__namespace.useState(false);
|
|
17908
18183
|
const { updateEvent } = useEventCalendar();
|
|
17909
|
-
const setDraggedEvent =
|
|
18184
|
+
const setDraggedEvent = React37__namespace.useCallback((event) => {
|
|
17910
18185
|
setDraggedEventState(event);
|
|
17911
18186
|
setIsDragging(!!event);
|
|
17912
18187
|
if (event) {
|
|
17913
18188
|
onDragStart?.(event);
|
|
17914
18189
|
}
|
|
17915
18190
|
}, [onDragStart]);
|
|
17916
|
-
const handleDrop =
|
|
18191
|
+
const handleDrop = React37__namespace.useCallback((newStartDate) => {
|
|
17917
18192
|
if (!draggedEvent) return;
|
|
17918
18193
|
const snappedDate = snapToInterval(newStartDate, snapMinutes);
|
|
17919
18194
|
const { startDate, endDate } = calculateDropDates(draggedEvent, snappedDate);
|
|
@@ -17926,7 +18201,7 @@ function DragProvider({
|
|
|
17926
18201
|
onDragEnd?.(updatedEvent, new Date(startDate), new Date(endDate));
|
|
17927
18202
|
setDraggedEvent(null);
|
|
17928
18203
|
}, [draggedEvent, snapMinutes, updateEvent, onDragEnd, setDraggedEvent]);
|
|
17929
|
-
const contextValue =
|
|
18204
|
+
const contextValue = React37__namespace.useMemo(
|
|
17930
18205
|
() => ({
|
|
17931
18206
|
draggedEvent,
|
|
17932
18207
|
setDraggedEvent,
|
|
@@ -17937,7 +18212,7 @@ function DragProvider({
|
|
|
17937
18212
|
return /* @__PURE__ */ jsxRuntime.jsx(DragContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(DragDropHandler, { onDrop: handleDrop, children }) });
|
|
17938
18213
|
}
|
|
17939
18214
|
function useDrag() {
|
|
17940
|
-
const context =
|
|
18215
|
+
const context = React37__namespace.useContext(DragContext);
|
|
17941
18216
|
if (!context) {
|
|
17942
18217
|
throw new Error("useDrag must be used within a DragProvider");
|
|
17943
18218
|
}
|
|
@@ -17982,7 +18257,7 @@ function DroppableZone({
|
|
|
17982
18257
|
}) {
|
|
17983
18258
|
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
17984
18259
|
const { updateEvent } = useEventCalendar();
|
|
17985
|
-
const [isOver, setIsOver] =
|
|
18260
|
+
const [isOver, setIsOver] = React37__namespace.useState(false);
|
|
17986
18261
|
const handleDragOver = (e) => {
|
|
17987
18262
|
e.preventDefault();
|
|
17988
18263
|
e.dataTransfer.dropEffect = "move";
|
|
@@ -18020,23 +18295,23 @@ function DroppableZone({
|
|
|
18020
18295
|
function useDroppable({ date, hour, minute = 0, onDrop }) {
|
|
18021
18296
|
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
18022
18297
|
const { updateEvent } = useEventCalendar();
|
|
18023
|
-
const [isOver, setIsOver] =
|
|
18024
|
-
const dropTargetDate =
|
|
18298
|
+
const [isOver, setIsOver] = React37__namespace.useState(false);
|
|
18299
|
+
const dropTargetDate = React37__namespace.useMemo(() => {
|
|
18025
18300
|
const targetDate = new Date(date);
|
|
18026
18301
|
if (hour !== void 0) {
|
|
18027
18302
|
targetDate.setHours(hour, minute, 0, 0);
|
|
18028
18303
|
}
|
|
18029
18304
|
return targetDate;
|
|
18030
18305
|
}, [date, hour, minute]);
|
|
18031
|
-
const handleDragOver =
|
|
18306
|
+
const handleDragOver = React37__namespace.useCallback((e) => {
|
|
18032
18307
|
e.preventDefault();
|
|
18033
18308
|
e.dataTransfer.dropEffect = "move";
|
|
18034
18309
|
if (!isOver) setIsOver(true);
|
|
18035
18310
|
}, [isOver]);
|
|
18036
|
-
const handleDragLeave =
|
|
18311
|
+
const handleDragLeave = React37__namespace.useCallback(() => {
|
|
18037
18312
|
setIsOver(false);
|
|
18038
18313
|
}, []);
|
|
18039
|
-
const handleDrop =
|
|
18314
|
+
const handleDrop = React37__namespace.useCallback((e) => {
|
|
18040
18315
|
e.preventDefault();
|
|
18041
18316
|
setIsOver(false);
|
|
18042
18317
|
if (!draggedEvent) return;
|
|
@@ -18063,13 +18338,13 @@ function useDroppable({ date, hour, minute = 0, onDrop }) {
|
|
|
18063
18338
|
function useDraggable3(event, disabled = false) {
|
|
18064
18339
|
const { setDraggedEvent, draggedEvent } = useDrag();
|
|
18065
18340
|
const isDragged = draggedEvent?.id === event.id;
|
|
18066
|
-
const handleDragStart =
|
|
18341
|
+
const handleDragStart = React37__namespace.useCallback((e) => {
|
|
18067
18342
|
if (disabled) return;
|
|
18068
18343
|
e.dataTransfer.effectAllowed = "move";
|
|
18069
18344
|
e.dataTransfer.setData("text/plain", event.id);
|
|
18070
18345
|
setDraggedEvent(event);
|
|
18071
18346
|
}, [disabled, event, setDraggedEvent]);
|
|
18072
|
-
const handleDragEnd =
|
|
18347
|
+
const handleDragEnd = React37__namespace.useCallback(() => {
|
|
18073
18348
|
setDraggedEvent(null);
|
|
18074
18349
|
}, [setDraggedEvent]);
|
|
18075
18350
|
return {
|
|
@@ -18110,15 +18385,15 @@ function MonthView({
|
|
|
18110
18385
|
}) {
|
|
18111
18386
|
const { selectedDate, badgeVariant, setSelectedDate, setView } = useEventCalendar();
|
|
18112
18387
|
const filteredEvents = useFilteredEvents();
|
|
18113
|
-
const { singleDayEvents, multiDayEvents } =
|
|
18388
|
+
const { singleDayEvents, multiDayEvents } = React37__namespace.useMemo(
|
|
18114
18389
|
() => splitEventsByDuration(filteredEvents),
|
|
18115
18390
|
[filteredEvents]
|
|
18116
18391
|
);
|
|
18117
|
-
const cells =
|
|
18392
|
+
const cells = React37__namespace.useMemo(
|
|
18118
18393
|
() => getCalendarCells(selectedDate),
|
|
18119
18394
|
[selectedDate]
|
|
18120
18395
|
);
|
|
18121
|
-
const eventPositions =
|
|
18396
|
+
const eventPositions = React37__namespace.useMemo(
|
|
18122
18397
|
() => calculateMonthEventPositions(multiDayEvents, singleDayEvents, selectedDate),
|
|
18123
18398
|
[multiDayEvents, singleDayEvents, selectedDate]
|
|
18124
18399
|
);
|
|
@@ -18300,7 +18575,7 @@ function WeekView({
|
|
|
18300
18575
|
visibleHours
|
|
18301
18576
|
} = useEventCalendar();
|
|
18302
18577
|
const filteredEvents = useFilteredEvents();
|
|
18303
|
-
const { singleDayEvents, multiDayEvents } =
|
|
18578
|
+
const { singleDayEvents, multiDayEvents } = React37__namespace.useMemo(
|
|
18304
18579
|
() => splitEventsByDuration(filteredEvents),
|
|
18305
18580
|
[filteredEvents]
|
|
18306
18581
|
);
|
|
@@ -18506,8 +18781,8 @@ function CalendarTimeline({
|
|
|
18506
18781
|
firstVisibleHour,
|
|
18507
18782
|
lastVisibleHour
|
|
18508
18783
|
}) {
|
|
18509
|
-
const [currentTime, setCurrentTime] =
|
|
18510
|
-
|
|
18784
|
+
const [currentTime, setCurrentTime] = React37__namespace.useState(/* @__PURE__ */ new Date());
|
|
18785
|
+
React37__namespace.useEffect(() => {
|
|
18511
18786
|
const interval = setInterval(() => {
|
|
18512
18787
|
setCurrentTime(/* @__PURE__ */ new Date());
|
|
18513
18788
|
}, 6e4);
|
|
@@ -18590,7 +18865,7 @@ function DayView({
|
|
|
18590
18865
|
visibleHours
|
|
18591
18866
|
} = useEventCalendar();
|
|
18592
18867
|
const filteredEvents = useFilteredEvents();
|
|
18593
|
-
const { singleDayEvents, multiDayEvents } =
|
|
18868
|
+
const { singleDayEvents, multiDayEvents } = React37__namespace.useMemo(
|
|
18594
18869
|
() => splitEventsByDuration(filteredEvents),
|
|
18595
18870
|
[filteredEvents]
|
|
18596
18871
|
);
|
|
@@ -18598,7 +18873,7 @@ function DayView({
|
|
|
18598
18873
|
visibleHours,
|
|
18599
18874
|
singleDayEvents
|
|
18600
18875
|
);
|
|
18601
|
-
const currentEvents =
|
|
18876
|
+
const currentEvents = React37__namespace.useMemo(() => {
|
|
18602
18877
|
if (!dateFns.isToday(selectedDate)) return [];
|
|
18603
18878
|
return getCurrentEvents(singleDayEvents);
|
|
18604
18879
|
}, [singleDayEvents, selectedDate]);
|
|
@@ -18822,8 +19097,8 @@ function CalendarTimeline2({
|
|
|
18822
19097
|
firstVisibleHour,
|
|
18823
19098
|
lastVisibleHour
|
|
18824
19099
|
}) {
|
|
18825
|
-
const [currentTime, setCurrentTime] =
|
|
18826
|
-
|
|
19100
|
+
const [currentTime, setCurrentTime] = React37__namespace.useState(/* @__PURE__ */ new Date());
|
|
19101
|
+
React37__namespace.useEffect(() => {
|
|
18827
19102
|
const interval = setInterval(() => {
|
|
18828
19103
|
setCurrentTime(/* @__PURE__ */ new Date());
|
|
18829
19104
|
}, 6e4);
|
|
@@ -18857,7 +19132,7 @@ function YearView({
|
|
|
18857
19132
|
}) {
|
|
18858
19133
|
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
18859
19134
|
const filteredEvents = useFilteredEvents();
|
|
18860
|
-
const months =
|
|
19135
|
+
const months = React37__namespace.useMemo(() => {
|
|
18861
19136
|
const yearStart = dateFns.startOfYear(selectedDate);
|
|
18862
19137
|
return Array.from({ length: 12 }, (_, i) => dateFns.addMonths(yearStart, i));
|
|
18863
19138
|
}, [selectedDate]);
|
|
@@ -18980,11 +19255,11 @@ function AgendaView({
|
|
|
18980
19255
|
}) {
|
|
18981
19256
|
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
18982
19257
|
const filteredEvents = useFilteredEvents();
|
|
18983
|
-
const { singleDayEvents, multiDayEvents } =
|
|
19258
|
+
const { singleDayEvents, multiDayEvents } = React37__namespace.useMemo(
|
|
18984
19259
|
() => splitEventsByDuration(filteredEvents),
|
|
18985
19260
|
[filteredEvents]
|
|
18986
19261
|
);
|
|
18987
|
-
const eventsByDay =
|
|
19262
|
+
const eventsByDay = React37__namespace.useMemo(() => {
|
|
18988
19263
|
const allDates = /* @__PURE__ */ new Map();
|
|
18989
19264
|
singleDayEvents.forEach((event) => {
|
|
18990
19265
|
const eventDate = dateFns.parseISO(event.startDate);
|
|
@@ -19449,16 +19724,16 @@ function EventDialog({
|
|
|
19449
19724
|
defaultUserId
|
|
19450
19725
|
}) {
|
|
19451
19726
|
const { addEvent, updateEvent, deleteEvent, users } = useEventCalendar();
|
|
19452
|
-
const [title, setTitle] =
|
|
19453
|
-
const [description, setDescription] =
|
|
19454
|
-
const [startDate, setStartDate] =
|
|
19455
|
-
const [startTime, setStartTime] =
|
|
19456
|
-
const [endDate, setEndDate] =
|
|
19457
|
-
const [endTime, setEndTime] =
|
|
19458
|
-
const [color, setColor] =
|
|
19459
|
-
const [userId, setUserId] =
|
|
19460
|
-
const [isSubmitting, setIsSubmitting] =
|
|
19461
|
-
|
|
19727
|
+
const [title, setTitle] = React37__namespace.useState("");
|
|
19728
|
+
const [description, setDescription] = React37__namespace.useState("");
|
|
19729
|
+
const [startDate, setStartDate] = React37__namespace.useState("");
|
|
19730
|
+
const [startTime, setStartTime] = React37__namespace.useState("");
|
|
19731
|
+
const [endDate, setEndDate] = React37__namespace.useState("");
|
|
19732
|
+
const [endTime, setEndTime] = React37__namespace.useState("");
|
|
19733
|
+
const [color, setColor] = React37__namespace.useState("blue");
|
|
19734
|
+
const [userId, setUserId] = React37__namespace.useState("");
|
|
19735
|
+
const [isSubmitting, setIsSubmitting] = React37__namespace.useState(false);
|
|
19736
|
+
React37__namespace.useEffect(() => {
|
|
19462
19737
|
if (open) {
|
|
19463
19738
|
if (mode === "edit" && event) {
|
|
19464
19739
|
const start = dateFns.parseISO(event.startDate);
|
|
@@ -19681,7 +19956,7 @@ function QuickAddEvent({
|
|
|
19681
19956
|
onOpenDialog,
|
|
19682
19957
|
onClose
|
|
19683
19958
|
}) {
|
|
19684
|
-
const [title, setTitle] =
|
|
19959
|
+
const [title, setTitle] = React37__namespace.useState("");
|
|
19685
19960
|
const { users } = useEventCalendar();
|
|
19686
19961
|
const handleSubmit = (e) => {
|
|
19687
19962
|
e.preventDefault();
|
|
@@ -19748,8 +20023,8 @@ var HOUR_OPTIONS = Array.from({ length: 25 }, (_, i) => {
|
|
|
19748
20023
|
});
|
|
19749
20024
|
function ChangeVisibleHoursInput() {
|
|
19750
20025
|
const { visibleHours, setVisibleHours } = useEventCalendar();
|
|
19751
|
-
const [from, setFrom] =
|
|
19752
|
-
const [to, setTo] =
|
|
20026
|
+
const [from, setFrom] = React37__namespace.useState(visibleHours.from);
|
|
20027
|
+
const [to, setTo] = React37__namespace.useState(visibleHours.to);
|
|
19753
20028
|
const handleApply = () => {
|
|
19754
20029
|
const toHour = to === 0 ? 24 : to;
|
|
19755
20030
|
setVisibleHours({ from, to: toHour });
|
|
@@ -19795,7 +20070,7 @@ var HOUR_OPTIONS2 = Array.from({ length: 25 }, (_, i) => {
|
|
|
19795
20070
|
});
|
|
19796
20071
|
function ChangeWorkingHoursInput() {
|
|
19797
20072
|
const { workingHours, setWorkingHours } = useEventCalendar();
|
|
19798
|
-
const [localWorkingHours, setLocalWorkingHours] =
|
|
20073
|
+
const [localWorkingHours, setLocalWorkingHours] = React37__namespace.useState({
|
|
19799
20074
|
...workingHours
|
|
19800
20075
|
});
|
|
19801
20076
|
const handleToggleDay = (dayId) => {
|
|
@@ -19944,8 +20219,8 @@ function CalendarSettingsButton({
|
|
|
19944
20219
|
);
|
|
19945
20220
|
}
|
|
19946
20221
|
function useMediaQuery(query) {
|
|
19947
|
-
const [matches, setMatches] =
|
|
19948
|
-
|
|
20222
|
+
const [matches, setMatches] = React37__namespace.useState(false);
|
|
20223
|
+
React37__namespace.useEffect(() => {
|
|
19949
20224
|
const media = window.matchMedia(query);
|
|
19950
20225
|
setMatches(media.matches);
|
|
19951
20226
|
const listener = (event) => {
|
|
@@ -19997,11 +20272,11 @@ function BigCalendarInner({
|
|
|
19997
20272
|
maxEventsPerDay
|
|
19998
20273
|
}) {
|
|
19999
20274
|
const { view, setView } = useEventCalendar();
|
|
20000
|
-
const [dialogOpen, setDialogOpen] =
|
|
20001
|
-
const [settingsDialogOpen, setSettingsDialogOpen] =
|
|
20002
|
-
const [selectedEvent, setSelectedEvent] =
|
|
20003
|
-
const [dialogMode, setDialogMode] =
|
|
20004
|
-
const [defaultDate, setDefaultDate] =
|
|
20275
|
+
const [dialogOpen, setDialogOpen] = React37__namespace.useState(false);
|
|
20276
|
+
const [settingsDialogOpen, setSettingsDialogOpen] = React37__namespace.useState(false);
|
|
20277
|
+
const [selectedEvent, setSelectedEvent] = React37__namespace.useState(null);
|
|
20278
|
+
const [dialogMode, setDialogMode] = React37__namespace.useState("add");
|
|
20279
|
+
const [defaultDate, setDefaultDate] = React37__namespace.useState(/* @__PURE__ */ new Date());
|
|
20005
20280
|
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
20006
20281
|
const isCompact = compact === "auto" ? isMobile : compact;
|
|
20007
20282
|
const handleAddClick = () => {
|
|
@@ -20160,7 +20435,7 @@ function CalendarView({
|
|
|
20160
20435
|
}
|
|
20161
20436
|
}
|
|
20162
20437
|
var t = tunnel__default.default();
|
|
20163
|
-
var KanbanContext =
|
|
20438
|
+
var KanbanContext = React37.createContext({
|
|
20164
20439
|
columns: [],
|
|
20165
20440
|
data: [],
|
|
20166
20441
|
activeCardId: null
|
|
@@ -20198,7 +20473,7 @@ var KanbanCard = ({
|
|
|
20198
20473
|
} = sortable.useSortable({
|
|
20199
20474
|
id
|
|
20200
20475
|
});
|
|
20201
|
-
const { activeCardId } =
|
|
20476
|
+
const { activeCardId } = React37.useContext(KanbanContext);
|
|
20202
20477
|
const style = {
|
|
20203
20478
|
transition,
|
|
20204
20479
|
transform: utilities.CSS.Transform.toString(transform)
|
|
@@ -20233,7 +20508,7 @@ var KanbanCards = ({
|
|
|
20233
20508
|
className,
|
|
20234
20509
|
...props
|
|
20235
20510
|
}) => {
|
|
20236
|
-
const { data } =
|
|
20511
|
+
const { data } = React37.useContext(KanbanContext);
|
|
20237
20512
|
const filteredData = data.filter((item) => item.column === props.id);
|
|
20238
20513
|
const items = filteredData.map((item) => item.id);
|
|
20239
20514
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScrollArea, { className: "overflow-hidden", children: [
|
|
@@ -20260,7 +20535,7 @@ var KanbanProvider = ({
|
|
|
20260
20535
|
onDataChange,
|
|
20261
20536
|
...props
|
|
20262
20537
|
}) => {
|
|
20263
|
-
const [activeCardId, setActiveCardId] =
|
|
20538
|
+
const [activeCardId, setActiveCardId] = React37.useState(null);
|
|
20264
20539
|
const sensors = core.useSensors(
|
|
20265
20540
|
core.useSensor(core.MouseSensor),
|
|
20266
20541
|
core.useSensor(core.TouchSensor),
|
|
@@ -20358,30 +20633,6 @@ var KanbanProvider = ({
|
|
|
20358
20633
|
) });
|
|
20359
20634
|
};
|
|
20360
20635
|
|
|
20361
|
-
Object.defineProperty(exports, "flexRender", {
|
|
20362
|
-
enumerable: true,
|
|
20363
|
-
get: function () { return reactTable.flexRender; }
|
|
20364
|
-
});
|
|
20365
|
-
Object.defineProperty(exports, "getCoreRowModel", {
|
|
20366
|
-
enumerable: true,
|
|
20367
|
-
get: function () { return reactTable.getCoreRowModel; }
|
|
20368
|
-
});
|
|
20369
|
-
Object.defineProperty(exports, "getFilteredRowModel", {
|
|
20370
|
-
enumerable: true,
|
|
20371
|
-
get: function () { return reactTable.getFilteredRowModel; }
|
|
20372
|
-
});
|
|
20373
|
-
Object.defineProperty(exports, "getPaginationRowModel", {
|
|
20374
|
-
enumerable: true,
|
|
20375
|
-
get: function () { return reactTable.getPaginationRowModel; }
|
|
20376
|
-
});
|
|
20377
|
-
Object.defineProperty(exports, "getSortedRowModel", {
|
|
20378
|
-
enumerable: true,
|
|
20379
|
-
get: function () { return reactTable.getSortedRowModel; }
|
|
20380
|
-
});
|
|
20381
|
-
Object.defineProperty(exports, "useReactTable", {
|
|
20382
|
-
enumerable: true,
|
|
20383
|
-
get: function () { return reactTable.useReactTable; }
|
|
20384
|
-
});
|
|
20385
20636
|
Object.defineProperty(exports, "areIntervalsOverlapping", {
|
|
20386
20637
|
enumerable: true,
|
|
20387
20638
|
get: function () { return dateFns.areIntervalsOverlapping; }
|
|
@@ -20515,8 +20766,12 @@ exports.ContextMenuSubTrigger = ContextMenuSubTrigger;
|
|
|
20515
20766
|
exports.ContextMenuTrigger = ContextMenuTrigger;
|
|
20516
20767
|
exports.DEFAULT_VISIBLE_HOURS = DEFAULT_VISIBLE_HOURS;
|
|
20517
20768
|
exports.DEFAULT_WORKING_HOURS = DEFAULT_WORKING_HOURS;
|
|
20769
|
+
exports.DataTableBlock = DataTableBlock;
|
|
20518
20770
|
exports.DataTableColumnHeader = DataTableColumnHeader;
|
|
20519
20771
|
exports.DataTablePagination = DataTablePagination;
|
|
20772
|
+
exports.DataTableRowActions = DataTableRowActions;
|
|
20773
|
+
exports.DataTableRowExpand = DataTableRowExpand;
|
|
20774
|
+
exports.DataTableSortHeader = DataTableSortHeader;
|
|
20520
20775
|
exports.DataTableViewOptions = DataTableViewOptions;
|
|
20521
20776
|
exports.DateBadge = DateBadge;
|
|
20522
20777
|
exports.DayView = DayView;
|