react-kggraph 0.0.18 → 0.0.20

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/lib/index.es14.js CHANGED
@@ -1,226 +1,71 @@
1
- import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
- import { forwardRef as h, useState as s, useImperativeHandle as b } from "react";
3
- import { Drawer as x } from "antd";
4
- const N = h((y, d) => {
5
- const [c, t] = s(!1), [a, o] = s({ style: {}, data: {} });
6
- b(d, () => ({
7
- open: (n) => {
8
- t(!0), o(n);
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { forwardRef as w, useState as C, useImperativeHandle as D } from "react";
3
+ import { Select as a, Form as l, Drawer as F, Input as r } from "antd";
4
+ const { Option: o } = a, z = w((S, g) => {
5
+ const [v, d] = C(!1), [B, x] = C({ style: {}, data: {} }), [s] = l.useForm();
6
+ return D(g, () => ({
7
+ open: (t) => {
8
+ var c, h, i, m, b, y, p, u, f, I;
9
+ d(!0), x(t), s.setFieldsValue({
10
+ name: (c = t.data) == null ? void 0 : c.name,
11
+ type: t.type || "圆形",
12
+ color: (h = t.style) == null ? void 0 : h.color,
13
+ size: parseInt((i = t.style) == null ? void 0 : i.height) || 30,
14
+ borderWidth: parseInt((m = t.style) == null ? void 0 : m.borderWidth) || 2,
15
+ borderDash: ((b = t.style) == null ? void 0 : b.borderDash) === [5, 5] ? "是" : "否",
16
+ borderColor: (y = t.style) == null ? void 0 : y.borderColor,
17
+ textValign: ((p = t.style) == null ? void 0 : p.textValign) || "center",
18
+ fontStyle: ((u = t.style) == null ? void 0 : u.fontStyle) || "normal",
19
+ fontColor: ((f = t.style) == null ? void 0 : f["font-color"]) || "#000000",
20
+ textBackgroundColor: ((I = t.style) == null ? void 0 : I.textBackgroundColor) || "transparent"
21
+ });
9
22
  },
10
- close: () => t(!1)
11
- }));
12
- const i = () => {
13
- t(!1);
14
- }, l = (n) => {
15
- const { name: p, value: m } = n.target;
16
- o((u) => ({ ...u, [p]: m }));
17
- };
18
- return /* @__PURE__ */ e(
19
- x,
23
+ close: () => d(!1)
24
+ })), /* @__PURE__ */ e(
25
+ F,
20
26
  {
21
27
  title: "节点配置",
22
28
  closable: { "aria-label": "Close Button" },
23
- onClose: i,
24
- open: c,
29
+ onClose: () => {
30
+ d(!1), s.resetFields();
31
+ },
32
+ open: v,
25
33
  getContainer: !1,
26
- children: /* @__PURE__ */ e("div", { className: "h-full overflow-y-auto z-50", children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
27
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
28
- /* @__PURE__ */ e("label", { className: "w-40", children: "名称" }),
29
- /* @__PURE__ */ e(
30
- "input",
31
- {
32
- name: "name",
33
- value: a.data.name,
34
- onChange: l,
35
- readOnly: !0,
36
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500"
37
- }
38
- )
39
- ] }),
40
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
41
- /* @__PURE__ */ e("label", { className: "w-40", children: "类型" }),
42
- /* @__PURE__ */ r(
43
- "select",
44
- {
45
- name: "type",
46
- value: a.type,
47
- disabled: !0,
48
- onChange: l,
49
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white",
50
- children: [
51
- /* @__PURE__ */ e("option", { value: "圆形", children: "圆形" }),
52
- /* @__PURE__ */ e("option", { value: "矩形", children: "矩形" })
53
- ]
54
- }
55
- )
56
- ] }),
57
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
58
- /* @__PURE__ */ e("label", { className: "w-40", children: "颜色" }),
59
- /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 items-center", children: [
60
- /* @__PURE__ */ e(
61
- "input",
62
- {
63
- name: "color",
64
- readOnly: !0,
65
- value: a.style.color,
66
- onChange: l,
67
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px"
68
- }
69
- ),
70
- /* @__PURE__ */ e(
71
- "input",
72
- {
73
- type: "color",
74
- readOnly: !0,
75
- value: a.style.color,
76
- onChange: (n) => o({ ...a, color: n.target.value }),
77
- className: "h-20px w-20px rounded cursor-pointer border"
78
- }
79
- )
80
- ] })
81
- ] }),
82
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
83
- /* @__PURE__ */ e("label", { className: "w-40", children: "大小" }),
84
- /* @__PURE__ */ e(
85
- "input",
86
- {
87
- type: "number",
88
- name: "size",
89
- readOnly: !0,
90
- value: parseInt(a.style.height),
91
- onChange: l,
92
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded "
93
- }
94
- )
95
- ] }),
96
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
97
- /* @__PURE__ */ e("label", { className: "w-40", children: "边框宽度" }),
98
- /* @__PURE__ */ e(
99
- "input",
100
- {
101
- type: "number",
102
- name: "borderWidth",
103
- readOnly: !0,
104
- value: parseInt(a.style.borderWidth),
105
- onChange: l,
106
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded "
107
- }
108
- )
109
- ] }),
110
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
111
- /* @__PURE__ */ e("label", { className: "w-40", children: "边框虚线" }),
112
- /* @__PURE__ */ r(
113
- "select",
114
- {
115
- name: "borderDash",
116
- value: a.style.borderDash,
117
- disabled: !0,
118
- onChange: l,
119
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white",
120
- children: [
121
- /* @__PURE__ */ e("option", { value: "否", children: "否" }),
122
- /* @__PURE__ */ e("option", { value: "是", children: "是" })
123
- ]
124
- }
125
- )
126
- ] }),
127
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
128
- /* @__PURE__ */ e("label", { className: "w-40", children: "边框颜色" }),
129
- /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 items-center", children: [
130
- /* @__PURE__ */ e(
131
- "input",
132
- {
133
- name: "borderColor",
134
- value: a.style.borderColor,
135
- readOnly: !0,
136
- onChange: l,
137
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px"
138
- }
139
- ),
140
- /* @__PURE__ */ e(
141
- "input",
142
- {
143
- type: "color",
144
- value: a.borderColor,
145
- readOnly: !0,
146
- onChange: (n) => o({ ...a, borderColor: n.target.value }),
147
- className: "h-20px w-20px rounded cursor-pointer border"
148
- }
149
- )
150
- ] })
151
- ] }),
152
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
153
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体位置" }),
154
- /* @__PURE__ */ r(
155
- "select",
156
- {
157
- name: "fontPosition",
158
- value: a.style.textValign,
159
- disabled: !0,
160
- onChange: l,
161
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white",
162
- children: [
163
- /* @__PURE__ */ e("option", { value: "center", children: "居中" }),
164
- /* @__PURE__ */ e("option", { value: "bottom", children: "底部" }),
165
- /* @__PURE__ */ e("option", { value: "top", children: "顶部" })
166
- ]
167
- }
168
- )
169
- ] }),
170
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
171
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体样式" }),
172
- /* @__PURE__ */ e(
173
- "input",
174
- {
175
- name: "fontStyle",
176
- value: a.style.fontStyle,
177
- readOnly: !0,
178
- onChange: l,
179
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded "
180
- }
181
- )
182
- ] }),
183
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
184
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体颜色" }),
185
- /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 items-center", children: [
186
- /* @__PURE__ */ e(
187
- "input",
188
- {
189
- name: "fontColor",
190
- readOnly: !0,
191
- value: a.style.textBorderColor,
192
- onChange: l,
193
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px"
194
- }
195
- ),
196
- /* @__PURE__ */ e(
197
- "input",
198
- {
199
- type: "color",
200
- readOnly: !0,
201
- value: a.style["font-color"],
202
- onChange: (n) => o({ ...a, fontColor: n.target.value }),
203
- className: "h-20px w-20px rounded cursor-pointer border"
204
- }
205
- )
206
- ] })
207
- ] }),
208
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
209
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体背色" }),
210
- /* @__PURE__ */ e(
211
- "input",
212
- {
213
- type: "text",
214
- readOnly: !0,
215
- value: a.style.textBackgroundColor,
216
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-gray-50 text-gray-400 cursor-not-allowed"
217
- }
218
- )
219
- ] })
220
- ] }) })
34
+ width: 360,
35
+ children: /* @__PURE__ */ n(
36
+ l,
37
+ {
38
+ form: s,
39
+ layout: "vertical",
40
+ disabled: !0,
41
+ children: [
42
+ /* @__PURE__ */ e(l.Item, { label: "名称", name: "name", children: /* @__PURE__ */ e(r, {}) }),
43
+ /* @__PURE__ */ e(l.Item, { label: "类型", name: "type", children: /* @__PURE__ */ n(a, { children: [
44
+ /* @__PURE__ */ e(o, { value: "圆形", children: "圆形" }),
45
+ /* @__PURE__ */ e(o, { value: "矩形", children: "矩形" })
46
+ ] }) }),
47
+ /* @__PURE__ */ e(l.Item, { label: "颜色", name: "color", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
48
+ /* @__PURE__ */ e(l.Item, { label: "大小", name: "size", children: /* @__PURE__ */ e(r, { type: "number" }) }),
49
+ /* @__PURE__ */ e(l.Item, { label: "边框宽度", name: "borderWidth", children: /* @__PURE__ */ e(r, { type: "number" }) }),
50
+ /* @__PURE__ */ e(l.Item, { label: "边框虚线", name: "borderDash", children: /* @__PURE__ */ n(a, { children: [
51
+ /* @__PURE__ */ e(o, { value: "", children: "否" }),
52
+ /* @__PURE__ */ e(o, { value: "是", children: "是" })
53
+ ] }) }),
54
+ /* @__PURE__ */ e(l.Item, { label: "边框颜色", name: "borderColor", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
55
+ /* @__PURE__ */ e(l.Item, { label: "字体位置", name: "textValign", children: /* @__PURE__ */ n(a, { children: [
56
+ /* @__PURE__ */ e(o, { value: "center", children: "居中" }),
57
+ /* @__PURE__ */ e(o, { value: "bottom", children: "底部" }),
58
+ /* @__PURE__ */ e(o, { value: "top", children: "顶部" })
59
+ ] }) }),
60
+ /* @__PURE__ */ e(l.Item, { label: "字体样式", name: "fontStyle", children: /* @__PURE__ */ e(r, {}) }),
61
+ /* @__PURE__ */ e(l.Item, { label: "字体颜色", name: "fontColor", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
62
+ /* @__PURE__ */ e(l.Item, { label: "字体背色", name: "textBackgroundColor", children: /* @__PURE__ */ e(r, {}) })
63
+ ]
64
+ }
65
+ )
221
66
  }
222
67
  );
223
68
  });
224
69
  export {
225
- N as default
70
+ z as default
226
71
  };