@snabcentr/vue-ui-lib 6.0.1 → 6.0.2

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.
@@ -24494,6 +24494,10 @@ var nD = it({
24494
24494
  inactive: {
24495
24495
  type: Boolean,
24496
24496
  default: !1
24497
+ },
24498
+ showActions: {
24499
+ type: Boolean,
24500
+ default: void 0
24497
24501
  }
24498
24502
  },
24499
24503
  setup(e) {
@@ -24516,7 +24520,7 @@ var nD = it({
24516
24520
  "allow-edit",
24517
24521
  "update-quantity-on-input",
24518
24522
  "class"
24519
- ]), e.allowEdit ? z(t.$slots, "actions", {}, void 0, void 0, 0) : A("", !0)]),
24523
+ ]), e.showActions ?? e.allowEdit ? z(t.$slots, "actions", {}, void 0, void 0, 0) : A("", !0)]),
24520
24524
  M("div", { class: lt(["grid grid-flow-col grid-rows-2 gap-1 text-base", n.value]) }, [
24521
24525
  r[0] ||= M("span", null, "Цена за ед.", -1),
24522
24526
  P(na, {
@@ -24528,7 +24532,8 @@ var nD = it({
24528
24532
  product: e.product,
24529
24533
  "cost-field-name": "cost"
24530
24534
  }, null, 8, ["product"])
24531
- ], 2)
24535
+ ], 2),
24536
+ z(t.$slots, "extra")
24532
24537
  ])]));
24533
24538
  }
