@king-one/form-antdv 0.0.13 → 0.0.14
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 +8 -0
- package/dist/es/src/components/ArrayCard/array-card.vue2.mjs +34 -34
- package/dist/es/src/components/ArrayTable/array-table.vue2.mjs +28 -28
- package/dist/lib/src/components/ArrayCard/array-card.vue2.js +1 -1
- package/dist/lib/src/components/ArrayTable/array-table.vue2.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Card as C, Empty as
|
|
1
|
+
import { defineComponent as A, mergeModels as B, useModel as E, computed as f, toRaw as N, openBlock as a, createElementBlock as d, normalizeClass as F, unref as n, createBlock as v, withCtx as l, createElementVNode as o, toDisplayString as h, createVNode as k, Fragment as _, renderList as g, createTextVNode as M } from "vue";
|
|
2
|
+
import { Card as C, Empty as S, Button as V } from "ant-design-vue";
|
|
3
3
|
import "../../internal.mjs";
|
|
4
|
-
import { useNamespace as
|
|
4
|
+
import { useNamespace as j } from "../../hooks/use-namespace/index.mjs";
|
|
5
5
|
import { useInjectFieldContext as D, RecursionField as I } from "@king-one/form-render";
|
|
6
|
-
const R = { class: "title-box" }, z = ["onClick"], H = /* @__PURE__ */
|
|
6
|
+
const R = { class: "title-box" }, z = ["onClick"], H = /* @__PURE__ */ A({
|
|
7
7
|
__name: "array-card",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ B({
|
|
9
9
|
title: {
|
|
10
10
|
type: String,
|
|
11
11
|
default: "默认标题"
|
|
@@ -16,64 +16,64 @@ const R = { class: "title-box" }, z = ["onClick"], H = /* @__PURE__ */ B({
|
|
|
16
16
|
}),
|
|
17
17
|
emits: ["update:value"],
|
|
18
18
|
setup(m) {
|
|
19
|
-
const b =
|
|
19
|
+
const b = j("ArrayCard"), e = D(), r = E(m, "value"), y = f(() => {
|
|
20
20
|
var t;
|
|
21
21
|
return ((t = e == null ? void 0 : e.path) == null ? void 0 : t.toString()) || "";
|
|
22
|
-
}),
|
|
22
|
+
}), p = f(() => !(e != null && e.schema.items) || Array.isArray(e == null ? void 0 : e.schema.items) ? {} : (e == null ? void 0 : e.schema.items.properties) || {});
|
|
23
23
|
function $() {
|
|
24
|
-
if (
|
|
24
|
+
if (r.value) {
|
|
25
25
|
const t = {};
|
|
26
|
-
Object.keys(
|
|
27
|
-
const u =
|
|
28
|
-
t[
|
|
29
|
-
}),
|
|
26
|
+
Object.keys(p.value).forEach((s) => {
|
|
27
|
+
const u = p.value[s].type || "string";
|
|
28
|
+
t[s] = u === "number" ? 0 : "";
|
|
29
|
+
}), r.value = [...N(r.value || []), t];
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
function x(t) {
|
|
33
33
|
e && (e == null || e.remove(t));
|
|
34
34
|
}
|
|
35
|
-
return (t,
|
|
35
|
+
return (t, s) => {
|
|
36
36
|
var u;
|
|
37
|
-
return a(),
|
|
37
|
+
return a(), d(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
40
|
-
class:
|
|
40
|
+
class: F(n(b).b())
|
|
41
41
|
},
|
|
42
42
|
[
|
|
43
|
-
(u =
|
|
43
|
+
(u = r.value) != null && u.length ? (a(!0), d(
|
|
44
44
|
_,
|
|
45
45
|
{ key: 1 },
|
|
46
|
-
g(
|
|
46
|
+
g(r.value, (L, i) => (a(), v(
|
|
47
47
|
n(C),
|
|
48
48
|
{
|
|
49
49
|
key: i,
|
|
50
50
|
style: { "margin-bottom": "12px" }
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
title:
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
title: l(() => [
|
|
54
|
+
o("div", R, [
|
|
55
|
+
o(
|
|
56
56
|
"span",
|
|
57
57
|
null,
|
|
58
58
|
"#" + h(i + 1) + " " + h(m.title),
|
|
59
59
|
1
|
|
60
60
|
/* TEXT */
|
|
61
61
|
),
|
|
62
|
-
|
|
62
|
+
o("span", {
|
|
63
63
|
class: "delete-btn",
|
|
64
64
|
onClick: (c) => x(i)
|
|
65
65
|
}, "删除", 8, z)
|
|
66
66
|
])
|
|
67
67
|
]),
|
|
68
|
-
default:
|
|
69
|
-
(a(!0),
|
|
68
|
+
default: l(() => [
|
|
69
|
+
(a(!0), d(
|
|
70
70
|
_,
|
|
71
71
|
null,
|
|
72
|
-
g(
|
|
73
|
-
key: `${
|
|
72
|
+
g(p.value, (c, w) => (a(), v(n(I), {
|
|
73
|
+
key: `${y.value}.${w}.${c.name}`,
|
|
74
74
|
schema: c,
|
|
75
75
|
name: c.name,
|
|
76
|
-
"base-path": `${
|
|
76
|
+
"base-path": `${y.value}.${i}`
|
|
77
77
|
}, null, 8, ["schema", "name", "base-path"]))),
|
|
78
78
|
128
|
|
79
79
|
/* KEYED_FRAGMENT */
|
|
@@ -88,9 +88,9 @@ const R = { class: "title-box" }, z = ["onClick"], H = /* @__PURE__ */ B({
|
|
|
88
88
|
128
|
|
89
89
|
/* KEYED_FRAGMENT */
|
|
90
90
|
)) : (a(), v(n(C), { key: 0 }, {
|
|
91
|
-
title:
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
title: l(() => [
|
|
92
|
+
o("div", null, [
|
|
93
|
+
o(
|
|
94
94
|
"span",
|
|
95
95
|
null,
|
|
96
96
|
h(m.title),
|
|
@@ -99,19 +99,19 @@ const R = { class: "title-box" }, z = ["onClick"], H = /* @__PURE__ */ B({
|
|
|
99
99
|
)
|
|
100
100
|
])
|
|
101
101
|
]),
|
|
102
|
-
default:
|
|
103
|
-
k(n(
|
|
102
|
+
default: l(() => [
|
|
103
|
+
k(n(S), { description: "暂无数据" })
|
|
104
104
|
]),
|
|
105
105
|
_: 1
|
|
106
106
|
/* STABLE */
|
|
107
107
|
})),
|
|
108
|
-
k(n(
|
|
108
|
+
k(n(V), {
|
|
109
109
|
type: "dashed",
|
|
110
110
|
style: { "margin-top": "10px", width: "100%" },
|
|
111
111
|
onClick: $
|
|
112
112
|
}, {
|
|
113
|
-
default:
|
|
114
|
-
|
|
113
|
+
default: l(() => s[0] || (s[0] = [
|
|
114
|
+
M(" 添加 ")
|
|
115
115
|
])),
|
|
116
116
|
_: 1,
|
|
117
117
|
__: [0]
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
1
|
+
import { defineComponent as g, mergeModels as k, computed as m, useModel as C, toRaw as w, openBlock as s, createElementBlock as d, normalizeClass as A, unref as a, createVNode as r, withCtx as l, Fragment as B, renderList as T, createBlock as $, createTextVNode as c } from "vue";
|
|
2
|
+
import { Table as F, TableColumn as p, Button as f } from "ant-design-vue";
|
|
3
3
|
import "../../internal.mjs";
|
|
4
|
-
import { useInjectFieldContext as
|
|
5
|
-
import { useNamespace as
|
|
6
|
-
const E = /* @__PURE__ */
|
|
4
|
+
import { useInjectFieldContext as M, RecursionField as N } from "@king-one/form-render";
|
|
5
|
+
import { useNamespace as z } from "../../hooks/use-namespace/index.mjs";
|
|
6
|
+
const E = /* @__PURE__ */ g({
|
|
7
7
|
__name: "array-table",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ k({
|
|
9
9
|
title: {
|
|
10
10
|
type: String,
|
|
11
11
|
default: "默认标题"
|
|
@@ -16,43 +16,43 @@ const E = /* @__PURE__ */ k({
|
|
|
16
16
|
}),
|
|
17
17
|
emits: ["update:value"],
|
|
18
18
|
setup(v) {
|
|
19
|
-
const e =
|
|
19
|
+
const e = M(), h = z("ArrayTable"), _ = m(() => {
|
|
20
20
|
var n;
|
|
21
21
|
return ((n = e == null ? void 0 : e.path) == null ? void 0 : n.toString()) || "";
|
|
22
|
-
}), i =
|
|
23
|
-
function
|
|
22
|
+
}), i = C(v, "value"), x = m(() => !(e != null && e.schema.items) || Array.isArray(e == null ? void 0 : e.schema.items) ? {} : (e == null ? void 0 : e.schema.items.properties) || {});
|
|
23
|
+
function y() {
|
|
24
24
|
i.value && (i.value = [...w(i.value || []), {}]);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function b(n) {
|
|
27
27
|
e && e.remove(n);
|
|
28
28
|
}
|
|
29
|
-
return (n, o) => (
|
|
29
|
+
return (n, o) => (s(), d(
|
|
30
30
|
"div",
|
|
31
31
|
{
|
|
32
|
-
class:
|
|
32
|
+
class: A(a(h).b())
|
|
33
33
|
},
|
|
34
34
|
[
|
|
35
|
-
|
|
35
|
+
r(a(F), {
|
|
36
36
|
"data-source": i.value,
|
|
37
37
|
pagination: !1,
|
|
38
38
|
bordered: "",
|
|
39
39
|
size: "middle"
|
|
40
40
|
}, {
|
|
41
|
-
default:
|
|
42
|
-
(
|
|
43
|
-
|
|
41
|
+
default: l(() => [
|
|
42
|
+
(s(!0), d(
|
|
43
|
+
B,
|
|
44
44
|
null,
|
|
45
|
-
|
|
45
|
+
T(x.value, (t) => (s(), $(a(p), {
|
|
46
46
|
key: `${t.name}`,
|
|
47
47
|
align: "center",
|
|
48
48
|
title: t.title,
|
|
49
49
|
"data-index": t.name
|
|
50
50
|
}, {
|
|
51
|
-
default:
|
|
52
|
-
|
|
51
|
+
default: l(({ index: u }) => [
|
|
52
|
+
r(a(N), {
|
|
53
53
|
schema: t,
|
|
54
54
|
name: t.name,
|
|
55
|
-
"base-path": `${
|
|
55
|
+
"base-path": `${_.value}.${u}`
|
|
56
56
|
}, null, 8, ["schema", "name", "base-path"])
|
|
57
57
|
]),
|
|
58
58
|
_: 2
|
|
@@ -61,18 +61,18 @@ const E = /* @__PURE__ */ k({
|
|
|
61
61
|
128
|
|
62
62
|
/* KEYED_FRAGMENT */
|
|
63
63
|
)),
|
|
64
|
-
|
|
64
|
+
r(a(p), {
|
|
65
65
|
title: "操作",
|
|
66
66
|
"data-index": "action",
|
|
67
67
|
align: "center",
|
|
68
68
|
width: "100px"
|
|
69
69
|
}, {
|
|
70
|
-
default:
|
|
71
|
-
|
|
70
|
+
default: l(({ index: t }) => [
|
|
71
|
+
r(a(f), {
|
|
72
72
|
type: "link",
|
|
73
|
-
onClick: (
|
|
73
|
+
onClick: (u) => b(t)
|
|
74
74
|
}, {
|
|
75
|
-
default:
|
|
75
|
+
default: l(() => o[0] || (o[0] = [
|
|
76
76
|
c(" 删除 ")
|
|
77
77
|
])),
|
|
78
78
|
_: 2,
|
|
@@ -86,12 +86,12 @@ const E = /* @__PURE__ */ k({
|
|
|
86
86
|
_: 1
|
|
87
87
|
/* STABLE */
|
|
88
88
|
}, 8, ["data-source"]),
|
|
89
|
-
|
|
89
|
+
r(a(f), {
|
|
90
90
|
type: "dashed",
|
|
91
91
|
style: { "margin-top": "10px", width: "100%" },
|
|
92
|
-
onClick:
|
|
92
|
+
onClick: y
|
|
93
93
|
}, {
|
|
94
|
-
default:
|
|
94
|
+
default: l(() => o[1] || (o[1] = [
|
|
95
95
|
c(" 添加 ")
|
|
96
96
|
])),
|
|
97
97
|
_: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("ant-design-vue");require("../../internal.js");const y=require("../../hooks/use-namespace/index.js"),d=require("@king-one/form-render"),g={class:"title-box"},f=["onClick"],C=e.defineComponent({__name:"array-card",props:e.mergeModels({title:{type:String,default:"默认标题"}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(c){const p=y.useNamespace("ArrayCard"),t=d.useInjectFieldContext(),r=e.useModel(c,"value"),m=e.computed(()=>{var n;return((n=t==null?void 0:t.path)==null?void 0:n.toString())||""}),i=e.computed(()=>!(t!=null&&t.schema.items)||Array.isArray(t==null?void 0:t.schema.items)?{}:(t==null?void 0:t.schema.items.properties)||{});function v(){if(r.value){const n={};Object.keys(i.value).forEach(a=>{const l=i.value[a].type||"string";n[a]=l==="number"?0:""}),r.value=[...e.toRaw(r.value||[]),n]}}function h(n){t&&(t==null||t.remove(n))}return(n,a)=>{var l;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(p).b())},[(l=r.value)!=null&&l.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(r.value,(B,o)=>(e.openBlock(),e.createBlock(e.unref(u.Card),{key:o,style:{"margin-bottom":"12px"}},{title:e.withCtx(()=>[e.createElementVNode("div",g,[e.createElementVNode("span",null,"#"+e.toDisplayString(o+1)+" "+e.toDisplayString(c.title),1),e.createElementVNode("span",{class:"delete-btn",onClick:s=>h(o)},"删除",8,f)])]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(s,k)=>(e.openBlock(),e.createBlock(e.unref(d.RecursionField),{key:`${m.value}.${k}.${s.name}`,schema:s,name:s.name,"base-path":`${m.value}.${o}`},null,8,["schema","name","base-path"]))),128))]),_:2},1024))),128)):(e.openBlock(),e.createBlock(e.unref(u.Card),{key:0},{title:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("span",null,e.toDisplayString(c.title),1)])]),default:e.withCtx(()=>[e.createVNode(e.unref(u.Empty),{description:"暂无数据"})]),_:1})),e.createVNode(e.unref(u.Button),{type:"dashed",style:{"margin-top":"10px",width:"100%"},onClick:v},{default:e.withCtx(()=>a[0]||(a[0]=[e.createTextVNode(" 添加 ")])),_:1,__:[0]})],2)}}});exports.default=C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("ant-design-vue");require("../../internal.js");const i=require("@king-one/form-render"),v=require("../../hooks/use-namespace/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("ant-design-vue");require("../../internal.js");const i=require("@king-one/form-render"),v=require("../../hooks/use-namespace/index.js"),h=e.defineComponent({__name:"array-table",props:e.mergeModels({title:{type:String,default:"默认标题"}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(s){const t=i.useInjectFieldContext(),c=v.useNamespace("ArrayTable"),d=e.computed(()=>{var n;return((n=t==null?void 0:t.path)==null?void 0:n.toString())||""}),u=e.useModel(s,"value"),m=e.computed(()=>!(t!=null&&t.schema.items)||Array.isArray(t==null?void 0:t.schema.items)?{}:(t==null?void 0:t.schema.items.properties)||{});function f(){u.value&&(u.value=[...e.toRaw(u.value||[]),{}])}function p(n){t&&t.remove(n)}return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(c).b())},[e.createVNode(e.unref(r.Table),{"data-source":u.value,pagination:!1,bordered:"",size:"middle"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,a=>(e.openBlock(),e.createBlock(e.unref(r.TableColumn),{key:`${a.name}`,align:"center",title:a.title,"data-index":a.name},{default:e.withCtx(({index:o})=>[e.createVNode(e.unref(i.RecursionField),{schema:a,name:a.name,"base-path":`${d.value}.${o}`},null,8,["schema","name","base-path"])]),_:2},1032,["title","data-index"]))),128)),e.createVNode(e.unref(r.TableColumn),{title:"操作","data-index":"action",align:"center",width:"100px"},{default:e.withCtx(({index:a})=>[e.createVNode(e.unref(r.Button),{type:"link",onClick:o=>p(a)},{default:e.withCtx(()=>l[0]||(l[0]=[e.createTextVNode(" 删除 ")])),_:2,__:[0]},1032,["onClick"])]),_:1})]),_:1},8,["data-source"]),e.createVNode(e.unref(r.Button),{type:"dashed",style:{"margin-top":"10px",width:"100%"},onClick:f},{default:e.withCtx(()=>l[1]||(l[1]=[e.createTextVNode(" 添加 ")])),_:1,__:[1]})],2))}});exports.default=h;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-one/form-antdv",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"description": "@king-one 表单渲染器 - ant-design-vue 组件库",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "ISC",
|
|
@@ -41,9 +41,10 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@king-one/theme": "^1.0.1",
|
|
44
|
+
"@king-one/utils": "^1.0.14",
|
|
44
45
|
"ant-design-vue": "^4.2.6",
|
|
45
46
|
"vue": "^3.5.13",
|
|
46
|
-
"@king-one/form-render": "^0.0.
|
|
47
|
+
"@king-one/form-render": "^0.0.11"
|
|
47
48
|
},
|
|
48
49
|
"publishConfig": {
|
|
49
50
|
"access": "public",
|