impact-nova 0.1.13 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/layout/dashboard-layout.d.ts +21 -6
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +32 -33
- package/dist/components/ui/accordion.js +25 -23
- package/dist/components/ui/ag-grid-react/cell-renderers/date-display-renderer.js +32 -21
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.d.ts +3 -5
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +57 -55
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +5 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +50 -52
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +34 -34
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +8 -11
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +17 -17
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +3 -3
- package/dist/components/ui/alert-dialog.js +45 -40
- package/dist/components/ui/alert.d.ts +21 -4
- package/dist/components/ui/alert.js +45 -25
- package/dist/components/ui/avatar.js +19 -16
- package/dist/components/ui/badge.js +8 -1
- package/dist/components/ui/breadcrumb.js +1 -0
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +27 -32
- package/dist/components/ui/button-variants.d.ts +1 -1
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +11 -9
- package/dist/components/ui/calendar.d.ts +14 -2
- package/dist/components/ui/calendar.js +443 -376
- package/dist/components/ui/card.js +7 -6
- package/dist/components/ui/checkbox.js +64 -48
- package/dist/components/ui/chips.d.ts +1 -0
- package/dist/components/ui/chips.js +27 -19
- package/dist/components/ui/data-table/data-table-column-list.d.ts +4 -1
- package/dist/components/ui/data-table/data-table-column-list.js +58 -54
- package/dist/components/ui/data-table/data-table-sheet.d.ts +1 -1
- package/dist/components/ui/data-table/data-table-sheet.js +43 -40
- package/dist/components/ui/data-table/data-table-view-options.js +17 -17
- package/dist/components/ui/data-table/data-table.js +21 -20
- package/dist/components/ui/date-picker/date-picker.js +93 -93
- package/dist/components/ui/date-picker/date-range-picker.js +142 -133
- package/dist/components/ui/date-picker/month-picker.js +96 -93
- package/dist/components/ui/date-picker/month-range-picker.js +144 -134
- package/dist/components/ui/date-picker/multi-date-picker.js +43 -45
- package/dist/components/ui/date-picker/multi-month-picker.js +37 -39
- package/dist/components/ui/date-picker/multi-week-picker.js +56 -46
- package/dist/components/ui/date-picker/week-picker.js +119 -109
- package/dist/components/ui/date-picker/week-range-picker.js +170 -147
- package/dist/components/ui/dialog.js +15 -6
- package/dist/components/ui/drawer.js +16 -13
- package/dist/components/ui/dropdown-menu.js +4 -2
- package/dist/components/ui/dynamic-layout.d.ts +2 -2
- package/dist/components/ui/dynamic-layout.js +18 -15
- package/dist/components/ui/empty-container.js +69 -64
- package/dist/components/ui/file-upload.js +113 -106
- package/dist/components/ui/filter-panel/filter-panel.js +49 -46
- package/dist/components/ui/filter-strip/filter-strip.js +41 -37
- package/dist/components/ui/header.js +26 -25
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +43 -40
- package/dist/components/ui/hover-card.js +6 -5
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.js +79 -68
- package/dist/components/ui/loader.d.ts +1 -0
- package/dist/components/ui/loader.js +23 -13
- package/dist/components/ui/nested-list/components/NestedListContent.d.ts +1 -3
- package/dist/components/ui/nested-list/components/NestedListContent.js +16 -15
- package/dist/components/ui/nested-list/components/SortableItem.js +116 -80
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.d.ts +13 -1
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +162 -112
- package/dist/components/ui/nested-list/nested-list.js +182 -189
- package/dist/components/ui/notification-panel/notification-item.js +19 -17
- package/dist/components/ui/notification-panel/notification-list.js +21 -21
- package/dist/components/ui/notification-panel/notification-panel.js +25 -25
- package/dist/components/ui/popover.js +37 -34
- package/dist/components/ui/progress.js +12 -10
- package/dist/components/ui/prompt.js +29 -27
- package/dist/components/ui/radio-group.js +55 -46
- package/dist/components/ui/select/components/Submenu.d.ts +1 -2
- package/dist/components/ui/select/components/Submenu.js +52 -48
- package/dist/components/ui/select/select.js +321 -324
- package/dist/components/ui/sheet.js +18 -15
- package/dist/components/ui/sidebar.d.ts +2 -2
- package/dist/components/ui/sidebar.js +3 -3
- package/dist/components/ui/skeleton.d.ts +2 -1
- package/dist/components/ui/skeleton.js +12 -11
- package/dist/components/ui/slider.js +39 -12
- package/dist/components/ui/smart-input.js +44 -39
- package/dist/components/ui/stepper.js +33 -29
- package/dist/components/ui/switch.js +6 -4
- package/dist/components/ui/tabs.js +50 -45
- package/dist/components/ui/tag-group.d.ts +2 -1
- package/dist/components/ui/tag-group.js +29 -25
- package/dist/components/ui/tag.d.ts +1 -0
- package/dist/components/ui/tag.js +26 -20
- package/dist/components/ui/textarea.js +18 -17
- package/dist/components/ui/toast.d.ts +1 -1
- package/dist/components/ui/toast.js +47 -41
- package/dist/components/ui/toaster.js +42 -42
- package/dist/components/ui/tooltip.js +18 -16
- package/dist/components/ui/types/date-picker.types.d.ts +33 -0
- package/dist/components/ui/types/empty-container.types.d.ts +5 -0
- package/dist/components/ui/types/nested-list.types.d.ts +1 -0
- package/dist/components/ui/types/select.types.d.ts +0 -1
- package/dist/icons/assets/bookmark.svg.js +4 -0
- package/dist/icons/assets/bookmark.svg2.js +5 -0
- package/dist/icons/assets/bookmarkFilled.svg.js +4 -0
- package/dist/icons/assets/bookmarkFilled.svg2.js +5 -0
- package/dist/icons/assets/download.svg.js +4 -0
- package/dist/icons/assets/download.svg2.js +5 -0
- package/dist/icons/index.d.ts +20 -6
- package/dist/icons/index.js +398 -370
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +318 -314
- package/dist/lib/fiscal-calendar.d.ts +62 -0
- package/dist/lib/fiscal-calendar.js +99 -0
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.js +29 -13
- package/package.json +5 -5
- package/dist/components/ui/select/hooks/useClickOutside.d.ts +0 -15
- package/dist/components/ui/select/hooks/useClickOutside.js +0 -43
- package/dist/components/ui/select/hooks/useMenuPosition.d.ts +0 -2
- package/dist/components/ui/select/hooks/useMenuPosition.js +0 -89
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
interface DashboardLayoutProps extends React.ComponentProps<"div"> {
|
|
3
3
|
/**
|
|
4
|
-
* The Sidebar component (e.g. <AppSidebar />)
|
|
4
|
+
* The Sidebar component (e.g. <AppSidebar />).
|
|
5
|
+
* Will be wrapped in a SidebarProvider automatically.
|
|
5
6
|
*/
|
|
6
7
|
sidebar: React.ReactNode;
|
|
7
8
|
/**
|
|
8
|
-
* The Header component (e.g. <Header />)
|
|
9
|
+
* The Header component (e.g. <Header />).
|
|
10
|
+
* Rendered above the main content area, below header it sticks to the top.
|
|
9
11
|
*/
|
|
10
12
|
header: React.ReactNode;
|
|
11
13
|
/**
|
|
12
|
-
* Optional
|
|
14
|
+
* Optional breadcrumb node rendered inside a sticky BreadcrumbHeader bar.
|
|
15
|
+
* When provided, the bar is sticky at the top of the scroll area.
|
|
13
16
|
*/
|
|
14
17
|
breadcrumb?: React.ReactNode;
|
|
15
18
|
/**
|
|
16
|
-
* Optional
|
|
19
|
+
* Optional content rendered on the right side of the breadcrumb header bar
|
|
20
|
+
* (e.g. action buttons, view toggles, filter toggle button).
|
|
21
|
+
*/
|
|
22
|
+
breadcrumbRightContent?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Optional FilterStrip or any content rendered below the BreadcrumbHeader bar
|
|
25
|
+
* with a smooth animated collapse/expand behaviour.
|
|
26
|
+
* Visibility is controlled by the built-in "Show/Hide Filters" toggle
|
|
27
|
+
* when `filterStrip` is provided.
|
|
17
28
|
*/
|
|
18
29
|
filterStrip?: React.ReactNode;
|
|
19
30
|
/**
|
|
20
|
-
*
|
|
31
|
+
* When true, the filter strip is shown by default. Defaults to `true`.
|
|
32
|
+
*/
|
|
33
|
+
defaultFiltersVisible?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Main content (e.g. <Outlet /> or page-level content).
|
|
21
36
|
*/
|
|
22
37
|
children: React.ReactNode;
|
|
23
38
|
}
|
|
24
|
-
export declare function DashboardLayout({ sidebar, header, breadcrumb, filterStrip, children, className, ...props }: DashboardLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function DashboardLayout({ sidebar, header, breadcrumb, breadcrumbRightContent, filterStrip, defaultFiltersVisible, children, className, ...props }: DashboardLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
25
40
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as W, useCallback as s, useMemo as _ } from "react";
|
|
3
3
|
import { Accordion as q, AccordionItem as z, AccordionTrigger as F, AccordionContent as G } from "../accordion.js";
|
|
4
4
|
import { Button as A } from "../button.js";
|
|
@@ -7,65 +7,66 @@ import { useAccordionNestedListState as J } from "./hooks/useAccordionNestedList
|
|
|
7
7
|
import { SelectionMode as K } from "../types/nested-list.types.js";
|
|
8
8
|
import { cn as P } from "../../../lib/utils.js";
|
|
9
9
|
const re = ({
|
|
10
|
-
sections:
|
|
10
|
+
sections: l,
|
|
11
11
|
onChange: d,
|
|
12
12
|
onSubmit: h,
|
|
13
13
|
onCancel: m,
|
|
14
|
-
enableApplyDiscard:
|
|
15
|
-
submitButtonLabel:
|
|
16
|
-
cancelButtonLabel:
|
|
17
|
-
className:
|
|
14
|
+
enableApplyDiscard: N = !0,
|
|
15
|
+
submitButtonLabel: g = "Apply",
|
|
16
|
+
cancelButtonLabel: v = "Reset",
|
|
17
|
+
className: C = "",
|
|
18
18
|
enableSearch: S = !0,
|
|
19
|
-
enableDragDrop:
|
|
20
|
-
enableSelectAll:
|
|
19
|
+
enableDragDrop: b = !0,
|
|
20
|
+
enableSelectAll: y = !0,
|
|
21
21
|
selectionMode: x = K.CASCADE_DOWN,
|
|
22
22
|
searchPlaceholder: k = "Search...",
|
|
23
23
|
value: D,
|
|
24
24
|
onValueChange: V,
|
|
25
|
-
isMultiExpanded:
|
|
25
|
+
isMultiExpanded: t = !0,
|
|
26
26
|
defaultCollapseAll: j = !1,
|
|
27
|
-
validateApply:
|
|
27
|
+
validateApply: o
|
|
28
28
|
}) => {
|
|
29
29
|
const {
|
|
30
|
-
currentSections:
|
|
31
|
-
hasChanges:
|
|
30
|
+
currentSections: n,
|
|
31
|
+
hasChanges: a,
|
|
32
32
|
setCurrentSection: u,
|
|
33
33
|
saveAllSections: f,
|
|
34
34
|
discardAllSections: p
|
|
35
|
-
} = J({ sections:
|
|
36
|
-
(e,
|
|
37
|
-
u(e,
|
|
35
|
+
} = J({ sections: l }), [L, w] = W(() => j ? t ? [] : "" : l.length > 0 ? t ? [l[0].id] : l[0].id : t ? [] : ""), B = D ?? L, I = V ?? w, M = s(
|
|
36
|
+
(e, i) => {
|
|
37
|
+
u(e, i), d?.(e, i);
|
|
38
38
|
},
|
|
39
39
|
[d, u]
|
|
40
40
|
), O = s(() => {
|
|
41
|
-
f(), h?.(
|
|
42
|
-
}, [
|
|
41
|
+
f(), h?.(n);
|
|
42
|
+
}, [n, h, f]), R = s(() => {
|
|
43
43
|
p(), m?.();
|
|
44
|
-
}, [p, m]), T = _(() =>
|
|
45
|
-
return /* @__PURE__ */
|
|
44
|
+
}, [p, m]), T = _(() => a ? o ? o(n) : !0 : !1, [a, o, n]);
|
|
45
|
+
return /* @__PURE__ */ c(
|
|
46
46
|
"div",
|
|
47
47
|
{
|
|
48
|
-
className: P("flex flex-col h-full",
|
|
49
|
-
"data-
|
|
48
|
+
className: P("flex flex-col h-full", C),
|
|
49
|
+
"data-component": "accordion-nested-list",
|
|
50
|
+
"data-has-changes": a ? "" : void 0,
|
|
50
51
|
children: [
|
|
51
52
|
/* @__PURE__ */ r("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ r(
|
|
52
53
|
q,
|
|
53
54
|
{
|
|
54
|
-
type:
|
|
55
|
+
type: t ? "multiple" : "single",
|
|
55
56
|
value: B,
|
|
56
57
|
onValueChange: I,
|
|
57
58
|
className: "space-y-4",
|
|
58
|
-
children:
|
|
59
|
+
children: l.map((e) => /* @__PURE__ */ c(z, { value: e.id, children: [
|
|
59
60
|
/* @__PURE__ */ r(F, { children: e.label }),
|
|
60
61
|
/* @__PURE__ */ r(G, { className: "min-h-0 h-full", children: /* @__PURE__ */ r("div", { className: "h-full min-h-0 pb-2", children: /* @__PURE__ */ r(
|
|
61
62
|
H,
|
|
62
63
|
{
|
|
63
|
-
items:
|
|
64
|
-
onChange: (
|
|
64
|
+
items: n[e.id] || [],
|
|
65
|
+
onChange: (i) => M(e.id, i),
|
|
65
66
|
enableApplyDiscard: !1,
|
|
66
67
|
enableSearch: S,
|
|
67
|
-
enableDragDrop:
|
|
68
|
-
enableSelectAll:
|
|
68
|
+
enableDragDrop: b,
|
|
69
|
+
enableSelectAll: y,
|
|
69
70
|
selectionMode: e.selectionMode ?? x,
|
|
70
71
|
searchPlaceholder: k,
|
|
71
72
|
className: "h-full"
|
|
@@ -74,15 +75,14 @@ const re = ({
|
|
|
74
75
|
] }, e.id))
|
|
75
76
|
}
|
|
76
77
|
) }),
|
|
77
|
-
|
|
78
|
+
N && /* @__PURE__ */ c("div", { className: "flex-shrink-0 flex justify-end gap-2 pt-4 border-t mt-4", children: [
|
|
78
79
|
/* @__PURE__ */ r(
|
|
79
80
|
A,
|
|
80
81
|
{
|
|
81
82
|
variant: "tertiary",
|
|
82
83
|
onClick: R,
|
|
83
|
-
disabled: !
|
|
84
|
-
|
|
85
|
-
children: C
|
|
84
|
+
disabled: !a,
|
|
85
|
+
children: v
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
88
|
/* @__PURE__ */ r(
|
|
@@ -91,8 +91,7 @@ const re = ({
|
|
|
91
91
|
variant: "default",
|
|
92
92
|
onClick: O,
|
|
93
93
|
disabled: !T,
|
|
94
|
-
|
|
95
|
-
children: N
|
|
94
|
+
children: g
|
|
96
95
|
}
|
|
97
96
|
)
|
|
98
97
|
] })
|
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
1
|
+
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import * as t from "@radix-ui/react-accordion";
|
|
4
4
|
import { ChevronRight as l } from "lucide-react";
|
|
5
|
-
import { cn as
|
|
6
|
-
const v =
|
|
7
|
-
|
|
5
|
+
import { cn as s } from "../../lib/utils.js";
|
|
6
|
+
const v = t.Root, f = n.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ a(
|
|
7
|
+
t.Item,
|
|
8
8
|
{
|
|
9
|
-
ref:
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
ref: o,
|
|
10
|
+
"data-item": e.value,
|
|
11
|
+
"data-disabled": e.disabled ? "" : void 0,
|
|
12
|
+
className: s("border-b rounded-lg bg-white overflow-hidden border-b-[#D9DDE7]", r),
|
|
13
|
+
...e
|
|
12
14
|
}
|
|
13
15
|
));
|
|
14
16
|
f.displayName = "AccordionItem";
|
|
15
|
-
const p =
|
|
16
|
-
|
|
17
|
+
const p = n.forwardRef(({ className: r, children: e, badge: o, rightActions: i, ...c }, m) => /* @__PURE__ */ a(t.Header, { className: "flex", children: /* @__PURE__ */ d(
|
|
18
|
+
t.Trigger,
|
|
17
19
|
{
|
|
18
20
|
ref: m,
|
|
19
|
-
className:
|
|
21
|
+
className: s(
|
|
20
22
|
"flex flex-1 items-center gap-3 px-4 py-2 text-sm font-semibold transition-all text-left [&[data-state=open]>div>svg]:-rotate-90",
|
|
21
23
|
r
|
|
22
24
|
),
|
|
23
25
|
...c,
|
|
24
26
|
children: [
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-center h-8 w-8 shrink-0 rounded-lg bg-secondary text-secondary-foreground transition-transform duration-200", children: /* @__PURE__ */ a(l, { className: "h-4 w-4 transition-transform duration-200" }) }),
|
|
28
|
+
/* @__PURE__ */ d("div", { className: "flex flex-1 items-center justify-between", children: [
|
|
29
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
|
|
30
|
+
e,
|
|
31
|
+
o
|
|
30
32
|
] }),
|
|
31
33
|
i
|
|
32
34
|
] })
|
|
33
35
|
]
|
|
34
36
|
}
|
|
35
37
|
) }));
|
|
36
|
-
p.displayName =
|
|
37
|
-
const x =
|
|
38
|
-
|
|
38
|
+
p.displayName = t.Trigger.displayName;
|
|
39
|
+
const x = n.forwardRef(({ className: r, children: e, ...o }, i) => /* @__PURE__ */ a(
|
|
40
|
+
t.Content,
|
|
39
41
|
{
|
|
40
42
|
ref: i,
|
|
41
43
|
className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
|
42
|
-
...
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
+
...o,
|
|
45
|
+
children: /* @__PURE__ */ a("div", { className: s("px-4 pb-4 pt-2", r), children: e })
|
|
44
46
|
}
|
|
45
47
|
));
|
|
46
|
-
x.displayName =
|
|
48
|
+
x.displayName = t.Content.displayName;
|
|
47
49
|
export {
|
|
48
50
|
v as Accordion,
|
|
49
51
|
x as AccordionContent,
|
|
@@ -1,50 +1,61 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
1
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import "lucide-react";
|
|
3
|
+
const u = (t, r) => {
|
|
4
|
+
if (t == null || t === "") return "";
|
|
5
5
|
try {
|
|
6
|
-
const
|
|
7
|
-
return isNaN(
|
|
6
|
+
const i = t instanceof Date ? t : new Date(String(t));
|
|
7
|
+
return isNaN(i.getTime()) ? String(t) : r === "time" ? i.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" }) : r === "datetime-local" ? i.toLocaleString(void 0, {
|
|
8
8
|
year: "numeric",
|
|
9
9
|
month: "short",
|
|
10
10
|
day: "numeric",
|
|
11
11
|
hour: "2-digit",
|
|
12
12
|
minute: "2-digit"
|
|
13
|
-
}) :
|
|
13
|
+
}) : i.toLocaleDateString(void 0, {
|
|
14
14
|
year: "numeric",
|
|
15
15
|
month: "short",
|
|
16
16
|
day: "numeric"
|
|
17
17
|
});
|
|
18
18
|
} catch {
|
|
19
|
-
return String(
|
|
19
|
+
return String(t);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, m = (t) => {
|
|
22
22
|
const {
|
|
23
|
-
valueFormatted:
|
|
24
|
-
value:
|
|
25
|
-
dateType:
|
|
26
|
-
placeholder:
|
|
23
|
+
valueFormatted: r,
|
|
24
|
+
value: i,
|
|
25
|
+
dateType: s = "date",
|
|
26
|
+
placeholder: h = "Select date...",
|
|
27
27
|
disabled: n,
|
|
28
|
-
colDef:
|
|
29
|
-
} =
|
|
30
|
-
return /* @__PURE__ */
|
|
28
|
+
colDef: l
|
|
29
|
+
} = t, c = !n && l?.editable === !0, a = r ?? u(i, s), d = !a;
|
|
30
|
+
return /* @__PURE__ */ e(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
33
|
className: `w-full h-full flex items-center ag-cell-inner-padding ${n ? "opacity-60 cursor-not-allowed" : c ? "in-ag-editable-cell-highlight" : ""}`,
|
|
34
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ o(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: "flex w-full items-center justify-between rounded-[8px] bg-white px-1.5 h-7 cursor-pointer",
|
|
38
38
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ e("span", { className: `truncate text-sm font-medium text-[#1f2b4d] ${d ? "text-[#dfe2e7]" : ""}`, children: d ? h : a }),
|
|
40
|
+
/* @__PURE__ */ e("span", { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground", children: /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
41
|
+
/* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
42
|
+
/* @__PURE__ */ e("path", { d: "M16 2v4" }),
|
|
43
|
+
/* @__PURE__ */ e("path", { d: "M8 2v4" }),
|
|
44
|
+
/* @__PURE__ */ e("path", { d: "M3 10h18" }),
|
|
45
|
+
/* @__PURE__ */ e("path", { d: "M8 14h.01" }),
|
|
46
|
+
/* @__PURE__ */ e("path", { d: "M12 14h.01" }),
|
|
47
|
+
/* @__PURE__ */ e("path", { d: "M16 14h.01" }),
|
|
48
|
+
/* @__PURE__ */ e("path", { d: "M8 18h.01" }),
|
|
49
|
+
/* @__PURE__ */ e("path", { d: "M12 18h.01" }),
|
|
50
|
+
/* @__PURE__ */ e("path", { d: "M16 18h.01" })
|
|
51
|
+
] }) })
|
|
41
52
|
]
|
|
42
53
|
}
|
|
43
54
|
)
|
|
44
55
|
}
|
|
45
56
|
);
|
|
46
57
|
};
|
|
47
|
-
|
|
58
|
+
m.displayName = "DateDisplayRenderer";
|
|
48
59
|
export {
|
|
49
|
-
|
|
60
|
+
m as DateDisplayRenderer
|
|
50
61
|
};
|
|
@@ -8,15 +8,13 @@ export interface DateCellEditorProps extends ICellEditorParams {
|
|
|
8
8
|
max?: string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* DateCellEditor - AG Grid popup cell editor
|
|
11
|
+
* DateCellEditor - AG Grid popup cell editor using the project's Calendar component.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Opens the Calendar directly on mount so the user sees the calendar popup
|
|
14
|
+
* immediately on click — no extra interaction needed.
|
|
15
15
|
*
|
|
16
16
|
* Returns an ISO string on commit, which AG Grid stores as the cell value.
|
|
17
17
|
*
|
|
18
|
-
* Only holds a single piece of state: the current date string.
|
|
19
|
-
*
|
|
20
18
|
* Usage in colDef:
|
|
21
19
|
* ```ts
|
|
22
20
|
* {
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as M, useState as b, useImperativeHandle as y, useEffect as N, useCallback as c } from "react";
|
|
3
|
+
import { Calendar as P } from "../../../calendar.js";
|
|
4
|
+
const d = (t) => {
|
|
5
|
+
if (!(t == null || t === ""))
|
|
6
|
+
try {
|
|
7
|
+
const n = t instanceof Date ? t : new Date(String(t));
|
|
8
|
+
return isNaN(n.getTime()) ? void 0 : n;
|
|
9
|
+
} catch {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
}, I = M((t, n) => {
|
|
12
13
|
const {
|
|
13
|
-
value:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
value: l,
|
|
15
|
+
min: u,
|
|
16
|
+
max: p,
|
|
17
|
+
node: i,
|
|
18
|
+
column: m,
|
|
19
|
+
stopEditing: f
|
|
20
|
+
} = t, g = d(l), [C, h] = b(g), [v, D] = b(g || /* @__PURE__ */ new Date());
|
|
21
|
+
y(n, () => ({
|
|
20
22
|
getValue() {
|
|
21
|
-
|
|
22
|
-
if (a === "time") return o;
|
|
23
|
-
try {
|
|
24
|
-
return new Date(o).toISOString();
|
|
25
|
-
} catch {
|
|
26
|
-
return o;
|
|
27
|
-
}
|
|
23
|
+
return l;
|
|
28
24
|
},
|
|
29
25
|
isCancelBeforeStart() {
|
|
30
26
|
return !1;
|
|
@@ -34,40 +30,46 @@ const w = (e, n) => {
|
|
|
34
30
|
},
|
|
35
31
|
isPopup() {
|
|
36
32
|
return !0;
|
|
37
|
-
},
|
|
38
|
-
afterGuiAttached() {
|
|
39
|
-
if (i.current) {
|
|
40
|
-
i.current.focus();
|
|
41
|
-
try {
|
|
42
|
-
i.current.showPicker?.();
|
|
43
|
-
} catch {
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
33
|
}
|
|
47
|
-
}))
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
})), N(() => {
|
|
35
|
+
const e = "ag-custom-component-popup", a = (o) => {
|
|
36
|
+
o instanceof HTMLElement && o.hasAttribute("data-radix-popper-content-wrapper") && o.classList.add(e);
|
|
37
|
+
}, s = new MutationObserver((o) => {
|
|
38
|
+
for (const L of o)
|
|
39
|
+
L.addedNodes.forEach(a);
|
|
40
|
+
});
|
|
41
|
+
return s.observe(document.body, { childList: !0, subtree: !0 }), document.querySelectorAll("[data-radix-popper-content-wrapper]").forEach((o) => {
|
|
42
|
+
o.classList.add(e);
|
|
43
|
+
}), () => s.disconnect();
|
|
44
|
+
}, []);
|
|
45
|
+
const r = c((e) => {
|
|
46
|
+
const a = m?.getColId();
|
|
47
|
+
if (a && i) {
|
|
48
|
+
const s = e ? `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}` : null;
|
|
49
|
+
i.setDataValue(a, s);
|
|
50
|
+
}
|
|
51
|
+
f();
|
|
52
|
+
}, [m, i, f]), w = c((e) => {
|
|
53
|
+
h(e), r(e);
|
|
54
|
+
}, [r]), E = c(() => {
|
|
55
|
+
h(void 0), r(void 0);
|
|
56
|
+
}, [r]), A = u ? d(u) : void 0, x = p ? d(p) : void 0;
|
|
57
|
+
return /* @__PURE__ */ S("div", { className: "ag-custom-component-popup bg-white border border-input rounded-md shadow-lg", children: /* @__PURE__ */ S(
|
|
58
|
+
P,
|
|
57
59
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
mode: "single",
|
|
61
|
+
selected: C,
|
|
62
|
+
onSelect: w,
|
|
63
|
+
month: v,
|
|
64
|
+
onMonthChange: D,
|
|
65
|
+
disabled: { before: A, after: x },
|
|
66
|
+
showFooter: !1,
|
|
67
|
+
onClear: E,
|
|
68
|
+
captionLayout: "dropdown"
|
|
67
69
|
}
|
|
68
70
|
) });
|
|
69
71
|
});
|
|
70
|
-
|
|
72
|
+
I.displayName = "DateCellEditor";
|
|
71
73
|
export {
|
|
72
|
-
|
|
74
|
+
I as DateCellEditor
|
|
73
75
|
};
|
|
@@ -30,6 +30,11 @@ export interface CellUpdatePayload {
|
|
|
30
30
|
newValue: unknown;
|
|
31
31
|
value: unknown;
|
|
32
32
|
field: string;
|
|
33
|
+
currentCellUpdate: {
|
|
34
|
+
valueKey: string;
|
|
35
|
+
field: string;
|
|
36
|
+
newValue: unknown;
|
|
37
|
+
};
|
|
33
38
|
}
|
|
34
39
|
export interface SplitCellEditorProps extends Omit<ICellEditorParams, 'context'> {
|
|
35
40
|
splits: SplitConfig[];
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const
|
|
4
|
-
const { splits:
|
|
5
|
-
|
|
6
|
-
field:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as U, useMemo as E, useState as I, useCallback as P } from "react";
|
|
3
|
+
const R = U((V) => {
|
|
4
|
+
const { splits: r, commonParams: f, data: s, node: o, api: p, column: m, context: i, value: a, colDef: d } = V, h = E(() => r?.map((e) => {
|
|
5
|
+
const l = e?.field?.split(".")?.pop() ?? "", n = a?.[l]?.value;
|
|
6
|
+
return { valueKey: l, field: e.field, newValue: n };
|
|
7
|
+
}) ?? [], [r, a]), [u, b] = I(h), x = P((e) => {
|
|
8
|
+
const l = u.find((t) => t.field === e);
|
|
9
|
+
if (!l)
|
|
10
|
+
return;
|
|
11
|
+
const n = {
|
|
12
|
+
api: p,
|
|
13
|
+
colDef: d,
|
|
14
|
+
column: m,
|
|
15
|
+
context: i,
|
|
16
|
+
data: s,
|
|
17
|
+
field: d.field,
|
|
18
|
+
node: o,
|
|
19
|
+
rowIndex: o?.rowIndex ?? null,
|
|
20
|
+
rowPinned: o?.rowPinned ?? void 0,
|
|
19
21
|
source: "edit",
|
|
20
22
|
type: "cellValueChanged",
|
|
21
|
-
currentCellUpdate:
|
|
22
|
-
newValue: { [
|
|
23
|
-
oldValue: { [
|
|
24
|
-
value: { [
|
|
23
|
+
currentCellUpdate: l,
|
|
24
|
+
newValue: { [l.valueKey]: { value: l.newValue } },
|
|
25
|
+
oldValue: { [l.valueKey]: { value: a?.[l.valueKey]?.value } },
|
|
26
|
+
value: { [l.valueKey]: { value: l.newValue } }
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
+
o.setDataValue(d.field, { ...a, [l.valueKey]: { value: l.newValue } }), i?.onCellUpdate?.(n);
|
|
29
|
+
}, [u, p, d, m, i, s, o, a]), N = (e) => {
|
|
28
30
|
if (typeof e == "string") {
|
|
29
|
-
const l =
|
|
30
|
-
return
|
|
31
|
+
const l = p?.getGridOption("components");
|
|
32
|
+
return i?.frameworkComponents?.[e] || l?.[e];
|
|
31
33
|
}
|
|
32
34
|
return e;
|
|
33
|
-
},
|
|
35
|
+
}, $ = (e, l) => {
|
|
34
36
|
if (!l) return "--";
|
|
35
37
|
let n = l;
|
|
36
38
|
switch (e?.decimals != null && !isNaN(Number(l)) && (n = Number(l).toFixed(e.decimals)), e.type) {
|
|
@@ -46,44 +48,40 @@ const K = x((y, S) => {
|
|
|
46
48
|
return n;
|
|
47
49
|
}
|
|
48
50
|
};
|
|
49
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ c(
|
|
50
52
|
"div",
|
|
51
53
|
{
|
|
52
|
-
style: { display: "grid", gridTemplateRows: `repeat(${
|
|
53
|
-
children:
|
|
54
|
-
const n = e?.field?.split(".")?.pop(), t = a?.[n]?.value;
|
|
55
|
-
|
|
56
|
-
valueKey: n,
|
|
57
|
-
field: e.field,
|
|
58
|
-
newValue: t
|
|
59
|
-
};
|
|
60
|
-
const b = e?.valueFormatter ? V(e.valueFormatter, t?.toString()) : t?.toString(), v = e.editable ? c.cellEditor : c.cellRenderer ? c.cellRenderer : void 0, w = v ? h(v) : void 0;
|
|
61
|
-
return /* @__PURE__ */ d(
|
|
54
|
+
style: { display: "grid", gridTemplateRows: `repeat(${r?.length}, 1fr)`, height: "100%", width: "100%" },
|
|
55
|
+
children: r?.map((e, l) => {
|
|
56
|
+
const n = e?.field?.split(".")?.pop(), t = a?.[n]?.value, v = s?.valueFormatter ?? e?.valueFormatter ?? null, S = v ? $(v, t?.toString()) : t?.toString(), w = e.editable ? f.cellEditor : f.cellRenderer ? f.cellRenderer : void 0, g = w ? N(w) : void 0;
|
|
57
|
+
return /* @__PURE__ */ c(
|
|
62
58
|
"div",
|
|
63
59
|
{
|
|
64
60
|
className: "flex items-center max-h-full overflow-hidden",
|
|
65
|
-
children:
|
|
66
|
-
|
|
61
|
+
children: g ? /* @__PURE__ */ c(
|
|
62
|
+
g,
|
|
67
63
|
{
|
|
68
|
-
context:
|
|
69
|
-
data:
|
|
64
|
+
context: i,
|
|
65
|
+
data: s,
|
|
70
66
|
value: t,
|
|
71
|
-
onValueChange: (
|
|
72
|
-
|
|
67
|
+
onValueChange: (y) => {
|
|
68
|
+
const C = u.find((K) => K.field === e.field);
|
|
69
|
+
C ? C.newValue = y : b([...u, {
|
|
73
70
|
valueKey: n,
|
|
74
71
|
field: e.field,
|
|
75
|
-
newValue:
|
|
76
|
-
};
|
|
72
|
+
newValue: y
|
|
73
|
+
}]);
|
|
77
74
|
},
|
|
78
|
-
valueFormatted:
|
|
75
|
+
valueFormatted: S,
|
|
79
76
|
colDef: e,
|
|
80
77
|
stopEditing: () => {
|
|
81
|
-
|
|
78
|
+
x(e.field);
|
|
82
79
|
},
|
|
80
|
+
node: o,
|
|
83
81
|
suppressAutoFocus: l !== 0,
|
|
84
|
-
className: l !==
|
|
82
|
+
className: l !== r.length - 1 ? "border-b border-gray-200" : ""
|
|
85
83
|
}
|
|
86
|
-
) : /* @__PURE__ */
|
|
84
|
+
) : /* @__PURE__ */ c(
|
|
87
85
|
"div",
|
|
88
86
|
{
|
|
89
87
|
className: "w-full h-full flex items-center ag-cell-inner-padding overflow-hidden text-ellipsis whitespace-nowrap",
|
|
@@ -97,7 +95,7 @@ const K = x((y, S) => {
|
|
|
97
95
|
}
|
|
98
96
|
);
|
|
99
97
|
});
|
|
100
|
-
|
|
98
|
+
R.displayName = "SplitCellEditor";
|
|
101
99
|
export {
|
|
102
|
-
|
|
100
|
+
R as SplitCellEditor
|
|
103
101
|
};
|