24534
24539
  }), TD = { class: "flex items-center gap-1.5" }, ED = {
@@ -24652,6 +24657,10 @@ var MD = it({
24652
24657
  type: Function,
24653
24658
  default: void 0
24654
24659
  },
24660
+ isItemRemovable: {
24661
+ type: Function,
24662
+ default: void 0
24663
+ },
24655
24664
  updateQuantityOnInput: {
24656
24665
  type: Boolean,
24657
24666
  default: !0
@@ -24662,23 +24671,28 @@ var MD = it({
24662
24671
  }),
24663
24672
  emits: ["update:selectedRowKeys"],
24664
24673
  setup(e) {
24665
- let t = e, n = Et(e, "selectedRowKeys"), r = (e) => Re(e, "ord"), i = O(() => r(t.products)), a = (e) => t.isItemInactive ? t.isItemInactive(e) : !!e.isRemoved || !!e.replacementId, o = (e) => t.isItemSelectable ? t.isItemSelectable(e) : !a(e), s = (e, t) => {
24674
+ let t = e, n = Et(e, "selectedRowKeys"), r = (e) => Re(e, "ord"), i = O(() => r(t.products)), a = (e) => t.isItemInactive ? t.isItemInactive(e) : !!e.isRemoved || !!e.replacementId, o = (e) => t.isItemSelectable ? t.isItemSelectable(e) : !a(e), s = (e) => t.isItemRemovable ? t.isItemRemovable(e) : !a(e), c = (e, t) => {
24666
24675
  t ? n.value.includes(e) || (n.value = [...n.value, e]) : n.value = n.value.filter((t) => t !== e);
24667
- }, c = (e) => t.selectable ? { class: n.value.includes(e.id) ? void 0 : "opacity-60" } : {}, l = (e, t) => {
24676
+ }, l = (e) => t.selectable ? { class: n.value.includes(e.id) ? void 0 : "opacity-60" } : {}, u = (e, t) => {
24668
24677
  let n = i.value, r = e.logicGroupId;
24669
24678
  if (!r) return 1;
24670
24679
  let a = n.at(t - 1);
24671
24680
  if (t && a && a.logicGroupId === r) return 0;
24672
24681
  let o = n.slice(t), s = o.findIndex((e) => e.logicGroupId !== r);
24673
24682
  return s === -1 ? o.length : s;
24674
- }, u = (e) => a(e) ? null : I(nn, {
24683
+ }, d = (e) => s(e) ? I(nn, {
24675
24684
  quaternary: !0,
24676
24685
  size: "small",
24677
24686
  type: "error",
24678
24687
  onClick: () => {
24679
24688
  t.eventEmitter?.emit("order-item:delete", { item: e });
24680
24689
  }
24681
- }, () => I(MD)), d = R(br.getDeviceTypeByResolution()), f = R(window.innerWidth), p = O(() => !Te(t.maxHeight)), m = () => {
24690
+ }, () => I(MD)) : null, f = (e, n) => (t.extraColumns ?? []).flatMap((t) => {
24691
+ let r = t.render?.(e, n);
24692
+ if (Te(r) || r === "" || r === !1) return [];
24693
+ let i = we(t.title) ? t.title(t) : t.title;
24694
+ return [I("div", { class: "flex flex-col items-start gap-1 text-sm" }, [I("span", { class: "text-sc-dark-grey" }, [i]), r])];
24695
+ }), p = R(br.getDeviceTypeByResolution()), m = R(window.innerWidth), h = O(() => !Te(t.maxHeight) || !Te(t.groups)), g = () => {
24682
24696
  let e = [
24683
24697
  {
24684
24698
  title: "№ п.п.",
@@ -24691,13 +24705,14 @@ var MD = it({
24691
24705
  title: "Артикул",
24692
24706
  key: "codeNumber",
24693
24707
  resizable: !0,
24694
- width: f.value >= 1536 ? 156 : 120,
24708
+ width: m.value >= 1536 ? 156 : 120,
24695
24709
  render: (e) => I("span", { class: `text-base${a(e) ? " line-through opacity-50" : ""}` }, [e.product.code])
24696
24710
  },
24697
24711
  {
24698
24712
  title: "Наименование",
24699
24713
  key: "name",
24700
24714
  resizable: !0,
24715
+ minWidth: Te(t.groups) ? void 0 : 240,
24701
24716
  render: (e) => I(bD, {
24702
24717
  item: e,
24703
24718
  inactive: a(e)
@@ -24708,7 +24723,7 @@ var MD = it({
24708
24723
  key: "quantity",
24709
24724
  resizable: !0,
24710
24725
  width: 180,
24711
- rowSpan: l,
24726
+ rowSpan: u,
24712
24727
  render: (e) => I(qE, {
24713
24728
  class: a(e) ? "line-through opacity-50" : "",
24714
24729
  item: e,
@@ -24721,7 +24736,7 @@ var MD = it({
24721
24736
  title: "Цена за ед.",
24722
24737
  key: "costOneRub",
24723
24738
  resizable: !0,
24724
- width: p.value ? 170 : 120,
24739
+ width: h.value ? 170 : 120,
24725
24740
  render: (e) => I("div", { class: a(e) ? "line-through opacity-50" : "" }, [I(na, {
24726
24741
  product: e,
24727
24742
  costFieldName: "costOne",
@@ -24732,7 +24747,7 @@ var MD = it({
24732
24747
  title: "Сумма",
24733
24748
  key: "cost",
24734
24749
  resizable: !0,
24735
- width: p.value ? 140 : 120,
24750
+ width: h.value ? 140 : 120,
24736
24751
  render: (e) => I("div", { class: a(e) ? "line-through opacity-50" : "" }, [I(na, {
24737
24752
  product: e,
24738
24753
  costFieldName: "cost",
@@ -24744,8 +24759,8 @@ var MD = it({
24744
24759
  title: "",
24745
24760
  key: "delete",
24746
24761
  width: 44,
24747
- rowSpan: l,
24748
- render: (e) => u(e)
24762
+ rowSpan: u,
24763
+ render: (e) => d(e)
24749
24764
  }] : []
24750
24765
  ], r = t.selectable ? [{
24751
24766
  key: "checkbox",
@@ -24755,7 +24770,7 @@ var MD = it({
24755
24770
  cellProps: (e) => ({
24756
24771
  class: o(e) ? "cursor-pointer" : void 0,
24757
24772
  onClick: () => {
24758
- o(e) && s(e.id, !n.value.includes(e.id));
24773
+ o(e) && c(e.id, !n.value.includes(e.id));
24759
24774
  }
24760
24775
  }),
24761
24776
  render: (e) => I(rn, {
@@ -24763,58 +24778,68 @@ var MD = it({
24763
24778
  disabled: !o(e)
24764
24779
  })
24765
24780
  }] : [];
24766
- switch (d.value) {
24781
+ switch (p.value) {
24767
24782
  case yr.phone:
24768
24783
  case yr.tablet: return [...r, {
24769
24784
  title: "",
24770
24785
  key: "items",
24771
24786
  resizable: !0,
24772
24787
  render: (e, n) => {
24773
- let r = l(e, n) > 0, i = t.allowEdit && !a(e) && r;
24788
+ let r = u(e, n) > 0, i = t.allowEdit && !a(e) && r;
24774
24789
  return I(wD, {
24775
24790
  product: e,
24776
24791
  index: n,
24777
24792
  eventEmitter: t.eventEmitter,
24778
24793
  allowEdit: i,
24779
24794
  updateQuantityOnInput: t.updateQuantityOnInput,
24780
- inactive: a(e)
24781
- }, { actions: () => u(e) });
24795
+ inactive: a(e),
24796
+ showActions: t.allowEdit && r
24797
+ }, {
24798
+ actions: () => d(e),
24799
+ extra: () => f(e, n)
24800
+ });
24782
24801
  }
24783
24802
  }];
24784
24803
  case yr.laptop: return [...r, ...e];
24785
24804
  default: return [...r, ...e];
24786
24805
  }
24787
- }, h = O(() => m()), g = () => {
24788
- d.value = br.getDeviceTypeByResolution(), f.value = window.innerWidth;
24806
+ }, _ = O(() => g()), v = (e) => {
24807
+ let t = e.width ?? e.minWidth;
24808
+ return Te(t) ? 0 : Number.parseFloat(String(t)) || 0;
24809
+ }, y = O(() => p.value === yr.phone || p.value === yr.tablet ? void 0 : He(_.value, v)), b = () => {
24810
+ p.value = br.getDeviceTypeByResolution(), m.value = window.innerWidth;
24789
24811
  };
24790
24812
  return ht(() => {
24791
- g(), window.addEventListener("resize", g);
24813
+ b(), window.addEventListener("resize", b);
24792
24814
  }), _t(() => {
24793
- window.removeEventListener("resize", g);
24815
+ window.removeEventListener("resize", b);
24794
24816
  }), (t, n) => {
24795
24817
  let a = on;
24796
24818
  return L(), j(D, null, [e.title ? (L(), j("h3", ND, B(e.title), 1)) : A("", !0), e.groups ? (L(!0), j(D, { key: 1 }, bt(e.groups, (t) => (L(), j("div", {
24797
24819
  key: t.name,
24798
24820
  class: "mb-6 last:mb-0"
24799
24821
  }, [M("div", PD, [M("div", FD, [M("span", ID, B(t.name), 1), t.description ? (L(), j("span", LD, B(t.description), 1)) : A("", !0)]), t.summary ? (L(), j("span", RD, B(t.summary), 1)) : A("", !0)]), P(a, {
24800
- columns: h.value,
24822
+ columns: _.value,
24801
24823
  data: r(t.items),
24802
24824
  "row-key": (e) => e.id,
24803
- "row-props": c,
24825
+ "row-props": l,
24804
24826
  "bottom-bordered": !1,
24805
24827
  bordered: !1,
24806
- "max-height": e.maxHeight
24828
+ "max-height": e.maxHeight,
24829
+ "scroll-x": y.value,
24830
+ "table-layout": "fixed"
24807
24831
  }, null, 8, [
24808
24832
  "columns",
24809
24833
  "data",
24810
24834
  "row-key",
24811
- "max-height"
24835
+ "max-height",
24836
+ "scroll-x"
24812
24837
  ])]))), 128)) : (L(), k(a, {
24813
24838
  key: 2,
24814
- columns: h.value,
24839
+ columns: _.value,
24815
24840
  data: i.value,
24816
24841
  "row-key": (e) => e.id,
24817
- "row-props": c,
24842
+ "row-props": l,
24818
24843
  "bottom-bordered": !1,
24819
24844
  bordered: !1,
24820
24845
  "max-height": e.maxHeight
@@ -24826,7 +24851,7 @@ var MD = it({
24826
24851
  ]))], 64);
24827
24852
  };
24828
24853
  }
24829
- }), [["__scopeId", "data-v-40ad851a"]]), BD = {
24854
+ }), [["__scopeId", "data-v-76fe9dca"]]), BD = {
24830
24855
  key: 0,
24831
24856
  class: "text-sc-dark-grey my-2 text-center"
24832
24857
  }, VD = {