@kolking/react-ui 1.9.2 → 1.9.3
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.
|
@@ -10,9 +10,6 @@ export type WithDialogProps<T extends object, R> = T & {
|
|
|
10
10
|
};
|
|
11
11
|
export declare function withDialog<T extends object, R>(Component: React.ComponentType<WithDialogProps<T, R>>, withProps?: PartialDialogProps): {
|
|
12
12
|
({ children, defaultOpen, onShow, onConfirm, onCancel, ...props }: ComponentProps<T, R>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
|
|
14
|
-
props: Record<string, unknown>;
|
|
15
|
-
show(_values: T, _showOptions?: DialogShowOptions<R>): void;
|
|
16
|
-
};
|
|
13
|
+
useDialogShow(): (_values: T, _showOptions?: DialogShowOptions<R>) => void;
|
|
17
14
|
};
|
|
18
15
|
export {};
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import i
|
|
1
|
+
import { jsxs as g, Fragment as x, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import i from "react";
|
|
3
3
|
import { Dialog as d } from "./Dialog.js";
|
|
4
|
-
import { useDialog as
|
|
5
|
-
function
|
|
6
|
-
const e = i.createContext({
|
|
7
|
-
|
|
8
|
-
show(t, n) {
|
|
9
|
-
throw new Error("Dialog context is not available");
|
|
10
|
-
}
|
|
4
|
+
import { useDialog as h } from "./useDialog.js";
|
|
5
|
+
function C(s, l) {
|
|
6
|
+
const e = i.createContext((t, n) => {
|
|
7
|
+
throw new Error("Dialog context is not available");
|
|
11
8
|
});
|
|
12
|
-
function
|
|
9
|
+
function a({
|
|
13
10
|
children: t,
|
|
14
11
|
defaultOpen: n,
|
|
15
|
-
onShow:
|
|
16
|
-
onConfirm:
|
|
12
|
+
onShow: p,
|
|
13
|
+
onConfirm: u,
|
|
17
14
|
onCancel: c,
|
|
18
|
-
...
|
|
15
|
+
...f
|
|
19
16
|
}) {
|
|
20
|
-
const o =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return /* @__PURE__ */ h(w, { children: [
|
|
25
|
-
/* @__PURE__ */ r(e, { value: f, children: typeof t == "function" ? t(o) : t }),
|
|
26
|
-
/* @__PURE__ */ r(d, { ...m, children: o.data && /* @__PURE__ */ r(a, { ...o.data, dialog: o }) })
|
|
17
|
+
const o = h({ defaultOpen: n, onShow: p, onConfirm: u, onCancel: c }), m = { ...l, ...f, ...o.props };
|
|
18
|
+
return /* @__PURE__ */ g(x, { children: [
|
|
19
|
+
/* @__PURE__ */ r(e, { value: o.show, children: typeof t == "function" ? t(o) : t }),
|
|
20
|
+
/* @__PURE__ */ r(d, { ...m, children: o.data && /* @__PURE__ */ r(s, { ...o.data, dialog: o }) })
|
|
27
21
|
] });
|
|
28
22
|
}
|
|
29
|
-
return
|
|
23
|
+
return a.useDialogShow = () => i.useContext(e), a;
|
|
30
24
|
}
|
|
31
25
|
export {
|
|
32
|
-
|
|
26
|
+
C as withDialog
|
|
33
27
|
};
|