@king-one/form-design 0.0.1 → 0.0.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/index.mjs +14 -6
  3. package/dist/es/src/components/form-desgin.mjs +51 -19
  4. package/dist/es/src/components/form-material.vue.mjs +64 -53
  5. package/dist/es/src/components/form-panel.vue.mjs +76 -59
  6. package/dist/es/src/components/form-setting.vue.mjs +55 -56
  7. package/dist/es/src/components/panel/index.mjs +16 -6
  8. package/dist/es/src/components/panel/panel-item.vue.mjs +112 -2
  9. package/dist/es/src/components/panel/panel-item.vue2.mjs +2 -64
  10. package/dist/es/src/components/panel/panel-wrapper.mjs +34 -0
  11. package/dist/es/src/components/panel/widget/array-card.vue.mjs +4 -0
  12. package/dist/es/src/components/panel/widget/array-card.vue2.mjs +71 -0
  13. package/dist/es/src/components/panel/widget/object.vue.mjs +4 -0
  14. package/dist/es/src/components/panel/widget/object.vue2.mjs +71 -0
  15. package/dist/es/src/components/panel/widget/select.vue.mjs +4 -0
  16. package/dist/es/src/components/panel/widget/select.vue2.mjs +23 -0
  17. package/dist/es/src/components/props/form-props.vue.mjs +4 -0
  18. package/dist/es/src/components/props/form-props.vue2.mjs +68 -0
  19. package/dist/es/src/components/props/index.mjs +5 -2
  20. package/dist/es/src/components/props/widget/BaseProps.vue.mjs +4 -0
  21. package/dist/es/src/components/props/widget/BaseProps.vue2.mjs +63 -0
  22. package/dist/es/src/components/props/widget/InputNumberProps.vue.mjs +4 -0
  23. package/dist/es/src/components/props/widget/InputNumberProps.vue2.mjs +125 -0
  24. package/dist/es/src/components/props/widget/InputProps.vue.mjs +4 -0
  25. package/dist/es/src/components/props/widget/InputProps.vue2.mjs +80 -0
  26. package/dist/es/src/components/props/widget/TextareaProps.vue.mjs +4 -0
  27. package/dist/es/src/components/props/widget/TextareaProps.vue2.mjs +79 -0
  28. package/dist/es/src/components/props/widget/index.mjs +27 -0
  29. package/dist/es/src/config/index.mjs +53 -4
  30. package/dist/es/src/core/Design.mjs +50 -26
  31. package/dist/es/src/core/Field.mjs +18 -0
  32. package/dist/es/src/core/FormSchema.mjs +39 -12
  33. package/dist/es/src/effects/effect-dict.mjs +7 -0
  34. package/dist/es/src/effects/onEffects.mjs +12 -0
  35. package/dist/es/src/hooks/use-namespace/index.mjs +24 -24
  36. package/dist/es/src/index.mjs +14 -7
  37. package/dist/es/src/plugins/index.mjs +17 -0
  38. package/dist/es/src/utils/instanceof.mjs +9 -0
  39. package/dist/es/src/utils/isEmpty.mjs +41 -0
  40. package/dist/es/src/utils/merge.mjs +64 -0
  41. package/dist/lib/index.js +1 -1
  42. package/dist/lib/src/components/form-desgin.js +1 -1
  43. package/dist/lib/src/components/form-material.vue.js +1 -1
  44. package/dist/lib/src/components/form-panel.vue.js +2 -2
  45. package/dist/lib/src/components/form-setting.vue.js +1 -1
  46. package/dist/lib/src/components/panel/index.js +1 -1
  47. package/dist/lib/src/components/panel/panel-item.vue.js +1 -1
  48. package/dist/lib/src/components/panel/panel-item.vue2.js +1 -1
  49. package/dist/lib/src/components/panel/panel-wrapper.js +1 -0
  50. package/dist/lib/src/components/panel/widget/array-card.vue.js +1 -0
  51. package/dist/lib/src/components/panel/widget/array-card.vue2.js +1 -0
  52. package/dist/lib/src/components/panel/widget/object.vue.js +1 -0
  53. package/dist/lib/src/components/panel/widget/object.vue2.js +1 -0
  54. package/dist/lib/src/components/panel/widget/select.vue.js +1 -0
  55. package/dist/lib/src/components/panel/widget/select.vue2.js +1 -0
  56. package/dist/lib/src/components/props/form-props.vue.js +1 -0
  57. package/dist/lib/src/components/props/form-props.vue2.js +1 -0
  58. package/dist/lib/src/components/props/index.js +1 -1
  59. package/dist/lib/src/components/props/widget/BaseProps.vue.js +1 -0
  60. package/dist/lib/src/components/props/widget/BaseProps.vue2.js +1 -0
  61. package/dist/lib/src/components/props/widget/InputNumberProps.vue.js +1 -0
  62. package/dist/lib/src/components/props/widget/InputNumberProps.vue2.js +1 -0
  63. package/dist/lib/src/components/props/widget/InputProps.vue.js +1 -0
  64. package/dist/lib/src/components/props/widget/InputProps.vue2.js +1 -0
  65. package/dist/lib/src/components/props/widget/TextareaProps.vue.js +1 -0
  66. package/dist/lib/src/components/props/widget/TextareaProps.vue2.js +1 -0
  67. package/dist/lib/src/components/props/widget/index.js +1 -0
  68. package/dist/lib/src/config/index.js +1 -1
  69. package/dist/lib/src/core/Design.js +1 -1
  70. package/dist/lib/src/core/Field.js +1 -0
  71. package/dist/lib/src/core/FormSchema.js +1 -1
  72. package/dist/lib/src/effects/effect-dict.js +1 -0
  73. package/dist/lib/src/effects/onEffects.js +1 -0
  74. package/dist/lib/src/hooks/use-namespace/index.js +1 -1
  75. package/dist/lib/src/index.js +1 -1
  76. package/dist/lib/src/plugins/index.js +1 -0
  77. package/dist/lib/src/utils/instanceof.js +1 -0
  78. package/dist/lib/src/utils/isEmpty.js +1 -0
  79. package/dist/lib/src/utils/merge.js +1 -0
  80. package/dist/theme-chalk/fonts/iconfont.ttf +0 -0
  81. package/dist/theme-chalk/fonts/iconfont.woff +0 -0
  82. package/dist/theme-chalk/fonts/iconfont.woff2 +0 -0
  83. package/dist/theme-chalk/form-design.css +1 -1
  84. package/dist/theme-chalk/icon.css +1 -1
  85. package/dist/theme-chalk/index.css +1 -1
  86. package/dist/theme-chalk/material.css +1 -1
  87. package/dist/theme-chalk/panel-item.css +1 -1
  88. package/dist/theme-chalk/panel.css +1 -1
  89. package/dist/theme-chalk/setting.css +1 -1
  90. package/dist/types/src/components/form-panel.vue.d.ts +3 -1
  91. package/dist/types/src/components/panel/index.d.ts +2 -2
  92. package/dist/types/src/components/panel/panel-item.vue.d.ts +2 -0
  93. package/dist/types/src/components/panel/panel-wrapper.d.ts +11 -0
  94. package/dist/types/src/components/panel/widget/array-card.vue.d.ts +20 -0
  95. package/dist/types/src/components/panel/widget/object.vue.d.ts +20 -0
  96. package/dist/types/src/components/panel/widget/select.vue.d.ts +8 -0
  97. package/dist/types/src/components/props/index.d.ts +2 -2
  98. package/dist/types/src/components/props/widget/InputNumberProps.vue.d.ts +3 -0
  99. package/dist/types/src/components/props/widget/InputProps.vue.d.ts +3 -0
  100. package/dist/types/src/components/props/widget/TextareaProps.vue.d.ts +3 -0
  101. package/dist/types/src/components/props/widget/index.d.ts +8 -0
  102. package/dist/types/src/config/index.d.ts +1 -0
  103. package/dist/types/src/core/Design.d.ts +175 -18
  104. package/dist/types/src/core/Field.d.ts +6 -0
  105. package/dist/types/src/core/FormSchema.d.ts +33 -11
  106. package/dist/types/src/effects/onEffects.d.ts +2 -2
  107. package/dist/types/src/hooks/use-namespace/index.d.ts +1 -1
  108. package/dist/types/src/index.d.ts +3 -0
  109. package/dist/types/src/plugins/index.d.ts +8 -0
  110. package/dist/types/src/types.d.ts +36 -5
  111. package/dist/types/src/utils/instanceof.d.ts +2 -0
  112. package/dist/types/src/utils/isEmpty.d.ts +2 -0
  113. package/dist/types/src/utils/merge.d.ts +12 -0
  114. package/package.json +2 -1
  115. package/dist/es/src/components/props/base-props.vue.mjs +0 -60
  116. package/dist/es/src/components/props/base-props.vue2.mjs +0 -4
  117. package/dist/es/src/components/props/component-props.vue.mjs +0 -21
  118. package/dist/es/src/components/props/component-props.vue2.mjs +0 -4
  119. package/dist/lib/src/components/props/base-props.vue.js +0 -1
  120. package/dist/lib/src/components/props/base-props.vue2.js +0 -1
  121. package/dist/lib/src/components/props/component-props.vue.js +0 -1
  122. package/dist/lib/src/components/props/component-props.vue2.js +0 -1
  123. /package/dist/types/src/components/props/{base-props.vue.d.ts → form-props.vue.d.ts} +0 -0
  124. /package/dist/types/src/components/props/{component-props.vue.d.ts → widget/BaseProps.vue.d.ts} +0 -0
