@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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @king-one/form-antdv
2
2
 
3
+ ## 0.0.14
4
+
5
+ ### Patch Changes
6
+
7
+ - feat:修改FromSchema类型定义,增加x-index的ui排序
8
+ - Updated dependencies
9
+ - @king-one/form-render@0.0.11
10
+
3
11
  ## 0.0.13
4
12
 
5
13
  ### Patch Changes
@@ -1,11 +1,11 @@
1
- import { defineComponent as B, mergeModels as E, useModel as N, computed as y, toRaw as F, openBlock as a, createElementBlock as p, normalizeClass as M, unref as n, createBlock as v, withCtx as o, createElementVNode as s, toDisplayString as h, createVNode as k, Fragment as _, renderList as g, createTextVNode as S } from "vue";
2
- import { Card as C, Empty as V, Button as j } from "ant-design-vue";
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 A } from "../../hooks/use-namespace/index.mjs";
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__ */ B({
6
+ const R = { class: "title-box" }, z = ["onClick"], H = /* @__PURE__ */ A({
7
7
  __name: "array-card",
8
- props: /* @__PURE__ */ E({
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 = A("ArrayCard"), e = D(), l = N(m, "value"), f = y(() => {
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
- }), d = y(() => (e == null ? void 0 : e.schema.items.properties) || {});
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 (l.value) {
24
+ if (r.value) {
25
25
  const t = {};
26
- Object.keys(d.value).forEach((r) => {
27
- const u = d.value[r].type || "string";
28
- t[r] = u === "number" ? 0 : "";
29
- }), l.value = [...F(l.value || []), t];
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, r) => {
35
+ return (t, s) => {
36
36
  var u;
37
- return a(), p(
37
+ return a(), d(
38
38
  "div",
39
39
  {
40
- class: M(n(b).b())
40
+ class: F(n(b).b())
41
41
  },
42
42
  [
43
- (u = l.value) != null && u.length ? (a(!0), p(
43
+ (u = r.value) != null && u.length ? (a(!0), d(
44
44
  _,
45
45
  { key: 1 },
46
- g(l.value, (L, i) => (a(), v(
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: o(() => [
54
- s("div", R, [
55
- s(
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
- s("span", {
62
+ o("span", {
63
63
  class: "delete-btn",
64
64
  onClick: (c) => x(i)
65
65
  }, "删除", 8, z)
66
66
  ])
67
67
  ]),
68
- default: o(() => [
69
- (a(!0), p(
68
+ default: l(() => [
69
+ (a(!0), d(
70
70
  _,
71
71
  null,
72
- g(d.value, (c, w) => (a(), v(n(I), {
73
- key: `${f.value}.${w}.${c.name}`,
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": `${f.value}.${i}`
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: o(() => [
92
- s("div", null, [
93
- s(
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: o(() => [
103
- k(n(V), { description: "暂无数据" })
102
+ default: l(() => [
103
+ k(n(S), { description: "暂无数据" })
104
104
  ]),
105
105
  _: 1
106
106
  /* STABLE */
107
107
  })),
108
- k(n(j), {
108
+ k(n(V), {
109
109
  type: "dashed",
110
110
  style: { "margin-top": "10px", width: "100%" },
111
111
  onClick: $
112
112
  }, {
113
- default: o(() => r[0] || (r[0] = [
114
- S(" 添加 ")
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 k, mergeModels as C, computed as d, useModel as y, toRaw as w, openBlock as u, createElementBlock as m, normalizeClass as B, unref as a, createVNode as l, withCtx as r, Fragment as T, renderList as $, createBlock as F, createTextVNode as c } from "vue";
2
- import { Table as M, TableColumn as p, Button as f } from "ant-design-vue";
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 N, RecursionField as z } from "@king-one/form-render";
5
- import { useNamespace as A } from "../../hooks/use-namespace/index.mjs";
6
- const E = /* @__PURE__ */ k({
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__ */ C({
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 = N(), _ = A("ArrayTable"), h = d(() => {
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 = y(v, "value"), x = d(() => (e == null ? void 0 : e.schema.items.properties) || {});
23
- function b() {
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 g(n) {
26
+ function b(n) {
27
27
  e && e.remove(n);
28
28
  }
29
- return (n, o) => (u(), m(
29
+ return (n, o) => (s(), d(
30
30
  "div",
31
31
  {
32
- class: B(a(_).b())
32
+ class: A(a(h).b())
33
33
  },
34
34
  [
35
- l(a(M), {
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: r(() => [
42
- (u(!0), m(
43
- T,
41
+ default: l(() => [
42
+ (s(!0), d(
43
+ B,
44
44
  null,
45
- $(x.value, (t) => (u(), F(a(p), {
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: r(({ index: s }) => [
52
- l(a(z), {
51
+ default: l(({ index: u }) => [
52
+ r(a(N), {
53
53
  schema: t,
54
54
  name: t.name,
55
- "base-path": `${h.value}.${s}`
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
- l(a(p), {
64
+ r(a(p), {
65
65
  title: "操作",
66
66
  "data-index": "action",
67
67
  align: "center",
68
68
  width: "100px"
69
69
  }, {
70
- default: r(({ index: t }) => [
71
- l(a(f), {
70
+ default: l(({ index: t }) => [
71
+ r(a(f), {
72
72
  type: "link",
73
- onClick: (s) => g(t)
73
+ onClick: (u) => b(t)
74
74
  }, {
75
- default: r(() => o[0] || (o[0] = [
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
- l(a(f), {
89
+ r(a(f), {
90
90
  type: "dashed",
91
91
  style: { "margin-top": "10px", width: "100%" },
92
- onClick: b
92
+ onClick: y
93
93
  }, {
94
- default: r(() => o[1] || (o[1] = [
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"),c=require("ant-design-vue");require("../../internal.js");const f=require("../../hooks/use-namespace/index.js"),m=require("@king-one/form-render"),y={class:"title-box"},g=["onClick"],C=e.defineComponent({__name:"array-card",props:e.mergeModels({title:{type:String,default:"默认标题"}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(s){const p=f.useNamespace("ArrayCard"),t=m.useInjectFieldContext(),a=e.useModel(s,"value"),d=e.computed(()=>{var n;return((n=t==null?void 0:t.path)==null?void 0:n.toString())||""}),i=e.computed(()=>(t==null?void 0:t.schema.items.properties)||{});function v(){if(a.value){const n={};Object.keys(i.value).forEach(r=>{const l=i.value[r].type||"string";n[r]=l==="number"?0:""}),a.value=[...e.toRaw(a.value||[]),n]}}function h(n){t&&(t==null||t.remove(n))}return(n,r)=>{var l;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(p).b())},[(l=a.value)!=null&&l.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.value,(B,o)=>(e.openBlock(),e.createBlock(e.unref(c.Card),{key:o,style:{"margin-bottom":"12px"}},{title:e.withCtx(()=>[e.createElementVNode("div",y,[e.createElementVNode("span",null,"#"+e.toDisplayString(o+1)+" "+e.toDisplayString(s.title),1),e.createElementVNode("span",{class:"delete-btn",onClick:u=>h(o)},"删除",8,g)])]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(u,k)=>(e.openBlock(),e.createBlock(e.unref(m.RecursionField),{key:`${d.value}.${k}.${u.name}`,schema:u,name:u.name,"base-path":`${d.value}.${o}`},null,8,["schema","name","base-path"]))),128))]),_:2},1024))),128)):(e.openBlock(),e.createBlock(e.unref(c.Card),{key:0},{title:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("span",null,e.toDisplayString(s.title),1)])]),default:e.withCtx(()=>[e.createVNode(e.unref(c.Empty),{description:"暂无数据"})]),_:1})),e.createVNode(e.unref(c.Button),{type:"dashed",style:{"margin-top":"10px",width:"100%"},onClick:v},{default:e.withCtx(()=>r[0]||(r[0]=[e.createTextVNode(" 添加 ")])),_:1,__:[0]})],2)}}});exports.default=C;
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"),x=e.defineComponent({__name:"array-table",props:e.mergeModels({title:{type:String,default:"默认标题"}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(d){const t=i.useInjectFieldContext(),s=v.useNamespace("ArrayTable"),c=e.computed(()=>{var n;return((n=t==null?void 0:t.path)==null?void 0:n.toString())||""}),l=e.useModel(d,"value"),m=e.computed(()=>(t==null?void 0:t.schema.items.properties)||{});function f(){l.value&&(l.value=[...e.toRaw(l.value||[]),{}])}function p(n){t&&t.remove(n)}return(n,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(s).b())},[e.createVNode(e.unref(r.Table),{"data-source":l.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":`${c.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(()=>u[0]||(u[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(()=>u[1]||(u[1]=[e.createTextVNode(" 添加 ")])),_:1,__:[1]})],2))}});exports.default=x;
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.13",
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.10"
47
+ "@king-one/form-render": "^0.0.11"
47
48
  },
48
49
  "publishConfig": {
49
50
  "access": "public",