@vue-ui-kit/ant 2.4.4 → 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/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 = De;
2721
- return n[t] ? c(n[t]) : n[t];
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: {
@@ -3452,7 +3462,7 @@ function Xa(e, t) {
3452
3462
  let n = e.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = Math.max(0, r - n.left - t.right), o = Math.max(0, i - n.top - t.bottom), s = e.parentElement;
3453
3463
  if (s) {
3454
3464
  let e = s.getBoundingClientRect();
3455
- e.width > 0 && (a = Math.min(a, e.width)), e.height > 0 && (o = Math.min(o, e.height));
3465
+ e.width > 0 && (a = Math.min(a, e.width));
3456
3466
  }
3457
3467
  e.style.width = `${a}px`, e.style.height = `${o}px`;
3458
3468
  }
@@ -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 = { key: 2 }, ro = { class: "flex items-center gap-4px" }, io = { class: "p-grid-table-body flex-1 min-h-0 overflow-hidden" }, ao = {
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
- }, oo = {
3504
+ }, co = {
3495
3505
  key: 1,
3496
3506
  class: "flex w-full items-center gap-12px pt-8px px-16px"
3497
- }, so = { class: "flex-1 min-w-0 text-slate-5 flex items-center" }, co = /* @__PURE__ */ l({
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: {},
@@ -3523,7 +3533,11 @@ var $a = { key: 0 }, eo = {
3523
3533
  },
3524
3534
  fitHeight: { default: () => ca().fitHeight ?? 30 },
3525
3535
  fitCanvasHeight: {},
3526
- renderY: {}
3536
+ renderY: {},
3537
+ fitContent: {
3538
+ type: Boolean,
3539
+ default: !1
3540
+ }
3527
3541
  },
3528
3542
  emits: [
3529
3543
  "toolbarButtonClick",
@@ -3681,6 +3695,11 @@ var $a = { key: 0 }, eo = {
3681
3695
  le.value = f.renderY;
3682
3696
  return;
3683
3697
  }
3698
+ if (f.fitContent) {
3699
+ let e = typeof window < "u" ? window.innerHeight : 800, t = f.fitHeight ?? 30;
3700
+ le.value = Math.max(Math.floor(e * .6) - t, 160);
3701
+ return;
3702
+ }
3684
3703
  let e = se.value.clientHeight, t = ce.value?.offsetHeight ?? 0, n = Ge(se.value)?.getBoundingClientRect().height ?? 0, r = f.fitHeight ?? 30;
3685
3704
  le.value = Math.max(e - t - n - r, 100);
3686
3705
  });
@@ -3736,7 +3755,7 @@ var $a = { key: 0 }, eo = {
3736
3755
  return b(), i("div", p({
3737
3756
  ref_key: "boxEl",
3738
3757
  ref: ie,
3739
- class: ["p-wrapper flex flex-col gap-8px overflow-y-auto", l.autoBoxSize ? "min-h-0 min-w-0 flex-1 w-full" : "h-full"]
3758
+ class: ["p-wrapper flex flex-col gap-8px", l.fitContent ? "w-full h-auto" : l.autoBoxSize ? "overflow-y-auto min-h-0 min-w-0 flex-1 w-full" : "overflow-y-auto h-full"]
3740
3759
  }, A(ke)), [Te.value === "bad" ? (b(), i("div", $a, "请检查配置")) : (b(), i(e, { key: 1 }, [
3741
3760
  A(g)?.items?.some((e) => e.field && e.itemRender) ? (b(), i("div", {
3742
3761
  key: 0,
@@ -3764,7 +3783,7 @@ var $a = { key: 0 }, eo = {
3764
3783
  }, 16, ["name", "model"]))]),
3765
3784
  _: 1
3766
3785
  }, 8, ["spinning"])], 512)) : r("", !0),
3767
- 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, a) => (b(), i(e, { key: a }, [t.dropdowns && t.dropdowns.length ? (b(), n(_, { key: 0 }, {
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 }, {
3768
3787
  overlay: F(() => [c(m, { onClick: Ne }, {
3769
3788
  default: F(() => [(b(!0), i(e, null, C(t.dropdowns, (t) => (b(), n(d, { key: t.code }, {
3770
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)]),
@@ -3782,14 +3801,14 @@ var $a = { key: 0 }, eo = {
3782
3801
  ghost: t.ghost,
3783
3802
  block: t.block
3784
3803
  }, {
3785
- default: F(() => [
3804
+ default: F(() => [a("div", no, [
3786
3805
  t.icon ? (b(), n(A(Da), {
3787
3806
  key: 0,
3788
3807
  icon: t.icon
3789
3808
  }, null, 8, ["icon"])) : r("", !0),
3790
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),
3791
3810
  c(A(Oe))
3792
- ]),
3811
+ ])]),
3793
3812
  _: 2
3794
3813
  }, 1032, [
3795
3814
  "type",
@@ -3814,10 +3833,10 @@ var $a = { key: 0 }, eo = {
3814
3833
  block: t.block,
3815
3834
  onClick: (e) => A(Me)(t.code)
3816
3835
  }, {
3817
- default: F(() => [t.icon ? (b(), n(A(Da), {
3836
+ default: F(() => [a("div", ro, [t.icon ? (b(), n(A(Da), {
3818
3837
  key: 0,
3819
3838
  icon: t.icon
3820
- }, 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)])]),
3821
3840
  _: 2
3822
3841
  }, 1032, [
3823
3842
  "type",
@@ -3829,8 +3848,8 @@ var $a = { key: 0 }, eo = {
3829
3848
  "ghost",
3830
3849
  "block",
3831
3850
  "onClick"
3832
- ])) : (b(), i("div", no))], 64))), 128)) : r("", !0)]), a("span", ro, [A(k).tools && A(k).tools.length > 0 ? (b(!0), i(e, { key: 0 }, C(A(k).tools, (t, a) => (b(), n(A(I), {
3833
- key: a,
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,
3834
3853
  type: t.type,
3835
3854
  size: t.size ?? "middle",
3836
3855
  disabled: A(k).disabled || t.disabled,
@@ -3841,10 +3860,10 @@ var $a = { key: 0 }, eo = {
3841
3860
  onClick: (e) => A(Pe)(t.code),
3842
3861
  loading: L.toolbar || !!t.code && _e[t.code]
3843
3862
  }, {
3844
- default: F(() => [t.icon ? (b(), n(A(Da), {
3863
+ default: F(() => [a("div", oo, [t.icon ? (b(), n(A(Da), {
3845
3864
  key: 0,
3846
3865
  icon: t.icon
3847
- }, 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)])]),
3848
3867
  _: 2
3849
3868
  }, 1032, [
3850
3869
  "type",
@@ -3860,8 +3879,8 @@ var $a = { key: 0 }, eo = {
3860
3879
  a("div", {
3861
3880
  ref_key: "tableWrapperEl",
3862
3881
  ref: se,
3863
- class: h(`p-pane flex-1 h-0 min-h-0 flex flex-col p-${A(te) ?? "inner"}-scroll`)
3864
- }, [a("div", io, [(b(), n(A(xe), p({
3882
+ class: h(l.fitContent ? "p-pane" : `p-pane flex-1 h-0 min-h-0 flex flex-col p-${A(te) ?? "inner"}-scroll`)
3883
+ }, [a("div", { class: h(l.fitContent ? "p-grid-table-body" : "p-grid-table-body flex-1 min-h-0 overflow-hidden") }, [(b(), n(A(xe), p({
3865
3884
  key: ge.value + "_table",
3866
3885
  "row-key": l.rowKey ?? "id",
3867
3886
  ref_key: "tableEl",
@@ -3908,11 +3927,11 @@ var $a = { key: 0 }, eo = {
3908
3927
  "data-source",
3909
3928
  "loading",
3910
3929
  "scroll"
3911
- ]))]), a("div", {
3930
+ ]))], 2), a("div", {
3912
3931
  ref_key: "tableFooterEl",
3913
3932
  ref: ce,
3914
3933
  class: "flex-shrink-0"
3915
- }, [Te.value !== "pagination" && De.value ? (b(), i("div", ao, " 已选:" + D(R.value.length), 1)) : Te.value === "pagination" ? (b(), i("div", oo, [a("div", so, [De.value ? (b(), i(e, { key: 0 }, [s(" 已选:" + D(R.value.length), 1)], 64)) : r("", !0)]), c(v, {
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, {
3916
3935
  size: "small",
3917
3936
  responsive: !1,
3918
3937
  "show-size-changer": !0,
@@ -3930,7 +3949,7 @@ var $a = { key: 0 }, eo = {
3930
3949
  ], 64))], 16);
3931
3950
  };
3932
3951
  }
3933
- }), lo = /* @__PURE__ */ Re((/* @__PURE__ */ H(((e, t) => {
3952
+ }), fo = /* @__PURE__ */ Re((/* @__PURE__ */ H(((e, t) => {
3934
3953
  (function() {
3935
3954
  try {
3936
3955
  if (typeof document < "u") {
@@ -10142,7 +10161,7 @@ var $a = { key: 0 }, eo = {
10142
10161
  }
10143
10162
  return $t;
10144
10163
  });
10145
- })))(), 1), uo = /* @__PURE__ */ l((e, { emit: t }) => {
10164
+ })))(), 1), po = /* @__PURE__ */ l((e, { emit: t }) => {
10146
10165
  let { cellRender: n, renderTableParams: r } = e, { row: i, field: a } = r;
10147
10166
  if (a) {
10148
10167
  let e = S(i[a]);
@@ -10152,7 +10171,7 @@ var $a = { key: 0 }, eo = {
10152
10171
  name: "RenderEditCell",
10153
10172
  props: ["cellRender", "renderTableParams"],
10154
10173
  emits: ["blur"]
10155
- }), fo = /* @__PURE__ */ l({
10174
+ }), mo = /* @__PURE__ */ l({
10156
10175
  __name: "PCanvasTable",
10157
10176
  props: {
10158
10177
  columns: {},
@@ -10211,7 +10230,7 @@ var $a = { key: 0 }, eo = {
10211
10230
  children: e.children?.map((e) => ce(e))
10212
10231
  });
10213
10232
  y(() => {
10214
- D.value && (v = new lo.default(D.value, {
10233
+ D.value && (v = new fo.default(D.value, {
10215
10234
  config: g.value.config,
10216
10235
  columns: f.columns.map((e) => ce(e)),
10217
10236
  data: f.data,
@@ -10287,7 +10306,7 @@ var $a = { key: 0 }, eo = {
10287
10306
  "style",
10288
10307
  "value",
10289
10308
  "cell"
10290
- ])) : A(Fa).renders[P.value]?.renderEdit ? (b(), n(A(uo), {
10309
+ ])) : A(Fa).renders[P.value]?.renderEdit ? (b(), n(A(po), {
10291
10310
  key: 1,
10292
10311
  "cell-render": ne[M.value.key],
10293
10312
  class: "ev-editor-wrapper",
@@ -10337,13 +10356,13 @@ var $a = { key: 0 }, eo = {
10337
10356
  }, 8, ["spinning"]);
10338
10357
  };
10339
10358
  }
10340
- }), po = { key: 0 }, mo = {
10359
+ }), ho = { key: 0 }, go = {
10341
10360
  key: 1,
10342
10361
  class: "p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"
10343
- }, ho = { class: "flex items-center flex-1 gap-4px" }, go = { key: 2 }, _o = { class: "flex items-center gap-4px" }, vo = {
10362
+ }, _o = { class: "flex items-center flex-1 gap-4px" }, vo = { key: 2 }, yo = { class: "flex items-center gap-4px" }, bo = {
10344
10363
  key: 0,
10345
10364
  class: "w-full text-slate-5 pl-4"
10346
- }, yo = /* @__PURE__ */ l({
10365
+ }, xo = /* @__PURE__ */ l({
10347
10366
  __name: "PCanvasGrid",
10348
10367
  props: {
10349
10368
  staticConfig: {},
@@ -10549,7 +10568,7 @@ var $a = { key: 0 }, eo = {
10549
10568
  ref_key: "boxEl",
10550
10569
  ref: _e,
10551
10570
  class: "h-full p-wrapper flex flex-col gap-8px overflow-y-auto"
10552
- }, A(_)), [ce.value === "bad" ? (b(), i("div", po, "请检查配置")) : (b(), i(e, { key: 1 }, [
10571
+ }, A(_)), [ce.value === "bad" ? (b(), i("div", ho, "请检查配置")) : (b(), i(e, { key: 1 }, [
10553
10572
  A(k)?.items?.some((e) => e.field && e.itemRender) ? (b(), i("div", {
10554
10573
  key: 0,
10555
10574
  class: "p-pane p-form-wrapper",
@@ -10575,7 +10594,7 @@ var $a = { key: 0 }, eo = {
10575
10594
  }, 16, ["model"]))]),
10576
10595
  _: 1
10577
10596
  }, 8, ["spinning"])], 512)) : r("", !0),
10578
- A(P) ? (b(), i("div", mo, [a("div", ho, [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 }, {
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 }, {
10579
10598
  overlay: F(() => [c(f, { onClick: je }, {
10580
10599
  default: F(() => [(b(!0), i(e, null, C(t.dropdowns, (e) => (b(), n(d, { key: e.code }, {
10581
10600
  default: F(() => [s(D(e.content), 1)]),
@@ -10640,7 +10659,7 @@ var $a = { key: 0 }, eo = {
10640
10659
  "ghost",
10641
10660
  "block",
10642
10661
  "onClick"
10643
- ])) : (b(), i("div", go))], 64))), 128)) : r("", !0)]), a("span", _o, [A(P).tools && A(P).tools.length > 0 ? (b(!0), i(e, { key: 0 }, C(A(P).tools, (e, t) => (b(), n(A(I), {
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), {
10644
10663
  key: t,
10645
10664
  type: e.type,
10646
10665
  size: e.size ?? "middle",
@@ -10673,8 +10692,8 @@ var $a = { key: 0 }, eo = {
10673
10692
  ref: be,
10674
10693
  class: h("p-pane flex-1 h-0 p-inner-scroll")
10675
10694
  }, [
10676
- A(L)?.selectable && A(L).showCount ? (b(), i("div", vo, " 已选:" + D(De.value.length), 1)) : r("", !0),
10677
- c(fo, {
10695
+ A(L)?.selectable && A(L).showCount ? (b(), i("div", bo, " 已选:" + D(De.value.length), 1)) : r("", !0),
10696
+ c(mo, {
10678
10697
  ref_key: "canvasTableRef",
10679
10698
  ref: ge,
10680
10699
  columns: ze.value,
@@ -10711,7 +10730,7 @@ var $a = { key: 0 }, eo = {
10711
10730
  ], 64))], 16);
10712
10731
  };
10713
10732
  }
10714
- }), bo = /* @__PURE__ */ l({
10733
+ }), So = /* @__PURE__ */ l({
10715
10734
  __name: "PGroupBlock",
10716
10735
  props: {
10717
10736
  name: {},
@@ -10726,7 +10745,7 @@ var $a = { key: 0 }, eo = {
10726
10745
  ref: a
10727
10746
  }, c.value, { data: A(o) }), null, 16, ["name", "data"]));
10728
10747
  }
10729
- }), xo = /* @__PURE__ */ l({
10748
+ }), Co = /* @__PURE__ */ l({
10730
10749
  __name: "CollapseCard",
10731
10750
  props: {
10732
10751
  defaultCollapsed: {
@@ -10775,7 +10794,7 @@ var $a = { key: 0 }, eo = {
10775
10794
  }))]), 1032, ["title"]));
10776
10795
  };
10777
10796
  }
10778
- }), So = /* @__PURE__ */ l({
10797
+ }), wo = /* @__PURE__ */ l({
10779
10798
  __name: "PFormGroup",
10780
10799
  props: /* @__PURE__ */ f({
10781
10800
  name: {},
@@ -10913,7 +10932,7 @@ var $a = { key: 0 }, eo = {
10913
10932
  })));
10914
10933
  return (t, u) => {
10915
10934
  let d = T("a-spin");
10916
- return b(), n(xo, {
10935
+ return b(), n(Co, {
10917
10936
  ref_key: "rootRef",
10918
10937
  ref: h,
10919
10938
  title: l.title,
@@ -10964,7 +10983,7 @@ var $a = { key: 0 }, eo = {
10964
10983
  default: F(() => [c(A(Ae))]),
10965
10984
  _: 2
10966
10985
  }, 1024)) : r("", !0)]),
10967
- default: F(() => [(b(), n(bo, {
10986
+ default: F(() => [(b(), n(So, {
10968
10987
  ref_for: !0,
10969
10988
  ref_key: "blockInstance",
10970
10989
  ref: y,
@@ -10996,7 +11015,7 @@ var $a = { key: 0 }, eo = {
10996
11015
  ]);
10997
11016
  };
10998
11017
  }
10999
- }), Co = { class: "w-full text-right p-2" }, wo = /* @__PURE__ */ l({
11018
+ }), To = { class: "w-full text-right p-2" }, Eo = /* @__PURE__ */ l({
11000
11019
  __name: "PromisePicker",
11001
11020
  props: {
11002
11021
  gridSetting: {},
@@ -11013,65 +11032,70 @@ var $a = { key: 0 }, eo = {
11013
11032
  }
11014
11033
  },
11015
11034
  setup(e, { expose: r }) {
11016
- let i = S(), l = S(!1), u = e, d = t(() => u.gridSetting.selectConfig?.multiple), f, h, g, v = x({ modal: !1 }), C = () => {
11035
+ let i = S(), l = e, u = t(() => l.gridSetting.selectConfig?.multiple), d = t(() => ({
11036
+ fitContent: !0,
11037
+ ...l.gridSetting
11038
+ })), f = {
11039
+ display: "flex",
11040
+ flexDirection: "column",
11041
+ minHeight: 0,
11042
+ maxHeight: "min(80dvh, calc(100dvh - 200px))",
11043
+ overflow: "hidden"
11044
+ }, m, h, g, _ = x({ modal: !1 }), v = () => {
11017
11045
  g && g();
11018
- }, w = () => {
11019
- v.modal = !1, g && g();
11020
- }, T = ({ row: e, field: t }) => {
11021
- f && !d.value && u.beforePick(e).then(() => {
11022
- v.modal = !1, f({
11046
+ }, y = () => {
11047
+ _.modal = !1, g && g();
11048
+ }, C = ({ row: e, field: t }) => {
11049
+ m && !u.value && l.beforePick(e).then(() => {
11050
+ _.modal = !1, m({
11023
11051
  row: e,
11024
11052
  field: t
11025
11053
  });
11026
11054
  });
11027
- }, E = () => {
11055
+ }, w = () => {
11028
11056
  let e = i.value?.selectedRecords ?? [];
11029
- e.length === 0 && !u.multipleAllowEmpty ? Ka("请选择数据") : u.beforePick(e).then(() => {
11030
- v.modal = !1, h(e);
11057
+ e.length === 0 && !l.multipleAllowEmpty ? Ka("请选择数据") : l.beforePick(e).then(() => {
11058
+ _.modal = !1, h(e);
11031
11059
  });
11032
11060
  };
11033
- return y(() => {}), r({
11061
+ return r({
11034
11062
  pick: () => new Promise((e, t) => {
11035
- f = e, g = t, l.value = !1, v.modal = !0, m(() => {
11036
- l.value = !0;
11037
- });
11063
+ m = e, g = t, _.modal = !0;
11038
11064
  }),
11039
11065
  pickMultiple: () => new Promise((e, t) => {
11040
- h = e, g = t, l.value = !1, v.modal = !0, m(() => {
11041
- l.value = !0;
11042
- });
11066
+ h = e, g = t, _.modal = !0;
11043
11067
  }),
11044
11068
  grid: i,
11045
11069
  hide: () => {
11046
- v.modal = !1;
11070
+ _.modal = !1;
11047
11071
  }
11048
11072
  }), (t, r) => (b(), n(A(ue), {
11049
- open: v.modal,
11050
- "onUpdate:open": r[0] ||= (e) => v.modal = e,
11073
+ open: _.modal,
11074
+ "onUpdate:open": r[0] ||= (e) => _.modal = e,
11051
11075
  "destroy-on-close": "",
11052
11076
  title: e.title,
11053
11077
  width: e.width,
11054
- footer: d.value ? void 0 : null,
11055
- onCancel: C,
11078
+ footer: u.value ? void 0 : null,
11079
+ onCancel: v,
11056
11080
  "body-style": e.bodyStyle
11057
11081
  }, o({
11058
- default: F(() => [a("div", { style: _({ minHeight: l.value ? "unset" : "642px" }) }, [c(co, p(e.gridSetting, {
11082
+ default: F(() => [a("div", { style: f }, [c(uo, p(d.value, {
11059
11083
  ref_key: "gridEl",
11060
11084
  ref: i,
11061
- onPick: T
11062
- }), null, 16)], 4)]),
11085
+ onPick: C
11086
+ }), null, 16)])]),
11063
11087
  _: 2
11064
- }, [d.value ? {
11088
+ }, [u.value ? {
11065
11089
  name: "footer",
11066
- fn: F(() => [a("div", Co, [a("span", null, [c(A(I), {
11090
+ fn: F(() => [a("div", To, [a("span", null, [c(A(I), {
11067
11091
  class: "mr-4",
11068
- onClick: w
11092
+ onClick: y
11069
11093
  }, {
11070
11094
  default: F(() => [...r[1] ||= [s(" 取消 ", -1)]]),
11071
11095
  _: 1
11072
11096
  }), c(A(I), {
11073
11097
  type: "primary",
11074
- onClick: E
11098
+ onClick: w
11075
11099
  }, {
11076
11100
  default: F(() => [...r[2] ||= [s(" 确定 ", -1)]]),
11077
11101
  _: 1
@@ -11088,16 +11112,16 @@ var $a = { key: 0 }, eo = {
11088
11112
  });
11089
11113
  //#endregion
11090
11114
  //#region src/index.ts
11091
- function To(e) {
11115
+ function Do(e) {
11092
11116
  e && ia(e);
11093
11117
  }
11094
- var Eo = {
11118
+ var Oo = {
11095
11119
  install(e) {
11096
- e.component("PForm", Va), e.component("PGrid", co), e.component("PCanvasTable", fo), e.component("PCanvasGrid", yo), e.component("PFormGroup", So), e.component("PGroupBlock", bo), e.component("PromisePicker", wo);
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);
11097
11121
  },
11098
11122
  addFormatter: Sa,
11099
11123
  addRender: Pa,
11100
- setup: To
11124
+ setup: Do
11101
11125
  };
11102
11126
  //#endregion
11103
- export { yo as PCanvasGrid, fo as PCanvasTable, Va as PForm, So as PFormGroup, co as PGrid, bo as PGroupBlock, wo as PromisePicker, Sa as addFormatter, Pa as addRender, Xa as applyViewportRestSize, da as cleanCol, Qa as createAutoViewportBoxController, Eo 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, To as setup, va as watchPreviousDeep };
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
@@ -59,8 +59,15 @@ export declare interface AjaxConfig<F extends Recordable = Recordable> {
59
59
  declare type Align = 'left' | 'center' | 'right';
60
60
 
61
61
  /**
62
- * 宽/高先按「视口内从元素左上角到右/下边缘」计算,再与**直接父元素**布局框取较小值,
63
- * 避免嵌套在侧栏 + flex 列等窄容器里仍按整屏宽度赋值,从而撑出页面级横向滚动条。
62
+ * 宽/高先按「视口内从元素左上角到右/下边缘」计算。
63
+ *
64
+ * 宽度会再与**直接父元素**布局框取较小值,避免嵌套在侧栏 + flex 列等窄容器里仍按整屏宽度赋值,
65
+ * 从而撑出页面级横向滚动条。
66
+ *
67
+ * 高度不做 parent 截断:autoBoxSize 的语义就是「一直撑到视口底」。若对 parent 取 min,
68
+ * 遇到「父容器没有明确高度、靠子元素内容撑开」的常见布局(外层未写死高度,p-grid 根节点
69
+ * 自身决定可视高度),会形成循环依赖(子依赖父、父又靠子撑开),导致高度被截成极小值,
70
+ * 反映到 PGrid 上就是表体下方出现大面积空白。
64
71
  */
65
72
  export declare function applyViewportRestSize(el: HTMLElement, offset: AutoViewportBoxOffset): void;
66
73
 
@@ -2574,6 +2581,15 @@ export declare type PGridProps<D extends Recordable = Recordable, F extends Reco
2574
2581
  * 虚拟列表 Y区计算高度
2575
2582
  */
2576
2583
  renderY?: number;
2584
+ /**
2585
+ * 适应「外层高度由内容撑开」的布局(典型如弹窗 `PromisePicker`)。
2586
+ *
2587
+ * 开启后:
2588
+ * - 根容器/表体宿主不再 `flex:1` 强行撑满(避免父无固定高度时塌陷到 0);
2589
+ * - `a-table` 的纵向 `scroll.y` 作为「最多滚动到多少」的上限,由 `renderY` 显式指定;
2590
+ * 若不传 `renderY`,使用基于视口的默认值。内容少时不会出现行区域下方的大片空白。
2591
+ */
2592
+ fitContent?: boolean;
2577
2593
  };
2578
2594
 
2579
2595
  export declare const PGroupBlock: <F extends Recordable = Recordable>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal_4<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
@@ -2961,6 +2977,12 @@ export declare interface UIKitConfig {
2961
2977
  * @param content tooltip 内容,字符串或返回 VNode 的函数
2962
2978
  */
2963
2979
  renderTooltip?: (defaultSlot: () => VNode, content: string | (() => VNode)) => VNode;
2980
+ /**
2981
+ * 自定义图标:按 `icon` 名字渲染;返回值为真时优先于 `@ant-design/icons-vue` 同名组件。
2982
+ */
2983
+ icon?: {
2984
+ render?: (name: string) => unknown;
2985
+ };
2964
2986
  }
2965
2987
 
2966
2988
  declare interface ValidateErrorEntity<Values = any> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -256,6 +256,15 @@ export type PGridProps<D extends Recordable = Recordable, F extends Recordable =
256
256
  * 虚拟列表 Y区计算高度
257
257
  */
258
258
  renderY?: number;
259
+ /**
260
+ * 适应「外层高度由内容撑开」的布局(典型如弹窗 `PromisePicker`)。
261
+ *
262
+ * 开启后:
263
+ * - 根容器/表体宿主不再 `flex:1` 强行撑满(避免父无固定高度时塌陷到 0);
264
+ * - `a-table` 的纵向 `scroll.y` 作为「最多滚动到多少」的上限,由 `renderY` 显式指定;
265
+ * 若不传 `renderY`,使用基于视口的默认值。内容少时不会出现行区域下方的大片空白。
266
+ */
267
+ fitContent?: boolean;
259
268
  };
260
269
 
261
270
  export interface RenderOptions {
@@ -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';
@@ -62,6 +62,7 @@
62
62
  fitHeight: () => getGridDefaults().fitHeight ?? 30,
63
63
  striped: () => getGridDefaults().striped ?? false,
64
64
  autoBoxSize: false,
65
+ fitContent: false,
65
66
  });
66
67
 
67
68
  const {
@@ -484,6 +485,13 @@
484
485
  renderHeight.value = props.renderY as number;
485
486
  return;
486
487
  }
488
+ // 内容撑开模式(弹窗等):scroll.y 作为上限,内容不足时 a-table-body 按自然高度展示。
489
+ if (props.fitContent) {
490
+ const vh = typeof window !== 'undefined' ? window.innerHeight : 800;
491
+ const reserve = props.fitHeight ?? 30;
492
+ renderHeight.value = Math.max(Math.floor(vh * 0.6) - reserve, 160);
493
+ return;
494
+ }
487
495
  const wrapperH = tableWrapperEl.value.clientHeight;
488
496
  const footerH = tableFooterEl.value?.offsetHeight ?? 0;
489
497
  const tableHeaderEl = resolveTableHeaderEl(tableWrapperEl.value);
@@ -605,8 +613,12 @@
605
613
  <div
606
614
  ref="boxEl"
607
615
  :class="[
608
- 'p-wrapper flex flex-col gap-8px overflow-y-auto',
609
- autoBoxSize ? 'min-h-0 min-w-0 flex-1 w-full' : 'h-full',
616
+ 'p-wrapper flex flex-col gap-8px',
617
+ fitContent
618
+ ? 'w-full h-auto'
619
+ : autoBoxSize
620
+ ? 'overflow-y-auto min-h-0 min-w-0 flex-1 w-full'
621
+ : 'overflow-y-auto h-full',
610
622
  ]"
611
623
  v-bind="attrs"
612
624
  >
@@ -666,12 +678,14 @@
666
678
  :ghost="btn.ghost"
667
679
  :block="btn.block"
668
680
  >
669
- <Icon v-if="btn.icon" :icon="btn.icon" />
670
- <template v-if="btn.content && isStringContent(renderContent(btn.content))">
671
- {{ renderContent(btn.content) }}
672
- </template>
673
- <component v-else-if="btn.content" :is="renderContent(btn.content)" />
674
- <DownOutlined />
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>
675
689
  </a-button>
676
690
  </a-dropdown>
677
691
  <a-button
@@ -686,11 +700,13 @@
686
700
  :block="btn.block"
687
701
  @click="debounceToolBtnClick(btn.code)"
688
702
  >
689
- <Icon v-if="btn.icon" :icon="btn.icon" />
690
- <template v-if="btn.content && isStringContent(renderContent(btn.content))">
691
- {{ renderContent(btn.content) }}
692
- </template>
693
- <component v-else-if="btn.content" :is="renderContent(btn.content)" />
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>
694
710
  </a-button>
695
711
  <div v-else></div>
696
712
  </template>
@@ -711,20 +727,30 @@
711
727
  @click="debounceToolToolClick(tool.code)"
712
728
  :loading="loading.toolbar || (!!tool.code && codeLoadings[tool.code])"
713
729
  >
714
- <Icon v-if="tool.icon" :icon="tool.icon" />
715
- <template v-if="tool.content && isStringContent(renderContent(tool.content))">
716
- {{ renderContent(tool.content) }}
717
- </template>
718
- <component v-else-if="tool.content" :is="renderContent(tool.content)" />
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>
719
737
  </a-button>
720
738
  </template>
721
739
  </span>
722
740
  </div>
723
741
  <div
724
742
  ref="tableWrapperEl"
725
- :class="`p-pane flex-1 h-0 min-h-0 flex flex-col p-${scrollMode ?? 'inner'}-scroll`"
743
+ :class="
744
+ fitContent
745
+ ? 'p-pane'
746
+ : `p-pane flex-1 h-0 min-h-0 flex flex-col p-${scrollMode ?? 'inner'}-scroll`
747
+ "
726
748
  >
727
- <div class="p-grid-table-body flex-1 min-h-0 overflow-hidden">
749
+ <div
750
+ :class="
751
+ fitContent ? 'p-grid-table-body' : 'p-grid-table-body flex-1 min-h-0 overflow-hidden'
752
+ "
753
+ >
728
754
  <a-table
729
755
  :key="renderTableKey + '_table'"
730
756
  :row-key="rowKey ?? 'id'"