@bioturing/components 0.15.5 → 0.16.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/Badge/component.js +16 -11
- package/dist/components/Badge/component.js.map +1 -1
- package/dist/components/Breadcrumb/component.js +4 -3
- package/dist/components/Breadcrumb/component.js.map +1 -1
- package/dist/components/Button/component.js +30 -3
- package/dist/components/Button/component.js.map +1 -1
- package/dist/components/Button/style.css +1 -1
- package/dist/components/CodeBlock/component.js +7 -6
- package/dist/components/CodeBlock/component.js.map +1 -1
- package/dist/components/CodeBlock/style.css +1 -1
- package/dist/components/Collapse/component.js +11 -10
- package/dist/components/Collapse/component.js.map +1 -1
- package/dist/components/DSRoot/component.js +8 -7
- package/dist/components/DSRoot/component.js.map +1 -1
- package/dist/components/DSRoot/context.js +5 -4
- package/dist/components/DSRoot/context.js.map +1 -1
- package/dist/components/DropdownMenu/component.js +1 -0
- package/dist/components/DropdownMenu/component.js.map +1 -1
- package/dist/components/Field/component.js +13 -12
- package/dist/components/Field/component.js.map +1 -1
- package/dist/components/Form/component.js +4 -3
- package/dist/components/Form/component.js.map +1 -1
- package/dist/components/Form/item.js +1 -0
- package/dist/components/Form/item.js.map +1 -1
- package/dist/components/IconButton/component.js +1 -0
- package/dist/components/IconButton/component.js.map +1 -1
- package/dist/components/Modal/Modal.js +1 -0
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/ModalProvider.js +1 -0
- package/dist/components/Modal/ModalProvider.js.map +1 -1
- package/dist/components/Modal/index.js +11 -10
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Popover/component.js +6 -5
- package/dist/components/Popover/component.js.map +1 -1
- package/dist/components/PopupPanel/component.js +74 -68
- package/dist/components/PopupPanel/component.js.map +1 -1
- package/dist/components/ScrollArea/component.js +10 -9
- package/dist/components/ScrollArea/component.js.map +1 -1
- package/dist/components/Slider/component.js +9 -8
- package/dist/components/Slider/component.js.map +1 -1
- package/dist/components/Splitter/component.js +12 -11
- package/dist/components/Splitter/component.js.map +1 -1
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/StackChild.js +26 -23
- package/dist/components/Stack/StackChild.js.map +1 -1
- package/dist/components/Stack/style.css +1 -1
- package/dist/components/Table/component.js +54 -50
- package/dist/components/Table/component.js.map +1 -1
- package/dist/components/Table/style.css +1 -1
- package/dist/components/Tag/component.js +6 -5
- package/dist/components/Tag/component.js.map +1 -1
- package/dist/components/ThemeProvider/component.js +15 -14
- package/dist/components/ThemeProvider/component.js.map +1 -1
- package/dist/components/Toast/component.js +17 -16
- package/dist/components/Toast/component.js.map +1 -1
- package/dist/components/Toast/function.js +5 -4
- package/dist/components/Toast/function.js.map +1 -1
- package/dist/components/Tooltip/component.js +13 -12
- package/dist/components/Tooltip/component.js.map +1 -1
- package/dist/components/Tour/component.js +5 -4
- package/dist/components/Tour/component.js.map +1 -1
- package/dist/components/Transition/component.js +45 -32
- package/dist/components/Transition/component.js.map +1 -1
- package/dist/components/Tree/components.js +9 -8
- package/dist/components/Tree/components.js.map +1 -1
- package/dist/components/Tree/helpers.js +1 -0
- package/dist/components/Tree/helpers.js.map +1 -1
- package/dist/components/Tree/useTreeCommon.js +12 -11
- package/dist/components/Tree/useTreeCommon.js.map +1 -1
- package/dist/components/Truncate/component.js +1 -0
- package/dist/components/Truncate/component.js.map +1 -1
- package/dist/components/Upload/component.js +13 -11
- package/dist/components/Upload/component.js.map +1 -1
- package/dist/components/Upload/dragger.js +3 -2
- package/dist/components/Upload/dragger.js.map +1 -1
- package/dist/components/Upload/hooks.js +3 -2
- package/dist/components/Upload/hooks.js.map +1 -1
- package/dist/components/Upload/style.css +1 -0
- package/dist/components/VerticalCollapsiblePanel/component.js +35 -32
- package/dist/components/VerticalCollapsiblePanel/component.js.map +1 -1
- package/dist/components/hooks/antd.js +4 -3
- package/dist/components/hooks/antd.js.map +1 -1
- package/dist/components/hooks/base-ui.js +34 -28
- package/dist/components/hooks/base-ui.js.map +1 -1
- package/dist/components/hooks/useControlledState.js +17 -9
- package/dist/components/hooks/useControlledState.js.map +1 -1
- package/dist/components/utils/WithAntdTokens.js +14 -13
- package/dist/components/utils/WithAntdTokens.js.map +1 -1
- package/dist/components/utils/antdUtils.js +1 -0
- package/dist/components/utils/antdUtils.js.map +1 -1
- package/dist/index.d.ts +112 -59
- package/dist/index.js +78 -70
- package/dist/index.js.map +1 -1
- package/dist/metadata.js +81 -87
- package/dist/metadata.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
3
|
import { X as N, CircleNotch as g, CheckCircle as w, XCircle as T, WarningCircle as k, Info as b } from "@bioturing/assets";
|
|
3
4
|
import { Toast as s } from "@base-ui-components/react";
|
|
@@ -15,26 +16,26 @@ function u({
|
|
|
15
16
|
toast: e
|
|
16
17
|
}) {
|
|
17
18
|
var l;
|
|
18
|
-
const
|
|
19
|
+
const t = f(), n = {
|
|
19
20
|
info: /* @__PURE__ */ r(b, { weight: "fill" }),
|
|
20
21
|
warning: /* @__PURE__ */ r(k, { weight: "fill" }),
|
|
21
22
|
error: /* @__PURE__ */ r(T, { weight: "fill" }),
|
|
22
23
|
success: /* @__PURE__ */ r(w, { weight: "fill" }),
|
|
23
24
|
progress: /* @__PURE__ */ r(g, {})
|
|
24
|
-
}, i = ((l = e.data) == null ? void 0 : l.type) || "info",
|
|
25
|
+
}, i = ((l = e.data) == null ? void 0 : l.type) || "info", o = M(e == null ? void 0 : e.description);
|
|
25
26
|
v(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
27
|
+
o && a.update(e.id, { timeout: 0 });
|
|
28
|
+
}, [o, e.id]);
|
|
28
29
|
const h = x(
|
|
29
30
|
(C) => {
|
|
30
31
|
const { children: m, className: d, ...p } = C;
|
|
31
|
-
return
|
|
32
|
+
return o ? /* @__PURE__ */ c(
|
|
32
33
|
"div",
|
|
33
34
|
{
|
|
34
35
|
...p,
|
|
35
|
-
className:
|
|
36
|
+
className: t(
|
|
36
37
|
"toast-description",
|
|
37
|
-
|
|
38
|
+
o ? "toast-description-traceback" : "",
|
|
38
39
|
d
|
|
39
40
|
),
|
|
40
41
|
children: [
|
|
@@ -59,32 +60,32 @@ function u({
|
|
|
59
60
|
) })
|
|
60
61
|
]
|
|
61
62
|
}
|
|
62
|
-
) : /* @__PURE__ */ r("p", { ...p, className:
|
|
63
|
+
) : /* @__PURE__ */ r("p", { ...p, className: t("toast-description", d), children: m });
|
|
63
64
|
},
|
|
64
|
-
[
|
|
65
|
+
[o, t, e.id]
|
|
65
66
|
);
|
|
66
|
-
return /* @__PURE__ */ c(s.Root, { toast: e, className:
|
|
67
|
-
/* @__PURE__ */ r("span", { className:
|
|
68
|
-
/* @__PURE__ */ c("div", { className:
|
|
69
|
-
/* @__PURE__ */ r(s.Title, { className:
|
|
67
|
+
return /* @__PURE__ */ c(s.Root, { toast: e, className: t("toast"), children: [
|
|
68
|
+
/* @__PURE__ */ r("span", { className: t("toast-icon-wrap"), children: /* @__PURE__ */ r("span", { className: t("toast-icon", `toast-icon-${i}`), children: n[i] }) }),
|
|
69
|
+
/* @__PURE__ */ c("div", { className: t("toast-content"), children: [
|
|
70
|
+
/* @__PURE__ */ r(s.Title, { className: t("toast-title") }),
|
|
70
71
|
/* @__PURE__ */ r(s.Description, { render: h })
|
|
71
72
|
] }),
|
|
72
73
|
/* @__PURE__ */ r(
|
|
73
74
|
s.Close,
|
|
74
75
|
{
|
|
75
|
-
className:
|
|
76
|
+
className: t("toast-close"),
|
|
76
77
|
render: /* @__PURE__ */ r(j, { size: "small", children: /* @__PURE__ */ r(N, {}) })
|
|
77
78
|
}
|
|
78
79
|
)
|
|
79
80
|
] });
|
|
80
81
|
}
|
|
81
82
|
function y({ className: e }) {
|
|
82
|
-
const { toasts:
|
|
83
|
+
const { toasts: t } = s.useToastManager(), n = f(), i = V();
|
|
83
84
|
return /* @__PURE__ */ r(
|
|
84
85
|
s.Viewport,
|
|
85
86
|
{
|
|
86
87
|
className: E(n("toast-viewport"), i, e),
|
|
87
|
-
children:
|
|
88
|
+
children: t.map((o) => /* @__PURE__ */ r(u, { toast: o }, o.id))
|
|
88
89
|
}
|
|
89
90
|
);
|
|
90
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Toast/component.tsx"],"sourcesContent":["\"use client\";\nimport { useAntdCssVarClassname, useCls, clsx } from \"../utils\";\nimport {\n CheckCircle,\n CircleNotch,\n Info,\n WarningCircle,\n X,\n XCircle,\n} from \"@bioturing/assets\";\nimport { Toast as BaseToast } from \"@base-ui-components/react\";\nimport { IconButton } from \"../IconButton\";\nimport { ToastData } from \"./types\";\nimport { toastManager } from \"./function\";\nimport { isTracebackError, type GenericHTMLProps } from \"../utils\";\nimport { useCallback, useEffect } from \"react\";\nimport { Button } from \"../Button/component\";\nimport { Modal } from \"../Modal\";\nimport { CodeBlock } from \"../CodeBlock\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nfunction InnerToast({\n toast,\n}: {\n toast: BaseToast.Root.ToastObject<ToastData>;\n}) {\n const cls = useCls();\n const toastIconMap = {\n info: <Info weight=\"fill\" />,\n warning: <WarningCircle weight=\"fill\" />,\n error: <XCircle weight=\"fill\" />,\n success: <CheckCircle weight=\"fill\" />,\n progress: <CircleNotch />,\n };\n const type = toast.data?.type || \"info\";\n const isTraceback = isTracebackError(toast?.description);\n\n // Update manager timeout for traceback to disable auto-dismiss\n useEffect(() => {\n if (isTraceback) {\n toastManager.update(toast.id, { timeout: 0 });\n }\n }, [isTraceback, toast.id]);\n // console.log(toast);\n const renderDescription: BaseToast.Description.Props[\"render\"] = useCallback(\n (props: GenericHTMLProps) => {\n const { children, className, ...rest } = props;\n if (isTraceback) {\n return (\n <div\n {...rest}\n className={cls(\n \"toast-description\",\n isTraceback ? \"toast-description-traceback\" : \"\",\n className\n )}\n >\n <p>\n An unexpected error occurred.\n <br />\n Please contact us with error details for support.\n </p>\n <p>\n <Button\n size=\"small\"\n onClick={() => {\n Modal.open({\n title: \"Error details\",\n content: <CodeBlock>{children}</CodeBlock>,\n hideOkButton: true,\n });\n toastManager.close(toast.id);\n }}\n >\n View error details\n </Button>\n </p>\n </div>\n );\n }\n return (\n <p {...rest} className={cls(\"toast-description\", className)}>\n {children}\n </p>\n );\n },\n [isTraceback, cls, toast.id]\n );\n return (\n <BaseToast.Root toast={toast} className={cls(\"toast\")}>\n <span className={cls(\"toast-icon-wrap\")}>\n <span className={cls(\"toast-icon\", `toast-icon-${type}`)}>\n {toastIconMap[type]}\n </span>\n </span>\n <div className={cls(\"toast-content\")}>\n <BaseToast.Title className={cls(\"toast-title\")} />\n <BaseToast.Description render={renderDescription} />\n </div>\n <BaseToast.Close\n className={cls(\"toast-close\")}\n render={\n <IconButton size=\"small\">\n <X />\n </IconButton>\n }\n ></BaseToast.Close>\n </BaseToast.Root>\n );\n}\n\nfunction ToastList({ className }: { className?: string }) {\n const { toasts } = BaseToast.useToastManager();\n const cls = useCls();\n const cssVars = useAntdCssVarClassname();\n\n return (\n <BaseToast.Viewport\n className={clsx(cls(\"toast-viewport\"), cssVars, className)}\n >\n {toasts.map((toast) => (\n <InnerToast key={toast.id} toast={toast} />\n ))}\n </BaseToast.Viewport>\n );\n}\n\nfunction ToastProvider(props: BaseToast.Provider.Props) {\n return <BaseToast.Provider toastManager={toastManager} {...props} />;\n}\n\nexport const Toast = Object.assign(InnerToast, {\n List: ToastList,\n Provider: ToastProvider,\n});\n"],"names":["InnerToast","toast","cls","useCls","toastIconMap","jsx","Info","WarningCircle","XCircle","CheckCircle","CircleNotch","type","_a","isTraceback","isTracebackError","useEffect","toastManager","renderDescription","useCallback","props","children","className","rest","jsxs","Button","Modal","CodeBlock","BaseToast","IconButton","X","ToastList","toasts","cssVars","useAntdCssVarClassname","clsx","ToastProvider","Toast"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Toast/component.tsx"],"sourcesContent":["\"use client\";\nimport { useAntdCssVarClassname, useCls, clsx } from \"../utils\";\nimport {\n CheckCircle,\n CircleNotch,\n Info,\n WarningCircle,\n X,\n XCircle,\n} from \"@bioturing/assets\";\nimport { Toast as BaseToast } from \"@base-ui-components/react\";\nimport { IconButton } from \"../IconButton\";\nimport { ToastData } from \"./types\";\nimport { toastManager } from \"./function\";\nimport { isTracebackError, type GenericHTMLProps } from \"../utils\";\nimport { useCallback, useEffect } from \"react\";\nimport { Button } from \"../Button/component\";\nimport { Modal } from \"../Modal\";\nimport { CodeBlock } from \"../CodeBlock\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nfunction InnerToast({\n toast,\n}: {\n toast: BaseToast.Root.ToastObject<ToastData>;\n}) {\n const cls = useCls();\n const toastIconMap = {\n info: <Info weight=\"fill\" />,\n warning: <WarningCircle weight=\"fill\" />,\n error: <XCircle weight=\"fill\" />,\n success: <CheckCircle weight=\"fill\" />,\n progress: <CircleNotch />,\n };\n const type = toast.data?.type || \"info\";\n const isTraceback = isTracebackError(toast?.description);\n\n // Update manager timeout for traceback to disable auto-dismiss\n useEffect(() => {\n if (isTraceback) {\n toastManager.update(toast.id, { timeout: 0 });\n }\n }, [isTraceback, toast.id]);\n // console.log(toast);\n const renderDescription: BaseToast.Description.Props[\"render\"] = useCallback(\n (props: GenericHTMLProps) => {\n const { children, className, ...rest } = props;\n if (isTraceback) {\n return (\n <div\n {...rest}\n className={cls(\n \"toast-description\",\n isTraceback ? \"toast-description-traceback\" : \"\",\n className\n )}\n >\n <p>\n An unexpected error occurred.\n <br />\n Please contact us with error details for support.\n </p>\n <p>\n <Button\n size=\"small\"\n onClick={() => {\n Modal.open({\n title: \"Error details\",\n content: <CodeBlock>{children}</CodeBlock>,\n hideOkButton: true,\n });\n toastManager.close(toast.id);\n }}\n >\n View error details\n </Button>\n </p>\n </div>\n );\n }\n return (\n <p {...rest} className={cls(\"toast-description\", className)}>\n {children}\n </p>\n );\n },\n [isTraceback, cls, toast.id]\n );\n return (\n <BaseToast.Root toast={toast} className={cls(\"toast\")}>\n <span className={cls(\"toast-icon-wrap\")}>\n <span className={cls(\"toast-icon\", `toast-icon-${type}`)}>\n {toastIconMap[type]}\n </span>\n </span>\n <div className={cls(\"toast-content\")}>\n <BaseToast.Title className={cls(\"toast-title\")} />\n <BaseToast.Description render={renderDescription} />\n </div>\n <BaseToast.Close\n className={cls(\"toast-close\")}\n render={\n <IconButton size=\"small\">\n <X />\n </IconButton>\n }\n ></BaseToast.Close>\n </BaseToast.Root>\n );\n}\n\nfunction ToastList({ className }: { className?: string }) {\n const { toasts } = BaseToast.useToastManager();\n const cls = useCls();\n const cssVars = useAntdCssVarClassname();\n\n return (\n <BaseToast.Viewport\n className={clsx(cls(\"toast-viewport\"), cssVars, className)}\n >\n {toasts.map((toast) => (\n <InnerToast key={toast.id} toast={toast} />\n ))}\n </BaseToast.Viewport>\n );\n}\n\nfunction ToastProvider(props: BaseToast.Provider.Props) {\n return <BaseToast.Provider toastManager={toastManager} {...props} />;\n}\n\nexport const Toast = Object.assign(InnerToast, {\n List: ToastList,\n Provider: ToastProvider,\n});\n"],"names":["InnerToast","toast","cls","useCls","toastIconMap","jsx","Info","WarningCircle","XCircle","CheckCircle","CircleNotch","type","_a","isTraceback","isTracebackError","useEffect","toastManager","renderDescription","useCallback","props","children","className","rest","jsxs","Button","Modal","CodeBlock","BaseToast","IconButton","X","ToastList","toasts","cssVars","useAntdCssVarClassname","clsx","ToastProvider","Toast"],"mappings":";;;;;;;;;;;;;;AAuBA,SAASA,EAAW;AAAA,EAClB,OAAAC;AACF,GAEG;;AACD,QAAMC,IAAMC,EAAO,GACbC,IAAe;AAAA,IACnB,MAAM,gBAAAC,EAACC,GAAK,EAAA,QAAO,OAAO,CAAA;AAAA,IAC1B,SAAS,gBAAAD,EAACE,GAAc,EAAA,QAAO,OAAO,CAAA;AAAA,IACtC,OAAO,gBAAAF,EAACG,GAA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2BAAQQ,EAAU,UAAV,EAAmB,cAAAX,GAA6B,GAAGG,GAAO;AACpE;AAEa,MAAAiB,IAAQ,OAAO,OAAOpC,GAAY;AAAA,EAC7C,MAAM8B;AAAA,EACN,UAAUK;AACZ,CAAC;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { Toast as e } from "@base-ui-components/react";
|
|
3
|
+
const n = e.createToastManager();
|
|
3
4
|
function r(o) {
|
|
4
|
-
return (s, t) =>
|
|
5
|
+
return (s, t) => n.add({
|
|
5
6
|
description: s,
|
|
6
7
|
data: {
|
|
7
8
|
type: o
|
|
@@ -20,6 +21,6 @@ const i = Object.assign(r("info"), {
|
|
|
20
21
|
});
|
|
21
22
|
export {
|
|
22
23
|
i as toast,
|
|
23
|
-
|
|
24
|
+
n as toastManager
|
|
24
25
|
};
|
|
25
26
|
//# sourceMappingURL=function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.js","sources":["../../../src/components/Toast/function.ts"],"sourcesContent":["\"use client\";\nimport { Toast as BaseToast } from \"@base-ui-components/react\";\nimport type { ToastData } from \"./types\";\n\nexport const toastManager = BaseToast.createToastManager();\n\nfunction createToastTypeFunction(type: ToastData[\"type\"]) {\n return (\n message: string,\n options?: Omit<\n BaseToast.useToastManager.AddOptions<ToastData>,\n \"data\" | \"description\"\n >\n ) => {\n const toastId = toastManager.add<ToastData>({\n description: message,\n data: {\n type: type,\n },\n // progress and error toasts should not auto close\n ...(type === \"progress\" || type === \"error\" ? { timeout: 0 } : {}),\n ...options,\n });\n return toastId;\n };\n}\n\nexport const toast = Object.assign(createToastTypeFunction(\"info\"), {\n info: createToastTypeFunction(\"info\"),\n success: createToastTypeFunction(\"success\"),\n error: createToastTypeFunction(\"error\"),\n warning: createToastTypeFunction(\"warning\"),\n progress: createToastTypeFunction(\"progress\"),\n});\n"],"names":["toastManager","BaseToast","createToastTypeFunction","type","message","options","toast"],"mappings":"
|
|
1
|
+
{"version":3,"file":"function.js","sources":["../../../src/components/Toast/function.ts"],"sourcesContent":["\"use client\";\nimport { Toast as BaseToast } from \"@base-ui-components/react\";\nimport type { ToastData } from \"./types\";\n\nexport const toastManager = BaseToast.createToastManager();\n\nfunction createToastTypeFunction(type: ToastData[\"type\"]) {\n return (\n message: string,\n options?: Omit<\n BaseToast.useToastManager.AddOptions<ToastData>,\n \"data\" | \"description\"\n >\n ) => {\n const toastId = toastManager.add<ToastData>({\n description: message,\n data: {\n type: type,\n },\n // progress and error toasts should not auto close\n ...(type === \"progress\" || type === \"error\" ? { timeout: 0 } : {}),\n ...options,\n });\n return toastId;\n };\n}\n\nexport const toast = Object.assign(createToastTypeFunction(\"info\"), {\n info: createToastTypeFunction(\"info\"),\n success: createToastTypeFunction(\"success\"),\n error: createToastTypeFunction(\"error\"),\n warning: createToastTypeFunction(\"warning\"),\n progress: createToastTypeFunction(\"progress\"),\n});\n"],"names":["toastManager","BaseToast","createToastTypeFunction","type","message","options","toast"],"mappings":";;AAIa,MAAAA,IAAeC,EAAU,mBAAmB;AAEzD,SAASC,EAAwBC,GAAyB;AACjD,SAAA,CACLC,GACAC,MAKgBL,EAAa,IAAe;AAAA,IAC1C,aAAaI;AAAA,IACb,MAAM;AAAA,MACJ,MAAAD;AAAA,IACF;AAAA;AAAA,IAEA,GAAIA,MAAS,cAAcA,MAAS,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC;AAAA,IAChE,GAAGE;AAAA,EAAA,CACJ;AAGL;AAEO,MAAMC,IAAQ,OAAO,OAAOJ,EAAwB,MAAM,GAAG;AAAA,EAClE,MAAMA,EAAwB,MAAM;AAAA,EACpC,SAASA,EAAwB,SAAS;AAAA,EAC1C,OAAOA,EAAwB,OAAO;AAAA,EACtC,SAASA,EAAwB,SAAS;AAAA,EAC1C,UAAUA,EAAwB,UAAU;AAC9C,CAAC;"}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
import i from "
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import l from "antd/es/tooltip";
|
|
3
4
|
import './style.css';/* empty css */
|
|
4
|
-
import { useCls as
|
|
5
|
-
import { clsx as
|
|
6
|
-
const
|
|
5
|
+
import { useCls as p } from "../utils/antdUtils.js";
|
|
6
|
+
import { clsx as e } from "../utils/cn.js";
|
|
7
|
+
const x = ({
|
|
7
8
|
className: o,
|
|
8
9
|
style: t,
|
|
9
10
|
arrow: r = !1,
|
|
10
|
-
...
|
|
11
|
+
...s
|
|
11
12
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
13
|
+
const m = p();
|
|
14
|
+
return /* @__PURE__ */ i(
|
|
15
|
+
l,
|
|
15
16
|
{
|
|
16
|
-
className:
|
|
17
|
+
className: e(m("tooltip"), o),
|
|
17
18
|
arrow: r,
|
|
18
19
|
style: t,
|
|
19
|
-
...
|
|
20
|
+
...s
|
|
20
21
|
}
|
|
21
22
|
);
|
|
22
23
|
};
|
|
23
24
|
export {
|
|
24
|
-
|
|
25
|
+
x as Tooltip
|
|
25
26
|
};
|
|
26
27
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Tooltip/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTooltip,\n type TooltipProps as AntTooltipProps,\n} from \"antd/es/tooltip\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Define props interface extending Ant Design's TooltipProps\nexport type TooltipProps = AntTooltipProps & {\n /**\n * Arrow config for of the tooltip\n * @default false\n */\n arrow?: AntTooltipProps[\"arrow\"];\n};\n\n// Create Tooltip component\nexport const Tooltip = ({\n className,\n style,\n arrow = false,\n ...rest\n}: TooltipProps) => {\n const cls = useCls();\n return (\n <AntTooltip\n className={clsx(cls(\"tooltip\"), className)}\n arrow={arrow}\n style={style}\n {...rest}\n />\n );\n};\n"],"names":["Tooltip","className","style","arrow","rest","cls","useCls","jsx","AntTooltip","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Tooltip/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTooltip,\n type TooltipProps as AntTooltipProps,\n} from \"antd/es/tooltip\";\nimport { clsx, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Define props interface extending Ant Design's TooltipProps\nexport type TooltipProps = AntTooltipProps & {\n /**\n * Arrow config for of the tooltip\n * @default false\n */\n arrow?: AntTooltipProps[\"arrow\"];\n};\n\n// Create Tooltip component\nexport const Tooltip = ({\n className,\n style,\n arrow = false,\n ...rest\n}: TooltipProps) => {\n const cls = useCls();\n return (\n <AntTooltip\n className={clsx(cls(\"tooltip\"), className)}\n arrow={arrow}\n style={style}\n {...rest}\n />\n );\n};\n"],"names":["Tooltip","className","style","arrow","rest","cls","useCls","jsx","AntTooltip","clsx"],"mappings":";;;;;;AAoBO,MAAMA,IAAU,CAAC;AAAA,EACtB,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,GAAGC;AACL,MAAoB;AAClB,QAAMC,IAAMC,EAAO;AAEjB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAKJ,EAAI,SAAS,GAAGJ,CAAS;AAAA,MACzC,OAAAE;AAAA,MACA,OAAAD;AAAA,MACC,GAAGE;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as e } from "react/jsx-runtime";
|
|
2
3
|
import c from "antd/es/tour";
|
|
3
4
|
import './style.css';/* empty css */
|
|
4
5
|
import { useCls as d } from "../utils/antdUtils.js";
|
|
5
6
|
import { clsx as m } from "../utils/cn.js";
|
|
6
|
-
const N = ({ indicatorsRender:
|
|
7
|
+
const N = ({ indicatorsRender: s, ...n }) => {
|
|
7
8
|
const r = d();
|
|
8
9
|
return /* @__PURE__ */ o(
|
|
9
10
|
c,
|
|
10
11
|
{
|
|
11
|
-
indicatorsRender:
|
|
12
|
-
/* @__PURE__ */
|
|
12
|
+
indicatorsRender: s || ((t, i) => /* @__PURE__ */ e("div", { className: r("tour-indicator-wrapper"), children: [
|
|
13
|
+
/* @__PURE__ */ e("span", { className: r("tour-indicator-summary-text"), children: [
|
|
13
14
|
t + 1,
|
|
14
15
|
"/",
|
|
15
16
|
i
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Tour/component.tsx"],"sourcesContent":["\"use client\";\nimport { default as AntTour } from \"antd/es/tour\";\nimport {\n type TourProps as AntTourProps,\n type TourStepProps as AntTourStepProps,\n} from \"antd/es/tour/interface\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Define props interface extending Ant Design's TourProps\nexport interface TourProps extends AntTourProps {}\n\n// Define props interface for TourStepProps\nexport interface TourStepProps extends AntTourStepProps {}\n\n// Create Tour component\nconst Tour = ({ indicatorsRender, ...rest }: TourProps) => {\n const cls = useCls();\n const defaultIndicatorRender = (current: number, total: number) => (\n <div className={cls(\"tour-indicator-wrapper\")}>\n <span className={cls(\"tour-indicator-summary-text\")}>\n {current + 1}/{total}\n </span>\n <div>\n {Array.from({ length: total }).map<React.ReactNode>((_, index) => (\n <span\n key={index}\n className={clsx(\n index === current && cls(`tour-indicator-active`),\n cls(\"tour-indicator\")\n )}\n />\n ))}\n </div>\n </div>\n );\n return (\n <AntTour\n indicatorsRender={indicatorsRender || defaultIndicatorRender}\n {...rest}\n />\n );\n};\n\nexport { Tour };\n"],"names":["Tour","indicatorsRender","rest","cls","useCls","jsx","AntTour","current","total","jsxs","_","index","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Tour/component.tsx"],"sourcesContent":["\"use client\";\nimport { default as AntTour } from \"antd/es/tour\";\nimport {\n type TourProps as AntTourProps,\n type TourStepProps as AntTourStepProps,\n} from \"antd/es/tour/interface\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Define props interface extending Ant Design's TourProps\nexport interface TourProps extends AntTourProps {}\n\n// Define props interface for TourStepProps\nexport interface TourStepProps extends AntTourStepProps {}\n\n// Create Tour component\nconst Tour = ({ indicatorsRender, ...rest }: TourProps) => {\n const cls = useCls();\n const defaultIndicatorRender = (current: number, total: number) => (\n <div className={cls(\"tour-indicator-wrapper\")}>\n <span className={cls(\"tour-indicator-summary-text\")}>\n {current + 1}/{total}\n </span>\n <div>\n {Array.from({ length: total }).map<React.ReactNode>((_, index) => (\n <span\n key={index}\n className={clsx(\n index === current && cls(`tour-indicator-active`),\n cls(\"tour-indicator\")\n )}\n />\n ))}\n </div>\n </div>\n );\n return (\n <AntTour\n indicatorsRender={indicatorsRender || defaultIndicatorRender}\n {...rest}\n />\n );\n};\n\nexport { Tour };\n"],"names":["Tour","indicatorsRender","rest","cls","useCls","jsx","AntTour","current","total","jsxs","_","index","clsx"],"mappings":";;;;;;AAkBA,MAAMA,IAAO,CAAC,EAAE,kBAAAC,GAAkB,GAAGC,QAAsB;AACzD,QAAMC,IAAMC,EAAO;AAoBjB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,kBAAkBL,MApBS,CAACM,GAAiBC,wBAC9C,OAAI,EAAA,WAAWL,EAAI,wBAAwB,GAC1C,UAAA;AAAA,QAAA,gBAAAM,EAAC,QAAK,EAAA,WAAWN,EAAI,6BAA6B,GAC/C,UAAA;AAAA,UAAUI,IAAA;AAAA,UAAE;AAAA,UAAEC;AAAA,QAAA,GACjB;AAAA,QACC,gBAAAH,EAAA,OAAA,EACE,UAAM,MAAA,KAAK,EAAE,QAAQG,EAAO,CAAA,EAAE,IAAqB,CAACE,GAAGC,MACtD,gBAAAN;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAWO;AAAA,cACTD,MAAUJ,KAAWJ,EAAI,uBAAuB;AAAA,cAChDA,EAAI,gBAAgB;AAAA,YAAA;AAAA,UACtB;AAAA,UAJKQ;AAAA,QAAA,CAMR,EACH,CAAA;AAAA,MAAA,GACF;AAAA,MAKG,GAAGT;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|
|
@@ -1,44 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as v, useEffect as x, isValidElement as N } from "react";
|
|
4
|
+
import { useRender as j } from "@base-ui-components/react/use-render";
|
|
5
|
+
import { mergeProps as w } from "@base-ui-components/react/merge-props";
|
|
6
|
+
import { useTransitionStatus as A } from "@base-ui-components/react/utils";
|
|
7
|
+
import { useLatestRef as F, useAnimationsFinished as T } from "../hooks/base-ui.js";
|
|
8
|
+
import { clsx as k } from "../utils/cn.js";
|
|
9
|
+
function q(c) {
|
|
9
10
|
const {
|
|
10
|
-
children:
|
|
11
|
-
className:
|
|
12
|
-
starting:
|
|
13
|
-
ending:
|
|
11
|
+
children: n = /* @__PURE__ */ m("div", {}),
|
|
12
|
+
className: l,
|
|
13
|
+
starting: r,
|
|
14
|
+
ending: i,
|
|
14
15
|
show: t = !0,
|
|
15
|
-
keepMounted:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
keepMounted: o = !1,
|
|
17
|
+
onTransitionComplete: s,
|
|
18
|
+
listenToChildAnimations: p = !1,
|
|
19
|
+
asChild: g = !0,
|
|
20
|
+
...h
|
|
21
|
+
} = c, { mounted: y, setMounted: a, transitionStatus: e } = A(t), u = F(t), R = k(
|
|
22
|
+
l,
|
|
23
|
+
e === "starting" && typeof r == "string" && r,
|
|
24
|
+
e === "ending" && typeof i == "string" && i
|
|
25
|
+
), d = v(null), f = T(d, {
|
|
26
|
+
waitForNextTick: t,
|
|
27
|
+
subtree: p
|
|
28
|
+
}), b = j({
|
|
29
|
+
render: typeof n == "function" || g && N(n) ? n : /* @__PURE__ */ m("div", { children: n }),
|
|
30
|
+
props: w(h, {
|
|
31
|
+
ref: d,
|
|
32
|
+
className: R,
|
|
27
33
|
"data-starting": e === "starting" ? "true" : void 0,
|
|
28
34
|
"data-ending": e === "ending" ? "true" : void 0,
|
|
29
35
|
style: {
|
|
30
|
-
...e === "starting" && typeof
|
|
31
|
-
...e === "ending" && typeof
|
|
36
|
+
...e === "starting" && typeof r == "object" ? r : {},
|
|
37
|
+
...e === "ending" && typeof i == "object" ? i : {}
|
|
32
38
|
}
|
|
33
39
|
})
|
|
34
40
|
});
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
t ===
|
|
41
|
+
return x(() => {
|
|
42
|
+
f(() => {
|
|
43
|
+
t === u.current && (o || a(t), s == null || s(t));
|
|
38
44
|
});
|
|
39
|
-
}, [
|
|
40
|
-
|
|
45
|
+
}, [
|
|
46
|
+
t,
|
|
47
|
+
o,
|
|
48
|
+
f,
|
|
49
|
+
a,
|
|
50
|
+
u,
|
|
51
|
+
s
|
|
52
|
+
]), y ? b : null;
|
|
53
|
+
}
|
|
41
54
|
export {
|
|
42
|
-
|
|
55
|
+
q as Transition
|
|
43
56
|
};
|
|
44
57
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Transition/component.tsx"],"sourcesContent":["\"use client\";\nimport { CSSProperties, useEffect, useRef } from \"react\";\nimport { useRender } from \"@base-ui-components/react/use-render\";\nimport { mergeProps } from \"@base-ui-components/react/merge-props\";\nimport { useTransitionStatus } from \"@base-ui-components/react/utils\";\nimport { clsx } from \"../utils\";\nimport { useAnimationsFinished, useLatestRef } from \"../hooks\";\n\nexport
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Transition/component.tsx"],"sourcesContent":["\"use client\";\nimport { CSSProperties, isValidElement, useEffect, useRef } from \"react\";\nimport { useRender } from \"@base-ui-components/react/use-render\";\nimport { mergeProps } from \"@base-ui-components/react/merge-props\";\nimport { useTransitionStatus } from \"@base-ui-components/react/utils\";\nimport { clsx } from \"../utils\";\nimport { useAnimationsFinished, useLatestRef } from \"../hooks\";\n\nexport type TransitionProps = Omit<\n useRender.ComponentProps<\"div\">,\n \"render\" | \"children\"\n> & {\n /** Whether the component should be shown */\n show?: boolean;\n /** CSS classes to apply when the component is opened */\n starting?: string | CSSProperties;\n /** CSS classes to apply when the component is closed */\n ending?: string | CSSProperties;\n /** CSS classes to apply to the component */\n className?: string;\n /** Keep mounted */\n keepMounted?: boolean;\n /**\n * Callback function to be called when the transition ends\n */\n onTransitionComplete?: (show?: boolean) => void;\n /**\n * Whether to listen for animations in child elements\n */\n listenToChildAnimations?: boolean;\n /**\n * Whether to render the child as a child element\n * @default true\n */\n asChild?: boolean;\n children?: React.ReactNode | useRender.ComponentProps<\"div\">[\"render\"];\n};\n\nexport function Transition(props: TransitionProps) {\n const {\n children = <div />,\n className,\n starting,\n ending,\n show = true,\n keepMounted = false,\n onTransitionComplete,\n listenToChildAnimations = false,\n asChild = true,\n ...otherProps\n } = props;\n\n const { mounted, setMounted, transitionStatus } = useTransitionStatus(show);\n const showRef = useLatestRef(show);\n\n const combinedClassName = clsx(\n className,\n transitionStatus === \"starting\" && typeof starting == \"string\" && starting,\n transitionStatus === \"ending\" && typeof ending == \"string\" && ending\n );\n\n const ref = useRef<HTMLDivElement>(null);\n const runOnceAnimationsFinish = useAnimationsFinished(ref, {\n waitForNextTick: show,\n subtree: listenToChildAnimations,\n });\n\n const getRender = () => {\n if (typeof children === \"function\") {\n return children;\n }\n if (asChild && isValidElement(children)) {\n return children;\n }\n return <div>{children}</div>;\n };\n\n const rendered = useRender({\n render: getRender(),\n props: mergeProps<\"div\">(otherProps, {\n ref,\n className: combinedClassName,\n ...{\n \"data-starting\": transitionStatus === \"starting\" ? \"true\" : undefined,\n \"data-ending\": transitionStatus === \"ending\" ? \"true\" : undefined,\n },\n style: {\n ...(transitionStatus === \"starting\" && typeof starting === \"object\"\n ? starting\n : {}),\n ...(transitionStatus === \"ending\" && typeof ending === \"object\"\n ? ending\n : {}),\n },\n }),\n });\n\n useEffect(() => {\n runOnceAnimationsFinish(() => {\n if (show === showRef.current) {\n if (!keepMounted) setMounted(show);\n onTransitionComplete?.(show);\n }\n });\n }, [\n show,\n keepMounted,\n runOnceAnimationsFinish,\n setMounted,\n showRef,\n onTransitionComplete,\n ]);\n\n return mounted ? rendered : null;\n}\n"],"names":["Transition","props","children","className","starting","ending","show","keepMounted","onTransitionComplete","listenToChildAnimations","asChild","otherProps","mounted","setMounted","transitionStatus","useTransitionStatus","showRef","useLatestRef","combinedClassName","clsx","ref","useRef","runOnceAnimationsFinish","useAnimationsFinished","rendered","useRender","isValidElement","jsx","mergeProps","useEffect"],"mappings":";;;;;;;;AAsCO,SAASA,EAAWC,GAAwB;AAC3C,QAAA;AAAA,IACJ,UAAAC,sBAAY,OAAI,EAAA;AAAA,IAChB,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,aAAAC,IAAc;AAAA,IACd,sBAAAC;AAAA,IACA,yBAAAC,IAA0B;AAAA,IAC1B,SAAAC,IAAU;AAAA,IACV,GAAGC;AAAA,EAAA,IACDV,GAEE,EAAE,SAAAW,GAAS,YAAAC,GAAY,kBAAAC,EAAiB,IAAIC,EAAoBT,CAAI,GACpEU,IAAUC,EAAaX,CAAI,GAE3BY,IAAoBC;AAAA,IACxBhB;AAAA,IACAW,MAAqB,cAAc,OAAOV,KAAY,YAAYA;AAAA,IAClEU,MAAqB,YAAY,OAAOT,KAAU,YAAYA;AAAA,EAChE,GAEMe,IAAMC,EAAuB,IAAI,GACjCC,IAA0BC,EAAsBH,GAAK;AAAA,IACzD,iBAAiBd;AAAA,IACjB,SAASG;AAAA,EAAA,CACV,GAYKe,IAAWC,EAAU;AAAA,IACzB,QAVI,OAAOvB,KAAa,cAGpBQ,KAAWgB,EAAexB,CAAQ,IAC7BA,IAEF,gBAAAyB,EAAC,SAAK,UAAAzB,GAAS;AAAA,IAKtB,OAAO0B,EAAkBjB,GAAY;AAAA,MACnC,KAAAS;AAAA,MACA,WAAWF;AAAA,MAET,iBAAiBJ,MAAqB,aAAa,SAAS;AAAA,MAC5D,eAAeA,MAAqB,WAAW,SAAS;AAAA,MAE1D,OAAO;AAAA,QACL,GAAIA,MAAqB,cAAc,OAAOV,KAAa,WACvDA,IACA,CAAC;AAAA,QACL,GAAIU,MAAqB,YAAY,OAAOT,KAAW,WACnDA,IACA,CAAA;AAAA,MAAC;AAAA,IAER,CAAA;AAAA,EAAA,CACF;AAED,SAAAwB,EAAU,MAAM;AACd,IAAAP,EAAwB,MAAM;AACxB,MAAAhB,MAASU,EAAQ,YACdT,KAAaM,EAAWP,CAAI,GACjCE,KAAA,QAAAA,EAAuBF;AAAA,IACzB,CACD;AAAA,EAAA,GACA;AAAA,IACDA;AAAA,IACAC;AAAA,IACAe;AAAA,IACAT;AAAA,IACAG;AAAA,IACAR;AAAA,EAAA,CACD,GAEMI,IAAUY,IAAW;AAC9B;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as T } from "react/jsx-runtime";
|
|
2
3
|
import p from "antd/es/tree";
|
|
3
4
|
import { forwardRef as l } from "react";
|
|
@@ -9,8 +10,8 @@ const y = (e, r) => {
|
|
|
9
10
|
cls: c,
|
|
10
11
|
customSwitcherIcon: n,
|
|
11
12
|
processedTreeData: t,
|
|
12
|
-
currentUniqueExpandedKeys:
|
|
13
|
-
currentUniqueCheckedKeys:
|
|
13
|
+
currentUniqueExpandedKeys: s,
|
|
14
|
+
currentUniqueCheckedKeys: o,
|
|
14
15
|
handleAntTreeExpand: a,
|
|
15
16
|
handleAntTreeCheck: d,
|
|
16
17
|
restProps: h,
|
|
@@ -24,9 +25,9 @@ const y = (e, r) => {
|
|
|
24
25
|
className: k(c("tree"), i),
|
|
25
26
|
switcherIcon: m || n,
|
|
26
27
|
treeData: t,
|
|
27
|
-
expandedKeys:
|
|
28
|
+
expandedKeys: s,
|
|
28
29
|
onExpand: a,
|
|
29
|
-
checkedKeys: { checked:
|
|
30
|
+
checkedKeys: { checked: o, halfChecked: [] },
|
|
30
31
|
onCheck: d,
|
|
31
32
|
...h
|
|
32
33
|
}
|
|
@@ -36,8 +37,8 @@ const y = (e, r) => {
|
|
|
36
37
|
cls: c,
|
|
37
38
|
customSwitcherIcon: n,
|
|
38
39
|
processedTreeData: t,
|
|
39
|
-
currentUniqueExpandedKeys:
|
|
40
|
-
currentUniqueCheckedKeys:
|
|
40
|
+
currentUniqueExpandedKeys: s,
|
|
41
|
+
currentUniqueCheckedKeys: o,
|
|
41
42
|
handleAntTreeExpand: a,
|
|
42
43
|
handleAntTreeCheck: d,
|
|
43
44
|
restProps: h,
|
|
@@ -51,9 +52,9 @@ const y = (e, r) => {
|
|
|
51
52
|
className: k(c("directory-tree"), i),
|
|
52
53
|
switcherIcon: m || n,
|
|
53
54
|
treeData: t,
|
|
54
|
-
expandedKeys:
|
|
55
|
+
expandedKeys: s,
|
|
55
56
|
onExpand: a,
|
|
56
|
-
checkedKeys: { checked:
|
|
57
|
+
checkedKeys: { checked: o, halfChecked: [] },
|
|
57
58
|
onCheck: d,
|
|
58
59
|
...h
|
|
59
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sources":["../../../src/components/Tree/components.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTree,\n type DataNode as AntTreeDataNode,\n} from \"antd/es/tree\";\n\nimport { forwardRef } from \"react\";\nimport { clsx } from \"../utils\";\nimport type { TreeDataNode, TreeProps, DirectoryTreeProps } from \"./types\";\nimport { useTreeCommon } from \"./useTreeCommon\";\n\nimport \"./style.css\";\n\n// Create inner function for main Tree with forwarded ref\n// Ensure generic constraint matches TreeProps if it uses AntTreeDataNode\nconst MainTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: TreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props);\n\n return (\n <AntTree\n ref={ref}\n className={clsx(cls(\"tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree\n treeData={processedTreeData}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Create inner function for DirectoryTree with forwarded ref\nconst DirectoryTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: DirectoryTreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props as any);\n\n return (\n <AntTree.DirectoryTree\n ref={ref}\n className={clsx(cls(\"directory-tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree.DirectoryTree\n treeData={processedTreeData as T[]}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Use forwardRef with type assertion for main Tree\n// Ensure the generic constraint here matches TreeProps\nconst MainTree = forwardRef(MainTreeInner) as <\n T extends AntTreeDataNode = TreeDataNode // Use AntTreeDataNode if TreeProps uses it\n>(\n props: TreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>;\n }\n) => ReturnType<typeof MainTreeInner<T>>;\n\n// Use forwardRef with type assertion for DirectoryTree\nconst DirectoryTree = forwardRef(DirectoryTreeInner) as <\n T extends AntTreeDataNode = AntTreeDataNode\n>(\n props: DirectoryTreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>; // Check ref type consistency\n }\n) => ReturnType<typeof DirectoryTreeInner<T>>;\n\n// Create the final component with DirectoryTree property\nexport const Tree = Object.assign(MainTree, {\n DirectoryTree,\n TreeNode: AntTree.TreeNode,\n});\n"],"names":["MainTreeInner","props","ref","cls","customSwitcherIcon","processedTreeData","currentUniqueExpandedKeys","currentUniqueCheckedKeys","handleAntTreeExpand","handleAntTreeCheck","restProps","className","switcherIcon","useTreeCommon","jsx","AntTree","clsx","DirectoryTreeInner","MainTree","forwardRef","DirectoryTree","Tree"],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sources":["../../../src/components/Tree/components.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTree,\n type DataNode as AntTreeDataNode,\n} from \"antd/es/tree\";\n\nimport { forwardRef } from \"react\";\nimport { clsx } from \"../utils\";\nimport type { TreeDataNode, TreeProps, DirectoryTreeProps } from \"./types\";\nimport { useTreeCommon } from \"./useTreeCommon\";\n\nimport \"./style.css\";\n\n// Create inner function for main Tree with forwarded ref\n// Ensure generic constraint matches TreeProps if it uses AntTreeDataNode\nconst MainTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: TreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props);\n\n return (\n <AntTree\n ref={ref}\n className={clsx(cls(\"tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree\n treeData={processedTreeData}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Create inner function for DirectoryTree with forwarded ref\nconst DirectoryTreeInner = <T extends AntTreeDataNode = TreeDataNode>(\n props: DirectoryTreeProps<T>,\n ref: React.Ref<React.ComponentRef<typeof AntTree<T>>>\n) => {\n const {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n } = useTreeCommon(props as any);\n\n return (\n <AntTree.DirectoryTree\n ref={ref}\n className={clsx(cls(\"directory-tree\"), className)}\n switcherIcon={switcherIcon || customSwitcherIcon}\n // Pass processed props to AntTree.DirectoryTree\n treeData={processedTreeData as T[]}\n expandedKeys={currentUniqueExpandedKeys}\n onExpand={handleAntTreeExpand}\n // Pass checked keys in the object format\n checkedKeys={{ checked: currentUniqueCheckedKeys, halfChecked: [] }}\n onCheck={handleAntTreeCheck}\n {...restProps} // Pass other props like checkable, showLine, etc.\n />\n );\n};\n\n// Use forwardRef with type assertion for main Tree\n// Ensure the generic constraint here matches TreeProps\nconst MainTree = forwardRef(MainTreeInner) as <\n T extends AntTreeDataNode = TreeDataNode // Use AntTreeDataNode if TreeProps uses it\n>(\n props: TreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>;\n }\n) => ReturnType<typeof MainTreeInner<T>>;\n\n// Use forwardRef with type assertion for DirectoryTree\nconst DirectoryTree = forwardRef(DirectoryTreeInner) as <\n T extends AntTreeDataNode = AntTreeDataNode\n>(\n props: DirectoryTreeProps<T> & {\n ref?: React.ForwardedRef<React.ComponentRef<typeof AntTree<T>>>; // Check ref type consistency\n }\n) => ReturnType<typeof DirectoryTreeInner<T>>;\n\n// Create the final component with DirectoryTree property\nexport const Tree = Object.assign(MainTree, {\n DirectoryTree,\n TreeNode: AntTree.TreeNode,\n});\n"],"names":["MainTreeInner","props","ref","cls","customSwitcherIcon","processedTreeData","currentUniqueExpandedKeys","currentUniqueCheckedKeys","handleAntTreeExpand","handleAntTreeCheck","restProps","className","switcherIcon","useTreeCommon","jsx","AntTree","clsx","DirectoryTreeInner","MainTree","forwardRef","DirectoryTree","Tree"],"mappings":";;;;;;;AAeA,MAAMA,IAAgB,CACpBC,GACAC,MACG;AACG,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEC,EAAcZ,CAAK;AAGrB,SAAA,gBAAAa;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAb;AAAA,MACA,WAAWc,EAAKb,EAAI,MAAM,GAAGQ,CAAS;AAAA,MACtC,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAG;AAAA,MAClE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMO,IAAqB,CACzBhB,GACAC,MACG;AACG,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEC,EAAcZ,CAAY;AAG5B,SAAA,gBAAAa;AAAA,IAACC,EAAQ;AAAA,IAAR;AAAA,MACC,KAAAb;AAAA,MACA,WAAWc,EAAKb,EAAI,gBAAgB,GAAGQ,CAAS;AAAA,MAChD,cAAcC,KAAgBR;AAAA,MAE9B,UAAUC;AAAA,MACV,cAAcC;AAAA,MACd,UAAUE;AAAA,MAEV,aAAa,EAAE,SAASD,GAA0B,aAAa,CAAA,EAAG;AAAA,MAClE,SAASE;AAAA,MACR,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAIMQ,IAAWC,EAAWnB,CAAa,GASnCoB,IAAgBD,EAAWF,CAAkB,GAStCI,IAAO,OAAO,OAAOH,GAAU;AAAA,EAC1C,eAAAE;AAAA,EACA,UAAUL,EAAQ;AACpB,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../src/components/Tree/helpers.tsx"],"sourcesContent":["\"use client\";\nimport React, { type Key } from \"react\";\nimport { type DataNode as AntTreeDataNode } from \"antd/es/tree\";\nimport { File, Folder, FolderOpen } from \"@bioturing/assets\";\n\n// Function to recursively find unique keys corresponding to original keys\nexport const getUniqueKeysFromOriginals = (\n nodes: AntTreeDataNode[] | undefined,\n originalKeysToFind: Set<Key>,\n map: Map<Key, Key>\n): Key[] => {\n if (!nodes) return [];\n let keys: Key[] = [];\n nodes.forEach((node) => {\n const originalKey = map.get(node.key);\n if (originalKey !== undefined && originalKeysToFind.has(originalKey)) {\n keys.push(node.key); // Add the unique key\n }\n if (node.children) {\n keys = keys.concat(\n getUniqueKeysFromOriginals(node.children, originalKeysToFind, map)\n );\n }\n });\n return keys;\n};\n\n// Helper function to generate unique keys and apply icons\nexport const processTreeData = <T extends AntTreeDataNode = AntTreeDataNode>(\n nodes: T[] | undefined,\n expandedOriginalKeys: Set<Key>, // Use Set for faster lookups\n parentKeyPrefix: string = \"\",\n keyMap: Map<Key, Key> // Map uniqueKey -> originalKey\n): T[] | undefined => {\n if (!nodes) return undefined;\n\n return nodes.map((node) => {\n const originalKey = node.key;\n // Ensure nodes have a valid key for unique key generation\n if (originalKey === null || originalKey === undefined) {\n console.warn(\n \"Tree node is missing a key. Skipping unique key generation for this node and its children.\",\n node\n );\n // Return node as is, or handle based on requirements\n return {\n ...node,\n // Optionally process children even if parent key is missing\n // children: processTreeData(node.children as T[] | undefined, expandedOriginalKeys, '', keyMap)\n };\n }\n\n const separator = \"/\"; // Use / as the separator\n const originalKeyString = String(originalKey);\n\n // Warn if the original key contains the separator\n if (originalKeyString.includes(separator)) {\n console.warn(\n `Tree node original key \"${originalKeyString}\" contains the separator character \"${separator}\". This might lead to unexpected behavior if keys are not truly unique.`,\n node\n );\n }\n\n const uniqueKey = parentKeyPrefix\n ? `${parentKeyPrefix}${separator}${originalKeyString}` // Use separator\n : originalKeyString;\n keyMap.set(uniqueKey, originalKey); // Store mapping uniqueKey -> originalKey\n\n const isExpanded = expandedOriginalKeys.has(originalKey);\n // Apply default icons based on expansion state and type (leaf/directory)\n const icon =\n node.icon ||\n (node.isLeaf ? <File /> : isExpanded ? <FolderOpen /> : <Folder />);\n\n // Recursively process children\n const processedChildren = processTreeData(\n node.children as T[] | undefined, // Cast children to T[]\n expandedOriginalKeys,\n uniqueKey, // Pass the generated unique key as the prefix for children\n keyMap\n );\n\n return {\n ...node,\n key: uniqueKey, // Override key with the unique one\n icon: icon,\n children: processedChildren,\n };\n });\n};\n"],"names":["getUniqueKeysFromOriginals","nodes","originalKeysToFind","map","keys","node","originalKey","processTreeData","expandedOriginalKeys","parentKeyPrefix","keyMap","separator","originalKeyString","uniqueKey","isExpanded","icon","jsx","File","FolderOpen","Folder","processedChildren"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/components/Tree/helpers.tsx"],"sourcesContent":["\"use client\";\nimport React, { type Key } from \"react\";\nimport { type DataNode as AntTreeDataNode } from \"antd/es/tree\";\nimport { File, Folder, FolderOpen } from \"@bioturing/assets\";\n\n// Function to recursively find unique keys corresponding to original keys\nexport const getUniqueKeysFromOriginals = (\n nodes: AntTreeDataNode[] | undefined,\n originalKeysToFind: Set<Key>,\n map: Map<Key, Key>\n): Key[] => {\n if (!nodes) return [];\n let keys: Key[] = [];\n nodes.forEach((node) => {\n const originalKey = map.get(node.key);\n if (originalKey !== undefined && originalKeysToFind.has(originalKey)) {\n keys.push(node.key); // Add the unique key\n }\n if (node.children) {\n keys = keys.concat(\n getUniqueKeysFromOriginals(node.children, originalKeysToFind, map)\n );\n }\n });\n return keys;\n};\n\n// Helper function to generate unique keys and apply icons\nexport const processTreeData = <T extends AntTreeDataNode = AntTreeDataNode>(\n nodes: T[] | undefined,\n expandedOriginalKeys: Set<Key>, // Use Set for faster lookups\n parentKeyPrefix: string = \"\",\n keyMap: Map<Key, Key> // Map uniqueKey -> originalKey\n): T[] | undefined => {\n if (!nodes) return undefined;\n\n return nodes.map((node) => {\n const originalKey = node.key;\n // Ensure nodes have a valid key for unique key generation\n if (originalKey === null || originalKey === undefined) {\n console.warn(\n \"Tree node is missing a key. Skipping unique key generation for this node and its children.\",\n node\n );\n // Return node as is, or handle based on requirements\n return {\n ...node,\n // Optionally process children even if parent key is missing\n // children: processTreeData(node.children as T[] | undefined, expandedOriginalKeys, '', keyMap)\n };\n }\n\n const separator = \"/\"; // Use / as the separator\n const originalKeyString = String(originalKey);\n\n // Warn if the original key contains the separator\n if (originalKeyString.includes(separator)) {\n console.warn(\n `Tree node original key \"${originalKeyString}\" contains the separator character \"${separator}\". This might lead to unexpected behavior if keys are not truly unique.`,\n node\n );\n }\n\n const uniqueKey = parentKeyPrefix\n ? `${parentKeyPrefix}${separator}${originalKeyString}` // Use separator\n : originalKeyString;\n keyMap.set(uniqueKey, originalKey); // Store mapping uniqueKey -> originalKey\n\n const isExpanded = expandedOriginalKeys.has(originalKey);\n // Apply default icons based on expansion state and type (leaf/directory)\n const icon =\n node.icon ||\n (node.isLeaf ? <File /> : isExpanded ? <FolderOpen /> : <Folder />);\n\n // Recursively process children\n const processedChildren = processTreeData(\n node.children as T[] | undefined, // Cast children to T[]\n expandedOriginalKeys,\n uniqueKey, // Pass the generated unique key as the prefix for children\n keyMap\n );\n\n return {\n ...node,\n key: uniqueKey, // Override key with the unique one\n icon: icon,\n children: processedChildren,\n };\n });\n};\n"],"names":["getUniqueKeysFromOriginals","nodes","originalKeysToFind","map","keys","node","originalKey","processTreeData","expandedOriginalKeys","parentKeyPrefix","keyMap","separator","originalKeyString","uniqueKey","isExpanded","icon","jsx","File","FolderOpen","Folder","processedChildren"],"mappings":";;;AAMO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,MACU;AACN,MAAA,CAACF,EAAO,QAAO,CAAC;AACpB,MAAIG,IAAc,CAAC;AACb,SAAAH,EAAA,QAAQ,CAACI,MAAS;AACtB,UAAMC,IAAcH,EAAI,IAAIE,EAAK,GAAG;AACpC,IAAIC,MAAgB,UAAaJ,EAAmB,IAAII,CAAW,KAC5DF,EAAA,KAAKC,EAAK,GAAG,GAEhBA,EAAK,aACPD,IAAOA,EAAK;AAAA,MACVJ,EAA2BK,EAAK,UAAUH,GAAoBC,CAAG;AAAA,IACnE;AAAA,EACF,CACD,GACMC;AACT,GAGaG,IAAkB,CAC7BN,GACAO,GACAC,IAA0B,IAC1BC,MACoB;AAChB,MAACT;AAEE,WAAAA,EAAM,IAAI,CAACI,MAAS;AACzB,YAAMC,IAAcD,EAAK;AAErB,UAAAC,KAAgB;AACV,uBAAA;AAAA,UACN;AAAA,UACAD;AAAA,QACF,GAEO;AAAA,UACL,GAAGA;AAAA;AAAA;AAAA,QAGL;AAGF,YAAMM,IAAY,KACZC,IAAoB,OAAON,CAAW;AAGxC,MAAAM,EAAkB,SAASD,CAAS,KAC9B,QAAA;AAAA,QACN,2BAA2BC,CAAiB,uCAAuCD,CAAS;AAAA,QAC5FN;AAAA,MACF;AAGI,YAAAQ,IAAYJ,IACd,GAAGA,CAAe,GAAGE,CAAS,GAAGC,CAAiB,KAClDA;AACG,MAAAF,EAAA,IAAIG,GAAWP,CAAW;AAE3B,YAAAQ,IAAaN,EAAqB,IAAIF,CAAW,GAEjDS,IACJV,EAAK,SACJA,EAAK,SAAS,gBAAAW,EAACC,GAAK,CAAA,CAAA,IAAKH,IAAa,gBAAAE,EAACE,GAAW,CAAA,CAAA,sBAAMC,GAAO,CAAA,CAAA,IAG5DC,IAAoBb;AAAA,QACxBF,EAAK;AAAA;AAAA,QACLG;AAAA,QACAK;AAAA;AAAA,QACAH;AAAA,MACF;AAEO,aAAA;AAAA,QACL,GAAGL;AAAA,QACH,KAAKQ;AAAA;AAAA,QACL,MAAAE;AAAA,QACA,UAAUK;AAAA,MACZ;AAAA,IAAA,CACD;AACH;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as v } from "react/jsx-runtime";
|
|
2
3
|
import { useMemo as I } from "react";
|
|
3
4
|
import { CaretRight as M } from "@bioturing/assets";
|
|
@@ -20,28 +21,28 @@ function z(h) {
|
|
|
20
21
|
...w
|
|
21
22
|
} = h, A = I(() => {
|
|
22
23
|
if (d) {
|
|
23
|
-
const n = [],
|
|
24
|
+
const n = [], a = (c = []) => {
|
|
24
25
|
c.forEach((t) => {
|
|
25
|
-
n.push(t.key), Array.isArray(t.children) &&
|
|
26
|
+
n.push(t.key), Array.isArray(t.children) && a(t.children);
|
|
26
27
|
});
|
|
27
28
|
};
|
|
28
|
-
return
|
|
29
|
+
return a(o), n;
|
|
29
30
|
}
|
|
30
31
|
if (i && (r != null && r.length)) {
|
|
31
|
-
const n = /* @__PURE__ */ new Map(),
|
|
32
|
+
const n = /* @__PURE__ */ new Map(), a = (t, s) => {
|
|
32
33
|
t.forEach((e) => {
|
|
33
|
-
|
|
34
|
+
s && n.set(e.key, s.key);
|
|
34
35
|
const p = Array.isArray(e.children) ? e.children : [];
|
|
35
|
-
p.length &&
|
|
36
|
+
p.length && a(p, e);
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
|
-
|
|
39
|
+
a(o);
|
|
39
40
|
const c = new Set(r);
|
|
40
41
|
return r.forEach((t) => {
|
|
41
|
-
let
|
|
42
|
-
for (; n.has(
|
|
43
|
-
const e = n.get(
|
|
44
|
-
c.has(e) || c.add(e),
|
|
42
|
+
let s = t;
|
|
43
|
+
for (; n.has(s); ) {
|
|
44
|
+
const e = n.get(s);
|
|
45
|
+
c.has(e) || c.add(e), s = e;
|
|
45
46
|
}
|
|
46
47
|
}), Array.from(c);
|
|
47
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTreeCommon.js","sources":["../../../src/components/Tree/useTreeCommon.tsx"],"sourcesContent":["\"use client\";\nimport { type DataNode as AntTreeDataNode } from \"antd/es/tree\";\n\nimport { useMemo, type Key } from \"react\";\nimport { useCls } from \"../utils\";\nimport { CaretRight } from \"@bioturing/assets\";\nimport type { TreeDataNode, TreeProps, DirectoryTreeProps } from \"./types\";\nimport { useUniqueKeysTree } from \"./useUniqueKeysTree\";\n\nexport function useTreeCommon<T extends AntTreeDataNode>(\n props: TreeProps<T> | DirectoryTreeProps<T>\n) {\n const {\n treeData: originTreeData = [],\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys = [],\n defaultExpandAll = false,\n defaultExpandParent = true,\n onExpand: propOnExpand,\n checkedKeys,\n defaultCheckedKeys,\n onCheck,\n allowDuplicatedKeys,\n className,\n switcherIcon,\n ...restProps\n } = props;\n\n // compute resolved defaultExpandedKeys\n const resolvedDefaultExpandedKeys = useMemo<Key[]>(() => {\n if (defaultExpandAll) {\n const keys: Key[] = [];\n const traverse = (nodes: TreeDataNode[] = []) => {\n nodes.forEach((node) => {\n keys.push(node.key);\n if (Array.isArray(node.children))\n traverse(node.children as TreeDataNode[]);\n });\n };\n traverse(originTreeData as TreeDataNode[]);\n return keys;\n }\n if (defaultExpandParent && propDefaultExpandedKeys?.length) {\n // build parent map\n const parentMap = new Map<Key, Key>();\n const traverse = (nodes: TreeDataNode[], parent?: TreeDataNode) => {\n nodes.forEach((node) => {\n if (parent) parentMap.set(node.key, parent.key);\n const children = Array.isArray(node.children)\n ? (node.children as TreeDataNode[])\n : [];\n if (children.length) traverse(children, node);\n });\n };\n traverse(originTreeData as TreeDataNode[]);\n // collect all expansions: original keys + their ancestors\n const expanded = new Set<Key>(propDefaultExpandedKeys);\n propDefaultExpandedKeys.forEach((key) => {\n let k = key;\n while (parentMap.has(k)) {\n const p = parentMap.get(k)!;\n if (!expanded.has(p)) expanded.add(p);\n k = p;\n }\n });\n return Array.from(expanded);\n }\n return propDefaultExpandedKeys ?? [];\n }, [\n originTreeData,\n defaultExpandAll,\n defaultExpandParent,\n propDefaultExpandedKeys,\n ]);\n\n // use unique keys hook\n const {\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n } = useUniqueKeysTree({\n treeData: originTreeData,\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: resolvedDefaultExpandedKeys,\n onExpand: propOnExpand,\n checkedKeys,\n defaultCheckedKeys,\n onCheck,\n allowDuplicatedKeys,\n });\n\n const cls = useCls();\n const customSwitcherIcon: TreeProps<T>[\"switcherIcon\"] = () => (\n <CaretRight weight=\"bold\" className={cls(\"caret-switcher-icon\")} />\n );\n\n return {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n };\n}\n"],"names":["useTreeCommon","props","originTreeData","propExpandedKeys","propDefaultExpandedKeys","defaultExpandAll","defaultExpandParent","propOnExpand","checkedKeys","defaultCheckedKeys","onCheck","allowDuplicatedKeys","className","switcherIcon","restProps","resolvedDefaultExpandedKeys","useMemo","keys","traverse","nodes","node","parentMap","parent","children","expanded","key","k","p","processedTreeData","currentUniqueExpandedKeys","currentUniqueCheckedKeys","handleAntTreeExpand","handleAntTreeCheck","useUniqueKeysTree","cls","useCls","jsx","CaretRight"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTreeCommon.js","sources":["../../../src/components/Tree/useTreeCommon.tsx"],"sourcesContent":["\"use client\";\nimport { type DataNode as AntTreeDataNode } from \"antd/es/tree\";\n\nimport { useMemo, type Key } from \"react\";\nimport { useCls } from \"../utils\";\nimport { CaretRight } from \"@bioturing/assets\";\nimport type { TreeDataNode, TreeProps, DirectoryTreeProps } from \"./types\";\nimport { useUniqueKeysTree } from \"./useUniqueKeysTree\";\n\nexport function useTreeCommon<T extends AntTreeDataNode>(\n props: TreeProps<T> | DirectoryTreeProps<T>\n) {\n const {\n treeData: originTreeData = [],\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys = [],\n defaultExpandAll = false,\n defaultExpandParent = true,\n onExpand: propOnExpand,\n checkedKeys,\n defaultCheckedKeys,\n onCheck,\n allowDuplicatedKeys,\n className,\n switcherIcon,\n ...restProps\n } = props;\n\n // compute resolved defaultExpandedKeys\n const resolvedDefaultExpandedKeys = useMemo<Key[]>(() => {\n if (defaultExpandAll) {\n const keys: Key[] = [];\n const traverse = (nodes: TreeDataNode[] = []) => {\n nodes.forEach((node) => {\n keys.push(node.key);\n if (Array.isArray(node.children))\n traverse(node.children as TreeDataNode[]);\n });\n };\n traverse(originTreeData as TreeDataNode[]);\n return keys;\n }\n if (defaultExpandParent && propDefaultExpandedKeys?.length) {\n // build parent map\n const parentMap = new Map<Key, Key>();\n const traverse = (nodes: TreeDataNode[], parent?: TreeDataNode) => {\n nodes.forEach((node) => {\n if (parent) parentMap.set(node.key, parent.key);\n const children = Array.isArray(node.children)\n ? (node.children as TreeDataNode[])\n : [];\n if (children.length) traverse(children, node);\n });\n };\n traverse(originTreeData as TreeDataNode[]);\n // collect all expansions: original keys + their ancestors\n const expanded = new Set<Key>(propDefaultExpandedKeys);\n propDefaultExpandedKeys.forEach((key) => {\n let k = key;\n while (parentMap.has(k)) {\n const p = parentMap.get(k)!;\n if (!expanded.has(p)) expanded.add(p);\n k = p;\n }\n });\n return Array.from(expanded);\n }\n return propDefaultExpandedKeys ?? [];\n }, [\n originTreeData,\n defaultExpandAll,\n defaultExpandParent,\n propDefaultExpandedKeys,\n ]);\n\n // use unique keys hook\n const {\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n } = useUniqueKeysTree({\n treeData: originTreeData,\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: resolvedDefaultExpandedKeys,\n onExpand: propOnExpand,\n checkedKeys,\n defaultCheckedKeys,\n onCheck,\n allowDuplicatedKeys,\n });\n\n const cls = useCls();\n const customSwitcherIcon: TreeProps<T>[\"switcherIcon\"] = () => (\n <CaretRight weight=\"bold\" className={cls(\"caret-switcher-icon\")} />\n );\n\n return {\n cls,\n customSwitcherIcon,\n processedTreeData,\n currentUniqueExpandedKeys,\n currentUniqueCheckedKeys,\n handleAntTreeExpand,\n handleAntTreeCheck,\n restProps,\n className,\n switcherIcon,\n };\n}\n"],"names":["useTreeCommon","props","originTreeData","propExpandedKeys","propDefaultExpandedKeys","defaultExpandAll","defaultExpandParent","propOnExpand","checkedKeys","defaultCheckedKeys","onCheck","allowDuplicatedKeys","className","switcherIcon","restProps","resolvedDefaultExpandedKeys","useMemo","keys","traverse","nodes","node","parentMap","parent","children","expanded","key","k","p","processedTreeData","currentUniqueExpandedKeys","currentUniqueCheckedKeys","handleAntTreeExpand","handleAntTreeCheck","useUniqueKeysTree","cls","useCls","jsx","CaretRight"],"mappings":";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