@vue-ui-kit/ant 2.4.5 → 2.4.6
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/dist/cjs/index.js +2 -2
- package/dist/es/index.js +53 -43
- package/dist/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/packages/components/PGrid.vue +23 -17
- package/src/packages/renders/Icon.ts +9 -1
- package/src/packages/utils/config.ts +11 -0
package/dist/es/index.js
CHANGED
|
@@ -2382,7 +2382,8 @@ var Q = Vi(), Xi = (e) => e == null || e === "", $ = (e) => !Xi(e), Zi = (e) =>
|
|
|
2382
2382
|
DISABLED: !0,
|
|
2383
2383
|
ENABLE_FINDER: !0,
|
|
2384
2384
|
AUTO_ROW_HEIGHT: !0
|
|
2385
|
-
}
|
|
2385
|
+
},
|
|
2386
|
+
icon: {}
|
|
2386
2387
|
}, ra = (0, Q.clone)(na, !0);
|
|
2387
2388
|
function ia(e) {
|
|
2388
2389
|
ra = {
|
|
@@ -2398,7 +2399,11 @@ function ia(e) {
|
|
|
2398
2399
|
...ra.canvasTable,
|
|
2399
2400
|
...e.canvasTable
|
|
2400
2401
|
},
|
|
2401
|
-
renderTooltip: e.renderTooltip ?? ra.renderTooltip
|
|
2402
|
+
renderTooltip: e.renderTooltip ?? ra.renderTooltip,
|
|
2403
|
+
icon: {
|
|
2404
|
+
...ra.icon,
|
|
2405
|
+
...e.icon
|
|
2406
|
+
}
|
|
2402
2407
|
};
|
|
2403
2408
|
}
|
|
2404
2409
|
function aa() {
|
|
@@ -2717,8 +2722,13 @@ var ya = "-", ba = {
|
|
|
2717
2722
|
};
|
|
2718
2723
|
}
|
|
2719
2724
|
}), Da = (e) => {
|
|
2720
|
-
let { icon: t } = e, n =
|
|
2721
|
-
|
|
2725
|
+
let { icon: t } = e, n = oa().icon?.render;
|
|
2726
|
+
if (n) {
|
|
2727
|
+
let e = n(t);
|
|
2728
|
+
if (e) return e;
|
|
2729
|
+
}
|
|
2730
|
+
let r = De;
|
|
2731
|
+
return r[t] ? c(r[t]) : null;
|
|
2722
2732
|
}, Oa = {
|
|
2723
2733
|
AInput: { autocomplete: "off" },
|
|
2724
2734
|
$input: {
|
|
@@ -3488,13 +3498,13 @@ function Qa(e, t, n) {
|
|
|
3488
3498
|
var $a = { key: 0 }, eo = {
|
|
3489
3499
|
key: 1,
|
|
3490
3500
|
class: "p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"
|
|
3491
|
-
}, to = { class: "flex items-center flex-1 gap-4px" }, no = {
|
|
3501
|
+
}, to = { class: "flex items-center flex-1 gap-4px" }, no = { class: "flex items-center gap-4px" }, ro = { class: "flex items-center gap-4px" }, io = { key: 2 }, ao = { class: "flex items-center gap-4px" }, oo = { class: "flex items-center gap-4px" }, so = {
|
|
3492
3502
|
key: 0,
|
|
3493
3503
|
class: "w-full pt-8px px-16px text-slate-5"
|
|
3494
|
-
},
|
|
3504
|
+
}, co = {
|
|
3495
3505
|
key: 1,
|
|
3496
3506
|
class: "flex w-full items-center gap-12px pt-8px px-16px"
|
|
3497
|
-
},
|
|
3507
|
+
}, lo = { class: "flex-1 min-w-0 text-slate-5 flex items-center" }, uo = /* @__PURE__ */ l({
|
|
3498
3508
|
__name: "PGrid",
|
|
3499
3509
|
props: {
|
|
3500
3510
|
selectConfig: {},
|
|
@@ -3773,7 +3783,7 @@ var $a = { key: 0 }, eo = {
|
|
|
3773
3783
|
}, 16, ["name", "model"]))]),
|
|
3774
3784
|
_: 1
|
|
3775
3785
|
}, 8, ["spinning"])], 512)) : r("", !0),
|
|
3776
|
-
A(k) ? (b(), i("div", eo, [a("div", to, [A(k).buttons && A(k).buttons.length > 0 ? (b(!0), i(e, { key: 0 }, C(A(k).buttons, (t,
|
|
3786
|
+
A(k) ? (b(), i("div", eo, [a("div", to, [A(k).buttons && A(k).buttons.length > 0 ? (b(!0), i(e, { key: 0 }, C(A(k).buttons, (t, o) => (b(), i(e, { key: o }, [t.dropdowns && t.dropdowns.length ? (b(), n(_, { key: 0 }, {
|
|
3777
3787
|
overlay: F(() => [c(m, { onClick: Ne }, {
|
|
3778
3788
|
default: F(() => [(b(!0), i(e, null, C(t.dropdowns, (t) => (b(), n(d, { key: t.code }, {
|
|
3779
3789
|
default: F(() => [t.content && Qe(Ze(t.content)) ? (b(), i(e, { key: 0 }, [s(D(Ze(t.content)), 1)], 64)) : t.content ? (b(), n(E(Ze(t.content)), { key: 1 })) : r("", !0)]),
|
|
@@ -3791,14 +3801,14 @@ var $a = { key: 0 }, eo = {
|
|
|
3791
3801
|
ghost: t.ghost,
|
|
3792
3802
|
block: t.block
|
|
3793
3803
|
}, {
|
|
3794
|
-
default: F(() => [
|
|
3804
|
+
default: F(() => [a("div", no, [
|
|
3795
3805
|
t.icon ? (b(), n(A(Da), {
|
|
3796
3806
|
key: 0,
|
|
3797
3807
|
icon: t.icon
|
|
3798
3808
|
}, null, 8, ["icon"])) : r("", !0),
|
|
3799
3809
|
t.content && Qe(Ze(t.content)) ? (b(), i(e, { key: 1 }, [s(D(Ze(t.content)), 1)], 64)) : t.content ? (b(), n(E(Ze(t.content)), { key: 2 })) : r("", !0),
|
|
3800
3810
|
c(A(Oe))
|
|
3801
|
-
]),
|
|
3811
|
+
])]),
|
|
3802
3812
|
_: 2
|
|
3803
3813
|
}, 1032, [
|
|
3804
3814
|
"type",
|
|
@@ -3823,10 +3833,10 @@ var $a = { key: 0 }, eo = {
|
|
|
3823
3833
|
block: t.block,
|
|
3824
3834
|
onClick: (e) => A(Me)(t.code)
|
|
3825
3835
|
}, {
|
|
3826
|
-
default: F(() => [t.icon ? (b(), n(A(Da), {
|
|
3836
|
+
default: F(() => [a("div", ro, [t.icon ? (b(), n(A(Da), {
|
|
3827
3837
|
key: 0,
|
|
3828
3838
|
icon: t.icon
|
|
3829
|
-
}, null, 8, ["icon"])) : r("", !0), t.content && Qe(Ze(t.content)) ? (b(), i(e, { key: 1 }, [s(D(Ze(t.content)), 1)], 64)) : t.content ? (b(), n(E(Ze(t.content)), { key: 2 })) : r("", !0)]),
|
|
3839
|
+
}, null, 8, ["icon"])) : r("", !0), t.content && Qe(Ze(t.content)) ? (b(), i(e, { key: 1 }, [s(D(Ze(t.content)), 1)], 64)) : t.content ? (b(), n(E(Ze(t.content)), { key: 2 })) : r("", !0)])]),
|
|
3830
3840
|
_: 2
|
|
3831
3841
|
}, 1032, [
|
|
3832
3842
|
"type",
|
|
@@ -3838,8 +3848,8 @@ var $a = { key: 0 }, eo = {
|
|
|
3838
3848
|
"ghost",
|
|
3839
3849
|
"block",
|
|
3840
3850
|
"onClick"
|
|
3841
|
-
])) : (b(), i("div",
|
|
3842
|
-
key:
|
|
3851
|
+
])) : (b(), i("div", io))], 64))), 128)) : r("", !0)]), a("span", ao, [A(k).tools && A(k).tools.length > 0 ? (b(!0), i(e, { key: 0 }, C(A(k).tools, (t, o) => (b(), n(A(I), {
|
|
3852
|
+
key: o,
|
|
3843
3853
|
type: t.type,
|
|
3844
3854
|
size: t.size ?? "middle",
|
|
3845
3855
|
disabled: A(k).disabled || t.disabled,
|
|
@@ -3850,10 +3860,10 @@ var $a = { key: 0 }, eo = {
|
|
|
3850
3860
|
onClick: (e) => A(Pe)(t.code),
|
|
3851
3861
|
loading: L.toolbar || !!t.code && _e[t.code]
|
|
3852
3862
|
}, {
|
|
3853
|
-
default: F(() => [t.icon ? (b(), n(A(Da), {
|
|
3863
|
+
default: F(() => [a("div", oo, [t.icon ? (b(), n(A(Da), {
|
|
3854
3864
|
key: 0,
|
|
3855
3865
|
icon: t.icon
|
|
3856
|
-
}, null, 8, ["icon"])) : r("", !0), t.content && Qe(Ze(t.content)) ? (b(), i(e, { key: 1 }, [s(D(Ze(t.content)), 1)], 64)) : t.content ? (b(), n(E(Ze(t.content)), { key: 2 })) : r("", !0)]),
|
|
3866
|
+
}, null, 8, ["icon"])) : r("", !0), t.content && Qe(Ze(t.content)) ? (b(), i(e, { key: 1 }, [s(D(Ze(t.content)), 1)], 64)) : t.content ? (b(), n(E(Ze(t.content)), { key: 2 })) : r("", !0)])]),
|
|
3857
3867
|
_: 2
|
|
3858
3868
|
}, 1032, [
|
|
3859
3869
|
"type",
|
|
@@ -3921,7 +3931,7 @@ var $a = { key: 0 }, eo = {
|
|
|
3921
3931
|
ref_key: "tableFooterEl",
|
|
3922
3932
|
ref: ce,
|
|
3923
3933
|
class: "flex-shrink-0"
|
|
3924
|
-
}, [Te.value !== "pagination" && De.value ? (b(), i("div",
|
|
3934
|
+
}, [Te.value !== "pagination" && De.value ? (b(), i("div", so, " 已选:" + D(R.value.length), 1)) : Te.value === "pagination" ? (b(), i("div", co, [a("div", lo, [De.value ? (b(), i(e, { key: 0 }, [s(" 已选:" + D(R.value.length), 1)], 64)) : r("", !0)]), c(v, {
|
|
3925
3935
|
size: "small",
|
|
3926
3936
|
responsive: !1,
|
|
3927
3937
|
"show-size-changer": !0,
|
|
@@ -3939,7 +3949,7 @@ var $a = { key: 0 }, eo = {
|
|
|
3939
3949
|
], 64))], 16);
|
|
3940
3950
|
};
|
|
3941
3951
|
}
|
|
3942
|
-
}),
|
|
3952
|
+
}), fo = /* @__PURE__ */ Re((/* @__PURE__ */ H(((e, t) => {
|
|
3943
3953
|
(function() {
|
|
3944
3954
|
try {
|
|
3945
3955
|
if (typeof document < "u") {
|
|
@@ -10151,7 +10161,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10151
10161
|
}
|
|
10152
10162
|
return $t;
|
|
10153
10163
|
});
|
|
10154
|
-
})))(), 1),
|
|
10164
|
+
})))(), 1), po = /* @__PURE__ */ l((e, { emit: t }) => {
|
|
10155
10165
|
let { cellRender: n, renderTableParams: r } = e, { row: i, field: a } = r;
|
|
10156
10166
|
if (a) {
|
|
10157
10167
|
let e = S(i[a]);
|
|
@@ -10161,7 +10171,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10161
10171
|
name: "RenderEditCell",
|
|
10162
10172
|
props: ["cellRender", "renderTableParams"],
|
|
10163
10173
|
emits: ["blur"]
|
|
10164
|
-
}),
|
|
10174
|
+
}), mo = /* @__PURE__ */ l({
|
|
10165
10175
|
__name: "PCanvasTable",
|
|
10166
10176
|
props: {
|
|
10167
10177
|
columns: {},
|
|
@@ -10220,7 +10230,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10220
10230
|
children: e.children?.map((e) => ce(e))
|
|
10221
10231
|
});
|
|
10222
10232
|
y(() => {
|
|
10223
|
-
D.value && (v = new
|
|
10233
|
+
D.value && (v = new fo.default(D.value, {
|
|
10224
10234
|
config: g.value.config,
|
|
10225
10235
|
columns: f.columns.map((e) => ce(e)),
|
|
10226
10236
|
data: f.data,
|
|
@@ -10296,7 +10306,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10296
10306
|
"style",
|
|
10297
10307
|
"value",
|
|
10298
10308
|
"cell"
|
|
10299
|
-
])) : A(Fa).renders[P.value]?.renderEdit ? (b(), n(A(
|
|
10309
|
+
])) : A(Fa).renders[P.value]?.renderEdit ? (b(), n(A(po), {
|
|
10300
10310
|
key: 1,
|
|
10301
10311
|
"cell-render": ne[M.value.key],
|
|
10302
10312
|
class: "ev-editor-wrapper",
|
|
@@ -10346,13 +10356,13 @@ var $a = { key: 0 }, eo = {
|
|
|
10346
10356
|
}, 8, ["spinning"]);
|
|
10347
10357
|
};
|
|
10348
10358
|
}
|
|
10349
|
-
}),
|
|
10359
|
+
}), ho = { key: 0 }, go = {
|
|
10350
10360
|
key: 1,
|
|
10351
10361
|
class: "p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"
|
|
10352
|
-
},
|
|
10362
|
+
}, _o = { class: "flex items-center flex-1 gap-4px" }, vo = { key: 2 }, yo = { class: "flex items-center gap-4px" }, bo = {
|
|
10353
10363
|
key: 0,
|
|
10354
10364
|
class: "w-full text-slate-5 pl-4"
|
|
10355
|
-
},
|
|
10365
|
+
}, xo = /* @__PURE__ */ l({
|
|
10356
10366
|
__name: "PCanvasGrid",
|
|
10357
10367
|
props: {
|
|
10358
10368
|
staticConfig: {},
|
|
@@ -10558,7 +10568,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10558
10568
|
ref_key: "boxEl",
|
|
10559
10569
|
ref: _e,
|
|
10560
10570
|
class: "h-full p-wrapper flex flex-col gap-8px overflow-y-auto"
|
|
10561
|
-
}, A(_)), [ce.value === "bad" ? (b(), i("div",
|
|
10571
|
+
}, A(_)), [ce.value === "bad" ? (b(), i("div", ho, "请检查配置")) : (b(), i(e, { key: 1 }, [
|
|
10562
10572
|
A(k)?.items?.some((e) => e.field && e.itemRender) ? (b(), i("div", {
|
|
10563
10573
|
key: 0,
|
|
10564
10574
|
class: "p-pane p-form-wrapper",
|
|
@@ -10584,7 +10594,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10584
10594
|
}, 16, ["model"]))]),
|
|
10585
10595
|
_: 1
|
|
10586
10596
|
}, 8, ["spinning"])], 512)) : r("", !0),
|
|
10587
|
-
A(P) ? (b(), i("div",
|
|
10597
|
+
A(P) ? (b(), i("div", go, [a("div", _o, [A(P).buttons && A(P).buttons.length > 0 ? (b(!0), i(e, { key: 0 }, C(A(P).buttons, (t, a) => (b(), i(e, { key: a }, [t.dropdowns && t.dropdowns.length ? (b(), n(v, { key: 0 }, {
|
|
10588
10598
|
overlay: F(() => [c(f, { onClick: je }, {
|
|
10589
10599
|
default: F(() => [(b(!0), i(e, null, C(t.dropdowns, (e) => (b(), n(d, { key: e.code }, {
|
|
10590
10600
|
default: F(() => [s(D(e.content), 1)]),
|
|
@@ -10649,7 +10659,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10649
10659
|
"ghost",
|
|
10650
10660
|
"block",
|
|
10651
10661
|
"onClick"
|
|
10652
|
-
])) : (b(), i("div",
|
|
10662
|
+
])) : (b(), i("div", vo))], 64))), 128)) : r("", !0)]), a("span", yo, [A(P).tools && A(P).tools.length > 0 ? (b(!0), i(e, { key: 0 }, C(A(P).tools, (e, t) => (b(), n(A(I), {
|
|
10653
10663
|
key: t,
|
|
10654
10664
|
type: e.type,
|
|
10655
10665
|
size: e.size ?? "middle",
|
|
@@ -10682,8 +10692,8 @@ var $a = { key: 0 }, eo = {
|
|
|
10682
10692
|
ref: be,
|
|
10683
10693
|
class: h("p-pane flex-1 h-0 p-inner-scroll")
|
|
10684
10694
|
}, [
|
|
10685
|
-
A(L)?.selectable && A(L).showCount ? (b(), i("div",
|
|
10686
|
-
c(
|
|
10695
|
+
A(L)?.selectable && A(L).showCount ? (b(), i("div", bo, " 已选:" + D(De.value.length), 1)) : r("", !0),
|
|
10696
|
+
c(mo, {
|
|
10687
10697
|
ref_key: "canvasTableRef",
|
|
10688
10698
|
ref: ge,
|
|
10689
10699
|
columns: ze.value,
|
|
@@ -10720,7 +10730,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10720
10730
|
], 64))], 16);
|
|
10721
10731
|
};
|
|
10722
10732
|
}
|
|
10723
|
-
}),
|
|
10733
|
+
}), So = /* @__PURE__ */ l({
|
|
10724
10734
|
__name: "PGroupBlock",
|
|
10725
10735
|
props: {
|
|
10726
10736
|
name: {},
|
|
@@ -10735,7 +10745,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10735
10745
|
ref: a
|
|
10736
10746
|
}, c.value, { data: A(o) }), null, 16, ["name", "data"]));
|
|
10737
10747
|
}
|
|
10738
|
-
}),
|
|
10748
|
+
}), Co = /* @__PURE__ */ l({
|
|
10739
10749
|
__name: "CollapseCard",
|
|
10740
10750
|
props: {
|
|
10741
10751
|
defaultCollapsed: {
|
|
@@ -10784,7 +10794,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10784
10794
|
}))]), 1032, ["title"]));
|
|
10785
10795
|
};
|
|
10786
10796
|
}
|
|
10787
|
-
}),
|
|
10797
|
+
}), wo = /* @__PURE__ */ l({
|
|
10788
10798
|
__name: "PFormGroup",
|
|
10789
10799
|
props: /* @__PURE__ */ f({
|
|
10790
10800
|
name: {},
|
|
@@ -10922,7 +10932,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10922
10932
|
})));
|
|
10923
10933
|
return (t, u) => {
|
|
10924
10934
|
let d = T("a-spin");
|
|
10925
|
-
return b(), n(
|
|
10935
|
+
return b(), n(Co, {
|
|
10926
10936
|
ref_key: "rootRef",
|
|
10927
10937
|
ref: h,
|
|
10928
10938
|
title: l.title,
|
|
@@ -10973,7 +10983,7 @@ var $a = { key: 0 }, eo = {
|
|
|
10973
10983
|
default: F(() => [c(A(Ae))]),
|
|
10974
10984
|
_: 2
|
|
10975
10985
|
}, 1024)) : r("", !0)]),
|
|
10976
|
-
default: F(() => [(b(), n(
|
|
10986
|
+
default: F(() => [(b(), n(So, {
|
|
10977
10987
|
ref_for: !0,
|
|
10978
10988
|
ref_key: "blockInstance",
|
|
10979
10989
|
ref: y,
|
|
@@ -11005,7 +11015,7 @@ var $a = { key: 0 }, eo = {
|
|
|
11005
11015
|
]);
|
|
11006
11016
|
};
|
|
11007
11017
|
}
|
|
11008
|
-
}),
|
|
11018
|
+
}), To = { class: "w-full text-right p-2" }, Eo = /* @__PURE__ */ l({
|
|
11009
11019
|
__name: "PromisePicker",
|
|
11010
11020
|
props: {
|
|
11011
11021
|
gridSetting: {},
|
|
@@ -11069,7 +11079,7 @@ var $a = { key: 0 }, eo = {
|
|
|
11069
11079
|
onCancel: v,
|
|
11070
11080
|
"body-style": e.bodyStyle
|
|
11071
11081
|
}, o({
|
|
11072
|
-
default: F(() => [a("div", { style: f }, [c(
|
|
11082
|
+
default: F(() => [a("div", { style: f }, [c(uo, p(d.value, {
|
|
11073
11083
|
ref_key: "gridEl",
|
|
11074
11084
|
ref: i,
|
|
11075
11085
|
onPick: C
|
|
@@ -11077,7 +11087,7 @@ var $a = { key: 0 }, eo = {
|
|
|
11077
11087
|
_: 2
|
|
11078
11088
|
}, [u.value ? {
|
|
11079
11089
|
name: "footer",
|
|
11080
|
-
fn: F(() => [a("div",
|
|
11090
|
+
fn: F(() => [a("div", To, [a("span", null, [c(A(I), {
|
|
11081
11091
|
class: "mr-4",
|
|
11082
11092
|
onClick: y
|
|
11083
11093
|
}, {
|
|
@@ -11102,16 +11112,16 @@ var $a = { key: 0 }, eo = {
|
|
|
11102
11112
|
});
|
|
11103
11113
|
//#endregion
|
|
11104
11114
|
//#region src/index.ts
|
|
11105
|
-
function
|
|
11115
|
+
function Do(e) {
|
|
11106
11116
|
e && ia(e);
|
|
11107
11117
|
}
|
|
11108
|
-
var
|
|
11118
|
+
var Oo = {
|
|
11109
11119
|
install(e) {
|
|
11110
|
-
e.component("PForm", Va), e.component("PGrid",
|
|
11120
|
+
e.component("PForm", Va), e.component("PGrid", uo), e.component("PCanvasTable", mo), e.component("PCanvasGrid", xo), e.component("PFormGroup", wo), e.component("PGroupBlock", So), e.component("PromisePicker", Eo);
|
|
11111
11121
|
},
|
|
11112
11122
|
addFormatter: Sa,
|
|
11113
11123
|
addRender: Pa,
|
|
11114
|
-
setup:
|
|
11124
|
+
setup: Do
|
|
11115
11125
|
};
|
|
11116
11126
|
//#endregion
|
|
11117
|
-
export {
|
|
11127
|
+
export { xo as PCanvasGrid, mo as PCanvasTable, Va as PForm, wo as PFormGroup, uo as PGrid, So as PGroupBlock, Eo as PromisePicker, Sa as addFormatter, Pa as addRender, Xa as applyViewportRestSize, da as cleanCol, Qa as createAutoViewportBoxController, Oo as default, fa as defaultItemResponsive, pa as defaultLabelCol, ha as get24rest, _a as getButtonResponsive, aa as getTooltipRenderer, oa as getUIKitConfig, ma as labelColDict, Ja as parseAutoViewportBoxOffset, ua as resetUIKitConfig, ia as setUIKitConfig, Do as setup, va as watchPreviousDeep };
|
package/dist/index.d.ts
CHANGED
|
@@ -2977,6 +2977,12 @@ export declare interface UIKitConfig {
|
|
|
2977
2977
|
* @param content tooltip 内容,字符串或返回 VNode 的函数
|
|
2978
2978
|
*/
|
|
2979
2979
|
renderTooltip?: (defaultSlot: () => VNode, content: string | (() => VNode)) => VNode;
|
|
2980
|
+
/**
|
|
2981
|
+
* 自定义图标:按 `icon` 名字渲染;返回值为真时优先于 `@ant-design/icons-vue` 同名组件。
|
|
2982
|
+
*/
|
|
2983
|
+
icon?: {
|
|
2984
|
+
render?: (name: string) => unknown;
|
|
2985
|
+
};
|
|
2980
2986
|
}
|
|
2981
2987
|
|
|
2982
2988
|
declare interface ValidateErrorEntity<Values = any> {
|
package/package.json
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
import RenderTitleSlots from '@/components/RenderTitleSlots';
|
|
11
11
|
import { $confirm } from '@/hooks/useMessage';
|
|
12
12
|
import Icon from '@/renders/Icon';
|
|
13
|
-
import { getGridDefaults } from '@/utils/config';
|
|
14
13
|
import {
|
|
15
14
|
createAutoViewportBoxController,
|
|
16
15
|
parseAutoViewportBoxOffset,
|
|
17
16
|
type AutoViewportBoxController,
|
|
18
17
|
type AutoViewportBoxOffsetInput,
|
|
19
18
|
} from '@/utils/autoViewportBox';
|
|
19
|
+
import { getGridDefaults } from '@/utils/config';
|
|
20
20
|
import { cleanCol, defaultLabelCol } from '@/utils/core';
|
|
21
21
|
import { isGoodValue } from '@/utils/is';
|
|
22
22
|
import { eachTree } from '@/utils/treeHelper';
|
|
@@ -678,12 +678,14 @@
|
|
|
678
678
|
:ghost="btn.ghost"
|
|
679
679
|
:block="btn.block"
|
|
680
680
|
>
|
|
681
|
-
<
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
681
|
+
<div class="flex items-center gap-4px">
|
|
682
|
+
<Icon v-if="btn.icon" :icon="btn.icon" />
|
|
683
|
+
<template v-if="btn.content && isStringContent(renderContent(btn.content))">
|
|
684
|
+
{{ renderContent(btn.content) }}
|
|
685
|
+
</template>
|
|
686
|
+
<component v-else-if="btn.content" :is="renderContent(btn.content)" />
|
|
687
|
+
<DownOutlined />
|
|
688
|
+
</div>
|
|
687
689
|
</a-button>
|
|
688
690
|
</a-dropdown>
|
|
689
691
|
<a-button
|
|
@@ -698,11 +700,13 @@
|
|
|
698
700
|
:block="btn.block"
|
|
699
701
|
@click="debounceToolBtnClick(btn.code)"
|
|
700
702
|
>
|
|
701
|
-
<
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
703
|
+
<div class="flex items-center gap-4px">
|
|
704
|
+
<Icon v-if="btn.icon" :icon="btn.icon" />
|
|
705
|
+
<template v-if="btn.content && isStringContent(renderContent(btn.content))">
|
|
706
|
+
{{ renderContent(btn.content) }}
|
|
707
|
+
</template>
|
|
708
|
+
<component v-else-if="btn.content" :is="renderContent(btn.content)" />
|
|
709
|
+
</div>
|
|
706
710
|
</a-button>
|
|
707
711
|
<div v-else></div>
|
|
708
712
|
</template>
|
|
@@ -723,11 +727,13 @@
|
|
|
723
727
|
@click="debounceToolToolClick(tool.code)"
|
|
724
728
|
:loading="loading.toolbar || (!!tool.code && codeLoadings[tool.code])"
|
|
725
729
|
>
|
|
726
|
-
<
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
730
|
+
<div class="flex items-center gap-4px">
|
|
731
|
+
<Icon v-if="tool.icon" :icon="tool.icon" />
|
|
732
|
+
<template v-if="tool.content && isStringContent(renderContent(tool.content))">
|
|
733
|
+
{{ renderContent(tool.content) }}
|
|
734
|
+
</template>
|
|
735
|
+
<component v-else-if="tool.content" :is="renderContent(tool.content)" />
|
|
736
|
+
</div>
|
|
731
737
|
</a-button>
|
|
732
738
|
</template>
|
|
733
739
|
</span>
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { createVNode } from 'vue';
|
|
2
2
|
import * as $Icon from '@ant-design/icons-vue';
|
|
3
|
+
import { getUIKitConfig } from '@/utils/config';
|
|
4
|
+
|
|
3
5
|
const Icon = (props: { icon: string }) => {
|
|
4
6
|
const { icon } = props;
|
|
7
|
+
const customRender = getUIKitConfig().icon?.render;
|
|
8
|
+
if (customRender) {
|
|
9
|
+
const custom = customRender(icon);
|
|
10
|
+
if (custom) return custom;
|
|
11
|
+
}
|
|
5
12
|
const antIcon: { [key: string]: any } = $Icon;
|
|
6
|
-
|
|
13
|
+
if (antIcon[icon]) return createVNode(antIcon[icon]);
|
|
14
|
+
return null;
|
|
7
15
|
};
|
|
8
16
|
export default Icon;
|
|
@@ -26,6 +26,12 @@ export interface UIKitConfig {
|
|
|
26
26
|
* @param content tooltip 内容,字符串或返回 VNode 的函数
|
|
27
27
|
*/
|
|
28
28
|
renderTooltip?: (defaultSlot: () => VNode, content: string | (() => VNode)) => VNode;
|
|
29
|
+
/**
|
|
30
|
+
* 自定义图标:按 `icon` 名字渲染;返回值为真时优先于 `@ant-design/icons-vue` 同名组件。
|
|
31
|
+
*/
|
|
32
|
+
icon?: {
|
|
33
|
+
render?: (name: string) => unknown;
|
|
34
|
+
};
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
// 默认配置
|
|
@@ -45,6 +51,7 @@ const defaultConfig: UIKitConfig = {
|
|
|
45
51
|
ENABLE_FINDER: true,
|
|
46
52
|
AUTO_ROW_HEIGHT: true,
|
|
47
53
|
},
|
|
54
|
+
icon: {},
|
|
48
55
|
};
|
|
49
56
|
|
|
50
57
|
// 当前配置(可被修改)
|
|
@@ -66,6 +73,10 @@ export function setUIKitConfig(config: Partial<UIKitConfig>): void {
|
|
|
66
73
|
...config.canvasTable,
|
|
67
74
|
},
|
|
68
75
|
renderTooltip: config.renderTooltip ?? currentConfig.renderTooltip,
|
|
76
|
+
icon: {
|
|
77
|
+
...currentConfig.icon,
|
|
78
|
+
...config.icon,
|
|
79
|
+
},
|
|
69
80
|
};
|
|
70
81
|
}
|
|
71
82
|
|