@king-one/form-design 0.0.24 → 0.0.26
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/CHANGELOG.md +12 -0
- package/dist/es/src/components/form-desgin.mjs +5 -5
- package/dist/es/src/components/form-material.vue.mjs +91 -70
- package/dist/es/src/components/form-panel.vue.mjs +44 -32
- package/dist/es/src/components/panel/index.mjs +17 -14
- package/dist/es/src/components/panel/widget/grid.vue.mjs +4 -0
- package/dist/es/src/components/panel/widget/grid.vue2.mjs +117 -0
- package/dist/es/src/components/props/widget/GridProps.vue.mjs +4 -0
- package/dist/es/src/components/props/widget/GridProps.vue2.mjs +108 -0
- package/dist/es/src/components/props/widget/index.mjs +17 -10
- package/dist/es/src/config/index.mjs +42 -38
- package/dist/es/src/core/Design.mjs +20 -13
- package/dist/es/src/core/FormSchema.mjs +57 -34
- package/dist/es/src/effects/index.mjs +2 -0
- package/dist/es/src/plugins/modules/drag-add.mjs +11 -11
- package/dist/es/src/types.mjs +11 -0
- package/dist/lib/src/components/form-desgin.js +1 -1
- package/dist/lib/src/components/form-material.vue.js +2 -2
- package/dist/lib/src/components/form-panel.vue.js +2 -2
- package/dist/lib/src/components/panel/index.js +1 -1
- package/dist/lib/src/components/panel/widget/grid.vue.js +1 -0
- package/dist/lib/src/components/panel/widget/grid.vue2.js +1 -0
- package/dist/lib/src/components/props/widget/GridProps.vue.js +1 -0
- package/dist/lib/src/components/props/widget/GridProps.vue2.js +1 -0
- package/dist/lib/src/components/props/widget/index.js +1 -1
- package/dist/lib/src/config/index.js +1 -1
- package/dist/lib/src/core/Design.js +1 -1
- package/dist/lib/src/core/FormSchema.js +1 -1
- package/dist/lib/src/effects/index.js +1 -1
- package/dist/lib/src/plugins/modules/drag-add.js +1 -1
- package/dist/lib/src/types.js +1 -0
- package/dist/theme-chalk/grid-props.css +1 -0
- package/dist/theme-chalk/grid.css +1 -0
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/types/src/components/panel/widget/grid.vue.d.ts +20 -0
- package/dist/types/src/components/props/widget/GridProps.vue.d.ts +3 -0
- package/dist/types/src/core/Design.d.ts +4 -2
- package/dist/types/src/core/FormSchema.d.ts +8 -0
- package/dist/types/src/effects/index.d.ts +1 -0
- package/dist/types/src/types.d.ts +2 -9
- package/package.json +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defineComponent as _, computed as k, resolveComponent as y, openBlock as p, createBlock as C, unref as o, normalizeClass as g, withCtx as a, createVNode as n, createElementBlock as c, Fragment as h, renderList as b, createTextVNode as N } from "vue";
|
|
2
|
+
import { Form as I, FormItem as d, InputNumber as B, Button as F } from "ant-design-vue";
|
|
3
|
+
import "../../../internal.mjs";
|
|
4
|
+
import { uid as w } from "@king-one/utils";
|
|
5
|
+
import "../../form-icon.vue.mjs";
|
|
6
|
+
import { useNamespace as U } from "../../../hooks/use-namespace/index.mjs";
|
|
7
|
+
import { useInjectDesignContext as V } from "../../../context/design.mjs";
|
|
8
|
+
import $ from "../../form-icon.vue2.mjs";
|
|
9
|
+
const q = /* @__PURE__ */ _({
|
|
10
|
+
__name: "GridProps",
|
|
11
|
+
setup(z) {
|
|
12
|
+
const { b: f } = U("grid-props"), { checkedField: r } = V(), s = k(() => r.value["x-component-props"] || {});
|
|
13
|
+
function v(l) {
|
|
14
|
+
var e;
|
|
15
|
+
(e = r.value.children) == null || e.splice(l, 1);
|
|
16
|
+
}
|
|
17
|
+
function x() {
|
|
18
|
+
var t, i;
|
|
19
|
+
const l = w(), m = {
|
|
20
|
+
title: `列表容器${(((t = r.value.children) == null ? void 0 : t.length) || 0) + 1}`,
|
|
21
|
+
name: l,
|
|
22
|
+
id: l,
|
|
23
|
+
key: "k-grid-column",
|
|
24
|
+
type: "void",
|
|
25
|
+
icon: "form-list",
|
|
26
|
+
children: [],
|
|
27
|
+
"x-component": "GridColumn",
|
|
28
|
+
"x-decorator": "Void",
|
|
29
|
+
"x-component-props": {
|
|
30
|
+
span: 12
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
(i = r.value.children) == null || i.push(m);
|
|
34
|
+
}
|
|
35
|
+
return (l, e) => {
|
|
36
|
+
const m = y("AInputNumber");
|
|
37
|
+
return p(), C(o(I), {
|
|
38
|
+
layout: "vertical",
|
|
39
|
+
class: g(o(f)())
|
|
40
|
+
}, {
|
|
41
|
+
default: a(() => [
|
|
42
|
+
n(o(d), { label: "间隔大小" }, {
|
|
43
|
+
default: a(() => [
|
|
44
|
+
n(o(B), {
|
|
45
|
+
value: s.value.gutter,
|
|
46
|
+
"onUpdate:value": e[0] || (e[0] = (t) => s.value.gutter = t),
|
|
47
|
+
style: { width: "100%" },
|
|
48
|
+
min: 1,
|
|
49
|
+
precision: 0,
|
|
50
|
+
max: 999,
|
|
51
|
+
"addon-after": "px"
|
|
52
|
+
}, null, 8, ["value"])
|
|
53
|
+
]),
|
|
54
|
+
_: 1
|
|
55
|
+
/* STABLE */
|
|
56
|
+
}),
|
|
57
|
+
n(o(d), { label: "配置项" }, {
|
|
58
|
+
default: a(() => [
|
|
59
|
+
(p(!0), c(
|
|
60
|
+
h,
|
|
61
|
+
null,
|
|
62
|
+
b(o(r).children, (t, i) => (p(), c("div", {
|
|
63
|
+
key: t.id,
|
|
64
|
+
class: "col-item"
|
|
65
|
+
}, [
|
|
66
|
+
n(m, {
|
|
67
|
+
value: t["x-component-props"].span,
|
|
68
|
+
"onUpdate:value": (u) => t["x-component-props"].span = u,
|
|
69
|
+
min: 1,
|
|
70
|
+
style: { width: "200px" },
|
|
71
|
+
precision: 0,
|
|
72
|
+
max: 24
|
|
73
|
+
}, null, 8, ["value", "onUpdate:value"]),
|
|
74
|
+
n($, {
|
|
75
|
+
name: "delete1",
|
|
76
|
+
class: "close-icon",
|
|
77
|
+
onClick: (u) => v(i)
|
|
78
|
+
}, null, 8, ["onClick"])
|
|
79
|
+
]))),
|
|
80
|
+
128
|
|
81
|
+
/* KEYED_FRAGMENT */
|
|
82
|
+
)),
|
|
83
|
+
n(o(F), {
|
|
84
|
+
size: "small",
|
|
85
|
+
type: "primary",
|
|
86
|
+
style: { "margin-bottom": "10px" },
|
|
87
|
+
onClick: x
|
|
88
|
+
}, {
|
|
89
|
+
default: a(() => e[1] || (e[1] = [
|
|
90
|
+
N(" 添加 + ")
|
|
91
|
+
])),
|
|
92
|
+
_: 1,
|
|
93
|
+
__: [1]
|
|
94
|
+
})
|
|
95
|
+
]),
|
|
96
|
+
_: 1
|
|
97
|
+
/* STABLE */
|
|
98
|
+
})
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
/* STABLE */
|
|
102
|
+
}, 8, ["class"]);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
export {
|
|
107
|
+
q as default
|
|
108
|
+
};
|
|
@@ -5,13 +5,15 @@ import "./BaseProps.vue.mjs";
|
|
|
5
5
|
import "./SelectProps.vue.mjs";
|
|
6
6
|
import "./OvertimeProps.vue.mjs";
|
|
7
7
|
import { propsWidgetDecorator as a } from "./PropsDecorator.mjs";
|
|
8
|
+
import "./GridProps.vue.mjs";
|
|
8
9
|
import o from "./BaseProps.vue2.mjs";
|
|
9
10
|
import s from "./InputProps.vue2.mjs";
|
|
10
11
|
import d from "./TextareaProps.vue2.mjs";
|
|
11
12
|
import f from "./InputNumberProps.vue2.mjs";
|
|
12
13
|
import h from "./SelectProps.vue2.mjs";
|
|
13
14
|
import g from "./OvertimeProps.vue2.mjs";
|
|
14
|
-
|
|
15
|
+
import _ from "./GridProps.vue2.mjs";
|
|
16
|
+
const w = {
|
|
15
17
|
"k-input": {
|
|
16
18
|
component: [
|
|
17
19
|
{ header: "基础设置", widget: o },
|
|
@@ -40,23 +42,28 @@ const _ = {
|
|
|
40
42
|
component: [
|
|
41
43
|
{ header: "组件属性", widget: g }
|
|
42
44
|
]
|
|
45
|
+
},
|
|
46
|
+
"k-grid": {
|
|
47
|
+
component: [
|
|
48
|
+
{ header: "组件属性", widget: _ }
|
|
49
|
+
]
|
|
43
50
|
}
|
|
44
51
|
};
|
|
45
|
-
function
|
|
52
|
+
function z(c = []) {
|
|
46
53
|
const i = {};
|
|
47
|
-
for (const [e, p] of Object.entries(
|
|
48
|
-
const
|
|
49
|
-
for (const
|
|
50
|
-
const { keys: r, exclude: t } =
|
|
54
|
+
for (const [e, p] of Object.entries(w)) {
|
|
55
|
+
const m = [...p.component];
|
|
56
|
+
for (const n of c) {
|
|
57
|
+
const { keys: r, exclude: t } = n;
|
|
51
58
|
if (t && (Array.isArray(t) ? t.includes(e) : t.test(e)))
|
|
52
59
|
continue;
|
|
53
|
-
(Array.isArray(r) ? r.includes(e) : r.test(e)) &&
|
|
60
|
+
(Array.isArray(r) ? r.includes(e) : r.test(e)) && m.push(n.component);
|
|
54
61
|
}
|
|
55
|
-
i[e] = a(e,
|
|
62
|
+
i[e] = a(e, m);
|
|
56
63
|
}
|
|
57
64
|
return i;
|
|
58
65
|
}
|
|
59
66
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
z as expandProps,
|
|
68
|
+
w as widgetProps
|
|
62
69
|
};
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import { valueTypeMap as e } from "../types.mjs";
|
|
2
|
+
const o = {
|
|
2
3
|
name: "布局组件",
|
|
3
4
|
key: "layout",
|
|
4
5
|
widget: [
|
|
5
6
|
{
|
|
6
|
-
title: "
|
|
7
|
+
title: "栅格布局",
|
|
7
8
|
icon: "k-form-grid",
|
|
8
|
-
key: "
|
|
9
|
-
type:
|
|
10
|
-
"x-component": "
|
|
9
|
+
key: "k-grid",
|
|
10
|
+
type: e.void,
|
|
11
|
+
"x-component": "FormGrid",
|
|
12
|
+
"x-component-props": {
|
|
13
|
+
gutter: 20
|
|
14
|
+
},
|
|
15
|
+
"x-decorator": "Void"
|
|
11
16
|
}
|
|
12
17
|
]
|
|
13
|
-
},
|
|
18
|
+
}, a = {
|
|
14
19
|
name: "基础组件",
|
|
15
20
|
key: "basic",
|
|
16
21
|
widget: [
|
|
17
22
|
{
|
|
18
23
|
title: "输入框",
|
|
19
24
|
key: "k-input",
|
|
20
|
-
type:
|
|
25
|
+
type: e.string,
|
|
21
26
|
icon: "form-input",
|
|
22
27
|
"x-component": "Input",
|
|
23
28
|
"x-component-props": {
|
|
@@ -27,7 +32,7 @@ const e = {
|
|
|
27
32
|
{
|
|
28
33
|
title: "多文本输入框",
|
|
29
34
|
key: "k-textarea",
|
|
30
|
-
type:
|
|
35
|
+
type: e.string,
|
|
31
36
|
icon: "form-textarea",
|
|
32
37
|
"x-component": "Textarea",
|
|
33
38
|
"x-component-props": {
|
|
@@ -37,7 +42,7 @@ const e = {
|
|
|
37
42
|
{
|
|
38
43
|
title: "数字输入框",
|
|
39
44
|
key: "k-input-number",
|
|
40
|
-
type:
|
|
45
|
+
type: e.number,
|
|
41
46
|
icon: "form-number",
|
|
42
47
|
"x-component": "InputNumber",
|
|
43
48
|
"x-component-props": {
|
|
@@ -47,9 +52,9 @@ const e = {
|
|
|
47
52
|
{
|
|
48
53
|
title: "下拉选择框",
|
|
49
54
|
key: "k-select",
|
|
50
|
-
type:
|
|
55
|
+
type: e.array,
|
|
51
56
|
items: {
|
|
52
|
-
type:
|
|
57
|
+
type: e.string
|
|
53
58
|
},
|
|
54
59
|
icon: "form-select",
|
|
55
60
|
"x-component": "Select",
|
|
@@ -73,10 +78,10 @@ const e = {
|
|
|
73
78
|
{
|
|
74
79
|
title: "日期范围",
|
|
75
80
|
key: "k-date-range",
|
|
76
|
-
type:
|
|
81
|
+
type: e.array,
|
|
77
82
|
format: "date",
|
|
78
83
|
items: {
|
|
79
|
-
type:
|
|
84
|
+
type: e.string,
|
|
80
85
|
format: "date"
|
|
81
86
|
},
|
|
82
87
|
icon: "form-date",
|
|
@@ -92,7 +97,7 @@ const e = {
|
|
|
92
97
|
{
|
|
93
98
|
title: "单个日期",
|
|
94
99
|
key: "k-date-single",
|
|
95
|
-
type:
|
|
100
|
+
type: e.string,
|
|
96
101
|
format: "date",
|
|
97
102
|
icon: "form-date",
|
|
98
103
|
"x-component": "InputNumber",
|
|
@@ -104,46 +109,46 @@ const e = {
|
|
|
104
109
|
{
|
|
105
110
|
title: "地区选择",
|
|
106
111
|
key: "k-form-area",
|
|
107
|
-
type:
|
|
112
|
+
type: e.object,
|
|
108
113
|
icon: "form-area",
|
|
109
114
|
"x-component": "FormArea",
|
|
110
115
|
children: [
|
|
111
116
|
{
|
|
112
117
|
title: "省份",
|
|
113
118
|
key: "k-form-area-province",
|
|
114
|
-
type:
|
|
119
|
+
type: e.string,
|
|
115
120
|
name: "province"
|
|
116
121
|
},
|
|
117
122
|
{
|
|
118
123
|
title: "城市",
|
|
119
124
|
key: "k-form-area-city",
|
|
120
|
-
type:
|
|
125
|
+
type: e.string,
|
|
121
126
|
name: "city"
|
|
122
127
|
},
|
|
123
128
|
{
|
|
124
129
|
title: "区县",
|
|
125
130
|
key: "k-form-area-county",
|
|
126
|
-
type:
|
|
131
|
+
type: e.string,
|
|
127
132
|
name: "county"
|
|
128
133
|
}
|
|
129
134
|
]
|
|
130
135
|
}
|
|
131
136
|
]
|
|
132
|
-
},
|
|
137
|
+
}, r = {
|
|
133
138
|
name: "扩展组件",
|
|
134
139
|
key: "extend",
|
|
135
140
|
widget: [
|
|
136
141
|
{
|
|
137
142
|
title: "对象容器",
|
|
138
143
|
key: "k-object",
|
|
139
|
-
type:
|
|
144
|
+
type: e.object,
|
|
140
145
|
icon: "form-object",
|
|
141
146
|
children: []
|
|
142
147
|
},
|
|
143
148
|
{
|
|
144
149
|
title: "列表容器",
|
|
145
150
|
key: "k-array-card",
|
|
146
|
-
type:
|
|
151
|
+
type: e.array,
|
|
147
152
|
icon: "form-list",
|
|
148
153
|
children: [],
|
|
149
154
|
"x-component": "ArrayCard",
|
|
@@ -152,7 +157,7 @@ const e = {
|
|
|
152
157
|
{
|
|
153
158
|
title: "明细表",
|
|
154
159
|
key: "k-table",
|
|
155
|
-
type:
|
|
160
|
+
type: e.array,
|
|
156
161
|
icon: "form-table",
|
|
157
162
|
"x-component": "ArrayTable",
|
|
158
163
|
"x-decorator-props": {
|
|
@@ -160,7 +165,7 @@ const e = {
|
|
|
160
165
|
}
|
|
161
166
|
}
|
|
162
167
|
]
|
|
163
|
-
},
|
|
168
|
+
}, n = [
|
|
164
169
|
{
|
|
165
170
|
name: "加班模版",
|
|
166
171
|
key: "overtime",
|
|
@@ -168,7 +173,7 @@ const e = {
|
|
|
168
173
|
schema: {
|
|
169
174
|
title: "加班模版",
|
|
170
175
|
key: "k-overtime",
|
|
171
|
-
type:
|
|
176
|
+
type: e.object,
|
|
172
177
|
name: "overtime",
|
|
173
178
|
id: "overtime",
|
|
174
179
|
"x-design-props": {
|
|
@@ -181,15 +186,15 @@ const e = {
|
|
|
181
186
|
{
|
|
182
187
|
title: "加班明细",
|
|
183
188
|
key: "k-array-card",
|
|
184
|
-
type:
|
|
189
|
+
type: e.array,
|
|
185
190
|
children: [
|
|
186
191
|
{
|
|
187
192
|
title: "日期范围",
|
|
188
193
|
key: "k-date-range",
|
|
189
|
-
type:
|
|
194
|
+
type: e.array,
|
|
190
195
|
format: "date",
|
|
191
196
|
items: {
|
|
192
|
-
type:
|
|
197
|
+
type: e.string,
|
|
193
198
|
format: "date"
|
|
194
199
|
},
|
|
195
200
|
"x-component": "DateRange",
|
|
@@ -208,13 +213,12 @@ const e = {
|
|
|
208
213
|
status: "",
|
|
209
214
|
message: ""
|
|
210
215
|
}
|
|
211
|
-
}
|
|
212
|
-
children: []
|
|
216
|
+
}
|
|
213
217
|
},
|
|
214
218
|
{
|
|
215
219
|
title: "加班时长",
|
|
216
220
|
key: "k-input-number",
|
|
217
|
-
type:
|
|
221
|
+
type: e.number,
|
|
218
222
|
"x-component": "InputNumber",
|
|
219
223
|
"x-component-props": {
|
|
220
224
|
placeholder: "请输入"
|
|
@@ -243,7 +247,7 @@ const e = {
|
|
|
243
247
|
{
|
|
244
248
|
title: "总时长",
|
|
245
249
|
key: "k-input",
|
|
246
|
-
type:
|
|
250
|
+
type: e.string,
|
|
247
251
|
"x-component": "Input",
|
|
248
252
|
"x-component-props": {
|
|
249
253
|
placeholder: "请输入"
|
|
@@ -267,7 +271,7 @@ const e = {
|
|
|
267
271
|
schema: {
|
|
268
272
|
title: "请假模版",
|
|
269
273
|
key: "k-leave",
|
|
270
|
-
type:
|
|
274
|
+
type: e.object,
|
|
271
275
|
name: "leave",
|
|
272
276
|
id: "leave",
|
|
273
277
|
"x-design-props": {
|
|
@@ -280,9 +284,9 @@ const e = {
|
|
|
280
284
|
{
|
|
281
285
|
title: "下拉选择框",
|
|
282
286
|
key: "k-select",
|
|
283
|
-
type:
|
|
287
|
+
type: e.array,
|
|
284
288
|
items: {
|
|
285
|
-
type:
|
|
289
|
+
type: e.string
|
|
286
290
|
},
|
|
287
291
|
"x-component": "Select",
|
|
288
292
|
enum: [
|
|
@@ -315,8 +319,8 @@ const e = {
|
|
|
315
319
|
}
|
|
316
320
|
];
|
|
317
321
|
export {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
+
a as BaseSchema,
|
|
323
|
+
r as ExtendSchema,
|
|
324
|
+
o as LayoutSchema,
|
|
325
|
+
n as tempSchema
|
|
322
326
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
2
|
var p = (r, e, s) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
3
|
var t = (r, e, s) => p(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { ref as
|
|
4
|
+
import { ref as c } from "vue";
|
|
5
5
|
import "../effects/index.mjs";
|
|
6
|
-
import { widgetPanels as
|
|
6
|
+
import { widgetPanels as d } from "../components/panel/index.mjs";
|
|
7
7
|
import "../components/props/index.mjs";
|
|
8
8
|
import { Plugin as l } from "../plugins/index.mjs";
|
|
9
9
|
import { Heart as n } from "./Heart.mjs";
|
|
10
|
-
import { FormSchema as
|
|
11
|
-
import { widgetProps as
|
|
12
|
-
import {
|
|
13
|
-
|
|
10
|
+
import { FormSchema as a } from "./FormSchema.mjs";
|
|
11
|
+
import { widgetProps as g } from "../components/props/widget/index.mjs";
|
|
12
|
+
import { DesignEffectDict as f } from "../effects/effect-dict.mjs";
|
|
13
|
+
import { runEffects as u } from "../effects/effective.mjs";
|
|
14
|
+
class N {
|
|
14
15
|
constructor(e) {
|
|
15
16
|
t(this, "schema");
|
|
16
17
|
t(this, "tempSchema");
|
|
17
18
|
t(this, "heart");
|
|
18
19
|
t(this, "plugin");
|
|
19
|
-
t(this, "FormSchema", new
|
|
20
|
+
t(this, "FormSchema", new a());
|
|
20
21
|
t(this, "props");
|
|
21
|
-
t(this, "checkedField",
|
|
22
|
+
t(this, "checkedField", c({}));
|
|
22
23
|
t(this, "shared", {
|
|
23
24
|
draggedContext: {
|
|
24
25
|
key: "",
|
|
@@ -33,15 +34,15 @@ class C {
|
|
|
33
34
|
});
|
|
34
35
|
const { extendFormProps: s = [], propsWidgets: i = {}, panelWidgets: o = {}, ...h } = e;
|
|
35
36
|
this.shared.panelWidgets = {
|
|
36
|
-
...
|
|
37
|
+
...d,
|
|
37
38
|
...o
|
|
38
39
|
}, this.shared.propsWidgets = {
|
|
39
|
-
...
|
|
40
|
+
...g,
|
|
40
41
|
...i
|
|
41
42
|
}, this.props = { ...h }, this.schema = e.schema, this.tempSchema = e.tempSchema || [], this.plugin = new l(), this.heart = new n({
|
|
42
43
|
lifecycles: this.lifecycles,
|
|
43
44
|
context: this
|
|
44
|
-
}), this.extendFormProps = s;
|
|
45
|
+
}), this.extendFormProps = s, this.notify(f.ON_DESIGN_INIT);
|
|
45
46
|
}
|
|
46
47
|
use(e) {
|
|
47
48
|
this.plugin.use(e);
|
|
@@ -52,11 +53,17 @@ class C {
|
|
|
52
53
|
getFieldList() {
|
|
53
54
|
return this.FormSchema.getFieldList();
|
|
54
55
|
}
|
|
56
|
+
setFields(e) {
|
|
57
|
+
return this.FormSchema.setFields(e);
|
|
58
|
+
}
|
|
59
|
+
clearFields() {
|
|
60
|
+
return this.FormSchema.clearFields();
|
|
61
|
+
}
|
|
55
62
|
setCheckedField(e) {
|
|
56
63
|
this.checkedField.value = e;
|
|
57
64
|
}
|
|
58
65
|
get lifecycles() {
|
|
59
|
-
return this.props.effects ?
|
|
66
|
+
return this.props.effects ? u(this, this.props.effects) : [];
|
|
60
67
|
}
|
|
61
68
|
get hooks() {
|
|
62
69
|
return this.plugin.hooks;
|
|
@@ -69,5 +76,5 @@ class C {
|
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
export {
|
|
72
|
-
|
|
79
|
+
N as FormDesign
|
|
73
80
|
};
|
|
@@ -1,51 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
5
|
-
import { uid as
|
|
6
|
-
import { Field as
|
|
7
|
-
class
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var p = (r, s, t) => s in r ? h(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var n = (r, s, t) => p(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ref as a, toRaw as m } from "vue";
|
|
5
|
+
import { uid as d } from "@king-one/utils";
|
|
6
|
+
import { Field as f } from "./Field.mjs";
|
|
7
|
+
class g {
|
|
8
8
|
constructor() {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
n(this, "version", "1.0.0");
|
|
10
|
+
n(this, "fields", a([]));
|
|
11
11
|
}
|
|
12
12
|
getSchema() {
|
|
13
|
-
const
|
|
14
|
-
console.log(
|
|
15
|
-
const
|
|
13
|
+
const s = m(this.fields.value);
|
|
14
|
+
console.log(s, "s");
|
|
15
|
+
const t = this.jsonToschema(s);
|
|
16
16
|
return {
|
|
17
17
|
version: this.version,
|
|
18
18
|
form: {
|
|
19
|
-
schema:
|
|
19
|
+
schema: t
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
getFieldList() {
|
|
24
|
-
return this.fields.value.map((
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...
|
|
34
|
-
|
|
24
|
+
return this.fields.value.map((s) => new f(s));
|
|
25
|
+
}
|
|
26
|
+
clearFields() {
|
|
27
|
+
return this.fields.value = [];
|
|
28
|
+
}
|
|
29
|
+
jsonToschema(s, t = {}) {
|
|
30
|
+
return s.forEach((i) => {
|
|
31
|
+
const e = this.omit(i, ["children"]);
|
|
32
|
+
e.type === "object" && i.children ? t[e.name] = {
|
|
33
|
+
...e,
|
|
34
|
+
properties: this.jsonToschema(i.children)
|
|
35
|
+
} : e.type === "void" && i.children ? t[e.name] = {
|
|
36
|
+
...e,
|
|
37
|
+
properties: this.jsonToschema(i.children)
|
|
38
|
+
} : e.type === "array" && i.children ? t[e.name] = {
|
|
39
|
+
...e,
|
|
40
|
+
items: e.items || {
|
|
35
41
|
type: "object",
|
|
36
|
-
id:
|
|
37
|
-
properties: this.jsonToschema(
|
|
42
|
+
id: d(),
|
|
43
|
+
properties: this.jsonToschema(i.children)
|
|
38
44
|
}
|
|
39
|
-
} :
|
|
40
|
-
}),
|
|
45
|
+
} : t[e.name] = e;
|
|
46
|
+
}), t;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 将 schema 对象格式还原为数组格式
|
|
50
|
+
* @param schema schema 对象
|
|
51
|
+
* @returns FieldSchema[] 数组格式
|
|
52
|
+
*/
|
|
53
|
+
schemaToJson(s) {
|
|
54
|
+
const t = [];
|
|
55
|
+
return Object.keys(s).forEach((i) => {
|
|
56
|
+
var l;
|
|
57
|
+
const e = s[i], o = this.omit(e, ["properties", "items"]);
|
|
58
|
+
(e.type === "object" || e.type === "void") && e.properties ? o.children = this.schemaToJson(e.properties) : e.type === "array" && ((l = e.items) != null && l.properties) ? (o.children = this.schemaToJson(e.items.properties), Object.keys(e.items).every((c) => ["type", "id", "properties"].includes(c)) || (o.items = this.omit(e.items, ["properties"]))) : e.type === "array" && e.items && (o.items = e.items), t.push(o);
|
|
59
|
+
}), t;
|
|
60
|
+
}
|
|
61
|
+
setFields(s) {
|
|
62
|
+
const t = this.schemaToJson(s);
|
|
63
|
+
this.fields.value = t;
|
|
41
64
|
}
|
|
42
|
-
omit(
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
delete
|
|
46
|
-
}),
|
|
65
|
+
omit(s, t) {
|
|
66
|
+
const i = { ...s };
|
|
67
|
+
return t.forEach((e) => {
|
|
68
|
+
delete i[e];
|
|
69
|
+
}), i;
|
|
47
70
|
}
|
|
48
71
|
}
|
|
49
72
|
export {
|
|
50
|
-
|
|
73
|
+
g as FormSchema
|
|
51
74
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var l = (a, r, e) => r in a ? o(a, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[r] = e;
|
|
3
|
+
var d = (a, r, e) => l(a, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
const k = ["k-array-card", "k-object", "k-table"];
|
|
5
5
|
class g {
|
|
6
6
|
constructor() {
|
|
7
|
-
|
|
7
|
+
d(this, "name", "BaseDragAdd");
|
|
8
8
|
}
|
|
9
9
|
install(r) {
|
|
10
|
-
r.hooks.syncDragAdd.tap("formPanelDragAdd", (
|
|
11
|
-
const { region: t, source:
|
|
12
|
-
if (t
|
|
13
|
-
const
|
|
14
|
-
return !
|
|
10
|
+
r.hooks.syncDragAdd.tap("formPanelDragAdd", (e) => !0), r.hooks.syncDragAdd.tap("NestedDragAdd", (e) => {
|
|
11
|
+
const { region: t, source: n } = e, s = ["k-array-card", "k-object", "k-table", "k-grid"];
|
|
12
|
+
if (s.includes(t)) {
|
|
13
|
+
const { key: c } = n;
|
|
14
|
+
return !s.includes(c);
|
|
15
15
|
}
|
|
16
16
|
return !0;
|
|
17
17
|
});
|
|
@@ -19,5 +19,5 @@ class g {
|
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
21
|
g as BaseDragAdd,
|
|
22
|
-
|
|
22
|
+
k as exclusion
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../internal.js");const s=require("../context/design.js");require("./index.js");const a=require("./types.js"),c=require("../utils/merge.js");require("@king-one/form-design/dist/theme-chalk/index.css");const l=require("../hooks/use-namespace/index.js"),g=require("./form-material.vue.js"),_=require("./form-panel.vue.js"),p=require("./form-setting.vue.js"),{b:d}=l.useNamespace("main"),f={config:{theme:"dark",tags:["frontend","vue"]}},
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../internal.js");const s=require("../context/design.js");require("./index.js");const a=require("./types.js"),c=require("../utils/merge.js");require("@king-one/form-design/dist/theme-chalk/index.css");const l=require("../hooks/use-namespace/index.js"),g=require("./form-material.vue.js"),_=require("./form-panel.vue.js"),p=require("./form-setting.vue.js"),{b:d}=l.useNamespace("main"),f={config:{theme:"dark",tags:["frontend","vue"]}},v={config:{language:"zh-CN",tags:["typescript","javascript"]}},m=c.merge(f,v,{});console.log(m);const q=e.defineComponent({name:"FormDesign",props:a.FormDesignProps,setup(u,{slots:n}){const{toolbar:o,setting:r}=n,t=e.ref(!1);return s.useProvideDragContext({isDrag:t,updateDrag:i=>{t.value=i}}),s.useProvideDesignContext(u.design),()=>e.h("div",{class:d()},[e.h(g.default),e.h(_.default,{},{toolbar:o}),e.h(p.default,null,{default:()=>r==null?void 0:r()})])}});exports.default=q;
|