@king-one/antdv 1.0.38 → 1.0.39
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 +6 -0
- package/dist/es/components/pro-area/src/ProArea.vue2.mjs +8 -8
- package/dist/es/components/pro-area/src/types.mjs +1 -1
- package/dist/es/components/pro-picker/src/ProPicker.vue2.mjs +29 -22
- package/dist/lib/components/pro-area/src/ProArea.vue2.js +1 -1
- package/dist/lib/components/pro-area/src/types.js +1 -1
- package/dist/lib/components/pro-picker/src/ProPicker.vue2.js +1 -1
- package/dist/types/components/pro-area/index.d.ts +3 -3
- package/dist/types/components/pro-area/src/ProArea.vue.d.ts +3 -3
- package/dist/types/components/pro-area/src/types.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, mergeModels as B, useModel as F, 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
2
|
import { Form as M, Row as N, Col as k, Select as U } from "ant-design-vue";
|
|
3
3
|
import { useNamespace as j } from "../../../hooks/use-namespace/index.mjs";
|
|
4
4
|
import { ProAreaProps as q } from "./types.mjs";
|
|
5
|
-
const L = /* @__PURE__ */
|
|
5
|
+
const L = /* @__PURE__ */ b({
|
|
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
|
},
|
|
@@ -15,7 +15,7 @@ const L = /* @__PURE__ */ _({
|
|
|
15
15
|
setup(d) {
|
|
16
16
|
const n = d;
|
|
17
17
|
M.useInjectFormItemContext();
|
|
18
|
-
const a =
|
|
18
|
+
const a = F(d, "modelValue"), { b: f } = j("pro-area-select"), v = u(() => (e) => `请选择${e === 1 ? "请选择省份" : e === 2 ? "请选择城市" : "请选择区县"}`), h = u(() => (e) => n.options.length > 0 ? g(e) : []);
|
|
19
19
|
function g(e) {
|
|
20
20
|
var t;
|
|
21
21
|
if (e === 1)
|
|
@@ -49,7 +49,7 @@ const L = /* @__PURE__ */ _({
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function o(e, t) {
|
|
52
|
-
return e && t ? e[(n == null ? void 0 : n.
|
|
52
|
+
return e && t ? e[(n == null ? void 0 : n.fieldNames[t]) || t] : void 0;
|
|
53
53
|
}
|
|
54
54
|
const C = u(() => {
|
|
55
55
|
let e = n.level;
|
|
@@ -57,7 +57,7 @@ const L = /* @__PURE__ */ _({
|
|
|
57
57
|
for (; e--; )
|
|
58
58
|
t.push(e === 2 ? "province" : e === 1 ? "city" : "county");
|
|
59
59
|
return t;
|
|
60
|
-
}),
|
|
60
|
+
}), V = u(() => [f()]);
|
|
61
61
|
return (e, t) => (c(), p(i(N), { gutter: 10 }, {
|
|
62
62
|
default: m(() => [
|
|
63
63
|
(c(!0), P(
|
|
@@ -70,9 +70,9 @@ const L = /* @__PURE__ */ _({
|
|
|
70
70
|
default: m(() => [
|
|
71
71
|
A(i(U), {
|
|
72
72
|
value: a.value[r],
|
|
73
|
-
"onUpdate:value": (
|
|
73
|
+
"onUpdate:value": (_) => a.value[r] = _,
|
|
74
74
|
placeholder: v.value(l + 1),
|
|
75
|
-
class: I(
|
|
75
|
+
class: I(V.value),
|
|
76
76
|
options: h.value(l + 1)
|
|
77
77
|
}, null, 8, ["value", "onUpdate:value", "placeholder", "class", "options"])
|
|
78
78
|
]),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { debounce as
|
|
3
|
-
import { Select as
|
|
4
|
-
import { proPickerApi as
|
|
1
|
+
import { defineComponent as s, mergeModels as d, useModel as m, reactive as f, watch as u, openBlock as h, createBlock as v, unref as l, createSlots as y, withCtx as b, createVNode as g } from "vue";
|
|
2
|
+
import { debounce as P } from "lodash-es";
|
|
3
|
+
import { Select as k, Spin as S } from "ant-design-vue";
|
|
4
|
+
import { proPickerApi as r } from "../apis/pro-picker.api.mjs";
|
|
5
5
|
import { ProPickerProps as w } from "./types.mjs";
|
|
6
|
-
const z = /* @__PURE__ */
|
|
6
|
+
const z = /* @__PURE__ */ s({
|
|
7
7
|
name: "ProPicker",
|
|
8
8
|
__name: "ProPicker",
|
|
9
9
|
props: /* @__PURE__ */ d(w, {
|
|
@@ -12,31 +12,38 @@ const z = /* @__PURE__ */ p({
|
|
|
12
12
|
}),
|
|
13
13
|
emits: ["update:modelValue"],
|
|
14
14
|
setup(i) {
|
|
15
|
-
const
|
|
15
|
+
const p = i, n = m(i, "modelValue"), o = f({
|
|
16
16
|
data: [],
|
|
17
17
|
fetching: !1
|
|
18
18
|
});
|
|
19
|
-
u(
|
|
20
|
-
(typeof e == "string" || typeof e == "number") &&
|
|
19
|
+
u(n, (e) => {
|
|
20
|
+
(typeof e == "string" || typeof e == "number") && r.company({
|
|
21
|
+
params: { value: e }
|
|
22
|
+
}).then((t) => {
|
|
23
|
+
o.data = t.data.options.map((a) => ({
|
|
24
|
+
label: a.label,
|
|
25
|
+
value: a.value
|
|
26
|
+
})), o.fetching = !1;
|
|
27
|
+
});
|
|
21
28
|
}, {
|
|
22
29
|
once: !0
|
|
23
30
|
});
|
|
24
|
-
const
|
|
25
|
-
e && (o.fetching = !0,
|
|
31
|
+
const c = P((e) => {
|
|
32
|
+
e && (o.fetching = !0, p.type === "company" ? r.company({
|
|
26
33
|
params: { label: e }
|
|
27
34
|
}).then((t) => {
|
|
28
|
-
o.data = t.data.options.map((
|
|
29
|
-
label:
|
|
30
|
-
value:
|
|
35
|
+
o.data = t.data.options.map((a) => ({
|
|
36
|
+
label: a.label,
|
|
37
|
+
value: a.value
|
|
31
38
|
})), o.fetching = !1;
|
|
32
|
-
}) :
|
|
39
|
+
}) : r.user({
|
|
33
40
|
params: { label: e }
|
|
34
41
|
}).then(() => {
|
|
35
42
|
}));
|
|
36
|
-
},
|
|
37
|
-
return (e, t) => (h(),
|
|
38
|
-
value:
|
|
39
|
-
"onUpdate:value": t[0] || (t[0] = (
|
|
43
|
+
}, p.delay);
|
|
44
|
+
return (e, t) => (h(), v(l(k), {
|
|
45
|
+
value: n.value,
|
|
46
|
+
"onUpdate:value": t[0] || (t[0] = (a) => n.value = a),
|
|
40
47
|
mode: e.mode,
|
|
41
48
|
"show-search": "",
|
|
42
49
|
placeholder: e.placeholder,
|
|
@@ -44,15 +51,15 @@ const z = /* @__PURE__ */ p({
|
|
|
44
51
|
"filter-option": !1,
|
|
45
52
|
"not-found-content": o.fetching ? void 0 : null,
|
|
46
53
|
options: o.data,
|
|
47
|
-
onSearch:
|
|
48
|
-
},
|
|
54
|
+
onSearch: l(c)
|
|
55
|
+
}, y({
|
|
49
56
|
_: 2
|
|
50
57
|
/* DYNAMIC */
|
|
51
58
|
}, [
|
|
52
59
|
o.fetching ? {
|
|
53
60
|
name: "notFoundContent",
|
|
54
|
-
fn:
|
|
55
|
-
|
|
61
|
+
fn: b(() => [
|
|
62
|
+
g(l(S), { size: "small" })
|
|
56
63
|
]),
|
|
57
64
|
key: "0"
|
|
58
65
|
} : void 0
|
|
@@ -1 +1 @@
|
|
|
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.
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={level:{type:Number,default:3},options:{type:Array,required:!0},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={level:{type:Number,default:3},options:{type:Array,required:!0},fieldNames:{type:Object,default:()=>({name:"name",id:"id",children:"children"})}};exports.ProAreaProps=e;
|
|
@@ -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"),p=require("lodash-es"),c=require("ant-design-vue"),l=require("../apis/pro-picker.api.js"),d=require("./types.js"),f=e.defineComponent({name:"ProPicker",__name:"ProPicker",props:e.mergeModels(d.ProPickerProps,{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const s=i,r=e.useModel(i,"modelValue"),t=e.reactive({data:[],fetching:!1});e.watch(r,o=>{(typeof o=="string"||typeof o=="number")&&l.proPickerApi.company({params:{value:o}}).then(n=>{t.data=n.data.options.map(a=>({label:a.label,value:a.value})),t.fetching=!1})},{once:!0});const u=p.debounce(o=>{o&&(t.fetching=!0,s.type==="company"?l.proPickerApi.company({params:{label:o}}).then(n=>{t.data=n.data.options.map(a=>({label:a.label,value:a.value})),t.fetching=!1}):l.proPickerApi.user({params:{label:o}}).then(()=>{}))},s.delay);return(o,n)=>(e.openBlock(),e.createBlock(e.unref(c.Select),{value:r.value,"onUpdate:value":n[0]||(n[0]=a=>r.value=a),mode:o.mode,"show-search":"",placeholder:o.placeholder,style:{width:"100%"},"filter-option":!1,"not-found-content":t.fetching?void 0:null,options:t.data,onSearch:e.unref(u)},e.createSlots({_:2},[t.fetching?{name:"notFoundContent",fn:e.withCtx(()=>[e.createVNode(e.unref(c.Spin),{size:"small"})]),key:"0"}:void 0]),1032,["value","mode","placeholder","not-found-content","options","onSearch"]))}});exports.default=f;
|
|
@@ -11,7 +11,7 @@ export declare const KProArea: SFCWithInstall<DefineComponent<{
|
|
|
11
11
|
readonly type: PropType< AreaOptions[]>;
|
|
12
12
|
readonly required: true;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
fieldNames: {
|
|
15
15
|
readonly type: PropType<FieldNames>;
|
|
16
16
|
readonly default: () => {
|
|
17
17
|
name: string;
|
|
@@ -42,7 +42,7 @@ export declare const KProArea: SFCWithInstall<DefineComponent<{
|
|
|
42
42
|
readonly type: PropType< AreaOptions[]>;
|
|
43
43
|
readonly required: true;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
fieldNames: {
|
|
46
46
|
readonly type: PropType<FieldNames>;
|
|
47
47
|
readonly default: () => {
|
|
48
48
|
name: string;
|
|
@@ -65,8 +65,8 @@ export declare const KProArea: SFCWithInstall<DefineComponent<{
|
|
|
65
65
|
county?: string;
|
|
66
66
|
}) => any) | undefined;
|
|
67
67
|
}, {
|
|
68
|
+
fieldNames: FieldNames;
|
|
68
69
|
level: 1 | 2 | 3;
|
|
69
|
-
FieldNames: FieldNames;
|
|
70
70
|
}, {}>>;
|
|
71
71
|
export * from './hooks/use-pro-area';
|
|
72
72
|
export default KProArea;
|
|
@@ -9,7 +9,7 @@ declare const _default: DefineComponent<{
|
|
|
9
9
|
readonly type: PropType<AreaOptions[]>;
|
|
10
10
|
readonly required: true;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
fieldNames: {
|
|
13
13
|
readonly type: PropType<FieldNames>;
|
|
14
14
|
readonly default: () => {
|
|
15
15
|
name: string;
|
|
@@ -40,7 +40,7 @@ declare const _default: DefineComponent<{
|
|
|
40
40
|
readonly type: PropType<AreaOptions[]>;
|
|
41
41
|
readonly required: true;
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
fieldNames: {
|
|
44
44
|
readonly type: PropType<FieldNames>;
|
|
45
45
|
readonly default: () => {
|
|
46
46
|
name: string;
|
|
@@ -63,7 +63,7 @@ declare const _default: DefineComponent<{
|
|
|
63
63
|
county?: string;
|
|
64
64
|
}) => any) | undefined;
|
|
65
65
|
}, {
|
|
66
|
+
fieldNames: FieldNames;
|
|
66
67
|
level: 1 | 2 | 3;
|
|
67
|
-
FieldNames: FieldNames;
|
|
68
68
|
}, {}>;
|
|
69
69
|
export default _default;
|