@king-one/antdv 1.0.35 → 1.0.37
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,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Row as N, Col as k, Select as U } from "ant-design-vue";
|
|
3
|
-
import { useNamespace as
|
|
4
|
-
import { ProAreaProps as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as _, mergeModels as b, useModel as B, computed as u, openBlock as c, createBlock as p, unref as i, withCtx as m, createElementBlock as P, Fragment as w, renderList as y, createVNode as A, normalizeClass as I } from "vue";
|
|
2
|
+
import { Form as M, Row as N, Col as k, Select as U } from "ant-design-vue";
|
|
3
|
+
import { useNamespace as j } from "../../../hooks/use-namespace/index.mjs";
|
|
4
|
+
import { ProAreaProps as q } from "./types.mjs";
|
|
5
|
+
const L = /* @__PURE__ */ _({
|
|
6
6
|
name: "ProArea",
|
|
7
7
|
__name: "ProArea",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ b(q, {
|
|
9
9
|
modelValue: {
|
|
10
10
|
required: !0
|
|
11
11
|
},
|
|
@@ -13,9 +13,11 @@ const O = /* @__PURE__ */ b({
|
|
|
13
13
|
}),
|
|
14
14
|
emits: ["update:modelValue"],
|
|
15
15
|
setup(d) {
|
|
16
|
-
const n = d
|
|
16
|
+
const n = d;
|
|
17
|
+
M.useInjectFormItemContext();
|
|
18
|
+
const a = B(d, "modelValue"), { b: f } = j("pro-area-select"), v = u(() => (e) => `请选择${e === 1 ? "请选择省份" : e === 2 ? "请选择城市" : "请选择区县"}`), h = u(() => (e) => n.options.length > 0 ? g(e) : []);
|
|
17
19
|
function g(e) {
|
|
18
|
-
var
|
|
20
|
+
var t;
|
|
19
21
|
if (e === 1)
|
|
20
22
|
return n.options.map((r) => ({
|
|
21
23
|
value: o(r, "id"),
|
|
@@ -23,55 +25,55 @@ const O = /* @__PURE__ */ b({
|
|
|
23
25
|
}));
|
|
24
26
|
if (e === 2) {
|
|
25
27
|
const r = a.value.province;
|
|
26
|
-
return r ? s(n.options, r).map((
|
|
27
|
-
value: o(
|
|
28
|
-
label: o(
|
|
28
|
+
return r ? s(n.options, r).map((l) => ({
|
|
29
|
+
value: o(l, "id"),
|
|
30
|
+
label: o(l, "name")
|
|
29
31
|
})) : [];
|
|
30
32
|
} else {
|
|
31
|
-
const r = (
|
|
32
|
-
return r ? s(n.options, r).map((
|
|
33
|
-
value: o(
|
|
34
|
-
label: o(
|
|
33
|
+
const r = (t = a.value) == null ? void 0 : t.city;
|
|
34
|
+
return r ? s(n.options, r).map((l) => ({
|
|
35
|
+
value: o(l, "id"),
|
|
36
|
+
label: o(l, "name")
|
|
35
37
|
})) : [];
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
function s(e,
|
|
40
|
+
function s(e, t) {
|
|
39
41
|
for (const r of e) {
|
|
40
|
-
if (o(r, "id") ===
|
|
42
|
+
if (o(r, "id") === t)
|
|
41
43
|
return o(r, "children") || [];
|
|
42
44
|
if (o(r, "children")) {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
45
|
+
const l = s(o(r, "children"), t);
|
|
46
|
+
if (l)
|
|
47
|
+
return l;
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
function o(e,
|
|
50
|
-
return e &&
|
|
51
|
+
function o(e, t) {
|
|
52
|
+
return e && t ? e[(n == null ? void 0 : n.FieldNames[t]) || t] : void 0;
|
|
51
53
|
}
|
|
52
54
|
const C = u(() => {
|
|
53
55
|
let e = n.level;
|
|
54
|
-
const
|
|
56
|
+
const t = [];
|
|
55
57
|
for (; e--; )
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
}),
|
|
59
|
-
return (e,
|
|
58
|
+
t.push(e === 2 ? "province" : e === 1 ? "city" : "county");
|
|
59
|
+
return t;
|
|
60
|
+
}), F = u(() => [f()]);
|
|
61
|
+
return (e, t) => (c(), p(i(N), { gutter: 10 }, {
|
|
60
62
|
default: m(() => [
|
|
61
|
-
(c(!0),
|
|
62
|
-
|
|
63
|
+
(c(!0), P(
|
|
64
|
+
w,
|
|
63
65
|
null,
|
|
64
|
-
|
|
66
|
+
y(C.value, (r, l) => (c(), p(i(k), {
|
|
65
67
|
key: r,
|
|
66
68
|
span: 24 / e.level
|
|
67
69
|
}, {
|
|
68
70
|
default: m(() => [
|
|
69
|
-
|
|
71
|
+
A(i(U), {
|
|
70
72
|
value: a.value[r],
|
|
71
|
-
"onUpdate:value": (
|
|
72
|
-
placeholder: v.value(
|
|
73
|
-
class:
|
|
74
|
-
options: h.value(
|
|
73
|
+
"onUpdate:value": (V) => a.value[r] = V,
|
|
74
|
+
placeholder: v.value(l + 1),
|
|
75
|
+
class: I(F.value),
|
|
76
|
+
options: h.value(l + 1)
|
|
75
77
|
}, null, 8, ["value", "onUpdate:value", "placeholder", "class", "options"])
|
|
76
78
|
]),
|
|
77
79
|
_: 2
|
|
@@ -87,5 +89,5 @@ const O = /* @__PURE__ */ b({
|
|
|
87
89
|
}
|
|
88
90
|
});
|
|
89
91
|
export {
|
|
90
|
-
|
|
92
|
+
L as default
|
|
91
93
|
};
|
|
@@ -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"),c=require("ant-design-vue"),B=require("../../../hooks/use-namespace/index.js"),C=require("./types.js"),_=e.defineComponent({name:"ProArea",__name:"ProArea",props:e.mergeModels(C.ProAreaProps,{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const u=i;c.Form.useInjectFormItemContext();const a=e.useModel(i,"modelValue"),{b:d}=B.useNamespace("pro-area-select"),p=e.computed(()=>t=>`请选择${t===1?"请选择省份":t===2?"请选择城市":"请选择区县"}`),m=e.computed(()=>t=>u.options.length>0?v(t):[]);function v(t){var n;if(t===1)return u.options.map(r=>({value:o(r,"id"),label:o(r,"name")}));if(t===2){const r=a.value.province;return r?s(u.options,r).map(l=>({value:o(l,"id"),label:o(l,"name")})):[]}else{const r=(n=a.value)==null?void 0:n.city;return r?s(u.options,r).map(l=>({value:o(l,"id"),label:o(l,"name")})):[]}}function s(t,n){for(const r of t){if(o(r,"id")===n)return o(r,"children")||[];if(o(r,"children")){const l=s(o(r,"children"),n);if(l)return l}}}function o(t,n){return t&&n?t[(u==null?void 0:u.FieldNames[n])||n]:void 0}const f=e.computed(()=>{let t=u.level;const n=[];for(;t--;)n.push(t===2?"province":t===1?"city":"county");return n}),h=e.computed(()=>[d()]);return(t,n)=>(e.openBlock(),e.createBlock(e.unref(c.Row),{gutter:10},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(r,l)=>(e.openBlock(),e.createBlock(e.unref(c.Col),{key:r,span:24/t.level},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Select),{value:a.value[r],"onUpdate:value":g=>a.value[r]=g,placeholder:p.value(l+1),class:e.normalizeClass(h.value),options:m.value(l+1)},null,8,["value","onUpdate:value","placeholder","class","options"])]),_:2},1032,["span"]))),128))]),_:1}))}});exports.default=_;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { default as ProModal } from './src/ProModal.vue';
|
|
2
2
|
export * from './hooks/useProModal';
|
|
3
3
|
export * from './src/types';
|
|
4
|
-
export declare const KProModal:
|
|
4
|
+
export declare const KProModal: typeof ProModal;
|
|
5
5
|
export default KProModal;
|