@@ -1,2 +1,5 @@
1
- import "./base-props.vue2.mjs";
2
- import "./component-props.vue2.mjs";
1
+ import "./form-props.vue.mjs";
2
+ import { widgetProps as t } from "./widget/index.mjs";
3
+ export {
4
+ t as widgetProps
5
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./BaseProps.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,63 @@
1
+ import { defineComponent as d, openBlock as u, createBlock as i, unref as e, withCtx as l, createElementVNode as m, createVNode as o, createTextVNode as p } from "vue";
2
+ import { CollapsePanel as s, Form as f, FormItem as a, Input as c, Switch as x } from "ant-design-vue";
3
+ import "../../../internal.mjs";
4
+ import "../../form-icon.vue.mjs";
5
+ import { useInjectDesignContext as k } from "../../../context/design.mjs";
6
+ import _ from "../../form-icon.vue2.mjs";
7
+ const V = /* @__PURE__ */ d({
8
+ __name: "BaseProps",
9
+ setup(v) {
10
+ const { checkedField: r } = k();
11
+ return (C, t) => (u(), i(e(s), null, {
12
+ header: l(() => t[2] || (t[2] = [
13
+ m(
14
+ "div",
15
+ null,
16
+ "基础设置",
17
+ -1
18
+ /* CACHED */
19
+ )
20
+ ])),
21
+ default: l(() => [
22
+ o(e(f), {
23
+ "label-col": { style: { width: "85px" } },
24
+ layout: "vertical"
25
+ }, {
26
+ default: l(() => [
27
+ o(e(a), { label: "字段标题" }, {
28
+ default: l(() => [
29
+ o(e(c), {
30
+ value: e(r).title,
31
+ "onUpdate:value": t[0] || (t[0] = (n) => e(r).title = n)
32
+ }, null, 8, ["value"])
33
+ ]),
34
+ _: 1
35
+ /* STABLE */
36
+ }),
37
+ o(e(a), { label: "是否必填" }, {
38
+ extra: l(() => [
39
+ o(_, { name: "sound" }),
40
+ t[3] || (t[3] = p(" 表单字段设置为必填才能作为审批条件 "))
41
+ ]),
42
+ default: l(() => [
43
+ o(e(x), {
44
+ checked: e(r).required,
45
+ "onUpdate:checked": t[1] || (t[1] = (n) => e(r).required = n)
46
+ }, null, 8, ["checked"])
47
+ ]),
48
+ _: 1
49
+ /* STABLE */
50
+ })
51
+ ]),
52
+ _: 1
53
+ /* STABLE */
54
+ })
55
+ ]),
56
+ _: 1
57
+ /* STABLE */
58
+ }));
59
+ }
60
+ });
61
+ export {
62
+ V as default
63
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./InputNumberProps.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,125 @@
1
+ import { defineComponent as i, computed as v, openBlock as m, createBlock as s, unref as l, withCtx as n, createElementVNode as f, createVNode as a } from "vue";
2
+ import { CollapsePanel as b, Form as x, FormItem as o, InputNumber as d, Switch as k, Input as r } from "ant-design-vue";
3
+ import "../../../internal.mjs";
4
+ import { useInjectDesignContext as w } from "../../../context/design.mjs";
5
+ const c = /* @__PURE__ */ i({
6
+ __name: "InputNumberProps",
7
+ setup(U) {
8
+ const { checkedField: p } = w(), t = v(() => p.value["k-component-props"] || {});
9
+ return (y, e) => (m(), s(l(b), { key: "input-number-props" }, {
10
+ header: n(() => e[7] || (e[7] = [
11
+ f(
12
+ "div",
13
+ null,
14
+ "属性设置",
15
+ -1
16
+ /* CACHED */
17
+ )
18
+ ])),
19
+ default: n(() => [
20
+ a(l(x), {
21
+ "label-col": { style: { width: "100px" } },
22
+ "label-align": "left"
23
+ }, {
24
+ default: n(() => [
25
+ a(l(o), { label: "最大值" }, {
26
+ default: n(() => [
27
+ a(l(d), {
28
+ value: t.value.max,
29
+ "onUpdate:value": e[0] || (e[0] = (u) => t.value.max = u),
30
+ style: { width: "100%" },
31
+ min: 1,
32
+ precision: 0,
33
+ max: 999
34
+ }, null, 8, ["value"])
35
+ ]),
36
+ _: 1
37
+ /* STABLE */
38
+ }),
39
+ a(l(o), { label: "最小值" }, {
40
+ default: n(() => [
41
+ a(l(d), {
42
+ value: t.value.min,
43
+ "onUpdate:value": e[1] || (e[1] = (u) => t.value.min = u),
44
+ style: { width: "100%" },
45
+ min: 1,
46
+ precision: 0,
47
+ max: 999
48
+ }, null, 8, ["value"])
49
+ ]),
50
+ _: 1
51
+ /* STABLE */
52
+ }),
53
+ a(l(o), { label: "小数点位数" }, {
54
+ default: n(() => [
55
+ a(l(d), {
56
+ value: t.value.precision,
57
+ "onUpdate:value": e[2] || (e[2] = (u) => t.value.precision = u),
58
+ style: { width: "100%" },
59
+ min: 1,
60
+ precision: 0,
61
+ max: 999
62
+ }, null, 8, ["value"])
63
+ ]),
64
+ _: 1
65
+ /* STABLE */
66
+ }),
67
+ a(l(o), { label: "步长" }, {
68
+ default: n(() => [
69
+ a(l(d), {
70
+ value: t.value.step,
71
+ "onUpdate:value": e[3] || (e[3] = (u) => t.value.step = u),
72
+ style: { width: "100%" },
73
+ min: 1,
74
+ precision: 0,
75
+ max: 999
76
+ }, null, 8, ["value"])
77
+ ]),
78
+ _: 1
79
+ /* STABLE */
80
+ }),
81
+ a(l(o), { label: "显示增减按钮" }, {
82
+ default: n(() => [
83
+ a(l(k), {
84
+ checked: t.value.controls,
85
+ "onUpdate:checked": e[4] || (e[4] = (u) => t.value.controls = u)
86
+ }, null, 8, ["checked"])
87
+ ]),
88
+ _: 1
89
+ /* STABLE */
90
+ }),
91
+ a(l(o), { label: "前缀内容" }, {
92
+ default: n(() => [
93
+ a(l(r), {
94
+ value: t.value.addonBefore,
95
+ "onUpdate:value": e[5] || (e[5] = (u) => t.value.addonBefore = u),
96
+ placeholder: "请输入前缀内容"
97
+ }, null, 8, ["value"])
98
+ ]),
99
+ _: 1
100
+ /* STABLE */
101
+ }),
102
+ a(l(o), { label: "后缀内容" }, {
103
+ default: n(() => [
104
+ a(l(r), {
105
+ value: t.value.addonAfter,
106
+ "onUpdate:value": e[6] || (e[6] = (u) => t.value.addonAfter = u),
107
+ placeholder: "请输入前缀内容"
108
+ }, null, 8, ["value"])
109
+ ]),
110
+ _: 1
111
+ /* STABLE */
112
+ })
113
+ ]),
114
+ _: 1
115
+ /* STABLE */
116
+ })
117
+ ]),
118
+ _: 1
119
+ /* STABLE */
120
+ }));
121
+ }
122
+ });
123
+ export {
124
+ c as default
125
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./InputProps.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,80 @@
1
+ import { defineComponent as p, computed as v, openBlock as f, createBlock as m, unref as l, withCtx as u, createElementVNode as i, createVNode as a } from "vue";
2
+ import { CollapsePanel as s, Form as c, FormItem as r, Input as n, Switch as k } from "ant-design-vue";
3
+ import "../../../internal.mjs";
4
+ import { useInjectDesignContext as C } from "../../../context/design.mjs";
5
+ const _ = /* @__PURE__ */ p({
6
+ __name: "InputProps",
7
+ setup(b) {
8
+ const { checkedField: d } = C(), o = v(() => d.value["k-component-props"] || {});
9
+ return (w, e) => (f(), m(l(s), { key: "input-props" }, {
10
+ header: u(() => e[4] || (e[4] = [
11
+ i(
12
+ "div",
13
+ null,
14
+ "属性设置",
15
+ -1
16
+ /* CACHED */
17
+ )
18
+ ])),
19
+ default: u(() => [
20
+ a(l(c), { layout: "vertical" }, {
21
+ default: u(() => [
22
+ a(l(r), {
23
+ label: "输入提示",
24
+ tooltip: "输入提示"
25
+ }, {
26
+ default: u(() => [
27
+ a(l(n), {
28
+ value: o.value.placeholder,
29
+ "onUpdate:value": e[0] || (e[0] = (t) => o.value.placeholder = t),
30
+ placeholder: "请输入占位提示"
31
+ }, null, 8, ["value"])
32
+ ]),
33
+ _: 1
34
+ /* STABLE */
35
+ }),
36
+ a(l(r), { label: "允许清除内容(显示清除图标)" }, {
37
+ default: u(() => [
38
+ a(l(k), {
39
+ checked: o.value.allowClear,
40
+ "onUpdate:checked": e[1] || (e[1] = (t) => o.value.allowClear = t)
41
+ }, null, 8, ["checked"])
42
+ ]),
43
+ _: 1
44
+ /* STABLE */
45
+ }),
46
+ a(l(r), { label: "前缀内容" }, {
47
+ default: u(() => [
48
+ a(l(n), {
49
+ value: o.value.addonBefore,
50
+ "onUpdate:value": e[2] || (e[2] = (t) => o.value.addonBefore = t),
51
+ placeholder: "请输入前缀内容"
52
+ }, null, 8, ["value"])
53
+ ]),
54
+ _: 1
55
+ /* STABLE */
56
+ }),
57
+ a(l(r), { label: "后缀内容" }, {
58
+ default: u(() => [
59
+ a(l(n), {
60
+ value: o.value.addonAfter,
61
+ "onUpdate:value": e[3] || (e[3] = (t) => o.value.addonAfter = t),
62
+ placeholder: "请输入后缀内容"
63
+ }, null, 8, ["value"])
64
+ ]),
65
+ _: 1
66
+ /* STABLE */
67
+ })
68
+ ]),
69
+ _: 1
70
+ /* STABLE */
71
+ })
72
+ ]),
73
+ _: 1
74
+ /* STABLE */
75
+ }));
76
+ }
77
+ });
78
+ export {
79
+ _ as default
80
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./TextareaProps.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,79 @@
1
+ import { defineComponent as p, computed as m, openBlock as s, createBlock as v, unref as l, withCtx as u, createElementVNode as i, createVNode as t } from "vue";
2
+ import { CollapsePanel as c, Form as f, FormItem as n, Input as k, Switch as r, InputNumber as h } from "ant-design-vue";
3
+ import "../../../internal.mjs";
4
+ import { useInjectDesignContext as x } from "../../../context/design.mjs";
5
+ const g = /* @__PURE__ */ p({
6
+ __name: "TextareaProps",
7
+ setup(C) {
8
+ const { checkedField: d } = x(), a = m(() => d.value["k-component-props"] || {});
9
+ return (w, e) => (s(), v(l(c), { key: "textarea-props" }, {
10
+ header: u(() => e[4] || (e[4] = [
11
+ i(
12
+ "div",
13
+ null,
14
+ "属性设置",
15
+ -1
16
+ /* CACHED */
17
+ )
18
+ ])),
19
+ default: u(() => [
20
+ t(l(f), { layout: "vertical" }, {
21
+ default: u(() => [
22
+ t(l(n), { label: "占位提示" }, {
23
+ default: u(() => [
24
+ t(l(k), {
25
+ value: a.value.placeholder,
26
+ "onUpdate:value": e[0] || (e[0] = (o) => a.value.placeholder = o),
27
+ placeholder: "请输入占位提示"
28
+ }, null, 8, ["value"])
29
+ ]),
30
+ _: 1
31
+ /* STABLE */
32
+ }),
33
+ t(l(n), { label: "允许清除内容(显示清除图标)" }, {
34
+ default: u(() => [
35
+ t(l(r), {
36
+ checked: a.value.allowClear,
37
+ "onUpdate:checked": e[1] || (e[1] = (o) => a.value.allowClear = o)
38
+ }, null, 8, ["checked"])
39
+ ]),
40
+ _: 1
41
+ /* STABLE */
42
+ }),
43
+ t(l(n), { label: "是否展示字数" }, {
44
+ default: u(() => [
45
+ t(l(r), {
46
+ checked: a.value.showCount,
47
+ "onUpdate:checked": e[2] || (e[2] = (o) => a.value.showCount = o)
48
+ }, null, 8, ["checked"])
49
+ ]),
50
+ _: 1
51
+ /* STABLE */
52
+ }),
53
+ t(l(n), { label: "最大长度" }, {
54
+ default: u(() => [
55
+ t(l(h), {
56
+ value: a.value.maxlength,
57
+ "onUpdate:value": e[3] || (e[3] = (o) => a.value.maxlength = o),
58
+ style: { width: "100%" },
59
+ min: 1,
60
+ precision: 0,
61
+ max: 999
62
+ }, null, 8, ["value"])
63
+ ]),
64
+ _: 1
65
+ /* STABLE */
66
+ })
67
+ ]),
68
+ _: 1
69
+ /* STABLE */
70
+ })
71
+ ]),
72
+ _: 1
73
+ /* STABLE */
74
+ }));
75
+ }
76
+ });
77
+ export {
78
+ g as default
79
+ };
@@ -0,0 +1,27 @@
1
+ import "./InputProps.vue.mjs";
2
+ import "./TextareaProps.vue.mjs";
3
+ import "./InputNumberProps.vue.mjs";
4
+ import "./BaseProps.vue.mjs";
5
+ import t from "./InputProps.vue2.mjs";
6
+ import m from "./TextareaProps.vue2.mjs";
7
+ import n from "./InputNumberProps.vue2.mjs";
8
+ import o from "./BaseProps.vue2.mjs";
9
+ const _ = {
10
+ "k-input": t,
11
+ "k-textarea": m,
12
+ "k-input-number": n
13
+ }, k = {
14
+ "k-input": {
15
+ component: [o, t]
16
+ },
17
+ "k-textarea": {
18
+ component: [o, m]
19
+ },
20
+ "k-input-number": {
21
+ component: [o, n]
22
+ }
23
+ };
24
+ export {
25
+ _ as components,
26
+ k as widgetProps
27
+ };
@@ -4,7 +4,7 @@ const e = {
4
4
  widget: [
5
5
  {
6
6
  title: "表单布局",
7
- icon: "form-grid",
7
+ icon: "k-form-grid",
8
8
  key: "form-layout",
9
9
  type: "void",
10
10
  "k-component": "FormLayout"
@@ -16,7 +16,7 @@ const e = {
16
16
  widget: [
17
17
  {
18
18
  title: "输入框",
19
- key: "input",
19
+ key: "k-input",
20
20
  type: "string",
21
21
  icon: "form-input",
22
22
  "k-component": "Input",
@@ -26,7 +26,7 @@ const e = {
26
26
  },
27
27
  {
28
28
  title: "多文本输入框",
29
- key: "textarea",
29
+ key: "k-textarea",
30
30
  type: "string",
31
31
  icon: "form-textarea",
32
32
  "k-component": "Textarea",
@@ -36,17 +36,66 @@ const e = {
36
36
  },
37
37
  {
38
38
  title: "数字输入框",
39
- key: "input-number",
39
+ key: "k-input-number",
40
40
  type: "number",
41
41
  icon: "form-number",
42
42
  "k-component": "InputNumber",
43
43
  "k-component-props": {
44
44
  placeholder: "请输入"
45
45
  }
46
+ },
47
+ {
48
+ title: "下拉选择框",
49
+ key: "k-select",
50
+ type: "string",
51
+ icon: "form-select",
52
+ "k-component": "Select",
53
+ enum: [
54
+ {
55
+ label: "选项1",
56
+ value: "1"
57
+ },
58
+ {
59
+ label: "选项2",
60
+ value: "2"
61
+ }
62
+ ],
63
+ "k-component-props": {
64
+ placeholder: "请选择"
65
+ }
66
+ }
67
+ ]
68
+ }, o = {
69
+ name: "扩展组件",
70
+ key: "extend",
71
+ widget: [
72
+ {
73
+ title: "对象容器",
74
+ key: "k-object",
75
+ type: "object",
76
+ icon: "form-object",
77
+ "k-component": "FormLayout",
78
+ children: []
79
+ },
80
+ {
81
+ title: "数组容器",
82
+ key: "k-array-card",
83
+ type: "array",
84
+ icon: "form-list",
85
+ children: [],
86
+ "k-component": "FormLayout"
87
+ },
88
+ {
89
+ title: "明细表",
90
+ key: "k-table",
91
+ type: "array",
92
+ icon: "form-table",
93
+ "k-component": "FormLayout"
46
94
  }
47
95
  ]
48
96
  };
49
97
  export {
50
98
  t as BaseSchema,
99
+ o as ExtendSchema,
51
100
  e as LayoutSchema
52
101
  };
@@ -1,44 +1,68 @@
1
1
  var m = Object.defineProperty;
2
- var n = (r, e, t) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => n(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { ref as i } from "vue";
2
+ var p = (s, e, r) => e in s ? m(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
+ var t = (s, e, r) => p(s, typeof e != "symbol" ? e + "" : e, r);
4
+ import { ref as n } from "vue";
5
5
  import "../effects/index.mjs";
6
- import { panels as c } from "../components/panel/index.mjs";
7
- import { Heart as h } from "./Heart.mjs";
8
- import { FormSchema as f } from "./FormSchema.mjs";
9
- import { runEffects as a } from "../effects/effective.mjs";
10
- class y {
6
+ import { widgetPanels as c } from "../components/panel/index.mjs";
7
+ import "../components/props/index.mjs";
8
+ import { Plugin as g } from "../plugins/index.mjs";
9
+ import { Heart as a } from "./Heart.mjs";
10
+ import { FormSchema as d } from "./FormSchema.mjs";
11
+ import { widgetProps as f } from "../components/props/widget/index.mjs";
12
+ import { runEffects as l } from "../effects/effective.mjs";
13
+ class b {
11
14
  constructor(e) {
12
- o(this, "schema");
13
- o(this, "heart");
14
- o(this, "FormSchema", new f());
15
- o(this, "props");
16
- o(this, "checkedField", i({}));
17
- const { propsComponents: t, panelComponents: s, ...p } = e;
18
- this.props = { propsComponents: { ...t }, panelComponents: { ...c, ...s }, ...p }, this.schema = e.schema, this.heart = new h({
15
+ t(this, "schema");
16
+ t(this, "heart");
17
+ t(this, "plugin");
18
+ t(this, "FormSchema", new d());
19
+ t(this, "props");
20
+ t(this, "checkedField", n({}));
21
+ t(this, "shared", {
22
+ draggedContext: {
23
+ key: ""
24
+ },
25
+ panelWidgets: {},
26
+ widgetProps: {}
27
+ });
28
+ t(this, "extendFormProps", []);
29
+ t(this, "notify", (e, ...r) => {
30
+ this.heart.publish(e, ...r);
31
+ });
32
+ const { extendFormProps: r = [], propsWidgets: i = {}, panelWidgets: o = {}, ...h } = e;
33
+ this.shared.panelWidgets = {
34
+ ...c,
35
+ ...o
36
+ }, this.shared.widgetProps = {
37
+ ...f,
38
+ ...i
39
+ }, this.props = { ...h }, this.schema = e.schema, this.plugin = new g(), this.heart = new a({
19
40
  lifecycles: this.lifecycles,
20
41
  context: this
21
- });
42
+ }), this.extendFormProps = r;
22
43
  }
23
- get lifecycles() {
24
- return this.props.effects ? a(this, this.props.effects) : [];
44
+ use(e) {
45
+ this.plugin.use(e);
25
46
  }
26
47
  getFormSchema() {
27
48
  return this.FormSchema.getSchema();
28
49
  }
29
- get formProps() {
50
+ getFieldList() {
51
+ return this.FormSchema.getFieldList();
52
+ }
53
+ get lifecycles() {
54
+ return this.props.effects ? l(this, this.props.effects) : [];
55
+ }
56
+ getFormProps() {
30
57
  return this.FormSchema.formProps;
31
58
  }
59
+ get hooks() {
60
+ return this.plugin.hooks;
61
+ }
32
62
  get fields() {
33
63
  return this.FormSchema.fields;
34
64
  }
35
- get propsComponents() {
36
- return this.props.propsComponents;
37
- }
38
- get panelComponents() {
39
- return this.props.panelComponents;
40
- }
41
65
  }
42
66
  export {
43
- y as FormDesign
67
+ b as FormDesign
44
68
  };
@@ -0,0 +1,18 @@
1
+ var t = Object.defineProperty;
2
+ var l = (e, i, s) => i in e ? t(e, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[i] = s;
3
+ var d = (e, i, s) => l(e, typeof i != "symbol" ? i + "" : i, s);
4
+ class p {
5
+ constructor(i) {
6
+ d(this, "field");
7
+ this.field = i;
8
+ }
9
+ upDateValidate(i, s) {
10
+ this.field["k-design-props"] && (this.field["k-design-props"].validate = {
11
+ status: i,
12
+ message: s
13
+ });
14
+ }
15
+ }
16
+ export {
17
+ p as Field
18
+ };
@@ -1,27 +1,54 @@
1
- var i = Object.defineProperty;
2
- var a = (e, o, r) => o in e ? i(e, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[o] = r;
3
- var s = (e, o, r) => a(e, typeof o != "symbol" ? o + "" : o, r);
4
- import { reactive as l, ref as f, toRaw as t } from "vue";
5
- class c {
1
+ var a = Object.defineProperty;
2
+ var l = (s, e, t) => e in s ? a(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var i = (s, e, t) => l(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { reactive as m, ref as c, toRaw as n } from "vue";
5
+ import { uid as h } from "@king-one/utils";
6
+ import { Field as f } from "./Field.mjs";
7
+ class j {
6
8
  constructor() {
7
- s(this, "version", "1.0.0");
8
- s(this, "formProps", l({
9
+ i(this, "version", "1.0.0");
10
+ i(this, "formProps", m({
9
11
  layout: "horizontal",
10
12
  labelAlign: "left"
11
13
  }));
12
- s(this, "fields", f([]));
14
+ i(this, "fields", c([]));
13
15
  }
14
16
  getSchema() {
15
- const o = t(this.fields.value), r = t(this.formProps);
17
+ const e = n(this.fields.value), t = n(this.formProps), r = this.jsonToschema(e);
16
18
  return {
17
19
  version: this.version,
18
20
  form: {
19
- ...r,
20
- schema: o
21
+ ...t,
22
+ schema: r
21
23
  }
22
24
  };
23
25
  }
26
+ getFieldList() {
27
+ return this.fields.value.map((e) => new f(e));
28
+ }
29
+ jsonToschema(e, t = {}) {
30
+ return e.forEach((r) => {
31
+ const o = this.omit(r, ["children"]);
32
+ o.type === "object" || o.type === "void" ? t[o.name] = {
33
+ ...o,
34
+ properties: this.jsonToschema(r.children)
35
+ } : o.type === "array" ? t[o.name] = {
36
+ ...o,
37
+ items: {
38
+ type: "object",
39
+ id: h(),
40
+ properties: this.jsonToschema(r.children)
41
+ }
42
+ } : t[o.name] = o;
43
+ }), t;
44
+ }
45
+ omit(e, t) {
46
+ const r = { ...e };
47
+ return t.forEach((o) => {
48
+ delete r[o];
49
+ }), r;
50
+ }
24
51
  }
25
52
  export {
26
- c as FormSchema
53
+ j as FormSchema
27
54
  };